mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
- Added the boolean function "isInZone" to the card class. It should be a performance upgrade to "AllZone.getZoneOf(c).equals(zone)".
This commit is contained in:
@@ -496,6 +496,25 @@ public final class AllZone implements NewConstants {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isCardInZone(final Card c, Constant.Zone zone) {
|
||||||
|
final FGameState gameState = Singletons.getModel().getGameState();
|
||||||
|
if (gameState == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (zone.equals(Constant.Zone.Stack) && gameState.getStackZone().contains(c)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
else for (Player p : gameState.getPlayers()) {
|
||||||
|
if(p.getZone(zone).contains(c)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* resetZoneMoveTracking.
|
* resetZoneMoveTracking.
|
||||||
|
|||||||
@@ -8092,4 +8092,8 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isInZone(final Constant.Zone zone) {
|
||||||
|
return AllZone.isCardInZone(this, zone);
|
||||||
|
}
|
||||||
|
|
||||||
} // end Card class
|
} // end Card class
|
||||||
|
|||||||
@@ -303,8 +303,7 @@ public class StaticAbility {
|
|||||||
effectZone = Zone.smartValueOf(this.mapParams.get("EffectZone"));
|
effectZone = Zone.smartValueOf(this.mapParams.get("EffectZone"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((effectZone != null)
|
if ((effectZone != null) && (!this.hostCard.isInZone(effectZone) || this.hostCard.isPhasedOut())) {
|
||||||
&& (!AllZone.getZoneOf(this.hostCard).getZoneType().equals(effectZone) || this.hostCard.isPhasedOut())) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user