mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-28 11:54:16 +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:
@@ -30,9 +30,14 @@ export class PlayerExecution implements Execution {
|
||||
this.player.units().forEach((u) => {
|
||||
const tileOwner = this.mg!.owner(u.tile());
|
||||
if (u.info().territoryBound) {
|
||||
if (tileOwner.isPlayer()) {
|
||||
if (tileOwner?.isPlayer()) {
|
||||
if (tileOwner !== this.player) {
|
||||
this.mg!.player(tileOwner.id()).captureUnit(u);
|
||||
if (u.type() === UnitType.DefensePost) {
|
||||
this.mg!.player(tileOwner.id()).captureUnit(u);
|
||||
u.decreaseLevel(this.mg!.player(tileOwner.id()));
|
||||
} else {
|
||||
this.mg!.player(tileOwner.id()).captureUnit(u);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
u.delete();
|
||||
|
||||
Reference in New Issue
Block a user