mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 20:58:03 +00:00
- Replaced some unnecessary uses of getZoneOf.
This commit is contained in:
@@ -59,8 +59,9 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
|
||||
// don't want to log those.
|
||||
if (!c.isImmutable()) {
|
||||
this.cardsAddedThisTurn.add(c);
|
||||
if (AllZone.getZoneOf(c) != null) {
|
||||
this.cardsAddedThisTurnSource.add(AllZone.getZoneOf(c).getZoneType());
|
||||
PlayerZone zone = AllZone.getZoneOf(c);
|
||||
if (zone != null) {
|
||||
this.cardsAddedThisTurnSource.add(zone.getZoneType());
|
||||
} else {
|
||||
this.cardsAddedThisTurnSource.add(null);
|
||||
}
|
||||
@@ -117,8 +118,9 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
|
||||
// don't want to log those.
|
||||
if (!c.isImmutable()) {
|
||||
this.cardsAddedThisTurn.add(c);
|
||||
if (AllZone.getZoneOf(c) != null) {
|
||||
this.cardsAddedThisTurnSource.add(AllZone.getZoneOf(c).getZoneType());
|
||||
PlayerZone zone = AllZone.getZoneOf(c);
|
||||
if (zone != null) {
|
||||
this.cardsAddedThisTurnSource.add(zone.getZoneType());
|
||||
} else {
|
||||
this.cardsAddedThisTurnSource.add(null);
|
||||
}
|
||||
|
||||
@@ -160,8 +160,8 @@ public class MagicStack extends MyObservable {
|
||||
// on the stack zone, move there
|
||||
if (ability.isSpell()) {
|
||||
final Card source = ability.getSourceCard();
|
||||
if (!source.isCopiedSpell() && !AllZone.getZoneOf(source).is(Constant.Zone.Stack)) {
|
||||
//ability.setSourceCard(AllZone.getGameAction().moveToStack(source));
|
||||
if (!source.isCopiedSpell() && !source.isInZone(Constant.Zone.Stack)) {
|
||||
ability.setSourceCard(AllZone.getGameAction().moveToStack(source));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -957,7 +957,7 @@ public class MagicStack extends MyObservable {
|
||||
// If Spell and still on the Stack then let it goto the graveyard or
|
||||
// replace its own movement
|
||||
else if (!source.isCopiedSpell() && (source.isInstant() || source.isSorcery() || fizzle)
|
||||
&& AllZone.getZoneOf(source).is(Constant.Zone.Stack)) {
|
||||
&& source.isInZone(Constant.Zone.Stack)) {
|
||||
AllZone.getGameAction().moveToGraveyard(source);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2386,7 +2386,7 @@ public class CardFactoryUtil {
|
||||
} else {
|
||||
// If an Aura's target is removed before it resolves, the Aura
|
||||
// fizzles
|
||||
if (source.isAura() && !AllZone.getZoneOf(target).is(Constant.Zone.Battlefield)) {
|
||||
if (source.isAura() && !target.isInZone(Constant.Zone.Battlefield)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ public class CostDiscard extends CostPartWithList {
|
||||
final Integer amount = this.convertAmount();
|
||||
|
||||
if (this.getThis()) {
|
||||
if (!AllZone.getZoneOf(source).is(Constant.Zone.Hand)) {
|
||||
if (!source.isInZone(Constant.Zone.Hand)) {
|
||||
return false;
|
||||
}
|
||||
} else if (type.equals("Hand")) {
|
||||
|
||||
@@ -48,7 +48,7 @@ public class CostReveal extends CostPartWithList {
|
||||
final Integer amount = this.convertAmount();
|
||||
|
||||
if (this.getThis()) {
|
||||
if (!AllZone.getZoneOf(source).is(Constant.Zone.Hand)) {
|
||||
if (!source.isInZone(Constant.Zone.Hand)) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -286,7 +286,7 @@ public class Spell_Permanent extends Spell {
|
||||
}
|
||||
|
||||
final CardList cl = (CardList) this.championGetCreature.execute();
|
||||
if ((o == null) || !(cl.size() > 0) || !AllZone.getZoneOf(this.getSourceCard()).is(Constant.Zone.Hand)) {
|
||||
if ((o == null) || !(cl.size() > 0) || !this.getSourceCard().isInZone(Constant.Zone.Hand)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import forge.CardList;
|
||||
import forge.CardUtil;
|
||||
import forge.Constant.Zone;
|
||||
import forge.Player;
|
||||
import forge.PlayerZone;
|
||||
import forge.card.abilityFactory.AbilityFactory;
|
||||
import forge.card.cardFactory.CardFactoryUtil;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
@@ -292,13 +293,14 @@ public abstract class Trigger {
|
||||
public final boolean zonesCheck() {
|
||||
if (mapParams.containsKey("TriggerZones")) {
|
||||
List<Zone> triggerZones = new ArrayList<Zone>();
|
||||
PlayerZone zone = AllZone.getZoneOf(hostCard);
|
||||
for (String s : mapParams.get("TriggerZones").split(",")) {
|
||||
triggerZones.add(Zone.smartValueOf(s));
|
||||
}
|
||||
if (AllZone.getZoneOf(hostCard) == null) {
|
||||
if (zone == null) {
|
||||
return false;
|
||||
}
|
||||
if (!triggerZones.contains(AllZone.getZoneOf(hostCard).getZoneType()) || hostCard.isPhasedOut()) {
|
||||
if (!triggerZones.contains(zone.getZoneType()) || hostCard.isPhasedOut()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user