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 the player who lost was the Monarch, someone else will be the monarch
if(p.equals(getPhaseHandler().getPlayerTurn())) {
getAction().becomeMonarch(getNextPlayerAfter(p));
getAction().becomeMonarch(getNextPlayerAfter(p), null);
} 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();
if (p == null || p.equals(previous))
return;
@@ -1776,7 +1776,7 @@ public class GameAction {
if (previous != null)
previous.removeMonarchEffect();
p.createMonarchEffect();
p.createMonarchEffect(set);
game.setMonarch(p);
// Run triggers

View File

@@ -27,11 +27,12 @@ public class BecomeMonarchEffect extends SpellAbilityEffect {
public void resolve(SpellAbility sa) {
final TargetRestrictions tgt = sa.getTargetRestrictions();
// TODO: improve ai and fix corner cases
final String set = sa.getHostCard().getSetCode();
for (final Player p : getTargetPlayers(sa)) {
if ((tgt == null) || p.canBeTargetedBy(sa)) {
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());
}
public void createMonarchEffect() {
public void createMonarchEffect(final String set) {
final PlayerZone com = getZone(ZoneType.Command);
if (monarchEffect == null) {
monarchEffect = new Card(game.nextCardId(), null, game);
monarchEffect.setOwner(this);
monarchEffect.setImageKey("t:monarch");
if (set != null) {
monarchEffect.setImageKey("t:monarch_" + set.toLowerCase());
monarchEffect.setSetCode(set);
} else {
monarchEffect.setImageKey("t:monarch");
}
monarchEffect.setName("The Monarch");
monarchEffect.addType("Effect");