mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-15 11:42:47 +00:00
feat(PlayerExecution): downgrade defense posts on capture (#1957)
## Description: Closes https://github.com/openfrontio/OpenFrontIO/issues/1619. On capture, defense posts will be downgraded. On the live version this means defense posts will be destroyed, as defense posts can only be level 1. Misc. changes: - added `decreaserLevel` helper - cleaned up if/else in tick unit loop for clarity to avoid yet another nested layer Continuation of the stale PR, https://github.com/openfrontio/OpenFrontIO/pull/1622. ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced ## Please put your Discord username so you can be contacted if a bug or regression is found: Discord username: `seekerreturns`
This commit is contained in:
@@ -397,6 +397,18 @@ export class UnitImpl implements Unit {
|
||||
this.mg.addUpdate(this.toUpdate());
|
||||
}
|
||||
|
||||
decreaseLevel(destroyer?: Player): void {
|
||||
this._level--;
|
||||
if ([UnitType.MissileSilo, UnitType.SAMLauncher].includes(this.type())) {
|
||||
this._missileTimerQueue.pop();
|
||||
}
|
||||
if (this._level <= 0) {
|
||||
this.delete(true, destroyer);
|
||||
return;
|
||||
}
|
||||
this.mg.addUpdate(this.toUpdate());
|
||||
}
|
||||
|
||||
trainType(): TrainType | undefined {
|
||||
return this._trainType;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user