package TownBell import ClosureEvents import ClosureForGroups import ClosureTimers import Assets import SoundUtils constant TOWN_BELL_ITEM_ID = 'I00E' constant TOWER_ID = 'h025' constant DUMMY_ID = 'h00D' constant SPELL_DURATION = 30.0 constant snd = new SoundDefinition(Sounds.humanCallToArmsWhat1, false) player lastRinger int usages = 0 public function onTownBell() snd.play() lastRinger = GetManipulatingUnit().getOwner() forUnitsOfPlayer(players[8]) u -> if u.getTypeId() == DUMMY_ID let pos = u.getPos() let facing = u.getFacingAngle() addEffect(Abilities.avatarCaster, pos).destr() u.remove() createUnit(lastRinger, TOWER_ID, pos, facing) doAfter(SPELL_DURATION) -> forUnitsOfPlayer(lastRinger) u -> if u.getTypeId() == TOWER_ID let pos = u.getPos() let facing = u.getFacingAngle() addEffect(UI.goldCredit, pos).destr() u.remove() createUnit(players[8], DUMMY_ID, pos, facing) usages++ init EventListener.add(EVENT_PLAYER_UNIT_PICKUP_ITEM) -> if GetManipulatedItem().getTypeId() == TOWN_BELL_ITEM_ID GetManipulatedItem().remove() onTownBell()