mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
More flexibility
This commit is contained in:
@@ -43,6 +43,7 @@ import forge.game.card.CardLists;
|
||||
import forge.game.card.CardPredicates;
|
||||
import forge.game.card.CardUtil;
|
||||
import forge.game.cost.Cost;
|
||||
import forge.game.cost.CostPart;
|
||||
import forge.game.keyword.Keyword;
|
||||
import forge.game.keyword.KeywordInterface;
|
||||
import forge.game.phase.PhaseType;
|
||||
@@ -346,17 +347,17 @@ public class CombatUtil {
|
||||
return attackCost;
|
||||
}
|
||||
|
||||
public static CardCollection getOptionalAttackCostCreatures(final CardCollection attackers) {
|
||||
final CardCollection exerters = new CardCollection();
|
||||
public static CardCollection getOptionalAttackCostCreatures(final CardCollection attackers, Class<? extends CostPart> costType) {
|
||||
final CardCollection attackersWithCost = new CardCollection();
|
||||
for (final Card card : attackers) {
|
||||
for (final StaticAbility stAb : card.getStaticAbilities()) {
|
||||
if (stAb.hasExertCost(card)) {
|
||||
exerters.add(card);
|
||||
if (stAb.hasAttackCost(card, costType)) {
|
||||
attackersWithCost.add(card);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return exerters;
|
||||
return attackersWithCost;
|
||||
}
|
||||
|
||||
public static boolean payRequiredBlockCosts(Game game, Card blocker, Card attacker) {
|
||||
|
||||
@@ -40,6 +40,7 @@ import forge.game.card.CardZoneTable;
|
||||
import forge.game.card.CounterEnumType;
|
||||
import forge.game.combat.Combat;
|
||||
import forge.game.combat.CombatUtil;
|
||||
import forge.game.cost.CostExert;
|
||||
import forge.game.event.GameEventAttackersDeclared;
|
||||
import forge.game.event.GameEventBlockersDeclared;
|
||||
import forge.game.event.GameEventCardStatsChanged;
|
||||
@@ -560,7 +561,7 @@ public class PhaseHandler implements java.io.Serializable {
|
||||
}
|
||||
|
||||
// CR 508.1g
|
||||
List<Card> possibleExerters = CombatUtil.getOptionalAttackCostCreatures(combat.getAttackers());
|
||||
List<Card> possibleExerters = CombatUtil.getOptionalAttackCostCreatures(combat.getAttackers(), CostExert.class);
|
||||
if (!possibleExerters.isEmpty()) {
|
||||
possibleExerters = whoDeclares.getController().exertAttackers(possibleExerters);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ import forge.game.card.CardCollectionView;
|
||||
import forge.game.card.CardLists;
|
||||
import forge.game.card.CardState;
|
||||
import forge.game.cost.Cost;
|
||||
import forge.game.cost.CostExert;
|
||||
import forge.game.cost.CostPart;
|
||||
import forge.game.phase.PhaseHandler;
|
||||
import forge.game.phase.PhaseType;
|
||||
import forge.game.player.Player;
|
||||
@@ -335,11 +335,11 @@ public class StaticAbility extends CardTraitBase implements IIdentifiable, Clone
|
||||
return StaticAbilityCantAttackBlock.getAttackCost(this, attacker, target);
|
||||
}
|
||||
|
||||
public final boolean hasExertCost(final Card attacker) {
|
||||
public final boolean hasAttackCost(final Card attacker, Class<? extends CostPart> costType) {
|
||||
if (this.isSuppressed() || !getParam("Mode").equals("OptionalAttackCost") || !this.checkConditions()) {
|
||||
return false;
|
||||
}
|
||||
return StaticAbilityCantAttackBlock.getAttackCost(this, attacker, null).hasSpecificCostType(CostExert.class);
|
||||
return StaticAbilityCantAttackBlock.getAttackCost(this, attacker, null).hasSpecificCostType(costType);
|
||||
}
|
||||
|
||||
public final Cost getBlockCost(final Card blocker, final Card attacker) {
|
||||
|
||||
Reference in New Issue
Block a user