package Weapon import ItemObject import public WeaponTypes import ChannelAbilityPreset public constant WEAPON_DUMMY_ID = compiletime(UNIT_ID_GEN.next()) public constant ATTACK_MELEE = 'A07G' public constant ATTACK_RANGED = 'A07H' // public class WeaponObject extends ItemObject // Escaper holder = null // int weaponId = 0 // construct(vec2 pos, player owner) // super(pos, createItem(weapontypes[weaponId].itemId, pos), createUnit(owner, WEAPON_DUMMY_ID, pos, angle(0))) // EventListener.add(setup, EVENT_PLAYER_UNIT_SPELL_CAST, () -> onCast()) // override function onPickup(Escaper e) // if e.weapon == null // e.weapon = this // e.weaponAttach = e.actor.addEffect(weapontypes[weaponId].attachment, "hand") // holder = e // setup.hide() // holder.actor.addAbility(weapontypes[weaponId].attackAbil) // else // fixItem() // override function onDrop(Escaper e) // holder.actor..removeAbility(weapontypes[weaponId].attackAbil) // holder.weapon = null // e.weaponAttach.destr() // e.weaponAttach = null // holder = null // setup..setXY(pos.toVec2())..show() // fixItem() // function fixItem() // nullTimer(() -> begin // actorItem.setEntity(null) // actorItem.remove() // actorItem = CreateItem(weapontypes[weaponId].itemId, pos.x, pos.y) // actorItem.setUserData(this castTo int) // end) // override function onUse(Escaper e) // weapontypes[weaponId].listener.onAttack(e) // override function update() // if holder != null // pos = holder.pos // function onCast() // let id = GetSpellAbilityId() // for i = 0 to weaponcount - 1 // if weapontypes[i].abilId == id // weaponId = i // actorItem.remove() // actorItem = createItem(weapontypes[weaponId].itemId, pos.toVec2()) // actorItem.setUserData(this castTo int) // class WeaponMissile extends Projectile // int id // construct(vec3 pos, vec2 target, player owner, int id) // super(vec3(pos.x,pos.y,40.), weapon[id].aoe, owner, pos.angleTo2d(target), weapon[id].eff) // setSpeed(18) // setRanged(weapon[id].range) // this.id = id // override function update() // super.update() // GroupEnumUnitsInRange(ENUM_GROUP, pos.x, pos.y, weapon[id].aoe, null) // for u in ENUM_GROUP // var e = u.getEntity() // if e instanceof Boss // var b = e castTo Boss // b.onDamage(owner, weapon[id].dmg) // destroy(this) // else if e instanceof Wall // destroy(this) // ENUM_GROUP.clear() @objectgen function genWeapon() new UnitDefinition(WEAPON_DUMMY_ID, 'hfoo') ..setAttacksEnabled(0) ..setTargetedAs("structure") ..setAnimationBlendTimeseconds(0) ..setAnimationCastBackswing(0) ..setAnimationCastPoint(0) ..setScalingValue(0.35) ..setShadowImageUnit("") ..setShadowImageCenterX(0) ..setShadowImageCenterY(0) ..setShadowImageWidth(0) ..setShadowImageHeight(0) ..setIconGameInterface("ReplaceableTextures\\CommandButtons\\BTNSteelMelee.blp") ..setModelFile("war3mapImported\\sd.mdl") ..setSelectionScale(0.4) ..setSpeedBase(0) ..setTurnRate(0) ..setMovementType(MovementType.None) ..setUnitSoundSet("") ..setCollisionSize(0) ..setNormalAbilities(commaList('A080', REMOVE_OBJECT_ID, GHOST_VIS_ID, INVULNERABILITY_ID)) ..setName("Coin Dummy") ..setUpgradesUsed("") ..setBuildTime(1) ..setUnitClassification("mechanical") ..setHitPointsMaximumBase(100000000) ..setIsaBuilding(true) ..setHideMinimapDisplay(true)