Monarch command zone effect: support multiple arts/sets

This commit is contained in:
Northmoc
2020-12-02 11:02:46 -05:00
parent 9e53fdbad1
commit 4b5027a86e
4 changed files with 13 additions and 7 deletions

View File

@@ -743,9 +743,9 @@ public class Game {
if (p != null && p.isMonarch()) { if (p != null && p.isMonarch()) {
// if the player who lost was the Monarch, someone else will be the monarch // if the player who lost was the Monarch, someone else will be the monarch
if(p.equals(getPhaseHandler().getPlayerTurn())) { if(p.equals(getPhaseHandler().getPlayerTurn())) {
getAction().becomeMonarch(getNextPlayerAfter(p)); getAction().becomeMonarch(getNextPlayerAfter(p), null);
} else { } else {
getAction().becomeMonarch(getPhaseHandler().getPlayerTurn()); getAction().becomeMonarch(getPhaseHandler().getPlayerTurn(), null);
} }
} }

View File

@@ -1768,7 +1768,7 @@ public class GameAction {
} }
} }
public void becomeMonarch(final Player p) { public void becomeMonarch(final Player p, final String set) {
final Player previous = game.getMonarch(); final Player previous = game.getMonarch();
if (p == null || p.equals(previous)) if (p == null || p.equals(previous))
return; return;
@@ -1776,7 +1776,7 @@ public class GameAction {
if (previous != null) if (previous != null)
previous.removeMonarchEffect(); previous.removeMonarchEffect();
p.createMonarchEffect(); p.createMonarchEffect(set);
game.setMonarch(p); game.setMonarch(p);
// Run triggers // Run triggers

View File

@@ -27,11 +27,12 @@ public class BecomeMonarchEffect extends SpellAbilityEffect {
public void resolve(SpellAbility sa) { public void resolve(SpellAbility sa) {
final TargetRestrictions tgt = sa.getTargetRestrictions(); final TargetRestrictions tgt = sa.getTargetRestrictions();
// TODO: improve ai and fix corner cases // TODO: improve ai and fix corner cases
final String set = sa.getHostCard().getSetCode();
for (final Player p : getTargetPlayers(sa)) { for (final Player p : getTargetPlayers(sa)) {
if ((tgt == null) || p.canBeTargetedBy(sa)) { if ((tgt == null) || p.canBeTargetedBy(sa)) {
if (!p.hasKeyword("You cant become the monarch this turn.")) { if (!p.hasKeyword("You cant become the monarch this turn.")) {
p.getGame().getAction().becomeMonarch(p); p.getGame().getAction().becomeMonarch(p, set);
} }
} }
} }

View File

@@ -3170,12 +3170,17 @@ public class Player extends GameEntity implements Comparable<Player> {
return equals(game.getMonarch()); return equals(game.getMonarch());
} }
public void createMonarchEffect() { public void createMonarchEffect(final String set) {
final PlayerZone com = getZone(ZoneType.Command); final PlayerZone com = getZone(ZoneType.Command);
if (monarchEffect == null) { if (monarchEffect == null) {
monarchEffect = new Card(game.nextCardId(), null, game); monarchEffect = new Card(game.nextCardId(), null, game);
monarchEffect.setOwner(this); monarchEffect.setOwner(this);
if (set != null) {
monarchEffect.setImageKey("t:monarch_" + set.toLowerCase());
monarchEffect.setSetCode(set);
} else {
monarchEffect.setImageKey("t:monarch"); monarchEffect.setImageKey("t:monarch");
}
monarchEffect.setName("The Monarch"); monarchEffect.setName("The Monarch");
monarchEffect.addType("Effect"); monarchEffect.addType("Effect");