package Jumper import Escaper import BaseObject import SoundUtils import EscaperKillers constant INFO_JUMPER_ID = compiletime(ABIL_ID_GEN.next()) constant DECREASE_FORCE_ID = compiletime(ABIL_ID_GEN.next()) constant INCREASE_FORCE_ID = compiletime(ABIL_ID_GEN.next()) constant MODE_FORCED_ID = compiletime(ABIL_ID_GEN.next()) constant MODE_UNFORCED_ID = compiletime(ABIL_ID_GEN.next()) constant string EFFECT_STRING = "Abilities\\Spells\\Human\\FlakCannons\\FlakTarget.mdl" constant SPECIAL_ID = 'A07O' SoundDefinition snd = new SoundDefinition("Units\\Human\\Priest\\PriestPissed3.wav", false) enum JumpMode FORCED UNFORCED function filter() returns boolean return GetFilterUnit().getTypeId() == JUMPER_ID public class Goo image img vec2 pos construct(image img, vec2 pos) this.img = img this.pos = pos ondestroy let tile = pos.getEBRTile() if tile.hasModifier(TileModifier.BLUGOO) tile.removeModifier(TileModifier.BLUGOO) if tile.hasModifier(TileModifier.ORANGEGOO) tile.removeModifier(TileModifier.ORANGEGOO) img.remove() enum JumpPermission ESCAPER KILLER BOTH public class Jumper extends StaticBaseObject private Goo array[5] goos private var goocounter = 0 var mode = JumpMode.FORCED var permission = JumpPermission.ESCAPER let jumpForce = new ConfigValue(12., 0.5, "Jump Force") construct(unit existing) super(existing.getPos(), existing, 40., function Jumper.onInRange, null) actor.addAbility(TURN_OFF_ID) construct(vec2 pos, player owner) super(pos, createUnit(owner, JUMPER_ID, pos, angle(0)), 40., function Jumper.onInRange, null) actor.addAbility(TURN_OFF_ID) forUnitsInRange(pos, 8) u -> if u != actor and u.getTypeId() == JUMPER_ID snd.play() u.addAbility(SPECIAL_ID) Log.debug("Jumper Terminate") this.terminate() function executeJump(UnitEntity edata) edata.actor.abortOrder() if edata instanceof SetupObject (edata castTo SetupObject).setup..abortOrder() edata.getPos() switch mode case JumpMode.FORCED edata.pos.z = 1 edata.setTarget(getRallyPoint(), jumpForce.get()) case JumpMode.UNFORCED edata.addVel(vec3(0,0, jumpForce.get())) edata.setXY(edata.pos.add(0,0,1.)) flashEffect(EFFECT_STRING, pos) function inRange() let data = GetTriggerUnit().getEntity() if not getRegionData(getRallyPoint()).canBuild(owner) return switch permission case ESCAPER if data instanceof Escaper executeJump(data) case KILLER if data instanceof EscaperSensorSetup executeJump(data) case BOTH if data instanceof Escaper or data instanceof EscaperSensorSetup executeJump(data) static function onInRange() let jdata = GetTriggeringTrigger().getSource().getEntity() castTo Jumper jdata.inRange() override function onCast() super.onCast() let id = GetSpellAbilityId() switch id case MODE_FORCED_ID actor..removeAbility(MODE_FORCED_ID)..addAbility(MODE_UNFORCED_ID)..setVertexColor(color(75,95,205)) mode = JumpMode.UNFORCED clearQuestionmark() case MODE_UNFORCED_ID actor..removeAbility(MODE_UNFORCED_ID)..addAbility(MODE_FORCED_ID)..setVertexColor(color(50,50,255)) mode = JumpMode.FORCED case DECREASE_FORCE_ID jumpForce.decrement(this, 6) case INCREASE_FORCE_ID jumpForce.increment(this, 30) case SPECIAL_ID if goocounter < 5 let tpos = EventData.getSpellTargetPos() let goo = createImage("textures\\blugoo.blp", tpos, 128, 128) ..show() goos[goocounter] = new Goo(goo, tpos) goocounter++ EventData.getSpellTargetPos().getEBRTile().addModifier(TileModifier.BLUGOO) case MODE_BOTH_ID actor..removeAbility(MODE_BOTH_ID)..addAbility(MODE_ESCAPERS_ID) permission = JumpPermission.ESCAPER case MODE_ESCAPERS_ID actor..removeAbility(MODE_ESCAPERS_ID)..addAbility(MODE_KILLERS_ID) permission = JumpPermission.KILLER case MODE_KILLERS_ID actor..removeAbility(MODE_KILLERS_ID)..addAbility(MODE_BOTH_ID) permission = JumpPermission.BOTH override function serialize() returns Json let json = super.serialize() json.addProperty(new Property(KEY_TYPE, JUMPER_INDEX.toString())) json.addProperty(new Property("f", (jumpForce.get() * 100.).toInt().toString())) return json override function deserialize(Json json) super.deserialize(json) jumpForce.setVal(json.getReal("f") / 100.) ondestroy for i = 0 to 4 if goos[i] != null destroy goos[i] destroy jumpForce @objectgen function genJumper() new ChannelAbilityPreset(INFO_JUMPER_ID, 1, TRUE) ..setName("Information: Jumper") ..presetTooltipNormal(lvl -> "Information: Jumper") ..presetTooltipNormalExtended(lvl -> "The Jumper lets an entering Escaper fly to Rallypoint." + "\nThe Escaper cant be harmed in midair.") ..presetIcon("ReplaceableTextures\\CommandButtons\\PASInfo.blp") ..presetButtonPosNormal(0, 0) ..presetTargetTypes(Targettype.PASSIVE) ..setHeroAbility(FALSE) new ChannelAbilityPreset(INCREASE_FORCE_ID, 1, TRUE) ..setName("Jumper: Increase Force") ..presetTooltipNormal(lvl -> "Increase Force [|cffFFCC00W|r]") ..presetTooltipNormalExtended(lvl -> "|cff0884BDIn forced mode|r: Makes the escaper jump |cffFFCC00faster|r," + "and |cffFFCC00lower|n|cff0884BDIn unforced mode|r: Makes the escaper jump |cffFFCC00higher") ..presetIcon("ReplaceableTextures\\CommandButtons\\BTNReplay-Speedup.blp") ..presetButtonPosNormal(1, 0) ..presetHotkey("W") ..presetTargetTypes(Targettype.NONE) ..setHeroAbility(FALSE) new ChannelAbilityPreset(DECREASE_FORCE_ID, 1, TRUE) ..setName("Jumper: Decrease Force") ..presetTooltipNormal(lvl -> "Decrease Force [|cffFFCC00E|r]") ..presetTooltipNormalExtended(lvl -> "|cff0884BDIn forced mode|r: Makes the escaper jump |cffFFCC00slower|r," + "but |cffFFCC00higher|n|cff0884BDIn unforced mode|r: Makes the escaper jump |cffFFCC00lower") ..presetIcon("ReplaceableTextures\\CommandButtons\\BTNReplay-Speeddown.blp") ..presetButtonPosNormal(2, 0) ..presetHotkey("E") ..presetTargetTypes(Targettype.NONE) ..setHeroAbility(FALSE) new ChannelAbilityPreset(MODE_FORCED_ID, 1, TRUE) ..setName("Jumper: Mode Forced") ..presetTooltipNormal(lvl -> "Change Jumper Mode [|cffFFCC00R|r]") ..presetTooltipNormalExtended(lvl -> "The Jump corrently happens onto the Rallypoint.") ..presetIcon("ReplaceableTextures\\CommandButtons\\BTNJumperModeForced.blp") ..presetButtonPosNormal(3, 0) ..presetHotkey("R") ..presetTargetTypes(Targettype.NONE) ..setHeroAbility(FALSE) new ChannelAbilityPreset(MODE_UNFORCED_ID, 1, TRUE) ..setName("Jumper: Mode Unforced") ..presetTooltipNormal(lvl -> "Change Jumper Mode [|cffFFCC00R|r]") ..presetTooltipNormalExtended(lvl -> "Only vertical momentum is applied.") ..presetIcon("ReplaceableTextures\\CommandButtons\\BTNJumperModeUnforced.blp") ..presetButtonPosNormal(3, 0) ..presetHotkey("R") ..presetTargetTypes(Targettype.NONE) ..setHeroAbility(FALSE) new BuildingDefinition(JUMPER_ID, 'ncop') ..setName("|cff085294Jumper") ..setHotkey("C") ..setTooltipBasic("|cffFFCC00Build |cff085294Jumper [C]") ..setTooltipExtended("Fires the Escaper through the air to the rallypoint." + "\nWhile the Escaper flys, he cant be harmed by Escapekillers, Obstacles or unwalkable Terrain.") ..setIconGameInterface("ReplaceableTextures\\CommandButtons\\BTNJumper.blp") ..setNormalAbilities(commaList(INFO_JUMPER_ID, INCREASE_FORCE_ID, DECREASE_FORCE_ID, MODE_FORCED_ID, REMOVE_OBJECT_ID, MAKE_UNIT_INVISIBLE_ID, MODE_ESCAPERS_ID, RALLY_POINT, GHOST_VIS_ID, INVULNERABILITY_ID)) ..setButtonPositionX(2) ..setButtonPositionY(2) ..setTintingColorRed(50) ..setTintingColorGreen(50) ..setSightRadiusDay(0) ..setSightRadiusNight(0) ..setBuildTime(1) ..setCollisionSize(0) ..setScalingValue(0.8) ..setSelectionScale(2.2) ..setUnitClassification("ancient,standon") ..setHideMinimapDisplay(true)