[OTJ] Implementing "spree" mechanic (#12018)

* [OTJ] Implement Unfortunate Accident

* fix errors

* a few more things

* [OTJ] Implement Three Steps Ahead

* [OTJ] Implement Caught in the Crossfire

* [OTJ] Implement Insatiable Avarice

* add test

* [OTJ] Implement Explosive Derailment

* [OTJ] Implement Requisition Raid

* [OTJ] Implement Rustler Rampage

* add comment to test

* [OTJ] Implement Metamorphic Blast

* [OTJ] Implement Final Showdown

* rework cost addition, add test

* move cost application to its own loop
This commit is contained in:
Evan Kranzler 2024-03-31 12:11:34 -04:00 committed by GitHub
parent fa67b0450f
commit ba20e97b71
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 740 additions and 2 deletions

View file

@ -311,6 +311,16 @@ public abstract class AbilityImpl implements Ability {
return false;
}
// apply mode costs if they have them
for (UUID modeId : this.getModes().getSelectedModes()) {
Cost cost = this.getModes().get(modeId).getCost();
if (cost instanceof ManaCost) {
this.addManaCostsToPay((ManaCost) cost.copy());
} else if (cost != null) {
this.costs.add(cost.copy());
}
}
// unit tests only: it allows to add targets/choices by two ways:
// 1. From cast/activate command params (process it here)
// 2. From single addTarget/setChoice, it's a preffered method for tests (process it in normal choose dialogs like human player)
@ -1141,6 +1151,12 @@ public abstract class AbilityImpl implements Ability {
return this;
}
@Override
public Ability withFirstModeCost(Cost cost) {
this.modes.getMode().withCost(cost);
return this;
}
@Override
public String getGameLogMessage(Game game) {
if (game.isSimulation()) {