Modal double-faced cards - fixed game error on usage with some replacement effects (example: Diluvian Primordial, closes #12176) (#12184)

This commit is contained in:
Susucre 2024-04-25 21:40:57 +02:00 committed by GitHub
parent 1ae48593a8
commit 36d6547bf8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 339 additions and 38 deletions

View file

@ -116,7 +116,8 @@ public abstract class ModalDoubleFacedCard extends CardImpl implements CardWithH
@Override
public boolean moveToZone(Zone toZone, Ability source, Game game, boolean flag, List<UUID> appliedEffects) {
if (super.moveToZone(toZone, source, game, flag, appliedEffects)) {
setSideZones(toZone, game);
Zone currentZone = game.getState().getZone(getId());
setSideZones(currentZone, game);
return true;
}
return false;
@ -131,7 +132,8 @@ public abstract class ModalDoubleFacedCard extends CardImpl implements CardWithH
@Override
public boolean moveToExile(UUID exileId, String name, Ability source, Game game, List<UUID> appliedEffects) {
if (super.moveToExile(exileId, name, source, game, appliedEffects)) {
setSideZones(Zone.EXILED, game);
Zone currentZone = game.getState().getZone(getId());
setSideZones(currentZone, game);
return true;
}
return false;
@ -233,10 +235,12 @@ public abstract class ModalDoubleFacedCard extends CardImpl implements CardWithH
case MODAL_RIGHT:
return this.rightHalfCard.cast(game, fromZone, ability, controllerId);
default:
if (this.leftHalfCard.getSpellAbility() != null)
if (this.leftHalfCard.getSpellAbility() != null) {
this.leftHalfCard.getSpellAbility().setControllerId(controllerId);
if (this.rightHalfCard.getSpellAbility() != null)
}
if (this.rightHalfCard.getSpellAbility() != null) {
this.rightHalfCard.getSpellAbility().setControllerId(controllerId);
}
return super.cast(game, fromZone, ability, controllerId);
}
}