Skip to content

Commit 9b8a2cd

Browse files
committed
Add faster gateway build time after warpgate is researched
1 parent bf0a36c commit 9b8a2cd

1 file changed

Lines changed: 28 additions & 7 deletions

File tree

‎src/game_logic/gamelogic.ts‎

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,12 @@ class GameLogic {
734734
}
735735
}
736736

737-
if (trainerUnit.name === "WarpGate") {
737+
if (trainerUnit.name === "Gateway" && this.upgrades.has("WarpGateResearch")) {
738+
// Training through gateway when warpgate is researched reduces train time
739+
// TODO: According to patch notes: speeds up by 35% but the calculations don't match
740+
newTask.totalFramesRequired = this.gatewayBuildTimeAfterWarpgateResearch(unit.name)
741+
trainerUnit.addTask(this, newTask, trainerCanTrainThroughReactor, true)
742+
} else if (trainerUnit.name === "WarpGate") {
738743
// Training through warpgate reduces train time to 4 seconds
739744
newTask.totalFramesRequired = 3.6 * 22.4
740745
trainerUnit.addTask(this, newTask, trainerCanTrainThroughReactor, true)
@@ -994,17 +999,33 @@ class GameLogic {
994999
return UNITS_BY_NAME[unitName].time * 16
9951000
}
9961001

1002+
/**
1003+
* Since patch 5.0.16 gateways build faster after warpgate has been researched
1004+
*/
1005+
gatewayBuildTimeAfterWarpgateResearch(unitName: string): number {
1006+
const newBuildTime: { [name: string]: number } = {
1007+
// Values from https://news.blizzard.com/en-us/article/24259080/starcraft-ii-5-0-16-patch-notes
1008+
Zealot: 16 * 22.4,
1009+
Adept: 18 * 22.4,
1010+
Stalker: 18 * 22.4,
1011+
Sentry: 14 * 22.4,
1012+
DarkTemplar: 26 * 22.4,
1013+
HighTemplar: 26 * 22.4,
1014+
}
1015+
return newBuildTime[unitName]
1016+
}
1017+
9971018
/**
9981019
* Recover time of warp gates when creating a specific unit, how long the warp gate will be on cooldown after warping in a specific unit
9991020
*/
10001021
warpgateRecoverTime(unitName: string): number {
10011022
const recoverTimes: { [name: string]: number } = {
1002-
Zealot: 20 * 22.4,
1003-
Adept: 20 * 22.4,
1004-
Stalker: 23 * 22.4,
1005-
Sentry: 23 * 22.4,
1006-
DarkTemplar: 32 * 22.4,
1007-
HighTemplar: 32 * 22.4,
1023+
Zealot: 22 * 22.4,
1024+
Adept: 22 * 22.4,
1025+
Stalker: 22 * 22.4,
1026+
Sentry: 22 * 22.4,
1027+
DarkTemplar: 35 * 22.4,
1028+
HighTemplar: 35 * 22.4,
10081029
}
10091030
return recoverTimes[unitName]
10101031
}

0 commit comments

Comments
 (0)