package Fountain import SetupObject import Escaper import ChannelAbilityPreset import Assets //constant BOTH_ID = 'fbot' //constant HEAL_ID = 'fhea' WIP //constant CURE_ID = 'fcur' constant string EFFECT_ID = "Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl" public class Fountain extends StaticSetupObject boolean cure = true construct(unit existing) super(existing, createUnit(existing.getOwner(), FOUNTAIN_BOTH_ID, existing.getPos(), (270).asAngleDegrees()), 200., function Fountain.cure) EventListener.add(setup, EVENT_PLAYER_UNIT_SPELL_CAST, () -> onCast()) construct(vec2 pos, player owner) super(createUnit(owner, FOUNTAIN_BOTH_ID, pos, (270).asAngleDegrees()), createUnit(owner, FOUNTAIN_BOTH_ID, pos, (270).asAngleDegrees()), 200., function Fountain.cure) EventListener.add(setup, EVENT_PLAYER_UNIT_SPELL_CAST, () -> onCast()) static function cure() let obj = GetTriggeringTrigger().getSource().getEntity() castTo Fountain let e = GetTriggerUnit().getEntity() if e instanceof Escaper and obj.cure let es = e castTo Escaper if es.poisoned and not es.flying DestroyEffect(AddSpecialEffect(EFFECT_ID,es.pos.x ,es.pos.y)) es.setPoison(false) function onCast() let id = GetSpellAbilityId() switch id case 'A077' setNewActor(CreateUnit(owner, FOUNTAIN_HEAL_ID, pos.x, pos.y, 270.)) actor.addAbility(LOCUST_ID) cure = false setup..removeAbility('A077')..addAbility('A078') case 'A078' setNewActor(CreateUnit(owner, FOUNTAIN_CURE_ID, pos.x, pos.y, 270.)) actor.addAbility(LOCUST_ID) cure = true setup..removeAbility('A078')..addAbility('A079') case 'A079' setNewActor(CreateUnit(owner, FOUNTAIN_BOTH_ID, pos.x, pos.y, 270.)) actor.addAbility(LOCUST_ID) cure = true setup..removeAbility('A079')..addAbility('A077') override function serialize() returns Json let json = super.serialize() json.addProperty(new Property(KEY_TYPE, FOUNTAIN_INDEX.toString())) return json @compiletime function genFountain() new BuildingDefinition(FOUNTAIN_BOTH_ID, 'hctw') ..setName("|cff2994EFFountain") ..setHotkey("A") ..setTooltipBasic("|cffFFCC00Build |cff2994EFFountain [A]") ..setTooltipExtended("Heals nearby Escapers." + "\nAlso cures infections.") ..setIconGameInterface("ReplaceableTextures\\CommandButtons\\BTNFountainOfLife.blp") ..setNormalAbilities(commaList('A077', 'A00H', REMOVE_OBJECT_ID, GHOST_VIS_ID, INVULNERABILITY_ID)) ..setAttacksEnabled(0) ..setScalingValue(0.4) ..setAcquisitionRange(3500) ..setDefenseBase(0) ..setDefenseUpgradeBonus(0) ..setButtonPositionX(3) ..setButtonPositionY(0) ..setGroundTexture("") ..setShadowTextureBuilding("ShadowTrollBurrow") ..setModelFile(Buildings.fountainOfHealth) ..setUnitSoundSet("FountainOfLife") ..setSelectionScale(2) ..setPlacementRequires("") ..setCollisionSize(0) ..setRequirements("") ..setUpgradesUsed("") ..setBuildTime(2) ..setHitPointsMaximumBase(1000) ..setSightRadiusDay(0) ..setSightRadiusNight(0) ..setLumberCost(0) ..setGoldCost(0) ..setUnitClassification("ancient,standon") ..setHideMinimapDisplay(true) new BuildingDefinition(FOUNTAIN_HEAL_ID, 'hctw') ..setName("|cff2994EFFountain") ..setHotkey("A") ..setTooltipBasic("|cffFFCC00Build |cff2994EFFountain [A]") ..setTooltipExtended("Heals nearby Escapers." + "\nAlso cures infections.") ..setIconGameInterface("ReplaceableTextures\\CommandButtons\\BTNFountainOfLifeBlood.blp") ..setNormalAbilities(commaList('A078', 'A00H', REMOVE_OBJECT_ID, GHOST_VIS_ID, INVULNERABILITY_ID)) ..setAttacksEnabled(0) ..setScalingValue(0.4) ..setAcquisitionRange(3500) ..setDefenseBase(0) ..setDefenseUpgradeBonus(0) ..setButtonPositionX(3) ..setButtonPositionY(0) ..setGroundTexture("") ..setShadowTextureBuilding("ShadowTrollBurrow") ..setModelFile("buildings\\other\\FountainOfLifeBlood\\FountainOfLifeBlood.mdl") ..setUnitSoundSet("FountainOfLife") ..setSelectionScale(2) ..setPlacementRequires("") ..setCollisionSize(0) ..setRequirements("") ..setUpgradesUsed("") ..setBuildTime(2) ..setHitPointsMaximumBase(1000) ..setSightRadiusDay(0) ..setSightRadiusNight(0) ..setLumberCost(0) ..setGoldCost(0) ..setUnitClassification("ancient,standon") ..setHideMinimapDisplay(true) new BuildingDefinition(FOUNTAIN_CURE_ID, 'hctw') ..setName("|cff2994EFFountain") ..setHotkey("A") ..setTooltipBasic("|cffFFCC00Build |cff2994EFFountain [A]") ..setTooltipExtended("Heals nearby Escapers." + "\nAlso cures infections.") ..setIconGameInterface("ReplaceableTextures\\CommandButtons\\BTNFountainOfLife.blp") ..setNormalAbilities(commaList('A079', REMOVE_OBJECT_ID, GHOST_VIS_ID, INVULNERABILITY_ID)) ..setAttacksEnabled(0) ..setScalingValue(0.4) ..setAcquisitionRange(3500) ..setDefenseBase(0) ..setDefenseUpgradeBonus(0) ..setButtonPositionX(3) ..setButtonPositionY(0) ..setGroundTexture("") ..setTintingColorRed(150) ..setTintingColorBlue(150) ..setShadowTextureBuilding("ShadowTrollBurrow") ..setModelFile(Buildings.fountainOfMana) ..setUnitSoundSet("FountainOfLife") ..setSelectionScale(2) ..setPlacementRequires("") ..setCollisionSize(0) ..setRequirements("") ..setUpgradesUsed("") ..setBuildTime(2) ..setHitPointsMaximumBase(1000) ..setSightRadiusDay(0) ..setSightRadiusNight(0) ..setLumberCost(0) ..setGoldCost(0) ..setUnitClassification("ancient,standon") ..setHideMinimapDisplay(true)