getGameState => getGame

Stack zone uses its own class Zone (which has no owner obv.)
This commit is contained in:
Maxmtg
2012-10-19 23:55:27 +00:00
parent 1f38a60e4b
commit e7983cf9e1
128 changed files with 1897 additions and 1829 deletions

3
.gitattributes vendored
View File

@@ -12680,10 +12680,11 @@ src/main/java/forge/game/player/PlayerStatistics.java -text
src/main/java/forge/game/player/PlayerType.java svneol=native#text/plain
src/main/java/forge/game/player/PlayerUtil.java svneol=native#text/plain
src/main/java/forge/game/player/package-info.java svneol=native#text/plain
src/main/java/forge/game/zone/IPlayerZone.java svneol=native#text/plain
src/main/java/forge/game/zone/IZone.java svneol=native#text/plain
src/main/java/forge/game/zone/MagicStack.java svneol=native#text/plain
src/main/java/forge/game/zone/PlayerZone.java svneol=native#text/plain
src/main/java/forge/game/zone/PlayerZoneBattlefield.java svneol=native#text/plain
src/main/java/forge/game/zone/Zone.java -text
src/main/java/forge/game/zone/ZoneType.java -text
src/main/java/forge/game/zone/package-info.java svneol=native#text/plain
src/main/java/forge/gauntlet/GauntletData.java -text

View File

@@ -264,7 +264,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|| (cur == CardCharacteristicName.Transformed && state == CardCharacteristicName.Original)) {
HashMap<String, Object> runParams = new HashMap<String, Object>();
runParams.put("Transformer", this);
Singletons.getModel().getGameState().getTriggerHandler().runTrigger(TriggerType.Transformed, runParams);
Singletons.getModel().getGame().getTriggerHandler().runTrigger(TriggerType.Transformed, runParams);
}
return true;
@@ -1267,7 +1267,7 @@ public class Card extends GameEntity implements Comparable<Card> {
runParams.put("Card", this);
runParams.put("CounterType", counterName);
for (int i = 0; i < n; i++) {
Singletons.getModel().getGameState().getTriggerHandler().runTrigger(TriggerType.CounterAdded, runParams);
Singletons.getModel().getGame().getTriggerHandler().runTrigger(TriggerType.CounterAdded, runParams);
}
this.updateObservers();
@@ -1300,7 +1300,7 @@ public class Card extends GameEntity implements Comparable<Card> {
runParams.put("Card", this);
runParams.put("CounterType", counterName);
for (int i = 0; i < (multiplier * n); i++) {
Singletons.getModel().getGameState().getTriggerHandler().runTrigger(TriggerType.CounterAdded, runParams);
Singletons.getModel().getGame().getTriggerHandler().runTrigger(TriggerType.CounterAdded, runParams);
}
this.updateObservers();
@@ -1329,26 +1329,26 @@ public class Card extends GameEntity implements Comparable<Card> {
runParams.put("Card", this);
runParams.put("CounterType", counterName);
for (int i = 0; i < n; i++) {
Singletons.getModel().getGameState().getTriggerHandler().runTrigger(TriggerType.CounterRemoved, runParams);
Singletons.getModel().getGame().getTriggerHandler().runTrigger(TriggerType.CounterRemoved, runParams);
}
if (counterName.equals(Counters.TIME) && (aux == 0)) {
final boolean hasVanish = CardFactoryUtil.hasKeyword(this, "Vanishing") != -1;
if (hasVanish && this.isInPlay()) {
Singletons.getModel().getGameAction().sacrifice(this, null);
Singletons.getModel().getGame().getAction().sacrifice(this, null);
}
if (this.hasSuspend() && Singletons.getModel().getGameState().isCardExiled(this)) {
if (this.hasSuspend() && Singletons.getModel().getGame().isCardExiled(this)) {
final Card c = this;
c.setSuspendCast(true);
// set activating player for base spell ability
c.getSpellAbility()[0].setActivatingPlayer(c.getOwner());
// Any trigger should cause the phase not to skip
Singletons.getModel().getGameState().getPhaseHandler().setSkipPhase(false);
Singletons.getModel().getGame().getPhaseHandler().setSkipPhase(false);
if (c.getOwner().isHuman()) {
Singletons.getModel().getGameAction().playCardWithoutManaCost(c);
Singletons.getModel().getGame().getAction().playCardWithoutManaCost(c);
} else {
final ArrayList<SpellAbility> choices = this.getBasicSpells();
@@ -1733,7 +1733,7 @@ public class Card extends GameEntity implements Comparable<Card> {
return new CardColor(this);
}
CardColor colors = null;
final ArrayList<CardColor> globalChanges = Singletons.getModel().getGameState().getColorChanger().getColorChanges();
final ArrayList<CardColor> globalChanges = Singletons.getModel().getGame().getColorChanger().getColorChanges();
colors = this.determineColor(globalChanges);
colors.fixColorless();
return colors;
@@ -3765,8 +3765,8 @@ public class Card extends GameEntity implements Comparable<Card> {
}
}
this.controllerObjects.add(controllerObject);
if ((Singletons.getModel().getGameAction() != null) && (prevController != null)) {
Singletons.getModel().getGameAction().controllerChangeZoneCorrection(this);
if ((Singletons.getModel().getGame().getAction() != null) && (prevController != null)) {
Singletons.getModel().getGame().getAction().controllerChangeZoneCorrection(this);
}
if (prevController != null) {
@@ -3791,7 +3791,7 @@ public class Card extends GameEntity implements Comparable<Card> {
this.controllerObjects.remove(controllerObject);
if (!currentController.equals(this.getController())) {
Singletons.getModel().getGameAction().controllerChangeZoneCorrection(this);
Singletons.getModel().getGame().getAction().controllerChangeZoneCorrection(this);
for (final Command c : this.changeControllerCommandList) {
c.execute();
@@ -3975,7 +3975,7 @@ public class Card extends GameEntity implements Comparable<Card> {
*/
public final void addEquipping(final Card c) {
this.equipping.add(c);
this.setTimestamp(Singletons.getModel().getGameState().getNextTimestamp());
this.setTimestamp(Singletons.getModel().getGame().getNextTimestamp());
this.updateObservers();
}
@@ -4003,7 +4003,7 @@ public class Card extends GameEntity implements Comparable<Card> {
*/
public final void equipCard(final Card c) {
if (c.hasKeyword("CARDNAME can't be equipped.")) {
Singletons.getModel().getGameState().getGameLog().add("ResolveStack", "Trying to equip " + c.getName()
Singletons.getModel().getGame().getGameLog().add("ResolveStack", "Trying to equip " + c.getName()
+ " but it can't be equipped.", 2);
return;
}
@@ -4033,7 +4033,7 @@ public class Card extends GameEntity implements Comparable<Card> {
final Map<String, Object> runParams = new TreeMap<String, Object>();
runParams.put("Equipment", this);
runParams.put("Card", c);
Singletons.getModel().getGameState().getTriggerHandler().runTrigger(TriggerType.Unequip, runParams);
Singletons.getModel().getGame().getTriggerHandler().runTrigger(TriggerType.Unequip, runParams);
}
/**
@@ -4160,7 +4160,7 @@ public class Card extends GameEntity implements Comparable<Card> {
*/
public final void addEnchanting(final GameEntity e) {
this.enchanting = e;
this.setTimestamp(Singletons.getModel().getGameState().getNextTimestamp());
this.setTimestamp(Singletons.getModel().getGame().getNextTimestamp());
this.updateObservers();
}
@@ -4189,7 +4189,7 @@ public class Card extends GameEntity implements Comparable<Card> {
*/
public final void enchantEntity(final GameEntity entity) {
if (entity.hasKeyword("CARDNAME can't be enchanted.")) {
Singletons.getModel().getGameState().getGameLog().add("ResolveStack", "Trying to enchant " + entity.getName()
Singletons.getModel().getGame().getGameLog().add("ResolveStack", "Trying to enchant " + entity.getName()
+ " but it can't be enchanted.", 2);
return;
}
@@ -4753,7 +4753,7 @@ public class Card extends GameEntity implements Comparable<Card> {
return 0;
}
if (Singletons.getModel().getGameState().isCardInPlay("Doran, the Siege Tower")) {
if (Singletons.getModel().getGame().isCardInPlay("Doran, the Siege Tower")) {
return this.getNetDefense();
}
return this.getNetAttack();
@@ -5039,7 +5039,7 @@ public class Card extends GameEntity implements Comparable<Card> {
// Run triggers
final Map<String, Object> runParams = new TreeMap<String, Object>();
runParams.put("Card", this);
Singletons.getModel().getGameState().getTriggerHandler().runTrigger(TriggerType.Taps, runParams);
Singletons.getModel().getGame().getTriggerHandler().runTrigger(TriggerType.Taps, runParams);
}
this.setTapped(true);
}
@@ -5054,7 +5054,7 @@ public class Card extends GameEntity implements Comparable<Card> {
// Run triggers
final Map<String, Object> runParams = new TreeMap<String, Object>();
runParams.put("Card", this);
Singletons.getModel().getGameState().getTriggerHandler().runTrigger(TriggerType.Untaps, runParams);
Singletons.getModel().getGame().getTriggerHandler().runTrigger(TriggerType.Untaps, runParams);
}
@@ -6079,9 +6079,9 @@ public class Card extends GameEntity implements Comparable<Card> {
// Suppressed Exiling is as close as we can get to
// "ceasing to exist"
Singletons.getModel().getGameState().getTriggerHandler().suppressMode(TriggerType.ChangesZone);
Singletons.getModel().getGameAction().exile(this);
Singletons.getModel().getGameState().getTriggerHandler().clearSuppression(TriggerType.ChangesZone);
Singletons.getModel().getGame().getTriggerHandler().suppressMode(TriggerType.ChangesZone);
Singletons.getModel().getGame().getAction().exile(this);
Singletons.getModel().getGame().getTriggerHandler().clearSuppression(TriggerType.ChangesZone);
}
return true;
}
@@ -6491,7 +6491,7 @@ public class Card extends GameEntity implements Comparable<Card> {
}
} else if (property.startsWith("RememberedPlayerCtrl")) {
if (source.getRemembered().isEmpty()) {
final Card newCard = Singletons.getModel().getGameState().getCardState(source);
final Card newCard = Singletons.getModel().getGame().getCardState(source);
for (final Object o : newCard.getRemembered()) {
if (o instanceof Player) {
if (!this.getController().equals((Player) o)) {
@@ -6541,11 +6541,11 @@ public class Card extends GameEntity implements Comparable<Card> {
}
}
} else if (property.startsWith("ActivePlayerCtrl")) {
if (!Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(this.getController())) {
if (!Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(this.getController())) {
return false;
}
} else if (property.startsWith("NonActivePlayerCtrl")) {
if (Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(this.getController())) {
if (Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(this.getController())) {
return false;
}
} else if (property.startsWith("YouOwn")) {
@@ -6724,7 +6724,7 @@ public class Card extends GameEntity implements Comparable<Card> {
}
} else if (restriction.equals("MostProminentColor")) {
for (final String color : CardUtil.getColors(this)) {
if (CardFactoryUtil.isMostProminentColor(Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield), color)) {
if (CardFactoryUtil.isMostProminentColor(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), color)) {
return true;
}
}
@@ -6813,12 +6813,12 @@ public class Card extends GameEntity implements Comparable<Card> {
return false;
}
} else if (restriction.equals(ZoneType.Battlefield.toString())) {
final List<Card> list = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
final List<Card> list = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
if (list.isEmpty()) {
return false;
}
boolean shares = false;
for (final Card card : Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield)) {
for (final Card card : Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield)) {
if (this.getName().equals(card.getName())) {
shares = true;
}
@@ -6912,11 +6912,11 @@ public class Card extends GameEntity implements Comparable<Card> {
return false;
}
} else if (property.startsWith("enteredBattlefieldThisTurn")) {
if (!(this.getTurnInZone() == Singletons.getModel().getGameState().getPhaseHandler().getTurn())) {
if (!(this.getTurnInZone() == Singletons.getModel().getGame().getPhaseHandler().getTurn())) {
return false;
}
} else if (property.startsWith("notEnteredBattlefieldThisTurn")) {
if (this.getTurnInZone() == Singletons.getModel().getGameState().getPhaseHandler().getTurn()) {
if (this.getTurnInZone() == Singletons.getModel().getGame().getPhaseHandler().getTurn()) {
return false;
}
} else if (property.startsWith("firstTurnControlled")) {
@@ -6986,28 +6986,28 @@ public class Card extends GameEntity implements Comparable<Card> {
return false;
}
} else if (property.startsWith("greatestPower")) {
final List<Card> list = CardLists.filter(Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield), Presets.CREATURES);
final List<Card> list = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), Presets.CREATURES);
for (final Card crd : list) {
if (crd.getNetAttack() > this.getNetAttack()) {
return false;
}
}
} else if (property.startsWith("leastPower")) {
final List<Card> list = CardLists.filter(Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield), Presets.CREATURES);
final List<Card> list = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), Presets.CREATURES);
for (final Card crd : list) {
if (crd.getNetAttack() < this.getNetAttack()) {
return false;
}
}
} else if (property.startsWith("greatestCMC")) {
final List<Card> list = CardLists.filter(Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield), Presets.CREATURES);
final List<Card> list = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), Presets.CREATURES);
for (final Card crd : list) {
if (crd.getCMC() > this.getCMC()) {
return false;
}
}
} else if (property.startsWith("lowestCMC")) {
final List<Card> list = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
final List<Card> list = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
for (final Card crd : list) {
if (!crd.isLand() && !crd.isImmutable() && (crd.getCMC() < this.getCMC())) {
return false;
@@ -7052,7 +7052,7 @@ public class Card extends GameEntity implements Comparable<Card> {
}
}
} else if (property.startsWith("suspended")) {
if (!this.hasSuspend() || !Singletons.getModel().getGameState().isCardExiled(this)
if (!this.hasSuspend() || !Singletons.getModel().getGame().isCardExiled(this)
|| !(this.getCounters(Counters.getType("TIME")) >= 1)) {
return false;
}
@@ -7172,7 +7172,7 @@ public class Card extends GameEntity implements Comparable<Card> {
return false;
}
} else if (property.startsWith("unblocked")) {
if (!Singletons.getModel().getGameState().getCombat().isUnblocked(this)) {
if (!Singletons.getModel().getGame().getCombat().isUnblocked(this)) {
return false;
}
} else if (property.startsWith("kicked")) {
@@ -7273,7 +7273,7 @@ public class Card extends GameEntity implements Comparable<Card> {
return false;
}
} else if (property.startsWith("OnBattlefield")) {
final List<Card> list = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
final List<Card> list = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
if (!list.contains(this)) {
return false;
}
@@ -7529,7 +7529,7 @@ public class Card extends GameEntity implements Comparable<Card> {
* @return a boolean.
*/
public final boolean isAttacking() {
return Singletons.getModel().getGameState().getCombat().isAttacking(this);
return Singletons.getModel().getGame().getCombat().isAttacking(this);
}
/**
@@ -7540,7 +7540,7 @@ public class Card extends GameEntity implements Comparable<Card> {
* @return a boolean.
*/
public final boolean isBlocking() {
final List<Card> blockers = Singletons.getModel().getGameState().getCombat().getAllBlockers();
final List<Card> blockers = Singletons.getModel().getGame().getCombat().getAllBlockers();
return blockers.contains(this);
}
@@ -7552,7 +7552,7 @@ public class Card extends GameEntity implements Comparable<Card> {
* @return a boolean.
*/
public final boolean isBlocked() {
return Singletons.getModel().getGameState().getCombat().isBlocked(this);
return Singletons.getModel().getGame().getCombat().isBlocked(this);
}
/**
@@ -7565,7 +7565,7 @@ public class Card extends GameEntity implements Comparable<Card> {
* @return a boolean.
*/
public final boolean isBlocking(final Card attacker) {
return Singletons.getModel().getGameState().getCombat().getAttackersBlockedBy(this).contains(attacker);
return Singletons.getModel().getGame().getCombat().getAttackersBlockedBy(this).contains(attacker);
}
/**
@@ -7578,7 +7578,7 @@ public class Card extends GameEntity implements Comparable<Card> {
* @return a boolean.
*/
public final boolean isBlockedBy(final Card blocker) {
return Singletons.getModel().getGameState().getCombat().getAttackersBlockedBy(blocker).contains(this);
return Singletons.getModel().getGame().getCombat().getAttackersBlockedBy(blocker).contains(this);
}
// /////////////////////////
@@ -8006,7 +8006,7 @@ public class Card extends GameEntity implements Comparable<Card> {
public final int staticDamagePrevention(final int damage, final int possiblePrvenetion, final Card source,
final boolean isCombat) {
if (Singletons.getModel().getGameState().isCardInPlay("Leyline of Punishment")) {
if (Singletons.getModel().getGame().isCardInPlay("Leyline of Punishment")) {
return damage;
}
@@ -8035,11 +8035,11 @@ public class Card extends GameEntity implements Comparable<Card> {
@Override
public final int staticDamagePrevention(final int damageIn, final Card source, final boolean isCombat) {
if (Singletons.getModel().getGameState().isCardInPlay("Leyline of Punishment")) {
if (Singletons.getModel().getGame().isCardInPlay("Leyline of Punishment")) {
return damageIn;
}
if (isCombat && Singletons.getModel().getGameState().getPhaseHandler().isPreventCombatDamageThisTurn()) {
if (isCombat && Singletons.getModel().getGame().getPhaseHandler().isPreventCombatDamageThisTurn()) {
return 0;
}
@@ -8098,7 +8098,7 @@ public class Card extends GameEntity implements Comparable<Card> {
}
// Prevent Damage static abilities
final List<Card> allp = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
final List<Card> allp = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
for (final Card ca : allp) {
final ArrayList<StaticAbility> staticAbilities = ca.getStaticAbilities();
for (final StaticAbility stAb : staticAbilities) {
@@ -8112,7 +8112,7 @@ public class Card extends GameEntity implements Comparable<Card> {
return 0;
}
if ((source.isCreature() && Singletons.getModel().getGameState().isCardInPlay("Well-Laid Plans") && source.sharesColorWith(this))) {
if ((source.isCreature() && Singletons.getModel().getGame().isCardInPlay("Well-Laid Plans") && source.sharesColorWith(this))) {
return 0;
}
} // Creature end
@@ -8140,7 +8140,7 @@ public class Card extends GameEntity implements Comparable<Card> {
@Override
public final int preventDamage(final int damage, final Card source, final boolean isCombat) {
if (Singletons.getModel().getGameState().isCardInPlay("Leyline of Punishment")
if (Singletons.getModel().getGame().isCardInPlay("Leyline of Punishment")
|| source.hasKeyword("Damage that would be dealt by CARDNAME can't be prevented.")) {
return damage;
}
@@ -8160,7 +8160,7 @@ public class Card extends GameEntity implements Comparable<Card> {
repParams.put("IsCombat", isCombat);
repParams.put("Prevention", true);
if (Singletons.getModel().getGameState().getReplacementHandler().run(repParams) != ReplacementResult.NotReplaced) {
if (Singletons.getModel().getGame().getReplacementHandler().run(repParams) != ReplacementResult.NotReplaced) {
return 0;
}
@@ -8206,7 +8206,7 @@ public class Card extends GameEntity implements Comparable<Card> {
public final int staticReplaceDamage(final int damage, final Card source, final boolean isCombat) {
int restDamage = damage;
for (Card c : Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield)) {
for (Card c : Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield)) {
if (c.getName().equals("Sulfuric Vapors")) {
if (source.isSpell() && source.isRed()) {
restDamage += 1;
@@ -8287,7 +8287,7 @@ public class Card extends GameEntity implements Comparable<Card> {
repParams.put("DamageAmount", damageIn);
repParams.put("IsCombat", isCombat);
if (Singletons.getModel().getGameState().getReplacementHandler().run(repParams) != ReplacementResult.NotReplaced) {
if (Singletons.getModel().getGame().getReplacementHandler().run(repParams) != ReplacementResult.NotReplaced) {
return 0;
}
@@ -8352,7 +8352,7 @@ public class Card extends GameEntity implements Comparable<Card> {
runParams.put("DamageTarget", this);
runParams.put("DamageAmount", damageToAdd);
runParams.put("IsCombatDamage", isCombat);
Singletons.getModel().getGameState().getTriggerHandler().runTrigger(TriggerType.DamageDone, runParams);
Singletons.getModel().getGame().getTriggerHandler().runTrigger(TriggerType.DamageDone, runParams);
if (this.isPlaneswalker()) {
this.subtractCounter(Counters.LOYALTY, damageToAdd);
@@ -8369,7 +8369,7 @@ public class Card extends GameEntity implements Comparable<Card> {
this.addCounter(Counters.M1M1, damageToAdd);
}
if (source.hasKeyword("Deathtouch") && this.isCreature()) {
Singletons.getModel().getGameAction().destroy(this);
Singletons.getModel().getGame().getAction().destroy(this);
} else if (this.isInPlay() && !wither) {
this.damage += damageToAdd;
}
@@ -8869,7 +8869,7 @@ public class Card extends GameEntity implements Comparable<Card> {
* @return boolean
*/
public boolean isInZone(final ZoneType zone) {
return Singletons.getModel().getGameState().isCardInZone(this, zone);
return Singletons.getModel().getGame().isCardInZone(this, zone);
}
/**
@@ -8887,7 +8887,7 @@ public class Card extends GameEntity implements Comparable<Card> {
}
// CantTarget static abilities
final List<Card> allp = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
final List<Card> allp = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
for (final Card ca : allp) {
final ArrayList<StaticAbility> staticAbilities = ca.getStaticAbilities();
for (final StaticAbility stAb : staticAbilities) {

View File

@@ -211,7 +211,7 @@ public final class CardUtil {
int xPaid = 0;
// 2012-07-22 - If a card is on the stack, count the xManaCost in with it's CMC
if (Singletons.getModel().getGameState().getCardsIn(ZoneType.Stack).contains(c) && c.getManaCost() != null) {
if (Singletons.getModel().getGame().getCardsIn(ZoneType.Stack).contains(c) && c.getManaCost() != null) {
xPaid = c.getXManaCostPaid() * c.getManaCost().countX();
}
return c.getManaCost().getCMC() + xPaid;
@@ -627,10 +627,10 @@ public final class CardUtil {
final Card src) {
List<Card> res = new ArrayList<Card>();
if (to != ZoneType.Stack) {
for (Player p : Singletons.getModel().getGameState().getPlayers())
for (Player p : Singletons.getModel().getGame().getPlayers())
res.addAll(p.getZone(to).getCardsAddedThisTurn(from));
} else {
res.addAll(Singletons.getModel().getGameState().getStackZone().getCardsAddedThisTurn(from));
res.addAll(Singletons.getModel().getGame().getStackZone().getCardsAddedThisTurn(from));
}
res = CardLists.getValidCards(res, valid, src.getController(), src);
@@ -650,7 +650,7 @@ public final class CardUtil {
public static List<Card> getThisTurnCast(final String valid, final Card src) {
List<Card> res = new ArrayList<Card>();
res.addAll(Singletons.getModel().getGameState().getStack().getCardsCastThisTurn());
res.addAll(Singletons.getModel().getGame().getStack().getCardsCastThisTurn());
res = CardLists.getValidCards(res, valid, src.getController(), src);
@@ -669,7 +669,7 @@ public final class CardUtil {
public static List<Card> getLastTurnCast(final String valid, final Card src) {
List<Card> res = new ArrayList<Card>();
res.addAll(Singletons.getModel().getGameState().getStack().getCardsCastLastTurn());
res.addAll(Singletons.getModel().getGame().getStack().getCardsCastLastTurn());
res = CardLists.getValidCards(res, valid, src.getController(), src);
@@ -828,7 +828,7 @@ public final class CardUtil {
if (strCol.equalsIgnoreCase("Colorless")) {
continue;
}
for (final Card c : Singletons.getModel().getGameState().getColoredCardsInPlay(strCol)) {
for (final Card c : Singletons.getModel().getGame().getColoredCardsInPlay(strCol)) {
if (!res.contains(c) && c.isValid(valid, source.getController(), source) && !c.equals(origin)) {
res.add(c);
}

View File

@@ -59,6 +59,7 @@ import forge.game.player.ComputerUtil;
import forge.game.player.Player;
import forge.game.zone.PlayerZone;
import forge.game.zone.PlayerZoneBattlefield;
import forge.game.zone.Zone;
import forge.game.zone.ZoneType;
import forge.gui.GuiChoose;
import forge.gui.match.ViewWinLose;
@@ -107,7 +108,7 @@ public class GameAction {
* @param position TODO
* @return a {@link forge.Card} object.
*/
public Card changeZone(final PlayerZone zoneFrom, final PlayerZone zoneTo, final Card c, Integer position) {
public Card changeZone(final Zone zoneFrom, final Zone zoneTo, final Card c, Integer position) {
if (c.isCopiedSpell()) {
if ((zoneFrom != null)) {
zoneFrom.remove(c);
@@ -121,10 +122,8 @@ public class GameAction {
else {
zoneTo.add(c, position);
}
Player p = zoneTo.getPlayer();
if (p != null) {
p.updateLabelObservers();
}
zoneTo.updateLabelObservers();
return c;
}
@@ -186,7 +185,7 @@ public class GameAction {
ReplacementResult repres = game.getReplacementHandler().run(repParams);
if (repres != ReplacementResult.NotReplaced) {
if (game.getStack().isResolving(c) && !zoneTo.is(ZoneType.Graveyard) && repres == ReplacementResult.Prevented) {
return Singletons.getModel().getGameAction().moveToGraveyard(c);
return Singletons.getModel().getGame().getAction().moveToGraveyard(c);
}
return c;
}
@@ -221,10 +220,7 @@ public class GameAction {
zoneFrom.remove(c);
}
Player p = zoneTo.getPlayer();
if (p != null) {
p.updateLabelObservers();
}
zoneTo.updateLabelObservers();
final HashMap<String, Object> runParams = new HashMap<String, Object>();
runParams.put("Card", lastKnownInfo);
@@ -303,7 +299,7 @@ public class GameAction {
copied.turnFaceUp();
}
} else if (zoneTo.is(ZoneType.Battlefield)) {
copied.setTimestamp(Singletons.getModel().getGameState().getNextTimestamp());
copied.setTimestamp(Singletons.getModel().getGame().getNextTimestamp());
for (String s : copied.getKeyword()) {
if (s.startsWith("May be played") || s.startsWith("You may look at this card.")
|| s.startsWith("May be played by your opponent")
@@ -313,7 +309,7 @@ public class GameAction {
}
}
} else if (zoneTo.is(ZoneType.Graveyard)) {
copied.setTimestamp(Singletons.getModel().getGameState().getNextTimestamp());
copied.setTimestamp(Singletons.getModel().getGame().getNextTimestamp());
for (String s : copied.getKeyword()) {
if (s.startsWith("May be played") || s.startsWith("You may look at this card.")
|| s.startsWith("May be played by your opponent")
@@ -341,14 +337,14 @@ public class GameAction {
* a {@link forge.Card} object.
* @return a {@link forge.Card} object.
*/
public final Card moveTo(final PlayerZone zoneTo, Card c) {
public final Card moveTo(final Zone zoneTo, Card c) {
return moveTo(zoneTo, c, null);
}
public final Card moveTo(final PlayerZone zoneTo, Card c, Integer position) {
public final Card moveTo(final Zone zoneTo, Card c, Integer position) {
// Ideally move to should never be called without a prevZone
// Remove card from Current Zone, if it has one
final PlayerZone zoneFrom = game.getZoneOf(c);
final Zone zoneFrom = game.getZoneOf(c);
// String prevName = prev != null ? prev.getZoneName() : "";
if (c.hasKeyword("If CARDNAME would leave the battlefield, exile it instead of putting it anywhere else.")
@@ -396,7 +392,7 @@ public class GameAction {
final PlayerZone hand = c.getOwner().getZone(ZoneType.Hand);
final PlayerZone play = c.getController().getZone(ZoneType.Battlefield);
c = Singletons.getModel().getGameAction().changeZone(hand, play, c, null);
c = Singletons.getModel().getGame().getAction().changeZone(hand, play, c, null);
return c;
}
@@ -409,7 +405,7 @@ public class GameAction {
*/
public final void controllerChangeZoneCorrection(final Card c) {
System.out.println("Correcting zone for " + c.toString());
final PlayerZone oldBattlefield = game.getZoneOf(c);
final Zone oldBattlefield = game.getZoneOf(c);
if (oldBattlefield == null || oldBattlefield.getZoneType() == ZoneType.Stack) {
return;
}
@@ -456,7 +452,7 @@ public class GameAction {
* @return a {@link forge.Card} object.
*/
public final Card moveToStack(final Card c) {
final PlayerZone stack = game.getStackZone();
final Zone stack = game.getStackZone();
return this.moveTo(stack, c);
}
@@ -470,7 +466,7 @@ public class GameAction {
* @return a {@link forge.Card} object.
*/
public final Card moveToGraveyard(Card c) {
final PlayerZone origZone = game.getZoneOf(c);
final Zone origZone = game.getZoneOf(c);
final Player owner = c.getOwner();
final PlayerZone grave = owner.getZone(ZoneType.Graveyard);
final PlayerZone exile = owner.getZone(ZoneType.Exile);
@@ -511,7 +507,7 @@ public class GameAction {
@Override
public void execute() {
Singletons.getModel().getGameAction().moveToHand(recoverable);
Singletons.getModel().getGame().getAction().moveToHand(recoverable);
}
};
@@ -520,7 +516,7 @@ public class GameAction {
@Override
public void execute() {
Singletons.getModel().getGameAction().exile(recoverable);
Singletons.getModel().getGame().getAction().exile(recoverable);
}
};
@@ -529,7 +525,7 @@ public class GameAction {
@Override
public void resolve() {
Singletons.getModel().getGameAction().moveToHand(recoverable);
Singletons.getModel().getGame().getAction().moveToHand(recoverable);
}
@Override
@@ -560,7 +556,7 @@ public class GameAction {
if (ComputerUtil.canPayCost(abRecover, p)) {
ComputerUtil.playNoStack(p, abRecover);
} else {
Singletons.getModel().getGameAction().exile(recoverable);
Singletons.getModel().getGame().getAction().exile(recoverable);
}
}
}
@@ -657,7 +653,7 @@ public class GameAction {
* @return a {@link forge.Card} object.
*/
public final Card moveToLibrary(Card c, int libPosition) {
final PlayerZone p = game.getZoneOf(c);
final Zone p = game.getZoneOf(c);
final PlayerZone library = c.getOwner().getZone(ZoneType.Library);
if (c.hasKeyword("If CARDNAME would leave the battlefield, exile it instead of putting it anywhere else.")) {
@@ -703,12 +699,7 @@ public class GameAction {
runParams.put("Destination", ZoneType.Library.name());
game.getTriggerHandler().runTrigger(TriggerType.ChangesZone, runParams);
if (p != null) {
Player owner = p.getPlayer();
if (owner != null) {
owner.updateLabelObservers();
}
}
p.updateLabelObservers();
// Soulbond unpairing
if (c.isPaired()) {
@@ -735,7 +726,7 @@ public class GameAction {
final PlayerZone removed = c.getOwner().getZone(ZoneType.Exile);
return Singletons.getModel().getGameAction().moveTo(removed, c);
return Singletons.getModel().getGame().getAction().moveTo(removed, c);
}
/**
@@ -813,7 +804,7 @@ public class GameAction {
// pay miracle cost here.
if (card.getOwner().isHuman()) {
if (GameActionUtil.showYesNoDialog(card, card + " - Drawn. Pay Miracle Cost?")) {
Singletons.getModel().getGameAction().playSpellAbility(miracle);
Singletons.getModel().getGame().getAction().playSpellAbility(miracle);
}
} else {
Spell spell = (Spell) miracle;
@@ -878,7 +869,7 @@ public class GameAction {
// pay madness cost here.
if (card.getOwner().isHuman()) {
if (GameActionUtil.showYesNoDialog(card, card + " - Discarded. Pay Madness Cost?")) {
Singletons.getModel().getGameAction().playSpellAbility(madness);
Singletons.getModel().getGame().getAction().playSpellAbility(madness);
}
} else {
Spell spell = (Spell) madness;
@@ -1216,7 +1207,7 @@ public class GameAction {
c = list.get(i);
if (c.getCounters(Counters.LOYALTY) <= 0) {
Singletons.getModel().getGameAction().moveToGraveyard(c);
Singletons.getModel().getGame().getAction().moveToGraveyard(c);
}
final ArrayList<String> types = c.getType();
@@ -1229,7 +1220,7 @@ public class GameAction {
if (cl.size() > 1) {
for (final Card crd : cl) {
Singletons.getModel().getGameAction().moveToGraveyard(crd);
Singletons.getModel().getGame().getAction().moveToGraveyard(crd);
}
}
}
@@ -1259,7 +1250,7 @@ public class GameAction {
a.remove(0);
if (1 < b.size()) {
for (int i = 0; i < b.size(); i++) {
Singletons.getModel().getGameAction().sacrificeDestroy(b.get(i));
Singletons.getModel().getGame().getAction().sacrificeDestroy(b.get(i));
}
}
}
@@ -1547,7 +1538,7 @@ public class GameAction {
final ArrayList<SpellAbility> abilities = c.getSpellAbilities();
final ArrayList<String> choices = new ArrayList<String>();
final Player human = Singletons.getControl().getPlayer();
final PlayerZone zone = game.getZoneOf(c);
final Zone zone = game.getZoneOf(c);
if (c.isLand() && human.canPlayLand()) {
if (zone.is(ZoneType.Hand) || ((!zone.is(ZoneType.Battlefield)) && c.hasStartOfKeyword("May be played"))) {
@@ -1648,7 +1639,7 @@ public class GameAction {
if (sa.isSpell()) {
final Card c = sa.getSourceCard();
if (!c.isCopiedSpell()) {
sa.setSourceCard(Singletons.getModel().getGameAction().moveToStack(c));
sa.setSourceCard(Singletons.getModel().getGame().getAction().moveToStack(c));
}
}
boolean x = sa.getSourceCard().getManaCost().getShardCount(ManaCostShard.X) > 0;
@@ -1975,7 +1966,7 @@ public class GameAction {
if (sa.getAfterPayMana() == null) {
final Card source = sa.getSourceCard();
if (sa.isSpell() && !source.isCopiedSpell()) {
sa.setSourceCard(Singletons.getModel().getGameAction().moveToStack(source));
sa.setSourceCard(Singletons.getModel().getGame().getAction().moveToStack(source));
}
game.getStack().add(sa);

View File

@@ -105,7 +105,7 @@ public final class GameActionUtil {
public void execute() {
if (!c.isCopiedSpell()) {
final List<Card> maelstromNexii = CardLists.filter(Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Maelstrom Nexus"));
final List<Card> maelstromNexii = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Maelstrom Nexus"));
for (final Card nexus : maelstromNexii) {
if (CardUtil.getThisTurnCast("Card.YouCtrl", nexus).size() == 1) {
@@ -165,7 +165,7 @@ public final class GameActionUtil {
title.toString(), JOptionPane.YES_NO_OPTION);
if (answer == JOptionPane.YES_OPTION) {
Singletons.getModel().getGameAction().playCardWithoutManaCost(cascadedCard);
Singletons.getModel().getGame().getAction().playCardWithoutManaCost(cascadedCard);
revealed.remove(cascadedCard);
}
} else {
@@ -191,7 +191,7 @@ public final class GameActionUtil {
}
CardLists.shuffle(revealed);
for (final Card bottom : revealed) {
Singletons.getModel().getGameAction().moveToBottomOfLibrary(bottom);
Singletons.getModel().getGame().getAction().moveToBottomOfLibrary(bottom);
}
}
};
@@ -200,7 +200,7 @@ public final class GameActionUtil {
ability.setStackDescription(sb.toString());
ability.setActivatingPlayer(controller);
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
}
};
@@ -284,7 +284,7 @@ public final class GameActionUtil {
JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null,
possibleValues, possibleValues[0]);
if (q.equals(0)) {
Singletons.getModel().getGameAction().playCardWithoutManaCost(rippledCards[i]);
Singletons.getModel().getGame().getAction().playCardWithoutManaCost(rippledCards[i]);
revealed.remove(rippledCards[i]);
}
} else {
@@ -311,7 +311,7 @@ public final class GameActionUtil {
}
CardLists.shuffle(revealed);
for (final Card bottom : revealed) {
Singletons.getModel().getGameAction().moveToBottomOfLibrary(bottom);
Singletons.getModel().getGame().getAction().moveToBottomOfLibrary(bottom);
}
}
};
@@ -319,7 +319,7 @@ public final class GameActionUtil {
sb.append(c).append(" - Ripple.");
ability.setStackDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
}
}
@@ -345,10 +345,10 @@ public final class GameActionUtil {
final Command unpaid) {
// temporarily disable the Resolve flag, so the user can payMana for the
// resolving Ability
final boolean bResolving = Singletons.getModel().getGameState().getStack().isResolving();
Singletons.getModel().getGameState().getStack().setResolving(false);
final boolean bResolving = Singletons.getModel().getGame().getStack().isResolving();
Singletons.getModel().getGame().getStack().setResolving(false);
Singletons.getModel().getMatch().getInput().setInput(new InputPayManaCostAbility(message, manaCost, paid, unpaid));
Singletons.getModel().getGameState().getStack().setResolving(bResolving);
Singletons.getModel().getGame().getStack().setResolving(bResolving);
}
/**
@@ -427,7 +427,7 @@ public final class GameActionUtil {
source.addCounterFromNonEffect(counterType, amount);
} else {
hasPaid = false;
Singletons.getModel().getGameState().getGameLog().add("ResolveStack", "Trying to pay upkeep for " + source + " but it can't have "
Singletons.getModel().getGame().getGameLog().add("ResolveStack", "Trying to pay upkeep for " + source + " but it can't have "
+ counterType.getName() + " counters put on it.", 2);
break;
}
@@ -442,7 +442,7 @@ public final class GameActionUtil {
if ("All".equals(part.getType())) {
if (showYesNoDialog(source, "Do you want to exile all cards in your graveyard?")) {
for (final Card card : p.getCardsIn(ZoneType.Graveyard)) {
Singletons.getModel().getGameAction().exile(card);
Singletons.getModel().getGame().getAction().exile(card);
}
} else {
hasPaid = false;
@@ -462,7 +462,7 @@ public final class GameActionUtil {
if (c != null) {
list.remove(c);
Singletons.getModel().getGameAction().exile(c);
Singletons.getModel().getGame().getAction().exile(c);
} else {
hasPaid = false;
break;
@@ -490,30 +490,30 @@ public final class GameActionUtil {
//the following costs need inputs and can't be combined at the moment
if (costPart instanceof CostSacrifice) {
final boolean bResolving = Singletons.getModel().getGameState().getStack().isResolving();
Singletons.getModel().getGameState().getStack().setResolving(false);
final boolean bResolving = Singletons.getModel().getGame().getStack().isResolving();
Singletons.getModel().getGame().getStack().setResolving(false);
Singletons.getModel().getMatch().getInput().setInput(new InputPaySacCost((CostSacrifice) costPart, ability, paid, unpaid));
Singletons.getModel().getGameState().getStack().setResolving(bResolving);
Singletons.getModel().getGame().getStack().setResolving(bResolving);
}
else if (costPart instanceof CostReturn) {
final boolean bResolving = Singletons.getModel().getGameState().getStack().isResolving();
Singletons.getModel().getGameState().getStack().setResolving(false);
final boolean bResolving = Singletons.getModel().getGame().getStack().isResolving();
Singletons.getModel().getGame().getStack().setResolving(false);
Singletons.getModel().getMatch().getInput().setInput(new InputPayReturnCost((CostReturn) costPart, ability, paid, unpaid));
Singletons.getModel().getGameState().getStack().setResolving(bResolving);
Singletons.getModel().getGame().getStack().setResolving(bResolving);
}
else if (costPart instanceof CostDiscard) {
final boolean bResolving = Singletons.getModel().getGameState().getStack().isResolving();
Singletons.getModel().getGameState().getStack().setResolving(false);
final boolean bResolving = Singletons.getModel().getGame().getStack().isResolving();
Singletons.getModel().getGame().getStack().setResolving(false);
Singletons.getModel().getMatch().getInput().setInput(new InputPayDiscardCost((CostDiscard) costPart, ability, paid, unpaid));
Singletons.getModel().getGameState().getStack().setResolving(bResolving);
Singletons.getModel().getGame().getStack().setResolving(bResolving);
}
else if (costPart instanceof CostMana) {
// temporarily disable the Resolve flag, so the user can payMana for the
// resolving Ability
final boolean bResolving = Singletons.getModel().getGameState().getStack().isResolving();
Singletons.getModel().getGameState().getStack().setResolving(false);
final boolean bResolving = Singletons.getModel().getGame().getStack().isResolving();
Singletons.getModel().getGame().getStack().setResolving(false);
Singletons.getModel().getMatch().getInput().setInput(new InputPayManaCostAbility(source + "\r\n", ability.getManaCost(), paid, unpaid));
Singletons.getModel().getGameState().getStack().setResolving(bResolving);
Singletons.getModel().getGame().getStack().setResolving(bResolving);
}
}
@@ -656,14 +656,14 @@ public final class GameActionUtil {
final Ability ability = new Ability(source, "0") {
@Override
public void resolve() {
Singletons.getModel().getGameAction().destroy(affected);
Singletons.getModel().getGame().getAction().destroy(affected);
}
};
final Ability ability2 = new Ability(source, "0") {
@Override
public void resolve() {
Singletons.getModel().getGameAction().destroyNoRegeneration(affected);
Singletons.getModel().getGame().getAction().destroyNoRegeneration(affected);
}
};
@@ -675,12 +675,12 @@ public final class GameActionUtil {
.getAmountOfKeyword("When CARDNAME is dealt damage, destroy it. It can't be regenerated.");
for (int i = 0; i < amount; i++) {
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability2);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability2);
}
final int amount2 = affected.getAmountOfKeyword("When CARDNAME is dealt damage, destroy it.");
for (int i = 0; i < amount2; i++) {
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
}
}
}
@@ -727,7 +727,7 @@ public final class GameActionUtil {
}
ability2.setStackDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability2);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability2);
}
}
@@ -774,7 +774,7 @@ public final class GameActionUtil {
sb.append(" sacrifices ").append(damage).append(" nontoken permanents.");
ability.setStackDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
}
@@ -833,7 +833,7 @@ public final class GameActionUtil {
for (int i = 0; i < keywords.size(); i++) {
if (keywords.get(i).startsWith("Poisonous")) {
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
}
}
@@ -871,7 +871,7 @@ public final class GameActionUtil {
doubleLife.setStackDescription(aura.getName() + " - " + enchanted.getController()
+ " doubles his or her life total.");
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(doubleLife);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(doubleLife);
}
}
@@ -941,7 +941,7 @@ public final class GameActionUtil {
for (int j = 0; j < max; j++) {
final Card c = libList.get(j);
Singletons.getModel().getGameAction().exile(c);
Singletons.getModel().getGame().getAction().exile(c);
}
}
}; // ability
@@ -952,7 +952,7 @@ public final class GameActionUtil {
sb.append("If two or more of those cards have the same name, repeat this process.");
ability.setStackDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
}
}
@@ -983,7 +983,7 @@ public final class GameActionUtil {
produces.put("Plains", "W");
produces.put("Swamp", "B");
List<Card> lands = Singletons.getModel().getGameState().getCardsInGame();
List<Card> lands = Singletons.getModel().getGame().getCardsInGame();
lands = CardLists.filter(lands, Presets.LANDS);
// remove all abilities granted by this Command
@@ -1054,8 +1054,8 @@ public final class GameActionUtil {
}
// add +1/+1 to cards
list.clear();
final int num = CardLists.filter(Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Coat of Arms")).size();
final List<Card> creatures = CardLists.filter(Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES);
final int num = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Coat of Arms")).size();
final List<Card> creatures = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES);
for (Card c : creatures) {
for (Card c2 : creatures) {
@@ -1079,9 +1079,9 @@ public final class GameActionUtil {
@Override
public void execute() {
final List<Card> alphaStatuses = CardLists.filter(Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Alpha Status"));
final List<Card> alphaStatuses = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Alpha Status"));
final List<Card> allCreatures = CardLists.filter(Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield), Presets.CREATURES);
final List<Card> allCreatures = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), Presets.CREATURES);
for (int i = 0; i < this.previouslyPumped.size(); i++) {
this.previouslyPumped.get(i).addSemiPermanentAttackBoost(0 - this.previouslyPumpedValue.get(i));
@@ -1116,7 +1116,7 @@ public final class GameActionUtil {
@Override
public void execute() {
// get all creatures
final List<Card> cards = CardLists.filter(Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Umbra Stalker"));
final List<Card> cards = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Umbra Stalker"));
for (final Card c : cards) {
final Player player = c.getController();
final List<Card> grave = player.getCardsIn(ZoneType.Graveyard);
@@ -1133,7 +1133,7 @@ public final class GameActionUtil {
@Override
public void execute() {
List<Card> list = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
List<Card> list = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
list = CardLists.filter(list, new Predicate<Card>() {
@Override
@@ -1156,7 +1156,7 @@ public final class GameActionUtil {
@Override
public void execute() {
final List<Card> list = CardLists.filter(Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Old Man of the Sea"));
final List<Card> list = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Old Man of the Sea"));
for (final Card oldman : list) {
if (!oldman.getGainControlTargets().isEmpty()) {
if (oldman.getNetAttack() < oldman.getGainControlTargets().get(0).getNetAttack()) {
@@ -1177,7 +1177,7 @@ public final class GameActionUtil {
@Override
public void execute() {
final List<Card> list = CardLists.filter(Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Liu Bei, Lord of Shu"));
final List<Card> list = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Liu Bei, Lord of Shu"));
if (list.size() > 0) {
for (int i = 0; i < list.size(); i++) {
@@ -1216,7 +1216,7 @@ public final class GameActionUtil {
@Override
public void execute() {
List<Card> list = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
List<Card> list = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
list = CardLists.filter(list, new Predicate<Card>() {
@Override
public boolean apply(final Card c) {
@@ -1234,7 +1234,7 @@ public final class GameActionUtil {
}
private int countSoundTheCalls() {
List<Card> list = CardLists.filter(Singletons.getModel().getGameState().getCardsIn(ZoneType.Graveyard), CardPredicates.nameEquals("Sound the Call"));
List<Card> list = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Graveyard), CardPredicates.nameEquals("Sound the Call"));
return list.size();
}
@@ -1247,7 +1247,7 @@ public final class GameActionUtil {
@Override
public void execute() {
// get all creatures
final List<Card> list = CardLists.filter(Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Tarmogoyf"));
final List<Card> list = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Tarmogoyf"));
for (int i = 0; i < list.size(); i++) {
final Card c = list.get(i);
@@ -1258,7 +1258,7 @@ public final class GameActionUtil {
} // execute()
private int countDiffTypes() {
final List<Card> list = Singletons.getModel().getGameState().getCardsIn(ZoneType.Graveyard);
final List<Card> list = Singletons.getModel().getGame().getCardsIn(ZoneType.Graveyard);
int count = 0;
for (int q = 0; q < list.size(); q++) {

View File

@@ -56,7 +56,7 @@ public class StaticEffects {
}
this.staticEffects = new ArrayList<StaticEffect>();
Singletons.getModel().getGameState().getTriggerHandler().cleanUpTemporaryTriggers();
Singletons.getModel().getGame().getTriggerHandler().cleanUpTemporaryTriggers();
}
/**
@@ -325,7 +325,7 @@ public class StaticEffects {
public final void rePopulateStateBasedList() {
this.reset();
final List<Card> cards = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
final List<Card> cards = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
Log.debug("== Start add state effects ==");
for (int i = 0; i < cards.size(); i++) {

View File

@@ -6,7 +6,7 @@ import forge.Card;
import forge.GameEntity;
import forge.card.cardfactory.CardFactoryUtil;
import forge.card.spellability.SpellAbility;
import forge.game.zone.PlayerZone;
import forge.game.zone.Zone;
import forge.game.zone.ZoneType;
/**
@@ -59,7 +59,7 @@ public abstract class TriggerReplacementBase {
*
* @return a boolean.
*/
public final boolean zonesCheck(PlayerZone hostCardZone) {
public final boolean zonesCheck(Zone hostCardZone) {
return !this.hostCard.isPhasedOut()
&& (validHostZones == null || validHostZones.isEmpty()
|| (hostCardZone != null && validHostZones.contains(hostCardZone.getZoneType()))

View File

@@ -1495,12 +1495,12 @@ public class AbilityFactory {
return false;
}
if (sa.getRestrictions().getPlaneswalker() && Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.MAIN2)) {
if (sa.getRestrictions().getPlaneswalker() && Singletons.getModel().getGame().getPhaseHandler().is(PhaseType.MAIN2)) {
return true;
}
return (Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.END_OF_TURN)
&& Singletons.getModel().getGameState().getPhaseHandler().isNextTurn(PlayerType.COMPUTER));
return (Singletons.getModel().getGame().getPhaseHandler().is(PhaseType.END_OF_TURN)
&& Singletons.getModel().getGame().getPhaseHandler().isNextTurn(PlayerType.COMPUTER));
}
// returns true if it's better to wait until blockers are declared
@@ -1517,8 +1517,8 @@ public class AbilityFactory {
return (sa.getSourceCard().isCreature()
&& sa.getPayCosts().getTap()
&& (Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)
|| Singletons.getModel().getGameState().getPhaseHandler().isNextTurn(PlayerType.HUMAN)));
&& (Singletons.getModel().getGame().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)
|| Singletons.getModel().getGame().getPhaseHandler().isNextTurn(PlayerType.HUMAN)));
}
/**
@@ -1630,10 +1630,10 @@ public class AbilityFactory {
// Add whole Remembered list to handlePaid
final List<Card> list = new ArrayList<Card>();
if (card.getRemembered().isEmpty()) {
final Card newCard = Singletons.getModel().getGameState().getCardState(card);
final Card newCard = Singletons.getModel().getGame().getCardState(card);
for (final Object o : newCard.getRemembered()) {
if (o instanceof Card) {
list.add(Singletons.getModel().getGameState().getCardState((Card) o));
list.add(Singletons.getModel().getGame().getCardState((Card) o));
}
}
}
@@ -1647,7 +1647,7 @@ public class AbilityFactory {
} else {
for (final Object o : card.getRemembered()) {
if (o instanceof Card) {
list.add(Singletons.getModel().getGameState().getCardState((Card) o));
list.add(Singletons.getModel().getGame().getCardState((Card) o));
}
}
}
@@ -1657,7 +1657,7 @@ public class AbilityFactory {
// Add whole Imprinted list to handlePaid
final List<Card> list = new ArrayList<Card>();
for (final Card c : card.getImprinted()) {
list.add(Singletons.getModel().getGameState().getCardState(c));
list.add(Singletons.getModel().getGame().getCardState(c));
}
return CardFactoryUtil.handlePaid(list, calcX[1], card) * multiplier;
@@ -1667,7 +1667,7 @@ public class AbilityFactory {
if (card.isEnchanting()) {
Object o = card.getEnchanting();
if (o instanceof Card) {
list.add(Singletons.getModel().getGameState().getCardState((Card) o));
list.add(Singletons.getModel().getGame().getCardState((Card) o));
}
}
return CardFactoryUtil.handlePaid(list, calcX[1], card) * multiplier;
@@ -1927,7 +1927,7 @@ public class AbilityFactory {
else {
final Object crd = root.getTriggeringObject(defined.substring(9));
if (crd instanceof Card) {
c = Singletons.getModel().getGameState().getCardState((Card) crd);
c = Singletons.getModel().getGame().getCardState((Card) crd);
c = (Card) crd;
} else if (crd instanceof List<?>) {
for (final Card cardItem : (List<Card>) crd) {
@@ -1939,7 +1939,7 @@ public class AbilityFactory {
final SpellAbility root = sa.getRootSpellAbility();
final Object crd = root.getReplacingObject(defined.substring(8));
if (crd instanceof Card) {
c = Singletons.getModel().getGameState().getCardState((Card) crd);
c = Singletons.getModel().getGame().getCardState((Card) crd);
} else if (crd instanceof List<?>) {
for (final Card cardItem : (List<Card>) crd) {
cards.add(cardItem);
@@ -1947,26 +1947,26 @@ public class AbilityFactory {
}
} else if (defined.equals("Remembered")) {
if (hostCard.getRemembered().isEmpty()) {
final Card newCard = Singletons.getModel().getGameState().getCardState(hostCard);
final Card newCard = Singletons.getModel().getGame().getCardState(hostCard);
for (final Object o : newCard.getRemembered()) {
if (o instanceof Card) {
cards.add(Singletons.getModel().getGameState().getCardState((Card) o));
cards.add(Singletons.getModel().getGame().getCardState((Card) o));
}
}
}
for (final Object o : hostCard.getRemembered()) {
if (o instanceof Card) {
cards.add(Singletons.getModel().getGameState().getCardState((Card) o));
cards.add(Singletons.getModel().getGame().getCardState((Card) o));
}
}
} else if (defined.equals("Clones")) {
for (final Card clone : hostCard.getClones()) {
cards.add(Singletons.getModel().getGameState().getCardState(clone));
cards.add(Singletons.getModel().getGame().getCardState(clone));
}
} else if (defined.equals("Imprinted")) {
for (final Card imprint : hostCard.getImprinted()) {
cards.add(Singletons.getModel().getGameState().getCardState(imprint));
cards.add(Singletons.getModel().getGame().getCardState(imprint));
}
} else if (defined.startsWith("ThisTurnEntered")) {
final String[] workingCopy = defined.split("_");
@@ -2187,12 +2187,12 @@ public class AbilityFactory {
}
}
} else if (defined.equals("AttackingPlayer")) {
final Player p = Singletons.getModel().getGameState().getCombat().getAttackingPlayer();
final Player p = Singletons.getModel().getGame().getCombat().getAttackingPlayer();
if (!players.contains(p)) {
players.add(p);
}
} else if (defined.equals("DefendingPlayer")) {
final Player p = Singletons.getModel().getGameState().getCombat().getDefendingPlayer();
final Player p = Singletons.getModel().getGame().getCombat().getDefendingPlayer();
if (!players.contains(p)) {
players.add(p);
}
@@ -2210,7 +2210,7 @@ public class AbilityFactory {
players.add(sa.getActivatingPlayer().getOpponent());
}
} else {
for (Player p : Singletons.getModel().getGameState().getPlayers()) {
for (Player p : Singletons.getModel().getGame().getPlayers()) {
if (p.isValid(defined, sa.getActivatingPlayer(), sa.getSourceCard())) {
players.add(p);
}
@@ -2262,7 +2262,7 @@ public class AbilityFactory {
for (final Object o : card.getRemembered()) {
if (o instanceof Card) {
final Card rem = (Card) o;
sas.addAll(Singletons.getModel().getGameState().getCardState(rem).getSpellAbilities());
sas.addAll(Singletons.getModel().getGame().getCardState(rem).getSpellAbilities());
}
}
} else if (defined.equals("Imprinted")) {
@@ -2283,7 +2283,7 @@ public class AbilityFactory {
final SpellAbility root = sa.getRootSpellAbility();
final Object crd = root.getTriggeringObject("Card");
if (crd instanceof Card) {
triggeredCard = Singletons.getModel().getGameState().getCardState((Card) crd);
triggeredCard = Singletons.getModel().getGame().getCardState((Card) crd);
} //find the imprinted card that does not share a name with the triggered card
for (final SpellAbility spell : imprintedCards) {
if (!spell.getSourceCard().getName().equals(triggeredCard.getName())) {
@@ -2426,12 +2426,12 @@ public class AbilityFactory {
*/
public static ArrayList<Object> predictThreatenedObjects(final Player aiPlayer, final AbilityFactory saviourAf) {
final ArrayList<Object> objects = new ArrayList<Object>();
if (Singletons.getModel().getGameState().getStack().size() == 0) {
if (Singletons.getModel().getGame().getStack().size() == 0) {
return objects;
}
// check stack for something that will kill this
final SpellAbility topStack = Singletons.getModel().getGameState().getStack().peekAbility();
final SpellAbility topStack = Singletons.getModel().getGame().getStack().peekAbility();
objects.addAll(AbilityFactory.predictThreatenedObjects(aiPlayer, saviourAf, topStack));
return objects;
@@ -2906,7 +2906,7 @@ public class AbilityFactory {
// every resolving spellAbility will end here
if (usedStack) {
SpellAbility root = sa.getRootSpellAbility();
Singletons.getModel().getGameState().getStack().finishResolving(root, false);
Singletons.getModel().getGame().getStack().finishResolving(root, false);
}
return;
}

View File

@@ -323,13 +323,13 @@ public class AbilityFactoryAlterLife {
return false;
}
}
if (Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_DECLARE_BLOCKERS)
if (Singletons.getModel().getGame().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_DECLARE_BLOCKERS)
&& !params.containsKey("ActivationPhases")) {
return false;
}
boolean lifeCritical = life <= 5;
lifeCritical |= (Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_DAMAGE)
&& CombatUtil.lifeInDanger(ai, Singletons.getModel().getGameState().getCombat()));
lifeCritical |= (Singletons.getModel().getGame().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_DAMAGE)
&& CombatUtil.lifeInDanger(ai, Singletons.getModel().getGame().getCombat()));
if (abCost != null && !lifeCritical) {
if (!CostUtil.checkSacrificeCost(ai, abCost, source, false)) {
@@ -355,7 +355,7 @@ public class AbilityFactoryAlterLife {
// Don't use lifegain before main 2 if possible
if (!lifeCritical
&& Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2)
&& Singletons.getModel().getGame().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2)
&& !params.containsKey("ActivationPhases")) {
return false;
}
@@ -782,7 +782,7 @@ public class AbilityFactoryAlterLife {
}
// Don't use loselife before main 2 if possible
if (Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2)
if (Singletons.getModel().getGame().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2)
&& !params.containsKey("ActivationPhases") && !priority) {
return false;
}
@@ -1265,7 +1265,7 @@ public class AbilityFactoryAlterLife {
}
// Don't use poison before main 2 if possible
if (Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2) && !params.containsKey("ActivationPhases")) {
if (Singletons.getModel().getGame().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2) && !params.containsKey("ActivationPhases")) {
return false;
}
@@ -1512,7 +1512,7 @@ public class AbilityFactoryAlterLife {
}
// Don't use setLife before main 2 if possible
if (Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2) && !params.containsKey("ActivationPhases")) {
if (Singletons.getModel().getGame().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2) && !params.containsKey("ActivationPhases")) {
return false;
}

View File

@@ -360,8 +360,8 @@ public final class AbilityFactoryAnimate {
// don't use instant speed animate abilities outside computers
// Combat_Begin step
if (!Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.COMBAT_BEGIN)
&& Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(aiPlayer)
if (!Singletons.getModel().getGame().getPhaseHandler().is(PhaseType.COMBAT_BEGIN)
&& Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(aiPlayer)
&& !AbilityFactory.isSorcerySpeed(sa)
&& !params.containsKey("ActivationPhases") && !params.containsKey("Permanent")) {
return false;
@@ -369,7 +369,7 @@ public final class AbilityFactoryAnimate {
Player opponent = aiPlayer.getOpponent();
// don't animate if the AI won't attack anyway
if (Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(aiPlayer)
if (Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(aiPlayer)
&& aiPlayer.getLife() < 6
&& opponent.getLife() > 6
&& Iterables.any(opponent.getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES)) {
@@ -378,14 +378,14 @@ public final class AbilityFactoryAnimate {
// don't use instant speed animate abilities outside humans
// Combat_Declare_Attackers_InstantAbility step
if ((!Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY)
|| (Singletons.getModel().getGameState().getCombat().getAttackers().isEmpty()))
&& Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(opponent)) {
if ((!Singletons.getModel().getGame().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY)
|| (Singletons.getModel().getGame().getCombat().getAttackers().isEmpty()))
&& Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(opponent)) {
return false;
}
// don't activate during main2 unless this effect is permanent
if (Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.MAIN2) && !params.containsKey("Permanent")) {
if (Singletons.getModel().getGame().getPhaseHandler().is(PhaseType.MAIN2) && !params.containsKey("Permanent")) {
return false;
}
@@ -394,7 +394,7 @@ public final class AbilityFactoryAnimate {
boolean bFlag = false;
for (final Card c : defined) {
bFlag |= (!c.isCreature() && !c.isTapped() && !(c.getTurnInZone() == Singletons.getModel().getGameState().getPhaseHandler().getTurn()));
bFlag |= (!c.isCreature() && !c.isTapped() && !(c.getTurnInZone() == Singletons.getModel().getGame().getPhaseHandler().getTurn()));
// for creatures that could be improved (like Figure of Destiny)
if (c.isCreature() && (params.containsKey("Permanent") || (!c.isTapped() && !c.isSick()))) {
@@ -556,7 +556,7 @@ public final class AbilityFactoryAnimate {
}
// Every Animate event needs a unique time stamp
timest = Singletons.getModel().getGameState().getNextTimestamp();
timest = Singletons.getModel().getGame().getNextTimestamp();
final long timestamp = timest;
@@ -767,17 +767,17 @@ public final class AbilityFactoryAnimate {
if (!permanent) {
if (params.containsKey("UntilEndOfCombat")) {
Singletons.getModel().getGameState().getEndOfCombat().addUntil(unanimate);
Singletons.getModel().getGame().getEndOfCombat().addUntil(unanimate);
} else if (params.containsKey("UntilHostLeavesPlay")) {
host.addLeavesPlayCommand(unanimate);
} else if (params.containsKey("UntilYourNextUpkeep")) {
Singletons.getModel().getGameState().getUpkeep().addUntil(host.getController(), unanimate);
Singletons.getModel().getGame().getUpkeep().addUntil(host.getController(), unanimate);
} else if (params.containsKey("UntilControllerNextUntap")) {
Singletons.getModel().getGameState().getUntap().addUntil(c.getController(), unanimate);
Singletons.getModel().getGame().getUntap().addUntil(c.getController(), unanimate);
} else if (params.containsKey("UntilYourNextTurn")) {
Singletons.getModel().getGameState().getCleanup().addUntilYourNextTurn(host.getController(), unanimate);
Singletons.getModel().getGame().getCleanup().addUntilYourNextTurn(host.getController(), unanimate);
} else {
Singletons.getModel().getGameState().getEndOfTurn().addUntil(unanimate);
Singletons.getModel().getGame().getEndOfTurn().addUntil(unanimate);
}
}
}
@@ -1206,7 +1206,7 @@ public final class AbilityFactoryAnimate {
}
// Every Animate event needs a unique time stamp
timest = Singletons.getModel().getGameState().getNextTimestamp();
timest = Singletons.getModel().getGame().getNextTimestamp();
final long timestamp = timest;
@@ -1294,7 +1294,7 @@ public final class AbilityFactoryAnimate {
}
if ((tgtPlayers == null) || tgtPlayers.isEmpty()) {
list = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
list = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
} else {
list = tgtPlayers.get(0).getCardsIn(ZoneType.Battlefield);
}
@@ -1404,9 +1404,9 @@ public final class AbilityFactoryAnimate {
if (!permanent) {
if (params.containsKey("UntilEndOfCombat")) {
Singletons.getModel().getGameState().getEndOfCombat().addUntil(unanimate);
Singletons.getModel().getGame().getEndOfCombat().addUntil(unanimate);
} else {
Singletons.getModel().getGameState().getEndOfTurn().addUntil(unanimate);
Singletons.getModel().getGame().getEndOfTurn().addUntil(unanimate);
}
}
}

View File

@@ -98,7 +98,7 @@ public class AbilityFactoryAttach {
// The Spell_Permanent (Auras) version of this AF needs to
// move the card into play before Attaching
this.getSourceCard().addController(this.getActivatingPlayer());
final Card c = Singletons.getModel().getGameAction()
final Card c = Singletons.getModel().getGame().getAction()
.moveTo(this.getActivatingPlayer().getZone(ZoneType.Battlefield), this.getSourceCard());
this.setSourceCard(c);
AbilityFactoryAttach.attachResolve(abilityFactory, this);
@@ -346,7 +346,7 @@ public class AbilityFactoryAttach {
return null;
}
List<Card> list = Singletons.getModel().getGameState().getCardsIn(tgt.getZone());
List<Card> list = Singletons.getModel().getGame().getCardsIn(tgt.getZone());
list = CardLists.getValidCards(list, tgt.getValidTgts(), sa.getActivatingPlayer(), attachSource);
if (params.containsKey("AITgts")) {
list = CardLists.getValidCards(list, params.get("AITgts"), sa.getActivatingPlayer(), attachSource);
@@ -589,7 +589,7 @@ public class AbilityFactoryAttach {
* @return true, if is useful keyword
*/
public static boolean isUsefulAttachKeyword(final String keyword, final Card card, final SpellAbility sa) {
final PhaseHandler ph = Singletons.getModel().getGameState().getPhaseHandler();
final PhaseHandler ph = Singletons.getModel().getGame().getPhaseHandler();
final Player human = sa.getActivatingPlayer().getOpponent();
if (!CardUtil.isStackingKeyword(keyword) && card.hasKeyword(keyword)) {
return false;
@@ -1114,7 +1114,7 @@ public class AbilityFactoryAttach {
source.setSVar("PayX", Integer.toString(xPay));
}
if (Singletons.getModel().getGameState().getPhaseHandler().getPhase().isAfter(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)
if (Singletons.getModel().getGame().getPhaseHandler().getPhase().isAfter(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)
&& !"Curse".equals(af.getMapParams().get("AILogic"))) {
return false;
}
@@ -1403,7 +1403,7 @@ public class AbilityFactoryAttach {
if (tgt.canTgtPlayer()) {
final ArrayList<Player> players = new ArrayList<Player>();
for (Player player : Singletons.getModel().getGameState().getPlayers()) {
for (Player player : Singletons.getModel().getGame().getPlayers()) {
if (player.isValid(tgt.getValidTgts(), aura.getActivatingPlayer(), source)) {
players.add(player);
}
@@ -1416,7 +1416,7 @@ public class AbilityFactoryAttach {
return true;
}
} else {
List<Card> list = Singletons.getModel().getGameState().getCardsIn(tgt.getZone());
List<Card> list = Singletons.getModel().getGame().getCardsIn(tgt.getZone());
list = CardLists.getValidCards(list, tgt.getValidTgts(), aura.getActivatingPlayer(), source);
final Object o = GuiChoose.one(source + " - Select a card to attach to.", list);
@@ -1644,7 +1644,7 @@ public class AbilityFactoryAttach {
source.setSVar("PayX", Integer.toString(xPay));
}
if (Singletons.getModel().getGameState().getPhaseHandler().getPhase().isAfter(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)
if (Singletons.getModel().getGame().getPhaseHandler().getPhase().isAfter(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)
&& !"Curse".equals(af.getMapParams().get("AILogic"))) {
return false;
}
@@ -1710,7 +1710,7 @@ public class AbilityFactoryAttach {
// If Cast Targets will be checked on the Stack
for (final Object o : targets) {
String valid = params.get("UnattachValid");
List<Card> unattachList = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
List<Card> unattachList = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
unattachList = CardLists.getValidCards(unattachList, valid.split(","), source.getController(), source);
for (final Card c : unattachList) {
AbilityFactoryAttach.handleUnattachment(o, c, af);

View File

@@ -325,7 +325,7 @@ public final class AbilityFactoryBond {
}
// find list of valid cards to pair with
List<Card> cards = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
List<Card> cards = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
cards = AbilityFactory.filterListByType(cards, params.get("ValidCards"), sa);
if (cards.isEmpty()) {
return;

View File

@@ -55,7 +55,7 @@ import forge.game.phase.PhaseType;
import forge.game.player.ComputerUtil;
import forge.game.player.ComputerUtilBlock;
import forge.game.player.Player;
import forge.game.zone.PlayerZone;
import forge.game.zone.Zone;
import forge.game.zone.ZoneType;
import forge.gui.GuiChoose;
import forge.util.MyRandom;
@@ -511,17 +511,17 @@ public final class AbilityFactoryChangeZone {
//Ninjutsu
if (params.containsKey("Ninjutsu")) {
if (source.isType("Legendary") && !Singletons.getModel().getGameState().isCardInPlay("Mirror Gallery")) {
if (source.isType("Legendary") && !Singletons.getModel().getGame().isCardInPlay("Mirror Gallery")) {
final List<Card> list = ai.getCardsIn(ZoneType.Battlefield);
if (Iterables.any(list, CardPredicates.nameEquals(source.getName()))) {
return false;
}
}
if (Singletons.getModel().getGameState().getPhaseHandler().getPhase().isAfter(PhaseType.COMBAT_DAMAGE)) {
if (Singletons.getModel().getGame().getPhaseHandler().getPhase().isAfter(PhaseType.COMBAT_DAMAGE)) {
return false;
}
List<Card> attackers = new ArrayList<Card>();
attackers.addAll(Singletons.getModel().getGameState().getCombat().getUnblockedAttackers());
attackers.addAll(Singletons.getModel().getGame().getCombat().getUnblockedAttackers());
boolean lowerCMC = false;
for (Card attacker : attackers) {
if (attacker.getCMC() < source.getCMC()) {
@@ -592,7 +592,7 @@ public final class AbilityFactoryChangeZone {
}
// don't use fetching to top of library/graveyard before main2
if (Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2)
if (Singletons.getModel().getGame().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2)
&& !params.containsKey("ActivationPhases")) {
if (!destination.equals("Battlefield") && !destination.equals("Hand")) {
return false;
@@ -974,7 +974,7 @@ public final class AbilityFactoryChangeZone {
}
} else if (!origin.contains(ZoneType.Library) && !origin.contains(ZoneType.Hand)
&& !params.containsKey("DefinedPlayer")) {
fetchList = Singletons.getModel().getGameState().getCardsIn(origin);
fetchList = Singletons.getModel().getGame().getCardsIn(origin);
} else {
fetchList = player.getCardsIn(origin);
}
@@ -1035,7 +1035,7 @@ public final class AbilityFactoryChangeZone {
if (origin.contains(ZoneType.Library) && (i < 1) && "False".equals(params.get("Shuffle"))) {
player.shuffle();
}
movedCard = Singletons.getModel().getGameAction().moveToLibrary(c, libraryPos);
movedCard = Singletons.getModel().getGame().getAction().moveToLibrary(c, libraryPos);
} else if (destination.equals(ZoneType.Battlefield)) {
if (params.containsKey("Tapped")) {
c.setTapped(true);
@@ -1064,20 +1064,20 @@ public final class AbilityFactoryChangeZone {
}
if (params.containsKey("Attacking")) {
Singletons.getModel().getGameState().getCombat().addAttacker(c);
Singletons.getModel().getGame().getCombat().addAttacker(c);
}
movedCard = Singletons.getModel().getGameAction().moveTo(c.getController().getZone(destination), c);
movedCard = Singletons.getModel().getGame().getAction().moveTo(c.getController().getZone(destination), c);
if (params.containsKey("Tapped")) {
movedCard.setTapped(true);
}
} else if (destination.equals(ZoneType.Exile)) {
movedCard = Singletons.getModel().getGameAction().exile(c);
movedCard = Singletons.getModel().getGame().getAction().exile(c);
if (params.containsKey("ExileFaceDown")) {
movedCard.setState(CardCharacteristicName.FaceDown);
}
} else {
movedCard = Singletons.getModel().getGameAction().moveTo(destination, c);
movedCard = Singletons.getModel().getGame().getAction().moveTo(destination, c);
}
movedCards.add(movedCard);
@@ -1160,7 +1160,7 @@ public final class AbilityFactoryChangeZone {
}
} else if (!origin.contains(ZoneType.Library) && !origin.contains(ZoneType.Hand)
&& !params.containsKey("DefinedPlayer")) {
fetchList = Singletons.getModel().getGameState().getCardsIn(origin);
fetchList = Singletons.getModel().getGame().getCardsIn(origin);
fetchList = AbilityFactory.filterListByType(fetchList, type, sa);
} else {
fetchList = player.getCardsIn(origin);
@@ -1297,7 +1297,7 @@ public final class AbilityFactoryChangeZone {
if (ZoneType.Library.equals(destination)) {
final int libraryPos = params.containsKey("LibraryPosition") ? Integer.parseInt(params
.get("LibraryPosition")) : 0;
movedCard = Singletons.getModel().getGameAction().moveToLibrary(c, libraryPos);
movedCard = Singletons.getModel().getGame().getAction().moveToLibrary(c, libraryPos);
} else if (ZoneType.Battlefield.equals(destination)) {
if (params.containsKey("Tapped")) {
c.setTapped(true);
@@ -1324,7 +1324,7 @@ public final class AbilityFactoryChangeZone {
}
if (params.containsKey("Attacking")) {
Singletons.getModel().getGameState().getCombat().addAttacker(c);
Singletons.getModel().getGame().getCombat().addAttacker(c);
}
// Auras without Candidates stay in their current location
if (c.isAura()) {
@@ -1334,17 +1334,17 @@ public final class AbilityFactoryChangeZone {
}
}
movedCard = Singletons.getModel().getGameAction().moveTo(c.getController().getZone(destination), c);
movedCard = Singletons.getModel().getGame().getAction().moveTo(c.getController().getZone(destination), c);
if (params.containsKey("Tapped")) {
movedCard.setTapped(true);
}
} else if (destination.equals(ZoneType.Exile)) {
movedCard = Singletons.getModel().getGameAction().exile(c);
movedCard = Singletons.getModel().getGame().getAction().exile(c);
if (params.containsKey("ExileFaceDown")) {
movedCard.setState(CardCharacteristicName.FaceDown);
}
} else {
movedCard = Singletons.getModel().getGameAction().moveTo(destination, c);
movedCard = Singletons.getModel().getGame().getAction().moveTo(destination, c);
}
if (remember != null) {
@@ -1556,7 +1556,7 @@ public final class AbilityFactoryChangeZone {
// in general this should only be used to protect from Imminent Harm
// (dying or losing control of)
if (origin.equals(ZoneType.Battlefield)) {
if (Singletons.getModel().getGameState().getStack().size() == 0) {
if (Singletons.getModel().getGame().getStack().size() == 0) {
return false;
}
@@ -1587,14 +1587,14 @@ public final class AbilityFactoryChangeZone {
// don't return something to your hand if your hand is full of good stuff
if (destination.equals(ZoneType.Hand) && origin.equals(ZoneType.Graveyard)) {
int handSize = ai.getCardsIn(ZoneType.Hand).size();
if (Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN1)) {
if (Singletons.getModel().getGame().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN1)) {
return false;
}
if (Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2)
if (Singletons.getModel().getGame().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2)
&& handSize > 1) {
return false;
}
if (Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(ai)
if (Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(ai)
&& handSize >= ai.getMaxHandSize()) {
return false;
}
@@ -1664,7 +1664,7 @@ public final class AbilityFactoryChangeZone {
tgt.resetTargets();
}
List<Card> list = Singletons.getModel().getGameState().getCardsIn(origin);
List<Card> list = Singletons.getModel().getGame().getCardsIn(origin);
list = CardLists.getValidCards(list, tgt.getValidTgts(), ai, source);
if (params.containsKey("AITgts")) {
list = CardLists.getValidCards(list, params.get("AITgts"), sa.getActivatingPlayer(), source);
@@ -1698,7 +1698,7 @@ public final class AbilityFactoryChangeZone {
// check stack for something on the stack that will kill
// anything i control
if (Singletons.getModel().getGameState().getStack().size() > 0) {
if (Singletons.getModel().getGame().getStack().size() > 0) {
final ArrayList<Object> objects = AbilityFactory.predictThreatenedObjects(ai, af);
final List<Card> threatenedTargets = new ArrayList<Card>();
@@ -1716,7 +1716,7 @@ public final class AbilityFactoryChangeZone {
}
}
// Save combatants
else if (Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
else if (Singletons.getModel().getGame().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
final List<Card> combatants = CardLists.filter(aiPermanents, CardPredicates.Presets.CREATURES);
CardLists.sortByEvaluateCreature(combatants);
@@ -1762,7 +1762,7 @@ public final class AbilityFactoryChangeZone {
if (origin.equals(ZoneType.Battlefield)
&& destination.equals(ZoneType.Exile)
&& (subAPI.equals("DelayedTrigger") || (subAPI.equals("ChangeZone") && subAffected.equals("Remembered")))
&& !(Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY) || sa
&& !(Singletons.getModel().getGame().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY) || sa
.isAbility())) {
return false;
}
@@ -1772,8 +1772,8 @@ public final class AbilityFactoryChangeZone {
// don't rush bouncing stuff when not going to attack
if (!sa.isTrigger() && sa.getPayCosts() != null
&& Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2)
&& Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(ai)
&& Singletons.getModel().getGame().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2)
&& Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(ai)
&& ai.getCreaturesInPlay().isEmpty()) {
return false;
}
@@ -1792,7 +1792,7 @@ public final class AbilityFactoryChangeZone {
}
// Only care about combatants during combat
if (Singletons.getModel().getGameState().getPhaseHandler().inCombat()) {
if (Singletons.getModel().getGame().getPhaseHandler().inCombat()) {
CardLists.getValidCards(list, "Card.attacking,Card.blocking", null, null);
}
@@ -1899,7 +1899,7 @@ public final class AbilityFactoryChangeZone {
final ZoneType destination = ZoneType.smartValueOf(params.get("Destination"));
final Target tgt = sa.getTarget();
List<Card> list = Singletons.getModel().getGameState().getCardsIn(origin);
List<Card> list = Singletons.getModel().getGame().getCardsIn(origin);
list = CardLists.getValidCards(list, tgt.getValidTgts(), ai, source);
// Narrow down the list:
@@ -2205,7 +2205,7 @@ public final class AbilityFactoryChangeZone {
continue;
}
final SpellAbilityStackInstance si = Singletons.getModel().getGameState().getStack().getInstanceFromSpellAbility(tgtSA);
final SpellAbilityStackInstance si = Singletons.getModel().getGame().getStack().getInstanceFromSpellAbility(tgtSA);
if (si == null) {
continue;
}
@@ -2234,7 +2234,7 @@ public final class AbilityFactoryChangeZone {
&& !GameActionUtil.showYesNoDialog(hostCard, sb.toString())) {
continue;
}
final PlayerZone originZone = Singletons.getModel().getGameState().getZoneOf(tgtC);
final Zone originZone = Singletons.getModel().getGame().getZoneOf(tgtC);
// if Target isn't in the expected Zone, continue
@@ -2249,7 +2249,7 @@ public final class AbilityFactoryChangeZone {
final int libraryPosition = params.containsKey("LibraryPosition") ? Integer.parseInt(params
.get("LibraryPosition")) : 0;
movedCard = Singletons.getModel().getGameAction().moveToLibrary(tgtC, libraryPosition);
movedCard = Singletons.getModel().getGame().getAction().moveToLibrary(tgtC, libraryPosition);
// for things like Gaea's Blessing
if (params.containsKey("Shuffle")) {
@@ -2290,25 +2290,25 @@ public final class AbilityFactoryChangeZone {
}
}
movedCard = Singletons.getModel().getGameAction()
movedCard = Singletons.getModel().getGame().getAction()
.moveTo(tgtC.getController().getZone(destination), tgtC);
if (params.containsKey("Ninjutsu") || params.containsKey("Attacking")) {
Singletons.getModel().getGameState().getCombat().addAttacker(tgtC);
Singletons.getModel().getGameState().getCombat().addUnblockedAttacker(tgtC);
Singletons.getModel().getGame().getCombat().addAttacker(tgtC);
Singletons.getModel().getGame().getCombat().addUnblockedAttacker(tgtC);
}
if (params.containsKey("Tapped") || params.containsKey("Ninjutsu")) {
tgtC.setTapped(true);
}
} else {
movedCard = Singletons.getModel().getGameAction().moveTo(destination, tgtC);
movedCard = Singletons.getModel().getGame().getAction().moveTo(destination, tgtC);
// If a card is Exiled from the stack, remove its spells from the stack
if (params.containsKey("Fizzle")) {
ArrayList<SpellAbility> spells = tgtC.getSpellAbilities();
for (SpellAbility spell : spells) {
if (tgtC.isInZone(ZoneType.Exile)) {
final SpellAbilityStackInstance si = Singletons.getModel().getGameState().getStack().getInstanceFromSpellAbility(spell);
Singletons.getModel().getGameState().getStack().remove(si);
final SpellAbilityStackInstance si = Singletons.getModel().getGame().getStack().getInstanceFromSpellAbility(spell);
Singletons.getModel().getGame().getStack().remove(si);
}
}
}
@@ -2347,7 +2347,7 @@ public final class AbilityFactoryChangeZone {
final ArrayList<Card> list = AbilityFactory.getDefinedCards(sa.getSourceCard(), defined, sa);
for (final Card c : list) {
final Card actualCard = Singletons.getModel().getGameState().getCardState(c);
final Card actualCard = Singletons.getModel().getGame().getCardState(c);
ret.add(actualCard);
}
return ret;
@@ -2367,7 +2367,7 @@ public final class AbilityFactoryChangeZone {
* object.
*/
private static void removeFromStack(final SpellAbility tgtSA, final SpellAbility srcSA, final SpellAbilityStackInstance si) {
Singletons.getModel().getGameState().getStack().remove(si);
Singletons.getModel().getGame().getStack().remove(si);
final AbilityFactory af = srcSA.getAbilityFactory();
final HashMap<String, String> params = af.getMapParams();
@@ -2376,19 +2376,19 @@ public final class AbilityFactoryChangeZone {
if (tgtSA.isAbility()) {
// Shouldn't be able to target Abilities but leaving this in for now
} else if (tgtSA.isFlashBackAbility()) {
Singletons.getModel().getGameAction().exile(tgtSA.getSourceCard());
Singletons.getModel().getGame().getAction().exile(tgtSA.getSourceCard());
} else if (params.get("Destination").equals("Graveyard")) {
Singletons.getModel().getGameAction().moveToGraveyard(tgtSA.getSourceCard());
Singletons.getModel().getGame().getAction().moveToGraveyard(tgtSA.getSourceCard());
} else if (params.get("Destination").equals("Exile")) {
Singletons.getModel().getGameAction().exile(tgtSA.getSourceCard());
Singletons.getModel().getGame().getAction().exile(tgtSA.getSourceCard());
} else if (params.get("Destination").equals("TopOfLibrary")) {
Singletons.getModel().getGameAction().moveToLibrary(tgtSA.getSourceCard());
Singletons.getModel().getGame().getAction().moveToLibrary(tgtSA.getSourceCard());
} else if (params.get("Destination").equals("Hand")) {
Singletons.getModel().getGameAction().moveToHand(tgtSA.getSourceCard());
Singletons.getModel().getGame().getAction().moveToHand(tgtSA.getSourceCard());
} else if (params.get("Destination").equals("BottomOfLibrary")) {
Singletons.getModel().getGameAction().moveToBottomOfLibrary(tgtSA.getSourceCard());
Singletons.getModel().getGame().getAction().moveToBottomOfLibrary(tgtSA.getSourceCard());
} else if (params.get("Destination").equals("ShuffleIntoLibrary")) {
Singletons.getModel().getGameAction().moveToBottomOfLibrary(tgtSA.getSourceCard());
Singletons.getModel().getGame().getAction().moveToBottomOfLibrary(tgtSA.getSourceCard());
tgtSA.getSourceCard().getController().shuffle();
} else {
throw new IllegalArgumentException("AbilityFactory_ChangeZone: Invalid Destination argument for card "
@@ -2647,7 +2647,7 @@ public final class AbilityFactoryChangeZone {
}
// Don't cast during main1?
if (Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.MAIN1, ai)) {
if (Singletons.getModel().getGame().getPhaseHandler().is(PhaseType.MAIN1, ai)) {
return false;
}
} else if (origin.equals(ZoneType.Graveyard)) {
@@ -2925,7 +2925,7 @@ public final class AbilityFactoryChangeZone {
}
if ((tgtPlayers == null) || tgtPlayers.isEmpty()) {
cards = Singletons.getModel().getGameState().getCardsIn(origin);
cards = Singletons.getModel().getGame().getCardsIn(origin);
} else {
cards = tgtPlayers.get(0).getCardsIn(origin);
}
@@ -2958,9 +2958,9 @@ public final class AbilityFactoryChangeZone {
if (params.containsKey("GainControl")) {
c.addController(sa.getSourceCard());
Singletons.getModel().getGameAction().moveToPlay(c, sa.getActivatingPlayer());
Singletons.getModel().getGame().getAction().moveToPlay(c, sa.getActivatingPlayer());
} else {
final Card movedCard = Singletons.getModel().getGameAction().moveTo(destination, c, libraryPos);
final Card movedCard = Singletons.getModel().getGame().getAction().moveTo(destination, c, libraryPos);
if (params.containsKey("ExileFaceDown")) {
movedCard.setState(CardCharacteristicName.FaceDown);
}
@@ -2970,14 +2970,14 @@ public final class AbilityFactoryChangeZone {
}
if (remember != null) {
Singletons.getModel().getGameState().getCardState(sa.getSourceCard()).addRemembered(c);
Singletons.getModel().getGame().getCardState(sa.getSourceCard()).addRemembered(c);
}
}
// if Shuffle parameter exists, and any amount of cards were owned by
// that player, then shuffle that library
if (params.containsKey("Shuffle")) {
for( Player p : Singletons.getModel().getGameState().getPlayers()) {
for( Player p : Singletons.getModel().getGame().getPlayers()) {
if (Iterables.any(cards, CardPredicates.isOwner(p))) {
p.shuffle();
}

View File

@@ -380,7 +380,7 @@ public final class AbilityFactoryChoose {
if (params.containsKey("AILogic")) {
final String logic = params.get("AILogic");
if (logic.equals("MostProminentOnBattlefield")) {
chosen = CardFactoryUtil.getMostProminentCreatureType(Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield));
chosen = CardFactoryUtil.getMostProminentCreatureType(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield));
}
if (logic.equals("MostProminentComputerControls")) {
chosen = CardFactoryUtil.getMostProminentCreatureType(ai.getCardsIn(ZoneType.Battlefield));
@@ -388,11 +388,11 @@ public final class AbilityFactoryChoose {
if (logic.equals("MostProminentHumanControls")) {
chosen = CardFactoryUtil.getMostProminentCreatureType(opp.getCardsIn(ZoneType.Battlefield));
if (!CardUtil.isACreatureType(chosen) || invalidTypes.contains(chosen)) {
chosen = CardFactoryUtil.getMostProminentCreatureType(CardLists.filterControlledBy(Singletons.getModel().getGameState().getCardsInGame(), opp));
chosen = CardFactoryUtil.getMostProminentCreatureType(CardLists.filterControlledBy(Singletons.getModel().getGame().getCardsInGame(), opp));
}
}
if (logic.equals("MostProminentInComputerDeck")) {
chosen = CardFactoryUtil.getMostProminentCreatureType(CardLists.filterControlledBy(Singletons.getModel().getGameState().getCardsInGame(), ai));
chosen = CardFactoryUtil.getMostProminentCreatureType(CardLists.filterControlledBy(Singletons.getModel().getGame().getCardsInGame(), ai));
}
if (logic.equals("MostProminentInComputerGraveyard")) {
chosen = CardFactoryUtil.getMostProminentCreatureType(ai.getCardsIn(ZoneType.Graveyard));
@@ -727,21 +727,21 @@ public final class AbilityFactoryChoose {
if (params.containsKey("AILogic")) {
final String logic = params.get("AILogic");
if (logic.equals("MostProminentInHumanDeck")) {
chosen.add(CardFactoryUtil.getMostProminentColor(CardLists.filterControlledBy(Singletons.getModel().getGameState().getCardsInGame(), opp)));
chosen.add(CardFactoryUtil.getMostProminentColor(CardLists.filterControlledBy(Singletons.getModel().getGame().getCardsInGame(), opp)));
} else if (logic.equals("MostProminentInComputerDeck")) {
chosen.add(CardFactoryUtil.getMostProminentColor(CardLists.filterControlledBy(Singletons.getModel().getGameState().getCardsInGame(), ai)));
chosen.add(CardFactoryUtil.getMostProminentColor(CardLists.filterControlledBy(Singletons.getModel().getGame().getCardsInGame(), ai)));
} else if (logic.equals("MostProminentDualInComputerDeck")) {
List<String> prominence = CardFactoryUtil.getColorByProminence(CardLists.filterControlledBy(Singletons.getModel().getGameState().getCardsInGame(), ai));
List<String> prominence = CardFactoryUtil.getColorByProminence(CardLists.filterControlledBy(Singletons.getModel().getGame().getCardsInGame(), ai));
chosen.add(prominence.get(0));
chosen.add(prominence.get(1));
}
else if (logic.equals("MostProminentInGame")) {
chosen.add(CardFactoryUtil.getMostProminentColor(Singletons.getModel().getGameState().getCardsInGame()));
chosen.add(CardFactoryUtil.getMostProminentColor(Singletons.getModel().getGame().getCardsInGame()));
}
else if (logic.equals("MostProminentHumanCreatures")) {
List<Card> list = opp.getCreaturesInPlay();
if (list.isEmpty()) {
list = CardLists.filter(CardLists.filterControlledBy(Singletons.getModel().getGameState().getCardsInGame(), opp), CardPredicates.Presets.CREATURES);
list = CardLists.filter(CardLists.filterControlledBy(Singletons.getModel().getGame().getCardsInGame(), opp), CardPredicates.Presets.CREATURES);
}
chosen.add(CardFactoryUtil.getMostProminentColor(list));
}
@@ -749,11 +749,11 @@ public final class AbilityFactoryChoose {
chosen.add(CardFactoryUtil.getMostProminentColor(ai.getCardsIn(ZoneType.Battlefield)));
}
else if (logic.equals("MostProminentPermanent")) {
final List<Card> list = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
final List<Card> list = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
chosen.add(CardFactoryUtil.getMostProminentColor(list));
}
else if (logic.equals("MostProminentAttackers")) {
chosen.add(CardFactoryUtil.getMostProminentColor(Singletons.getModel().getGameState().getCombat()
chosen.add(CardFactoryUtil.getMostProminentColor(Singletons.getModel().getGame().getCombat()
.getAttackerList()));
}
}
@@ -1303,7 +1303,7 @@ public final class AbilityFactoryChoose {
}
final ArrayList<Player> choices = params.containsKey("Choices") ? AbilityFactory.getDefinedPlayers(
sa.getSourceCard(), params.get("Choices"), sa) : new ArrayList<Player>(Singletons.getModel().getGameState().getPlayers());
sa.getSourceCard(), params.get("Choices"), sa) : new ArrayList<Player>(Singletons.getModel().getGame().getPlayers());
final String choiceDesc = params.containsKey("ChoiceTitle") ? params.get("ChoiceTitle") : "Choose a player";
@@ -1643,7 +1643,7 @@ public final class AbilityFactoryChoose {
chosen = CardFactoryUtil.getMostProminentCardName(p.getOpponent().getCardsIn(ZoneType.Library));
}
} else {
List<Card> list = CardLists.filterControlledBy(Singletons.getModel().getGameState().getCardsInGame(), p.getOpponent());
List<Card> list = CardLists.filterControlledBy(Singletons.getModel().getGame().getCardsInGame(), p.getOpponent());
list = CardLists.filter(list, Predicates.not(Presets.LANDS));
if (!list.isEmpty()) {
chosen = list.get(0).getName();
@@ -1869,7 +1869,7 @@ public final class AbilityFactoryChoose {
if (params.containsKey("ChoiceZone")) {
choiceZone = ZoneType.smartValueOf(params.get("ChoiceZone"));
}
List<Card> choices = Singletons.getModel().getGameState().getCardsIn(choiceZone);
List<Card> choices = Singletons.getModel().getGame().getCardsIn(choiceZone);
if (params.containsKey("Choices")) {
choices = CardLists.getValidCards(choices, params.get("Choices"), host.getController(), host);
}
@@ -1938,7 +1938,7 @@ public final class AbilityFactoryChoose {
if (params.containsKey("ChoiceZone")) {
choiceZone = ZoneType.smartValueOf(params.get("ChoiceZone"));
}
List<Card> choices = Singletons.getModel().getGameState().getCardsIn(choiceZone);
List<Card> choices = Singletons.getModel().getGame().getCardsIn(choiceZone);
if (params.containsKey("Choices")) {
choices = CardLists.getValidCards(choices, params.get("Choices"), host.getController(), host);
}
@@ -1951,7 +1951,7 @@ public final class AbilityFactoryChoose {
? CardFactoryUtil.xCount(host, host.getSVar(params.get("Amount"))) : Integer.parseInt(numericAmount);
if (params.containsKey("SunderingTitan")) {
final List<Card> land = Singletons.getModel().getGameState().getLandsInPlay();
final List<Card> land = Singletons.getModel().getGame().getLandsInPlay();
final ArrayList<String> basic = CardUtil.getBasicTypes();
for (final String type : basic) {

View File

@@ -252,7 +252,7 @@ public final class AbilityFactoryClash {
runParams.put("Won", "False");
}
Singletons.getModel().getGameState().getTriggerHandler().runTrigger(TriggerType.Clashed, runParams);
Singletons.getModel().getGame().getTriggerHandler().runTrigger(TriggerType.Clashed, runParams);
}
// *************************************************************************

View File

@@ -105,7 +105,7 @@ public final class AbilityFactoryCleanup {
if (params.containsKey("ClearRemembered")) {
source.clearRemembered();
Singletons.getModel().getGameState().getCardState(source).clearRemembered();
Singletons.getModel().getGame().getCardState(source).clearRemembered();
}
if (params.containsKey("ClearImprinted")) {
source.clearImprinted();
@@ -117,7 +117,7 @@ public final class AbilityFactoryCleanup {
source.setSVar("ChosenY", "");
}
if (params.containsKey("ClearTriggered")) {
Singletons.getModel().getGameState().getTriggerHandler().clearDelayedTrigger(source);
Singletons.getModel().getGame().getTriggerHandler().clearDelayedTrigger(source);
}
}

View File

@@ -269,7 +269,7 @@ public final class AbilityFactoryClone {
// TODO - add some kind of check for during human turn to answer
// "Can I use this to block something?"
PhaseHandler phase = Singletons.getModel().getGameState().getPhaseHandler();
PhaseHandler phase = Singletons.getModel().getGame().getPhaseHandler();
// don't use instant speed clone abilities outside computers
// Combat_Begin step
if (!phase.is(PhaseType.COMBAT_BEGIN)
@@ -280,7 +280,7 @@ public final class AbilityFactoryClone {
// don't use instant speed clone abilities outside humans
// Combat_Declare_Attackers_InstantAbility step
if ( (!phase.is(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY) || Singletons.getModel().getGameState().getCombat().getAttackers().isEmpty())
if ( (!phase.is(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY) || Singletons.getModel().getGame().getCombat().getAttackers().isEmpty())
&& !phase.isPlayerTurn(ai)) {
return false;
}

View File

@@ -240,20 +240,20 @@ public final class AbilityFactoryCombat {
*/
public static boolean fogCanPlayAI(final Player ai, final AbilityFactory af, final SpellAbility sa) {
// AI should only activate this during Human's Declare Blockers phase
if (Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(sa.getActivatingPlayer())) {
if (Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(sa.getActivatingPlayer())) {
return false;
}
if (!Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
if (!Singletons.getModel().getGame().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
return false;
}
// Only cast when Stack is empty, so Human uses spells/abilities first
if (Singletons.getModel().getGameState().getStack().size() != 0) {
if (Singletons.getModel().getGame().getStack().size() != 0) {
return false;
}
// Don't cast it, if the effect is already in place
if (Singletons.getModel().getGameState().getPhaseHandler().isPreventCombatDamageThisTurn()) {
if (Singletons.getModel().getGame().getPhaseHandler().isPreventCombatDamageThisTurn()) {
return false;
}
@@ -265,7 +265,7 @@ public final class AbilityFactoryCombat {
}
// Cast it if life is in danger
return CombatUtil.lifeInDanger(ai, Singletons.getModel().getGameState().getCombat());
return CombatUtil.lifeInDanger(ai, Singletons.getModel().getGame().getCombat());
}
/**
@@ -282,10 +282,10 @@ public final class AbilityFactoryCombat {
public static boolean fogPlayDrawbackAI(final AbilityFactory af, final SpellAbility sa) {
// AI should only activate this during Human's turn
boolean chance;
if (Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(sa.getActivatingPlayer().getOpponent())) {
chance = Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_FIRST_STRIKE_DAMAGE);
if (Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(sa.getActivatingPlayer().getOpponent())) {
chance = Singletons.getModel().getGame().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_FIRST_STRIKE_DAMAGE);
} else {
chance = Singletons.getModel().getGameState().getPhaseHandler().getPhase().isAfter(PhaseType.COMBAT_DAMAGE);
chance = Singletons.getModel().getGame().getPhaseHandler().getPhase().isAfter(PhaseType.COMBAT_DAMAGE);
}
final AbilitySub subAb = sa.getSubAbility();
@@ -316,10 +316,10 @@ public final class AbilityFactoryCombat {
}
boolean chance;
if (Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(sa.getActivatingPlayer().getOpponent())) {
chance = Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_FIRST_STRIKE_DAMAGE);
if (Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(sa.getActivatingPlayer().getOpponent())) {
chance = Singletons.getModel().getGame().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_FIRST_STRIKE_DAMAGE);
} else {
chance = Singletons.getModel().getGameState().getPhaseHandler().getPhase().isAfter(PhaseType.COMBAT_DAMAGE);
chance = Singletons.getModel().getGame().getPhaseHandler().getPhase().isAfter(PhaseType.COMBAT_DAMAGE);
}
// check SubAbilities DoTrigger?
@@ -344,7 +344,7 @@ public final class AbilityFactoryCombat {
public static void fogResolve(final AbilityFactory af, final SpellAbility sa) {
// Expand Fog keyword here depending on what we need out of it.
Singletons.getModel().getGameState().getPhaseHandler().setPreventCombatDamageThisTurn(true);
Singletons.getModel().getGame().getPhaseHandler().setPreventCombatDamageThisTurn(true);
}
// **************************************************************
@@ -819,7 +819,7 @@ public final class AbilityFactoryCombat {
for (final Card c : tgtCards) {
if ((tgt == null) || c.canBeTargetedBy(sa)) {
Singletons.getModel().getGameState().getCombat().removeFromCombat(c);
Singletons.getModel().getGame().getCombat().removeFromCombat(c);
}
}
@@ -1042,7 +1042,7 @@ public final class AbilityFactoryCombat {
}
// only use on creatures that can attack
if (!Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2)) {
if (!Singletons.getModel().getGame().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2)) {
return false;
}

View File

@@ -260,7 +260,7 @@ public final class AbilityFactoryCopy {
// TODO - I'm sure someone can do this AI better
final HashMap<String, String> params = af.getMapParams();
if (params.containsKey("AtEOT") && !Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.MAIN1)) {
if (params.containsKey("AtEOT") && !Singletons.getModel().getGame().getPhaseHandler().is(PhaseType.MAIN1)) {
return false;
} else {
double chance = .4; // 40 percent chance with instant speed stuff
@@ -305,7 +305,7 @@ public final class AbilityFactoryCopy {
final Target abTgt = sa.getTarget();
if (abTgt != null) {
List<Card> list = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
List<Card> list = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
list = CardLists.getValidCards(list, abTgt.getValidTgts(), source.getController(), source);
list = CardLists.getTargetableCards(list, sa);
abTgt.resetTargets();
@@ -462,7 +462,7 @@ public final class AbilityFactoryCopy {
if (c.isFaceDown()) {
c.setState(CardCharacteristicName.FaceDown);
}
copy = Singletons.getModel().getGameAction().moveToPlay(copy);
copy = Singletons.getModel().getGame().getAction().moveToPlay(copy);
copy.setCloneOrigin(hostCard);
sa.getSourceCard().addClone(copy);
@@ -489,9 +489,9 @@ public final class AbilityFactoryCopy {
if (params.get("AtEOT").equals("Sacrifice")) {
// maybe do a setSacrificeAtEOT, but
// probably not.
Singletons.getModel().getGameAction().sacrifice(target[index], sa);
Singletons.getModel().getGame().getAction().sacrifice(target[index], sa);
} else if (params.get("AtEOT").equals("Exile")) {
Singletons.getModel().getGameAction().exile(target[index]);
Singletons.getModel().getGame().getAction().exile(target[index]);
}
}
@@ -504,11 +504,11 @@ public final class AbilityFactoryCopy {
@Override
public void execute() {
sac.setStackDescription(params.get("AtEOT") + " " + target[index] + ".");
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(sac);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(sac);
}
}; // Command
if (params.containsKey("AtEOT")) {
Singletons.getModel().getGameState().getEndOfTurn().addAt(atEOT);
Singletons.getModel().getGame().getEndOfTurn().addAt(atEOT);
}
// end copied Kiki code

View File

@@ -248,7 +248,7 @@ public class AbilityFactoryCounterMagic {
boolean toReturn = true;
final Cost abCost = af.getAbCost();
final Card source = sa.getSourceCard();
if (Singletons.getModel().getGameState().getStack().size() < 1) {
if (Singletons.getModel().getGame().getStack().size() < 1) {
return false;
}
@@ -265,7 +265,7 @@ public class AbilityFactoryCounterMagic {
final Target tgt = sa.getTarget();
if (tgt != null) {
final SpellAbility topSA = Singletons.getModel().getGameState().getStack().peekAbility();
final SpellAbility topSA = Singletons.getModel().getGame().getStack().peekAbility();
if (!CardFactoryUtil.isCounterableBy(topSA.getSourceCard(), sa) || topSA.getActivatingPlayer().isComputer()) {
return false;
}
@@ -343,13 +343,13 @@ public class AbilityFactoryCounterMagic {
*/
private boolean counterDoTriggerAI(final Player ai, final AbilityFactory af, final SpellAbility sa, final boolean mandatory) {
boolean toReturn = true;
if (Singletons.getModel().getGameState().getStack().size() < 1) {
if (Singletons.getModel().getGame().getStack().size() < 1) {
return false;
}
final Target tgt = sa.getTarget();
if (tgt != null) {
final SpellAbility topSA = Singletons.getModel().getGameState().getStack().peekAbility();
final SpellAbility topSA = Singletons.getModel().getGame().getStack().peekAbility();
if (!CardFactoryUtil.isCounterableBy(topSA.getSourceCard(), sa) || topSA.getActivatingPlayer().isComputer()) {
return false;
}
@@ -426,8 +426,8 @@ public class AbilityFactoryCounterMagic {
final Target tgt = sa.getTarget();
if (params.containsKey("AllType")) {
sas = new ArrayList<SpellAbility>();
for (int i=0; i < Singletons.getModel().getGameState().getStack().size(); i++) {
SpellAbility spell = Singletons.getModel().getGameState().getStack().peekAbility(i);
for (int i=0; i < Singletons.getModel().getGame().getStack().size(); i++) {
SpellAbility spell = Singletons.getModel().getGame().getStack().peekAbility(i);
if (params.get("AllType").equals("Spell") && !spell.isSpell()) {
continue;
}
@@ -457,7 +457,7 @@ public class AbilityFactoryCounterMagic {
continue;
}
final SpellAbilityStackInstance si = Singletons.getModel().getGameState().getStack().getInstanceFromSpellAbility(tgtSA);
final SpellAbilityStackInstance si = Singletons.getModel().getGame().getStack().getInstanceFromSpellAbility(tgtSA);
if (si == null) {
continue;
}
@@ -466,7 +466,7 @@ public class AbilityFactoryCounterMagic {
// Destroy Permanent may be able to be turned into a SubAbility
if (tgtSA.isAbility() && this.params.containsKey("DestroyPermanent")) {
Singletons.getModel().getGameAction().destroy(tgtSACard);
Singletons.getModel().getGame().getAction().destroy(tgtSACard);
}
if (this.params.containsKey("RememberTargets")) {
@@ -503,8 +503,8 @@ public class AbilityFactoryCounterMagic {
final Target tgt = sa.getTarget();
if (params.containsKey("AllType")) {
sas = new ArrayList<SpellAbility>();
for (int i=0; i < Singletons.getModel().getGameState().getStack().size(); i++) {
SpellAbility spell = Singletons.getModel().getGameState().getStack().peekAbility(i);
for (int i=0; i < Singletons.getModel().getGame().getStack().size(); i++) {
SpellAbility spell = Singletons.getModel().getGame().getStack().peekAbility(i);
if (params.get("AllType").equals("Spell") && !spell.isSpell()) {
continue;
}
@@ -561,35 +561,35 @@ public class AbilityFactoryCounterMagic {
* object.
*/
private void removeFromStack(final SpellAbility tgtSA, final SpellAbility srcSA, final SpellAbilityStackInstance si) {
Singletons.getModel().getGameState().getStack().remove(si);
Singletons.getModel().getGame().getStack().remove(si);
if (tgtSA.isAbility()) {
// For Ability-targeted counterspells - do not move it anywhere,
// even if Destination$ is specified.
} else if (tgtSA.isFlashBackAbility()) {
Singletons.getModel().getGameAction().exile(tgtSA.getSourceCard());
Singletons.getModel().getGame().getAction().exile(tgtSA.getSourceCard());
} else if (this.destination.equals("Graveyard")) {
Singletons.getModel().getGameAction().moveToGraveyard(tgtSA.getSourceCard());
Singletons.getModel().getGame().getAction().moveToGraveyard(tgtSA.getSourceCard());
} else if (this.destination.equals("Exile")) {
Singletons.getModel().getGameAction().exile(tgtSA.getSourceCard());
Singletons.getModel().getGame().getAction().exile(tgtSA.getSourceCard());
} else if (this.destination.equals("TopOfLibrary")) {
Singletons.getModel().getGameAction().moveToLibrary(tgtSA.getSourceCard());
Singletons.getModel().getGame().getAction().moveToLibrary(tgtSA.getSourceCard());
} else if (this.destination.equals("Hand")) {
Singletons.getModel().getGameAction().moveToHand(tgtSA.getSourceCard());
Singletons.getModel().getGame().getAction().moveToHand(tgtSA.getSourceCard());
} else if (this.destination.equals("Battlefield")) {
if (tgtSA instanceof SpellPermanent) {
Card c = tgtSA.getSourceCard();
System.out.println(c + " is SpellPermanent");
c.addController(srcSA.getActivatingPlayer());
Singletons.getModel().getGameAction().moveToPlay(c, srcSA.getActivatingPlayer());
Singletons.getModel().getGame().getAction().moveToPlay(c, srcSA.getActivatingPlayer());
} else {
Card c = Singletons.getModel().getGameAction().moveToPlay(tgtSA.getSourceCard(), srcSA.getActivatingPlayer());
Card c = Singletons.getModel().getGame().getAction().moveToPlay(tgtSA.getSourceCard(), srcSA.getActivatingPlayer());
c.addController(srcSA.getActivatingPlayer());
}
} else if (this.destination.equals("BottomOfLibrary")) {
Singletons.getModel().getGameAction().moveToBottomOfLibrary(tgtSA.getSourceCard());
Singletons.getModel().getGame().getAction().moveToBottomOfLibrary(tgtSA.getSourceCard());
} else if (this.destination.equals("ShuffleIntoLibrary")) {
Singletons.getModel().getGameAction().moveToBottomOfLibrary(tgtSA.getSourceCard());
Singletons.getModel().getGame().getAction().moveToBottomOfLibrary(tgtSA.getSourceCard());
tgtSA.getSourceCard().getController().shuffle();
} else {
throw new IllegalArgumentException("AbilityFactory_CounterMagic: Invalid Destination argument for card "

View File

@@ -47,6 +47,7 @@ import forge.game.player.ComputerUtil;
import forge.game.player.Player;
import forge.game.player.PlayerType;
import forge.game.zone.PlayerZone;
import forge.game.zone.Zone;
import forge.game.zone.ZoneType;
import forge.gui.GuiChoose;
import forge.gui.match.CMatchUI;
@@ -423,7 +424,7 @@ public class AbilityFactoryCounters {
}
// Don't use non P1P1/M1M1 counters before main 2 if possible
if (Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2)
if (Singletons.getModel().getGame().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2)
&& !params.containsKey("ActivationPhases")
&& !(type.equals("P1P1") || type.equals("M1M1"))) {
return false;
@@ -754,7 +755,7 @@ public class AbilityFactoryCounters {
if (max != -1) {
counterAmount = max - tgtCard.getCounters(Counters.valueOf(type));
}
final PlayerZone zone = Singletons.getModel().getGameState().getZoneOf(tgtCard);
final Zone zone = Singletons.getModel().getGame().getZoneOf(tgtCard);
if (zone == null) {
// Do nothing, token disappeared
} else if (zone.is(ZoneType.Battlefield)) {
@@ -1037,7 +1038,7 @@ public class AbilityFactoryCounters {
return false;
}
if (Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2)
if (Singletons.getModel().getGame().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2)
&& !params.containsKey("ActivationPhases")
&& !type.equals("M1M1")) {
return false;
@@ -1175,7 +1176,7 @@ public class AbilityFactoryCounters {
}
for (final Card tgtCard : tgtCards) {
if ((tgt == null) || tgtCard.canBeTargetedBy(sa)) {
final PlayerZone zone = Singletons.getModel().getGameState().getZoneOf(tgtCard);
final Zone zone = Singletons.getModel().getGame().getZoneOf(tgtCard);
if (params.get("CounterNum").equals("All")) {
counterAmount = tgtCard.getCounters(Counters.valueOf(type));
}
@@ -1524,7 +1525,7 @@ public class AbilityFactoryCounters {
}
private static void proliferateResolveHuman(final AbilityFactory af, final SpellAbility sa) {
final List<Card> unchosen = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
final List<Card> unchosen = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
Singletons.getModel().getMatch().getInput().setInput(new Input() {
private static final long serialVersionUID = -1779224307654698954L;
@@ -1540,7 +1541,7 @@ public class AbilityFactoryCounters {
// counters being put on. They used
// to wait for another priority passing after proliferate
// finished.
Singletons.getModel().getGameState().getStack().chooseOrderOfSimultaneousStackEntryAll();
Singletons.getModel().getGame().getStack().chooseOrderOfSimultaneousStackEntryAll();
this.stop();
}
@@ -1563,7 +1564,7 @@ public class AbilityFactoryCounters {
}
}
List<Player> players = Singletons.getModel().getGameState().getPlayers();
List<Player> players = Singletons.getModel().getGame().getPlayers();
@Override
public void selectPlayer(final Player player) {
@@ -1597,7 +1598,7 @@ public class AbilityFactoryCounters {
}
};
List<Card> cardsToProliferate = CardLists.filter(Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield), predProliferate);
List<Card> cardsToProliferate = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), predProliferate);
List<Player> playersToPoison = new ArrayList<Player>();
for( Player e : enemies ) {
if ( e.getPoisonCounters() > 0 )
@@ -1924,7 +1925,7 @@ public class AbilityFactoryCounters {
}
//Check for cards that could profit from the ability
PhaseHandler phase = Singletons.getModel().getGameState().getPhaseHandler();
PhaseHandler phase = Singletons.getModel().getGame().getPhaseHandler();
if (type.equals("P1P1") && sa.isAbility() && source.isCreature()
&& sa.getPayCosts() != null && sa.getPayCosts().getTap()
&& sa instanceof AbilitySub
@@ -1988,7 +1989,7 @@ public class AbilityFactoryCounters {
final String valid = params.get("ValidCards");
final ZoneType zone = params.containsKey("ValidZone") ? ZoneType.smartValueOf(params.get("ValidZone")) : ZoneType.Battlefield;
List<Card> cards = Singletons.getModel().getGameState().getCardsIn(zone);
List<Card> cards = Singletons.getModel().getGame().getCardsIn(zone);
cards = CardLists.getValidCards(cards, valid, sa.getSourceCard().getController(), sa.getSourceCard());
final Target tgt = sa.getTarget();
@@ -1998,7 +1999,7 @@ public class AbilityFactoryCounters {
}
for (final Card tgtCard : cards) {
if (Singletons.getModel().getGameState().getZoneOf(tgtCard).is(ZoneType.Battlefield)) {
if (Singletons.getModel().getGame().getZoneOf(tgtCard).is(ZoneType.Battlefield)) {
tgtCard.addCounter(Counters.valueOf(type), counterAmount);
} else {
// adding counters to something like re-suspend cards
@@ -2243,7 +2244,7 @@ public class AbilityFactoryCounters {
final String valid = params.get("ValidCards");
final ZoneType zone = params.containsKey("ValidZone") ? ZoneType.smartValueOf(params.get("ValidZone")) : ZoneType.Battlefield;
List<Card> cards = Singletons.getModel().getGameState().getCardsIn(zone);
List<Card> cards = Singletons.getModel().getGame().getCardsIn(zone);
cards = CardLists.getValidCards(cards, valid, sa.getSourceCard().getController(), sa.getSourceCard());
final Target tgt = sa.getTarget();

View File

@@ -407,7 +407,7 @@ public class AbilityFactoryDealDamage {
if (source.getName().equals("Stuffy Doll")) {
// Now stuffy sits around for blocking
// TODO(sol): this should also happen if Stuffy is going to die
return Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.END_OF_TURN, ai.getOpponent());
return Singletons.getModel().getGame().getPhaseHandler().is(PhaseType.END_OF_TURN, ai.getOpponent());
}
if (this.abilityFactory.isAbility()) {
@@ -488,8 +488,8 @@ public class AbilityFactoryDealDamage {
if (this.abilityFactory.isSpell()) {
// If this is a spell, cast it instead of discarding
if ((Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.END_OF_TURN) || Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.MAIN2))
&& Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(comp) && (hand.size() > comp.getMaxHandSize())) {
if ((Singletons.getModel().getGame().getPhaseHandler().is(PhaseType.END_OF_TURN) || Singletons.getModel().getGame().getPhaseHandler().is(PhaseType.MAIN2))
&& Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(comp) && (hand.size() > comp.getMaxHandSize())) {
return true;
}
}
@@ -522,7 +522,7 @@ public class AbilityFactoryDealDamage {
final Player pl, final boolean mandatory) {
// wait until stack is empty (prevents duplicate kills)
if (!saMe.isTrigger() && !Singletons.getModel().getGameState().getStack().isEmpty()) {
if (!saMe.isTrigger() && !Singletons.getModel().getGame().getStack().isEmpty()) {
return null;
}
final Target tgt = saMe.getTarget();
@@ -616,7 +616,7 @@ public class AbilityFactoryDealDamage {
private boolean damageChoosingTargets(final Player ai, final SpellAbility saMe, final Target tgt, final int dmg,
final boolean isTrigger, final boolean mandatory) {
final boolean noPrevention = this.abilityFactory.getMapParams().containsKey("NoPrevention");
final PhaseHandler phase = Singletons.getModel().getGameState().getPhaseHandler();
final PhaseHandler phase = Singletons.getModel().getGame().getPhaseHandler();
// target loop
tgt.resetTargets();
@@ -1206,7 +1206,7 @@ public class AbilityFactoryDealDamage {
}
// wait until stack is empty (prevents duplicate kills)
if (!Singletons.getModel().getGameState().getStack().isEmpty()) {
if (!Singletons.getModel().getGame().getStack().isEmpty()) {
return false;
}
@@ -1382,7 +1382,7 @@ public class AbilityFactoryDealDamage {
}
if (params.containsKey("ValidCards")) {
list = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
list = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
}
if (targetPlayer != null) {
@@ -1646,7 +1646,7 @@ public class AbilityFactoryDealDamage {
final HashMap<String, String> params = af.getMapParams();
final Card card = sa.getSourceCard();
List<Card> sources = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
List<Card> sources = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
if (params.containsKey("ValidCards")) {
sources = CardLists.getValidCards(sources, params.get("ValidCards"), card.getController(), card);
}

View File

@@ -317,12 +317,12 @@ public final class AbilityFactoryDebuff {
final HashMap<String, String> params = af.getMapParams();
final SpellAbilityRestriction restrict = sa.getRestrictions();
final PhaseHandler ph = Singletons.getModel().getGameState().getPhaseHandler();
final PhaseHandler ph = Singletons.getModel().getGame().getPhaseHandler();
// Phase Restrictions
if (ph.getPhase().isBefore(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY)
|| ph.getPhase().isAfter(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)
|| !Singletons.getModel().getGameState().getStack().isEmpty()) {
|| !Singletons.getModel().getGame().getStack().isEmpty()) {
// Instant-speed pumps should not be cast outside of combat when the
// stack is empty
if (!AbilityFactory.isSorcerySpeed(sa)) {
@@ -403,7 +403,7 @@ public final class AbilityFactoryDebuff {
private static boolean debuffTgtAI(final Player ai, final AbilityFactory af, final SpellAbility sa, final ArrayList<String> kws,
final boolean mandatory) {
// this would be for evasive things like Flying, Unblockable, etc
if (!mandatory && Singletons.getModel().getGameState().getPhaseHandler().getPhase().isAfter(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
if (!mandatory && Singletons.getModel().getGame().getPhaseHandler().getPhase().isAfter(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
return false;
}
@@ -495,7 +495,7 @@ public final class AbilityFactoryDebuff {
* @return a boolean.
*/
private static boolean debuffMandatoryTarget(final Player ai, final AbilityFactory af, final SpellAbility sa, final boolean mandatory) {
List<Card> list = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
List<Card> list = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
final Target tgt = sa.getTarget();
list = CardLists.getValidCards(list, tgt.getValidTgts(), sa.getActivatingPlayer(), sa.getSourceCard());
@@ -626,7 +626,7 @@ public final class AbilityFactoryDebuff {
}
}
if (!params.containsKey("Permanent")) {
Singletons.getModel().getGameState().getEndOfTurn().addUntil(new Command() {
Singletons.getModel().getGame().getEndOfTurn().addUntil(new Command() {
private static final long serialVersionUID = 5387486776282932314L;
@Override
@@ -826,7 +826,7 @@ public final class AbilityFactoryDebuff {
});
// don't use DebuffAll after Combat_Begin until AI is improved
if (Singletons.getModel().getGameState().getPhaseHandler().getPhase().isAfter(PhaseType.COMBAT_BEGIN)) {
if (Singletons.getModel().getGame().getPhaseHandler().getPhase().isAfter(PhaseType.COMBAT_BEGIN)) {
return false;
}
@@ -857,7 +857,7 @@ public final class AbilityFactoryDebuff {
valid = params.get("ValidCards");
}
List<Card> list = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
List<Card> list = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
list = CardLists.getValidCards(list, valid.split(","), hostCard.getController(), hostCard);
for (final Card tgtC : list) {
@@ -872,7 +872,7 @@ public final class AbilityFactoryDebuff {
}
}
if (!params.containsKey("Permanent")) {
Singletons.getModel().getGameState().getEndOfTurn().addUntil(new Command() {
Singletons.getModel().getGame().getEndOfTurn().addUntil(new Command() {
private static final long serialVersionUID = 7486231071095628674L;
@Override

View File

@@ -299,6 +299,6 @@ public class AbilityFactoryDelayedTrigger {
final Trigger delTrig = TriggerHandler.parseTrigger(mapParams, spellAbility.getSourceCard(), true);
Singletons.getModel().getGameState().getTriggerHandler().registerDelayedTrigger(delTrig);
Singletons.getModel().getGame().getTriggerHandler().registerDelayedTrigger(delTrig);
}
}

View File

@@ -375,7 +375,7 @@ public class AbilityFactoryDestroy {
final Player opp = ai.getOpponent();
if (tgt != null) {
List<Card> list;
list = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
list = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
list = CardLists.getTargetableCards(list, sa);
list = CardLists.getValidCards(list, tgt.getValidTgts(), source.getController(), source);
@@ -593,11 +593,11 @@ public class AbilityFactoryDestroy {
if (tgtC.isInPlay() && ((tgt == null) || tgtC.canBeTargetedBy(sa))) {
boolean destroyed = false;
if (sac) {
destroyed = Singletons.getModel().getGameAction().sacrifice(tgtC, sa);
destroyed = Singletons.getModel().getGame().getAction().sacrifice(tgtC, sa);
} else if (noRegen) {
destroyed = Singletons.getModel().getGameAction().destroyNoRegeneration(tgtC);
destroyed = Singletons.getModel().getGame().getAction().destroyNoRegeneration(tgtC);
} else {
destroyed = Singletons.getModel().getGameAction().destroy(tgtC);
destroyed = Singletons.getModel().getGame().getAction().destroy(tgtC);
} if (destroyed && remDestroyed) {
card.addRemembered(tgtC);
}
@@ -608,11 +608,11 @@ public class AbilityFactoryDestroy {
if (unTgtC.isInPlay()) {
boolean destroyed = false;
if (sac) {
destroyed = Singletons.getModel().getGameAction().sacrifice(unTgtC, sa);
destroyed = Singletons.getModel().getGame().getAction().sacrifice(unTgtC, sa);
} else if (noRegen) {
destroyed = Singletons.getModel().getGameAction().destroyNoRegeneration(unTgtC);
destroyed = Singletons.getModel().getGame().getAction().destroyNoRegeneration(unTgtC);
} else {
destroyed = Singletons.getModel().getGameAction().destroy(unTgtC);
destroyed = Singletons.getModel().getGame().getAction().destroy(unTgtC);
} if (destroyed && remDestroyed) {
card.addRemembered(unTgtC);
}
@@ -1036,7 +1036,7 @@ public class AbilityFactoryDestroy {
valid = valid.replace("X", Integer.toString(AbilityFactory.calculateAmount(card, "X", sa)));
}
List<Card> list = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
List<Card> list = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
if (targetPlayer != null) {
list = CardLists.filterControlledBy(list, targetPlayer);
@@ -1051,13 +1051,13 @@ public class AbilityFactoryDestroy {
if (noRegen) {
for (int i = 0; i < list.size(); i++) {
if (Singletons.getModel().getGameAction().destroyNoRegeneration(list.get(i)) && remDestroyed) {
if (Singletons.getModel().getGame().getAction().destroyNoRegeneration(list.get(i)) && remDestroyed) {
card.addRemembered(list.get(i));
}
}
} else {
for (int i = 0; i < list.size(); i++) {
if (Singletons.getModel().getGameAction().destroy(list.get(i)) && remDestroyed) {
if (Singletons.getModel().getGame().getAction().destroy(list.get(i)) && remDestroyed) {
card.addRemembered(list.get(i));
}
}

View File

@@ -259,32 +259,32 @@ public class AbilityFactoryEffect {
if (params.containsKey("AILogic")) {
logic = params.get("AILogic");
final PhaseHandler phase = Singletons.getModel().getGameState().getPhaseHandler();
final PhaseHandler phase = Singletons.getModel().getGame().getPhaseHandler();
if (logic.equals("BeginningOfOppTurn")) {
if (phase.isPlayerTurn(ai.getOpponent()) || phase.getPhase().isAfter(PhaseType.DRAW)) {
return false;
}
randomReturn = true;
} else if (logic.equals("Fog")) {
if (Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(sa.getActivatingPlayer())) {
if (Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(sa.getActivatingPlayer())) {
return false;
}
if (!Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
if (!Singletons.getModel().getGame().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
return false;
}
if (Singletons.getModel().getGameState().getStack().size() != 0) {
if (Singletons.getModel().getGame().getStack().size() != 0) {
return false;
}
if (Singletons.getModel().getGameState().getPhaseHandler().isPreventCombatDamageThisTurn()) {
if (Singletons.getModel().getGame().getPhaseHandler().isPreventCombatDamageThisTurn()) {
return false;
}
if (!CombatUtil.lifeInDanger(ai, Singletons.getModel().getGameState().getCombat())) {
if (!CombatUtil.lifeInDanger(ai, Singletons.getModel().getGame().getCombat())) {
return false;
}
final Target tgt = sa.getTarget();
if (tgt != null) {
tgt.resetTargets();
List<Card> list = Singletons.getModel().getGameState().getCombat().getAttackerList();
List<Card> list = Singletons.getModel().getGame().getCombat().getAttackerList();
list = CardLists.getValidCards(list, tgt.getValidTgts(), sa.getActivatingPlayer(), sa.getSourceCard());
list = CardLists.getTargetableCards(list, sa);
Card target = CardFactoryUtil.getBestCreatureAI(list);
@@ -446,7 +446,7 @@ public class AbilityFactoryEffect {
}
// Unique Effects shouldn't be duplicated
if (params.containsKey("Unique") && Singletons.getModel().getGameState().isCardInPlay(name)) {
if (params.containsKey("Unique") && Singletons.getModel().getGame().isCardInPlay(name)) {
return;
}
@@ -552,7 +552,7 @@ public class AbilityFactoryEffect {
// Remember created effect
if (params.containsKey("RememberEffect")) {
Singletons.getModel().getGameState().getCardState(card).addRemembered(eff);
Singletons.getModel().getGame().getCardState(card).addRemembered(eff);
}
// Duration
@@ -563,29 +563,29 @@ public class AbilityFactoryEffect {
@Override
public void execute() {
Singletons.getModel().getGameAction().exile(e);
Singletons.getModel().getGame().getAction().exile(e);
}
};
if ((duration == null) || duration.equals("EndOfTurn")) {
Singletons.getModel().getGameState().getEndOfTurn().addUntil(endEffect);
Singletons.getModel().getGame().getEndOfTurn().addUntil(endEffect);
}
else if (duration.equals("UntilHostLeavesPlay")) {
card.addLeavesPlayCommand(endEffect);
}
else if (duration.equals("HostLeavesOrEOT")) {
Singletons.getModel().getGameState().getEndOfTurn().addUntil(endEffect);
Singletons.getModel().getGame().getEndOfTurn().addUntil(endEffect);
card.addLeavesPlayCommand(endEffect);
}
else if (duration.equals("UntilYourNextTurn")) {
Singletons.getModel().getGameState().getCleanup().addUntilYourNextTurn(controller, endEffect);
Singletons.getModel().getGame().getCleanup().addUntilYourNextTurn(controller, endEffect);
}
}
// TODO: Add targeting to the effect so it knows who it's dealing with
Singletons.getModel().getGameState().getTriggerHandler().suppressMode(TriggerType.ChangesZone);
Singletons.getModel().getGameAction().moveToPlay(eff);
Singletons.getModel().getGameState().getTriggerHandler().clearSuppression(TriggerType.ChangesZone);
Singletons.getModel().getGame().getTriggerHandler().suppressMode(TriggerType.ChangesZone);
Singletons.getModel().getGame().getAction().moveToPlay(eff);
Singletons.getModel().getGame().getTriggerHandler().clearSuppression(TriggerType.ChangesZone);
}
} // end class AbilityFactoryEffect

View File

@@ -353,7 +353,7 @@ public class AbilityFactoryGainControl {
// Don't steal something if I can't Attack without, or prevent it from
// blocking at least
if ((this.lose != null) && this.lose.contains("EOT")
&& Singletons.getModel().getGameState().getPhaseHandler().getPhase().isAfter(PhaseType.COMBAT_DECLARE_BLOCKERS)) {
&& Singletons.getModel().getGame().getPhaseHandler().getPhase().isAfter(PhaseType.COMBAT_DECLARE_BLOCKERS)) {
return false;
}
@@ -423,7 +423,7 @@ public class AbilityFactoryGainControl {
final Target tgt = sa.getTarget();
if (this.params.containsKey("AllValid")) {
tgtCards = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
tgtCards = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
tgtCards = AbilityFactory.filterListByType(tgtCards, this.params.get("AllValid"), sa);
} else if ((tgt != null) && !this.params.containsKey("Defined")) {
tgtCards.addAll(tgt.getTargetCards());
@@ -499,7 +499,7 @@ public class AbilityFactoryGainControl {
sa.getSourceCard().addChangeControllerCommand(this.getLoseControlCommand(tgtC, originalController, newController));
}
if (this.lose.contains("EOT")) {
Singletons.getModel().getGameState().getEndOfTurn().addAt(this.getLoseControlCommand(tgtC, originalController, newController));
Singletons.getModel().getGame().getEndOfTurn().addAt(this.getLoseControlCommand(tgtC, originalController, newController));
}
}
@@ -560,14 +560,14 @@ public class AbilityFactoryGainControl {
private boolean gainControlDrawbackAI(final Player ai, final SpellAbility sa) {
if ((sa.getTarget() == null) || !sa.getTarget().doesTarget()) {
if (this.params.containsKey("AllValid")) {
List<Card> tgtCards = CardLists.filterControlledBy(Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield), ai.getOpponent());
List<Card> tgtCards = CardLists.filterControlledBy(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), ai.getOpponent());
tgtCards = AbilityFactory.filterListByType(tgtCards, this.params.get("AllValid"), sa);
if (tgtCards.isEmpty()) {
return false;
}
}
if ((this.lose != null) && this.lose.contains("EOT")
&& Singletons.getModel().getGameState().getPhaseHandler().getPhase().isAfter(PhaseType.COMBAT_DECLARE_ATTACKERS)) {
&& Singletons.getModel().getGame().getPhaseHandler().getPhase().isAfter(PhaseType.COMBAT_DECLARE_ATTACKERS)) {
return false;
}
} else {
@@ -597,9 +597,9 @@ public class AbilityFactoryGainControl {
public void resolve() {
if (AbilityFactoryGainControl.this.bNoRegen) {
Singletons.getModel().getGameAction().destroyNoRegeneration(c);
Singletons.getModel().getGame().getAction().destroyNoRegeneration(c);
} else {
Singletons.getModel().getGameAction().destroy(c);
Singletons.getModel().getGame().getAction().destroy(c);
}
}
};
@@ -611,7 +611,7 @@ public class AbilityFactoryGainControl {
}
ability.setStackDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
}
};

View File

@@ -467,7 +467,7 @@ public class AbilityFactoryMana {
final int num = card.getCounters(Counters.getType(deplete));
if (num == 0) {
abMana.setUndoable(false);
Singletons.getModel().getGameAction().sacrifice(card, null);
Singletons.getModel().getGame().getAction().sacrifice(card, null);
}
}
@@ -771,7 +771,7 @@ public class AbilityFactoryMana {
cards.add(c);
}
} else {
cards = CardLists.getValidCards(Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield), validCard, abMana.getActivatingPlayer(), card);
cards = CardLists.getValidCards(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), validCard, abMana.getActivatingPlayer(), card);
}
// remove anything cards that is already in parents

View File

@@ -474,7 +474,7 @@ public class AbilityFactoryPermanentState {
final Card source = sa.getSourceCard();
final Target tgt = sa.getTarget();
List<Card> list = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
List<Card> list = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
list = CardLists.getValidCards(list, tgt.getValidTgts(), source.getController(), source);
list = CardLists.getTargetableCards(list, sa);
@@ -863,7 +863,7 @@ public class AbilityFactoryPermanentState {
final Random r = MyRandom.getRandom();
boolean randomReturn = r.nextFloat() <= Math.pow(.6667, sa.getActivationsThisTurn());
final PhaseHandler phase = Singletons.getModel().getGameState().getPhaseHandler();
final PhaseHandler phase = Singletons.getModel().getGame().getPhaseHandler();
final Player turn = phase.getPlayerTurn();
if (turn.isHuman() && phase.getPhase().isBefore(PhaseType.COMBAT_DECLARE_ATTACKERS)) {
@@ -1028,7 +1028,7 @@ public class AbilityFactoryPermanentState {
}
}
PhaseHandler phase = Singletons.getModel().getGameState().getPhaseHandler();
PhaseHandler phase = Singletons.getModel().getGame().getPhaseHandler();
if (phase.isPlayerTurn(ai)
&& phase.getPhase().isBefore(PhaseType.COMBAT_DECLARE_BLOCKERS)) {
// Tap creatures possible blockers before combat during AI's turn.
@@ -1036,7 +1036,7 @@ public class AbilityFactoryPermanentState {
List<Card> attackers;
if (phase.getPhase().isAfter(PhaseType.COMBAT_DECLARE_ATTACKERS)) {
//Combat has already started
attackers = Singletons.getModel().getGameState().getCombat().getAttackerList();
attackers = Singletons.getModel().getGame().getCombat().getAttackerList();
} else {
attackers = CardLists.filter(ai.getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES_CAN_ATTACK);
attackers.remove(sa.getSourceCard());
@@ -1099,7 +1099,7 @@ public class AbilityFactoryPermanentState {
final Card source = sa.getSourceCard();
final Target tgt = sa.getTarget();
List<Card> list = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
List<Card> list = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
list = CardLists.getValidCards(list, tgt.getValidTgts(), source.getController(), source);
list = CardLists.getTargetableCards(list, sa);
@@ -1419,7 +1419,7 @@ public class AbilityFactoryPermanentState {
}
if ((tgtPlayers == null) || tgtPlayers.isEmpty()) {
list = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
list = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
} else {
list = tgtPlayers.get(0).getCardsIn(ZoneType.Battlefield);
}
@@ -1677,7 +1677,7 @@ public class AbilityFactoryPermanentState {
}
if ((tgtPlayers == null) || tgtPlayers.isEmpty()) {
cards = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
cards = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
} else {
cards = tgtPlayers.get(0).getCardsIn(ZoneType.Battlefield);
}
@@ -1712,7 +1712,7 @@ public class AbilityFactoryPermanentState {
final HashMap<String, String> params = af.getMapParams();
Player opp = ai.getOpponent();
if (Singletons.getModel().getGameState().getPhaseHandler().getPhase().isAfter(PhaseType.COMBAT_BEGIN)) {
if (Singletons.getModel().getGame().getPhaseHandler().getPhase().isAfter(PhaseType.COMBAT_BEGIN)) {
return false;
}
@@ -1721,7 +1721,7 @@ public class AbilityFactoryPermanentState {
valid = params.get("ValidCards");
}
List<Card> validTappables = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
List<Card> validTappables = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
final Target tgt = sa.getTarget();
@@ -1772,7 +1772,7 @@ public class AbilityFactoryPermanentState {
* @return a {@link forge.CardList} object.
*/
private static List<Card> getTapAllTargets(final String valid, final Card source) {
List<Card> tmpList = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
List<Card> tmpList = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
tmpList = CardLists.getValidCards(tmpList, valid, source.getController(), source);
tmpList = CardLists.filter(tmpList, Presets.UNTAPPED);
return tmpList;
@@ -2600,7 +2600,7 @@ public class AbilityFactoryPermanentState {
final Card source = sa.getSourceCard();
final Target tgt = sa.getTarget();
List<Card> list = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
List<Card> list = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
list = CardLists.getTargetableCards(CardLists.getValidCards(list, tgt.getValidTgts(), source.getController(), source), sa);
return false;

View File

@@ -291,7 +291,7 @@ public final class AbilityFactoryPlay {
}
// don't use this as a response
if (Singletons.getModel().getGameState().getStack().size() != 0) {
if (Singletons.getModel().getGame().getStack().size() != 0) {
return false;
}
@@ -302,7 +302,7 @@ public final class AbilityFactoryPlay {
final Target tgt = sa.getTarget();
if (tgt != null) {
ZoneType zone = tgt.getZone().get(0);
cards = Singletons.getModel().getGameState().getCardsIn(zone);
cards = Singletons.getModel().getGame().getCardsIn(zone);
cards = CardLists.getValidCards(cards, tgt.getValidTgts(), ai, source);
if (cards.isEmpty()) {
return false;
@@ -374,7 +374,7 @@ public final class AbilityFactoryPlay {
if (params.containsKey("ValidZone")) {
zone = ZoneType.smartValueOf(params.get("ValidZone"));
}
tgtCards = Singletons.getModel().getGameState().getCardsIn(zone);
tgtCards = Singletons.getModel().getGame().getCardsIn(zone);
tgtCards = AbilityFactory.filterListByType(tgtCards, params.get("Valid"), sa);
} else if (params.containsKey("Defined")) {
tgtCards = new ArrayList<Card>(AbilityFactory.getDefinedCards(sa.getSourceCard(), params.get("Defined"), sa));
@@ -511,7 +511,7 @@ public final class AbilityFactoryPlay {
newSA.setPayCosts(cost);
newSA.setManaCost("");
newSA.setDescription(newSA.getDescription() + " (without paying its mana cost)");
Singletons.getModel().getGameAction().playSpellAbility(newSA);
Singletons.getModel().getGame().getAction().playSpellAbility(newSA);
if (remember) {
source.addRemembered(tgtSA.getSourceCard());
}
@@ -528,7 +528,7 @@ public final class AbilityFactoryPlay {
}
} else {
if (controller.isHuman()) {
Singletons.getModel().getGameAction().playSpellAbility(tgtSA);
Singletons.getModel().getGame().getAction().playSpellAbility(tgtSA);
if (remember) {
source.addRemembered(tgtSA.getSourceCard());
}

View File

@@ -302,7 +302,7 @@ public class AbilityFactoryPreventDamage {
params.get("Defined"), sa);
// react to threats on the stack
if (Singletons.getModel().getGameState().getStack().size() > 0) {
if (Singletons.getModel().getGame().getStack().size() > 0) {
final ArrayList<Object> threatenedObjects = AbilityFactory.predictThreatenedObjects(sa.getActivatingPlayer(), af);
for (final Object o : objects) {
if (threatenedObjects.contains(o)) {
@@ -310,7 +310,7 @@ public class AbilityFactoryPreventDamage {
}
}
} else {
PhaseHandler handler = Singletons.getModel().getGameState().getPhaseHandler();
PhaseHandler handler = Singletons.getModel().getGame().getPhaseHandler();
if (handler.is(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
boolean flag = false;
for (final Object o : objects) {
@@ -321,8 +321,8 @@ public class AbilityFactoryPreventDamage {
// Don't need to worry about Combat Damage during AI's turn
final Player p = (Player) o;
if (!handler.isPlayerTurn(p)) {
flag |= (p.isComputer() && ((CombatUtil.wouldLoseLife(ai, Singletons.getModel().getGameState().getCombat()) && sa
.isAbility()) || CombatUtil.lifeInDanger(ai, Singletons.getModel().getGameState().getCombat())));
flag |= (p.isComputer() && ((CombatUtil.wouldLoseLife(ai, Singletons.getModel().getGame().getCombat()) && sa
.isAbility()) || CombatUtil.lifeInDanger(ai, Singletons.getModel().getGame().getCombat())));
}
}
}
@@ -336,7 +336,7 @@ public class AbilityFactoryPreventDamage {
} // targeted
// react to threats on the stack
else if (Singletons.getModel().getGameState().getStack().size() > 0) {
else if (Singletons.getModel().getGame().getStack().size() > 0) {
tgt.resetTargets();
// check stack for something on the stack will kill anything i
// control
@@ -365,10 +365,10 @@ public class AbilityFactoryPreventDamage {
}
} // Protect combatants
else if (Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
if (sa.canTarget(ai) && CombatUtil.wouldLoseLife(ai, Singletons.getModel().getGameState().getCombat())
&& (CombatUtil.lifeInDanger(ai, Singletons.getModel().getGameState().getCombat()) || sa.isAbility())
&& Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(ai.getOpponent())) {
else if (Singletons.getModel().getGame().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
if (sa.canTarget(ai) && CombatUtil.wouldLoseLife(ai, Singletons.getModel().getGame().getCombat())
&& (CombatUtil.lifeInDanger(ai, Singletons.getModel().getGame().getCombat()) || sa.isAbility())
&& Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(ai.getOpponent())) {
tgt.addTarget(ai);
chance = true;
} else {
@@ -456,7 +456,7 @@ public class AbilityFactoryPreventDamage {
final Target tgt = sa.getTarget();
tgt.resetTargets();
// filter AIs battlefield by what I can target
List<Card> targetables = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
List<Card> targetables = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
targetables = CardLists.getValidCards(targetables, tgt.getValidTgts(), ai, hostCard);
final List<Card> compTargetables = CardLists.filterControlledBy(targetables, ai);
@@ -471,7 +471,7 @@ public class AbilityFactoryPreventDamage {
if (compTargetables.size() > 0) {
final List<Card> combatants = CardLists.filter(compTargetables, CardPredicates.Presets.CREATURES);
CardLists.sortByEvaluateCreature(combatants);
if (Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
if (Singletons.getModel().getGame().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
for (final Card c : combatants) {
if (CombatUtil.combatantWouldBeDestroyed(c)) {
tgt.addTarget(c);
@@ -739,12 +739,12 @@ public class AbilityFactoryPreventDamage {
return false;
}
if (Singletons.getModel().getGameState().getStack().size() > 0) {
if (Singletons.getModel().getGame().getStack().size() > 0) {
// TODO check stack for something on the stack will kill anything i
// control
} // Protect combatants
else if (Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
else if (Singletons.getModel().getGame().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
// TODO
}
@@ -786,7 +786,7 @@ public class AbilityFactoryPreventDamage {
}
if (params.containsKey("ValidCards")) {
list = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
list = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
}
list = AbilityFactory.filterListByType(list, params.get("ValidCards"), sa);
@@ -796,7 +796,7 @@ public class AbilityFactoryPreventDamage {
}
if (!players.equals("")) {
final ArrayList<Player> playerList = new ArrayList<Player>(Singletons.getModel().getGameState().getPlayers());
final ArrayList<Player> playerList = new ArrayList<Player>(Singletons.getModel().getGame().getPlayers());
for (final Player p : playerList) {
if (p.isValid(players, source.getController(), source)) {
p.addPreventNextDamage(numDam);

View File

@@ -261,8 +261,8 @@ public final class AbilityFactoryProtection {
}
// will the creature attack (only relevant for sorcery speed)?
if (Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_DECLARE_ATTACKERS)
&& Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(ai)
if (Singletons.getModel().getGame().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_DECLARE_ATTACKERS)
&& Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(ai)
&& CardFactoryUtil.doesCreatureAttackAI(ai, c)) {
return true;
}
@@ -275,9 +275,9 @@ public final class AbilityFactoryProtection {
}
// is the creature in blocked and the blocker would survive
if (Singletons.getModel().getGameState().getPhaseHandler().getPhase().isAfter(PhaseType.COMBAT_DECLARE_BLOCKERS)
&& Singletons.getModel().getGameState().getCombat().isAttacking(c) && Singletons.getModel().getGameState().getCombat().isBlocked(c)
&& CombatUtil.blockerWouldBeDestroyed(Singletons.getModel().getGameState().getCombat().getBlockers(c).get(0))) {
if (Singletons.getModel().getGame().getPhaseHandler().getPhase().isAfter(PhaseType.COMBAT_DECLARE_BLOCKERS)
&& Singletons.getModel().getGame().getCombat().isAttacking(c) && Singletons.getModel().getGame().getCombat().isBlocked(c)
&& CombatUtil.blockerWouldBeDestroyed(Singletons.getModel().getGame().getCombat().getBlockers(c).get(0))) {
return true;
}
@@ -326,13 +326,13 @@ public final class AbilityFactoryProtection {
}
// Phase Restrictions
if ((Singletons.getModel().getGameState().getStack().size() == 0) && Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_FIRST_STRIKE_DAMAGE)) {
if ((Singletons.getModel().getGame().getStack().size() == 0) && Singletons.getModel().getGame().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_FIRST_STRIKE_DAMAGE)) {
// Instant-speed protections should not be cast outside of combat
// when the stack is empty
if (!AbilityFactory.isSorcerySpeed(sa)) {
return false;
}
} else if (Singletons.getModel().getGameState().getStack().size() > 0) {
} else if (Singletons.getModel().getGame().getStack().size() > 0) {
// TODO protection something only if the top thing on the stack will
// kill it via damage or destroy
return false;
@@ -373,7 +373,7 @@ public final class AbilityFactoryProtection {
* @return a boolean.
*/
private static boolean protectTgtAI(final Player ai, final AbilityFactory af, final SpellAbility sa, final boolean mandatory) {
if (!mandatory && Singletons.getModel().getGameState().getPhaseHandler().getPhase().isAfter(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
if (!mandatory && Singletons.getModel().getGame().getPhaseHandler().getPhase().isAfter(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
return false;
}
@@ -396,16 +396,16 @@ public final class AbilityFactoryProtection {
* Or, add protection (to make it unblockable) when Compy is attacking.
*/
if (Singletons.getModel().getGameState().getStack().size() == 0) {
if (Singletons.getModel().getGame().getStack().size() == 0) {
// If the cost is tapping, don't activate before declare
// attack/block
if ((sa.getPayCosts() != null) && sa.getPayCosts().getTap()) {
if (Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_DECLARE_ATTACKERS)
&& Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(ai)) {
if (Singletons.getModel().getGame().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_DECLARE_ATTACKERS)
&& Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(ai)) {
list.remove(sa.getSourceCard());
}
if (Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_DECLARE_BLOCKERS)
&& Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(ai)) {
if (Singletons.getModel().getGame().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_DECLARE_BLOCKERS)
&& Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(ai)) {
list.remove(sa.getSourceCard());
}
}
@@ -468,7 +468,7 @@ public final class AbilityFactoryProtection {
final HashMap<String, String> params = af.getMapParams();
final Card host = af.getHostCard();
List<Card> list = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
List<Card> list = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
final Target tgt = sa.getTarget();
list = CardLists.getValidCards(list, tgt.getValidTgts(), sa.getActivatingPlayer(), sa.getSourceCard());
@@ -745,7 +745,7 @@ public final class AbilityFactoryProtection {
if (logic.equals("MostProminentHumanCreatures")) {
List<Card> list = ai.getOpponent().getCreaturesInPlay();
if (list.isEmpty()) {
list = CardLists.filterControlledBy(Singletons.getModel().getGameState().getCardsInGame(), ai.getOpponent());
list = CardLists.filterControlledBy(Singletons.getModel().getGame().getCardsInGame(), ai.getOpponent());
}
if (!list.isEmpty()) {
choice = CardFactoryUtil.getMostProminentColor(list);
@@ -814,9 +814,9 @@ public final class AbilityFactoryProtection {
}
};
if (params.containsKey("UntilEndOfCombat")) {
Singletons.getModel().getGameState().getEndOfCombat().addUntil(untilEOT);
Singletons.getModel().getGame().getEndOfCombat().addUntil(untilEOT);
} else {
Singletons.getModel().getGameState().getEndOfTurn().addUntil(untilEOT);
Singletons.getModel().getGame().getEndOfTurn().addUntil(untilEOT);
}
}
}
@@ -846,9 +846,9 @@ public final class AbilityFactoryProtection {
}
};
if (params.containsKey("UntilEndOfCombat")) {
Singletons.getModel().getGameState().getEndOfCombat().addUntil(untilEOT);
Singletons.getModel().getGame().getEndOfCombat().addUntil(untilEOT);
} else {
Singletons.getModel().getGameState().getEndOfTurn().addUntil(untilEOT);
Singletons.getModel().getGame().getEndOfTurn().addUntil(untilEOT);
}
}
}
@@ -1190,7 +1190,7 @@ public final class AbilityFactoryProtection {
valid = params.get("ValidCards");
}
if (!valid.equals("")) {
List<Card> list = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
List<Card> list = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
list = CardLists.getValidCards(list, valid, sa.getActivatingPlayer(), host);
for (final Card tgtC : list) {
@@ -1214,9 +1214,9 @@ public final class AbilityFactoryProtection {
}
};
if (params.containsKey("UntilEndOfCombat")) {
Singletons.getModel().getGameState().getEndOfCombat().addUntil(untilEOT);
Singletons.getModel().getGame().getEndOfCombat().addUntil(untilEOT);
} else {
Singletons.getModel().getGameState().getEndOfTurn().addUntil(untilEOT);
Singletons.getModel().getGame().getEndOfTurn().addUntil(untilEOT);
}
}
}
@@ -1248,9 +1248,9 @@ public final class AbilityFactoryProtection {
}
};
if (params.containsKey("UntilEndOfCombat")) {
Singletons.getModel().getGameState().getEndOfCombat().addUntil(untilEOT);
Singletons.getModel().getGame().getEndOfCombat().addUntil(untilEOT);
} else {
Singletons.getModel().getGameState().getEndOfTurn().addUntil(untilEOT);
Singletons.getModel().getGame().getEndOfTurn().addUntil(untilEOT);
}
}
}

View File

@@ -314,7 +314,7 @@ public class AbilityFactoryPump {
* @return true, if is useful keyword
*/
public boolean isUsefulCurseKeyword(final Player ai, final String keyword, final Card card, final SpellAbility sa) {
final PhaseHandler ph = Singletons.getModel().getGameState().getPhaseHandler();
final PhaseHandler ph = Singletons.getModel().getGame().getPhaseHandler();
final Player human = ai.getOpponent();
//int attack = getNumAttack(sa);
//int defense = getNumDefense(sa);
@@ -404,7 +404,7 @@ public class AbilityFactoryPump {
* @return true, if is useful keyword
*/
public boolean isUsefulPumpKeyword(final Player ai, final String keyword, final Card card, final SpellAbility sa) {
final PhaseHandler ph = Singletons.getModel().getGameState().getPhaseHandler();
final PhaseHandler ph = Singletons.getModel().getGame().getPhaseHandler();
final Player opp = ai.getOpponent();
int attack = getNumAttack(sa);
//int defense = getNumDefense(sa);
@@ -430,10 +430,10 @@ public class AbilityFactoryPump {
} else if (keyword.endsWith("Flying")) {
if (ph.isPlayerTurn(opp)
&& ph.getPhase().equals(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY)
&& !CardLists.getKeyword(Singletons.getModel().getGameState().getCombat().getAttackerList(), "Flying").isEmpty()
&& !CardLists.getKeyword(Singletons.getModel().getGame().getCombat().getAttackerList(), "Flying").isEmpty()
&& !card.hasKeyword("Reach")
&& CombatUtil.canBlock(card)
&& CombatUtil.lifeInDanger(ai, Singletons.getModel().getGameState().getCombat())) {
&& CombatUtil.lifeInDanger(ai, Singletons.getModel().getGame().getCombat())) {
return true;
}
Predicate<Card> flyingOrReach = Predicates.or(CardPredicates.hasKeyword("Flying"), CardPredicates.hasKeyword("Reach"));
@@ -445,9 +445,9 @@ public class AbilityFactoryPump {
} else if (keyword.endsWith("Horsemanship")) {
if (ph.isPlayerTurn(opp)
&& ph.getPhase().equals(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY)
&& !CardLists.getKeyword(Singletons.getModel().getGameState().getCombat().getAttackerList(), "Horsemanship").isEmpty()
&& !CardLists.getKeyword(Singletons.getModel().getGame().getCombat().getAttackerList(), "Horsemanship").isEmpty()
&& CombatUtil.canBlock(card)
&& CombatUtil.lifeInDanger(ai, Singletons.getModel().getGameState().getCombat())) {
&& CombatUtil.lifeInDanger(ai, Singletons.getModel().getGame().getCombat())) {
return true;
}
if (ph.isPlayerTurn(opp) || !(CombatUtil.canAttack(card) || card.isAttacking())
@@ -467,7 +467,7 @@ public class AbilityFactoryPump {
} else if (keyword.endsWith("Indestructible")) {
return true;
} else if (keyword.endsWith("Deathtouch")) {
Combat combat = Singletons.getModel().getGameState().getCombat();
Combat combat = Singletons.getModel().getGame().getCombat();
if (ph.isPlayerTurn(opp) && ph.getPhase().equals(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY)) {
List<Card> attackers = combat.getAttackers();
for (Card attacker : attackers) {
@@ -559,7 +559,7 @@ public class AbilityFactoryPump {
} else if (keyword.equals("Reach")) {
if (ph.isPlayerTurn(ai)
|| !ph.getPhase().equals(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY)
|| CardLists.getKeyword(Singletons.getModel().getGameState().getCombat().getAttackerList(), "Flying").isEmpty()
|| CardLists.getKeyword(Singletons.getModel().getGame().getCombat().getAttackerList(), "Flying").isEmpty()
|| card.hasKeyword("Flying")
|| !CombatUtil.canBlock(card)) {
return false;
@@ -571,7 +571,7 @@ public class AbilityFactoryPump {
}
int canBlockNum = 1 + card.getKeywordAmount("CARDNAME can block an additional creature.");
int possibleBlockNum = 0;
for (Card attacker : Singletons.getModel().getGameState().getCombat().getAttackerList()) {
for (Card attacker : Singletons.getModel().getGame().getCombat().getAttackerList()) {
if (CombatUtil.canBlock(attacker, card)) {
possibleBlockNum++;
if (possibleBlockNum > canBlockNum) {
@@ -625,7 +625,7 @@ public class AbilityFactoryPump {
private boolean shouldPumpCard(final Player ai, final SpellAbility sa, final Card c) {
int attack = getNumAttack(sa);
int defense = getNumDefense(sa);
PhaseHandler phase = Singletons.getModel().getGameState().getPhaseHandler();
PhaseHandler phase = Singletons.getModel().getGame().getPhaseHandler();
if (!c.canBeTargetedBy(sa)) {
return false;
@@ -653,7 +653,7 @@ public class AbilityFactoryPump {
if (defense > 0 && CombatUtil.blockerWouldBeDestroyed(c)) {
return true;
}
List<Card> blockedBy = Singletons.getModel().getGameState().getCombat().getAttackersBlockedBy(c);
List<Card> blockedBy = Singletons.getModel().getGame().getCombat().getAttackersBlockedBy(c);
// For now, Only care the first creature blocked by a card.
// TODO Add in better BlockAdditional support
if (!blockedBy.isEmpty() && attack > 0 && !CombatUtil.attackerWouldBeDestroyed(blockedBy.get(0))) {
@@ -663,21 +663,21 @@ public class AbilityFactoryPump {
// is the creature unblocked and the spell will pump its power?
if (phase.is(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)
&& Singletons.getModel().getGameState().getCombat().isAttacking(c) && Singletons.getModel().getGameState().getCombat().isUnblocked(c) && (attack > 0)) {
&& Singletons.getModel().getGame().getCombat().isAttacking(c) && Singletons.getModel().getGame().getCombat().isUnblocked(c) && (attack > 0)) {
return true;
}
// is the creature blocked and the blocker would survive
if (phase.is(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY) && (attack > 0)
&& Singletons.getModel().getGameState().getCombat().isAttacking(c) && Singletons.getModel().getGameState().getCombat().isBlocked(c)
&& Singletons.getModel().getGameState().getCombat().getBlockers(c) != null
&& !Singletons.getModel().getGameState().getCombat().getBlockers(c).isEmpty()
&& !CombatUtil.blockerWouldBeDestroyed(Singletons.getModel().getGameState().getCombat().getBlockers(c).get(0))) {
&& Singletons.getModel().getGame().getCombat().isAttacking(c) && Singletons.getModel().getGame().getCombat().isBlocked(c)
&& Singletons.getModel().getGame().getCombat().getBlockers(c) != null
&& !Singletons.getModel().getGame().getCombat().getBlockers(c).isEmpty()
&& !CombatUtil.blockerWouldBeDestroyed(Singletons.getModel().getGame().getCombat().getBlockers(c).get(0))) {
return true;
}
// if the life of the computer is in danger, try to pump blockers blocking Tramplers
List<Card> blockedBy = Singletons.getModel().getGameState().getCombat().getAttackersBlockedBy(c);
List<Card> blockedBy = Singletons.getModel().getGame().getCombat().getAttackersBlockedBy(c);
boolean attackerHasTrample = false;
for (Card b : blockedBy) {
attackerHasTrample |= b.hasKeyword("Trample");
@@ -688,7 +688,7 @@ public class AbilityFactoryPump {
&& c.isBlocking()
&& defense > 0
&& attackerHasTrample
&& (sa.isAbility() || CombatUtil.lifeInDanger(ai, Singletons.getModel().getGameState().getCombat()))) {
&& (sa.isAbility() || CombatUtil.lifeInDanger(ai, Singletons.getModel().getGame().getCombat()))) {
return true;
}
@@ -744,11 +744,11 @@ public class AbilityFactoryPump {
}); // leaves all creatures that will be destroyed
} // -X/-X end
else if ((attack < 0) && !list.isEmpty()
&& !Singletons.getModel().getGameState().getPhaseHandler().isPreventCombatDamageThisTurn()) {
&& !Singletons.getModel().getGame().getPhaseHandler().isPreventCombatDamageThisTurn()) {
// spells that give -X/0
Player activePlayer = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
Player activePlayer = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
if (activePlayer.isComputer()) {
if (Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_BEGIN)) {
if (Singletons.getModel().getGame().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_BEGIN)) {
// TODO: Curse creatures that will block AI's creatures, if AI is going to attack.
list = new ArrayList<Card>();
} else {
@@ -756,7 +756,7 @@ public class AbilityFactoryPump {
}
} else {
// Human active, only curse attacking creatures
if (Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_DECLARE_BLOCKERS)) {
if (Singletons.getModel().getGame().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_DECLARE_BLOCKERS)) {
list = CardLists.filter(list, new Predicate<Card>() {
@Override
public boolean apply(final Card c) {
@@ -819,7 +819,7 @@ public class AbilityFactoryPump {
*/
private boolean pumpPlayAI(final Player ai, final SpellAbility sa) {
final Cost cost = sa.getPayCosts();
final PhaseHandler ph = Singletons.getModel().getGameState().getPhaseHandler();
final PhaseHandler ph = Singletons.getModel().getGame().getPhaseHandler();
if (!CostUtil.checkLifeCost(ai, cost, sa.getSourceCard(), 4, null)) {
return false;
@@ -837,7 +837,7 @@ public class AbilityFactoryPump {
return false;
}
if (Singletons.getModel().getGameState().getStack().isEmpty() && CostUtil.hasTapCost(cost, sa.getSourceCard())) {
if (Singletons.getModel().getGame().getStack().isEmpty() && CostUtil.hasTapCost(cost, sa.getSourceCard())) {
if (ph.getPhase().isBefore(PhaseType.COMBAT_DECLARE_ATTACKERS) && ph.isPlayerTurn(ai)) {
return false;
}
@@ -849,13 +849,13 @@ public class AbilityFactoryPump {
final SpellAbilityRestriction restrict = sa.getRestrictions();
// Phase Restrictions
if ((Singletons.getModel().getGameState().getStack().size() == 0) && ph.getPhase().isBefore(PhaseType.COMBAT_BEGIN)) {
if ((Singletons.getModel().getGame().getStack().size() == 0) && ph.getPhase().isBefore(PhaseType.COMBAT_BEGIN)) {
// Instant-speed pumps should not be cast outside of combat when the
// stack is empty
if (!this.abilityFactory.isCurse() && !AbilityFactory.isSorcerySpeed(sa)) {
return false;
}
} else if (Singletons.getModel().getGameState().getStack().size() > 0) {
} else if (Singletons.getModel().getGame().getStack().size() > 0) {
if (!this.keywords.contains("Shroud") && !this.keywords.contains("Hexproof")) {
return false;
}
@@ -968,7 +968,7 @@ public class AbilityFactoryPump {
private boolean pumpTgtAI(final Player ai, final SpellAbility sa, final int defense, final int attack, final boolean mandatory) {
if (!mandatory
&& !sa.isTrigger()
&& Singletons.getModel().getGameState().getPhaseHandler().getPhase().isAfter(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)
&& Singletons.getModel().getGame().getPhaseHandler().getPhase().isAfter(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)
&& !(this.abilityFactory.isCurse() && (defense < 0))
&& !this.containsNonCombatKeyword(this.keywords)
&& !sa.getAbilityFactory().getMapParams().containsKey("UntilYourNextTurn")) {
@@ -981,7 +981,7 @@ public class AbilityFactoryPump {
List<Card> list = new ArrayList<Card>();
if (this.abilityFactory.getMapParams().containsKey("AILogic")) {
if (this.abilityFactory.getMapParams().get("AILogic").equals("HighestPower")) {
list = CardLists.getValidCards(CardLists.filter(Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield), Presets.CREATURES), tgt.getValidTgts(), sa.getActivatingPlayer(), sa.getSourceCard());
list = CardLists.getValidCards(CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), Presets.CREATURES), tgt.getValidTgts(), sa.getActivatingPlayer(), sa.getSourceCard());
list = CardLists.getTargetableCards(list, sa);
CardLists.sortAttack(list);
if (!list.isEmpty()) {
@@ -1000,7 +1000,7 @@ public class AbilityFactoryPump {
} else {
if (!tgt.canTgtCreature()) {
ZoneType zone = tgt.getZone().get(0);
list = Singletons.getModel().getGameState().getCardsIn(zone);
list = Singletons.getModel().getGame().getCardsIn(zone);
} else {
list = this.getPumpCreatures(ai, sa);
}
@@ -1011,16 +1011,16 @@ public class AbilityFactoryPump {
}
list = CardLists.getValidCards(list, tgt.getValidTgts(), sa.getActivatingPlayer(), sa.getSourceCard());
if (Singletons.getModel().getGameState().getStack().size() == 0) {
if (Singletons.getModel().getGame().getStack().size() == 0) {
// If the cost is tapping, don't activate before declare
// attack/block
if ((sa.getPayCosts() != null) && sa.getPayCosts().getTap()) {
if (Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_DECLARE_ATTACKERS)
&& Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(ai)) {
if (Singletons.getModel().getGame().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_DECLARE_ATTACKERS)
&& Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(ai)) {
list.remove(sa.getSourceCard());
}
if (Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_DECLARE_BLOCKERS)
&& Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(opp)) {
if (Singletons.getModel().getGame().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_DECLARE_BLOCKERS)
&& Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(opp)) {
list.remove(sa.getSourceCard());
}
}
@@ -1080,7 +1080,7 @@ public class AbilityFactoryPump {
* @return a boolean.
*/
private boolean pumpMandatoryTarget(final Player ai, final AbilityFactory af, final SpellAbility sa, final boolean mandatory) {
List<Card> list = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
List<Card> list = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
final Target tgt = sa.getTarget();
final Player opp = ai.getOpponent();
list = CardLists.getValidCards(list, tgt.getValidTgts(), sa.getActivatingPlayer(), sa.getSourceCard());
@@ -1444,7 +1444,7 @@ public class AbilityFactoryPump {
final Card tgtC = tgtCards.get(j);
// only pump things in PumpZone
if (!Singletons.getModel().getGameState().getCardsIn(pumpZone).contains(tgtC)) {
if (!Singletons.getModel().getGame().getCardsIn(pumpZone).contains(tgtC)) {
continue;
}
@@ -1459,7 +1459,7 @@ public class AbilityFactoryPump {
for (int i = 0; i < untargetedCards.size(); i++) {
final Card tgtC = untargetedCards.get(i);
// only pump things in PumpZone
if (!Singletons.getModel().getGameState().getCardsIn(pumpZone).contains(tgtC)) {
if (!Singletons.getModel().getGame().getCardsIn(pumpZone).contains(tgtC)) {
continue;
}
@@ -1513,20 +1513,20 @@ public class AbilityFactoryPump {
}
};
if (this.params.containsKey("UntilEndOfCombat")) {
Singletons.getModel().getGameState().getEndOfCombat().addUntil(untilEOT);
Singletons.getModel().getGame().getEndOfCombat().addUntil(untilEOT);
} else if (this.params.containsKey("UntilYourNextUpkeep")) {
Singletons.getModel().getGameState().getUpkeep().addUntil(sa.getActivatingPlayer(), untilEOT);
Singletons.getModel().getGame().getUpkeep().addUntil(sa.getActivatingPlayer(), untilEOT);
} else if (params.containsKey("UntilHostLeavesPlay")) {
sa.getSourceCard().addLeavesPlayCommand(untilEOT);
} else if (this.params.containsKey("UntilLoseControlOfHost")) {
sa.getSourceCard().addLeavesPlayCommand(untilEOT);
sa.getSourceCard().addChangeControllerCommand(untilEOT);
} else if (this.params.containsKey("UntilYourNextTurn")) {
Singletons.getModel().getGameState().getCleanup().addUntilYourNextTurn(sa.getActivatingPlayer(), untilEOT);
Singletons.getModel().getGame().getCleanup().addUntilYourNextTurn(sa.getActivatingPlayer(), untilEOT);
} else if (params.containsKey("UntilUntaps")) {
sa.getSourceCard().addUntapCommand(untilEOT);
} else {
Singletons.getModel().getGameState().getEndOfTurn().addUntil(untilEOT);
Singletons.getModel().getGame().getEndOfTurn().addUntil(untilEOT);
}
}
}
@@ -1553,11 +1553,11 @@ public class AbilityFactoryPump {
}
};
if (this.params.containsKey("UntilEndOfCombat")) {
Singletons.getModel().getGameState().getEndOfCombat().addUntil(untilEOT);
Singletons.getModel().getGame().getEndOfCombat().addUntil(untilEOT);
} else if (this.params.containsKey("UntilYourNextUpkeep")) {
Singletons.getModel().getGameState().getUpkeep().addUntil(sa.getActivatingPlayer(), untilEOT);
Singletons.getModel().getGame().getUpkeep().addUntil(sa.getActivatingPlayer(), untilEOT);
} else {
Singletons.getModel().getGameState().getEndOfTurn().addUntil(untilEOT);
Singletons.getModel().getGame().getEndOfTurn().addUntil(untilEOT);
}
}
}
@@ -1719,7 +1719,7 @@ public class AbilityFactoryPump {
this.params = this.abilityFactory.getMapParams();
final int power = this.getNumAttack(sa);
final int defense = this.getNumDefense(sa);
final PhaseType phase = Singletons.getModel().getGameState().getPhaseHandler().getPhase();
final PhaseType phase = Singletons.getModel().getGame().getPhaseHandler().getPhase();
// prevent runaway activations
final boolean chance = r.nextFloat() <= Math.pow(.6667, sa.getActivationsThisTurn()); // to
@@ -1765,8 +1765,8 @@ public class AbilityFactoryPump {
else if (power < 0) { // -X/-0
if (phase.isAfter(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)
|| phase.isBefore(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY)
|| Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(sa.getActivatingPlayer())
|| Singletons.getModel().getGameState().getPhaseHandler().isPreventCombatDamageThisTurn()) {
|| Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(sa.getActivatingPlayer())
|| Singletons.getModel().getGame().getPhaseHandler().isPreventCombatDamageThisTurn()) {
return false;
}
int totalPower = 0;
@@ -1776,8 +1776,8 @@ public class AbilityFactoryPump {
}
totalPower += Math.min(c.getNetAttack(), power * -1);
if (phase == PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY
&& Singletons.getModel().getGameState().getCombat().getUnblockedAttackers().contains(c)) {
if (CombatUtil.lifeInDanger(sa.getActivatingPlayer(), Singletons.getModel().getGameState().getCombat())) {
&& Singletons.getModel().getGame().getCombat().getUnblockedAttackers().contains(c)) {
if (CombatUtil.lifeInDanger(sa.getActivatingPlayer(), Singletons.getModel().getGame().getCombat())) {
return true;
}
totalPower += Math.min(c.getNetAttack(), power * -1);
@@ -1858,7 +1858,7 @@ public class AbilityFactoryPump {
list = new ArrayList<Card>();
if ((tgtPlayers == null) || tgtPlayers.isEmpty()) {
for (final ZoneType zone : affectedZones) {
list.addAll(Singletons.getModel().getGameState().getCardsIn(zone));
list.addAll(Singletons.getModel().getGame().getCardsIn(zone));
}
} else {
@@ -1921,7 +1921,7 @@ public class AbilityFactoryPump {
if (params.containsKey("UntilUntaps")) {
sa.getSourceCard().addUntapCommand(untilEOT);
} else {
Singletons.getModel().getGameState().getEndOfTurn().addUntil(untilEOT);
Singletons.getModel().getGame().getEndOfTurn().addUntil(untilEOT);
}
}
}

View File

@@ -292,7 +292,7 @@ public class AbilityFactoryRegenerate {
// them
final ArrayList<Card> list = AbilityFactory.getDefinedCards(hostCard, params.get("Defined"), sa);
if (Singletons.getModel().getGameState().getStack().size() > 0) {
if (Singletons.getModel().getGame().getStack().size() > 0) {
final ArrayList<Object> objects = AbilityFactory.predictThreatenedObjects(sa.getActivatingPlayer(),af);
for (final Card c : list) {
@@ -301,7 +301,7 @@ public class AbilityFactoryRegenerate {
}
}
} else {
if (Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
if (Singletons.getModel().getGame().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
boolean flag = false;
for (final Card c : list) {
@@ -327,7 +327,7 @@ public class AbilityFactoryRegenerate {
return false;
}
if (Singletons.getModel().getGameState().getStack().size() > 0) {
if (Singletons.getModel().getGame().getStack().size() > 0) {
// check stack for something on the stack will kill anything i
// control
final ArrayList<Object> objects = AbilityFactory.predictThreatenedObjects(sa.getActivatingPlayer(), af);
@@ -346,7 +346,7 @@ public class AbilityFactoryRegenerate {
chance = true;
}
} else {
if (Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
if (Singletons.getModel().getGame().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
final List<Card> combatants = CardLists.filter(targetables, CardPredicates.Presets.CREATURES);
CardLists.sortByEvaluateCreature(combatants);
@@ -423,7 +423,7 @@ public class AbilityFactoryRegenerate {
final Target tgt = sa.getTarget();
tgt.resetTargets();
// filter AIs battlefield by what I can target
List<Card> targetables = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
List<Card> targetables = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
targetables = CardLists.getValidCards(targetables, tgt.getValidTgts(), ai, hostCard);
targetables = CardLists.getTargetableCards(targetables, sa);
final List<Card> compTargetables = CardLists.filterControlledBy(targetables, ai);
@@ -439,7 +439,7 @@ public class AbilityFactoryRegenerate {
if (compTargetables.size() > 0) {
final List<Card> combatants = CardLists.filter(compTargetables, CardPredicates.Presets.CREATURES);
CardLists.sortByEvaluateCreature(combatants);
if (Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
if (Singletons.getModel().getGame().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
for (final Card c : combatants) {
if ((c.getShield() == 0) && CombatUtil.combatantWouldBeDestroyed(c)) {
tgt.addTarget(c);
@@ -512,7 +512,7 @@ public class AbilityFactoryRegenerate {
if (tgtC.isInPlay() && ((tgt == null) || tgtC.canBeTargetedBy(sa))) {
tgtC.addShield();
Singletons.getModel().getGameState().getEndOfTurn().addUntil(untilEOT);
Singletons.getModel().getGame().getEndOfTurn().addUntil(untilEOT);
}
}
} // regenerateResolve
@@ -738,7 +738,7 @@ public class AbilityFactoryRegenerate {
valid = params.get("ValidCards");
}
List<Card> list = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
List<Card> list = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
list = CardLists.getValidCards(list, valid.split(","), hostCard.getController(), hostCard);
list = CardLists.filter(list, CardPredicates.isController(ai));
@@ -747,7 +747,7 @@ public class AbilityFactoryRegenerate {
}
int numSaved = 0;
if (Singletons.getModel().getGameState().getStack().size() > 0) {
if (Singletons.getModel().getGame().getStack().size() > 0) {
final ArrayList<Object> objects = AbilityFactory.predictThreatenedObjects(sa.getActivatingPlayer(),af);
for (final Card c : list) {
@@ -756,7 +756,7 @@ public class AbilityFactoryRegenerate {
}
}
} else {
if (Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
if (Singletons.getModel().getGame().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS_INSTANT_ABILITY)) {
final List<Card> combatants = CardLists.filter(list, CardPredicates.Presets.CREATURES);
for (final Card c : combatants) {
@@ -827,7 +827,7 @@ public class AbilityFactoryRegenerate {
valid = params.get("ValidCards");
}
List<Card> list = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
List<Card> list = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
list = CardLists.getValidCards(list, valid.split(","), hostCard.getController(), hostCard);
for (final Card c : list) {
@@ -842,7 +842,7 @@ public class AbilityFactoryRegenerate {
if (c.isInPlay()) {
c.addShield();
Singletons.getModel().getGameState().getEndOfTurn().addUntil(untilEOT);
Singletons.getModel().getGame().getEndOfTurn().addUntil(untilEOT);
}
}
} // regenerateAllResolve

View File

@@ -279,7 +279,7 @@ public final class AbilityFactoryRepeat {
if (params.containsKey("RepeatDefined")) {
list.addAll(AbilityFactory.getDefinedCards(sa.getSourceCard(), params.get("RepeatDefined"), sa));
} else {
list = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
list = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
}
list = CardLists.getValidCards(list, repeatPresent.split(","), sa.getActivatingPlayer(), sa.getSourceCard());

View File

@@ -306,7 +306,7 @@ public final class AbilityFactoryReveal {
}
// Don't use draw abilities before main 2 if possible
if (Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2) && !params.containsKey("ActivationPhases")
if (Singletons.getModel().getGame().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2) && !params.containsKey("ActivationPhases")
&& !params.containsKey("DestinationZone")) {
return false;
}
@@ -583,9 +583,9 @@ public final class AbilityFactoryReveal {
}
final PlayerZone zone = c.getOwner().getZone(destZone1);
if (zone.is(ZoneType.Library)) {
Singletons.getModel().getGameAction().moveToLibrary(c, libraryPosition);
Singletons.getModel().getGame().getAction().moveToLibrary(c, libraryPosition);
} else {
c = Singletons.getModel().getGameAction().moveTo(zone, c);
c = Singletons.getModel().getGame().getAction().moveTo(zone, c);
if (destZone1.equals(ZoneType.Battlefield)) {
for (final String kw : keywords) {
c.addExtrinsicKeyword(kw);
@@ -628,12 +628,12 @@ public final class AbilityFactoryReveal {
} else {
chosen = rest.get(0);
}
Singletons.getModel().getGameAction().moveToLibrary(chosen, libraryPosition2);
Singletons.getModel().getGame().getAction().moveToLibrary(chosen, libraryPosition2);
rest.remove(chosen);
}
} else { // Computer
for (int i = 0; i < rest.size(); i++) {
Singletons.getModel().getGameAction().moveToLibrary(rest.get(i), libraryPosition2);
Singletons.getModel().getGame().getAction().moveToLibrary(rest.get(i), libraryPosition2);
}
}
} else {
@@ -641,7 +641,7 @@ public final class AbilityFactoryReveal {
for (int i = 0; i < rest.size(); i++) {
Card c = rest.get(i);
final PlayerZone toZone = c.getOwner().getZone(destZone2);
c = Singletons.getModel().getGameAction().moveTo(toZone, c);
c = Singletons.getModel().getGame().getAction().moveTo(toZone, c);
if (destZone2.equals(ZoneType.Battlefield) && !keywords.isEmpty()) {
for (final String kw : keywords) {
c.addExtrinsicKeyword(kw);
@@ -668,7 +668,7 @@ public final class AbilityFactoryReveal {
*/
private static List<Card> sharesNameWithCardOnBattlefield(final List<Card> list) {
final List<Card> toReturn = new ArrayList<Card>();
final List<Card> play = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
final List<Card> play = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
for (final Card c : list) {
for (final Card p : play) {
if (p.getName().equals(c.getName()) && !toReturn.contains(c)) {
@@ -1056,9 +1056,9 @@ public final class AbilityFactoryReveal {
final Card c = itr.next();
if (params.containsKey("GainControl") && foundDest.equals(ZoneType.Battlefield)) {
c.addController(af.getHostCard());
Singletons.getModel().getGameAction().moveTo(c.getController().getZone(foundDest), c);
Singletons.getModel().getGame().getAction().moveTo(c.getController().getZone(foundDest), c);
} else {
Singletons.getModel().getGameAction().moveTo(foundDest, c, foundLibPos);
Singletons.getModel().getGame().getAction().moveTo(foundDest, c, foundLibPos);
}
revealed.remove(c);
}
@@ -1073,7 +1073,7 @@ public final class AbilityFactoryReveal {
final Iterator<Card> itr = revealed.iterator();
while (itr.hasNext()) {
final Card c = itr.next();
Singletons.getModel().getGameAction().moveTo(revealedDest, c, revealedLibPos);
Singletons.getModel().getGame().getAction().moveTo(revealedDest, c, revealedLibPos);
}
if (params.containsKey("Shuffle")) {
@@ -2055,7 +2055,7 @@ public final class AbilityFactoryReveal {
List<Card> orderedCards = GuiChoose.getOrderChoices("Select order to Rearrange", "Top of Library", 0, topCards, null, src);
for (int i = maxCards - 1; i >= 0; i--) {
Card next = (Card) orderedCards.get(i);
Singletons.getModel().getGameAction().moveToLibrary(next, 0);
Singletons.getModel().getGame().getAction().moveToLibrary(next, 0);
}
if (mayshuffle) {
if (GameActionUtil.showYesNoDialog(src, "Do you want to shuffle the library?")) {

View File

@@ -494,8 +494,8 @@ public class AbilityFactorySacrifice {
final boolean remSacrificed = params.containsKey("RememberSacrificed");
if (valid.equals("Self")) {
if (Singletons.getModel().getGameState().getZoneOf(card).is(ZoneType.Battlefield)) {
if (Singletons.getModel().getGameAction().sacrifice(card, sa) && remSacrificed) {
if (Singletons.getModel().getGame().getZoneOf(card).is(ZoneType.Battlefield)) {
if (Singletons.getModel().getGame().getAction().sacrifice(card, sa) && remSacrificed) {
card.addRemembered(card);
}
}
@@ -583,11 +583,11 @@ public class AbilityFactorySacrifice {
final Card c = (Card) o;
if (destroy) {
if (Singletons.getModel().getGameAction().destroy(c)) {
if (Singletons.getModel().getGame().getAction().destroy(c)) {
sacList.add(c);
}
} else {
if (Singletons.getModel().getGameAction().sacrifice(c, sa)) {
if (Singletons.getModel().getGame().getAction().sacrifice(c, sa)) {
sacList.add(c);
}
}
@@ -624,11 +624,11 @@ public class AbilityFactorySacrifice {
if (list.size() != 0) {
final Card sac = CardUtil.getRandom(list);
if (destroy) {
if (Singletons.getModel().getGameAction().destroy(sac)) {
if (Singletons.getModel().getGame().getAction().destroy(sac)) {
sacList.add(sac);
}
} else {
if (Singletons.getModel().getGameAction().sacrifice(sac, sa)) {
if (Singletons.getModel().getGame().getAction().sacrifice(sac, sa)) {
sacList.add(sac);
}
}
@@ -933,7 +933,7 @@ public class AbilityFactorySacrifice {
if (params.containsKey("Defined")) {
list = new ArrayList<Card>(AbilityFactory.getDefinedCards(af.getHostCard(), params.get("Defined"), sa));
} else {
list = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
list = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
}
final boolean remSacrificed = params.containsKey("RememberSacrificed");
@@ -944,7 +944,7 @@ public class AbilityFactorySacrifice {
list = AbilityFactory.filterListByType(list, valid, sa);
for (int i = 0; i < list.size(); i++) {
if (Singletons.getModel().getGameAction().sacrifice(list.get(i), sa) && remSacrificed) {
if (Singletons.getModel().getGame().getAction().sacrifice(list.get(i), sa) && remSacrificed) {
card.addRemembered(list.get(i));
}
}

View File

@@ -471,7 +471,7 @@ public class AbilityFactorySetState {
valid = valid.replace("X", Integer.toString(AbilityFactory.calculateAmount(card, "X", sa)));
}
List<Card> list = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
List<Card> list = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
if (targetPlayer != null) {
list = CardLists.filterControlledBy(list, targetPlayer);

View File

@@ -247,7 +247,7 @@ public class AbilityFactoryStoreSVar {
final Player ai = sa.getActivatingPlayer();
final Card source = sa.getSourceCard();
if (AbilityFactory.waitForBlocking(sa) || ai.getLife() + 1 >= source.getNetDefense()
|| (ai.getLife() > 5 && !CombatUtil.lifeInSeriousDanger(ai, Singletons.getModel().getGameState().getCombat()))) {
|| (ai.getLife() > 5 && !CombatUtil.lifeInSeriousDanger(ai, Singletons.getModel().getGame().getCombat()))) {
return false;
}
final AbilitySub subAb = sa.getSubAbility();

View File

@@ -317,7 +317,7 @@ public class AbilityFactoryToken extends AbilityFactory {
}
}
PhaseHandler ph = Singletons.getModel().getGameState().getPhaseHandler();
PhaseHandler ph = Singletons.getModel().getGame().getPhaseHandler();
// Don't generate tokens without haste before main 2 if possible
if (ph.getPhase().isBefore(PhaseType.MAIN2)
&& ph.isPlayerTurn(ai) && !haste
@@ -331,7 +331,7 @@ public class AbilityFactoryToken extends AbilityFactory {
&& !AbilityFactory.isSorcerySpeed(sa) && !haste) {
return false;
}
if ((ph.getPhase().isAfter(PhaseType.COMBAT_BEGIN) || Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(
if ((ph.getPhase().isAfter(PhaseType.COMBAT_BEGIN) || Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(
opp))
&& oneShot) {
return false;
@@ -386,7 +386,7 @@ public class AbilityFactoryToken extends AbilityFactory {
return chance;
}
if (Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY)) {
if (Singletons.getModel().getGame().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY)) {
return ((r.nextFloat() < .95) && chance);
}
if (sa.isAbility()) {
@@ -636,13 +636,13 @@ public class AbilityFactoryToken extends AbilityFactory {
c.setTapped(true);
}
if (this.tokenAttacking) {
Singletons.getModel().getGameState().getCombat().addAttacker(c);
Singletons.getModel().getGame().getCombat().addAttacker(c);
}
if (remember != null) {
Singletons.getModel().getGameState().getCardState(sa.getSourceCard()).addRemembered(c);
Singletons.getModel().getGame().getCardState(sa.getSourceCard()).addRemembered(c);
}
if (this.abilityFactory.getMapParams().get("RememberSource") != null) {
Singletons.getModel().getGameState().getCardState(c).addRemembered(host);
Singletons.getModel().getGame().getCardState(c).addRemembered(host);
}
}
}

View File

@@ -347,7 +347,7 @@ public class AbilityFactoryTurns {
for (final Player p : tgtPlayers) {
if ((tgt == null) || p.canBeTargetedBy(sa)) {
for (int i = 0; i < numTurns; i++) {
ExtraTurn extra = Singletons.getModel().getGameState().getPhaseHandler().addExtraTurn(p);
ExtraTurn extra = Singletons.getModel().getGame().getPhaseHandler().addExtraTurn(p);
if (params.containsKey("LoseAtEndStep")) {
extra.setLoseAtEndStep(true);
}
@@ -502,25 +502,25 @@ public class AbilityFactoryTurns {
// 1) All spells and abilities on the stack are exiled. This includes
// Time Stop, though it will continue to resolve. It also includes
// spells and abilities that can't be countered.
for (final Card c : Singletons.getModel().getGameState().getStackZone().getCards()) {
Singletons.getModel().getGameAction().exile(c);
for (final Card c : Singletons.getModel().getGame().getStackZone().getCards()) {
Singletons.getModel().getGame().getAction().exile(c);
}
Singletons.getModel().getGameState().getStack().getStack().clear();
Singletons.getModel().getGame().getStack().getStack().clear();
// 2) All attacking and blocking creatures are removed from combat.
Singletons.getModel().getGameState().getCombat().reset();
Singletons.getModel().getGame().getCombat().reset();
// 3) State-based actions are checked. No player gets priority, and no
// triggered abilities are put onto the stack.
Singletons.getModel().getGameAction().checkStateEffects();
Singletons.getModel().getGame().getAction().checkStateEffects();
// 4) The current phase and/or step ends. The game skips straight to the
// cleanup step. The cleanup step happens in its entirety.
Singletons.getModel().getGameState().getPhaseHandler().setPhaseState(PhaseType.CLEANUP);
Singletons.getModel().getGame().getPhaseHandler().setPhaseState(PhaseType.CLEANUP);
// Update observers
Singletons.getModel().getGameState().getStack().updateObservers();
for (Player p : Singletons.getModel().getGameState().getPlayers()) {
Singletons.getModel().getGame().getStack().updateObservers();
for (Player p : Singletons.getModel().getGame().getPlayers()) {
p.updateObservers();
p.updateLabelObservers();
}

View File

@@ -345,7 +345,7 @@ public class AbilityFactoryZoneAffecting {
}
// Don't use draw abilities before main 2 if possible
if (Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2)
if (Singletons.getModel().getGame().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2)
&& !params.containsKey("ActivationPhases")) {
return false;
}
@@ -362,8 +362,8 @@ public class AbilityFactoryZoneAffecting {
if (AbilityFactory.isSorcerySpeed(sa)) {
randomReturn = true;
}
if ((Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.END_OF_TURN)
&& Singletons.getModel().getGameState().getPhaseHandler().isNextTurn(PlayerType.COMPUTER))) {
if ((Singletons.getModel().getGame().getPhaseHandler().is(PhaseType.END_OF_TURN)
&& Singletons.getModel().getGame().getPhaseHandler().isNextTurn(PlayerType.COMPUTER))) {
randomReturn = true;
}
@@ -466,7 +466,7 @@ public class AbilityFactoryZoneAffecting {
}
if (((computerHandSize + numCards) > computerMaxHandSize)
&& Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn().isComputer()) {
&& Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn().isComputer()) {
if (xPaid) {
numCards = computerMaxHandSize - computerHandSize;
source.setSVar("PayX", Integer.toString(numCards));
@@ -506,7 +506,7 @@ public class AbilityFactoryZoneAffecting {
}
if (((computerHandSize + numCards) > computerMaxHandSize)
&& Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn().isComputer()
&& Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn().isComputer()
&& !sa.isTrigger()) {
// Don't draw too many cards and then risk discarding cards at
// EOT
@@ -901,7 +901,7 @@ public class AbilityFactoryZoneAffecting {
final Random r = MyRandom.getRandom();
// Don't use draw abilities before main 2 if possible
if (Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2) && !params.containsKey("ActivationPhases")) {
if (Singletons.getModel().getGame().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2) && !params.containsKey("ActivationPhases")) {
return false;
}
@@ -916,8 +916,8 @@ public class AbilityFactoryZoneAffecting {
chance = .667; // 66.7% chance for sorcery speed
}
if ((Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.END_OF_TURN)
&& Singletons.getModel().getGameState().getPhaseHandler().isNextTurn(PlayerType.COMPUTER))) {
if ((Singletons.getModel().getGame().getPhaseHandler().is(PhaseType.END_OF_TURN)
&& Singletons.getModel().getGame().getPhaseHandler().isNextTurn(PlayerType.COMPUTER))) {
chance = .9; // 90% for end of opponents turn
}
@@ -1682,7 +1682,7 @@ public class AbilityFactoryZoneAffecting {
}
// Don't use draw abilities before main 2 if possible
if (Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2)
if (Singletons.getModel().getGame().getPhaseHandler().getPhase().isBefore(PhaseType.MAIN2)
&& !params.containsKey("ActivationPhases")) {
return false;
}

View File

@@ -205,7 +205,7 @@ public class CardFactory implements CardFactoryInterface {
}
if (controller.isHuman()) {
Singletons.getModel().getGameAction().playSpellAbilityForFree(copySA);
Singletons.getModel().getGame().getAction().playSpellAbilityForFree(copySA);
} else if (copySA instanceof Spell) {
Spell spell = (Spell) copySA;
if (spell.canPlayFromEffectAI(false, true)) {

View File

@@ -133,7 +133,7 @@ class CardFactoryArtifacts {
sb.append("choose white Citizen, blue Camarid, black Thrull, red Goblin, or green Saproling.");
ability.setStackDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
}
};
@@ -206,7 +206,7 @@ class CardFactoryArtifacts {
} // while
GuiChoose.oneOrNone("Revealed cards:", revealed);
for (final Card revealedCard : revealed) {
Singletons.getModel().getGameAction().moveToBottomOfLibrary(revealedCard);
Singletons.getModel().getGame().getAction().moveToBottomOfLibrary(revealedCard);
}
if (this.getTargetCard() != null) {
@@ -397,7 +397,7 @@ class CardFactoryArtifacts {
public void done() {
// exile those cards
for (final Card c : this.exiled) {
Singletons.getModel().getGameAction().exile(c);
Singletons.getModel().getGame().getAction().exile(c);
}
// Put that many cards from the top of your
@@ -406,7 +406,7 @@ class CardFactoryArtifacts {
final PlayerZone lib = card.getController().getZone(ZoneType.Library);
int numCards = 0;
while ((lib.size() > 0) && (numCards < this.exiled.size())) {
Singletons.getModel().getGameAction().moveToHand(lib.get(0));
Singletons.getModel().getGame().getAction().moveToHand(lib.get(0));
numCards++;
}
@@ -418,7 +418,7 @@ class CardFactoryArtifacts {
// top of your library in any order.
while (this.exiled.size() > 0) {
final Card c1 = GuiChoose.one("Put a card on top of your library.", this.exiled);
Singletons.getModel().getGameAction().moveToLibrary(c1);
Singletons.getModel().getGame().getAction().moveToLibrary(c1);
this.exiled.remove(c1);
}
@@ -481,7 +481,7 @@ class CardFactoryArtifacts {
JOptionPane.INFORMATION_MESSAGE);
}
} else {
Singletons.getModel().getGameAction().playCardWithoutManaCost(freeCard);
Singletons.getModel().getGame().getAction().playCardWithoutManaCost(freeCard);
}
} else {
final StringBuilder sb = new StringBuilder();
@@ -533,7 +533,7 @@ class CardFactoryArtifacts {
card.addSpellAbility(freeCast);
card.addExtrinsicKeyword("Play with the top card of your library revealed.");
Singletons.getModel().getGameState().getEndOfTurn().addUntil(new Command() {
Singletons.getModel().getGame().getEndOfTurn().addUntil(new Command() {
private static final long serialVersionUID = -2860753262177388046L;
@Override

View File

@@ -41,6 +41,7 @@ import forge.card.spellability.Target;
import forge.control.input.Input;
import forge.game.player.Player;
import forge.game.zone.PlayerZone;
import forge.game.zone.Zone;
import forge.game.zone.ZoneType;
import forge.gui.GuiChoose;
@@ -130,7 +131,7 @@ class CardFactoryAuras {
if (card.getController().isHuman()) {
newType[0] = GuiChoose.one("Select land type.", CardUtil.getLandTypes());
}
Singletons.getModel().getGameAction().moveToPlay(card);
Singletons.getModel().getGame().getAction().moveToPlay(card);
final Card c = this.getTargetCard();
@@ -248,7 +249,7 @@ class CardFactoryAuras {
@Override
public void showMessage() {
final List<Card> land = Singletons.getModel().getGameState().getLandsInPlay();
final List<Card> land = Singletons.getModel().getGame().getLandsInPlay();
this.stopSetNext(CardFactoryUtil
.inputTargetSpecific(spell, land, "Select target land", true, false));
}
@@ -294,7 +295,7 @@ class CardFactoryAuras {
@Override
public void resolve() {
Singletons.getModel().getGameAction().moveToPlay(card);
Singletons.getModel().getGame().getAction().moveToPlay(card);
final Card c = this.getTargetCard();
@@ -401,7 +402,7 @@ class CardFactoryAuras {
@Override
public void resolve() {
final Card aura = Singletons.getModel().getGameAction().moveToPlay(card);
final Card aura = Singletons.getModel().getGame().getAction().moveToPlay(card);
final Card c = this.getTargetCard();
@@ -425,7 +426,7 @@ class CardFactoryAuras {
// This includes creatures Animate Dead can't enchant once
// in play.
// The human may try to Animate them, the AI will not.
return CardLists.filter(Singletons.getModel().getGameState().getCardsIn(ZoneType.Graveyard), Presets.CREATURES);
return CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Graveyard), Presets.CREATURES);
}
@Override
@@ -479,18 +480,18 @@ class CardFactoryAuras {
}
final Card animated = targetC[0];
final PlayerZone grave = Singletons.getModel().getGameState().getZoneOf(animated);
final Zone grave = Singletons.getModel().getGame().getZoneOf(animated);
if (!grave.is(ZoneType.Graveyard)) {
// Animated Creature got removed before ability resolved
Singletons.getModel().getGameAction().sacrifice(card, null);
Singletons.getModel().getGame().getAction().sacrifice(card, null);
return;
}
// Bring creature onto the battlefield under your control
// (should trigger etb Abilities)
animated.addController(card.getController());
Singletons.getModel().getGameAction().moveToPlay(animated, card.getController());
Singletons.getModel().getGame().getAction().moveToPlay(animated, card.getController());
if (cardName.equals("Dance of the Dead")) {
animated.tap();
}
@@ -499,7 +500,7 @@ class CardFactoryAuras {
if (CardFactoryUtil.hasProtectionFrom(card, animated)) {
// Animated a creature with protection
Singletons.getModel().getGameAction().sacrifice(card, null);
Singletons.getModel().getGame().getAction().sacrifice(card, null);
return;
}
@@ -523,7 +524,7 @@ class CardFactoryAuras {
// note: this should be a state-based action, but it doesn't work currently.
// I don't know if that because it's hard-coded or what, but this fixes
// these cards being put on the battlefield not attached to anything.
Singletons.getModel().getGameAction().moveToGraveyard(card);
Singletons.getModel().getGame().getAction().moveToGraveyard(card);
}
}
};
@@ -537,7 +538,7 @@ class CardFactoryAuras {
final PlayerZone play = card.getController().getZone(ZoneType.Battlefield);
if (play.contains(c)) {
Singletons.getModel().getGameAction().sacrifice(c, null);
Singletons.getModel().getGame().getAction().sacrifice(c, null);
}
}
}; // Detach
@@ -552,7 +553,7 @@ class CardFactoryAuras {
final PlayerZone play = card.getController().getZone(ZoneType.Battlefield);
if (play.contains(c)) {
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(detach);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(detach);
}
}

View File

@@ -197,7 +197,7 @@ public class CardFactoryCreatures {
@Override
public boolean canPlayAI() {
return Iterables.any(getActivatingPlayer().getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.ARTIFACTS)
&& Singletons.getModel().getGameState().getZoneOf(this.getSourceCard()).is(ZoneType.Hand);
&& Singletons.getModel().getGame().getZoneOf(this.getSourceCard()).is(ZoneType.Hand);
}
});
card.addComesIntoPlayCommand(intoPlay);
@@ -242,7 +242,7 @@ public class CardFactoryCreatures {
card.setChosenColor(colors);
final String s = CardUtil.getShortColor(color[0]);
timeStamp[0] = Singletons.getModel().getGameState().getColorChanger().addColorChanges(s, card, true, true);
timeStamp[0] = Singletons.getModel().getGame().getColorChanger().addColorChanges(s, card, true, true);
}
}; // Command
@@ -252,7 +252,7 @@ public class CardFactoryCreatures {
@Override
public void execute() {
final String s = CardUtil.getShortColor(color[0]);
Singletons.getModel().getGameState().getColorChanger().removeColorChanges(s, card, true, timeStamp[0]);
Singletons.getModel().getGame().getColorChanger().removeColorChanges(s, card, true, timeStamp[0]);
}
};
@@ -275,7 +275,7 @@ public class CardFactoryCreatures {
@Override
public void execute() {
if (card.isInPlay()) {
Singletons.getModel().getGameAction().sacrifice(card, null);
Singletons.getModel().getGame().getAction().sacrifice(card, null);
}
}
});
@@ -292,7 +292,7 @@ public class CardFactoryCreatures {
@Override
public void execute() {
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
}
});
@@ -302,10 +302,10 @@ public class CardFactoryCreatures {
@Override
public void execute() {
final List<Card> list = CardLists.filter(Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Stangg Twin"));
final List<Card> list = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Stangg Twin"));
if (list.size() == 1) {
Singletons.getModel().getGameAction().exile(list.get(0));
Singletons.getModel().getGame().getAction().exile(list.get(0));
}
}
});
@@ -468,7 +468,7 @@ public class CardFactoryCreatures {
@Override
public void execute() {
getTargetCard().addDamage(1, target);
Singletons.getModel().getGameAction().checkStateEffects();
Singletons.getModel().getGame().getAction().checkStateEffects();
}
}));
}
@@ -562,7 +562,7 @@ public class CardFactoryCreatures {
@Override
public void resolve() {
int xCounters = card.getXManaCostPaid();
final Card c = Singletons.getModel().getGameAction().moveToPlay(this.getSourceCard());
final Card c = Singletons.getModel().getGame().getAction().moveToPlay(this.getSourceCard());
if (xCounters >= 5) {
xCounters = 2 * xCounters;
@@ -609,7 +609,7 @@ public class CardFactoryCreatures {
sb.append("Kinsbaile Borderguard enters the battlefield with a ");
sb.append("+1/+1 counter on it for each other Kithkin you control.");
ability.setStackDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
}
};
@@ -638,7 +638,7 @@ public class CardFactoryCreatures {
sb.append("from play, put a 1/1 white Kithkin Soldier creature ");
sb.append("token onto the battlefield for each counter on it.");
ability2.setStackDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability2);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability2);
}
};
@@ -666,7 +666,7 @@ public class CardFactoryCreatures {
@Override
public void execute() {
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
}
};
@@ -773,7 +773,7 @@ public class CardFactoryCreatures {
for (int m = 0; m < selection.size(); m++) {
intermSumPower += selection.get(m).getBaseAttack();
intermSumToughness += selection.get(m).getBaseDefense();
Singletons.getModel().getGameAction().exile(selection.get(m));
Singletons.getModel().getGame().getAction().exile(selection.get(m));
}
}
@@ -785,7 +785,7 @@ public class CardFactoryCreatures {
if ((c.getNetAttack() <= 2) && (c.getNetDefense() <= 3)) {
intermSumPower += c.getBaseAttack();
intermSumToughness += c.getBaseDefense();
Singletons.getModel().getGameAction().exile(c);
Singletons.getModel().getGame().getAction().exile(c);
count++;
}
// is this needed?
@@ -867,7 +867,7 @@ public class CardFactoryCreatures {
@Override
public void execute() {
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
}
};
@@ -929,7 +929,7 @@ public class CardFactoryCreatures {
//adding ability to stack first cause infinite loop (with observers notification)
//so it has to be stop first and add ability later
this.stop();
Singletons.getModel().getGameState().getStack().add(ability);
Singletons.getModel().getGame().getStack().add(ability);
}
@Override
@@ -983,7 +983,7 @@ public class CardFactoryCreatures {
if ( !list.isEmpty() )
{
ability.setTargetCard(CardFactoryUtil.getBestCreatureAI(list));
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
}
}
} // execute()
@@ -1020,7 +1020,7 @@ public class CardFactoryCreatures {
@Override
public void selectButtonCancel() {
toSac.clear();
Singletons.getModel().getGameAction().sacrifice(card, null);
Singletons.getModel().getGame().getAction().sacrifice(card, null);
this.stop();
}
@@ -1035,10 +1035,10 @@ public class CardFactoryCreatures {
private void done() {
if (getTotalPower() >= 12) {
for (final Card sac : toSac) {
Singletons.getModel().getGameAction().sacrifice(sac, null);
Singletons.getModel().getGame().getAction().sacrifice(sac, null);
}
} else {
Singletons.getModel().getGameAction().sacrifice(card, null);
Singletons.getModel().getGame().getAction().sacrifice(card, null);
}
toSac.clear();
this.stop();

View File

@@ -72,7 +72,7 @@ class CardFactoryEnchantments {
@Override
public boolean canPlay() {
boolean haveGraveWithSomeCreatures = false;
for( Player p : Singletons.getModel().getGameState().getPlayers()) {
for( Player p : Singletons.getModel().getGame().getPlayers()) {
Iterable<Card> grave = CardLists.filter(p.getCardsIn(ZoneType.Graveyard), CardPredicates.Presets.CREATURES);
if( Iterables.size(grave) > 1)
{
@@ -119,11 +119,11 @@ class CardFactoryEnchantments {
if (o2 != null) {
final Card c2 = (Card) o2;
newGrave.remove(c2);
Singletons.getModel().getGameAction().exile(c);
Singletons.getModel().getGameAction().exile(c2);
Singletons.getModel().getGame().getAction().exile(c);
Singletons.getModel().getGame().getAction().exile(c2);
this.once = true;
Singletons.getModel().getGameState().getStack().addAndUnfreeze(nightSoil);
Singletons.getModel().getGame().getStack().addAndUnfreeze(nightSoil);
}
}
@@ -191,7 +191,7 @@ class CardFactoryEnchantments {
sb.append(" loses life equal to his or her life total.");
loseAllLife.setStackDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(loseAllLife);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(loseAllLife);
}
};
@@ -214,7 +214,7 @@ class CardFactoryEnchantments {
sb.append("loses the game.");
loseGame.setStackDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(loseGame);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(loseGame);
}
};
@@ -264,7 +264,7 @@ class CardFactoryEnchantments {
player.payLife(4, card);
// card stays in hand
} else {
Singletons.getModel().getGameAction().moveToLibrary(card);
Singletons.getModel().getGame().getAction().moveToLibrary(card);
}
this.stop();
}

View File

@@ -90,14 +90,14 @@ public class CardFactoryInstants {
@Override
public void resolve() {
Player player = getTargetPlayer();
List<Card> artifacts = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
List<Card> artifacts = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
artifacts = CardLists.filter(artifacts, CardPredicates.Presets.ARTIFACTS);
for (int i = 0; i < artifacts.size(); i++) {
Card thisArtifact = artifacts.get(i);
if (thisArtifact.getOwner().equals(player)) {
//moveToHand handles tokens
Singletons.getModel().getGameAction().moveToHand(thisArtifact);
Singletons.getModel().getGame().getAction().moveToHand(thisArtifact);
}
}
} //resolve()
@@ -156,10 +156,10 @@ public class CardFactoryInstants {
final Card choice = selectedCards.get(MyRandom.getRandom().nextInt(2));
selectedCards.remove(choice);
Singletons.getModel().getGameAction().moveToHand(choice);
Singletons.getModel().getGame().getAction().moveToHand(choice);
for (final Card trash : selectedCards) {
Singletons.getModel().getGameAction().moveToGraveyard(trash);
Singletons.getModel().getGame().getAction().moveToGraveyard(trash);
}
}
@@ -194,10 +194,10 @@ public class CardFactoryInstants {
final Card choice = GuiChoose.one("Select card to give to computer", selectedCards);
selectedCards.remove(choice);
Singletons.getModel().getGameAction().moveToHand(choice);
Singletons.getModel().getGame().getAction().moveToHand(choice);
for (final Card trash : selectedCards) {
Singletons.getModel().getGameAction().moveToGraveyard(trash);
Singletons.getModel().getGame().getAction().moveToGraveyard(trash);
}
}
@@ -242,13 +242,13 @@ public class CardFactoryInstants {
final Card c1 = (Card) o;
graveList.remove(c1); // remove from the display
// list
Singletons.getModel().getGameAction().exile(c1);
Singletons.getModel().getGame().getAction().exile(c1);
}
} else { // Computer
// Random random = MyRandom.random;
for (int j = 0; j < x; j++) {
// int index = random.nextInt(X-j);
Singletons.getModel().getGameAction().exile(graveList.get(j));
Singletons.getModel().getGame().getAction().exile(graveList.get(j));
}
}
@@ -288,7 +288,7 @@ public class CardFactoryInstants {
@Override
public boolean canPlay() {
return PhaseUtil.isBeforeAttackersAreDeclared()
&& Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(card.getController().getOpponent());
&& Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(card.getController().getOpponent());
} // canPlay
@Override
@@ -329,7 +329,7 @@ public class CardFactoryInstants {
if (creature.isInPlay()) {
// System.out.println("Siren's Call - destroying "+creature.getName());
// this should probably go on the stack
Singletons.getModel().getGameAction().destroy(creature);
Singletons.getModel().getGame().getAction().destroy(creature);
}
}
creature.setSirenAttackOrDestroy(false);
@@ -349,10 +349,10 @@ public class CardFactoryInstants {
destroy.setDescription(sb.toString());
destroy.setStackDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(destroy);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(destroy);
} // execute
}; // Command
Singletons.getModel().getGameState().getEndOfTurn().addAt(atEOT);
Singletons.getModel().getGame().getEndOfTurn().addAt(atEOT);
} // resolve
}; // SpellAbility
@@ -387,11 +387,11 @@ public class CardFactoryInstants {
final Object o = GuiChoose.one(this.prompt[i], choices);
final Card c1 = (Card) o;
if (i == 0) {
Singletons.getModel().getGameAction().moveToHand(c1);
Singletons.getModel().getGame().getAction().moveToHand(c1);
} else if (i == 1) {
Singletons.getModel().getGameAction().moveToLibrary(c1);
Singletons.getModel().getGame().getAction().moveToLibrary(c1);
} else if (i == 2) {
Singletons.getModel().getGameAction().moveToBottomOfLibrary(c1);
Singletons.getModel().getGame().getAction().moveToBottomOfLibrary(c1);
}
choices.remove(c1);
@@ -415,7 +415,7 @@ public class CardFactoryInstants {
@Override
public void resolve() {
final Player you = card.getController();
final List<Card> ens = CardLists.filter(Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield), Presets.ENCHANTMENTS);
final List<Card> ens = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), Presets.ENCHANTMENTS);
final List<Card> toReturn = CardLists.filter(ens, new Predicate<Card>() {
@Override
public boolean apply(final Card c) {
@@ -432,12 +432,12 @@ public class CardFactoryInstants {
}
});
for (final Card c : toReturn) {
Singletons.getModel().getGameAction().moveToHand(c);
Singletons.getModel().getGame().getAction().moveToHand(c);
}
for (final Card c : ens) {
if (!toReturn.contains(c)) {
Singletons.getModel().getGameAction().destroy(c);
Singletons.getModel().getGame().getAction().destroy(c);
}
}
}

View File

@@ -144,7 +144,7 @@ class CardFactoryLands {
@Override
public boolean apply(final Card c) {
return c.isInPlay() && c.isCreature()
&& (c.getTurnInZone() == Singletons.getModel().getGameState().getPhaseHandler().getTurn());
&& (c.getTurnInZone() == Singletons.getModel().getGame().getPhaseHandler().getTurn());
}
};
@@ -167,8 +167,8 @@ class CardFactoryLands {
@Override
public boolean canPlayAI() {
if (Singletons.getModel().getGameState().getPhaseHandler().getPhase() != PhaseType.MAIN1
&& Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn().isComputer()) {
if (Singletons.getModel().getGame().getPhaseHandler().getPhase() != PhaseType.MAIN1
&& Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn().isComputer()) {
return false;
}
this.inPlay.clear();
@@ -179,7 +179,7 @@ class CardFactoryLands {
@Override
public void resolve() {
this.inPlay.clear();
this.inPlay.addAll(Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield));
this.inPlay.addAll(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield));
for (final Card targ : CardLists.filter(this.inPlay, targets)) {
targ.addCounter(Counters.P1P1, 1);
}
@@ -222,7 +222,7 @@ class CardFactoryLands {
if (land.size() > 0) {
for (final Card c : land) {
Singletons.getModel().getGameAction().sacrifice(c, null);
Singletons.getModel().getGame().getAction().sacrifice(c, null);
}
}
}

View File

@@ -95,7 +95,7 @@ public class CardFactorySorceries {
}
for (int i = 0; i < count; i++) {
exiled.add(lib.get(i));
Singletons.getModel().getGameAction().exile(lib.get(i));
Singletons.getModel().getGame().getAction().exile(lib.get(i));
}
final List<Card> pile1 = new ArrayList<Card>();
final List<Card> pile2 = new ArrayList<Card>();
@@ -233,7 +233,7 @@ public class CardFactorySorceries {
JOptionPane.INFORMATION_MESSAGE);
}
} else {
Singletons.getModel().getGameAction().playCardWithoutManaCost(playing);
Singletons.getModel().getGame().getAction().playCardWithoutManaCost(playing);
}
chosen.remove(playing);
}
@@ -268,7 +268,7 @@ public class CardFactorySorceries {
@Override
public void resolve() {
List<Card> tokens = CardLists.filter(Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield), Presets.CREATURES);
List<Card> tokens = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), Presets.CREATURES);
tokens = CardLists.filter(tokens, Presets.TOKEN);
CardFactoryUtil.copyTokens(tokens);
@@ -352,7 +352,7 @@ public class CardFactorySorceries {
// selected are sacrificed.
for (int i = 0; i < target.size(); i++) {
if (target.get(i).isInPlay() && !saveList.contains(target.get(i))) {
Singletons.getModel().getGameAction().sacrifice(target.get(i), this);
Singletons.getModel().getGame().getAction().sacrifice(target.get(i), this);
}
}
} // resolve()
@@ -500,10 +500,10 @@ public class CardFactorySorceries {
for (final Card c : Iterables.filter(player.getCardsIn(ZoneType.Graveyard), nonBasicLands)) {
for (final Card rem : Iterables.filter(lib, CardPredicates.nameEquals(c.getName()))) {
Singletons.getModel().getGameAction().exile(rem);
Singletons.getModel().getGame().getAction().exile(rem);
lib.remove(rem);
}
Singletons.getModel().getGameAction().exile(c);
Singletons.getModel().getGame().getAction().exile(c);
}
}
};
@@ -572,7 +572,7 @@ public class CardFactorySorceries {
private final static void balanceLands(Spell card)
{
List<List<Card>> lands = new ArrayList<List<Card>>();
for (Player p : Singletons.getModel().getGameState().getPlayers())
for (Player p : Singletons.getModel().getGame().getPlayers())
{
lands.add(p.getLandsInPlay());
}
@@ -583,7 +583,7 @@ public class CardFactorySorceries {
min = Math.min(min, s);
}
Iterator<List<Card>> ll = lands.iterator();
for (Player p : Singletons.getModel().getGameState().getPlayers())
for (Player p : Singletons.getModel().getGame().getPlayers())
{
List<Card> l = ll.next();
int sac = l.size() - min;
@@ -591,7 +591,7 @@ public class CardFactorySorceries {
if ( p.isComputer() ) {
CardLists.shuffle(l);
for (int i = 0; i < sac; i++) {
Singletons.getModel().getGameAction().sacrifice(l.get(i), card);
Singletons.getModel().getGame().getAction().sacrifice(l.get(i), card);
}
} else {
Singletons.getModel().getMatch().getInput().setInput(PlayerUtil.inputSacrificePermanents(sac, "Land"));
@@ -601,7 +601,7 @@ public class CardFactorySorceries {
private final static void balanceHands(Spell card) {
List<List<Card>> hands = new ArrayList<List<Card>>();
for (Player p : Singletons.getModel().getGameState().getPlayers())
for (Player p : Singletons.getModel().getGame().getPlayers())
{
hands.add(p.getCardsIn(ZoneType.Hand));
}
@@ -611,7 +611,7 @@ public class CardFactorySorceries {
min = Math.min(min, s);
}
Iterator<List<Card>> hh = hands.iterator();
for (Player p : Singletons.getModel().getGameState().getPlayers())
for (Player p : Singletons.getModel().getGame().getPlayers())
{
List<Card> h = hh.next();
int sac = h.size() - min;
@@ -622,7 +622,7 @@ public class CardFactorySorceries {
private final static void balanceCreatures(Spell card) {
List<List<Card>> creats = new ArrayList<List<Card>>();
for (Player p : Singletons.getModel().getGameState().getPlayers())
for (Player p : Singletons.getModel().getGame().getPlayers())
{
creats.add(p.getCreaturesInPlay());
}
@@ -632,7 +632,7 @@ public class CardFactorySorceries {
min = Math.min(min, s);
}
Iterator<List<Card>> cc = creats.iterator();
for (Player p : Singletons.getModel().getGameState().getPlayers())
for (Player p : Singletons.getModel().getGame().getPlayers())
{
List<Card> c = cc.next();
int sac = c.size() - min;
@@ -642,7 +642,7 @@ public class CardFactorySorceries {
CardLists.sortCMC(c);
Collections.reverse(c);
for (int i = 0; i < sac; i++) {
Singletons.getModel().getGameAction().sacrifice(c.get(i), card);
Singletons.getModel().getGame().getAction().sacrifice(c.get(i), card);
}
} else {
Singletons.getModel().getMatch().getInput().setInput(PlayerUtil.inputSacrificePermanents(sac, "Creature"));
@@ -712,7 +712,7 @@ public class CardFactorySorceries {
thePlayer.addMaxLandsToPlay(-3);
}
};
Singletons.getModel().getGameState().getEndOfTurn().addUntil(untilEOT);
Singletons.getModel().getGame().getEndOfTurn().addUntil(untilEOT);
}
};
@@ -746,7 +746,7 @@ public class CardFactorySorceries {
thePlayer.addMaxLandsToPlay(-1);
}
};
Singletons.getModel().getGameState().getEndOfTurn().addUntil(untilEOT);
Singletons.getModel().getGame().getEndOfTurn().addUntil(untilEOT);
thePlayer.drawCard();
}
@@ -772,12 +772,12 @@ public class CardFactorySorceries {
@Override
public void resolve() {
int max = Integer.MIN_VALUE;
for (Player p : Singletons.getModel().getGameState().getPlayers())
for (Player p : Singletons.getModel().getGame().getPlayers())
{
int s = p.getZone(ZoneType.Hand).size();
max = Math.max(max, s);
}
for (Player p : Singletons.getModel().getGameState().getPlayers())
for (Player p : Singletons.getModel().getGame().getPlayers())
{
this.discardDraw(p, max);
}
@@ -798,7 +798,7 @@ public class CardFactorySorceries {
@Override
public void resolve() {
List<String> types = new ArrayList<String>();
for(Player p : Singletons.getModel().getGameState().getPlayers()) {
for(Player p : Singletons.getModel().getGame().getPlayers()) {
if ( p.isHuman() ) {
types.add(GuiChoose.one("Which creature type?", Constant.CardTypes.CREATURE_TYPES));
} else {
@@ -824,11 +824,11 @@ public class CardFactorySorceries {
}
}
List<Card> bidded = CardLists.filter(Singletons.getModel().getGameState().getCardsIn(ZoneType.Graveyard), CardPredicates.Presets.CREATURES);
List<Card> bidded = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Graveyard), CardPredicates.Presets.CREATURES);
for (final Card c : bidded) {
for(int i = 0; i < types.size(); i++) {
if (c.isType(types.get(i))) {
Singletons.getModel().getGameAction().moveToPlay(c);
Singletons.getModel().getGame().getAction().moveToPlay(c);
i = types.size(); // break inner loop
}
}
@@ -918,7 +918,7 @@ public class CardFactorySorceries {
// then, move revealed cards to bottom of library
for (final Card c : topCards) {
Singletons.getModel().getGameAction().moveToBottomOfLibrary(c);
Singletons.getModel().getGame().getAction().moveToBottomOfLibrary(c);
}
} // resolve()
@@ -976,7 +976,7 @@ public class CardFactorySorceries {
final Card c = ab1card[0];
if (c != null) {
if (card.getController().getZone(ZoneType.Graveyard).contains(c) && c.canBeTargetedBy(this)) {
Singletons.getModel().getGameAction().moveToPlay(c);
Singletons.getModel().getGame().getAction().moveToPlay(c);
}
}
}
@@ -1002,7 +1002,7 @@ public class CardFactorySorceries {
}
}
};
Singletons.getModel().getGameState().getEndOfTurn().addUntil(untilEOT);
Singletons.getModel().getGame().getEndOfTurn().addUntil(untilEOT);
}
}
}
@@ -1025,7 +1025,7 @@ public class CardFactorySorceries {
}
}
};
Singletons.getModel().getGameState().getEndOfTurn().addUntil(untilEOT);
Singletons.getModel().getGame().getEndOfTurn().addUntil(untilEOT);
}
}
} // end ab[3]
@@ -1300,11 +1300,11 @@ public class CardFactorySorceries {
final ArrayList<String> display = new ArrayList<String>();
// get all
final List<Card> creatures = CardLists.filter(Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield), Presets.CREATURES);
final List<Card> creatures = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), Presets.CREATURES);
List<Card> grave = card.getController().getCardsIn(ZoneType.Graveyard);
grave = CardLists.filter(grave, Presets.CREATURES);
for (Player p : Singletons.getModel().getGameState().getPlayers()) {
for (Player p : Singletons.getModel().getGame().getPlayers()) {
if (p.canBeTargetedBy(spell)) {
display.add("Target player loses X life");
break;
@@ -1390,7 +1390,7 @@ public class CardFactorySorceries {
if (toSac != null) {
final Card c = (Card) toSac;
baseCMC = CardUtil.getConvertedManaCost(c);
Singletons.getModel().getGameAction().sacrifice(c, this);
Singletons.getModel().getGame().getAction().sacrifice(c, this);
} else {
return;
}
@@ -1410,7 +1410,7 @@ public class CardFactorySorceries {
// if <= baseCMC, put it onto the battlefield
if (newCMC <= baseCMC) {
Singletons.getModel().getGameAction().moveToPlay(newArtifact[0]);
Singletons.getModel().getGame().getAction().moveToPlay(newArtifact[0]);
} else {
final String diffCost = String.valueOf(newCMC - baseCMC);
Singletons.getModel().getMatch().getInput().setInput(new InputPayManaCostAbility(diffCost, new Command() {
@@ -1418,14 +1418,14 @@ public class CardFactorySorceries {
@Override
public void execute() {
Singletons.getModel().getGameAction().moveToPlay(newArtifact[0]);
Singletons.getModel().getGame().getAction().moveToPlay(newArtifact[0]);
}
}, new Command() {
private static final long serialVersionUID = -246036834856971935L;
@Override
public void execute() {
Singletons.getModel().getGameAction().moveToGraveyard(newArtifact[0]);
Singletons.getModel().getGame().getAction().moveToGraveyard(newArtifact[0]);
}
}));
}

View File

@@ -767,7 +767,7 @@ public class CardFactoryUtil {
@Override
public void selectCard(final Card card, final PlayerZone zone) {
if (choices.contains(card)) {
Singletons.getModel().getGameAction().destroyNoRegeneration(card);
Singletons.getModel().getGame().getAction().destroyNoRegeneration(card);
this.stop();
}
}
@@ -810,7 +810,7 @@ public class CardFactoryUtil {
@Override
public void resolve() {
final Card card = Singletons.getModel().getGameAction().moveToPlay(sourceCard);
final Card card = Singletons.getModel().getGame().getAction().moveToPlay(sourceCard);
card.addIntrinsicKeyword("At the beginning of the end step, exile CARDNAME.");
card.addIntrinsicKeyword("Haste");
@@ -819,7 +819,7 @@ public class CardFactoryUtil {
@Override
public boolean canPlayAI() {
PhaseHandler phase = Singletons.getModel().getGameState().getPhaseHandler();
PhaseHandler phase = Singletons.getModel().getGame().getPhaseHandler();
if (phase.getPhase().isAfter(PhaseType.MAIN1) || !phase.isPlayerTurn(getActivatingPlayer())) {
return false;
}
@@ -855,14 +855,14 @@ public class CardFactoryUtil {
@Override
public void resolve() {
Singletons.getModel().getGameAction().moveToPlay(sourceCard);
Singletons.getModel().getGame().getAction().moveToPlay(sourceCard);
}
@Override
public boolean canPlay() {
//Lands do not have SpellPermanents.
if (sourceCard.isLand()) {
return (Singletons.getModel().getGameState().getZoneOf(sourceCard).is(ZoneType.Hand) || sourceCard.hasKeyword("May be played"))
return (Singletons.getModel().getGame().getZoneOf(sourceCard).is(ZoneType.Hand) || sourceCard.hasKeyword("May be played"))
&& PhaseHandler.canCastSorcery(sourceCard.getController());
}
else {
@@ -903,12 +903,12 @@ public class CardFactoryUtil {
// Run triggers
final Map<String, Object> runParams = new TreeMap<String, Object>();
runParams.put("Card", sourceCard);
Singletons.getModel().getGameState().getTriggerHandler().runTrigger(TriggerType.TurnFaceUp, runParams);
Singletons.getModel().getGame().getTriggerHandler().runTrigger(TriggerType.TurnFaceUp, runParams);
StringBuilder sb = new StringBuilder();
sb.append(this.getActivatingPlayer()).append(" has unmorphed ");
sb.append(sourceCard.getName());
Singletons.getModel().getGameState().getGameLog().add("ResolveStack", sb.toString(), 2);
Singletons.getModel().getGame().getGameLog().add("ResolveStack", sb.toString(), 2);
}
}
@@ -1060,7 +1060,7 @@ public class CardFactoryUtil {
sourceCard.getController().discard(sourceCard, this);
final Card c1 = o;
Singletons.getModel().getGameAction().moveToHand(c1);
Singletons.getModel().getGame().getAction().moveToHand(c1);
}
sourceCard.getController().shuffle();
@@ -1122,7 +1122,7 @@ public class CardFactoryUtil {
@Override
public void resolve() {
final Card c = Singletons.getModel().getGameAction().exile(sourceCard);
final Card c = Singletons.getModel().getGame().getAction().exile(sourceCard);
int counters = AbilityFactory.calculateAmount(c, timeCounters, this);
c.addCounter(Counters.TIME, counters);
@@ -1131,7 +1131,7 @@ public class CardFactoryUtil {
sb.append(this.getActivatingPlayer()).append(" has suspended ");
sb.append(c.getName()).append("with ");
sb.append(counters).append(" time counters on it.");
Singletons.getModel().getGameState().getGameLog().add("ResolveStack", sb.toString(), 2);
Singletons.getModel().getGame().getGameLog().add("ResolveStack", sb.toString(), 2);
}
};
final StringBuilder sbDesc = new StringBuilder();
@@ -1269,7 +1269,7 @@ public class CardFactoryUtil {
} else if (choices.contains(card)) {
spell.setTargetCard(card);
if (spell.getManaCost().equals("0") || free) {
Singletons.getModel().getGameState().getStack().add(spell);
Singletons.getModel().getGame().getStack().add(spell);
this.stop();
} else {
this.stopSetNext(new InputPayManaCost(spell));
@@ -1315,7 +1315,7 @@ public class CardFactoryUtil {
@Override
public void selectButtonCancel() {
Singletons.getModel().getGameAction().sacrifice(crd, null);
Singletons.getModel().getGame().getAction().sacrifice(crd, null);
this.stop();
}
@@ -1323,11 +1323,11 @@ public class CardFactoryUtil {
public void selectCard(final Card card, final PlayerZone zone) {
if (choices.contains(card)) {
if (card == spell.getSourceCard()) {
Singletons.getModel().getGameAction().sacrifice(spell.getSourceCard(), null);
Singletons.getModel().getGame().getAction().sacrifice(spell.getSourceCard(), null);
this.stop();
} else {
spell.getSourceCard().setChampionedCard(card);
Singletons.getModel().getGameAction().exile(card);
Singletons.getModel().getGame().getAction().exile(card);
this.stop();
@@ -1335,7 +1335,7 @@ public class CardFactoryUtil {
final HashMap<String, Object> runParams = new HashMap<String, Object>();
runParams.put("Card", spell.getSourceCard());
runParams.put("Championed", card);
Singletons.getModel().getGameState().getTriggerHandler().runTrigger(TriggerType.Championed, runParams);
Singletons.getModel().getGame().getTriggerHandler().runTrigger(TriggerType.Championed, runParams);
}
}
} // selectCard()
@@ -1426,7 +1426,7 @@ public class CardFactoryUtil {
sb.append(" +1/+1 counter/s from ").append(card);
sb.append(" on ").append(card2);
ability.setStackDescription(sb.toString());
Singletons.getModel().getGameState().getStack().add(ability);
Singletons.getModel().getGame().getStack().add(ability);
this.stop();
}
}
@@ -1568,7 +1568,7 @@ public class CardFactoryUtil {
*/
public static boolean isTargetStillValid(final SpellAbility ability, final Card target) {
if (Singletons.getModel().getGameState().getZoneOf(target) == null) {
if (Singletons.getModel().getGame().getZoneOf(target) == null) {
return false; // for tokens that disappeared
}
@@ -1584,7 +1584,7 @@ public class CardFactoryUtil {
// Check if the target is in the zone it needs to be in to be
// targeted
if (!Singletons.getModel().getGameState().getZoneOf(target).is(tgt.getZone())) {
if (!Singletons.getModel().getGame().getZoneOf(target).is(tgt.getZone())) {
return false;
}
} else {
@@ -1846,7 +1846,7 @@ public class CardFactoryUtil {
if (l[0].contains("Valid")) {
final String restrictions = l[0].replace("Valid ", "");
final String[] rest = restrictions.split(",");
List<Card> cardsonbattlefield = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
List<Card> cardsonbattlefield = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
cardsonbattlefield = CardLists.getValidCards(cardsonbattlefield, rest, players.get(0), source);
n = cardsonbattlefield.size();
@@ -2054,7 +2054,7 @@ public class CardFactoryUtil {
String restrictions = l[0].replace("ValidGrave ", "");
restrictions = restrictions.replace("Count$", "");
final String[] rest = restrictions.split(",");
List<Card> cards = Singletons.getModel().getGameState().getCardsIn(ZoneType.Graveyard);
List<Card> cards = Singletons.getModel().getGame().getCardsIn(ZoneType.Graveyard);
cards = CardLists.getValidCards(cards, rest, cardController, c);
n = cards.size();
@@ -2066,7 +2066,7 @@ public class CardFactoryUtil {
String restrictions = l[0].replace("Valid ", "");
restrictions = restrictions.replace("Count$", "");
final String[] rest = restrictions.split(",");
List<Card> cardsonbattlefield = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
List<Card> cardsonbattlefield = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
cardsonbattlefield = CardLists.getValidCards(cardsonbattlefield, rest, cardController, c);
n = cardsonbattlefield.size();
@@ -2119,7 +2119,7 @@ public class CardFactoryUtil {
int highest = 0;
for (final Object o : c.getRemembered()) {
if (o instanceof Card) {
list.add(Singletons.getModel().getGameState().getCardState((Card) o));
list.add(Singletons.getModel().getGame().getCardState((Card) o));
}
}
for (final Card crd : list) {
@@ -2134,7 +2134,7 @@ public class CardFactoryUtil {
final List<Card> list = new ArrayList<Card>();
for (final Object o : c.getRemembered()) {
if (o instanceof Card) {
list.add(Singletons.getModel().getGameState().getCardState((Card) o));
list.add(Singletons.getModel().getGame().getCardState((Card) o));
}
}
return Aggregates.sum(Iterables.filter(list, CardPredicates.Presets.hasSecondStrike), CardPredicates.Accessors.fnGetAttack);
@@ -2173,7 +2173,7 @@ public class CardFactoryUtil {
}
if (sq[0].equals("StormCount")) {
return CardFactoryUtil.doXMath(Singletons.getModel().getGameState().getStack().getCardsCastThisTurn().size() - 1, m, c);
return CardFactoryUtil.doXMath(Singletons.getModel().getGame().getStack().getCardsCastThisTurn().size() - 1, m, c);
}
if (sq[0].equals("DamageDoneThisTurn")) {
@@ -2317,13 +2317,13 @@ public class CardFactoryUtil {
// Count$HighestLifeTotal
if (sq[0].contains("HighestLifeTotal")) {
return CardFactoryUtil.doXMath(
Aggregates.max(Singletons.getModel().getGameState().getPlayers(), Player.Accessors.FN_GET_LIFE), m, c);
Aggregates.max(Singletons.getModel().getGame().getPlayers(), Player.Accessors.FN_GET_LIFE), m, c);
}
// Count$LowestLifeTotal
if (sq[0].contains("LowestLifeTotal")) {
return CardFactoryUtil.doXMath(
Aggregates.min(Singletons.getModel().getGameState().getPlayers(), Player.Accessors.FN_GET_LIFE), m, c);
Aggregates.min(Singletons.getModel().getGame().getPlayers(), Player.Accessors.FN_GET_LIFE), m, c);
}
// Count$TopOfLibraryCMC
@@ -2344,7 +2344,7 @@ public class CardFactoryUtil {
// Count$LowestLibrary
if (sq[0].contains("LowestLibrary")) {
return Aggregates.min(Singletons.getModel().getGameState().getPlayers(), Player.Accessors.countCardsInZone(ZoneType.Library));
return Aggregates.min(Singletons.getModel().getGame().getPlayers(), Player.Accessors.countCardsInZone(ZoneType.Library));
}
// Count$Chroma.<mana letter>
@@ -2416,7 +2416,7 @@ public class CardFactoryUtil {
}
if (sq[0].contains("GraveyardWithGE20Cards")) {
if (Aggregates.max(Singletons.getModel().getGameState().getPlayers(), Player.Accessors.countCardsInZone(ZoneType.Graveyard)) >= 20) {
if (Aggregates.max(Singletons.getModel().getGame().getPlayers(), Player.Accessors.countCardsInZone(ZoneType.Graveyard)) >= 20) {
return CardFactoryUtil.doXMath(Integer.parseInt(sq[1]), m, c);
} else {
return CardFactoryUtil.doXMath(Integer.parseInt(sq[2]), m, c);
@@ -2447,7 +2447,7 @@ public class CardFactoryUtil {
if (sq[0].contains("SumPower")) {
final String[] restrictions = l[0].split("_");
final String[] rest = restrictions[1].split(",");
List<Card> cardsonbattlefield = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
List<Card> cardsonbattlefield = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
List<Card> filteredCards = CardLists.getValidCards(cardsonbattlefield, rest, cardController, c);
int sumPower = 0;
for (int i = 0; i < filteredCards.size(); i++) {
@@ -2467,7 +2467,7 @@ public class CardFactoryUtil {
if (sq[0].contains("SumCMC")) {
final String[] restrictions = l[0].split("_");
final String[] rest = restrictions[1].split(",");
List<Card> cardsonbattlefield = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
List<Card> cardsonbattlefield = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
List<Card> filteredCards = CardLists.getValidCards(cardsonbattlefield, rest, cardController, c);
return CardLists.sumCMC(filteredCards);
}
@@ -2488,7 +2488,7 @@ public class CardFactoryUtil {
final String[] restrictions = l[0].split("_");
final Counters cType = Counters.getType(restrictions[1]);
final String[] validFilter = restrictions[2].split(",");
List<Card> validCards = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
List<Card> validCards = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
validCards = CardLists.getValidCards(validCards, validFilter, cardController, c);
int cCount = 0;
for (final Card card : validCards) {
@@ -2507,7 +2507,7 @@ public class CardFactoryUtil {
// Count$IfMainPhase.<numMain>.<numNotMain> // 7/10
if (sq[0].contains("IfMainPhase")) {
final PhaseHandler cPhase = Singletons.getModel().getGameState().getPhaseHandler();
final PhaseHandler cPhase = Singletons.getModel().getGame().getPhaseHandler();
if (cPhase.getPhase().isMain() && cPhase.getPlayerTurn().equals(cardController)) {
return CardFactoryUtil.doXMath(Integer.parseInt(sq[1]), m, c);
} else {
@@ -2661,7 +2661,7 @@ public class CardFactoryUtil {
}
if (sq[0].contains("SpellsOnStack")) {
someCards.addAll(Singletons.getModel().getGameState().getCardsIn(ZoneType.Stack));
someCards.addAll(Singletons.getModel().getGame().getCardsIn(ZoneType.Stack));
}
if (sq[0].contains("InAllHands")) {
@@ -3261,7 +3261,7 @@ public class CardFactoryUtil {
temp.setToken(true);
CardFactoryUtil.parseKeywords(temp, temp.getName());
CardFactoryUtil.postFactoryKeywords(temp);
Singletons.getModel().getGameAction().moveToPlay(temp);
Singletons.getModel().getGame().getAction().moveToPlay(temp);
list.add(temp);
}
return list;
@@ -3340,7 +3340,7 @@ public class CardFactoryUtil {
}
};
Singletons.getModel().getGameState().getEndOfTurn().addUntil(untilEOT);
Singletons.getModel().getGame().getEndOfTurn().addUntil(untilEOT);
crd.addTempAttackBoost(magnitude);
crd.addTempDefenseBoost(magnitude);
@@ -3469,7 +3469,7 @@ public class CardFactoryUtil {
};
ability.setStackDescription("Fastbond - Deals 1 damage to you.");
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
}
}
@@ -3689,7 +3689,7 @@ public class CardFactoryUtil {
@Override
public void resolve() {
card.setEvoked(true);
Singletons.getModel().getGameAction().moveToPlay(card);
Singletons.getModel().getGame().getAction().moveToPlay(card);
}
@Override
@@ -3984,7 +3984,7 @@ public class CardFactoryUtil {
@Override
public void resolve() {
this.getTargetCard().addHauntedBy(card);
Singletons.getModel().getGameAction().exile(card);
Singletons.getModel().getGame().getAction().exile(card);
}
};
haunterDiesWork.setDescription(hauntDescription);
@@ -4005,7 +4005,7 @@ public class CardFactoryUtil {
}
if (c.canBeTargetedBy(haunterDiesWork)) {
haunterDiesWork.setTargetCard(c);
Singletons.getModel().getGameState().getStack().add(haunterDiesWork);
Singletons.getModel().getGame().getStack().add(haunterDiesWork);
this.stop();
} else {
CMatchUI.SINGLETON_INSTANCE
@@ -4017,7 +4017,7 @@ public class CardFactoryUtil {
final Ability haunterDiesSetup = new Ability(card, "0") {
@Override
public void resolve() {
final List<Card> creats = CardLists.filter(Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield), Presets.CREATURES);
final List<Card> creats = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), Presets.CREATURES);
for (int i = 0; i < creats.size(); i++) {
if (!creats.get(i).canBeTargetedBy(this)) {
creats.remove(i);
@@ -4040,7 +4040,7 @@ public class CardFactoryUtil {
} else {
haunterDiesWork.setTargetCard(CardFactoryUtil.getWorstCreatureAI(creats));
}
Singletons.getModel().getGameState().getStack().add(haunterDiesWork);
Singletons.getModel().getGame().getStack().add(haunterDiesWork);
}
}
};
@@ -4155,13 +4155,13 @@ public class CardFactoryUtil {
eff.addTrigger(copyTrigger);
Singletons.getModel().getGameState().getTriggerHandler().suppressMode(TriggerType.ChangesZone);
Singletons.getModel().getGameAction().moveToPlay(eff);
Singletons.getModel().getGameState().getTriggerHandler().clearSuppression(TriggerType.ChangesZone);
Singletons.getModel().getGame().getTriggerHandler().suppressMode(TriggerType.ChangesZone);
Singletons.getModel().getGame().getAction().moveToPlay(eff);
Singletons.getModel().getGame().getTriggerHandler().clearSuppression(TriggerType.ChangesZone);
}
if (card.getController().isHuman()) {
Singletons.getModel().getGameAction().playSpellAbilityNoStack(origSA, false);
Singletons.getModel().getGame().getAction().playSpellAbilityNoStack(origSA, false);
} else {
ComputerUtil.playNoStack(card.getController(), origSA);
}
@@ -4372,7 +4372,7 @@ public class CardFactoryUtil {
@Override
public void resolve() {
forge.Singletons.getModel().getGameAction().moveToPlay(((Card) this.getReplacingObject("Card")));
forge.Singletons.getModel().getGame().getAction().moveToPlay(((Card) this.getReplacingObject("Card")));
}
/* (non-Javadoc)
@@ -4557,10 +4557,10 @@ public class CardFactoryUtil {
@Override
public void execute() {
final List<Card> cardsInPlay = CardLists.getType(Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield), "World");
final List<Card> cardsInPlay = CardLists.getType(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), "World");
cardsInPlay.remove(card);
for (int i = 0; i < cardsInPlay.size(); i++) {
Singletons.getModel().getGameAction().sacrificeDestroy(cardsInPlay.get(i));
Singletons.getModel().getGame().getAction().sacrificeDestroy(cardsInPlay.get(i));
}
} // execute()
}; // Command
@@ -4657,7 +4657,7 @@ public class CardFactoryUtil {
for (Object o : selection) {
Card dinner = (Card) o;
card.addDevoured(dinner);
Singletons.getModel().getGameAction().sacrifice(dinner, null);
Singletons.getModel().getGame().getAction().sacrifice(dinner, null);
}
}
} // human
@@ -4667,7 +4667,7 @@ public class CardFactoryUtil {
final Card c = creats.get(i);
if ((c.getNetAttack() <= 1) && ((c.getNetAttack() + c.getNetDefense()) <= 3)) {
card.addDevoured(c);
Singletons.getModel().getGameAction().sacrifice(c, null);
Singletons.getModel().getGame().getAction().sacrifice(c, null);
count++;
}
}
@@ -4724,7 +4724,7 @@ public class CardFactoryUtil {
if (ability.getTargetCard() != null) {
ability.setStackDescription("Put " + card.getCounters(Counters.P1P1)
+ " +1/+1 counter/s from " + card + " on " + ability.getTargetCard());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
}
}

View File

@@ -438,7 +438,7 @@ public class Cost {
final String mana = this.getTotalMana();
final ManaCost changedCost = Singletons.getModel().getGameAction().getSpellCostChange(sa, new ManaCost(mana));
final ManaCost changedCost = Singletons.getModel().getGame().getAction().getSpellCostChange(sa, new ManaCost(mana));
costMana.setAdjustedMana(changedCost.toString(false));
costChanged = true;
@@ -446,7 +446,7 @@ public class Cost {
}
if (!costChanged) {
// Spells with a cost of 0 should be affected too
final ManaCost changedCost = Singletons.getModel().getGameAction().getSpellCostChange(sa, new ManaCost("0"));
final ManaCost changedCost = Singletons.getModel().getGame().getAction().getSpellCostChange(sa, new ManaCost("0"));
this.costParts.add(new CostMana(changedCost.toString(), 0, false));
}
}

View File

@@ -153,8 +153,8 @@ public class CostExile extends CostPartWithList {
return true; // this will always work
}
if (this.getFrom().equals(ZoneType.Stack)) {
for (int i = 0; i < Singletons.getModel().getGameState().getStack().size(); i++) {
typeList.add(Singletons.getModel().getGameState().getStack().peekAbility(i).getSourceCard());
for (int i = 0; i < Singletons.getModel().getGame().getStack().size(); i++) {
typeList.add(Singletons.getModel().getGame().getStack().peekAbility(i).getSourceCard());
}
} else {
typeList = activator.getCardsIn(this.getFrom());
@@ -182,13 +182,13 @@ public class CostExile extends CostPartWithList {
@Override
public final void payAI(final Player ai, final SpellAbility ability, final Card source, final CostPayment payment) {
for (final Card c : this.getList()) {
Singletons.getModel().getGameAction().exile(c);
Singletons.getModel().getGame().getAction().exile(c);
if (this.from.equals(ZoneType.Stack)) {
ArrayList<SpellAbility> spells = c.getSpellAbilities();
for (SpellAbility spell : spells) {
if (c.isInZone(ZoneType.Exile)) {
final SpellAbilityStackInstance si = Singletons.getModel().getGameState().getStack().getInstanceFromSpellAbility(spell);
Singletons.getModel().getGameState().getStack().remove(si);
final SpellAbilityStackInstance si = Singletons.getModel().getGame().getStack().getInstanceFromSpellAbility(spell);
Singletons.getModel().getGame().getStack().remove(si);
}
}
}
@@ -211,7 +211,7 @@ public class CostExile extends CostPartWithList {
if (this.getType().equals("All")) {
this.setList(list);
for (final Card card : list) {
Singletons.getModel().getGameAction().exile(card);
Singletons.getModel().getGame().getAction().exile(card);
}
payment.paidCost(this);
}
@@ -316,7 +316,7 @@ public class CostExile extends CostPartWithList {
while (itr.hasNext()) {
final Card c = itr.next();
part.addToList(c);
Singletons.getModel().getGameAction().exile(c);
Singletons.getModel().getGame().getAction().exile(c);
}
part.addListToHash(sa, "Exiled");
payment.paidCost(part);
@@ -365,7 +365,7 @@ public class CostExile extends CostPartWithList {
if (c != null) {
this.typeList.remove(c);
part.addToList(c);
Singletons.getModel().getGameAction().exile(c);
Singletons.getModel().getGame().getAction().exile(c);
if (i == (nNeeded - 1)) {
this.done();
}
@@ -426,9 +426,9 @@ public class CostExile extends CostPartWithList {
saList = new ArrayList<SpellAbility>();
descList = new ArrayList<String>();
for (int i = 0; i < Singletons.getModel().getGameState().getStack().size(); i++) {
final Card stC = Singletons.getModel().getGameState().getStack().peekAbility(i).getSourceCard();
final SpellAbility stSA = Singletons.getModel().getGameState().getStack().peekAbility(i).getRootSpellAbility();
for (int i = 0; i < Singletons.getModel().getGame().getStack().size(); i++) {
final Card stC = Singletons.getModel().getGame().getStack().peekAbility(i).getSourceCard();
final SpellAbility stSA = Singletons.getModel().getGame().getStack().peekAbility(i).getRootSpellAbility();
if (stC.isValid(type.split(";"), sa.getActivatingPlayer(), sa.getSourceCard()) && stSA.isSpell()) {
this.saList.add(stSA);
if (stC.isCopiedSpell()) {
@@ -453,13 +453,13 @@ public class CostExile extends CostPartWithList {
this.saList.remove(toExile);
part.addToList(c);
if (!c.isCopiedSpell()) {
Singletons.getModel().getGameAction().exile(c);
Singletons.getModel().getGame().getAction().exile(c);
}
if (i == (nNeeded - 1)) {
this.done();
}
final SpellAbilityStackInstance si = Singletons.getModel().getGameState().getStack().getInstanceFromSpellAbility(toExile);
Singletons.getModel().getGameState().getStack().remove(si);
final SpellAbilityStackInstance si = Singletons.getModel().getGame().getStack().getInstanceFromSpellAbility(toExile);
Singletons.getModel().getGame().getStack().remove(si);
} else {
this.cancel();
break;
@@ -546,7 +546,7 @@ public class CostExile extends CostPartWithList {
if (this.typeList.contains(card)) {
this.nExiles++;
part.addToList(card);
Singletons.getModel().getGameAction().exile(card);
Singletons.getModel().getGame().getAction().exile(card);
this.typeList.remove(card);
// in case nothing else to exile
if (this.nExiles == nNeeded) {
@@ -606,7 +606,7 @@ public class CostExile extends CostPartWithList {
possibleValues[0]);
if (choice.equals(0)) {
payment.getAbility().addCostToHashList(card, "Exiled");
Singletons.getModel().getGameAction().exile(card);
Singletons.getModel().getGame().getAction().exile(card);
part.addToList(card);
this.stop();
part.addListToHash(sa, "Exiled");

View File

@@ -112,7 +112,7 @@ public class CostMill extends CostPartWithList {
@Override
public final void payAI(final Player ai, final SpellAbility ability, final Card source, final CostPayment payment) {
for (final Card c : this.getList()) {
Singletons.getModel().getGameAction().moveToGraveyard(c);
Singletons.getModel().getGame().getAction().moveToGraveyard(c);
}
}
@@ -156,7 +156,7 @@ public class CostMill extends CostPartWithList {
while (itr.hasNext()) {
final Card card = itr.next();
this.addToList(card);
Singletons.getModel().getGameAction().moveToGraveyard(card);
Singletons.getModel().getGame().getAction().moveToGraveyard(card);
}
this.addListToHash(ability, "Milled");
payment.paidCost(this);

View File

@@ -131,7 +131,7 @@ public class CostReturn extends CostPartWithList {
@Override
public final void payAI(final Player ai, final SpellAbility ability, final Card source, final CostPayment payment) {
for (final Card c : this.getList()) {
Singletons.getModel().getGameAction().moveToHand(c);
Singletons.getModel().getGame().getAction().moveToHand(c);
}
}
@@ -247,7 +247,7 @@ public class CostReturn extends CostPartWithList {
if (this.typeList.contains(card)) {
this.nReturns++;
part.addToList(card);
Singletons.getModel().getGameAction().moveToHand(card);
Singletons.getModel().getGame().getAction().moveToHand(card);
this.typeList.remove(card);
// in case nothing else to return
if (this.nReturns == nNeeded) {
@@ -306,7 +306,7 @@ public class CostReturn extends CostPartWithList {
possibleValues[0]);
if (choice.equals(0)) {
part.addToList(card);
Singletons.getModel().getGameAction().moveToHand(card);
Singletons.getModel().getGame().getAction().moveToHand(card);
this.stop();
part.addListToHash(sa, "Returned");
payment.paidCost(part);

View File

@@ -140,7 +140,7 @@ public class CostSacrifice extends CostPartWithList {
public final void payAI(final Player ai, final SpellAbility ability, final Card source, final CostPayment payment) {
this.addListToHash(ability, "Sacrificed");
for (final Card c : this.getList()) {
Singletons.getModel().getGameAction().sacrifice(c, ability);
Singletons.getModel().getGame().getAction().sacrifice(c, ability);
}
}
@@ -249,7 +249,7 @@ public class CostSacrifice extends CostPartWithList {
// TODO Ask First
for (final Card card : typeList) {
payment.getAbility().addCostToHashList(card, "Sacrificed");
Singletons.getModel().getGameAction().sacrifice(card, sa);
Singletons.getModel().getGame().getAction().sacrifice(card, sa);
}
payment.setPaidManaPart(part);
@@ -306,7 +306,7 @@ public class CostSacrifice extends CostPartWithList {
if (typeList.contains(card)) {
this.nSacrifices++;
part.addToList(card);
Singletons.getModel().getGameAction().sacrifice(card, sa);
Singletons.getModel().getGame().getAction().sacrifice(card, sa);
typeList.remove(card);
// in case nothing else to sacrifice
if (this.nSacrifices == nNeeded) {
@@ -367,7 +367,7 @@ public class CostSacrifice extends CostPartWithList {
if (choice.equals(0)) {
part.addToList(card);
part.addListToHash(sa, "Sacrificed");
Singletons.getModel().getGameAction().sacrifice(card, sa);
Singletons.getModel().getGame().getAction().sacrifice(card, sa);
this.stop();
payment.paidCost(part);
} else {

View File

@@ -120,7 +120,7 @@ public class CostUntapType extends CostPartWithList {
*/
@Override
public final boolean canPay(final SpellAbility ability, final Card source, final Player activator, final Cost cost) {
List<Card> typeList = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
List<Card> typeList = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
typeList = CardLists.getValidCards(typeList, this.getType().split(";"), activator, source);
@@ -160,7 +160,7 @@ public class CostUntapType extends CostPartWithList {
@Override
public final boolean payHuman(final SpellAbility ability, final Card source, final CostPayment payment) {
final boolean untap = payment.getCost().getUntap();
List<Card> typeList = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
List<Card> typeList = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
typeList = CardLists.getValidCards(typeList, this.getType().split(";"), ability.getActivatingPlayer(), ability.getSourceCard());
typeList = CardLists.filter(typeList, Presets.TAPPED);
if (untap) {
@@ -197,7 +197,7 @@ public class CostUntapType extends CostPartWithList {
if (c == null) {
final String sVar = ability.getSVar(amount);
if (sVar.equals("XChoice")) {
List<Card> typeList = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
List<Card> typeList = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
typeList = CardLists.getValidCards(typeList, this.getType().split(";"), ai, ability.getSourceCard());
if (untap) {
typeList.remove(source);

View File

@@ -164,7 +164,7 @@ public class ManaPool {
for (final Mana m : manaList) {
this.addManaToPool(this.floatingMana, m);
}
Singletons.getModel().getGameAction().checkStateEffects();
Singletons.getModel().getGame().getAction().checkStateEffects();
owner.updateObservers();
}

View File

@@ -321,7 +321,7 @@ public abstract class ReplacementEffect extends TriggerReplacementBase {
}
if (this.getMapParams().containsKey("CheckSVar")) {
final int sVar = AbilityFactory.calculateAmount(Singletons.getModel().getGameState().getCardState(this.getHostCard()), this
final int sVar = AbilityFactory.calculateAmount(Singletons.getModel().getGame().getCardState(this.getHostCard()), this
.getMapParams().get("CheckSVar"), null);
String comparator = "GE1";
if (this.getMapParams().containsKey("SVarCompare")) {
@@ -329,7 +329,7 @@ public abstract class ReplacementEffect extends TriggerReplacementBase {
}
final String svarOperator = comparator.substring(0, 2);
final String svarOperand = comparator.substring(2);
final int operandValue = AbilityFactory.calculateAmount(Singletons.getModel().getGameState().getCardState(this.getHostCard()),
final int operandValue = AbilityFactory.calculateAmount(Singletons.getModel().getGame().getCardState(this.getHostCard()),
svarOperand, null);
if (!Expressions.compare(sVar, svarOperator, operandValue)) {
return false;

View File

@@ -102,7 +102,7 @@ public class ReplacementHandler {
}*/
// Round up Static replacement effects
for (final Player p : Singletons.getModel().getGameState().getPlayers()) {
for (final Player p : Singletons.getModel().getGame().getPlayers()) {
for (final Card crd : p.getAllCards()) {
for (final ReplacementEffect replacementEffect : crd.getReplacementEffects()) {
if (!replacementEffect.hasRun()
@@ -110,7 +110,7 @@ public class ReplacementHandler {
&& replacementEffect.requirementsCheck()
&& replacementEffect.canReplace(runParams)
&& !possibleReplacers.contains(replacementEffect)
&& replacementEffect.zonesCheck(Singletons.getModel().getGameState().getZoneOf(crd))) {
&& replacementEffect.zonesCheck(Singletons.getModel().getGame().getZoneOf(crd))) {
possibleReplacers.add(replacementEffect);
}
}
@@ -145,7 +145,7 @@ public class ReplacementHandler {
ReplacementResult res = this.executeReplacement(runParams, chosenRE, decider);
if (res != ReplacementResult.NotReplaced) {
chosenRE.setHasRun(false);
Singletons.getModel().getGameState().getGameLog().add("ReplacementEffect", chosenRE.toString(), 2);
Singletons.getModel().getGame().getGameLog().add("ReplacementEffect", chosenRE.toString(), 2);
return res;
} else {
if (possibleReplacers.size() == 0) {
@@ -235,7 +235,7 @@ public class ReplacementHandler {
Player player = replacementEffect.getHostCard().getController();
if (player.isHuman()) {
Singletons.getModel().getGameAction().playSpellAbilityNoStack(effectSA, false);
Singletons.getModel().getGame().getAction().playSpellAbilityNoStack(effectSA, false);
} else {
ComputerUtil.playNoStack(player, effectSA);
}

View File

@@ -68,7 +68,7 @@ public abstract class Ability extends SpellAbility {
/** {@inheritDoc} */
@Override
public boolean canPlay() {
if (Singletons.getModel().getGameState().getStack().isSplitSecondOnStack()) {
if (Singletons.getModel().getGame().getStack().isSplitSecondOnStack()) {
return false;
}

View File

@@ -82,7 +82,7 @@ public abstract class AbilityActivated extends SpellAbility implements java.io.S
/** {@inheritDoc} */
@Override
public boolean canPlay() {
if (Singletons.getModel().getGameState().getStack().isSplitSecondOnStack()) {
if (Singletons.getModel().getGame().getStack().isSplitSecondOnStack()) {
return false;
}
@@ -93,7 +93,7 @@ public abstract class AbilityActivated extends SpellAbility implements java.io.S
}
// CantBeActivated static abilities
final List<Card> allp = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
final List<Card> allp = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
for (final Card ca : allp) {
final ArrayList<StaticAbility> staticAbilities = ca.getStaticAbilities();
for (final StaticAbility stAb : staticAbilities) {
@@ -107,7 +107,7 @@ public abstract class AbilityActivated extends SpellAbility implements java.io.S
return false;
}
if (this.isCycling() && Singletons.getModel().getGameState().isCardInPlay("Stabilizer")) {
if (this.isCycling() && Singletons.getModel().getGame().isCardInPlay("Stabilizer")) {
return false;
}

View File

@@ -238,7 +238,7 @@ public class AbilityMana extends AbilityActivated implements java.io.Serializabl
runParams.put("Player", player);
runParams.put("AbilityMana", this);
runParams.put("Produced", produced);
Singletons.getModel().getGameState().getTriggerHandler().runTrigger(TriggerType.TapsForMana, runParams);
Singletons.getModel().getGame().getTriggerHandler().runTrigger(TriggerType.TapsForMana, runParams);
} // end produceMana(String)

View File

@@ -91,7 +91,7 @@ public abstract class Spell extends SpellAbility implements java.io.Serializable
/** {@inheritDoc} */
@Override
public boolean canPlay() {
if (Singletons.getModel().getGameState().getStack().isSplitSecondOnStack()) {
if (Singletons.getModel().getGame().getStack().isSplitSecondOnStack()) {
return false;
}
@@ -124,7 +124,7 @@ public abstract class Spell extends SpellAbility implements java.io.Serializable
}
// CantBeCast static abilities
final List<Card> allp = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
final List<Card> allp = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
allp.add(card);
for (final Card ca : allp) {
final ArrayList<StaticAbility> staticAbilities = ca.getStaticAbilities();
@@ -144,7 +144,7 @@ public abstract class Spell extends SpellAbility implements java.io.Serializable
final Card card = this.getSourceCard();
if (card.getSVar("NeedsToPlay").length() > 0) {
final String needsToPlay = card.getSVar("NeedsToPlay");
List<Card> list = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
List<Card> list = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
list = CardLists.getValidCards(list, needsToPlay.split(","), card.getController(), card);
if (list.isEmpty()) {

View File

@@ -198,11 +198,11 @@ public class SpellAbilityCondition extends SpellAbilityVariables {
return false;
}
if (this.isPlayerTurn() && !Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(activator)) {
if (this.isPlayerTurn() && !Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(activator)) {
return false;
}
if (this.isOpponentTurn() && Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(activator)) {
if (this.isOpponentTurn() && Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(activator)) {
return false;
}
@@ -212,7 +212,7 @@ public class SpellAbilityCondition extends SpellAbilityVariables {
if (this.getPhases().size() > 0) {
boolean isPhase = false;
final PhaseType currPhase = Singletons.getModel().getGameState().getPhaseHandler().getPhase();
final PhaseType currPhase = Singletons.getModel().getGame().getPhaseHandler().getPhase();
for (final PhaseType s : this.getPhases()) {
if (s == currPhase) {
isPhase = true;
@@ -256,7 +256,7 @@ public class SpellAbilityCondition extends SpellAbilityVariables {
if (this.getPresentDefined() != null) {
list.addAll(AbilityFactory.getDefinedCards(sa.getSourceCard(), this.getPresentDefined(), sa));
} else {
list = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
list = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
}
list = CardLists.getValidCards(list, this.getIsPresent().split(","), sa.getActivatingPlayer(), sa.getSourceCard());

View File

@@ -23,7 +23,7 @@ import forge.Card;
import forge.Singletons;
import forge.card.abilityfactory.AbilityFactory;
import forge.card.cost.CostPayment;
import forge.game.zone.PlayerZone;
import forge.game.zone.Zone;
/**
* <p>
@@ -65,7 +65,7 @@ public class SpellAbilityRequirements {
this.isFree = bFree;
}
private PlayerZone fromZone = null;
private Zone fromZone = null;
private boolean bCasting = false;
/**
@@ -110,15 +110,15 @@ public class SpellAbilityRequirements {
if (!this.ability.getSourceCard().isCopiedSpell()) {
final Card c = this.ability.getSourceCard();
this.fromZone = Singletons.getModel().getGameState().getZoneOf(c);
this.fromZone = Singletons.getModel().getGame().getZoneOf(c);
this.zonePosition = this.fromZone.getPosition(c);
this.ability.setSourceCard(Singletons.getModel().getGameAction().moveToStack(c));
this.ability.setSourceCard(Singletons.getModel().getGame().getAction().moveToStack(c));
}
}
// freeze Stack. No abilities should go onto the stack while I'm filling
// requirements.
Singletons.getModel().getGameState().getStack().freezeStack();
Singletons.getModel().getGame().getStack().freezeStack();
// Skip to paying if parent ability doesn't target and has no
// subAbilities.
@@ -143,11 +143,11 @@ public class SpellAbilityRequirements {
final Card c = this.ability.getSourceCard();
if (this.bCasting && !c.isCopiedSpell()) { // and not a copy
// add back to where it came from
Singletons.getModel().getGameAction().moveTo(this.fromZone, c, this.zonePosition);
Singletons.getModel().getGame().getAction().moveTo(this.fromZone, c, this.zonePosition);
}
this.select.resetTargets();
Singletons.getModel().getGameState().getStack().removeFromFrozenStack(this.ability);
Singletons.getModel().getGame().getStack().removeFromFrozenStack(this.ability);
return;
} else {
this.needPayment();
@@ -192,12 +192,12 @@ public class SpellAbilityRequirements {
}
this.select.resetTargets();
Singletons.getModel().getGameAction().checkStateEffects();
Singletons.getModel().getGame().getAction().checkStateEffects();
} else if (this.payment.isCanceled()) {
final Card c = this.ability.getSourceCard();
if (this.bCasting && !c.isCopiedSpell()) { // and not a copy
// add back to Previous Zone
Singletons.getModel().getGameAction().moveTo(this.fromZone, c, this.zonePosition);
Singletons.getModel().getGame().getAction().moveTo(this.fromZone, c, this.zonePosition);
}
if (this.select != null) {
@@ -206,7 +206,7 @@ public class SpellAbilityRequirements {
this.ability.resetOnceResolved();
this.payment.cancelPayment();
Singletons.getModel().getGameState().getStack().clearFrozen();
Singletons.getModel().getGame().getStack().clearFrozen();
}
}
@@ -234,6 +234,6 @@ public class SpellAbilityRequirements {
}
this.ability.getActivatingPlayer().getManaPool().clearManaPaid(this.ability, false);
Singletons.getModel().getGameState().getStack().addAndUnfreeze(this.ability);
Singletons.getModel().getGame().getStack().addAndUnfreeze(this.ability);
}
}

View File

@@ -30,7 +30,7 @@ import forge.card.cardfactory.CardFactoryUtil;
import forge.game.phase.PhaseHandler;
import forge.game.phase.PhaseType;
import forge.game.player.Player;
import forge.game.zone.PlayerZone;
import forge.game.zone.Zone;
import forge.game.zone.ZoneType;
import forge.util.Expressions;
@@ -186,7 +186,7 @@ public class SpellAbilityRestriction extends SpellAbilityVariables {
if (this.getZone() == null) {
return true;
}
PlayerZone cardZone = Singletons.getModel().getGameState().getZoneOf(c);
Zone cardZone = Singletons.getModel().getGame().getZoneOf(c);
Player activator = sa.getActivatingPlayer();
if (cardZone == null || !cardZone.is(this.getZone())) {
// If Card is not in the default activating zone, do some additional checks
@@ -220,17 +220,17 @@ public class SpellAbilityRestriction extends SpellAbilityVariables {
public final boolean checkTimingRestrictions(final Card c, final SpellAbility sa) {
Player activator = sa.getActivatingPlayer();
if (this.isPlayerTurn() && !Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(activator)) {
if (this.isPlayerTurn() && !Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(activator)) {
return false;
}
if (this.isOpponentTurn() && Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(activator)) {
if (this.isOpponentTurn() && Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(activator)) {
return false;
}
if (this.getPhases().size() > 0) {
boolean isPhase = false;
final PhaseType currPhase = Singletons.getModel().getGameState().getPhaseHandler().getPhase();
final PhaseType currPhase = Singletons.getModel().getGame().getPhaseHandler().getPhase();
for (final PhaseType s : this.getPhases()) {
if (s == currPhase) {
isPhase = true;
@@ -355,7 +355,7 @@ public class SpellAbilityRestriction extends SpellAbilityVariables {
}
}
if (this.getIsPresent() != null) {
List<Card> list = Singletons.getModel().getGameState().getCardsIn(this.getPresentZone());
List<Card> list = Singletons.getModel().getGame().getCardsIn(this.getPresentZone());
list = CardLists.getValidCards(list, this.getIsPresent().split(","), activator, c);

View File

@@ -98,7 +98,7 @@ public class SpellPermanent extends Spell {
final List<Card> creature = SpellPermanent.this.championGetCreature.get();
if (creature.size() == 0) {
Singletons.getModel().getGameAction().sacrifice(source, null);
Singletons.getModel().getGame().getAction().sacrifice(source, null);
return;
} else if (controller.isHuman()) {
Singletons.getModel().getMatch().getInput().setInput(SpellPermanent.this.championInputComes);
@@ -112,16 +112,16 @@ public class SpellPermanent extends Spell {
final Card c = computer.get(0);
source.setChampionedCard(c);
if (c.isInPlay()) {
Singletons.getModel().getGameAction().exile(c);
Singletons.getModel().getGame().getAction().exile(c);
}
// Run triggers
final HashMap<String, Object> runParams = new HashMap<String, Object>();
runParams.put("Card", source);
runParams.put("Championed", source.getChampionedCard());
Singletons.getModel().getGameState().getTriggerHandler().runTrigger(TriggerType.Championed, runParams);
Singletons.getModel().getGame().getTriggerHandler().runTrigger(TriggerType.Championed, runParams);
} else {
Singletons.getModel().getGameAction().sacrifice(this.getSourceCard(), null);
Singletons.getModel().getGame().getAction().sacrifice(this.getSourceCard(), null);
}
} // computer
} // resolve()
@@ -138,7 +138,7 @@ public class SpellPermanent extends Spell {
sb.append(SpellPermanent.this.getSourceCard()).append(
" - When CARDNAME enters the battlefield, sacrifice it unless you exile a creature you control.");
SpellPermanent.this.championAbilityComes.setStackDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(SpellPermanent.this.championAbilityComes);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(SpellPermanent.this.championAbilityComes);
} // execute()
}; // championCommandComes
@@ -154,8 +154,8 @@ public class SpellPermanent extends Spell {
@Override
public void resolve() {
final Card c = this.getSourceCard().getChampionedCard();
if ((c != null) && !c.isToken() && Singletons.getModel().getGameState().isCardExiled(c)) {
Singletons.getModel().getGameAction().moveToPlay(c);
if ((c != null) && !c.isToken() && Singletons.getModel().getGame().isCardExiled(c)) {
Singletons.getModel().getGame().getAction().moveToPlay(c);
}
} // resolve()
}; // SpellAbility
@@ -165,7 +165,7 @@ public class SpellPermanent extends Spell {
" - When CARDNAME leaves the battlefield, exiled card returns to the battlefield.");
ability.setStackDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
} // execute()
}; // championCommandLeavesPlay
@@ -263,7 +263,7 @@ public class SpellPermanent extends Spell {
public boolean canPlay() {
final Card source = this.getSourceCard();
final Player turn = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final Player turn = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
if (source.getName().equals("Serra Avenger")) {
if (turn.equals(source.getController()) && (turn.getTurn() <= 3)) {
@@ -291,21 +291,21 @@ public class SpellPermanent extends Spell {
card.setSVar("PayX", Integer.toString(xPay));
}
// Wait for Main2 if possible
if (Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.MAIN1)
if (Singletons.getModel().getGame().getPhaseHandler().is(PhaseType.MAIN1)
&& !ComputerUtil.castPermanentInMain1(this, ai)) {
return false;
}
// save cards with flash for surprise blocking
if (card.hasKeyword("Flash")
&& !ComputerAIGeneral.hasETBTrigger(card)
&& (Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(ai)
|| Singletons.getModel().getGameState().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY))) {
&& (Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(ai)
|| Singletons.getModel().getGame().getPhaseHandler().getPhase().isBefore(PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY))) {
return false;
}
// Prevent the computer from summoning Ball Lightning type creatures after attacking
if (card.hasKeyword("At the beginning of the end step, sacrifice CARDNAME.")
&& (Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(ai.getOpponent())
|| Singletons.getModel().getGameState().getPhaseHandler().getPhase().isAfter(PhaseType.COMBAT_DECLARE_ATTACKERS))) {
&& (Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(ai.getOpponent())
|| Singletons.getModel().getGame().getPhaseHandler().getPhase().isAfter(PhaseType.COMBAT_DECLARE_ATTACKERS))) {
return false;
}
@@ -349,7 +349,7 @@ public class SpellPermanent extends Spell {
}
// check on legendary
if (card.isType("Legendary") && !Singletons.getModel().getGameState().isCardInPlay("Mirror Gallery")) {
if (card.isType("Legendary") && !Singletons.getModel().getGame().isCardInPlay("Mirror Gallery")) {
final List<Card> list = ai.getCardsIn(ZoneType.Battlefield);
if (Iterables.any(list, CardPredicates.nameEquals(card.getName()))) {
return false;
@@ -410,7 +410,7 @@ public class SpellPermanent extends Spell {
private static boolean checkETBEffects(final Card card, final SpellAbility sa, final String api, final Player ai) {
if (card.isCreature() && Singletons.getModel().getGameState().isCardInPlay("Torpor Orb")) {
if (card.isCreature() && Singletons.getModel().getGame().isCardInPlay("Torpor Orb")) {
return true;
}
@@ -584,6 +584,6 @@ public class SpellPermanent extends Spell {
public void resolve() {
Card c = this.getSourceCard();
c.addController(this.getActivatingPlayer());
Singletons.getModel().getGameAction().moveTo(ZoneType.Battlefield, c);
Singletons.getModel().getGame().getAction().moveTo(ZoneType.Battlefield, c);
}
}

View File

@@ -704,7 +704,7 @@ public class Target {
* @return a boolean.
*/
public final boolean hasCandidates(final SpellAbility sa, final boolean isTargeted) {
for (Player player : Singletons.getModel().getGameState().getPlayers()) {
for (Player player : Singletons.getModel().getGame().getPlayers()) {
if (sa.canTarget(player)) {
return true;
}
@@ -713,7 +713,7 @@ public class Target {
if (this.tgtZone.contains(ZoneType.Stack)) {
return true;
} else {
for (final Card c : Singletons.getModel().getGameState().getCardsIn(this.tgtZone)) {
for (final Card c : Singletons.getModel().getGame().getCardsIn(this.tgtZone)) {
if (c.isValid(this.validTgts, this.srcCard.getController(), this.srcCard)
&& (!isTargeted || c.canBeTargetedBy(sa))
&& !this.getTargetCards().contains(c)) {

View File

@@ -268,7 +268,7 @@ public class TargetSelection {
return;
}
List<Card> choices = CardLists.getTargetableCards(CardLists.getValidCards(Singletons.getModel().getGameState().getCardsIn(zone), this.target.getValidTgts(), this.ability.getActivatingPlayer(), this.ability.getSourceCard()), this.ability);
List<Card> choices = CardLists.getTargetableCards(CardLists.getValidCards(Singletons.getModel().getGame().getCardsIn(zone), this.target.getValidTgts(), this.ability.getActivatingPlayer(), this.ability.getSourceCard()), this.ability);
ArrayList<Object> objects = new ArrayList<Object>();
if (tgt.isUniqueTargets()) {
@@ -459,15 +459,15 @@ public class TargetSelection {
final List<Card> crdsLibrary = new ArrayList<Card>();
final List<Card> crdsStack = new ArrayList<Card>();
for (final Card inZone : choicesZoneUnfiltered) {
if (Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield).contains(inZone)) {
if (Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield).contains(inZone)) {
crdsBattle.add(inZone);
} else if (Singletons.getModel().getGameState().getCardsIn(ZoneType.Exile).contains(inZone)) {
} else if (Singletons.getModel().getGame().getCardsIn(ZoneType.Exile).contains(inZone)) {
crdsExile.add(inZone);
} else if (Singletons.getModel().getGameState().getCardsIn(ZoneType.Graveyard).contains(inZone)) {
} else if (Singletons.getModel().getGame().getCardsIn(ZoneType.Graveyard).contains(inZone)) {
crdsGrave.add(inZone);
} else if (Singletons.getModel().getGameState().getCardsIn(ZoneType.Library).contains(inZone)) {
} else if (Singletons.getModel().getGame().getCardsIn(ZoneType.Library).contains(inZone)) {
crdsLibrary.add(inZone);
} else if (Singletons.getModel().getGameState().getCardsIn(ZoneType.Stack).contains(inZone)) {
} else if (Singletons.getModel().getGame().getCardsIn(ZoneType.Stack).contains(inZone)) {
crdsStack.add(inZone);
}
}
@@ -592,8 +592,8 @@ public class TargetSelection {
public static ArrayList<SpellAbility> getTargetableOnStack(final SpellAbility sa, final Target tgt) {
final ArrayList<SpellAbility> choosables = new ArrayList<SpellAbility>();
for (int i = 0; i < Singletons.getModel().getGameState().getStack().size(); i++) {
choosables.add(Singletons.getModel().getGameState().getStack().peekAbility(i));
for (int i = 0; i < Singletons.getModel().getGame().getStack().size(); i++) {
choosables.add(Singletons.getModel().getGame().getStack().peekAbility(i));
}
for (int i = 0; i < choosables.size(); i++) {

View File

@@ -456,7 +456,7 @@ public class StaticAbility {
if (this.mapParams.containsKey("EffectZone")) {
if (!this.mapParams.get("EffectZone").equals("All")
&& !ZoneType.listValueOf(this.mapParams.get("EffectZone"))
.contains(Singletons.getModel().getGameState().getZoneOf(this.hostCard).getZoneType())) {
.contains(Singletons.getModel().getGame().getZoneOf(this.hostCard).getZoneType())) {
return false;
}
} else {
@@ -481,11 +481,11 @@ public class StaticAbility {
return false;
}
if (this.mapParams.containsKey("PlayerTurn") && !Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(controller)) {
if (this.mapParams.containsKey("PlayerTurn") && !Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(controller)) {
return false;
}
if (this.mapParams.containsKey("OpponentTurn") && !Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(controller.getOpponent())) {
if (this.mapParams.containsKey("OpponentTurn") && !Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(controller.getOpponent())) {
return false;
}
@@ -496,7 +496,7 @@ public class StaticAbility {
if (this.mapParams.containsKey("Phases")) {
List<PhaseType> phases = PhaseType.parseRange(this.mapParams.get("Phases"));
if (!phases.contains(Singletons.getModel().getGameState().getPhaseHandler().getPhase())) {
if (!phases.contains(Singletons.getModel().getGame().getPhaseHandler().getPhase())) {
return false;
}
}

View File

@@ -64,7 +64,7 @@ public class StaticAbilityCantBeCast {
if (params.containsKey("Origin")) {
List<ZoneType> src = ZoneType.listValueOf(params.get("Origin"));
if (!src.contains(Singletons.getModel().getGameState().getZoneOf(card).getZoneType())) {
if (!src.contains(Singletons.getModel().getGame().getZoneOf(card).getZoneType())) {
return false;
}
}

View File

@@ -64,7 +64,7 @@ public class StaticAbilityContinuous {
se.setParams(params);
se.setTimestamp(hostCard.getTimestamp());
se.setSource(hostCard);
Singletons.getModel().getGameState().getStaticEffects().addStaticEffect(se);
Singletons.getModel().getGame().getStaticEffects().addStaticEffect(se);
int powerBonus = 0;
int toughnessBonus = 0;
@@ -231,7 +231,7 @@ public class StaticAbilityContinuous {
}
}
List<Card> cardsIGainedAbilitiesFrom = Singletons.getModel().getGameState().getCardsIn(validZones);
List<Card> cardsIGainedAbilitiesFrom = Singletons.getModel().getGame().getCardsIn(validZones);
cardsIGainedAbilitiesFrom = CardLists.getValidCards(cardsIGainedAbilitiesFrom, valids, hostCard.getController(), hostCard);
if (cardsIGainedAbilitiesFrom.size() > 0) {
@@ -407,7 +407,7 @@ public class StaticAbilityContinuous {
final String[] strngs = params.get("Affected").split(",");
for(Player p : Singletons.getModel().getGameState().getPlayers())
for(Player p : Singletons.getModel().getGame().getPlayers())
if (p.isValid(strngs, controller, hostCard)) {
players.add(p);
}
@@ -429,9 +429,9 @@ public class StaticAbilityContinuous {
List<Card> affectedCards = new ArrayList<Card>();
if (params.containsKey("AffectedZone")) {
affectedCards.addAll(Singletons.getModel().getGameState().getCardsIn(ZoneType.listValueOf(params.get("AffectedZone"))));
affectedCards.addAll(Singletons.getModel().getGame().getCardsIn(ZoneType.listValueOf(params.get("AffectedZone"))));
} else {
affectedCards = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
affectedCards = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
}
if (params.containsKey("Affected") && !params.get("Affected").contains(",")) {

View File

@@ -232,19 +232,19 @@ public abstract class Trigger extends TriggerReplacementBase {
*/
public final boolean phasesCheck() {
if (null != validPhases) {
if (!validPhases.contains(Singletons.getModel().getGameState().getPhaseHandler().getPhase())) {
if (!validPhases.contains(Singletons.getModel().getGame().getPhaseHandler().getPhase())) {
return false;
}
}
if (this.getMapParams().containsKey("PlayerTurn")) {
if (!Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(this.getHostCard().getController())) {
if (!Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(this.getHostCard().getController())) {
return false;
}
}
if (this.getMapParams().containsKey("OpponentTurn")) {
if (Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(this.getHostCard().getController())) {
if (Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(this.getHostCard().getController())) {
return false;
}
}
@@ -410,7 +410,7 @@ public abstract class Trigger extends TriggerReplacementBase {
}
if (this.getMapParams().containsKey("CheckSVar")) {
final int sVar = AbilityFactory.calculateAmount(Singletons.getModel().getGameState().getCardState(this.getHostCard()), this
final int sVar = AbilityFactory.calculateAmount(Singletons.getModel().getGame().getCardState(this.getHostCard()), this
.getMapParams().get("CheckSVar"), null);
String comparator = "GE1";
if (this.getMapParams().containsKey("SVarCompare")) {
@@ -418,7 +418,7 @@ public abstract class Trigger extends TriggerReplacementBase {
}
final String svarOperator = comparator.substring(0, 2);
final String svarOperand = comparator.substring(2);
final int operandValue = AbilityFactory.calculateAmount(Singletons.getModel().getGameState().getCardState(this.getHostCard()),
final int operandValue = AbilityFactory.calculateAmount(Singletons.getModel().getGame().getCardState(this.getHostCard()),
svarOperand, null);
if (!Expressions.compare(sVar, svarOperator, operandValue)) {
return false;

View File

@@ -63,7 +63,7 @@ public class TriggerHandler {
* Clean up temporary triggers.
*/
public final void cleanUpTemporaryTriggers() {
final List<Card> absolutelyAllCards = Singletons.getModel().getGameState().getCardsInGame();
final List<Card> absolutelyAllCards = Singletons.getModel().getGame().getCardsInGame();
for (final Card c : absolutelyAllCards) {
for (int i = 0; i < c.getTriggers().size(); i++) {
if (c.getTriggers().get(i).isTemporary()) {
@@ -271,7 +271,7 @@ public class TriggerHandler {
return;
}
final Player playerAP = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final Player playerAP = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
if (playerAP == null) {
// This should only happen outside of games, so it's safe to just
// abort.
@@ -285,8 +285,8 @@ public class TriggerHandler {
// This is done to allow the list of triggers to be modified while
// triggers are running.
final ArrayList<Trigger> delayedTriggersWorkingCopy = new ArrayList<Trigger>(this.delayedTriggers);
List<Card> allCards = Singletons.getModel().getGameState().getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES);
allCards.addAll(Singletons.getModel().getGameState().getCardsIn(ZoneType.Stack));
List<Card> allCards = Singletons.getModel().getGame().getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES);
allCards.addAll(Singletons.getModel().getGame().getCardsIn(ZoneType.Stack));
boolean checkStatics = false;
// Static triggers
@@ -301,23 +301,23 @@ public class TriggerHandler {
}
if (checkStatics) {
Singletons.getModel().getGameAction().checkStaticAbilities();
Singletons.getModel().getGame().getAction().checkStaticAbilities();
} else if (runParams.containsKey("Destination")){
// Check static abilities when a card enters the battlefield
String type = (String) runParams.get("Destination");
if (type.equals("Battlefield")) {
Singletons.getModel().getGameAction().checkStaticAbilities();
Singletons.getModel().getGame().getAction().checkStaticAbilities();
}
}
// AP
allCards = playerAP.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES);
allCards.addAll(CardLists.filterControlledBy(Singletons.getModel().getGameState().getCardsIn(ZoneType.Stack), playerAP));
allCards.addAll(CardLists.filterControlledBy(Singletons.getModel().getGame().getCardsIn(ZoneType.Stack), playerAP));
// add cards that move to hidden zones
if (runParams.containsKey("Destination") && runParams.containsKey("Card")) {
Card card = (Card) runParams.get("Card");
if (playerAP.equals(card.getController()) && !allCards.contains(card)
&& (Singletons.getModel().getGameState().getZoneOf(card) == null || Singletons.getModel().getGameState().getZoneOf(card).getZoneType().isHidden())) {
&& (Singletons.getModel().getGame().getZoneOf(card) == null || Singletons.getModel().getGame().getZoneOf(card).getZoneType().isHidden())) {
allCards.add(card);
}
}
@@ -338,12 +338,12 @@ public class TriggerHandler {
// NAP
allCards = playerAP.getOpponent().getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES);
allCards.addAll(CardLists.filterControlledBy(Singletons.getModel().getGameState().getCardsIn(ZoneType.Stack), playerAP.getOpponent()));
allCards.addAll(CardLists.filterControlledBy(Singletons.getModel().getGame().getCardsIn(ZoneType.Stack), playerAP.getOpponent()));
// add cards that move to hidden zones
if (runParams.containsKey("Destination") && runParams.containsKey("Card")) {
Card card = (Card) runParams.get("Card");
if (!playerAP.equals(card.getController()) && !allCards.contains(card)
&& (Singletons.getModel().getGameState().getZoneOf(card) == null || Singletons.getModel().getGameState().getZoneOf(card).getZoneType().isHidden())) {
&& (Singletons.getModel().getGame().getZoneOf(card) == null || Singletons.getModel().getGame().getZoneOf(card).getZoneType().isHidden())) {
allCards.add(card);
}
}
@@ -397,7 +397,7 @@ public class TriggerHandler {
return false; // Morphed cards only have pumped triggers go off.
}
if (regtrig instanceof TriggerAlways) {
if (Singletons.getModel().getGameState().getStack().hasStateTrigger(regtrig.getId())) {
if (Singletons.getModel().getGame().getStack().hasStateTrigger(regtrig.getId())) {
return false; // State triggers that are already on the stack
// don't trigger again.
}
@@ -409,7 +409,7 @@ public class TriggerHandler {
if (regtrig.isSuppressed()) {
return false; // Trigger removed by effect
}
if (!regtrig.zonesCheck(Singletons.getModel().getGameState().getZoneOf(regtrig.getHostCard()))) {
if (!regtrig.zonesCheck(Singletons.getModel().getGame().getZoneOf(regtrig.getHostCard()))) {
return false; // Host card isn't where it needs to be.
}
@@ -419,7 +419,7 @@ public class TriggerHandler {
String dest = (String) runParams.get("Destination");
if (dest.equals("Battlefield") && runParams.get("Card") instanceof Card) {
Card card = (Card) runParams.get("Card");
if (card.isCreature() && Singletons.getModel().getGameState().isCardInPlay("Torpor Orb")) {
if (card.isCreature() && Singletons.getModel().getGame().isCardInPlay("Torpor Orb")) {
return false;
}
}
@@ -431,7 +431,7 @@ public class TriggerHandler {
final Player[] controller = new Player[1];
// Any trigger should cause the phase not to skip
Singletons.getModel().getGameState().getPhaseHandler().setSkipPhase(false);
Singletons.getModel().getGame().getPhaseHandler().setSkipPhase(false);
regtrig.setRunParams(runParams);
@@ -446,7 +446,7 @@ public class TriggerHandler {
final AbilityFactory abilityFactory = new AbilityFactory();
final SpellAbility[] sa = new SpellAbility[1];
Card host = Singletons.getModel().getGameState().getCardState(regtrig.getHostCard());
Card host = Singletons.getModel().getGame().getCardState(regtrig.getHostCard());
if (host == null) {
host = regtrig.getHostCard();
@@ -979,7 +979,7 @@ public class TriggerHandler {
}
if (controller[0].isHuman()) {
Singletons.getModel().getGameAction().playSpellAbilityNoStack(sa[0], true);
Singletons.getModel().getGame().getAction().playSpellAbilityNoStack(sa[0], true);
} else {
// commented out because i don't think this should be called
// again here
@@ -1012,14 +1012,14 @@ public class TriggerHandler {
if (regtrig.isStatic()) {
if (controller[0].isHuman()) {
Singletons.getModel().getGameAction().playSpellAbilityNoStack(wrapperAbility, false);
Singletons.getModel().getGame().getAction().playSpellAbilityNoStack(wrapperAbility, false);
} else {
wrapperAbility.doTrigger(isMandatory);
ComputerUtil.playNoStack(controller[0], wrapperAbility);
}
//Singletons.getModel().getGameAction().playSpellAbilityNoStack(wrapperAbility, false);
} else {
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(wrapperAbility);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(wrapperAbility);
}
regtrig.setTriggeredSA(wrapperAbility);
return true;

View File

@@ -59,7 +59,7 @@ public class TriggerSpellAbilityCast extends Trigger {
public final boolean performTest(final java.util.Map<String, Object> runParams2) {
final SpellAbility spellAbility = (SpellAbility) runParams2.get("CastSA");
final Card cast = spellAbility.getSourceCard();
final SpellAbilityStackInstance si = Singletons.getModel().getGameState().getStack().getInstanceFromSpellAbility(spellAbility);
final SpellAbilityStackInstance si = Singletons.getModel().getGame().getStack().getInstanceFromSpellAbility(spellAbility);
if (this.getMode() == TriggerType.SpellCast) {
if (!spellAbility.isSpell()) {

View File

@@ -274,7 +274,7 @@ public enum FControl {
if (Singletons.getModel() == null)
return null;
return Aggregates.firstFieldEquals(Singletons.getModel().getGameState().getPlayers(), Player.Accessors.FN_GET_TYPE, PlayerType.HUMAN);
return Aggregates.firstFieldEquals(Singletons.getModel().getGame().getPlayers(), Player.Accessors.FN_GET_TYPE, PlayerType.HUMAN);
}
/**

View File

@@ -99,7 +99,7 @@ public abstract class Input implements java.io.Serializable {
// clears a "temp" Input like Input_PayManaCost if there is one
Singletons.getModel().getMatch().getInput().resetInput();
PhaseHandler ph = Singletons.getModel().getGameState().getPhaseHandler();
PhaseHandler ph = Singletons.getModel().getGame().getPhaseHandler();
if (ph.isNeedToNextPhase()) {
// mulligan needs this to move onto next phase
ph.setNeedToNextPhase(false);

View File

@@ -53,7 +53,7 @@ public class InputAttack extends Input {
ButtonUtil.enableOnlyOK();
final Object o = Singletons.getModel().getGameState().getCombat().nextDefender();
final Object o = Singletons.getModel().getGame().getCombat().nextDefender();
if (o == null) {
return;
}
@@ -64,13 +64,13 @@ public class InputAttack extends Input {
CMatchUI.SINGLETON_INSTANCE.showMessage(sb.toString());
if (Singletons.getModel().getGameState().getCombat().getRemainingDefenders() == 0) {
if (Singletons.getModel().getGame().getCombat().getRemainingDefenders() == 0) {
// Nothing left to attack, has to attack this defender
List<Card> possibleAttackers = Singletons.getControl().getPlayer().getCardsIn(ZoneType.Battlefield);
for (Card c : Iterables.filter(possibleAttackers, CardPredicates.Presets.CREATURES)) {
if (c.hasKeyword("CARDNAME attacks each turn if able.") && CombatUtil.canAttack(c, Singletons.getModel().getGameState().getCombat())
if (c.hasKeyword("CARDNAME attacks each turn if able.") && CombatUtil.canAttack(c, Singletons.getModel().getGame().getCombat())
&& !c.isAttacking()) {
Singletons.getModel().getGameState().getCombat().addAttacker(c);
Singletons.getModel().getGame().getCombat().addAttacker(c);
}
}
}
@@ -79,15 +79,15 @@ public class InputAttack extends Input {
/** {@inheritDoc} */
@Override
public final void selectButtonOK() {
if (!Singletons.getModel().getGameState().getCombat().getAttackers().isEmpty()) {
Singletons.getModel().getGameState().getPhaseHandler().setCombat(true);
if (!Singletons.getModel().getGame().getCombat().getAttackers().isEmpty()) {
Singletons.getModel().getGame().getPhaseHandler().setCombat(true);
}
if (Singletons.getModel().getGameState().getCombat().getRemainingDefenders() != 0) {
Singletons.getModel().getGameState().getPhaseHandler().repeatPhase();
if (Singletons.getModel().getGame().getCombat().getRemainingDefenders() != 0) {
Singletons.getModel().getGame().getPhaseHandler().repeatPhase();
}
Singletons.getModel().getGameState().getPhaseHandler().setNeedToNextPhase(true);
Singletons.getModel().getGame().getPhaseHandler().setNeedToNextPhase(true);
Singletons.getModel().getMatch().getInput().resetInput();
}
@@ -100,14 +100,14 @@ public class InputAttack extends Input {
final Player human = Singletons.getControl().getPlayer();
if (zone.is(ZoneType.Battlefield, human)
&& CombatUtil.canAttack(card, Singletons.getModel().getGameState().getCombat())) {
&& CombatUtil.canAttack(card, Singletons.getModel().getGame().getCombat())) {
// TODO add the propaganda code here and remove it in
// Phase.nextPhase()
// if (!CombatUtil.checkPropagandaEffects(card))
// return;
Singletons.getModel().getGameState().getCombat().addAttacker(card);
Singletons.getModel().getGame().getCombat().addAttacker(card);
// just to make sure the attack symbol is marked
human.getZone(ZoneType.Battlefield).updateObservers();

View File

@@ -86,13 +86,13 @@ public class InputBlock extends Input {
/** {@inheritDoc} */
@Override
public final void selectButtonOK() {
if (CombatUtil.finishedMandatoryBlocks(Singletons.getModel().getGameState().getCombat())) {
if (CombatUtil.finishedMandatoryBlocks(Singletons.getModel().getGame().getCombat())) {
// Done blocking
ButtonUtil.reset();
CombatUtil.orderMultipleCombatants(Singletons.getModel().getGameState().getCombat());
CombatUtil.orderMultipleCombatants(Singletons.getModel().getGame().getCombat());
Singletons.getModel().getGameState().getPhaseHandler().setNeedToNextPhase(true);
Singletons.getModel().getGame().getPhaseHandler().setNeedToNextPhase(true);
}
}
@@ -102,7 +102,7 @@ public class InputBlock extends Input {
// is attacking?
boolean reminder = true;
if (Singletons.getModel().getGameState().getCombat().getAttackers().contains(card)) {
if (Singletons.getModel().getGame().getCombat().getAttackers().contains(card)) {
this.currentAttacker = card;
reminder = false;
} else {
@@ -116,9 +116,9 @@ public class InputBlock extends Input {
List<Card> attackersBlocked = this.allBlocking.get(card);
if (!attackersBlocked.contains(this.currentAttacker) &&
CombatUtil.canBlock(this.currentAttacker, card, Singletons.getModel().getGameState().getCombat())) {
CombatUtil.canBlock(this.currentAttacker, card, Singletons.getModel().getGame().getCombat())) {
attackersBlocked.add(this.currentAttacker);
Singletons.getModel().getGameState().getCombat().addBlocker(this.currentAttacker, card);
Singletons.getModel().getGame().getCombat().addBlocker(this.currentAttacker, card);
reminder = false;
}
}

View File

@@ -41,7 +41,7 @@ public class InputCleanup extends Input {
/** {@inheritDoc} */
@Override
public final void showMessage() {
final Player active = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final Player active = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
if (active.isComputer()) {
this.aiCleanupDiscard(active);
return;
@@ -53,8 +53,8 @@ public class InputCleanup extends Input {
if (n <= max || max <= -1) {
CombatUtil.removeAllDamage();
Singletons.getModel().getGameState().getPhaseHandler().setNeedToNextPhase(true);
Singletons.getModel().getGameState().getPhaseHandler().nextPhase(); // TODO keep an eye on this code,
Singletons.getModel().getGame().getPhaseHandler().setNeedToNextPhase(true);
Singletons.getModel().getGame().getPhaseHandler().nextPhase(); // TODO keep an eye on this code,
// see if we can get rid of it.
return;
}
@@ -73,7 +73,7 @@ public class InputCleanup extends Input {
public final void selectCard(final Card card, final PlayerZone zone) {
if (zone.is(ZoneType.Hand, Singletons.getControl().getPlayer())) {
card.getController().discard(card, null);
if (Singletons.getModel().getGameState().getStack().size() == 0) {
if (Singletons.getModel().getGame().getStack().size() == 0) {
this.showMessage();
}
}
@@ -93,6 +93,6 @@ public class InputCleanup extends Input {
}
CombatUtil.removeAllDamage();
Singletons.getModel().getGameState().getPhaseHandler().setNeedToNextPhase(true);
Singletons.getModel().getGame().getPhaseHandler().setNeedToNextPhase(true);
}
}

View File

@@ -61,7 +61,7 @@ public class InputMulligan extends Input {
VMatchUI.SINGLETON_INSTANCE.getBtnCancel().setText("Yes");
final String str =
(Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn().equals(Singletons.getControl().getPlayer())
(Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn().equals(Singletons.getControl().getPlayer())
? "You're going first. " : "The computer is going first. ");
CMatchUI.SINGLETON_INSTANCE.showMessage(str + "Do you want to Mulligan?");
}
@@ -90,7 +90,7 @@ public class InputMulligan extends Input {
final void end() {
// Computer mulligan
for (Player ai : Singletons.getModel().getGameState().getPlayers()) {
for (Player ai : Singletons.getModel().getGame().getPlayers()) {
if ( ai.isHuman() ) continue;
boolean aiTakesMulligan = true;
@@ -113,8 +113,8 @@ public class InputMulligan extends Input {
ButtonUtil.reset();
final AbilityFactory af = new AbilityFactory();
final GameAction ga = Singletons.getModel().getGameAction();
for (Player p : Singletons.getModel().getGameState().getPlayers()) {
final GameAction ga = Singletons.getModel().getGame().getAction();
for (Player p : Singletons.getModel().getGame().getPlayers()) {
final List<Card> openingHand = p.getCardsIn(ZoneType.Hand);
for (final Card c : openingHand) {
@@ -159,7 +159,7 @@ public class InputMulligan extends Input {
}
}
if (c.getName().startsWith("Leyline")
&& !(c.getName().startsWith("Leyline of Singularity") && (CardLists.filter(Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Leyline of Singularity")).size() > 0))) {
&& !(c.getName().startsWith("Leyline of Singularity") && (CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Leyline of Singularity")).size() > 0))) {
ga.moveToPlay(c);
//ga.checkStateEffects();
}
@@ -170,12 +170,12 @@ public class InputMulligan extends Input {
ga.checkStateEffects();
Singletons.getModel().getGameState().getGameLog().add("Turn",
"Turn " + Singletons.getModel().getGameState().getPhaseHandler().getTurn()
+ " (" + Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn() + ")",
Singletons.getModel().getGame().getGameLog().add("Turn",
"Turn " + Singletons.getModel().getGame().getPhaseHandler().getTurn()
+ " (" + Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn() + ")",
0);
Singletons.getModel().getGameState().getPhaseHandler().setNeedToNextPhase(false);
PhaseUtil.visuallyActivatePhase(Singletons.getModel().getGameState().getPhaseHandler().getPhase());
Singletons.getModel().getGame().getPhaseHandler().setNeedToNextPhase(false);
PhaseUtil.visuallyActivatePhase(Singletons.getModel().getGame().getPhaseHandler().getPhase());
this.stop();
}
@@ -187,7 +187,7 @@ public class InputMulligan extends Input {
if (GameActionUtil.showYesNoDialog(c0, "Use " + c0.getName() + "'s ability?")) {
List<Card> hand = c0.getController().getCardsIn(ZoneType.Hand);
for (Card c : hand) {
Singletons.getModel().getGameAction().exile(c);
Singletons.getModel().getGame().getAction().exile(c);
}
c0.getController().drawCards(hand.size());
}

View File

@@ -46,8 +46,8 @@ public class InputPassPriority extends Input implements java.io.Serializable {
GuiDisplayUtil.updateGUI();
ButtonUtil.enableOnlyOK();
final PhaseType phase = Singletons.getModel().getGameState().getPhaseHandler().getPhase();
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPriorityPlayer();
final PhaseType phase = Singletons.getModel().getGame().getPhaseHandler().getPhase();
final Player player = Singletons.getModel().getGame().getPhaseHandler().getPriorityPlayer();
if (player.isComputer()) {
System.out.println(phase + ": Computer in passpriority");
@@ -55,11 +55,11 @@ public class InputPassPriority extends Input implements java.io.Serializable {
final StringBuilder sb = new StringBuilder();
sb.append("Turn : ").append(Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn()).append("\n");
sb.append("Turn : ").append(Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn()).append("\n");
sb.append("Phase: ").append(phase.Name).append("\n");
sb.append("Stack: ");
if (Singletons.getModel().getGameState().getStack().size() != 0) {
sb.append(Singletons.getModel().getGameState().getStack().size()).append(" to Resolve.");
if (Singletons.getModel().getGame().getStack().size() != 0) {
sb.append(Singletons.getModel().getGame().getStack().size()).append(" to Resolve.");
} else {
sb.append("Empty");
}
@@ -72,7 +72,7 @@ public class InputPassPriority extends Input implements java.io.Serializable {
/** {@inheritDoc} */
@Override
public final void selectButtonOK() {
Singletons.getModel().getGameState().getPhaseHandler().passPriority();
Singletons.getModel().getGame().getPhaseHandler().passPriority();
//GuiDisplayUtil.updateGUI();
final Input in = Singletons.getModel().getMatch().getInput().getInput();
if ((in == this) || (in == null)) {
@@ -84,8 +84,8 @@ public class InputPassPriority extends Input implements java.io.Serializable {
/** {@inheritDoc} */
@Override
public final void selectCard(final Card card, final PlayerZone zone) {
if (Singletons.getModel().getGameAction().playCard(card)) {
Singletons.getModel().getGameState().getPhaseHandler().setPriority(Singletons.getControl().getPlayer());
if (Singletons.getModel().getGame().getAction().playCard(card)) {
Singletons.getModel().getGame().getPhaseHandler().setPriority(Singletons.getControl().getPlayer());
}
else {
SDisplayUtil.remind(VMessage.SINGLETON_INSTANCE);

View File

@@ -74,16 +74,16 @@ public class InputPayManaCost extends InputMana {
this.spell = sa;
if (Singletons.getModel().getGameState() != null) {
if (Singletons.getModel().getGame() != null) {
if (sa.getSourceCard().isCopiedSpell() && sa.isSpell()) {
if (this.spell.getAfterPayMana() != null) {
this.stopSetNext(this.spell.getAfterPayMana());
} else {
this.manaCost = new ManaCost("0");
Singletons.getModel().getGameState().getStack().add(this.spell);
Singletons.getModel().getGame().getStack().add(this.spell);
}
} else {
this.manaCost = Singletons.getModel().getGameAction().getSpellCostChange(sa, new ManaCost(this.originalManaCost));
this.manaCost = Singletons.getModel().getGame().getAction().getSpellCostChange(sa, new ManaCost(this.originalManaCost));
}
} else {
this.manaCost = new ManaCost(sa.getManaCost());
@@ -119,13 +119,13 @@ public class InputPayManaCost extends InputMana {
this.spell = sa;
if (Singletons.getModel().getGameState() != null ) {
if (Singletons.getModel().getGame() != null ) {
if (sa.getSourceCard().isCopiedSpell() && sa.isSpell()) {
if (this.spell.getAfterPayMana() != null) {
this.stopSetNext(this.spell.getAfterPayMana());
} else {
this.manaCost = new ManaCost("0");
Singletons.getModel().getGameState().getStack().add(this.spell);
Singletons.getModel().getGame().getStack().add(this.spell);
}
} else {
this.manaCost = manaCostToPay;
@@ -216,7 +216,7 @@ public class InputPayManaCost extends InputMana {
// if this is a spell, move it to the Stack ZOne
if (this.spell.isSpell()) {
this.spell.setSourceCard(Singletons.getModel().getGameAction().moveToStack(this.originalCard));
this.spell.setSourceCard(Singletons.getModel().getGame().getAction().moveToStack(this.originalCard));
}
if (this.spell.getAfterPayMana() != null) {
@@ -225,7 +225,7 @@ public class InputPayManaCost extends InputMana {
if (this.skipStack) {
this.spell.resolve();
} else {
Singletons.getModel().getGameState().getStack().add(this.spell);
Singletons.getModel().getGame().getStack().add(this.spell);
}
Singletons.getModel().getMatch().getInput().resetInput();
}
@@ -239,12 +239,12 @@ public class InputPayManaCost extends InputMana {
// tapped for convoke)
if (this.spell.getTappedForConvoke() != null) {
Singletons.getModel().getGameState().getTriggerHandler().suppressMode(TriggerType.Untaps);
Singletons.getModel().getGame().getTriggerHandler().suppressMode(TriggerType.Untaps);
for (final Card c : this.spell.getTappedForConvoke()) {
c.untap();
c.tap();
}
Singletons.getModel().getGameState().getTriggerHandler().clearSuppression(TriggerType.Untaps);
Singletons.getModel().getGame().getTriggerHandler().clearSuppression(TriggerType.Untaps);
this.spell.clearTappedForConvoke();
}
}
@@ -255,11 +255,11 @@ public class InputPayManaCost extends InputMana {
public final void selectButtonCancel() {
// If this is a spell with convoke, untap all creatures used for it.
if (this.spell.getTappedForConvoke() != null) {
Singletons.getModel().getGameState().getTriggerHandler().suppressMode(TriggerType.Untaps);
Singletons.getModel().getGame().getTriggerHandler().suppressMode(TriggerType.Untaps);
for (final Card c : this.spell.getTappedForConvoke()) {
c.untap();
}
Singletons.getModel().getGameState().getTriggerHandler().clearSuppression(TriggerType.Untaps);
Singletons.getModel().getGame().getTriggerHandler().clearSuppression(TriggerType.Untaps);
this.spell.clearTappedForConvoke();
}

View File

@@ -203,7 +203,7 @@ public class InputPayManaCostUtil {
// save off color needed for use by any mana and reflected mana
chosen.setExpressChoice(colorsNeeded);
Singletons.getModel().getGameAction().playSpellAbility(chosen);
Singletons.getModel().getGame().getAction().playSpellAbility(chosen);
manaCost = Singletons.getControl().getPlayer().getManaPool().payManaFromAbility(sa, manaCost, chosen);
@@ -468,7 +468,7 @@ public class InputPayManaCostUtil {
final int manaToAdd) {
final ManaCost manaCost;
if (Singletons.getModel().getGameState() != null ) {
if (Singletons.getModel().getGame() != null ) {
final String mana = costMana.getManaToPay();
manaCost = new ManaCost(mana);
manaCost.increaseColorlessMana(manaToAdd);
@@ -545,12 +545,12 @@ public class InputPayManaCostUtil {
// being tapped for convoke)
if (sa.getTappedForConvoke() != null) {
Singletons.getModel().getGameState().getTriggerHandler().suppressMode(TriggerType.Untaps);
Singletons.getModel().getGame().getTriggerHandler().suppressMode(TriggerType.Untaps);
for (final Card c : sa.getTappedForConvoke()) {
c.untap();
c.tap();
}
Singletons.getModel().getGameState().getTriggerHandler().clearSuppression(TriggerType.Untaps);
Singletons.getModel().getGame().getTriggerHandler().clearSuppression(TriggerType.Untaps);
sa.clearTappedForConvoke();
}
@@ -561,11 +561,11 @@ public class InputPayManaCostUtil {
// If we're paying for a spell with convoke, untap all creatures
// used for it.
if (sa.getTappedForConvoke() != null) {
Singletons.getModel().getGameState().getTriggerHandler().suppressMode(TriggerType.Untaps);
Singletons.getModel().getGame().getTriggerHandler().suppressMode(TriggerType.Untaps);
for (final Card c : sa.getTappedForConvoke()) {
c.untap();
}
Singletons.getModel().getGameState().getTriggerHandler().clearSuppression(TriggerType.Untaps);
Singletons.getModel().getGame().getTriggerHandler().clearSuppression(TriggerType.Untaps);
sa.clearTappedForConvoke();
}

View File

@@ -166,7 +166,7 @@ public class InputPayReturnCost extends Input {
// actually sacrifice the cards
for (Card selected : this.returnCost.getList()) {
selected.setUsedToPay(false);
Singletons.getModel().getGameAction().moveTo(ZoneType.Hand, selected);
Singletons.getModel().getGame().getAction().moveTo(ZoneType.Hand, selected);
}
this.returnCost.addListToHash(ability, "Returned");
this.paid.execute();

View File

@@ -167,7 +167,7 @@ public class InputPaySacCost extends Input {
// actually sacrifice the cards
for (Card selected : this.sacCost.getList()) {
selected.setUsedToPay(false);
Singletons.getModel().getGameAction().sacrifice(selected, this.ability);
Singletons.getModel().getGame().getAction().sacrifice(selected, this.ability);
}
this.sacCost.addListToHash(ability, "Sacrificed");
this.paid.execute();

View File

@@ -95,21 +95,19 @@ public class GameNew {
* TODO: Accept something like match state as parameter. Match should be aware of players,
* their decks and other special starting conditions.
*/
public static void newGame(final Map<Player, PlayerStartConditions> playersConditions, GameType gameType) {
public static void newGame(final Map<Player, PlayerStartConditions> playersConditions, final GameState game, final boolean canRandomFoil ) {
Singletons.getModel().getMatch().getInput().clearInput();
Card.resetUniqueNumber();
// need this code here, otherwise observables fail
forge.card.trigger.Trigger.resetIDs();
Singletons.getModel().getGameState().getTriggerHandler().clearTriggerSettings();
Singletons.getModel().getGameState().getTriggerHandler().clearDelayedTrigger();
game.getTriggerHandler().clearTriggerSettings();
game.getTriggerHandler().clearDelayedTrigger();
// friendliness
final Map<Player, List<String>> removedAnteCards = new HashMap<Player, List<String>>();
final List<String> rAICards = new ArrayList<String>();
final boolean canRandomFoil = Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_RANDOM_FOIL) && gameType == GameType.Constructed;
for( Entry<Player, PlayerStartConditions> p : playersConditions.entrySet() ) {
final Player player = p.getKey();
player.setStartingLife(p.getValue().getStartingLife());
@@ -147,7 +145,7 @@ public class GameNew {
JOptionPane.showMessageDialog(null, ante.toString(), "", JOptionPane.INFORMATION_MESSAGE);
}
GameNew.actuateGame();
GameNew.actuateGame(game);
}
/**
@@ -157,22 +155,22 @@ public class GameNew {
* That process (also cleanup and observer updates) should be done in
* newGame, then when all is ready, call this function.
*/
private static void actuateGame() {
private static void actuateGame(final GameState game) {
// Deciding which cards go to ante
if (Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_ANTE)) {
final String nl = System.getProperty("line.separator");
final StringBuilder msg = new StringBuilder();
for (final Player p : Singletons.getModel().getGameState().getPlayers()) {
for (final Player p : game.getPlayers()) {
final List<Card> lib = p.getCardsIn(ZoneType.Library);
Predicate<Card> goodForAnte = Predicates.not(CardPredicates.Presets.BASIC_LANDS);
Card ante = Aggregates.random(Iterables.filter(lib, goodForAnte));
if (ante == null) {
throw new RuntimeException(p + " library is empty.");
}
Singletons.getModel().getGameState().getGameLog().add("Ante", p + " anted " + ante, 0);
game.getGameLog().add("Ante", p + " anted " + ante, 0);
VAntes.SINGLETON_INSTANCE.addAnteCard(p, ante);
Singletons.getModel().getGameAction().moveTo(ZoneType.Ante, ante);
game.getAction().moveTo(ZoneType.Ante, ante);
msg.append(p.getName()).append(" ante: ").append(ante).append(nl);
}
JOptionPane.showMessageDialog(null, msg, "Ante", JOptionPane.INFORMATION_MESSAGE);
@@ -192,7 +190,7 @@ public class GameNew {
// Draw 7 cards
for (final Player p : Singletons.getModel().getGameState().getPlayers())
for (final Player p : game.getPlayers())
{
for (int i = 0; i < 7; i++) {
p.drawCard();
@@ -285,7 +283,7 @@ public class GameNew {
computerDie = MyRandom.getRandom().nextInt(20);
}
List<Player> allPlayers = Singletons.getModel().getGameState().getPlayers();
List<Player> allPlayers = Singletons.getModel().getGame().getPlayers();
setPlayersFirstTurn(allPlayers.get(MyRandom.getRandom().nextInt(allPlayers.size())));
}
@@ -298,7 +296,7 @@ public class GameNew {
} else {
computerPlayOrDraw(message);
}
Singletons.getModel().getGameState().getPhaseHandler().setPlayerTurn(goesFirst);
Singletons.getModel().getGame().getPhaseHandler().setPlayerTurn(goesFirst);
} // seeWhoPlaysFirstDice()
private static boolean humanPlayOrDraw(String message) {

View File

@@ -26,6 +26,7 @@ import forge.Card;
import forge.CardLists;
import forge.CardPredicates.Presets;
import forge.ColorChanger;
import forge.GameAction;
import forge.GameLog;
import forge.StaticEffects;
import forge.card.replacement.ReplacementHandler;
@@ -41,6 +42,7 @@ import forge.game.player.LobbyPlayer;
import forge.game.player.Player;
import forge.game.zone.PlayerZone;
import forge.game.zone.MagicStack;
import forge.game.zone.Zone;
import forge.game.zone.ZoneType;
/**
@@ -55,19 +57,21 @@ public class GameState {
private final Untap untap = new Untap();
private final Upkeep upkeep = new Upkeep();
private PhaseHandler phaseHandler = new PhaseHandler();
private final MagicStack stack = new MagicStack();
private final MagicStack stack;
private final StaticEffects staticEffects = new StaticEffects();
private final TriggerHandler triggerHandler = new TriggerHandler();
private final ReplacementHandler replacementHandler = new ReplacementHandler();
private Combat combat = new Combat();
private final GameLog gameLog = new GameLog();
private final ColorChanger colorChanger = new ColorChanger();
private boolean gameOver = false;
private final PlayerZone stackZone = new PlayerZone(ZoneType.Stack, null);
private final Zone stackZone = new Zone(ZoneType.Stack);
private long timestamp = 0;
private int nTurn = 0;
private final GameAction action;
/**
* Constructor.
@@ -79,6 +83,8 @@ public class GameState {
players.add(p.getIngamePlayer());
}
roPlayers = Collections.unmodifiableList(players);
action = new GameAction(this);
stack = new MagicStack(this);
}
/**
@@ -204,7 +210,7 @@ public class GameState {
*
* @return the stackZone
*/
public final PlayerZone getStackZone() {
public final Zone getStackZone() {
return this.stackZone;
}
@@ -281,7 +287,7 @@ public class GameState {
// THESE WERE MOVED HERE FROM AllZoneUtil
// They must once become non-static members of this class
public PlayerZone getZoneOf(final Card c) {
public Zone getZoneOf(final Card c) {
if (getStackZone().contains(c)) {
return getStackZone();
}
@@ -430,4 +436,8 @@ public class GameState {
public ColorChanger getColorChanger() {
return colorChanger;
}
public GameAction getAction() {
return action;
}
}

View File

@@ -30,6 +30,7 @@ import forge.gui.match.controllers.CStack;
import forge.gui.match.nonsingleton.VField;
import forge.gui.match.views.VAntes;
import forge.gui.toolbox.FLabel;
import forge.properties.ForgePreferences.FPref;
import forge.util.Aggregates;
/**
@@ -121,8 +122,8 @@ public class MatchController {
currentGame.getStack().addObserver(CStack.SINGLETON_INSTANCE);
// some observers are set in CMatchUI.initMatch
GameNew.newGame(startConditions, gameType);
final boolean canRandomFoil = Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_RANDOM_FOIL) && gameType == GameType.Constructed;
GameNew.newGame(startConditions, currentGame, canRandomFoil);
Player computerPlayer = Aggregates.firstFieldEquals(currentGame.getPlayers(), Player.Accessors.FN_GET_TYPE, PlayerType.COMPUTER);
input.setComputer(new ComputerAIInput(new ComputerAIGeneral(computerPlayer)));
@@ -138,7 +139,7 @@ public class MatchController {
}
VAntes.SINGLETON_INSTANCE.clearAnteCards();
Singletons.getModel().getMatch().getInput().resetInput();
input.resetInput();
}
// per player observers were set in CMatchUI.SINGLETON_INSTANCE.initMatch

View File

@@ -94,7 +94,7 @@ public class Combat {
this.currentDefender = 0;
this.nextDefender = 0;
this.initiatePossibleDefenders(Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn().getOpponent());
this.initiatePossibleDefenders(Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn().getOpponent());
}
/**
@@ -261,7 +261,7 @@ public class Combat {
if (this.attackingPlayer != null) {
return this.attackingPlayer;
} else {
return Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
return Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
}
}
@@ -276,7 +276,7 @@ public class Combat {
if (this.attackingPlayer != null) {
return this.defendingPlayer;
} else {
return Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn().getOpponent();
return Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn().getOpponent();
}
}
@@ -581,7 +581,7 @@ public class Combat {
} else if (this.blockerMap.containsKey(c)) { // card is a blocker
List<Card> attackers = this.blockerMap.get(c);
boolean stillDeclaring = Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS);
boolean stillDeclaring = Singletons.getModel().getGame().getPhaseHandler().is(PhaseType.COMBAT_DECLARE_BLOCKERS);
this.blockerMap.remove(c);
for (Card a : attackers) {
this.attackerMap.get(a).remove(c);
@@ -648,7 +648,7 @@ public class Combat {
// Run Unblocked Trigger
final HashMap<String, Object> runParams = new HashMap<String, Object>();
runParams.put("Attacker", attacker);
Singletons.getModel().getGameState().getTriggerHandler().runTrigger(TriggerType.AttackerUnblocked, runParams);
Singletons.getModel().getGame().getTriggerHandler().runTrigger(TriggerType.AttackerUnblocked, runParams);
}
}
@@ -835,17 +835,17 @@ public class Combat {
*/
public static void dealAssignedDamage() {
// This function handles both Regular and First Strike combat assignment
final Player player = Singletons.getModel().getGameState().getCombat().getDefendingPlayer();
final Player player = Singletons.getModel().getGame().getCombat().getDefendingPlayer();
final boolean bFirstStrike = Singletons.getModel().getGameState().getPhaseHandler().is(PhaseType.COMBAT_FIRST_STRIKE_DAMAGE);
final boolean bFirstStrike = Singletons.getModel().getGame().getPhaseHandler().is(PhaseType.COMBAT_FIRST_STRIKE_DAMAGE);
final HashMap<Card, Integer> defMap = Singletons.getModel().getGameState().getCombat().getDefendingDamageMap();
final HashMap<Card, Integer> defMap = Singletons.getModel().getGame().getCombat().getDefendingDamageMap();
for (final Entry<Card, Integer> entry : defMap.entrySet()) {
player.addCombatDamage(entry.getValue(), entry.getKey());
}
final List<Card> unblocked = new ArrayList<Card>(bFirstStrike ? Singletons.getModel().getGameState().getCombat().getUnblockedAttackers() : Singletons.getModel().getGameState().getCombat().getUnblockedFirstStrikeAttackers());
final List<Card> unblocked = new ArrayList<Card>(bFirstStrike ? Singletons.getModel().getGame().getCombat().getUnblockedAttackers() : Singletons.getModel().getGame().getCombat().getUnblockedFirstStrikeAttackers());
for (int j = 0; j < unblocked.size(); j++) {
if (bFirstStrike) {
@@ -860,9 +860,9 @@ public class Combat {
// this can be much better below here...
final List<Card> combatants = new ArrayList<Card>();
combatants.addAll(Singletons.getModel().getGameState().getCombat().getAttackers());
combatants.addAll(Singletons.getModel().getGameState().getCombat().getAllBlockers());
combatants.addAll(Singletons.getModel().getGameState().getCombat().getDefendingPlaneswalkers());
combatants.addAll(Singletons.getModel().getGame().getCombat().getAttackers());
combatants.addAll(Singletons.getModel().getGame().getCombat().getAllBlockers());
combatants.addAll(Singletons.getModel().getGame().getCombat().getDefendingPlaneswalkers());
Card c;
for (int i = 0; i < combatants.size(); i++) {

View File

@@ -98,7 +98,7 @@ public class CombatUtil {
return false;
}
for (final Card c : Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield)) {
for (final Card c : Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield)) {
for (final String keyword : c.getKeyword()) {
if (keyword.equals("No more than one creature can block each combat.")
&& (combat.getAllBlockers().size() > 0)) {
@@ -111,7 +111,7 @@ public class CombatUtil {
}
}
if (combat.getAllBlockers().size() > 0 && Singletons.getModel().getGameState().isCardInPlay("Dueling Grounds")) {
if (combat.getAllBlockers().size() > 0 && Singletons.getModel().getGame().isCardInPlay("Dueling Grounds")) {
return false;
}
@@ -758,7 +758,7 @@ public class CombatUtil {
return false;
}
if (Singletons.getModel().getGameState().isCardInPlay("Shifting Sliver")) {
if (Singletons.getModel().getGame().isCardInPlay("Shifting Sliver")) {
if (attacker.isType("Sliver") && !blocker.isType("Sliver")) {
return false;
}
@@ -782,7 +782,7 @@ public class CombatUtil {
public static boolean canAttack(final Card c, final Combat combat) {
int cntAttackers = combat.getAttackers().size();
for (final Card card : Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield)) {
for (final Card card : Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield)) {
for (final String keyword : card.getKeyword()) {
if (keyword.equals("No more than one creature can attack each combat.") && cntAttackers > 0) {
return false;
@@ -809,7 +809,7 @@ public class CombatUtil {
return false;
}
if (cntAttackers > 0 && Singletons.getModel().getGameState().isCardInPlay("Dueling Grounds")) {
if (cntAttackers > 0 && Singletons.getModel().getGame().isCardInPlay("Dueling Grounds")) {
return false;
}
@@ -829,7 +829,7 @@ public class CombatUtil {
public static boolean canAttack(final Card c) {
if (c.isTapped() || c.isPhasedOut()
|| (c.hasSickness() && !c.hasKeyword("CARDNAME can attack as though it had haste."))
|| Singletons.getModel().getGameState().getPhaseHandler().getPhase()
|| Singletons.getModel().getGame().getPhaseHandler().getPhase()
.isAfter(PhaseType.COMBAT_DECLARE_ATTACKERS)) {
return false;
}
@@ -1319,7 +1319,7 @@ public class CombatUtil {
}
int defenderDamage = defender.getNetAttack() + CombatUtil.predictPowerBonusOfBlocker(attacker, defender, true);
if (Singletons.getModel().getGameState().isCardInPlay("Doran, the Siege Tower")) {
if (Singletons.getModel().getGame().isCardInPlay("Doran, the Siege Tower")) {
defenderDamage = defender.getNetDefense() + CombatUtil.predictToughnessBonusOfBlocker(attacker, defender, true);
}
@@ -1426,10 +1426,10 @@ public class CombatUtil {
* @return a boolean.
*/
public static boolean attackerWouldBeDestroyed(final Card attacker) {
final List<Card> blockers = Singletons.getModel().getGameState().getCombat().getBlockers(attacker);
final List<Card> blockers = Singletons.getModel().getGame().getCombat().getBlockers(attacker);
for (final Card defender : blockers) {
if (CombatUtil.canDestroyAttacker(attacker, defender, Singletons.getModel().getGameState().getCombat(), true)
if (CombatUtil.canDestroyAttacker(attacker, defender, Singletons.getModel().getGame().getCombat(), true)
&& !(defender.hasKeyword("Wither") || defender.hasKeyword("Infect"))) {
return true;
}
@@ -1460,10 +1460,10 @@ public class CombatUtil {
boolean willTrigger = false;
final Card source = trigger.getHostCard();
if (combat == null) {
combat = Singletons.getModel().getGameState().getCombat();
combat = Singletons.getModel().getGame().getCombat();
}
if (!trigger.zonesCheck(Singletons.getModel().getGameState().getZoneOf(trigger.getHostCard()))) {
if (!trigger.zonesCheck(Singletons.getModel().getGame().getZoneOf(trigger.getHostCard()))) {
return false;
}
if (!trigger.requirementsCheck()) {
@@ -1579,7 +1579,7 @@ public class CombatUtil {
// look out for continuous static abilities that only care for blocking
// creatures
final List<Card> cardList = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
final List<Card> cardList = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
for (final Card card : cardList) {
for (final StaticAbility stAb : card.getStaticAbilities()) {
final HashMap<String, String> params = stAb.getMapParams();
@@ -1606,7 +1606,7 @@ public class CombatUtil {
}
final ArrayList<Trigger> theTriggers = new ArrayList<Trigger>();
for (Card card : Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield)) {
for (Card card : Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield)) {
theTriggers.addAll(card.getTriggers());
}
theTriggers.addAll(attacker.getTriggers());
@@ -1705,7 +1705,7 @@ public class CombatUtil {
toughness += defender.getKeywordMagnitude("Bushido");
final ArrayList<Trigger> theTriggers = new ArrayList<Trigger>();
for (Card card : Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield)) {
for (Card card : Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield)) {
theTriggers.addAll(card.getTriggers());
}
theTriggers.addAll(attacker.getTriggers());
@@ -1827,7 +1827,7 @@ public class CombatUtil {
}
final ArrayList<Trigger> theTriggers = new ArrayList<Trigger>();
for (Card card : Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield)) {
for (Card card : Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield)) {
theTriggers.addAll(card.getTriggers());
}
// if the defender has first strike and wither the attacker will deal
@@ -1844,7 +1844,7 @@ public class CombatUtil {
// look out for continuous static abilities that only care for attacking
// creatures
final List<Card> cardList = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
final List<Card> cardList = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
for (final Card card : cardList) {
for (final StaticAbility stAb : card.getStaticAbilities()) {
final HashMap<String, String> params = stAb.getMapParams();
@@ -1959,7 +1959,7 @@ public class CombatUtil {
}
final ArrayList<Trigger> theTriggers = new ArrayList<Trigger>();
for (Card card : Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield)) {
for (Card card : Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield)) {
theTriggers.addAll(card.getTriggers());
}
if (defender != null) {
@@ -1969,7 +1969,7 @@ public class CombatUtil {
// look out for continuous static abilities that only care for attacking
// creatures
final List<Card> cardList = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
final List<Card> cardList = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
for (final Card card : cardList) {
for (final StaticAbility stAb : card.getStaticAbilities()) {
final HashMap<String, String> params = stAb.getMapParams();
@@ -2090,7 +2090,7 @@ public class CombatUtil {
*/
public static boolean checkDestroyBlockerTrigger(final Card attacker, final Card defender) {
final ArrayList<Trigger> theTriggers = new ArrayList<Trigger>();
for (Card card : Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield)) {
for (Card card : Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield)) {
theTriggers.addAll(card.getTriggers());
}
for (Trigger trigger : theTriggers) {
@@ -2145,7 +2145,7 @@ public class CombatUtil {
*/
public static boolean checkDestroyAttackerTrigger(final Card attacker, final Card defender) {
final ArrayList<Trigger> theTriggers = new ArrayList<Trigger>();
for (Card card : Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield)) {
for (Card card : Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield)) {
theTriggers.addAll(card.getTriggers());
}
for (Trigger trigger : theTriggers) {
@@ -2239,7 +2239,7 @@ public class CombatUtil {
+ CombatUtil.predictPowerBonusOfBlocker(attacker, defender, withoutAbilities);
int attackerDamage = attacker.getNetAttack()
+ CombatUtil.predictPowerBonusOfAttacker(attacker, defender, combat);
if (Singletons.getModel().getGameState().isCardInPlay("Doran, the Siege Tower")) {
if (Singletons.getModel().getGame().isCardInPlay("Doran, the Siege Tower")) {
defenderDamage = defender.getNetDefense()
+ CombatUtil.predictToughnessBonusOfBlocker(attacker, defender, withoutAbilities);
attackerDamage = attacker.getNetDefense()
@@ -2327,10 +2327,10 @@ public class CombatUtil {
public static boolean blockerWouldBeDestroyed(final Card blocker) {
// TODO THis function only checks if a single attacker at a time would destroy a blocker
// This needs to expand to tally up damage
final List<Card> attackers = Singletons.getModel().getGameState().getCombat().getAttackersBlockedBy(blocker);
final List<Card> attackers = Singletons.getModel().getGame().getCombat().getAttackersBlockedBy(blocker);
for(Card attacker : attackers) {
if (CombatUtil.canDestroyBlocker(blocker, attacker, Singletons.getModel().getGameState().getCombat(), true)
if (CombatUtil.canDestroyBlocker(blocker, attacker, Singletons.getModel().getGame().getCombat(), true)
&& !(attacker.hasKeyword("Wither") || attacker.hasKeyword("Infect"))) {
return true;
}
@@ -2387,7 +2387,7 @@ public class CombatUtil {
+ CombatUtil.predictPowerBonusOfBlocker(attacker, defender, withoutAbilities);
int attackerDamage = attacker.getNetAttack()
+ CombatUtil.predictPowerBonusOfAttacker(attacker, defender, combat);
if (Singletons.getModel().getGameState().isCardInPlay("Doran, the Siege Tower")) {
if (Singletons.getModel().getGame().isCardInPlay("Doran, the Siege Tower")) {
defenderDamage = defender.getNetDefense()
+ CombatUtil.predictToughnessBonusOfBlocker(attacker, defender, withoutAbilities);
attackerDamage = attacker.getNetDefense()
@@ -2476,7 +2476,7 @@ public class CombatUtil {
* </p>
*/
public static void removeAllDamage() {
final List<Card> cl = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
final List<Card> cl = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
for (final Card c : cl) {
c.setDamage(0);
}
@@ -2492,7 +2492,7 @@ public class CombatUtil {
// Loop through Defenders
// Append Defending Player/Planeswalker
final Combat combat = Singletons.getModel().getGameState().getCombat();
final Combat combat = Singletons.getModel().getGame().getCombat();
final List<GameEntity> defenders = combat.getDefenders();
final List<List<Card>> attackers = combat.sortAttackerByDefender();
@@ -2526,7 +2526,7 @@ public class CombatUtil {
// Loop through Defenders
// Append Defending Player/Planeswalker
final Combat combat = Singletons.getModel().getGameState().getCombat();
final Combat combat = Singletons.getModel().getGame().getCombat();
final List<GameEntity> defenders = combat.getDefenders();
final List<List<Card>> attackers = combat.sortAttackerByDefender();
@@ -2537,7 +2537,7 @@ public class CombatUtil {
for (final Card attacker : list) {
sb.append(combat.getDefendingPlayer()).append(" assigned ");
defend = Singletons.getModel().getGameState().getCombat().getBlockers(attacker);
defend = Singletons.getModel().getGame().getCombat().getBlockers(attacker);
if (!defend.isEmpty()) {
// loop through blockers
@@ -2564,15 +2564,15 @@ public class CombatUtil {
// TODO(sol) ShowCombat seems to be resetting itself when switching away and switching back?
final StringBuilder display = new StringBuilder();
if (!Singletons.getModel().getGameState().getPhaseHandler().inCombat()) {
if (!Singletons.getModel().getGame().getPhaseHandler().inCombat()) {
VCombat.SINGLETON_INSTANCE.updateCombat(display.toString().trim());
return;
}
// Loop through Defenders
// Append Defending Player/Planeswalker
final List<GameEntity> defenders = Singletons.getModel().getGameState().getCombat().getDefenders();
final List<List<Card>> attackers = Singletons.getModel().getGameState().getCombat().sortAttackerByDefender();
final List<GameEntity> defenders = Singletons.getModel().getGame().getCombat().getDefenders();
final List<List<Card>> attackers = Singletons.getModel().getGame().getCombat().sortAttackerByDefender();
// Not a big fan of the triple nested loop here
for (int def = 0; def < defenders.size(); def++) {
@@ -2594,7 +2594,7 @@ public class CombatUtil {
display.append("-> ");
display.append(CombatUtil.combatantToString(c)).append("\n");
List<Card> blockers = Singletons.getModel().getGameState().getCombat().getBlockers(c);
List<Card> blockers = Singletons.getModel().getGame().getCombat().getBlockers(c);
// loop through blockers
for (final Card element : blockers) {
@@ -2642,10 +2642,10 @@ public class CombatUtil {
public static void checkPropagandaEffects(final Card c, final boolean bLast) {
Cost attackCost = new Cost(c, "0", true);
// Sort abilities to apply them in proper order
for (Card card : Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield)) {
for (Card card : Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield)) {
final ArrayList<StaticAbility> staticAbilities = card.getStaticAbilities();
for (final StaticAbility stAb : staticAbilities) {
Cost additionalCost = stAb.getCostAbility("CantAttackUnless", c, Singletons.getModel().getGameState().getCombat().getDefenderByAttacker(c));
Cost additionalCost = stAb.getCostAbility("CantAttackUnless", c, Singletons.getModel().getGame().getCombat().getDefenderByAttacker(c));
attackCost = CostUtil.combineCosts(attackCost, additionalCost);
}
}
@@ -2662,7 +2662,7 @@ public class CombatUtil {
final Card crd = c;
final PhaseType phase = Singletons.getModel().getGameState().getPhaseHandler().getPhase();
final PhaseType phase = Singletons.getModel().getGame().getPhaseHandler().getPhase();
if (phase == PhaseType.COMBAT_DECLARE_ATTACKERS || phase == PhaseType.COMBAT_DECLARE_ATTACKERS_INSTANT_ABILITY) {
final Ability ability = new AbilityStatic(c, attackCost, null) {
@@ -2678,7 +2678,7 @@ public class CombatUtil {
@Override
public void execute() {
Singletons.getModel().getGameState().getCombat().removeFromCombat(crd);
Singletons.getModel().getGame().getCombat().removeFromCombat(crd);
if (bLast) {
PhaseUtil.handleAttackingTriggers();
@@ -2713,7 +2713,7 @@ public class CombatUtil {
} else {
// TODO remove the below line after Propaganda occurs
// during Declare_Attackers
Singletons.getModel().getGameState().getCombat().removeFromCombat(crd);
Singletons.getModel().getGame().getCombat().removeFromCombat(crd);
}
if (bLast) {
PhaseUtil.handleAttackingTriggers();
@@ -2735,11 +2735,11 @@ public class CombatUtil {
// Run triggers
final HashMap<String, Object> runParams = new HashMap<String, Object>();
runParams.put("Attacker", c);
final List<Card> otherAttackers = Singletons.getModel().getGameState().getCombat().getAttackerList();
final List<Card> otherAttackers = Singletons.getModel().getGame().getCombat().getAttackerList();
otherAttackers.remove(c);
runParams.put("OtherAttackers", otherAttackers);
runParams.put("Attacked", Singletons.getModel().getGameState().getCombat().getDefenderByAttacker(c));
Singletons.getModel().getGameState().getTriggerHandler().runTrigger(TriggerType.Attacks, runParams);
runParams.put("Attacked", Singletons.getModel().getGame().getCombat().getDefenderByAttacker(c));
Singletons.getModel().getGame().getTriggerHandler().runTrigger(TriggerType.Attacks, runParams);
// Annihilator:
if (!c.getDamageHistory().getCreatureAttackedThisCombat()) {
@@ -2773,7 +2773,7 @@ public class CombatUtil {
ability.setDescription(sb.toString());
ability.setActivatingPlayer(c.getController());
Singletons.getModel().getGameState().getStack().add(ability);
Singletons.getModel().getGame().getStack().add(ability);
} // find
} // for
} // creatureAttacked
@@ -2782,7 +2782,7 @@ public class CombatUtil {
// Mijae Djinn
if (c.getName().equals("Mijae Djinn")) {
if (!GameActionUtil.flipACoin(c.getController(), c)) {
Singletons.getModel().getGameState().getCombat().removeFromCombat(c);
Singletons.getModel().getGame().getCombat().removeFromCombat(c);
c.tap();
}
} // Mijae Djinn
@@ -2807,7 +2807,7 @@ public class CombatUtil {
if (charger.isInPlay()) {
charger.addIntrinsicKeyword("Trample");
Singletons.getModel().getGameState().getEndOfTurn().addUntil(untilEOT);
Singletons.getModel().getGame().getEndOfTurn().addUntil(untilEOT);
}
} // resolve
}; // ability
@@ -2816,7 +2816,7 @@ public class CombatUtil {
sb2.append(c.getName()).append(" - gains trample until end of turn if its power is 10 or greater.");
ability2.setStackDescription(sb2.toString());
Singletons.getModel().getGameState().getStack().add(ability2);
Singletons.getModel().getGame().getStack().add(ability2);
} // Witch-Maw Nephilim
@@ -2834,7 +2834,7 @@ public class CombatUtil {
player.gainLife(top.getBaseDefense(), c);
player.loseLife(top.getBaseAttack(), c);
Singletons.getModel().getGameAction().moveToHand(top);
Singletons.getModel().getGame().getAction().moveToHand(top);
}
}
} // Sapling of Colfenor
@@ -2857,7 +2857,7 @@ public class CombatUtil {
// Run triggers
final HashMap<String, Object> runParams = new HashMap<String, Object>();
runParams.put("Card", c);
Singletons.getModel().getGameState().getTriggerHandler().runTrigger(TriggerType.AttackerUnblocked, runParams);
Singletons.getModel().getGame().getTriggerHandler().runTrigger(TriggerType.AttackerUnblocked, runParams);
}
/**
@@ -2872,7 +2872,7 @@ public class CombatUtil {
for (final Card c : cl) {
if (!c.getDamageHistory().getCreatureBlockedThisCombat()) {
for (final Ability ab : CardFactoryUtil.getBushidoEffects(c)) {
Singletons.getModel().getGameState().getStack().add(ab);
Singletons.getModel().getGame().getStack().add(ab);
}
}
@@ -2898,16 +2898,16 @@ public class CombatUtil {
final HashMap<String, Object> runParams = new HashMap<String, Object>();
runParams.put("Attacker", a);
runParams.put("Blocker", b);
Singletons.getModel().getGameState().getTriggerHandler().runTrigger(TriggerType.Blocks, runParams);
Singletons.getModel().getGame().getTriggerHandler().runTrigger(TriggerType.Blocks, runParams);
if (!a.getDamageHistory().getCreatureGotBlockedThisCombat()) {
final int blockers = Singletons.getModel().getGameState().getCombat().getBlockers(a).size();
final int blockers = Singletons.getModel().getGame().getCombat().getBlockers(a).size();
runParams.put("NumBlockers", blockers);
Singletons.getModel().getGameState().getTriggerHandler().runTrigger(TriggerType.AttackerBlocked, runParams);
Singletons.getModel().getGame().getTriggerHandler().runTrigger(TriggerType.AttackerBlocked, runParams);
// Bushido
for (final Ability ab : CardFactoryUtil.getBushidoEffects(a)) {
Singletons.getModel().getGameState().getStack().add(ab);
Singletons.getModel().getGame().getStack().add(ab);
}
// Rampage
@@ -2919,7 +2919,7 @@ public class CombatUtil {
if (m.find()) {
final String[] k = keyword.split(" ");
final int magnitude = Integer.valueOf(k[1]);
final int numBlockers = Singletons.getModel().getGameState().getCombat().getBlockers(a).size();
final int numBlockers = Singletons.getModel().getGame().getCombat().getBlockers(a).size();
if (numBlockers > 1) {
CombatUtil.executeRampageAbility(a, magnitude, numBlockers);
}
@@ -2961,7 +2961,7 @@ public class CombatUtil {
blocker.addTempAttackBoost(-mag);
blocker.addTempDefenseBoost(-mag);
Singletons.getModel().getGameState().getEndOfTurn().addUntil(untilEOT);
Singletons.getModel().getGame().getEndOfTurn().addUntil(untilEOT);
System.out.println("Flanking!");
}
} // resolve
@@ -2973,7 +2973,7 @@ public class CombatUtil {
ability2.setStackDescription(sb2.toString());
ability2.setDescription(sb2.toString());
Singletons.getModel().getGameState().getStack().add(ability2);
Singletons.getModel().getGame().getStack().add(ability2);
Log.debug("Adding Flanking!");
} // flanking
@@ -3017,7 +3017,7 @@ public class CombatUtil {
crd.addTempAttackBoost(1);
crd.addTempDefenseBoost(1);
Singletons.getModel().getGameState().getEndOfTurn().addUntil(untilEOT);
Singletons.getModel().getGame().getEndOfTurn().addUntil(untilEOT);
}
} // resolve
@@ -3029,13 +3029,13 @@ public class CombatUtil {
ability.setDescription(sb.toString());
ability.setActivatingPlayer(c.getController());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
}
final Player phasingPlayer = c.getController();
// Finest Hour untaps the creature on the first combat phase
if ((phasingPlayer.getCardsIn(ZoneType.Battlefield, "Finest Hour").size() > 0)
&& Singletons.getModel().getGameState().getPhaseHandler().isFirstCombat()) {
&& Singletons.getModel().getGame().getPhaseHandler().isFirstCombat()) {
// Untap the attacking creature
final Ability fhUntap = new Ability(c, "0") {
@Override
@@ -3049,14 +3049,14 @@ public class CombatUtil {
fhUntap.setDescription(sbUntap.toString());
fhUntap.setStackDescription(sbUntap.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(fhUntap);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(fhUntap);
// If any Finest Hours, queue up a new combat phase
for (int ix = 0; ix < phasingPlayer.getCardsIn(ZoneType.Battlefield, "Finest Hour").size(); ix++) {
final Ability fhAddCombat = new Ability(c, "0") {
@Override
public void resolve() {
Singletons.getModel().getGameState().getPhaseHandler().addExtraCombat();
Singletons.getModel().getGame().getPhaseHandler().addExtraCombat();
}
};
@@ -3065,7 +3065,7 @@ public class CombatUtil {
fhAddCombat.setDescription(sbACom.toString());
fhAddCombat.setStackDescription(sbACom.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(fhAddCombat);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(fhAddCombat);
}
}
@@ -3104,7 +3104,7 @@ public class CombatUtil {
enchantment = CardFactoryUtil.getBestEnchantmentAI(enchantments, this, false);
}
if ((enchantment != null) && attacker.isInPlay()) {
Singletons.getModel().getGameAction().changeZone(Singletons.getModel().getGameState().getZoneOf(enchantment),
Singletons.getModel().getGame().getAction().changeZone(Singletons.getModel().getGame().getZoneOf(enchantment),
enchantment.getOwner().getZone(ZoneType.Battlefield), enchantment, null);
enchantment.enchantEntity(attacker);
}
@@ -3119,7 +3119,7 @@ public class CombatUtil {
ability4.setDescription(sb4.toString());
ability4.setStackDescription(sb4.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability4);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability4);
} // For
}
}
@@ -3161,7 +3161,7 @@ public class CombatUtil {
crd.addTempAttackBoost(pump);
crd.addTempDefenseBoost(pump);
Singletons.getModel().getGameState().getEndOfTurn().addUntil(untilEOT);
Singletons.getModel().getGame().getEndOfTurn().addUntil(untilEOT);
}
} // resolve
@@ -3171,7 +3171,7 @@ public class CombatUtil {
sb.append(c).append(" - (Rampage) gets +").append(pump).append("/+").append(pump).append(" until EOT.");
ability.setStackDescription(sb.toString());
Singletons.getModel().getGameState().getStack().add(ability);
Singletons.getModel().getGame().getStack().add(ability);
}
}

View File

@@ -55,15 +55,15 @@ public class EndOfTurn extends Phase implements java.io.Serializable {
// TODO - should this freeze the Stack?
final List<Card> all = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
final List<Card> all = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
//EndOfTurn.endOfTurnWallOfReverence();
EndOfTurn.endOfTurnLighthouseChronologist();
// reset mustAttackEntity for me
Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn().setMustAttackEntity(null);
Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn().setMustAttackEntity(null);
Singletons.getModel().getGameState().getStaticEffects().rePopulateStateBasedList();
Singletons.getModel().getGame().getStaticEffects().rePopulateStateBasedList();
for (final Card c : all) {
if (!c.isFaceDown() && c.hasKeyword("At the beginning of the end step, sacrifice CARDNAME.")) {
@@ -72,7 +72,7 @@ public class EndOfTurn extends Phase implements java.io.Serializable {
@Override
public void resolve() {
if (card.isInPlay()) {
Singletons.getModel().getGameAction().sacrifice(card, null);
Singletons.getModel().getGame().getAction().sacrifice(card, null);
}
}
};
@@ -81,7 +81,7 @@ public class EndOfTurn extends Phase implements java.io.Serializable {
sac.setStackDescription(sb.toString());
sac.setDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(sac);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(sac);
}
if (!c.isFaceDown() && c.hasKeyword("At the beginning of the end step, exile CARDNAME.")) {
@@ -90,7 +90,7 @@ public class EndOfTurn extends Phase implements java.io.Serializable {
@Override
public void resolve() {
if (card.isInPlay()) {
Singletons.getModel().getGameAction().exile(card);
Singletons.getModel().getGame().getAction().exile(card);
}
}
};
@@ -99,7 +99,7 @@ public class EndOfTurn extends Phase implements java.io.Serializable {
exile.setStackDescription(sb.toString());
exile.setDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(exile);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(exile);
}
if (!c.isFaceDown() && c.hasKeyword("At the beginning of the end step, destroy CARDNAME.")) {
@@ -108,7 +108,7 @@ public class EndOfTurn extends Phase implements java.io.Serializable {
@Override
public void resolve() {
if (card.isInPlay()) {
Singletons.getModel().getGameAction().destroy(card);
Singletons.getModel().getGame().getAction().destroy(card);
}
}
};
@@ -117,7 +117,7 @@ public class EndOfTurn extends Phase implements java.io.Serializable {
destroy.setStackDescription(sb.toString());
destroy.setDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(destroy);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(destroy);
}
// Berserk is using this, so don't check isFaceDown()
@@ -128,7 +128,7 @@ public class EndOfTurn extends Phase implements java.io.Serializable {
@Override
public void resolve() {
if (card.isInPlay()) {
Singletons.getModel().getGameAction().destroy(card);
Singletons.getModel().getGame().getAction().destroy(card);
}
}
};
@@ -137,7 +137,7 @@ public class EndOfTurn extends Phase implements java.io.Serializable {
sac.setStackDescription(sb.toString());
sac.setDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(sac);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(sac);
} else {
c.removeAllExtrinsicKeyword("At the beginning of the next end step, "
@@ -165,11 +165,11 @@ public class EndOfTurn extends Phase implements java.io.Serializable {
change.setStackDescription(sb.toString());
change.setDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(change);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(change);
}
if (c.getName().equals("Erg Raiders") && !c.getDamageHistory().getCreatureAttackedThisTurn() && !c.hasSickness()
&& Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(c.getController())) {
&& Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(c.getController())) {
final Card raider = c;
final SpellAbility change = new Ability(raider, "0") {
@Override
@@ -184,17 +184,17 @@ public class EndOfTurn extends Phase implements java.io.Serializable {
change.setStackDescription(sb.toString());
change.setDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(change);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(change);
}
if (c.hasKeyword("At the beginning of your end step, return CARDNAME to its owner's hand.")
&& Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(c.getController())) {
&& Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(c.getController())) {
final Card source = c;
final SpellAbility change = new Ability(source, "0") {
@Override
public void resolve() {
if (source.isInPlay()) {
Singletons.getModel().getGameAction().moveToHand(source);
Singletons.getModel().getGame().getAction().moveToHand(source);
}
}
};
@@ -203,12 +203,12 @@ public class EndOfTurn extends Phase implements java.io.Serializable {
change.setStackDescription(sb.toString());
change.setDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(change);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(change);
}
}
Player activePlayer = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
Player activePlayer = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
if (activePlayer.hasKeyword("At the beginning of this turn's end step, you lose the game.")) {
final Card source = new Card();
final SpellAbility change = new Ability(source, "0") {
@@ -221,7 +221,7 @@ public class EndOfTurn extends Phase implements java.io.Serializable {
change.setDescription("At the beginning of this turn's end step, you lose the game.");
change.setActivatingPlayer(activePlayer);
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(change);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(change);
}
this.execute(this.getAt());
@@ -229,7 +229,7 @@ public class EndOfTurn extends Phase implements java.io.Serializable {
} // executeAt()
private static void endOfTurnLighthouseChronologist() {
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final Player player = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
final Player opponent = player.getOpponent();
List<Card> list = opponent.getCardsIn(ZoneType.Battlefield);
@@ -246,7 +246,7 @@ public class EndOfTurn extends Phase implements java.io.Serializable {
ability = new Ability(list.get(i), "0") {
@Override
public void resolve() {
Singletons.getModel().getGameState().getPhaseHandler().addExtraTurn(card.getController());
Singletons.getModel().getGame().getPhaseHandler().addExtraTurn(card.getController());
}
};
@@ -255,7 +255,7 @@ public class EndOfTurn extends Phase implements java.io.Serializable {
ability.setStackDescription(sb.toString());
ability.setDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
}
}

View File

@@ -85,7 +85,7 @@ public abstract class Phase implements java.io.Serializable {
*/
public final void addUntil(Player p, final Command c) {
if (null == p) {
p = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
p = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
}
if (this.untilMap.containsKey(p)) {
@@ -121,7 +121,7 @@ public abstract class Phase implements java.io.Serializable {
*/
public final void addUntilYourNextTurn(Player p, final Command command) {
if (null == p) {
p = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
p = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
}
if (this.untilMap.containsKey(p)) {

View File

@@ -176,8 +176,8 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable {
* a {@link forge.game.player.Player} object.
*/
public final void setPriority(final Player p) {
if (Singletons.getModel().getGameState().getStack() != null) {
Singletons.getModel().getGameState().getStack().chooseOrderOfSimultaneousStackEntryAll();
if (Singletons.getModel().getGame().getStack() != null) {
Singletons.getModel().getGame().getStack().chooseOrderOfSimultaneousStackEntryAll();
}
this.pFirstPriority = p;
@@ -282,7 +282,7 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable {
final PhaseType phase = this.getPhase();
final Player turn = this.getPlayerTurn();
this.setSkipPhase(true);
Singletons.getModel().getGameAction().checkStateEffects();
Singletons.getModel().getGame().getAction().checkStateEffects();
if (this.isAutoPassedPhase(turn, phase)) {
this.setAutoPass(false);
@@ -344,14 +344,14 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable {
if (!this.inCombat()) {
this.setNeedToNextPhase(true);
} else {
Singletons.getModel().getGameState().getCombat().verifyCreaturesInPlay();
Singletons.getModel().getGame().getCombat().verifyCreaturesInPlay();
// no first strikers, skip this step
if (!Singletons.getModel().getGameState().getCombat().assignCombatDamage(true)) {
if (!Singletons.getModel().getGame().getCombat().assignCombatDamage(true)) {
this.setNeedToNextPhase(true);
} else {
Combat.dealAssignedDamage();
Singletons.getModel().getGameAction().checkStateEffects();
Singletons.getModel().getGame().getAction().checkStateEffects();
CombatUtil.showCombat();
}
}
@@ -361,13 +361,13 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable {
if (!this.inCombat()) {
this.setNeedToNextPhase(true);
} else {
Singletons.getModel().getGameState().getCombat().verifyCreaturesInPlay();
Singletons.getModel().getGame().getCombat().verifyCreaturesInPlay();
if (!Singletons.getModel().getGameState().getCombat().assignCombatDamage(false)) {
if (!Singletons.getModel().getGame().getCombat().assignCombatDamage(false)) {
this.setNeedToNextPhase(true);
} else {
Combat.dealAssignedDamage();
Singletons.getModel().getGameAction().checkStateEffects();
Singletons.getModel().getGame().getAction().checkStateEffects();
CombatUtil.showCombat();
}
}
@@ -375,8 +375,8 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable {
case COMBAT_END:
// End Combat always happens
Singletons.getModel().getGameState().getEndOfCombat().executeUntil();
Singletons.getModel().getGameState().getEndOfCombat().executeAt();
Singletons.getModel().getGame().getEndOfCombat().executeUntil();
Singletons.getModel().getGame().getEndOfCombat().executeAt();
CombatUtil.showCombat();
//SDisplayUtil.showTab(EDocID.REPORT_STACK.getDoc());
break;
@@ -387,12 +387,12 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable {
break;
case END_OF_TURN:
Singletons.getModel().getGameState().getEndOfTurn().executeAt();
Singletons.getModel().getGame().getEndOfTurn().executeAt();
break;
case CLEANUP:
// Reset Damage received map
final List<Card> list = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
final List<Card> list = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
for (final Card c : list) {
c.resetPreventNextDamage();
c.resetReceivedDamageFromThisTurn();
@@ -409,9 +409,9 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable {
c.clearBlockedThisTurn();
}
Singletons.getModel().getGameState().getEndOfTurn().executeUntil();
Singletons.getModel().getGame().getEndOfTurn().executeUntil();
for (Player player : Singletons.getModel().getGameState().getPlayers()) {
for (Player player : Singletons.getModel().getGame().getPlayers()) {
for (Card c : player.getCardsIn(ZoneType.Hand))
c.setDrawnThisTurn(false);
@@ -423,7 +423,7 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable {
player.resetAttackersDeclaredThisTurn();
}
this.getPlayerTurn().removeKeyword("Skip all combat phases of this turn.");
Singletons.getModel().getGameState().getCleanup().executeUntilTurn(this.getNextTurn());
Singletons.getModel().getGame().getCleanup().executeUntilTurn(this.getNextTurn());
break;
default:
@@ -435,12 +435,12 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable {
final HashMap<String, Object> runParams = new HashMap<String, Object>();
runParams.put("Phase", phase.Name);
runParams.put("Player", turn);
Singletons.getModel().getGameState().getTriggerHandler().runTrigger(TriggerType.Phase, runParams);
Singletons.getModel().getGame().getTriggerHandler().runTrigger(TriggerType.Phase, runParams);
}
// This line fixes Combat Damage triggers not going off when they should
Singletons.getModel().getGameState().getStack().unfreezeStack();
Singletons.getModel().getGame().getStack().unfreezeStack();
// UNTAP
if (phase != PhaseType.UNTAP) {
@@ -467,13 +467,13 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable {
this.needToNextPhase = false;
// If the Stack isn't empty why is nextPhase being called?
if (Singletons.getModel().getGameState().getStack().size() != 0) {
if (Singletons.getModel().getGame().getStack().size() != 0) {
Log.debug("Phase.nextPhase() is called, but Stack isn't empty.");
return;
}
this.bPhaseEffects = true;
if (!Singletons.getModel().getGameState().isCardInPlay("Upwelling")) {
for (Player p : Singletons.getModel().getGameState().getPlayers()) {
if (!Singletons.getModel().getGame().isCardInPlay("Upwelling")) {
for (Player p : Singletons.getModel().getGame().getPlayers()) {
int burn = p.getManaPool().clearPool();
if (Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_MANABURN)) {
p.loseLife(burn, null);
@@ -482,7 +482,7 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable {
}
if (this.getPhase() == PhaseType.COMBAT_DECLARE_ATTACKERS) {
Singletons.getModel().getGameState().getStack().unfreezeStack();
Singletons.getModel().getGame().getStack().unfreezeStack();
this.nCombatsThisTurn++;
} else if (this.getPhase() == PhaseType.UNTAP) {
this.nCombatsThisTurn = 0;
@@ -490,7 +490,7 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable {
if (this.getPhase() == PhaseType.COMBAT_END) {
//SDisplayUtil.showTab(EDocID.REPORT_STACK.getDoc());
Singletons.getModel().getGameState().getCombat().reset();
Singletons.getModel().getGame().getCombat().reset();
this.resetAttackedThisCombat(this.getPlayerTurn());
this.bCombat = false;
}
@@ -503,7 +503,7 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable {
}
if (this.is(PhaseType.COMBAT_DECLARE_BLOCKERS)) {
Singletons.getModel().getGameState().getStack().unfreezeStack();
Singletons.getModel().getGame().getStack().unfreezeStack();
}
if (this.is(PhaseType.COMBAT_END) && (this.extraCombats > 0)) {
@@ -516,9 +516,9 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable {
this.bCombat = true;
this.extraCombats--;
Singletons.getModel().getGameState().getCombat().reset();
Singletons.getModel().getGameState().getCombat().setAttackingPlayer(player);
Singletons.getModel().getGameState().getCombat().setDefendingPlayer(opp);
Singletons.getModel().getGame().getCombat().reset();
Singletons.getModel().getGame().getCombat().setAttackingPlayer(player);
Singletons.getModel().getGame().getCombat().setDefendingPlayer(opp);
this.phaseIndex = PhaseType.COMBAT_DECLARE_ATTACKERS.Index;
} else {
if (!this.bRepeat) { // for when Cleanup needs to repeat itself
@@ -529,13 +529,13 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable {
}
}
Singletons.getModel().getGameState().getGameLog().add("Phase", this.getPlayerTurn() + " " + this.getPhase().Name, 6);
Singletons.getModel().getGame().getGameLog().add("Phase", this.getPlayerTurn() + " " + this.getPhase().Name, 6);
// **** Anything BELOW Here is actually in the next phase. Maybe move
// this to handleBeginPhase
if (this.getPhase() == PhaseType.UNTAP) {
this.turn++;
Singletons.getModel().getGameState().getGameLog().add("Turn", "Turn " + this.turn + " (" + this.getPlayerTurn() + ")", 0);
Singletons.getModel().getGame().getGameLog().add("Turn", "Turn " + this.turn + " (" + this.getPlayerTurn() + ")", 0);
}
PhaseUtil.visuallyActivatePhase(this.getPhase());
@@ -559,15 +559,15 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable {
*/
private Player handleNextTurn() {
Singletons.getModel().getGameState().getStack().setCardsCastLastTurn();
Singletons.getModel().getGameState().getStack().clearCardsCastThisTurn();
Singletons.getModel().getGame().getStack().setCardsCastLastTurn();
Singletons.getModel().getGame().getStack().clearCardsCastThisTurn();
for (final Player p1 : Singletons.getModel().getGameState().getPlayers()) {
for (final Player p1 : Singletons.getModel().getGame().getPlayers()) {
for (final ZoneType z : Player.ALL_ZONES) {
p1.getZone(z).resetCardsAddedThisTurn();
}
}
for( Player p : Singletons.getModel().getGameState().getPlayers() )
for( Player p : Singletons.getModel().getGame().getPlayers() )
{
p.resetProwl();
p.setLifeLostThisTurn(0);
@@ -826,20 +826,20 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable {
// pass the priority to other player
this.setPriorityPlayer(actingPlayer.getOpponent());
Singletons.getModel().getMatch().getInput().resetInput();
Singletons.getModel().getGameState().getStack().chooseOrderOfSimultaneousStackEntryAll();
Singletons.getModel().getGame().getStack().chooseOrderOfSimultaneousStackEntryAll();
} else {
if (Singletons.getModel().getGameState().getStack().size() == 0) {
if (Singletons.getModel().getGame().getStack().size() == 0) {
// end phase
this.needToNextPhase = true;
this.pPlayerPriority = this.getPlayerTurn(); // this needs to be
// set early
// as we exit the phase
} else {
if (!Singletons.getModel().getGameState().getStack().hasSimultaneousStackEntries()) {
Singletons.getModel().getGameState().getStack().resolveStack();
if (!Singletons.getModel().getGame().getStack().hasSimultaneousStackEntries()) {
Singletons.getModel().getGame().getStack().resolveStack();
}
}
Singletons.getModel().getGameState().getStack().chooseOrderOfSimultaneousStackEntryAll();
Singletons.getModel().getGame().getStack().chooseOrderOfSimultaneousStackEntryAll();
}
}
@@ -920,8 +920,8 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable {
* @return a boolean.
*/
public static boolean canCastSorcery(final Player player) {
PhaseHandler now = Singletons.getModel().getGameState().getPhaseHandler();
return now.isPlayerTurn(player) && now.getPhase().isMain() && Singletons.getModel().getGameState().getStack().size() == 0;
PhaseHandler now = Singletons.getModel().getGame().getPhaseHandler();
return now.isPlayerTurn(player) && now.getPhase().isMain() && Singletons.getModel().getGame().getStack().size() == 0;
}
/**
@@ -937,11 +937,11 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable {
* @return a boolean .
*/
public static boolean couldCastSorcery(final Player player, final SpellAbility sa) {
PhaseHandler now = Singletons.getModel().getGameState().getPhaseHandler();
PhaseHandler now = Singletons.getModel().getGame().getPhaseHandler();
final Card source = sa.getRootSpellAbility().getSourceCard();
boolean onlyThis = true;
if (Singletons.getModel().getGameState().getStack().size() != 0) {
for (final Card card : Singletons.getModel().getGameState().getCardsIn(ZoneType.Stack)) {
if (Singletons.getModel().getGame().getStack().size() != 0) {
for (final Card card : Singletons.getModel().getGame().getCardsIn(ZoneType.Stack)) {
if (card != source) {
onlyThis = false;
//System.out.println("StackCard: " + card + " vs SourceCard: " + source);

View File

@@ -64,7 +64,7 @@ public class PhaseUtil {
return true;
}
if (Singletons.getModel().getGameState().isCardInPlay("Sands of Time") || Singletons.getModel().getGameState().isCardInPlay("Stasis")) {
if (Singletons.getModel().getGame().isCardInPlay("Sands of Time") || Singletons.getModel().getGame().isCardInPlay("Stasis")) {
return true;
}
@@ -82,15 +82,15 @@ public class PhaseUtil {
* </p>
*/
public static void handleUntap() {
final PhaseHandler ph = Singletons.getModel().getGameState().getPhaseHandler();
final PhaseHandler ph = Singletons.getModel().getGame().getPhaseHandler();
final Player turn = ph.getPlayerTurn();
Singletons.getModel().getGameState().notifyNextTurn();
Singletons.getModel().getGame().notifyNextTurn();
CMessage.SINGLETON_INSTANCE.updateGameInfo(Singletons.getModel().getMatch());
Singletons.getModel().getGameState().getCombat().reset();
Singletons.getModel().getGameState().getCombat().setAttackingPlayer(turn);
Singletons.getModel().getGameState().getCombat().setDefendingPlayer(turn.getOpponent());
Singletons.getModel().getGame().getCombat().reset();
Singletons.getModel().getGame().getCombat().setAttackingPlayer(turn);
Singletons.getModel().getGame().getCombat().setDefendingPlayer(turn.getOpponent());
// Tokens starting game in play now actually suffer from Sum. Sickness again
final List<Card> list = turn.getCardsIncludePhasingIn(ZoneType.Battlefield);
@@ -101,7 +101,7 @@ public class PhaseUtil {
}
turn.incrementTurn();
Singletons.getModel().getGameAction().resetActivationsPerTurn();
Singletons.getModel().getGame().getAction().resetActivationsPerTurn();
final List<Card> lands = CardLists.filter(turn.getLandsInPlay(), Presets.UNTAPPED);
turn.setNumPowerSurgeLands(lands.size());
@@ -110,17 +110,17 @@ public class PhaseUtil {
// phase is skipped
if (PhaseUtil.skipUntap(turn)) {
Singletons.getModel().getGameState().getPhaseHandler().setNeedToNextPhase(true);
Singletons.getModel().getGame().getPhaseHandler().setNeedToNextPhase(true);
return;
}
Singletons.getModel().getGameState().getUntap().executeUntil(turn);
Singletons.getModel().getGameState().getUntap().executeAt();
Singletons.getModel().getGame().getUntap().executeUntil(turn);
Singletons.getModel().getGame().getUntap().executeAt();
// otherwise land seems to stay tapped when it is really untapped
//AllZone.getHumanPlayer().getZone(ZoneType.Battlefield).updateObservers();
Singletons.getModel().getGameState().getPhaseHandler().setNeedToNextPhase(true);
Singletons.getModel().getGame().getPhaseHandler().setNeedToNextPhase(true);
}
// ******* UPKEEP PHASE *****
@@ -130,19 +130,19 @@ public class PhaseUtil {
* </p>
*/
public static void handleUpkeep() {
final Player turn = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final Player turn = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
if (PhaseUtil.skipUpkeep()) {
// Slowtrips all say "on the next turn's upkeep" if there is no
// upkeep next turn, the trigger will never occur.
turn.clearSlowtripList();
turn.getOpponent().clearSlowtripList();
Singletons.getModel().getGameState().getPhaseHandler().setNeedToNextPhase(true);
Singletons.getModel().getGame().getPhaseHandler().setNeedToNextPhase(true);
return;
}
Singletons.getModel().getGameState().getUpkeep().executeUntil(turn);
Singletons.getModel().getGameState().getUpkeep().executeAt();
Singletons.getModel().getGame().getUpkeep().executeUntil(turn);
Singletons.getModel().getGame().getUpkeep().executeAt();
}
/**
@@ -153,11 +153,11 @@ public class PhaseUtil {
* @return a boolean.
*/
public static boolean skipUpkeep() {
if (Singletons.getModel().getGameState().isCardInPlay("Eon Hub")) {
if (Singletons.getModel().getGame().isCardInPlay("Eon Hub")) {
return true;
}
final Player turn = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final Player turn = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
if ((turn.getCardsIn(ZoneType.Hand).size() == 0) && turn.isCardInPlay("Gibbering Descent")) {
return true;
@@ -173,10 +173,10 @@ public class PhaseUtil {
* </p>
*/
public static void handleDraw() {
final Player playerTurn = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final Player playerTurn = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
if (PhaseUtil.skipDraw(playerTurn)) {
Singletons.getModel().getGameState().getPhaseHandler().setNeedToNextPhase(true);
Singletons.getModel().getGame().getPhaseHandler().setNeedToNextPhase(true);
return;
}
@@ -194,7 +194,7 @@ public class PhaseUtil {
*/
private static boolean skipDraw(final Player player) {
// starting player skips his draw
if (Singletons.getModel().getGameState().getPhaseHandler().getTurn() == 1) {
if (Singletons.getModel().getGame().getPhaseHandler().getTurn() == 1) {
return true;
}
@@ -218,7 +218,7 @@ public class PhaseUtil {
* </p>
*/
public static void verifyCombat() {
Singletons.getModel().getGameState().getCombat().verifyCreaturesInPlay();
Singletons.getModel().getGame().getCombat().verifyCreaturesInPlay();
}
/**
@@ -227,10 +227,10 @@ public class PhaseUtil {
* </p>
*/
public static void handleCombatBegin() {
final Player playerTurn = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final Player playerTurn = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
if (PhaseUtil.skipCombat(playerTurn)) {
Singletons.getModel().getGameState().getPhaseHandler().setNeedToNextPhase(true);
Singletons.getModel().getGame().getPhaseHandler().setNeedToNextPhase(true);
return;
}
}
@@ -241,10 +241,10 @@ public class PhaseUtil {
* </p>
*/
public static void handleCombatDeclareAttackers() {
final Player playerTurn = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final Player playerTurn = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
if (PhaseUtil.skipCombat(playerTurn)) {
Singletons.getModel().getGameState().getPhaseHandler().setNeedToNextPhase(true);
Singletons.getModel().getGame().getPhaseHandler().setNeedToNextPhase(true);
playerTurn.removeKeyword("Skip your next combat phase.");
return;
}
@@ -288,16 +288,16 @@ public class PhaseUtil {
PhaseUtil.verifyCombat();
// Handles removing cards like Mogg Flunkies from combat if group attack didn't occur
final List<Card> filterList = Singletons.getModel().getGameState().getCombat().getAttackerList();
final List<Card> filterList = Singletons.getModel().getGame().getCombat().getAttackerList();
for (Card c : filterList) {
if (c.hasKeyword("CARDNAME can't attack or block alone.") && c.isAttacking()) {
if (Singletons.getModel().getGameState().getCombat().getAttackers().size() < 2) {
Singletons.getModel().getGameState().getCombat().removeFromCombat(c);
if (Singletons.getModel().getGame().getCombat().getAttackers().size() < 2) {
Singletons.getModel().getGame().getCombat().removeFromCombat(c);
}
}
}
final List<Card> list = Singletons.getModel().getGameState().getCombat().getAttackerList();
final List<Card> list = Singletons.getModel().getGame().getCombat().getAttackerList();
// TODO move propaganda to happen as the Attacker is Declared
// Remove illegal Propaganda attacks first only for attacking the Player
@@ -316,12 +316,12 @@ public class PhaseUtil {
* </p>
*/
public static void handleAttackingTriggers() {
final List<Card> list = Singletons.getModel().getGameState().getCombat().getAttackerList();
Singletons.getModel().getGameState().getStack().freezeStack();
final List<Card> list = Singletons.getModel().getGame().getCombat().getAttackerList();
Singletons.getModel().getGame().getStack().freezeStack();
// Then run other Attacker bonuses
// check for exalted:
if (list.size() == 1) {
final Player attackingPlayer = Singletons.getModel().getGameState().getCombat().getAttackingPlayer();
final Player attackingPlayer = Singletons.getModel().getGame().getCombat().getAttackingPlayer();
int exaltedMagnitude = 0;
for (Card card : attackingPlayer.getCardsIn(ZoneType.Battlefield)) {
exaltedMagnitude += card.getKeywordAmount("Exalted");
@@ -334,17 +334,17 @@ public class PhaseUtil {
}
Singletons.getModel().getGameState().getGameLog().add("Combat", CombatUtil.getCombatAttackForLog(), 1);
Singletons.getModel().getGame().getGameLog().add("Combat", CombatUtil.getCombatAttackForLog(), 1);
final HashMap<String, Object> runParams = new HashMap<String, Object>();
runParams.put("Attackers", list);
runParams.put("AttackingPlayer", Singletons.getModel().getGameState().getCombat().getAttackingPlayer());
Singletons.getModel().getGameState().getTriggerHandler().runTrigger(TriggerType.AttackersDeclared, runParams);
runParams.put("AttackingPlayer", Singletons.getModel().getGame().getCombat().getAttackingPlayer());
Singletons.getModel().getGame().getTriggerHandler().runTrigger(TriggerType.AttackersDeclared, runParams);
for (final Card c : list) {
CombatUtil.checkDeclareAttackers(c);
}
Singletons.getModel().getGameState().getStack().unfreezeStack();
Singletons.getModel().getGame().getStack().unfreezeStack();
}
/**
@@ -356,21 +356,21 @@ public class PhaseUtil {
PhaseUtil.verifyCombat();
// Handles removing cards like Mogg Flunkies from combat if group block didn't occur
final List<Card> filterList = Singletons.getModel().getGameState().getCombat().getAllBlockers();
final List<Card> filterList = Singletons.getModel().getGame().getCombat().getAllBlockers();
for (Card c : filterList) {
if (c.hasKeyword("CARDNAME can't attack or block alone.") && c.isBlocking()) {
if (Singletons.getModel().getGameState().getCombat().getAllBlockers().size() < 2) {
Singletons.getModel().getGameState().getCombat().undoBlockingAssignment(c);
if (Singletons.getModel().getGame().getCombat().getAllBlockers().size() < 2) {
Singletons.getModel().getGame().getCombat().undoBlockingAssignment(c);
}
}
}
Singletons.getModel().getGameState().getStack().freezeStack();
Singletons.getModel().getGame().getStack().freezeStack();
Singletons.getModel().getGameState().getCombat().setUnblocked();
Singletons.getModel().getGame().getCombat().setUnblocked();
List<Card> list = new ArrayList<Card>();
list.addAll(Singletons.getModel().getGameState().getCombat().getAllBlockers());
list.addAll(Singletons.getModel().getGame().getCombat().getAllBlockers());
list = CardLists.filter(list, new Predicate<Card>() {
@Override
@@ -379,20 +379,20 @@ public class PhaseUtil {
}
});
final List<Card> attList = Singletons.getModel().getGameState().getCombat().getAttackerList();
final List<Card> attList = Singletons.getModel().getGame().getCombat().getAttackerList();
CombatUtil.checkDeclareBlockers(list);
for (final Card a : attList) {
final List<Card> blockList = Singletons.getModel().getGameState().getCombat().getBlockers(a);
final List<Card> blockList = Singletons.getModel().getGame().getCombat().getBlockers(a);
for (final Card b : blockList) {
CombatUtil.checkBlockedAttackers(a, b);
}
}
Singletons.getModel().getGameState().getStack().unfreezeStack();
Singletons.getModel().getGame().getStack().unfreezeStack();
Singletons.getModel().getGameState().getGameLog().add("Combat", CombatUtil.getCombatBlockForLog(), 1);
Singletons.getModel().getGame().getGameLog().add("Combat", CombatUtil.getCombatBlockForLog(), 1);
}
// ***** Combat Utility **********
@@ -406,7 +406,7 @@ public class PhaseUtil {
* @return a boolean.
*/
public static boolean isBeforeAttackersAreDeclared() {
final PhaseType phase = Singletons.getModel().getGameState().getPhaseHandler().getPhase();
final PhaseType phase = Singletons.getModel().getGame().getPhaseHandler().getPhase();
return phase == PhaseType.UNTAP || phase == PhaseType.UPKEEP || phase == PhaseType.DRAW
|| phase == PhaseType.MAIN1 || phase == PhaseType.COMBAT_BEGIN;
}
@@ -420,7 +420,7 @@ public class PhaseUtil {
*/
public static void visuallyActivatePhase(final PhaseType s) {
PhaseLabel lbl = null;
final Player p = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final Player p = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
final CMatchUI t = CMatchUI.SINGLETON_INSTANCE;
// Index of field; computer is 1, human is 0

View File

@@ -63,7 +63,7 @@ public class Untap extends Phase implements java.io.Serializable {
public void executeAt() {
this.execute(this.getAt());
final Player turn = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final Player turn = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
Untap.doPhasing(turn);
Untap.doUntap();
@@ -86,7 +86,7 @@ public class Untap extends Phase implements java.io.Serializable {
return false;
}
final List<Card> allp = Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield);
final List<Card> allp = Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield);
for (final Card ca : allp) {
if (ca.hasStartOfKeyword("Permanents don't untap during their controllers' untap steps")) {
final int keywordPosition = ca
@@ -110,14 +110,14 @@ public class Untap extends Phase implements java.io.Serializable {
* </p>
*/
private static void doUntap() {
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final Player player = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
final Predicate<Card> tappedCanUntap = Predicates.and(Presets.TAPPED, Presets.CANUNTAP);
List<Card> list = player.getCardsIn(ZoneType.Battlefield);
for (final Card c : list) {
if (c.getBounceAtUntap() && c.getName().contains("Undiscovered Paradise")) {
Singletons.getModel().getGameAction().moveToHand(c);
Singletons.getModel().getGame().getAction().moveToHand(c);
}
}
@@ -130,11 +130,11 @@ public class Untap extends Phase implements java.io.Serializable {
if (Untap.canOnlyUntapOneLand() && c.isLand()) {
return false;
}
if ((Singletons.getModel().getGameState().isCardInPlay("Damping Field") || Singletons.getModel().getGameState().isCardInPlay("Imi Statue"))
if ((Singletons.getModel().getGame().isCardInPlay("Damping Field") || Singletons.getModel().getGame().isCardInPlay("Imi Statue"))
&& c.isArtifact()) {
return false;
}
if ((Singletons.getModel().getGameState().isCardInPlay("Smoke") || Singletons.getModel().getGameState().isCardInPlay("Stoic Angel") || Singletons.getModel().getGameState().isCardInPlay("Intruder Alarm")) && c.isCreature()) {
if ((Singletons.getModel().getGame().isCardInPlay("Smoke") || Singletons.getModel().getGame().isCardInPlay("Stoic Angel") || Singletons.getModel().getGame().isCardInPlay("Intruder Alarm")) && c.isCreature()) {
return false;
}
return true;
@@ -178,7 +178,7 @@ public class Untap extends Phase implements java.io.Serializable {
}
}
}
} else if ((c.getCounters(Counters.WIND) > 0) && Singletons.getModel().getGameState().isCardInPlay("Freyalise's Winds")) {
} else if ((c.getCounters(Counters.WIND) > 0) && Singletons.getModel().getGame().isCardInPlay("Freyalise's Winds")) {
// remove a WIND counter instead of untapping
c.subtractCounter(Counters.WIND, 1);
} else {
@@ -234,8 +234,8 @@ public class Untap extends Phase implements java.io.Serializable {
}
}
}
if (Singletons.getModel().getGameState().isCardInPlay("Damping Field") || Singletons.getModel().getGameState().isCardInPlay("Imi Statue")) {
final Player turnOwner = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
if (Singletons.getModel().getGame().isCardInPlay("Damping Field") || Singletons.getModel().getGame().isCardInPlay("Imi Statue")) {
final Player turnOwner = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
if (turnOwner.isComputer()) {
List<Card> artList = turnOwner.getCardsIn(ZoneType.Battlefield);
artList = CardLists.filter(artList, Presets.ARTIFACTS);
@@ -275,7 +275,7 @@ public class Untap extends Phase implements java.io.Serializable {
}
}
}
if ((Singletons.getModel().getGameState().isCardInPlay("Smoke") || Singletons.getModel().getGameState().isCardInPlay("Stoic Angel"))) {
if ((Singletons.getModel().getGame().isCardInPlay("Smoke") || Singletons.getModel().getGame().isCardInPlay("Stoic Angel"))) {
if (player.isComputer()) {
List<Card> creatures = player.getCreaturesInPlay();
creatures = CardLists.filter(creatures, tappedCanUntap);
@@ -329,11 +329,11 @@ public class Untap extends Phase implements java.io.Serializable {
private static boolean canOnlyUntapOneLand() {
// Winter Orb was given errata so it no longer matters if it's tapped or
// not
if (CardLists.filter(Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Winter Orb")).size() > 0) {
if (CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Winter Orb")).size() > 0) {
return true;
}
if (Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn().getCardsIn(ZoneType.Battlefield, "Mungha Wurm").size() > 0) {
if (Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn().getCardsIn(ZoneType.Battlefield, "Mungha Wurm").size() > 0) {
return true;
}

View File

@@ -75,7 +75,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
*/
@Override
public final void executeAt() {
Singletons.getModel().getGameState().getStack().freezeStack();
Singletons.getModel().getGame().getStack().freezeStack();
Upkeep.upkeepBraidOfFire();
Upkeep.upkeepSlowtrips(); // for "Draw a card at the beginning of the next turn's upkeep."
@@ -112,7 +112,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
Upkeep.upkeepCurseOfMisfortunes();
Upkeep.upkeepPowerSurge();
Singletons.getModel().getGameState().getStack().unfreezeStack();
Singletons.getModel().getGame().getStack().unfreezeStack();
}
// UPKEEP CARDS:
@@ -123,7 +123,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
* </p>
*/
private static void upkeepBraidOfFire() {
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final Player player = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
final List<Card> braids = player.getCardsIn(ZoneType.Battlefield, "Braid of Fire");
@@ -145,14 +145,14 @@ public class Upkeep extends Phase implements java.io.Serializable {
} else if (GameActionUtil.showYesNoDialog(c, sb.toString())) {
abMana.produceMana();
} else {
Singletons.getModel().getGameAction().sacrifice(c, null);
Singletons.getModel().getGame().getAction().sacrifice(c, null);
}
}
};
upkeepAbility.setStackDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(upkeepAbility);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(upkeepAbility);
}
} // upkeepBraidOfFire
@@ -163,7 +163,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
* </p>
*/
private static void upkeepEcho() {
List<Card> list = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn().getCardsIn(ZoneType.Battlefield);
List<Card> list = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn().getCardsIn(ZoneType.Battlefield);
list = CardLists.filter(list, new Predicate<Card>() {
@Override
public boolean apply(final Card c) {
@@ -182,7 +182,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
@Override
public void execute() {
Singletons.getModel().getGameAction().sacrifice(c, null);
Singletons.getModel().getGame().getAction().sacrifice(c, null);
}
};
@@ -202,7 +202,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
if (ComputerUtil.canPayCost(blankAbility, controller)) {
ComputerUtil.playNoStack(controller, blankAbility);
} else {
Singletons.getModel().getGameAction().sacrifice(c, null);
Singletons.getModel().getGame().getAction().sacrifice(c, null);
}
}
}
@@ -210,7 +210,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
sacAbility.setStackDescription(sb.toString());
sacAbility.setDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(sacAbility);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(sacAbility);
c.removeAllExtrinsicKeyword("(Echo unpaid)");
}
@@ -223,7 +223,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
* </p>
*/
private static void upkeepSlowtrips() {
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final Player player = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
List<Card> list = player.getSlowtripList();
@@ -242,7 +242,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
slowtrip.setStackDescription(card + " - Draw a card.");
slowtrip.setDescription(card + " - Draw a card.");
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(slowtrip);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(slowtrip);
}
player.clearSlowtripList();
@@ -267,7 +267,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
slowtrip.setStackDescription(card.getName() + " - Draw a card");
slowtrip.setDescription(card + " - Draw a card.");
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(slowtrip);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(slowtrip);
}
opponent.clearSlowtripList();
@@ -279,7 +279,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
* </p>
*/
private static void upkeepUpkeepCost() {
final List<Card> list = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn().getCardsIn(ZoneType.Battlefield);
final List<Card> list = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn().getCardsIn(ZoneType.Battlefield);
for (int i = 0; i < list.size(); i++) {
final Card c = list.get(i);
@@ -301,7 +301,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
if (c.getName().equals("Cosmic Horror")) {
controller.addDamage(7, c);
}
Singletons.getModel().getGameAction().destroy(c);
Singletons.getModel().getGame().getAction().destroy(c);
}
};
@@ -324,7 +324,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
if (c.getName().equals("Cosmic Horror")) {
controller.addDamage(7, c);
}
Singletons.getModel().getGameAction().destroy(c);
Singletons.getModel().getGame().getAction().destroy(c);
}
}
}
@@ -332,7 +332,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
upkeepAbility.setStackDescription(sb.toString());
upkeepAbility.setDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(upkeepAbility);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(upkeepAbility);
} // destroy
// sacrifice
@@ -361,7 +361,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
@Override
public void execute() {
Singletons.getModel().getGameAction().sacrifice(c, null);
Singletons.getModel().getGame().getAction().sacrifice(c, null);
}
};
@@ -379,7 +379,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
if (ComputerUtil.shouldPayCost(controller, c, upkeepCost) && ComputerUtil.canPayCost(blankAbility, controller)) {
ComputerUtil.playNoStack(controller, blankAbility);
} else {
Singletons.getModel().getGameAction().sacrifice(c, null);
Singletons.getModel().getGame().getAction().sacrifice(c, null);
}
}
}
@@ -387,7 +387,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
upkeepAbility.setStackDescription(sb.toString());
upkeepAbility.setDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(upkeepAbility);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(upkeepAbility);
} // sacrifice
// destroy
@@ -432,7 +432,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
upkeepAbility.setStackDescription(sb.toString());
upkeepAbility.setDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(upkeepAbility);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(upkeepAbility);
} // destroy
}
@@ -473,9 +473,9 @@ public class Upkeep extends Phase implements java.io.Serializable {
* creature that player controls of his or her choice. It can't be
* regenerated.
*/
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final List<Card> the = CardLists.filter(Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("The Abyss"));
final List<Card> magus = CardLists.filter(Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Magus of the Abyss"));
final Player player = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
final List<Card> the = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("The Abyss"));
final List<Card> magus = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Magus of the Abyss"));
final List<Card> cards = new ArrayList<Card>();
cards.addAll(the);
@@ -508,7 +508,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
// probably need to restrict by controller
// also
if (targets.contains(selected)) {
Singletons.getModel().getGameAction().destroyNoRegeneration(selected);
Singletons.getModel().getGame().getAction().destroyNoRegeneration(selected);
this.stop();
}
} // selectCard()
@@ -518,13 +518,13 @@ public class Upkeep extends Phase implements java.io.Serializable {
final List<Card> indestruct = CardLists.getKeyword(targets, "Indestructible");
if (indestruct.size() > 0) {
Singletons.getModel().getGameAction().destroyNoRegeneration(indestruct.get(0));
Singletons.getModel().getGame().getAction().destroyNoRegeneration(indestruct.get(0));
} else if (targets.size() > 0) {
final Card target = CardFactoryUtil.getWorstCreatureAI(targets);
if (null == target) {
// must be nothing valid to destroy
} else {
Singletons.getModel().getGameAction().destroyNoRegeneration(target);
Singletons.getModel().getGame().getAction().destroyNoRegeneration(target);
}
}
}
@@ -534,7 +534,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
final StringBuilder sb = new StringBuilder();
sb.append(abyss.getName()).append(" - destroy a nonartifact creature of your choice.");
sacrificeCreature.setStackDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addAndUnfreeze(sacrificeCreature);
Singletons.getModel().getGame().getStack().addAndUnfreeze(sacrificeCreature);
} // end for
} // The Abyss
@@ -549,7 +549,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
* power. It can't be regenerated. If two or more creatures are tied for
* least power, you choose one of them.
*/
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final Player player = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
final List<Card> drops = player.getCardsIn(ZoneType.Battlefield, "Drop of Honey");
drops.addAll(player.getCardsIn(ZoneType.Battlefield, "Porphyry Nodes"));
final List<Card> cards = drops;
@@ -560,7 +560,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
final Ability ability = new Ability(c, "") {
@Override
public void resolve() {
final List<Card> creatures = CardLists.filter(Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield), Presets.CREATURES);
final List<Card> creatures = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), Presets.CREATURES);
if (creatures.size() > 0) {
CardLists.sortAttackLowFirst(creatures);
final int power = creatures.get(0).getNetAttack();
@@ -570,7 +570,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
"Select creature with power: " + power + " to sacrifice."));
} else { // computer
final Card compyTarget = this.getCompyCardToDestroy(creatures);
Singletons.getModel().getGameAction().destroyNoRegeneration(compyTarget);
Singletons.getModel().getGame().getAction().destroyNoRegeneration(compyTarget);
}
}
} // resolve
@@ -608,7 +608,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
sb.append(c.getName()).append(" - destroy 1 creature with lowest power.");
ability.setStackDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
} // end for
} // upkeepDropOfHoney()
@@ -625,7 +625,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
* Hordes and sacrifice a land of an opponent's choice.
*/
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final Player player = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
final List<Card> cards = player.getCardsIn(ZoneType.Battlefield, "Demonic Hordes");
for (int i = 0; i < cards.size(); i++) {
@@ -647,7 +647,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
} else {
final Card target = CardFactoryUtil.getBestLandAI(playerLand);
Singletons.getModel().getGameAction().sacrifice(target, null);
Singletons.getModel().getGame().getAction().sacrifice(target, null);
}
} // end resolve()
}; // end noPay ability
@@ -659,7 +659,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
final Ability pay = new Ability(c, "0") {
@Override
public void resolve() {
if (Singletons.getModel().getGameState().getZoneOf(c).is(ZoneType.Battlefield)) {
if (Singletons.getModel().getGame().getZoneOf(c).is(ZoneType.Battlefield)) {
final StringBuilder cost = new StringBuilder();
cost.append("Pay cost for ").append(c).append("\r\n");
GameActionUtil.payManaDuringAbilityResolve(cost.toString(), noPay.getManaCost(),
@@ -669,7 +669,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
}; // end pay ability
pay.setStackDescription("Demonic Hordes - Upkeep Cost");
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(pay);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(pay);
} // end choice
else {
@@ -677,7 +677,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
sb.append(c.getName()).append(" - is tapped and you must sacrifice a land of opponent's choice");
noPay.setStackDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(noPay);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(noPay);
}
} // end human
@@ -691,10 +691,10 @@ public class Upkeep extends Phase implements java.io.Serializable {
};
computerPay.setStackDescription("Computer pays Demonic Hordes upkeep cost");
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(computerPay);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(computerPay);
} else {
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(noPay);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(noPay);
}
} // end computer
@@ -713,7 +713,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
* </p>
*/
private static void upkeepInkDissolver() {
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final Player player = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
final Player opponent = player.getOpponent();
final List<Card> kinship = player.getCardsIn(ZoneType.Battlefield, "Ink Dissolver");
@@ -789,7 +789,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
sb.append(" triggers Kinship");
ability.setStackDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
} // for
} // upkeepInkDissolver()
@@ -800,7 +800,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
* </p>
*/
private static void upkeepKithkinZephyrnaut() {
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final Player player = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
final List<Card> kinship = player.getCardsIn(ZoneType.Battlefield, "Kithkin Zephyrnaut");
final PlayerZone library = player.getZone(ZoneType.Library);
@@ -874,7 +874,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
k.removeExtrinsicKeyword("Vigilance");
}
};
Singletons.getModel().getGameState().getEndOfTurn().addUntil(untilEOT);
Singletons.getModel().getGame().getEndOfTurn().addUntil(untilEOT);
}
} // resolve()
@@ -891,7 +891,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
sb.append(" triggers Kinship");
ability.setStackDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
} // for
} // upkeepKithkinZephyrnaut()
@@ -902,7 +902,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
* </p>
*/
private static void upkeepLeafCrownedElder() {
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final Player player = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
final List<Card> kinship = player.getCardsIn(ZoneType.Battlefield, "Leaf-Crowned Elder");
final PlayerZone library = player.getZone(ZoneType.Library);
@@ -961,7 +961,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
if (wantToPlayCard) {
if (player.isHuman()) {
final Card c = library.get(0);
Singletons.getModel().getGameAction().playCardWithoutManaCost(c);
Singletons.getModel().getGame().getAction().playCardWithoutManaCost(c);
}
// player isComputer()
else {
@@ -991,7 +991,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
sb.append(" triggers Kinship");
ability.setStackDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
} // for
} // upkeepLeafCrownedElder()
@@ -1002,7 +1002,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
* </p>
*/
private static void upkeepMudbuttonClanger() {
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final Player player = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
final List<Card> kinship = player.getCardsIn(ZoneType.Battlefield, "Mudbutton Clanger");
final PlayerZone library = player.getZone(ZoneType.Library);
@@ -1071,7 +1071,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
k.addTempDefenseBoost(-1);
}
};
Singletons.getModel().getGameState().getEndOfTurn().addUntil(untilEOT);
Singletons.getModel().getGame().getEndOfTurn().addUntil(untilEOT);
}
} // resolve()
@@ -1088,7 +1088,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
sb.append(" triggers Kinship");
ability.setStackDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
} // for
} // upkeepMudbuttonClanger()
@@ -1099,7 +1099,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
* </p>
*/
private static void upkeepNightshadeSchemers() {
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final Player player = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
final List<Card> kinship = player.getCardsIn(ZoneType.Battlefield, "Nightshade Schemers");
final Player opponent = player.getOpponent();
@@ -1173,7 +1173,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
sb.append(" triggers Kinship");
ability.setStackDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
} // for
} // upkeepNightshadeSchemers()
@@ -1184,7 +1184,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
* </p>
*/
private static void upkeepPyroclastConsul() {
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final Player player = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
final List<Card> kinship = player.getCardsIn(ZoneType.Battlefield, "Pyroclast Consul");
final PlayerZone library = player.getZone(ZoneType.Library);
@@ -1254,7 +1254,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
}
if (wantDamageCreatures) {
final List<Card> allCreatures = CardLists.filter(Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield), Presets.CREATURES);
final List<Card> allCreatures = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), Presets.CREATURES);
for (final Card crd : allCreatures) {
crd.addDamage(2, k);
}
@@ -1274,7 +1274,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
sb.append(" triggers Kinship");
ability.setStackDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
} // for
} // upkeepPyroclastConsul()
@@ -1285,7 +1285,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
* </p>
*/
private static void upkeepSensationGorger() {
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final Player player = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
final List<Card> kinship = player.getCardsIn(ZoneType.Battlefield, "Sensation Gorger");
final Player opponent = player.getOpponent();
@@ -1366,7 +1366,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
sb.append(" triggers Kinship");
ability.setStackDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
} // for
} // upkeepSensationGorger()
@@ -1377,7 +1377,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
* </p>
*/
private static void upkeepSqueakingPieGrubfellows() {
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final Player player = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
final List<Card> kinship = player.getCardsIn(ZoneType.Battlefield, "Squeaking Pie Grubfellows");
final Player opponent = player.getOpponent();
@@ -1452,7 +1452,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
sb.append(" triggers Kinship");
ability.setStackDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
} // for
} // upkeepSqueakingPieGrubfellows()
@@ -1463,7 +1463,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
* </p>
*/
private static void upkeepWanderingGraybeard() {
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final Player player = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
final List<Card> kinship = player.getCardsIn(ZoneType.Battlefield, "Wandering Graybeard");
final PlayerZone library = player.getZone(ZoneType.Library);
@@ -1536,7 +1536,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
sb.append(" triggers Kinship");
ability.setStackDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
} // for
} // upkeepWanderingGraybeard()
@@ -1547,7 +1547,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
* </p>
*/
private static void upkeepWaterspoutWeavers() {
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final Player player = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
final List<Card> kinship = player.getCardsIn(ZoneType.Battlefield, "Waterspout Weavers");
final PlayerZone library = player.getZone(ZoneType.Library);
@@ -1624,7 +1624,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
}
}
};
Singletons.getModel().getGameState().getEndOfTurn().addUntil(untilEOT);
Singletons.getModel().getGame().getEndOfTurn().addUntil(untilEOT);
}
} // resolve()
@@ -1641,7 +1641,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
sb.append(" triggers Kinship");
ability.setStackDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
} // for
} // upkeepWaterspoutWeavers()
@@ -1652,7 +1652,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
* </p>
*/
private static void upkeepWinnowerPatrol() {
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final Player player = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
final List<Card> kinship = player.getCardsIn(ZoneType.Battlefield, "Winnower Patrol");
final PlayerZone library = player.getZone(ZoneType.Library);
@@ -1725,7 +1725,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
sb.append(" triggers Kinship");
ability.setStackDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
} // for
} // upkeepWinnowerPatrol()
@@ -1736,7 +1736,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
* </p>
*/
private static void upkeepWolfSkullShaman() {
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final Player player = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
final List<Card> kinship = player.getCardsIn(ZoneType.Battlefield, "Wolf-Skull Shaman");
final PlayerZone library = player.getZone(ZoneType.Library);
@@ -1812,7 +1812,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
sb.append(" triggers Kinship");
ability.setStackDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
} // for
} // upkeep_Wolf_Skull_Shaman()
@@ -1827,7 +1827,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
* </p>
*/
private static void upkeepSuspend() {
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final Player player = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
List<Card> list = player.getCardsIn(ZoneType.Exile);
@@ -1857,7 +1857,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
*/
private static void upkeepVanishing() {
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final Player player = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
List<Card> list = player.getCardsIn(ZoneType.Battlefield);
list = CardLists.filter(list, new Predicate<Card>() {
@Override
@@ -1881,7 +1881,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
ability.setStackDescription(sb.toString());
ability.setDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
}
}
@@ -1894,7 +1894,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
*/
private static void upkeepFading() {
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final Player player = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
List<Card> list = player.getCardsIn(ZoneType.Battlefield);
list = CardLists.filter(list, new Predicate<Card>() {
@Override
@@ -1910,7 +1910,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
public void resolve() {
final int fadeCounters = card.getCounters(Counters.FADE);
if (fadeCounters <= 0) {
Singletons.getModel().getGameAction().sacrifice(card, null);
Singletons.getModel().getGame().getAction().sacrifice(card, null);
} else {
card.subtractCounter(Counters.FADE, 1);
}
@@ -1923,7 +1923,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
ability.setStackDescription(sb.toString());
ability.setDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
}
}
@@ -1935,12 +1935,12 @@ public class Upkeep extends Phase implements java.io.Serializable {
* </p>
*/
private static void upkeepOathOfDruids() {
final List<Card> oathList = CardLists.filter(Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Oath of Druids"));
final List<Card> oathList = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Oath of Druids"));
if (oathList.isEmpty()) {
return;
}
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final Player player = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
if (GameState.compareTypeAmountInPlay(player, "Creature") < 0) {
for (int i = 0; i < oathList.size(); i++) {
@@ -1981,10 +1981,10 @@ public class Upkeep extends Phase implements java.io.Serializable {
final Card c = libraryList.get(i);
cardsToReveal.add(c);
if (c.isCreature()) {
Singletons.getModel().getGameAction().moveTo(battlefield, c);
Singletons.getModel().getGame().getAction().moveTo(battlefield, c);
break;
} else {
Singletons.getModel().getGameAction().moveToGraveyard(c);
Singletons.getModel().getGame().getAction().moveToGraveyard(c);
}
} // for loop
if (cardsToReveal.size() > 0) {
@@ -2004,7 +2004,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
ability.setStackDescription(sb.toString());
ability.setDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
}
}
@@ -2016,12 +2016,12 @@ public class Upkeep extends Phase implements java.io.Serializable {
* </p>
*/
private static void upkeepOathOfGhouls() {
final List<Card> oathList = CardLists.filter(Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Oath of Ghouls"));
final List<Card> oathList = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Oath of Ghouls"));
if (oathList.isEmpty()) {
return;
}
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final Player player = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
if (GameState.compareTypeAmountInGraveyard(player, "Creature") > 0) {
for (int i = 0; i < oathList.size(); i++) {
@@ -2036,12 +2036,12 @@ public class Upkeep extends Phase implements java.io.Serializable {
if (o != null) {
final Card card = o;
Singletons.getModel().getGameAction().moveToHand(card);
Singletons.getModel().getGame().getAction().moveToHand(card);
}
} else if (player.isComputer()) {
final Card card = graveyardCreatures.get(0);
Singletons.getModel().getGameAction().moveToHand(card);
Singletons.getModel().getGame().getAction().moveToHand(card);
}
}
}
@@ -2053,7 +2053,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
ability.setStackDescription(sb.toString());
ability.setDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
}
}
@@ -2065,8 +2065,8 @@ public class Upkeep extends Phase implements java.io.Serializable {
* </p>
*/
private static void upkeepKarma() {
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final List<Card> karmas = CardLists.filter(Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Karma"));
final Player player = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
final List<Card> karmas = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Karma"));
final List<Card> swamps = CardLists.getType(player.getCardsIn(ZoneType.Battlefield), "Swamp");
// determine how much damage to deal the current player
@@ -2092,7 +2092,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
ability.setStackDescription(sb.toString());
ability.setDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
}
}
@@ -2110,8 +2110,8 @@ public class Upkeep extends Phase implements java.io.Serializable {
* to that player, where X is the number of untapped lands he or she
* controlled at the beginning of this turn.
*/
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final List<Card> list = CardLists.filter(Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Power Surge"));
final Player player = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
final List<Card> list = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Power Surge"));
final int damage = player.getNumPowerSurgeLands();
for (final Card surge : list) {
@@ -2129,7 +2129,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
ability.setDescription(sb.toString());
if (damage > 0) {
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
}
} // for
} // upkeepPowerSurge()
@@ -2140,8 +2140,8 @@ public class Upkeep extends Phase implements java.io.Serializable {
* </p>
*/
private static void upkeepTangleWire() {
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final List<Card> wires = CardLists.filter(Singletons.getModel().getGameState().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Tangle Wire"));
final Player player = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
final List<Card> wires = CardLists.filter(Singletons.getModel().getGame().getCardsIn(ZoneType.Battlefield), CardPredicates.nameEquals("Tangle Wire"));
for (final Card source : wires) {
final SpellAbility ability = new Ability(source, "0") {
@@ -2220,7 +2220,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
ability.setDescription(source.getName() + " - " + player
+ " taps X artifacts, creatures or lands he or she controls.");
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
} // foreach(wire)
} // upkeepTangleWire()
@@ -2231,7 +2231,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
* </p>
*/
private static void upkeepBlazeCounters() {
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final Player player = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
List<Card> blaze = player.getCardsIn(ZoneType.Battlefield);
blaze = CardLists.filter(blaze, new Predicate<Card>() {
@@ -2255,7 +2255,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
sb.append(player).append(".");
ability.setStackDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
}
}
@@ -2266,7 +2266,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
* </p>
*/
private static void upkeepCurseOfMisfortunes() {
final Player player = Singletons.getModel().getGameState().getPhaseHandler().getPlayerTurn();
final Player player = Singletons.getModel().getGame().getPhaseHandler().getPlayerTurn();
final List<Card> misfortunes = player.getCardsIn(ZoneType.Battlefield, "Curse of Misfortunes");
@@ -2302,8 +2302,8 @@ public class Upkeep extends Phase implements java.io.Serializable {
enchantment = CardFactoryUtil.getBestEnchantmentAI(enchantmentsInLibrary, this, false);
}
if (enchantment != null) {
Singletons.getModel().getGameAction().changeZone(
Singletons.getModel().getGameState().getZoneOf(enchantment),
Singletons.getModel().getGame().getAction().changeZone(
Singletons.getModel().getGame().getZoneOf(enchantment),
enchantment.getOwner().getZone(ZoneType.Battlefield), enchantment, null);
enchantment.enchantEntity(source.getEnchantingPlayer());
}
@@ -2317,7 +2317,7 @@ public class Upkeep extends Phase implements java.io.Serializable {
+ " the same name as a Curse attached to enchanted player, "
+ "put it onto the battlefield attached to that player, then shuffle you library.");
ability.setStackDescription(sb.toString());
Singletons.getModel().getGameState().getStack().addSimultaneousStackEntry(ability);
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
}
} // upkeepCurseOfMisfortunes

View File

@@ -116,11 +116,11 @@ public class AIPlayer extends Player {
// rule 702.49a
if (this.getDredgeNumber(c) <= this.getCardsIn(ZoneType.Library).size()) {
// dredge library, put card in hand
Singletons.getModel().getGameAction().moveToHand(c);
Singletons.getModel().getGame().getAction().moveToHand(c);
// put dredge number in graveyard
for (int i = 0; i < this.getDredgeNumber(c); i++) {
final Card c2 = this.getCardsIn(ZoneType.Library).get(0);
Singletons.getModel().getGameAction().moveToGraveyard(c2);
Singletons.getModel().getGame().getAction().moveToGraveyard(c2);
}
return true;
}
@@ -184,7 +184,7 @@ public class AIPlayer extends Player {
}
if (bottom) {
final Card c = topN.get(i);
Singletons.getModel().getGameAction().moveToBottomOfLibrary(c);
Singletons.getModel().getGame().getAction().moveToBottomOfLibrary(c);
// topN.remove(c);
}
}
@@ -194,7 +194,7 @@ public class AIPlayer extends Player {
final Random rndm = MyRandom.getRandom();
final int r = rndm.nextInt(topN.size());
final Card c = topN.get(r);
Singletons.getModel().getGameAction().moveToLibrary(c);
Singletons.getModel().getGame().getAction().moveToLibrary(c);
topN.remove(r);
}
}
@@ -205,7 +205,7 @@ public class AIPlayer extends Player {
if (choices.size() > 0) {
// TODO - this could probably use better AI
final Card c = CardFactoryUtil.getWorstPermanentAI(choices, false, false, false, false);
Singletons.getModel().getGameAction().sacrificeDestroy(c);
Singletons.getModel().getGame().getAction().sacrificeDestroy(c);
}
}
@@ -214,7 +214,7 @@ public class AIPlayer extends Player {
protected final void clashMoveToTopOrBottom(final Card c) {
// computer just puts the card back until such time it can make a
// smarter decision
Singletons.getModel().getGameAction().moveToLibrary(c);
Singletons.getModel().getGame().getAction().moveToLibrary(c);
}
/*

View File

@@ -83,7 +83,7 @@ public class ComputerAIGeneral implements Computer {
final boolean nextPhase = ComputerUtil.playSpellAbilities(player, getSpellAbilities(list));
if (nextPhase) {
Singletons.getModel().getGameState().getPhaseHandler().passPriority();
Singletons.getModel().getGame().getPhaseHandler().passPriority();
}
} // playCards()
@@ -283,11 +283,11 @@ public class ComputerAIGeneral implements Computer {
public final void declareAttackers() {
// 12/2/10(sol) the decision making here has moved to getAttackers()
Singletons.getModel().getGameState().setCombat(ComputerUtil.getAttackers(player));
Singletons.getModel().getGame().setCombat(ComputerUtil.getAttackers(player));
final List<Card> att = Singletons.getModel().getGameState().getCombat().getAttackers();
final List<Card> att = Singletons.getModel().getGame().getCombat().getAttackers();
if (!att.isEmpty()) {
Singletons.getModel().getGameState().getPhaseHandler().setCombat(true);
Singletons.getModel().getGame().getPhaseHandler().setCombat(true);
}
for (final Card element : att) {
@@ -300,7 +300,7 @@ public class ComputerAIGeneral implements Computer {
player.getZone(ZoneType.Battlefield).updateObservers();
Singletons.getModel().getGameState().getPhaseHandler().setNeedToNextPhase(true);
Singletons.getModel().getGame().getPhaseHandler().setNeedToNextPhase(true);
}
/**
@@ -312,11 +312,11 @@ public class ComputerAIGeneral implements Computer {
public final void declareBlockers() {
final List<Card> blockers = player.getCreaturesInPlay();
Singletons.getModel().getGameState().setCombat(ComputerUtilBlock.getBlockers(player, Singletons.getModel().getGameState().getCombat(), blockers));
Singletons.getModel().getGame().setCombat(ComputerUtilBlock.getBlockers(player, Singletons.getModel().getGame().getCombat(), blockers));
CombatUtil.orderMultipleCombatants(Singletons.getModel().getGameState().getCombat());
CombatUtil.orderMultipleCombatants(Singletons.getModel().getGame().getCombat());
Singletons.getModel().getGameState().getPhaseHandler().setNeedToNextPhase(true);
Singletons.getModel().getGame().getPhaseHandler().setNeedToNextPhase(true);
}
/**
@@ -328,7 +328,7 @@ public class ComputerAIGeneral implements Computer {
public final void endOfTurn() {
//This is only called in the computer turn
//this.playSpellAbilitiesStackEmpty();
Singletons.getModel().getGameState().getPhaseHandler().passPriority();
Singletons.getModel().getGame().getPhaseHandler().passPriority();
}
/**
@@ -338,16 +338,16 @@ public class ComputerAIGeneral implements Computer {
*/
@Override
public final void playSpellAbilities() {
if (Singletons.getModel().getGameState().getStack().isEmpty()) {
if (Singletons.getModel().getGame().getStack().isEmpty()) {
this.playSpellAbilitiesStackEmpty();
return;
}
// if top of stack is owned by me
if (Singletons.getModel().getGameState().getStack().peekInstance().getActivatingPlayer().isComputer()) {
if (Singletons.getModel().getGame().getStack().peekInstance().getActivatingPlayer().isComputer()) {
// probably should let my stuff resolve to force Human to respond to
// it
Singletons.getModel().getGameState().getPhaseHandler().passPriority();
Singletons.getModel().getGame().getPhaseHandler().passPriority();
return;
}
final List<Card> cards = getAvailableCards();
@@ -375,6 +375,6 @@ public class ComputerAIGeneral implements Computer {
}
}
// if this hasn't been covered above, just PassPriority()
Singletons.getModel().getGameState().getPhaseHandler().passPriority();
Singletons.getModel().getGame().getPhaseHandler().passPriority();
}
}

Some files were not shown because too many files have changed in this diff Show More