package Faceless import EscaperSensor import ChannelAbilityPreset constant KILL_RADIUS = 64. constant DIMENSION_SHIFTER_ID = 'dims' constant UP_VIS_ID = compiletime(ABIL_ID_GEN.next()) constant DOWN_VIS_ID = compiletime(ABIL_ID_GEN.next()) constant UP_INVIS_ID = compiletime(ABIL_ID_GEN.next()) constant DOWN_INVIS_ID = compiletime(ABIL_ID_GEN.next()) enum WalkerMode VIS INVIS FADEIN FADEOUT public class Faceless extends EscaperSensorSetup let visibleDur = new ConfigValue(2, 0.5, "Visible Duration") let invisDur = new ConfigValue(.5, 0.5, "Invisible Duration") private var color = COLOR_WHITE private var fadeDur = 1. private var mode = WalkerMode.VIS private var dur = visibleDur.get() construct(vec2 pos, player owner, angle facing) super(pos.toVec3(), owner, DIMENSION_SHIFTER_ID, facing, KILL_RADIUS, KILL_RADIUS) setup() construct(vec2 pos, player owner) super(pos.toVec3(), owner, DIMENSION_SHIFTER_ID, KILL_RADIUS, KILL_RADIUS) setup() construct(unit existing) super(existing, KILL_RADIUS, KILL_RADIUS) setup() function setup() setup..setVertexColor(colorA(55,55,55,55))..setScale(0.5) ..addAbility(UP_VIS_ID)..addAbility(DOWN_VIS_ID) ..addAbility(UP_INVIS_ID)..addAbility(DOWN_INVIS_ID) EventListener.add(setup, EVENT_PLAYER_UNIT_SPELL_CAST, () -> onCast()) sleeps = false override function update() super.update() switch mode case WalkerMode.VIS dur -= ANIMATION_PERIOD if dur <= 0 mode = WalkerMode.FADEOUT dur = fadeDur case WalkerMode.INVIS dur -= ANIMATION_PERIOD if dur <= 0 mode = WalkerMode.FADEIN dur = fadeDur case WalkerMode.FADEOUT dur -= ANIMATION_PERIOD color = color.mix(COLOR_BLACK, (fadeDur-dur) / 3.) if dur <= 0 color = COLOR_BLACK mode = WalkerMode.INVIS dur = invisDur.get() case WalkerMode.FADEIN dur -= ANIMATION_PERIOD color = color.mix(COLOR_WHITE, (fadeDur-dur) / 3.) if dur <= 0 color = COLOR_WHITE mode = WalkerMode.VIS dur = visibleDur.get() actor.setVertexColor(color) function onCast() let id = GetSpellAbilityId() switch id case UP_VIS_ID visibleDur.increment(this, 10) case DOWN_VIS_ID visibleDur.decrement(this, 0) case UP_INVIS_ID invisDur.increment(this, 10) case DOWN_INVIS_ID invisDur.decrement(this, 0) ondestroy destroy visibleDur destroy invisDur override function serialize() returns Json let json = super.serialize() json ..addProperty(new Property(KEY_TYPE, FACELESS_INDEX.toString())) return json @objectgen function genSpells() let inc_spell = new ChannelAbilityPreset(UP_VIS_ID, 1, true) inc_spell..presetManaCost(lvl -> 0) ..setHeroAbility(false) ..presetCooldown(lvl -> 0) ..setName("Increase Visible Duration") ..presetIcon("ReplaceableTextures\\CommandButtons\\BTNReplay-Speedup.blp") ..presetHotkey("D") ..presetTooltipNormal(lvl -> "Increase Visible Duration [|cffFFCC00D|r]") ..presetTooltipNormalExtended(lvl -> "") ..presetButtonPosNormal(2, 1) let dec_spell = new ChannelAbilityPreset(DOWN_VIS_ID, 1, true) dec_spell..presetManaCost(lvl -> 0) ..setHeroAbility(false) ..presetCooldown(lvl -> 0) ..setName("Decrease Visible Duration") ..presetIcon("ReplaceableTextures\\CommandButtons\\BTNReplay-Speeddown.blp") ..presetHotkey("C") ..presetTooltipNormal(lvl -> "Decrease Visible Duration [|cffFFCC00C|r]") ..presetTooltipNormalExtended(lvl -> "") ..presetButtonPosNormal(2, 2) let inc_spell2 = new ChannelAbilityPreset(UP_INVIS_ID, 1, true) inc_spell2..presetManaCost(lvl -> 0) ..setHeroAbility(false) ..presetCooldown(lvl -> 0) ..setName("Increase Invisible Duration") ..presetIcon("ReplaceableTextures\\CommandButtons\\BTNReplay-Speedup.blp") ..presetHotkey("R") ..presetTooltipNormal(lvl -> "Increase Invisible Duration [|cffFFCC00R|r]") ..presetTooltipNormalExtended(lvl -> "") ..presetButtonPosNormal(3, 0) let dec_spell2 = new ChannelAbilityPreset(DOWN_INVIS_ID, 1, true) dec_spell2..presetManaCost(lvl -> 0) ..setHeroAbility(false) ..presetCooldown(lvl -> 0) ..setName("Decrease Invisible Duration") ..presetIcon("ReplaceableTextures\\CommandButtons\\BTNReplay-Speeddown.blp") ..presetHotkey("F") ..presetTooltipNormal(lvl -> "Decrease Invisible Duration [|cffFFCC00F|r]") ..presetTooltipNormalExtended(lvl -> "") ..presetButtonPosNormal(3, 1) @objectgen function genShifter() new UnitDefinition(DIMENSION_SHIFTER_ID, 'ugho') ..setAttacksEnabled(0) ..setTargetedAs("air") ..setAnimationCastBackswing(0) ..setShadowImageUnit("") ..setIconGameInterface("ReplaceableTextures\\CommandButtons\\BTNFacelessOne.blp") ..setButtonPositionX(3) ..setButtonPositionY(2) ..setModelFile("Units\\Creeps\\FacelessOne\\FacelessOne.mdl") ..setSelectionScale(0.7) ..setUnitSoundSet("") ..setCollisionSize(1) ..setSpeedBase(180) ..setMovementHeight(20) ..setMovementHeightMinimum(20) ..setMovementType(MovementType.Fly) ..setNormalAbilities(commaList('A01H', 'A01E', REMOVE_OBJECT_ID, GHOST_VIS_ID, INVULNERABILITY_ID)) ..setHotkey("I") ..setName("Dimension Shifter") ..setTooltipBasic("Dimension Shifter [I]") ..setTooltipExtended("Spawns a Dimension Shifter at|cffFFCC00 Rallypoint|n|n|cffD64219Kills Escapers") ..setUpgradesUsed("") ..setCanFlee(false) ..setHitPointsMaximumBase(100000000) ..setSightRadiusDay(0) ..setSightRadiusNight(0) ..setGoldCost(0) ..setFoodCost(0) ..setHideMinimapDisplay(true)