Skip to content

Commit

Permalink
Revert "Develop (#582)"
Browse files Browse the repository at this point in the history
This reverts commit 6166078.
  • Loading branch information
jlfarris91 committed Jul 16, 2023
1 parent 6166078 commit be608b9
Show file tree
Hide file tree
Showing 21 changed files with 220 additions and 790 deletions.
2 changes: 1 addition & 1 deletion _build/dependencies/WurstCore
110 changes: 0 additions & 110 deletions wurst/Camp/Headquarters.wurst
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import ItemType
import ChannelAbilityPreset
import GameConstants
import Buildings
import Bases
import HumanPlayerComponent
import UnitMetadata

public TlsBuildingDefinition g_headquarters1Definition
Expand All @@ -35,80 +33,8 @@ public constant string HEADQUARTERS3_ICON = "ReplaceableTextures\\CommandButtons
public constant string HEADQUARTERS4_ICON = "ReplaceableTextures\\CommandButtons\\BTNGenericHumanBuilding.blp"
public constant string HEADQUARTERS5_ICON = "ReplaceableTextures\\CommandButtons\\BTNGenericHumanBuilding1.blp"

constant int BASE_ABIL_ID_UNKNOWN = compiletime(ABIL_ID_GEN.next())
constant int BASE_ABIL_ID_EASY = compiletime(ABIL_ID_GEN.next())
constant int BASE_ABIL_ID_MEDIUM = compiletime(ABIL_ID_GEN.next())
constant int BASE_ABIL_ID_HARD = compiletime(ABIL_ID_GEN.next())

bool g_hasWisp = false

// ============================================================================
public class HeadquartersComponent extends UnitComponent

private Base m_base

// --------------------------------------------------------------------------
construct (IUnitMetadata owner)
super(owner)

// --------------------------------------------------------------------------
function setBase(Base base)
if (m_base != base)
m_base = base
updateBase()

// --------------------------------------------------------------------------
function getBase() returns Base
return m_base

// --------------------------------------------------------------------------
private function updateBase()

let ownerUnit = getOwnerUnit()

let playerComp = ownerUnit.getOwnerHumanPlayerComponent()
if (playerComp != null)
playerComp.setBase(m_base)

ownerUnit.removeAbility(BASE_ABIL_ID_EASY)
ownerUnit.removeAbility(BASE_ABIL_ID_MEDIUM)
ownerUnit.removeAbility(BASE_ABIL_ID_HARD)

if (m_base == null)
ownerUnit.addAbility(BASE_ABIL_ID_UNKNOWN)
return

switch (m_base.getDifficulty())
case BaseDifficulty.EASY
ownerUnit.addAbility(BASE_ABIL_ID_EASY)
case BaseDifficulty.MEDIUM
ownerUnit.addAbility(BASE_ABIL_ID_MEDIUM)
case BaseDifficulty.HARD
ownerUnit.addAbility(BASE_ABIL_ID_HARD)
default
skip

// ============================================================================
public function IUnitMetadata.getHeadquartersComponent() returns HeadquartersComponent
return this.getComponent(HeadquartersComponent.typeId) castTo HeadquartersComponent

// ============================================================================
public function IUnitMetadata.getOrAddHeadquartersComponent() returns HeadquartersComponent
var component = this.getHeadquartersComponent()
if (component == null)
component = this.addComponent(new HeadquartersComponent(this)) castTo HeadquartersComponent
return component

// ============================================================================
public function unit.getHeadquartersComponent() returns HeadquartersComponent
let metadata = this.getMetadata()
return metadata != null ? metadata.getHeadquartersComponent() : null

// ============================================================================
public function unit.getOrAddHeadquartersComponent() returns HeadquartersComponent
let metadata = this.getMetadata()
return metadata != null ? metadata.getOrAddHeadquartersComponent() : null

// ============================================================================
function createBaseHeadquartersDefinition(int newId) returns TlsBuildingDefinition
return new TlsBuildingDefinition(newId, UnitIds.townhall)
Expand Down Expand Up @@ -310,17 +236,6 @@ function onConstructCanceled()
// remove so it can't be revived since it's a hero
structure.remove()

// ============================================================================
function onConstructFinished()
let structure = GetTriggerUnit()
if (not structure.isHeadquarters())
return

let closestBase = Bases.getClosestBase(structure.getPos())
let hqComp = structure.getMetadata().getOrAddHeadquartersComponent()
if (hqComp != null)
hqComp.setBase(closestBase)

