[MKM] Implement Cases (#11713)

* Implementing "case" mechanic

* [MKM] Implement Case of the Burning Masks

* [MKM] Implement Case of the Filched Falcon

* [MKM] Implement Case of the Crimson Pulse

* [MKM] Implement Case of the Locked Hothouse

* Address PR comments

* some minor adjustments

* adjustments to hints

---------

Co-authored-by: Matthew Wilson <matthew_w@vaadin.com>
Co-authored-by: xenohedron <xenohedron@users.noreply.github.com>
This commit is contained in:
Matthew Wilson 2024-01-29 06:41:23 +02:00 committed by GitHub
parent 25a08c736f
commit f8d15cd6ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 941 additions and 22 deletions

View file

@ -95,6 +95,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
// maximal number of creatures the creature can be blocked by 0 = no restriction
protected int maxBlockedBy = 0;
protected boolean deathtouched;
protected boolean solved = false;
protected Map<String, List<UUID>> connectedCards = new HashMap<>();
protected Set<MageObjectReference> dealtDamageByThisTurn;
@ -145,6 +146,7 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
this.blocking = permanent.blocking;
this.maxBlocks = permanent.maxBlocks;
this.deathtouched = permanent.deathtouched;
this.solved = permanent.solved;
this.markedLifelink = permanent.markedLifelink;
this.connectedCards = CardUtil.deepCopyObject(permanent.connectedCards);
this.dealtDamageByThisTurn = CardUtil.deepCopyObject(permanent.dealtDamageByThisTurn);
@ -1913,6 +1915,33 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
return ringBearerFlag;
}
@Override
public boolean isSolved() {
return solved;
}
@Override
public boolean solve(Game game, Ability source) {
if (this.solved) {
return false;
}
GameEvent event = new GameEvent(GameEvent.EventType.SOLVE_CASE, getId(),
source, source.getControllerId());
if (game.replaceEvent(event)) {
return false;
}
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
game.informPlayers(controller.getLogName() + " solved " + this.getLogName() +
CardUtil.getSourceLogName(game, source));
}
this.solved = true;
game.fireEvent(new GameEvent(EventType.CASE_SOLVED, getId(), source,
source.getControllerId()));
return true;
}
@Override
public boolean fight(Permanent fightTarget, Ability source, Game game) {
return this.fight(fightTarget, source, game, true);