package Booster import BaseObject constant INFO_BOOSTER_ID = compiletime(ABIL_ID_GEN.next()) constant SPEED_UP_ID = compiletime(ABIL_ID_GEN.next()) constant SPEED_DOWN_ID = compiletime(ABIL_ID_GEN.next()) constant EVENT_RADIUS = 32. constant BOOST_SPEED_KEY = "b" public class Booster extends StaticBaseObject let boostspeed = new ConfigValue(250, 25, "Boostspeed") construct(vec2 pos, player owner) super(pos, createUnit(owner, BOOSTER_ID, pos, angle(0)), EVENT_RADIUS, function Booster.orderMove, null) clearQuestionmark() actor..addAbility(TURN_OFF_ID)..addAbility(GHOST_INVIS_ID) static function orderMove() let source = GetTriggeringTrigger().getSource() let u = GetTriggerUnit() let e = u.getEntity() let obj = source.getEntity() castTo Booster if e instanceof SetupObject let ek = e castTo SetupObject ek.actor.setMoveSpeed(obj.boostspeed.get()) ek.setup.setMoveSpeed(obj.boostspeed.get()) override function onCast() super.onCast() let id = GetSpellAbilityId() switch id case SPEED_UP_ID boostspeed.increment(this, 525) case SPEED_DOWN_ID boostspeed.decrement(this, 25) ondestroy destroy boostspeed override function deserialize(Json json) let speed = json.getInt(BOOST_SPEED_KEY) if speed > 0 boostspeed.setVal(speed * 1.) override function serialize() returns Json let json = super.serialize() json..addProperty(new Property(KEY_TYPE, BOOSTER_INDEX.toString())) if boostspeed.getInt() != 200 json..addProperty(new Property(BOOST_SPEED_KEY, boostspeed.getInt().toString())) return json @objectgen function genBooster() new ChannelAbilityPreset(INFO_BOOSTER_ID, 1, TRUE) ..setName("Information: Booster") ..presetTooltipNormal(lvl -> "Information: Booster") ..presetTooltipNormalExtended(lvl -> "Permanently changes the move speed of entering units.") ..presetIcon("ReplaceableTextures\\CommandButtons\\PASInfo.blp") ..presetButtonPosNormal(0, 0) ..presetTargetTypes(Targettype.PASSIVE) ..setHeroAbility(FALSE) new ChannelAbilityPreset(SPEED_UP_ID, 1, TRUE) ..setName("Booster: Speed up") ..presetTooltipNormal(lvl -> "Increases the boost speed [|cffFFCC00Y|r]") ..presetIcon(Icons.bTNReplay_SpeedUp) ..presetButtonPosNormal(2, 0) ..presetHotkey("Y") ..presetTargetTypes(Targettype.NONE) ..setHeroAbility(FALSE) new ChannelAbilityPreset(SPEED_DOWN_ID, 1, TRUE) ..setName("Booster: Speed down") ..presetTooltipNormal(lvl -> "Decreases the boost speed [|cffFFCC00X|r]") ..presetIcon(Icons.bTNReplay_SpeedDown) ..presetButtonPosNormal(2, 1) ..presetHotkey("X") ..presetTargetTypes(Targettype.NONE) ..setHeroAbility(FALSE) new BuildingDefinition(BOOSTER_ID, 'ncop') ..setName("|cffCE086BBooster") ..setHotkey("S") ..setTooltipBasic("|cffFFCC00Build |cffCE086BBooster [S]") ..setTooltipExtended("Permanently changes the move speed of entering non-escaper units.") ..setIconGameInterface("ReplaceableTextures\\CommandButtons\\BTNBooster.blp") ..setNormalAbilities(commaList(INFO_BOOSTER_ID, SPEED_UP_ID, SPEED_DOWN_ID, REMOVE_OBJECT_ID, GHOST_VIS_ID, INVULNERABILITY_ID)) ..setButtonPositionX(1) ..setButtonPositionY(1) ..setTintingColorGreen(100) ..setSightRadiusDay(0) ..setSightRadiusNight(0) ..setBuildTime(1) ..setCollisionSize(0) ..setScalingValue(0.8) ..setSelectionScale(2.2) ..setUnitClassification("ancient,standon") ..setHideMinimapDisplay(true)