mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
Monarch command zone effect: support multiple arts/sets
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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 can’t become the monarch this turn.")) {
|
if (!p.hasKeyword("You can’t become the monarch this turn.")) {
|
||||||
p.getGame().getAction().becomeMonarch(p);
|
p.getGame().getAction().becomeMonarch(p, set);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user