mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
getAttackCost & getBlockCost - straight methods
This commit is contained in:
@@ -440,37 +440,18 @@ public class StaticAbility {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply ability.
|
||||
*
|
||||
* @param mode
|
||||
* the mode
|
||||
* @param card
|
||||
* the card
|
||||
* @param target
|
||||
* the target
|
||||
* @return true, if successful
|
||||
*/
|
||||
public final Cost getCostAbility(final String mode, final Card card, final GameEntity target) {
|
||||
|
||||
// don't apply the ability if it hasn't got the right mode
|
||||
if (!this.params.get("Mode").equals(mode)) {
|
||||
public final Cost getAttackCost(final Card attacker, final GameEntity target) {
|
||||
if (this.isSuppressed() || !params.get("Mode").equals("CantAttackUnless") || !this.checkConditions()) {
|
||||
return null;
|
||||
}
|
||||
return StaticAbilityCantAttackBlock.getAttackCost(this, attacker, target);
|
||||
}
|
||||
|
||||
if (this.isSuppressed() || !this.checkConditions()) {
|
||||
public final Cost getBlockCost(final Card blocker, final Card attacker) {
|
||||
if (this.isSuppressed() || !params.get("Mode").equals("CantBlockUnless") || !this.checkConditions()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (mode.equals("CantAttackUnless")) {
|
||||
return StaticAbilityCantAttackBlock.applyCantAttackUnlessAbility(this, card, target);
|
||||
}
|
||||
|
||||
if (mode.equals("CantBlockUnless")) {
|
||||
return StaticAbilityCantAttackBlock.applyCantBlockUnlessAbility(this, card, target);
|
||||
}
|
||||
|
||||
return null;
|
||||
return StaticAbilityCantAttackBlock.getBlockCost(this, blocker, attacker);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -64,7 +64,7 @@ public class StaticAbilityCantAttackBlock {
|
||||
* the card
|
||||
* @return a Cost
|
||||
*/
|
||||
public static Cost applyCantAttackUnlessAbility(final StaticAbility stAb, final Card card, final GameEntity target) {
|
||||
public static Cost getAttackCost(final StaticAbility stAb, final Card card, final GameEntity target) {
|
||||
final HashMap<String, String> params = stAb.getMapParams();
|
||||
final Card hostCard = stAb.getHostCard();
|
||||
|
||||
@@ -100,7 +100,7 @@ public class StaticAbilityCantAttackBlock {
|
||||
* the card
|
||||
* @return a Cost
|
||||
*/
|
||||
public static Cost applyCantBlockUnlessAbility(final StaticAbility stAb, final Card blocker, final GameEntity attacker) {
|
||||
public static Cost getBlockCost(final StaticAbility stAb, final Card blocker, final GameEntity attacker) {
|
||||
final HashMap<String, String> params = stAb.getMapParams();
|
||||
final Card hostCard = stAb.getHostCard();
|
||||
|
||||
|
||||
@@ -1131,7 +1131,7 @@ public class CombatUtil {
|
||||
for (Card card : game.getCardsIn(ZoneType.Battlefield)) {
|
||||
final ArrayList<StaticAbility> staticAbilities = card.getStaticAbilities();
|
||||
for (final StaticAbility stAb : staticAbilities) {
|
||||
Cost additionalCost = stAb.getCostAbility("CantAttackUnless", c, game.getCombat().getDefenderByAttacker(c));
|
||||
Cost additionalCost = stAb.getAttackCost(c, game.getCombat().getDefenderByAttacker(c));
|
||||
if ( null != additionalCost )
|
||||
attackCost.add(additionalCost);
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ public class PhaseUtil {
|
||||
for (Card card : game.getCardsIn(ZoneType.Battlefield)) {
|
||||
final ArrayList<StaticAbility> staticAbilities = card.getStaticAbilities();
|
||||
for (final StaticAbility stAb : staticAbilities) {
|
||||
Cost c1 = stAb.getCostAbility("CantBlockUnless", blocker, attacker);
|
||||
Cost c1 = stAb.getBlockCost(blocker, attacker);
|
||||
if ( c1 != null )
|
||||
blockCost.add(c1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user