package Arcanery import BaseObject import Escaper import Assets import InstantDummyCaster import Fx import PresetBuffs import Orders constant SILENCE_BUFF_ID = 'BNsi' constant SILENCE_ID = compiletime(ABIL_ID_GEN.next()) constant SILENCE_BUFF = compiletime(createDummyBuffObject("Arcane Silence", "", "ReplaceableTextures\\CommandButtons\\BTNSilence.blp")) constant SILENCE_MODE_ID = compiletime(ABIL_ID_GEN.next()) constant JUMP_MODE_ID = compiletime(ABIL_ID_GEN.next()) constant ORB_MODE_ID = compiletime(ABIL_ID_GEN.next()) class SilenceBufff extends NormalBuff Arcanery arcanery real distance = (256.).squared() construct(Escaper target, Arcanery arcanery) super(9999, SILENCE_BUFF) this.arcanery = arcanery InstantDummyCaster.castTarget(DUMMY_PLAYER, SILENCE_ID, 1, Orders.soulburn, target.actor) apply(target.actor) override function update() super.update() switch arcanery.expMode case TIME case RANGE if arcanery.pos.distanceTo2dSq(target.getPos()) > distance terminate() case USE ondestroy target.removeAbility('BNso') enum ArcaneryMode SILENCE JUMP ORB enum ExpirationMode TIME RANGE USE public class Arcanery extends StaticBaseObject ArcaneryMode arcMode = ArcaneryMode.SILENCE ExpirationMode expMode = ExpirationMode.RANGE Fx currentEffect construct(unit existing) super(existing.getPos(), existing, 102., function onEnterEv, () -> true) clearQuestionmark() currentEffect = new Fx(pos + vec3(0,0,76), angle(0))..setScale(1.25) recreateEffect() construct(vec2 position, player owner) super(position, createUnit(owner, ARCANERY_ID, position, angle(0)), 102., function onEnterEv, () -> true) clearQuestionmark() currentEffect = new Fx(pos + vec3(0,0,76), angle(0))..setScale(1.25) recreateEffect() EventListener.onCast(actor) id -> if not this.done switch id case JUMP_MODE_ID arcMode = ArcaneryMode.JUMP case ORB_MODE_ID arcMode = ArcaneryMode.ORB case SILENCE_MODE_ID arcMode = ArcaneryMode.SILENCE recreateEffect() function recreateEffect() if currentEffect != null switch arcMode case SILENCE currentEffect.setFx(Abilities.silenceTarget) case JUMP currentEffect.setFx("war3mapImported\\BootsofSpeed.mdx") case ORB currentEffect.setFx("TC_EnergyBolt.mdx") function onEnter(Escaper target) printLog(Loglevel.DEBUG, "onEnter(target)") switch arcMode case SILENCE SilenceBufff b = target.actor.getBuff(SilenceBufff.typeId) castTo SilenceBufff if b == null new SilenceBufff(target, this) else b.arcanery = this case JUMP target.actor.addAbility(JUMP_SPELL) case ORB target.actor.addAbility(ORB_SPELL) ondestroy destroy currentEffect currentEffect = null static function onEnterEv() let enter = GetTriggerUnit().getEntity() let obj = GetTriggeringTrigger().getSource().getEntity() castTo Arcanery if enter instanceof Escaper obj.onEnter(enter castTo Escaper) override function serialize() returns Json let json = super.serialize() json..addProperty(new Property(KEY_TYPE, ARCANERY_INDEX.toString())) return json @objectgen function genArcanery() new AbilityDefinitionFirelordSoulBurn(SILENCE_ID) ..setLevels(1) ..setManaCost(1, 0) ..setCastRange(1, 92083) ..setCooldown(1, 0) ..setTargetsAllowed(1, "ground") ..setTooltipNormal(1, "Silence") ..setTooltipNormalExtended(1, "This escaper cannot cast spells") ..setName("Silence") ..setDurationHero(1, 99999) ..setDurationNormal(1, 99999) ..setHeroAbility(false) ..setDamageAmount(1, 0) new BuildingDefinition(ARCANERY_ID, 'ncop') ..setName("|cffFF0202Arcanery") ..setHotkey("E") ..setTooltipBasic("|cffFFCC00Build |cffFFFF08Arcanery |r[|cffFFCC00E|r]") ..setTooltipExtended("Grants or silences spells for the escapers.") ..setIconGameInterface("ReplaceableTextures\\CommandButtons\\BTNarcanery.blp") ..setNormalAbilities(commaList(REMOVE_OBJECT_ID, MAKE_UNIT_INVISIBLE_ID, INVULNERABILITY_ID, SILENCE_MODE_ID, JUMP_MODE_ID, ORB_MODE_ID)) ..setButtonPositionX(2) ..setButtonPositionY(0) ..setTintingColorRed(225) ..setTintingColorGreen(25) ..setTintingColorBlue(25) ..setSightRadiusDay(0) ..setSightRadiusNight(0) ..setBuildTime(1) ..setCollisionSize(0) ..setScalingValue(0.8) ..setSelectionScale(2.2) ..setUnitClassification("ancient,standon") ..setHideMinimapDisplay(true) new ChannelAbilityPreset(SILENCE_MODE_ID, 1, true) ..setName("Mode: Silence") ..presetTooltipNormal(lvl -> "Mode: Silence") ..presetIcon(Icons.bTNSilence) ..presetButtonPosNormal(0, 0) new ChannelAbilityPreset(JUMP_MODE_ID, 1, true) ..setName("Mode: Jump") ..presetTooltipNormal(lvl -> "Mode: Jump") ..presetIcon(Icons.bTNBootsOfSpeed) ..presetButtonPosNormal(1, 0) new ChannelAbilityPreset(ORB_MODE_ID, 1, true) ..setName("Mode: Orb") ..presetTooltipNormal(lvl -> "Mode: Orb") ..presetIcon(Icons.bTNOrb) ..presetButtonPosNormal(2, 0)