// ============================================================================
function onUpgradeFinished()
let structure = GetTriggerUnit()
Expand Down Expand Up @@ -451,30 +366,6 @@ function onSpellCast()
createHeadquartersItemBuildUnit(TlsUnitIds.BuildItemUnits.headquarters2, g_headquarters2ItemDefinition)
createHeadquartersItemBuildUnit(TlsUnitIds.BuildItemUnits.headquarters3, g_headquarters3ItemDefinition)

new AbilityDefinition(BASE_ABIL_ID_EASY, 'Ahan')
..presetTooltipNormal(lvl -> "Easy Base")
..presetTooltipNormalExtended(lvl -> "You've built your Headquarters in an Easy base.|n|n+1x score multiplier|")
..setButtonPositionNormalX(3)
..setButtonPositionNormalY(1)

new AbilityDefinition(BASE_ABIL_ID_MEDIUM, 'Ahan')
..presetTooltipNormal(lvl -> "Medium Base")
..presetTooltipNormalExtended(lvl -> "You've built your Headquarters in an Medium base.|n|n+2x score multiplier")
..setButtonPositionNormalX(3)
..setButtonPositionNormalY(1)

new AbilityDefinition(BASE_ABIL_ID_HARD, 'Ahan')
..presetTooltipNormal(lvl -> "Hard Base")
..presetTooltipNormalExtended(lvl -> "You've built your Headquarters in an Hard base.|n|n+3x score multiplier")
..setButtonPositionNormalX(3)
..setButtonPositionNormalY(1)

new AbilityDefinition(BASE_ABIL_ID_UNKNOWN, 'Ahan')
..presetTooltipNormal(lvl -> "Wild Base")
..presetTooltipNormalExtended(lvl -> "I have no idea where you built your Headquarters.")
..setButtonPositionNormalX(3)
..setButtonPositionNormalY(1)

// ============================================================================
init
if (g_headquarters1Definition == null)
Expand All @@ -487,6 +378,5 @@ init
registerPlayerUnitEvent(EVENT_PLAYER_UNIT_TRAIN_FINISH, function onUnitTrained)
registerPlayerUnitEvent(EVENT_PLAYER_UNIT_CONSTRUCT_START, function onConstructStarted)
registerPlayerUnitEvent(EVENT_PLAYER_UNIT_CONSTRUCT_CANCEL, function onConstructCanceled)
registerPlayerUnitEvent(EVENT_PLAYER_UNIT_CONSTRUCT_FINISH, function onConstructFinished)
registerPlayerUnitEvent(EVENT_PLAYER_UNIT_UPGRADE_FINISH, function onUpgradeFinished)
registerPlayerUnitEvent(EVENT_PLAYER_UNIT_SPELL_CAST, function onSpellCast)
7 changes: 0 additions & 7 deletions wurst/Camp/Wisp.wurst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import StringBuilder
import ColorUtility
import Icons
import TlsUpgradeDefinition
import TlsMMD

// ============================================================================
@compiletime function createObjectDefinitions()
Expand Down Expand Up @@ -295,20 +294,16 @@ function onSpellCast()
let abilityId = GetSpellAbilityId()

int heroTypeId
string heroId

switch (abilityId)
case TlsAbilityIds.selectHero_scout
heroTypeId = TlsUnitIds.heroScout
heroId = "Scout"

case TlsAbilityIds.selectHero_soldier
heroTypeId = TlsUnitIds.heroCaptain
heroId = "Captain"

case TlsAbilityIds.selectHero_tinkerer
heroTypeId = TlsUnitIds.heroTinker
heroId = "Tinker"

default
return
Expand All @@ -320,8 +315,6 @@ function onSpellCast()

castingUnit.remove()

TlsMMD.setHeroSelected(castingPlayer, heroId)

// ============================================================================
init

Expand Down
8 changes: 0 additions & 8 deletions wurst/Compile/TlsUnitIds.wurst
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,6 @@ public class TlsUnitIds
static constant int headquarters4 = compiletime(UNIT_ID_GEN.next())
static constant int headquarters5 = compiletime(UNIT_ID_GEN.next())

static constant int array headquarters = [
headquarters1,
headquarters2,
headquarters3,
headquarters4,
headquarters5
]

static constant int shelter1 = compiletime(UNIT_ID_GEN.next())
static constant int shelter2 = compiletime(UNIT_ID_GEN.next())
static constant int shelter3 = compiletime(UNIT_ID_GEN.next())
Expand Down
Loading

0 comments on commit be608b9

Please sign in to comment.