package WeaponTypes import Escaper import Assets import Boss import Minion import BoomerangProjectile import Fx public constant weaponcount = 4 tuple WeaponType(int itemId, int abilId, int attackAbil, string attachment, WeaponListener listener) public interface WeaponListener function onAttack(Escaper attacker) let weapontypes = [ WeaponType('I00U','A081', 'A07G', "weapons\\attachment\\Sabre.mdx", e -> onSabre(e)), WeaponType('I00W','A082', 'A085', "weapons\\attachment\\ThrallHammer.mdx", e -> onHammer(e)), WeaponType('I00V','A083', 'A07H', "weapons\\attachment\\Sabre.mdx", e -> onGlaive(e)), WeaponType('I00Y','A084', 'A086', "weapons\\attachment\\Sabre.mdx", e -> onBow(e)) ] function damageTarget(Entity entity, Escaper escaper, real damage) if entity != null if entity instanceof Boss let b = entity castTo Boss b.onDamage(escaper, damage) if entity instanceof Minion let m = entity castTo Minion m.onDamage(escaper, damage) function onSabre(Escaper e) let facing = e.actor.getFacingAngle() let tpos = e.getPos().toVec2().polarOffset(facing, 64) destroy new Fx(tpos, facing, Abilities.defendCaster) forUnitsInRange(tpos, 100) u -> let entity = u.getEntity() damageTarget(entity, e, 20) function onHammer(Escaper e) let facing = e.actor.getFacingAngle() let tpos = e.getPos().toVec2().polarOffset(facing, 64) addEffect(Abilities.thunderclapCaster, tpos).destr() forUnitsInRange(tpos, 100) u -> let entity = u.getEntity() damageTarget(entity, e, 20) function onGlaive(Escaper e) let tpos = EventData.getSpellTargetPos() new Boomerang(e, tpos) function onBow(Escaper e) let facing = e.actor.getFacingAngle() let tpos = e.getPos().toVec2().polarOffset(facing, 64) addEffect(Abilities.thunderclapCaster, tpos).destr() forUnitsInRange(tpos, 100) u -> let entity = u.getEntity() damageTarget(entity, e, 20)