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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public final Cost getAttackCost(final Card attacker, final GameEntity target) {
|
||||||
* Apply ability.
|
if (this.isSuppressed() || !params.get("Mode").equals("CantAttackUnless") || !this.checkConditions()) {
|
||||||
*
|
|
||||||
* @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)) {
|
|
||||||
return null;
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
|
return StaticAbilityCantAttackBlock.getBlockCost(this, blocker, attacker);
|
||||||
if (mode.equals("CantAttackUnless")) {
|
|
||||||
return StaticAbilityCantAttackBlock.applyCantAttackUnlessAbility(this, card, target);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mode.equals("CantBlockUnless")) {
|
|
||||||
return StaticAbilityCantAttackBlock.applyCantBlockUnlessAbility(this, card, target);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public class StaticAbilityCantAttackBlock {
|
|||||||
* the card
|
* the card
|
||||||
* @return a Cost
|
* @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 HashMap<String, String> params = stAb.getMapParams();
|
||||||
final Card hostCard = stAb.getHostCard();
|
final Card hostCard = stAb.getHostCard();
|
||||||
|
|
||||||
@@ -100,7 +100,7 @@ public class StaticAbilityCantAttackBlock {
|
|||||||
* the card
|
* the card
|
||||||
* @return a Cost
|
* @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 HashMap<String, String> params = stAb.getMapParams();
|
||||||
final Card hostCard = stAb.getHostCard();
|
final Card hostCard = stAb.getHostCard();
|
||||||
|
|
||||||
|
|||||||
@@ -1131,7 +1131,7 @@ public class CombatUtil {
|
|||||||
for (Card card : game.getCardsIn(ZoneType.Battlefield)) {
|
for (Card card : game.getCardsIn(ZoneType.Battlefield)) {
|
||||||
final ArrayList<StaticAbility> staticAbilities = card.getStaticAbilities();
|
final ArrayList<StaticAbility> staticAbilities = card.getStaticAbilities();
|
||||||
for (final StaticAbility stAb : staticAbilities) {
|
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 )
|
if ( null != additionalCost )
|
||||||
attackCost.add(additionalCost);
|
attackCost.add(additionalCost);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ public class PhaseUtil {
|
|||||||
for (Card card : game.getCardsIn(ZoneType.Battlefield)) {
|
for (Card card : game.getCardsIn(ZoneType.Battlefield)) {
|
||||||
final ArrayList<StaticAbility> staticAbilities = card.getStaticAbilities();
|
final ArrayList<StaticAbility> staticAbilities = card.getStaticAbilities();
|
||||||
for (final StaticAbility stAb : staticAbilities) {
|
for (final StaticAbility stAb : staticAbilities) {
|
||||||
Cost c1 = stAb.getCostAbility("CantBlockUnless", blocker, attacker);
|
Cost c1 = stAb.getBlockCost(blocker, attacker);
|
||||||
if ( c1 != null )
|
if ( c1 != null )
|
||||||
blockCost.add(c1);
|
blockCost.add(c1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user