mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
StaticAbility: remove applyAbility
This commit is contained in:
@@ -1758,7 +1758,7 @@ public class ComputerUtilCard {
|
||||
// remove old boost that might be copied
|
||||
for (final StaticAbility stAb : c.getStaticAbilities()) {
|
||||
vCard.removePTBoost(c.getTimestamp(), stAb.getId());
|
||||
if (!stAb.getParam("Mode").equals("Continuous")) {
|
||||
if (!stAb.checkMode("Continuous")) {
|
||||
continue;
|
||||
}
|
||||
if (!stAb.hasParam("Affected")) {
|
||||
|
||||
@@ -919,7 +919,7 @@ public class ComputerUtilCombat {
|
||||
final CardCollectionView cardList = CardCollection.combine(game.getCardsIn(ZoneType.Battlefield), game.getCardsIn(ZoneType.Command));
|
||||
for (final Card card : cardList) {
|
||||
for (final StaticAbility stAb : card.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals("Continuous")) {
|
||||
if (!stAb.checkMode("Continuous")) {
|
||||
continue;
|
||||
}
|
||||
if (!stAb.hasParam("Affected") || !stAb.getParam("Affected").contains("blocking")) {
|
||||
@@ -1215,7 +1215,7 @@ public class ComputerUtilCombat {
|
||||
final CardCollectionView cardList = CardCollection.combine(game.getCardsIn(ZoneType.Battlefield), game.getCardsIn(ZoneType.Command));
|
||||
for (final Card card : cardList) {
|
||||
for (final StaticAbility stAb : card.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals("Continuous")) {
|
||||
if (!stAb.checkMode("Continuous")) {
|
||||
continue;
|
||||
}
|
||||
if (!stAb.hasParam("Affected") || !stAb.getParam("Affected").contains("attacking")) {
|
||||
|
||||
@@ -10,10 +10,9 @@ import forge.game.card.CounterEnumType;
|
||||
import forge.game.cost.CostPayEnergy;
|
||||
import forge.game.keyword.Keyword;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.staticability.StaticAbility;
|
||||
import forge.game.staticability.StaticAbilityAssignCombatDamageAsUnblocked;
|
||||
import forge.game.staticability.StaticAbilityCantAttackBlock;
|
||||
import forge.game.staticability.StaticAbilityMustAttack;
|
||||
import forge.game.zone.ZoneType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -62,17 +61,10 @@ public class CreatureEvaluator implements Function<Card, Integer> {
|
||||
if (c.hasKeyword(Keyword.HORSEMANSHIP)) {
|
||||
value += addValue(power * 10, "horses");
|
||||
}
|
||||
boolean unblockable = false;
|
||||
for (final Card ca : c.getGame().getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (stAb.applyAbility("CantBlockBy", c, null)) {
|
||||
value += addValue(power * 10, "unblockable");
|
||||
unblockable = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!unblockable) {
|
||||
|
||||
if (StaticAbilityCantAttackBlock.cantBlockBy(c, null)) {
|
||||
value += addValue(power * 10, "unblockable");
|
||||
} else {
|
||||
if (StaticAbilityAssignCombatDamageAsUnblocked.assignCombatDamageAsUnblocked(c)
|
||||
|| StaticAbilityAssignCombatDamageAsUnblocked.assignCombatDamageAsUnblocked(c, false)) {
|
||||
value += addValue(power * 6, "thorns");
|
||||
|
||||
@@ -44,6 +44,7 @@ import forge.game.player.PlayerActionConfirmMode;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.spellability.TargetRestrictions;
|
||||
import forge.game.staticability.StaticAbility;
|
||||
import forge.game.staticability.StaticAbilityCantAttackBlock;
|
||||
import forge.game.trigger.Trigger;
|
||||
import forge.game.trigger.TriggerType;
|
||||
import forge.game.zone.ZoneType;
|
||||
@@ -662,13 +663,8 @@ public class AttachAi extends SpellAbilityAi {
|
||||
cardPriority += 40;
|
||||
}
|
||||
//check if card is generally unblockable
|
||||
for (final Card ca : card.getGame().getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (stAb.applyAbility("CantBlockBy", card, null)) {
|
||||
cardPriority += 50;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (StaticAbilityCantAttackBlock.cantBlockBy(card, null)) {
|
||||
cardPriority += 50;
|
||||
}
|
||||
// Prefer "tap to deal damage"
|
||||
// TODO : Skip this one if triggers on combat damage only?
|
||||
|
||||
@@ -803,11 +803,11 @@ public class GameAction {
|
||||
|
||||
// need to refresh ability text for affected cards
|
||||
for (final StaticAbility stAb : c.getStaticAbilities()) {
|
||||
if (stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (stAb.getParam("Mode").equals("CantBlockBy")) {
|
||||
if (stAb.checkMode("CantBlockBy")) {
|
||||
if (!stAb.hasParam("ValidAttacker") || (stAb.hasParam("ValidBlocker") && stAb.getParam("ValidBlocker").equals("Creature.Self"))) {
|
||||
continue;
|
||||
}
|
||||
@@ -817,7 +817,7 @@ public class GameAction {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (stAb.getParam("Mode").equals(StaticAbilityCantAttackBlock.MinMaxBlockerMode)) {
|
||||
if (stAb.checkMode(StaticAbilityCantAttackBlock.MinMaxBlockerMode)) {
|
||||
for (Card creature : Iterables.filter(game.getCardsIn(ZoneType.Battlefield), CardPredicates.Presets.CREATURES)) {
|
||||
if (stAb.matchesValidParam("ValidCard", creature)) {
|
||||
creature.updateAbilityTextForView();
|
||||
@@ -1077,7 +1077,7 @@ public class GameAction {
|
||||
public boolean hasStaticAbilityAffectingZone(ZoneType zone, StaticAbilityLayer layer) {
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals("Continuous") || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions("Continuous")) {
|
||||
continue;
|
||||
}
|
||||
if (layer != null && !stAb.getLayers().contains(layer)) {
|
||||
@@ -1126,7 +1126,7 @@ public class GameAction {
|
||||
// need to get Card from preList if able
|
||||
final Card co = preList.get(c);
|
||||
for (StaticAbility stAb : co.getStaticAbilities()) {
|
||||
if (stAb.getParam("Mode").equals("Continuous")) {
|
||||
if (stAb.checkMode("Continuous")) {
|
||||
staticAbilities.add(stAb);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -396,7 +396,7 @@ public final class GameActionUtil {
|
||||
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals("OptionalCost") || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions("OptionalCost")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -2580,14 +2580,14 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
}
|
||||
|
||||
boolean found = false;
|
||||
if (stAb.getParam("Mode").equals("CantBlockBy")) {
|
||||
if (stAb.checkMode("CantBlockBy")) {
|
||||
if (!stAb.hasParam("ValidAttacker") || (stAb.hasParam("ValidBlocker") && stAb.getParam("ValidBlocker").equals("Creature.Self"))) {
|
||||
continue;
|
||||
}
|
||||
if (stAb.matchesValidParam("ValidAttacker", this)) {
|
||||
found = true;
|
||||
}
|
||||
} else if (stAb.getParam("Mode").equals(StaticAbilityCantAttackBlock.MinMaxBlockerMode)) {
|
||||
} else if (stAb.checkMode(StaticAbilityCantAttackBlock.MinMaxBlockerMode)) {
|
||||
if (stAb.matchesValidParam("ValidCard", this)) {
|
||||
found = true;
|
||||
}
|
||||
@@ -5560,17 +5560,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
}
|
||||
|
||||
public final boolean canDamagePrevented(final boolean isCombat) {
|
||||
CardCollection list = new CardCollection(getGame().getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES));
|
||||
list.add(this);
|
||||
for (final Card ca : list) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (stAb.applyAbility("CantPreventDamage", this, isCombat)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return !StaticAbilityCantPreventDamage.cantPreventDamage(this, isCombat);
|
||||
}
|
||||
|
||||
// This is used by the AI to forecast an effect (so it must not change the game state)
|
||||
|
||||
@@ -255,38 +255,16 @@ public class CombatUtil {
|
||||
}
|
||||
}
|
||||
|
||||
// Keywords
|
||||
// replace with Static Ability if able
|
||||
if (attacker.hasKeyword("CARDNAME can't attack.") || attacker.hasKeyword("CARDNAME can't attack or block.")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// CantAttack static abilities
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (stAb.applyAbility("CantAttack", attacker, defender)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (StaticAbilityCantAttackBlock.cantAttack(attacker, defender)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isAttackerSick(final Card attacker, final GameEntity defender) {
|
||||
final Game game = attacker.getGame();
|
||||
if (!attacker.isSick()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (stAb.applyAbility("CanAttackIfHaste", attacker, defender)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return !StaticAbilityCantAttackBlock.canAttackHaste(attacker, defender);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -575,12 +553,8 @@ public class CombatUtil {
|
||||
}
|
||||
|
||||
// Unblockable check
|
||||
for (final Card ca : attacker.getGame().getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (stAb.applyAbility("CantBlockBy", attacker, null)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (StaticAbilityCantAttackBlock.cantBlockBy(attacker, null)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return canBeBlocked(attacker, defendingPlayer);
|
||||
@@ -1146,7 +1120,6 @@ public class CombatUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
final Game game = attacker.getGame();
|
||||
if (!canBlock(blocker, nextTurn)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1172,12 +1145,8 @@ public class CombatUtil {
|
||||
}
|
||||
|
||||
// CantBlockBy static abilities
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (stAb.applyAbility("CantBlockBy", attacker, blocker)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (StaticAbilityCantAttackBlock.cantBlockBy(attacker, blocker)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -75,7 +75,7 @@ public class CostAdjustment {
|
||||
// Sort abilities to apply them in proper order
|
||||
for (Card c : cardsOnBattlefield) {
|
||||
for (final StaticAbility stAb : c.getStaticAbilities()) {
|
||||
if (stAb.getParam("Mode").equals("RaiseCost")) {
|
||||
if (stAb.checkMode("RaiseCost")) {
|
||||
raiseAbilities.add(stAb);
|
||||
}
|
||||
}
|
||||
@@ -191,10 +191,10 @@ public class CostAdjustment {
|
||||
// Sort abilities to apply them in proper order
|
||||
for (Card c : cardsOnBattlefield) {
|
||||
for (final StaticAbility stAb : c.getStaticAbilities()) {
|
||||
if (stAb.getParam("Mode").equals("ReduceCost")) {
|
||||
if (stAb.checkMode("ReduceCost")) {
|
||||
reduceAbilities.add(stAb);
|
||||
}
|
||||
else if (stAb.getParam("Mode").equals("SetCost")) {
|
||||
else if (stAb.checkMode("SetCost")) {
|
||||
setAbilities.add(stAb);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ public class StaticAbility extends CardTraitBase implements IIdentifiable, Clone
|
||||
* @return the applicable layers.
|
||||
*/
|
||||
private final Set<StaticAbilityLayer> generateLayer() {
|
||||
if (!getParam("Mode").equals("Continuous")) {
|
||||
if (!checkMode("Continuous")) {
|
||||
return EnumSet.noneOf(StaticAbilityLayer.class);
|
||||
}
|
||||
|
||||
@@ -273,77 +273,28 @@ public class StaticAbility extends CardTraitBase implements IIdentifiable, Clone
|
||||
* conditions are fulfilled.
|
||||
*/
|
||||
private boolean shouldApplyContinuousAbility(final StaticAbilityLayer layer, final boolean previousRun) {
|
||||
return getParam("Mode").equals("Continuous") && layers.contains(layer) && !isSuppressed() && checkConditions() && (previousRun || getHostCard().getStaticAbilities().contains(this));
|
||||
}
|
||||
|
||||
public final boolean applyAbility(final String mode, final Card card, final boolean isCombat) {
|
||||
// don't apply the ability if it hasn't got the right mode
|
||||
if (!getParam("Mode").equals(mode)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.isSuppressed() || !this.checkConditions()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mode.equals("CantPreventDamage")) {
|
||||
return StaticAbilityCantPreventDamage.applyCantPreventDamage(this, card, isCombat);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply ability.
|
||||
*
|
||||
* @param mode
|
||||
* the mode
|
||||
* @param card
|
||||
* the card
|
||||
* @param target
|
||||
* the target
|
||||
* @return true, if successful
|
||||
*/
|
||||
public final boolean applyAbility(final String mode, final Card card, final GameEntity target) {
|
||||
// don't apply the ability if it hasn't got the right mode
|
||||
if (!getParam("Mode").equals(mode)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.isSuppressed() || !this.checkConditions()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mode.equals("CantAttack")) {
|
||||
return StaticAbilityCantAttackBlock.applyCantAttackAbility(this, card, target);
|
||||
} else if (mode.equals("CantBlockBy")) { // null allowed, so no instanceof check
|
||||
return StaticAbilityCantAttackBlock.applyCantBlockByAbility(this, card, (Card)target);
|
||||
} else if (mode.equals("CanAttackIfHaste")) {
|
||||
return StaticAbilityCantAttackBlock.applyCanAttackHasteAbility(this, card, target);
|
||||
}
|
||||
|
||||
return false;
|
||||
return layers.contains(layer) && checkConditions("Continuous") && (previousRun || getHostCard().getStaticAbilities().contains(this));
|
||||
}
|
||||
|
||||
public final Cost getAttackCost(final Card attacker, final GameEntity target, final List<Card> attackersWithOptionalCost) {
|
||||
if (!getParam("Mode").equals("CantAttackUnless") && (!getParam("Mode").equals("OptionalAttackCost") || !attackersWithOptionalCost.contains(attacker))) {
|
||||
if (!checkMode("CantAttackUnless") && (!checkMode("OptionalAttackCost") || !attackersWithOptionalCost.contains(attacker))) {
|
||||
return null;
|
||||
}
|
||||
if (this.isSuppressed() || !this.checkConditions()) {
|
||||
if (!this.checkConditions()) {
|
||||
return null;
|
||||
}
|
||||
return StaticAbilityCantAttackBlock.getAttackCost(this, attacker, target);
|
||||
}
|
||||
|
||||
public final boolean hasAttackCost(final Card attacker, Class<? extends CostPart> costType) {
|
||||
if (this.isSuppressed() || !getParam("Mode").equals("OptionalAttackCost") || !this.checkConditions()) {
|
||||
if (!checkConditions("OptionalAttackCost")) {
|
||||
return false;
|
||||
}
|
||||
return StaticAbilityCantAttackBlock.getAttackCost(this, attacker, null).hasSpecificCostType(costType);
|
||||
}
|
||||
|
||||
public final Cost getBlockCost(final Card blocker, final Card attacker) {
|
||||
if (this.isSuppressed() || !getParam("Mode").equals("CantBlockUnless") || !this.checkConditions()) {
|
||||
if (!checkConditions("CantBlockUnless")) {
|
||||
return null;
|
||||
}
|
||||
return StaticAbilityCantAttackBlock.getBlockCost(this, blocker, attacker);
|
||||
@@ -365,6 +316,14 @@ public class StaticAbility extends CardTraitBase implements IIdentifiable, Clone
|
||||
return true;
|
||||
}
|
||||
|
||||
public final boolean checkMode(String mode) {
|
||||
return getParam("Mode").equals(mode);
|
||||
}
|
||||
|
||||
public final boolean checkConditions(String mode) {
|
||||
return checkMode(mode) && checkConditions();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check conditions.
|
||||
*
|
||||
@@ -375,6 +334,9 @@ public class StaticAbility extends CardTraitBase implements IIdentifiable, Clone
|
||||
final Game game = getHostCard().getGame();
|
||||
final PhaseHandler ph = game.getPhaseHandler();
|
||||
|
||||
if (isSuppressed()) {
|
||||
return false;
|
||||
}
|
||||
if (getHostCard().isPhasedOut()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public class StaticAbilityActivateAbilityAsIfHaste {
|
||||
public static boolean canActivate(final Card card) {
|
||||
for (final Card ca : card.getGame().getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(MODE)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ public class StaticAbilityAdapt {
|
||||
final Game game = card.getGame();
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(MODE)) {
|
||||
continue;
|
||||
}
|
||||
if (applyWithAdapt(stAb, sa, card)) {
|
||||
|
||||
@@ -16,7 +16,7 @@ public class StaticAbilityAssignCombatDamageAsUnblocked {
|
||||
final Game game = card.getGame();
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(MODE)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ public class StaticAbilityAttackRestrict {
|
||||
int max = Integer.MAX_VALUE;
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()
|
||||
if (!stAb.checkConditions(MODE)
|
||||
|| stAb.hasParam("ValidDefender")) {
|
||||
continue;
|
||||
}
|
||||
@@ -33,7 +33,7 @@ public class StaticAbilityAttackRestrict {
|
||||
int num = Integer.MAX_VALUE;
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()
|
||||
if (!stAb.checkConditions(MODE)
|
||||
|| !stAb.hasParam("ValidDefender")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ public class StaticAbilityAttackVigilance {
|
||||
final Game game = card.getGame();
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(MODE)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ public class StaticAbilityCanAttackDefender {
|
||||
// CanAttack static abilities
|
||||
for (final Card ca : card.getGame().getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(MODE)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ public class StaticAbilityCantAttach {
|
||||
// CantTarget static abilities
|
||||
for (final Card ca : target.getGame().getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(MODE)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@@ -38,12 +38,35 @@ import forge.game.zone.ZoneType;
|
||||
* The Class StaticAbility_CantBeCast.
|
||||
*/
|
||||
public class StaticAbilityCantAttackBlock {
|
||||
|
||||
public static String CantAttackMode = "CantAttack";
|
||||
public static String CantBlockByMode = "CantBlockBy";
|
||||
public static String CanAttackHasteMode = "CanAttackIfHaste";
|
||||
public static String MinMaxBlockerMode = "MinMaxBlocker";
|
||||
|
||||
public static boolean cantAttack(final Card attacker, final GameEntity defender) {
|
||||
// Keywords
|
||||
// replace with Static Ability if able
|
||||
if (attacker.hasKeyword("CARDNAME can't attack.") || attacker.hasKeyword("CARDNAME can't attack or block.")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (final Card ca : attacker.getGame().getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.checkConditions(CantAttackMode)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (applyCantAttackAbility(stAb, attacker, defender)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO Write javadoc for this method.
|
||||
*
|
||||
*
|
||||
* @param stAb
|
||||
* a StaticAbility
|
||||
* @param card
|
||||
@@ -100,6 +123,21 @@ public class StaticAbilityCantAttackBlock {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean cantBlockBy(final Card attacker, final Card blocker)
|
||||
{
|
||||
for (final Card ca : attacker.getGame().getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.checkConditions(CantBlockByMode)) {
|
||||
continue;
|
||||
}
|
||||
if (applyCantBlockByAbility(stAb, attacker, blocker)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns true if attacker can't be blocked by blocker
|
||||
* @param stAb
|
||||
@@ -156,7 +194,7 @@ public class StaticAbilityCantAttackBlock {
|
||||
|
||||
/**
|
||||
* TODO Write javadoc for this method.
|
||||
*
|
||||
*
|
||||
* @param stAb
|
||||
* a StaticAbility
|
||||
* @param attacker
|
||||
@@ -196,7 +234,7 @@ public class StaticAbilityCantAttackBlock {
|
||||
|
||||
/**
|
||||
* TODO Write javadoc for this method.
|
||||
*
|
||||
*
|
||||
* @param stAb
|
||||
* a StaticAbility
|
||||
* @param blocker
|
||||
@@ -221,6 +259,24 @@ public class StaticAbilityCantAttackBlock {
|
||||
return new Cost(costString, true);
|
||||
}
|
||||
|
||||
public static boolean canAttackHaste(final Card attacker, final GameEntity defender) {
|
||||
final Game game = attacker.getGame();
|
||||
if (!attacker.isSick()) {
|
||||
return true;
|
||||
}
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.checkConditions(CanAttackHasteMode)) {
|
||||
continue;
|
||||
}
|
||||
if (applyCanAttackHasteAbility(stAb, attacker, defender)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean applyCanAttackHasteAbility(final StaticAbility stAb, final Card card, final GameEntity target) {
|
||||
if (!stAb.matchesValidParam("ValidCard", card)) {
|
||||
return false;
|
||||
@@ -243,7 +299,7 @@ public class StaticAbilityCantAttackBlock {
|
||||
final Game game = attacker.getGame();
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(MinMaxBlockerMode) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(MinMaxBlockerMode)) {
|
||||
continue;
|
||||
}
|
||||
applyMinMaxBlockerAbility(stAb, attacker, defender, result);
|
||||
|
||||
@@ -45,7 +45,7 @@ public class StaticAbilityCantBeCast {
|
||||
allp.add(card);
|
||||
for (final Card ca : allp) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(CantBeCast) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(CantBeCast)) {
|
||||
continue;
|
||||
}
|
||||
if (applyCantBeCastAbility(stAb, spell, card, activator)) {
|
||||
@@ -63,7 +63,7 @@ public class StaticAbilityCantBeCast {
|
||||
final Game game = activator.getGame();
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(CantBeActivated) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(CantBeActivated)) {
|
||||
continue;
|
||||
}
|
||||
if (applyCantBeActivatedAbility(stAb, spell, card, activator)) {
|
||||
@@ -78,7 +78,7 @@ public class StaticAbilityCantBeCast {
|
||||
final Game game = activator.getGame();
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(CantPlayLand) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(CantPlayLand)) {
|
||||
continue;
|
||||
}
|
||||
if (applyCantPlayLandAbility(stAb, card, activator)) {
|
||||
|
||||
@@ -13,7 +13,7 @@ public class StaticAbilityCantBecomeMonarch {
|
||||
final Game game = player.getGame();
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(MODE)) {
|
||||
continue;
|
||||
}
|
||||
if (applyCantBecomeMonarchAbility(stAb, player)) {
|
||||
|
||||
@@ -14,7 +14,7 @@ public class StaticAbilityCantDiscard {
|
||||
final Game game = player.getGame();
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(MODE)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ public class StaticAbilityCantDraw {
|
||||
final Game game = player.getGame();
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(MODE)) {
|
||||
continue;
|
||||
}
|
||||
amount = applyCantDrawAmountAbility(stAb, player, amount);
|
||||
|
||||
@@ -16,11 +16,11 @@ public class StaticAbilityCantGainLosePayLife {
|
||||
final Game game = player.getGame();
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!(stAb.getParam("Mode").equals(MODE_CANT_GAIN_LIFE) || stAb.getParam("Mode").equals(MODE_CANT_CHANGE_LIFE))) {
|
||||
if (!(stAb.checkMode(MODE_CANT_GAIN_LIFE) || stAb.checkMode(MODE_CANT_CHANGE_LIFE))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -36,11 +36,7 @@ public class StaticAbilityCantGainLosePayLife {
|
||||
final Game game = player.getGame();
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(MODE_CANT_CHANGE_LIFE)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(MODE_CANT_CHANGE_LIFE)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -57,11 +53,11 @@ public class StaticAbilityCantGainLosePayLife {
|
||||
final Game game = player.getGame();
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!(stAb.getParam("Mode").equals(MODE_CANT_PAY_LIFE) || stAb.getParam("Mode").equals(MODE_CANT_CHANGE_LIFE))) {
|
||||
if (!(stAb.checkMode(MODE_CANT_PAY_LIFE) || stAb.checkMode(MODE_CANT_CHANGE_LIFE))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ public class StaticAbilityCantPhaseIn {
|
||||
final Game game = card.getGame();
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(MODE)) {
|
||||
continue;
|
||||
}
|
||||
if (applyCantPhaseIn(stAb, card)) {
|
||||
|
||||
@@ -12,7 +12,7 @@ public class StaticAbilityCantPhaseOut {
|
||||
final Game game = card.getGame();
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(MODE)) {
|
||||
continue;
|
||||
}
|
||||
if (applyCantPhaseOut(stAb, card)) {
|
||||
|
||||
@@ -1,11 +1,27 @@
|
||||
package forge.game.staticability;
|
||||
|
||||
import forge.game.card.Card;
|
||||
import forge.game.card.CardCollection;
|
||||
import forge.game.zone.ZoneType;
|
||||
|
||||
public class StaticAbilityCantPreventDamage {
|
||||
|
||||
public StaticAbilityCantPreventDamage() {
|
||||
static String MODE = "CantPreventDamage";
|
||||
|
||||
public static boolean cantPreventDamage(final Card source, final boolean isCombat) {
|
||||
CardCollection list = new CardCollection(source.getGame().getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES));
|
||||
list.add(source);
|
||||
for (final Card ca : list) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.checkConditions(MODE)) {
|
||||
continue;
|
||||
}
|
||||
if (applyCantPreventDamage(stAb, source, isCombat)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean applyCantPreventDamage(final StaticAbility stAb, final Card source, final boolean isCombat) {
|
||||
|
||||
@@ -14,7 +14,7 @@ public class StaticAbilityCantPutCounter {
|
||||
final Game game = card.getGame();
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(MODE)) {
|
||||
continue;
|
||||
}
|
||||
if (applyCantPutCounter(stAb, card, type)) {
|
||||
@@ -29,7 +29,7 @@ public class StaticAbilityCantPutCounter {
|
||||
final Game game = player.getGame();
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(MODE)) {
|
||||
continue;
|
||||
}
|
||||
if (applyCantPutCounter(stAb, player, type)) {
|
||||
|
||||
@@ -13,7 +13,7 @@ public class StaticAbilityCantSacrifice {
|
||||
final Game game = card.getGame();
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(MODE)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ public class StaticAbilityCantSetSchemesInMotion {
|
||||
public static boolean any(final Game game) {
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(MODE)) {
|
||||
continue;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -42,7 +42,7 @@ public class StaticAbilityCantTarget {
|
||||
final Game game = card.getGame();
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(MODE)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public class StaticAbilityCantTarget {
|
||||
final Game game = player.getGame();
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(MODE)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ public class StaticAbilityCantTransform {
|
||||
final Game game = card.getGame();
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(MODE)) {
|
||||
continue;
|
||||
}
|
||||
if (applyCantTransformAbility(stAb, card, cause)) {
|
||||
|
||||
@@ -13,7 +13,7 @@ public class StaticAbilityCantVenture {
|
||||
final Game game = player.getGame();
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(MODE)) {
|
||||
continue;
|
||||
}
|
||||
if (applyCantVentureAbility(stAb, player)) {
|
||||
|
||||
@@ -17,7 +17,7 @@ public class StaticAbilityCastWithFlash {
|
||||
allp.add(card);
|
||||
for (final Card ca : allp) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(MODE)) {
|
||||
continue;
|
||||
}
|
||||
if (applyWithFlashNeedsInfo(stAb, sa, card, activator)) {
|
||||
@@ -34,7 +34,7 @@ public class StaticAbilityCastWithFlash {
|
||||
allp.add(card);
|
||||
for (final Card ca : allp) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(MODE)) {
|
||||
continue;
|
||||
}
|
||||
if (applyWithFlashAbility(stAb, sa, card, activator)) {
|
||||
|
||||
@@ -12,7 +12,7 @@ public class StaticAbilityCombatDamageToughness {
|
||||
final Game game = card.getGame();
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(MODE)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ public class StaticAbilityCrewValue {
|
||||
final Game game = card.getGame();
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(MODE)) {
|
||||
continue;
|
||||
}
|
||||
if (hasAnyCrewValue(stAb, card)) {
|
||||
@@ -31,7 +31,7 @@ public class StaticAbilityCrewValue {
|
||||
final Game game = card.getGame();
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(MODE)) {
|
||||
continue;
|
||||
}
|
||||
if (crewsWithToughness(stAb, card)) {
|
||||
@@ -51,7 +51,7 @@ public class StaticAbilityCrewValue {
|
||||
final Game game = card.getGame();
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(MODE)) {
|
||||
continue;
|
||||
}
|
||||
if (!stAb.matchesValidParam("ValidCard", card)) {
|
||||
|
||||
@@ -33,7 +33,7 @@ public class StaticAbilityDisableTriggers {
|
||||
|
||||
for (final Card ca : cardList) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(MODE)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,13 +17,10 @@ public class StaticAbilityIgnoreHexproofShroud {
|
||||
final Game game = entity.getGame();
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (keyword.equals(Keyword.HEXPROOF) && !stAb.getParam("Mode").equals(HEXPROOF_MODE)) {
|
||||
if (keyword.equals(Keyword.HEXPROOF) && !stAb.checkConditions(HEXPROOF_MODE)) {
|
||||
continue;
|
||||
}
|
||||
if (keyword.equals(Keyword.SHROUD) && !stAb.getParam("Mode").equals(SHROUD_MODE)) {
|
||||
continue;
|
||||
}
|
||||
if (stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (keyword.equals(Keyword.SHROUD) && !stAb.checkConditions(SHROUD_MODE)) {
|
||||
continue;
|
||||
}
|
||||
if (commonAbility(stAb, entity, spellAbility)) {
|
||||
|
||||
@@ -12,7 +12,7 @@ public class StaticAbilityIgnoreLegendRule {
|
||||
final Game game = card.getGame();
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(MODE)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ public class StaticAbilityMustAttack {
|
||||
final Game game = attacker.getGame();
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(MODE)) {
|
||||
continue;
|
||||
}
|
||||
if (stAb.matchesValidParam("ValidCreature", attacker)) {
|
||||
|
||||
@@ -12,7 +12,7 @@ public class StaticAbilityMustBlock {
|
||||
final Game game = creature.getGame();
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(MODE)) {
|
||||
continue;
|
||||
}
|
||||
if (applyBlocksEachCombatIfAble(stAb, creature)) {
|
||||
|
||||
@@ -61,7 +61,7 @@ public class StaticAbilityMustTarget {
|
||||
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(MODE) || !stAb.matchesValidParam("ValidSA", spellAbility) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(MODE) || !stAb.matchesValidParam("ValidSA", spellAbility)) {
|
||||
continue;
|
||||
}
|
||||
Pair<String, ZoneType> newRestriction = Pair.of(stAb.getParam("ValidTarget"), ZoneType.smartValueOf(stAb.getParam("ValidZone")));
|
||||
|
||||
@@ -16,7 +16,7 @@ public class StaticAbilityNumLoyaltyAct {
|
||||
public static boolean limitIncrease(final Card card) {
|
||||
for (final Card ca : card.getGame().getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(MODE)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class StaticAbilityNumLoyaltyAct {
|
||||
int addl = 0;
|
||||
for (final Card ca : card.getGame().getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(MODE)) {
|
||||
continue;
|
||||
}
|
||||
if (!stAb.matchesValidParam("ValidCard", card)) {
|
||||
|
||||
@@ -51,7 +51,7 @@ public class StaticAbilityPanharmonicon {
|
||||
// Checks only the battlefield, as those effects only work from there
|
||||
for (final Card ca : cardList) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(MODE)) {
|
||||
continue;
|
||||
}
|
||||
if (applyPanharmoniconAbility(stAb, t, runParams)) {
|
||||
|
||||
@@ -21,7 +21,7 @@ public class StaticAbilityUnspentMana {
|
||||
Set<Byte> result = Sets.newHashSet();
|
||||
for (final Card ca : game.getCardsIn(ZoneType.STATIC_ABILITIES_SOURCE_ZONES)) {
|
||||
for (final StaticAbility stAb : ca.getStaticAbilities()) {
|
||||
if (!stAb.getParam("Mode").equals(MODE) || stAb.isSuppressed() || !stAb.checkConditions()) {
|
||||
if (!stAb.checkConditions(MODE)) {
|
||||
continue;
|
||||
}
|
||||
applyUnspentManaAbility(stAb, player, result);
|
||||
|
||||
Reference in New Issue
Block a user