[Cleanup] Pass Player into execution constructor instead of PlayerID (#1022)

## Description:
Answering issue:  #1017 
[Cleanup] Pass Player into the execution constructor instead of PlayerID

I have tested the changes running and playing a full game. I do not know
other way to test the changes, please inform me ❤️

## 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
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

## Please put your Discord username so you can be contacted if a bug or
regression is found:

Lele

---------

Co-authored-by: lva <lva@rovsing.dk>
This commit is contained in:
Léo Joly
2025-06-10 16:10:48 -07:00
committed by evanpelle
co-authored by lva
parent 080cf8f3f8
commit 55206ca41f
32 changed files with 120 additions and 361 deletions
+7 -13
View File
@@ -282,7 +282,7 @@ export class FakeHumanExecution implements Execution {
this.lastEmojiSent.set(enemy, this.mg.ticks());
this.mg.addExecution(
new EmojiExecution(
this.player.id(),
this.player,
enemy.id(),
this.random.randElement(this.heckleEmoji),
),
@@ -354,7 +354,7 @@ export class FakeHumanExecution implements Execution {
const tick = this.mg.ticks();
this.lastNukeSent.push([tick, tile]);
this.mg.addExecution(
new NukeExecution(UnitType.AtomBomb, this.player.id(), tile),
new NukeExecution(UnitType.AtomBomb, this.player, tile),
);
}
@@ -421,7 +421,7 @@ export class FakeHumanExecution implements Execution {
}
this.mg.addExecution(
new TransportShipExecution(
this.player.id(),
this.player,
other.id(),
closest.y,
this.player.troops() / 5,
@@ -441,7 +441,7 @@ export class FakeHumanExecution implements Execution {
if (oceanTiles.length > 0) {
const buildTile = this.random.randElement(oceanTiles);
this.mg.addExecution(
new ConstructionExecution(player.id(), buildTile, UnitType.Port),
new ConstructionExecution(player, buildTile, UnitType.Port),
);
}
return;
@@ -470,9 +470,7 @@ export class FakeHumanExecution implements Execution {
if (canBuild === false) {
return;
}
this.mg.addExecution(
new ConstructionExecution(this.player.id(), tile, type),
);
this.mg.addExecution(new ConstructionExecution(this.player, tile, type));
}
private maybeSpawnWarship(): boolean {
@@ -498,11 +496,7 @@ export class FakeHumanExecution implements Execution {
return false;
}
this.mg.addExecution(
new ConstructionExecution(
this.player.id(),
targetTile,
UnitType.Warship,
),
new ConstructionExecution(this.player, targetTile, UnitType.Warship),
);
return true;
}
@@ -573,7 +567,7 @@ export class FakeHumanExecution implements Execution {
this.mg.addExecution(
new TransportShipExecution(
this.player.id(),
this.player,
this.mg.owner(dst).id(),
dst,
this.player.troops() / 5,