mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
- Cleanup in GameAction and GameActionUtil.
This commit is contained in:
@@ -7907,9 +7907,6 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
damageToAdd = this.replaceDamage(damageToAdd, source, true);
|
damageToAdd = this.replaceDamage(damageToAdd, source, true);
|
||||||
damageToAdd = this.preventDamage(damageToAdd, source, true);
|
damageToAdd = this.preventDamage(damageToAdd, source, true);
|
||||||
|
|
||||||
if ((damageToAdd > 0) && this.isCreature()) {
|
|
||||||
GameActionUtil.executeCombatDamageToCreatureEffects(source, this, damageToAdd);
|
|
||||||
}
|
|
||||||
map.put(source, damageToAdd);
|
map.put(source, damageToAdd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,8 +30,6 @@ import forge.card.abilityfactory.AbilityFactoryAttach;
|
|||||||
import forge.card.abilityfactory.AbilityFactoryCharm;
|
import forge.card.abilityfactory.AbilityFactoryCharm;
|
||||||
import forge.card.cardfactory.CardFactoryUtil;
|
import forge.card.cardfactory.CardFactoryUtil;
|
||||||
import forge.card.cost.Cost;
|
import forge.card.cost.Cost;
|
||||||
import forge.card.cost.CostMana;
|
|
||||||
import forge.card.cost.CostPart;
|
|
||||||
import forge.card.cost.CostPayment;
|
import forge.card.cost.CostPayment;
|
||||||
import forge.card.mana.ManaCost;
|
import forge.card.mana.ManaCost;
|
||||||
import forge.card.mana.ManaCostShard;
|
import forge.card.mana.ManaCostShard;
|
||||||
@@ -41,7 +39,6 @@ import forge.card.spellability.AbilityStatic;
|
|||||||
import forge.card.spellability.Spell;
|
import forge.card.spellability.Spell;
|
||||||
import forge.card.spellability.SpellAbility;
|
import forge.card.spellability.SpellAbility;
|
||||||
import forge.card.spellability.SpellAbilityRequirements;
|
import forge.card.spellability.SpellAbilityRequirements;
|
||||||
import forge.card.spellability.SpellAbilityRestriction;
|
|
||||||
import forge.card.spellability.Target;
|
import forge.card.spellability.Target;
|
||||||
import forge.card.spellability.TargetSelection;
|
import forge.card.spellability.TargetSelection;
|
||||||
import forge.card.staticability.StaticAbility;
|
import forge.card.staticability.StaticAbility;
|
||||||
@@ -365,37 +362,6 @@ public class GameAction {
|
|||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* public void changeController(CardList list, Player oldController, Player
|
|
||||||
* newController) { if (oldController.equals(newController)) return;
|
|
||||||
*
|
|
||||||
* // Consolidating this code for now. In the future I want moveTo to handle
|
|
||||||
* this garbage PlayerZone oldBattlefield =
|
|
||||||
* oldController.getZone(Constant.Zone.Battlefield); PlayerZone
|
|
||||||
* newBattlefield = newController.getZone(Constant.Zone.Battlefield);
|
|
||||||
*
|
|
||||||
* AllZone.getTriggerHandler().suppressMode("ChangesZone");
|
|
||||||
* ((PlayerZone_ComesIntoPlay)
|
|
||||||
* AllZone.getHumanPlayer().getZone(Zone.Battlefield)).setTriggers(false);
|
|
||||||
* ((PlayerZone_ComesIntoPlay)
|
|
||||||
* AllZone.getComputerPlayer().getZone(Zone.Battlefield
|
|
||||||
* )).setTriggers(false); //so "enters the battlefield" abilities don't
|
|
||||||
* trigger
|
|
||||||
*
|
|
||||||
* for (Card c : list) { int turnInZone = c.getTurnInZone();
|
|
||||||
* oldBattlefield.remove(c); c.setController(newController);
|
|
||||||
* newBattlefield.add(c); //set summoning sickness c.setSickness(true);
|
|
||||||
* c.setTurnInZone(turnInZone); // The number of turns in the zone should
|
|
||||||
* not change if (c.isCreature()) AllZone.getCombat().removeFromCombat(c); }
|
|
||||||
*
|
|
||||||
* AllZone.getTriggerHandler().clearSuppression("ChangesZone");
|
|
||||||
* ((PlayerZone_ComesIntoPlay)
|
|
||||||
* AllZone.getHumanPlayer().getZone(Zone.Battlefield)).setTriggers(true);
|
|
||||||
* ((PlayerZone_ComesIntoPlay)
|
|
||||||
* AllZone.getComputerPlayer().getZone(Zone.Battlefield)).setTriggers(true);
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controller change zone correction.
|
* Controller change zone correction.
|
||||||
*
|
*
|
||||||
@@ -1540,118 +1506,7 @@ public class GameAction {
|
|||||||
|
|
||||||
private boolean startCut = false;
|
private boolean startCut = false;
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* getAlternativeCosts.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param sa
|
|
||||||
* a SpellAbility.
|
|
||||||
* @return an ArrayList<SpellAbility>.
|
|
||||||
* get alternative costs as additional spell abilities
|
|
||||||
*/
|
|
||||||
public static final ArrayList<SpellAbility> getAlternativeCosts(SpellAbility sa) {
|
|
||||||
ArrayList<SpellAbility> alternatives = new ArrayList<SpellAbility>();
|
|
||||||
Card source = sa.getSourceCard();
|
|
||||||
if (!sa.isBasicSpell()) {
|
|
||||||
return alternatives;
|
|
||||||
}
|
|
||||||
for (final String keyword : source.getKeyword()) {
|
|
||||||
if (sa.isSpell() && keyword.startsWith("Flashback")) {
|
|
||||||
final SpellAbility flashback = sa.copy();
|
|
||||||
flashback.setFlashBackAbility(true);
|
|
||||||
SpellAbilityRestriction sar = new SpellAbilityRestriction();
|
|
||||||
sar.setVariables(sa.getRestrictions());
|
|
||||||
sar.setZone(ZoneType.Graveyard);
|
|
||||||
flashback.setRestrictions(sar);
|
|
||||||
|
|
||||||
// there is a flashback cost (and not the cards cost)
|
|
||||||
if (!keyword.equals("Flashback")) {
|
|
||||||
final Cost fbCost = new Cost(source, keyword.substring(10), false);
|
|
||||||
flashback.setPayCosts(fbCost);
|
|
||||||
}
|
|
||||||
alternatives.add(flashback);
|
|
||||||
}
|
|
||||||
if (sa.isSpell() && keyword.equals("May be played without paying its mana cost")) {
|
|
||||||
final SpellAbility newSA = sa.copy();
|
|
||||||
SpellAbilityRestriction sar = new SpellAbilityRestriction();
|
|
||||||
sar.setVariables(sa.getRestrictions());
|
|
||||||
sar.setZone(null);
|
|
||||||
newSA.setRestrictions(sar);
|
|
||||||
final Cost cost = new Cost(source, "", false);
|
|
||||||
if (newSA.getPayCosts() != null) {
|
|
||||||
for (final CostPart part : newSA.getPayCosts().getCostParts()) {
|
|
||||||
if (!(part instanceof CostMana)) {
|
|
||||||
cost.getCostParts().add(part);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
newSA.setBasicSpell(false);
|
|
||||||
newSA.setPayCosts(cost);
|
|
||||||
newSA.setManaCost("");
|
|
||||||
newSA.setDescription(sa.getDescription() + " (without paying its mana cost)");
|
|
||||||
alternatives.add(newSA);
|
|
||||||
}
|
|
||||||
if (sa.isSpell() && keyword.equals("May be played by your opponent without paying its mana cost")) {
|
|
||||||
final SpellAbility newSA = sa.copy();
|
|
||||||
SpellAbilityRestriction sar = new SpellAbilityRestriction();
|
|
||||||
sar.setVariables(sa.getRestrictions());
|
|
||||||
sar.setZone(null);
|
|
||||||
sar.setOpponentOnly(true);
|
|
||||||
newSA.setRestrictions(sar);
|
|
||||||
final Cost cost = new Cost(source, "", false);
|
|
||||||
if (newSA.getPayCosts() != null) {
|
|
||||||
for (final CostPart part : newSA.getPayCosts().getCostParts()) {
|
|
||||||
if (!(part instanceof CostMana)) {
|
|
||||||
cost.getCostParts().add(part);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
newSA.setBasicSpell(false);
|
|
||||||
newSA.setPayCosts(cost);
|
|
||||||
newSA.setManaCost("");
|
|
||||||
newSA.setDescription(sa.getDescription() + " (without paying its mana cost)");
|
|
||||||
alternatives.add(newSA);
|
|
||||||
}
|
|
||||||
if (sa.isSpell() && keyword.startsWith("May be played without paying its mana cost and as though it has flash")) {
|
|
||||||
final SpellAbility newSA = sa.copy();
|
|
||||||
SpellAbilityRestriction sar = new SpellAbilityRestriction();
|
|
||||||
sar.setVariables(sa.getRestrictions());
|
|
||||||
sar.setInstantSpeed(true);
|
|
||||||
newSA.setRestrictions(sar);
|
|
||||||
final Cost cost = new Cost(source, "", false);
|
|
||||||
if (newSA.getPayCosts() != null) {
|
|
||||||
for (final CostPart part : newSA.getPayCosts().getCostParts()) {
|
|
||||||
if (!(part instanceof CostMana)) {
|
|
||||||
cost.getCostParts().add(part);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
newSA.setBasicSpell(false);
|
|
||||||
newSA.setPayCosts(cost);
|
|
||||||
newSA.setManaCost("");
|
|
||||||
newSA.setDescription(sa.getDescription() + " (without paying its mana cost and as though it has flash)");
|
|
||||||
alternatives.add(newSA);
|
|
||||||
}
|
|
||||||
if (sa.isSpell() && keyword.startsWith("Alternative Cost")) {
|
|
||||||
final SpellAbility newSA = sa.copy();
|
|
||||||
final Cost cost = new Cost(source, keyword.substring(17), false);
|
|
||||||
if (newSA.getPayCosts() != null) {
|
|
||||||
for (final CostPart part : newSA.getPayCosts().getCostParts()) {
|
|
||||||
if (!(part instanceof CostMana)) {
|
|
||||||
cost.getCostParts().add(part);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
newSA.setBasicSpell(false);
|
|
||||||
newSA.setPayCosts(cost);
|
|
||||||
newSA.setManaCost("");
|
|
||||||
newSA.setDescription(sa.getDescription() + " (by paying " + keyword.substring(17) + " instead of its mana cost)");
|
|
||||||
alternatives.add(newSA);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return alternatives;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -1678,7 +1533,7 @@ public class GameAction {
|
|||||||
}
|
}
|
||||||
for (SpellAbility sa : basicAbilities) {
|
for (SpellAbility sa : basicAbilities) {
|
||||||
//add alternative costs as additional spell abilities
|
//add alternative costs as additional spell abilities
|
||||||
abilities.addAll(getAlternativeCosts(sa));
|
abilities.addAll(GameActionUtil.getAlternativeCosts(sa));
|
||||||
}
|
}
|
||||||
for (final SpellAbility sa : abilities) {
|
for (final SpellAbility sa : abilities) {
|
||||||
sa.setActivatingPlayer(human);
|
sa.setActivatingPlayer(human);
|
||||||
@@ -2295,31 +2150,6 @@ public class GameAction {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* canPlaySpellAbility.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param sa
|
|
||||||
* an array of {@link forge.card.spellability.SpellAbility}
|
|
||||||
* objects.
|
|
||||||
* @return an array of {@link forge.card.spellability.SpellAbility} objects.
|
|
||||||
*/
|
|
||||||
public final SpellAbility[] canPlaySpellAbility(final SpellAbility[] sa) {
|
|
||||||
final ArrayList<SpellAbility> list = new ArrayList<SpellAbility>();
|
|
||||||
|
|
||||||
for (final SpellAbility element : sa) {
|
|
||||||
element.setActivatingPlayer(AllZone.getHumanPlayer());
|
|
||||||
if (element.canPlay()) {
|
|
||||||
list.add(element);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
final SpellAbility[] array = new SpellAbility[list.size()];
|
|
||||||
list.toArray(array);
|
|
||||||
return array;
|
|
||||||
} // canPlaySpellAbility()
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* setComputerCut.
|
* setComputerCut.
|
||||||
|
|||||||
@@ -30,11 +30,10 @@ import forge.card.cost.CostPayLife;
|
|||||||
import forge.card.cost.CostMana;
|
import forge.card.cost.CostMana;
|
||||||
import forge.card.cost.CostSacrifice;
|
import forge.card.cost.CostSacrifice;
|
||||||
import forge.card.spellability.Ability;
|
import forge.card.spellability.Ability;
|
||||||
import forge.card.spellability.AbilityActivated;
|
|
||||||
import forge.card.spellability.AbilityMana;
|
import forge.card.spellability.AbilityMana;
|
||||||
import forge.card.spellability.Spell;
|
import forge.card.spellability.Spell;
|
||||||
import forge.card.spellability.SpellAbility;
|
import forge.card.spellability.SpellAbility;
|
||||||
import forge.control.input.Input;
|
import forge.card.spellability.SpellAbilityRestriction;
|
||||||
import forge.control.input.InputPayManaCostAbility;
|
import forge.control.input.InputPayManaCostAbility;
|
||||||
import forge.control.input.InputPayManaCostUtil;
|
import forge.control.input.InputPayManaCostUtil;
|
||||||
import forge.control.input.InputPaySacCost;
|
import forge.control.input.InputPaySacCost;
|
||||||
@@ -46,7 +45,6 @@ import forge.game.zone.ZoneType;
|
|||||||
import forge.gui.GuiUtils;
|
import forge.gui.GuiUtils;
|
||||||
import forge.gui.match.CMatchUI;
|
import forge.gui.match.CMatchUI;
|
||||||
import forge.util.MyRandom;
|
import forge.util.MyRandom;
|
||||||
import forge.view.ButtonUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -649,29 +647,6 @@ public final class GameActionUtil {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// restricted to combat damage and dealing damage to creatures
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* executeCombatDamageToCreatureEffects.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param source
|
|
||||||
* a {@link forge.Card} object.
|
|
||||||
* @param affected
|
|
||||||
* a {@link forge.Card} object.
|
|
||||||
* @param damage
|
|
||||||
* a int.
|
|
||||||
*/
|
|
||||||
public static void executeCombatDamageToCreatureEffects(final Card source, final Card affected, final int damage) {
|
|
||||||
|
|
||||||
if (damage <= 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// placeholder for any future needs (everything that was here is
|
|
||||||
// converted to script)
|
|
||||||
}
|
|
||||||
|
|
||||||
// not restricted to combat damage, restricted to dealing damage to
|
// not restricted to combat damage, restricted to dealing damage to
|
||||||
// creatures
|
// creatures
|
||||||
/**
|
/**
|
||||||
@@ -915,12 +890,6 @@ public final class GameActionUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if ((CardFactoryUtil.hasNumberEquipments(c, "Quietus Spike") > 0) && (c.getNetAttack() > 0)) {
|
|
||||||
for (int k = 0; k < CardFactoryUtil.hasNumberEquipments(c, "Quietus Spike"); k++) {
|
|
||||||
GameActionUtil.playerCombatDamageLoseHalfLifeUp(c);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
if (c.getName().equals("Scalpelexis")) {
|
if (c.getName().equals("Scalpelexis")) {
|
||||||
GameActionUtil.playerCombatDamageScalpelexis(c);
|
GameActionUtil.playerCombatDamageScalpelexis(c);
|
||||||
} else if (c.getName().equals("Spawnwrithe")) {
|
} else if (c.getName().equals("Spawnwrithe")) {
|
||||||
@@ -935,7 +904,6 @@ public final class GameActionUtil {
|
|||||||
if (player.isPlayer(AllZone.getComputerPlayer())) {
|
if (player.isPlayer(AllZone.getComputerPlayer())) {
|
||||||
c.getDamageHistory().setDealtCombatDmgToComputerThisTurn(true);
|
c.getDamageHistory().setDealtCombatDmgToComputerThisTurn(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // executeCombatDamageToPlayerEffects
|
} // executeCombatDamageToPlayerEffects
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1004,35 +972,6 @@ public final class GameActionUtil {
|
|||||||
} // if
|
} // if
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* playerCombatDamageLoseHalfLifeUp.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param c
|
|
||||||
* a {@link forge.Card} object.
|
|
||||||
*/
|
|
||||||
private static void playerCombatDamageLoseHalfLifeUp(final Card c) {
|
|
||||||
final Player player = c.getController().getOpponent();
|
|
||||||
if (c.getNetAttack() > 0) {
|
|
||||||
final Ability ability2 = new Ability(c, "0") {
|
|
||||||
@Override
|
|
||||||
public void resolve() {
|
|
||||||
int x = (int) Math.ceil(player.getLife() / 2.0);
|
|
||||||
player.loseLife(x, c);
|
|
||||||
}
|
|
||||||
}; // ability2
|
|
||||||
|
|
||||||
final StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append(c.getName()).append(" - ").append(player);
|
|
||||||
sb.append(" loses half his or her life, rounded up.");
|
|
||||||
ability2.setStackDescription(sb.toString());
|
|
||||||
|
|
||||||
AllZone.getStack().addSimultaneousStackEntry(ability2);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* playerCombatDamageScalpelexis.
|
* playerCombatDamageScalpelexis.
|
||||||
@@ -1835,4 +1774,116 @@ public final class GameActionUtil {
|
|||||||
GameActionUtil.stLandManaAbilities = stLandManaAbilitiesIn;
|
GameActionUtil.stLandManaAbilities = stLandManaAbilitiesIn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* getAlternativeCosts.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param sa
|
||||||
|
* a SpellAbility.
|
||||||
|
* @return an ArrayList<SpellAbility>.
|
||||||
|
* get alternative costs as additional spell abilities
|
||||||
|
*/
|
||||||
|
public static final ArrayList<SpellAbility> getAlternativeCosts(SpellAbility sa) {
|
||||||
|
ArrayList<SpellAbility> alternatives = new ArrayList<SpellAbility>();
|
||||||
|
Card source = sa.getSourceCard();
|
||||||
|
if (!sa.isBasicSpell()) {
|
||||||
|
return alternatives;
|
||||||
|
}
|
||||||
|
for (final String keyword : source.getKeyword()) {
|
||||||
|
if (sa.isSpell() && keyword.startsWith("Flashback")) {
|
||||||
|
final SpellAbility flashback = sa.copy();
|
||||||
|
flashback.setFlashBackAbility(true);
|
||||||
|
SpellAbilityRestriction sar = new SpellAbilityRestriction();
|
||||||
|
sar.setVariables(sa.getRestrictions());
|
||||||
|
sar.setZone(ZoneType.Graveyard);
|
||||||
|
flashback.setRestrictions(sar);
|
||||||
|
|
||||||
|
// there is a flashback cost (and not the cards cost)
|
||||||
|
if (!keyword.equals("Flashback")) {
|
||||||
|
final Cost fbCost = new Cost(source, keyword.substring(10), false);
|
||||||
|
flashback.setPayCosts(fbCost);
|
||||||
|
}
|
||||||
|
alternatives.add(flashback);
|
||||||
|
}
|
||||||
|
if (sa.isSpell() && keyword.equals("May be played without paying its mana cost")) {
|
||||||
|
final SpellAbility newSA = sa.copy();
|
||||||
|
SpellAbilityRestriction sar = new SpellAbilityRestriction();
|
||||||
|
sar.setVariables(sa.getRestrictions());
|
||||||
|
sar.setZone(null);
|
||||||
|
newSA.setRestrictions(sar);
|
||||||
|
final Cost cost = new Cost(source, "", false);
|
||||||
|
if (newSA.getPayCosts() != null) {
|
||||||
|
for (final CostPart part : newSA.getPayCosts().getCostParts()) {
|
||||||
|
if (!(part instanceof CostMana)) {
|
||||||
|
cost.getCostParts().add(part);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
newSA.setBasicSpell(false);
|
||||||
|
newSA.setPayCosts(cost);
|
||||||
|
newSA.setManaCost("");
|
||||||
|
newSA.setDescription(sa.getDescription() + " (without paying its mana cost)");
|
||||||
|
alternatives.add(newSA);
|
||||||
|
}
|
||||||
|
if (sa.isSpell() && keyword.equals("May be played by your opponent without paying its mana cost")) {
|
||||||
|
final SpellAbility newSA = sa.copy();
|
||||||
|
SpellAbilityRestriction sar = new SpellAbilityRestriction();
|
||||||
|
sar.setVariables(sa.getRestrictions());
|
||||||
|
sar.setZone(null);
|
||||||
|
sar.setOpponentOnly(true);
|
||||||
|
newSA.setRestrictions(sar);
|
||||||
|
final Cost cost = new Cost(source, "", false);
|
||||||
|
if (newSA.getPayCosts() != null) {
|
||||||
|
for (final CostPart part : newSA.getPayCosts().getCostParts()) {
|
||||||
|
if (!(part instanceof CostMana)) {
|
||||||
|
cost.getCostParts().add(part);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
newSA.setBasicSpell(false);
|
||||||
|
newSA.setPayCosts(cost);
|
||||||
|
newSA.setManaCost("");
|
||||||
|
newSA.setDescription(sa.getDescription() + " (without paying its mana cost)");
|
||||||
|
alternatives.add(newSA);
|
||||||
|
}
|
||||||
|
if (sa.isSpell() && keyword.startsWith("May be played without paying its mana cost and as though it has flash")) {
|
||||||
|
final SpellAbility newSA = sa.copy();
|
||||||
|
SpellAbilityRestriction sar = new SpellAbilityRestriction();
|
||||||
|
sar.setVariables(sa.getRestrictions());
|
||||||
|
sar.setInstantSpeed(true);
|
||||||
|
newSA.setRestrictions(sar);
|
||||||
|
final Cost cost = new Cost(source, "", false);
|
||||||
|
if (newSA.getPayCosts() != null) {
|
||||||
|
for (final CostPart part : newSA.getPayCosts().getCostParts()) {
|
||||||
|
if (!(part instanceof CostMana)) {
|
||||||
|
cost.getCostParts().add(part);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
newSA.setBasicSpell(false);
|
||||||
|
newSA.setPayCosts(cost);
|
||||||
|
newSA.setManaCost("");
|
||||||
|
newSA.setDescription(sa.getDescription() + " (without paying its mana cost and as though it has flash)");
|
||||||
|
alternatives.add(newSA);
|
||||||
|
}
|
||||||
|
if (sa.isSpell() && keyword.startsWith("Alternative Cost")) {
|
||||||
|
final SpellAbility newSA = sa.copy();
|
||||||
|
final Cost cost = new Cost(source, keyword.substring(17), false);
|
||||||
|
if (newSA.getPayCosts() != null) {
|
||||||
|
for (final CostPart part : newSA.getPayCosts().getCostParts()) {
|
||||||
|
if (!(part instanceof CostMana)) {
|
||||||
|
cost.getCostParts().add(part);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
newSA.setBasicSpell(false);
|
||||||
|
newSA.setPayCosts(cost);
|
||||||
|
newSA.setManaCost("");
|
||||||
|
newSA.setDescription(sa.getDescription() + " (by paying " + keyword.substring(17) + " instead of its mana cost)");
|
||||||
|
alternatives.add(newSA);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return alternatives;
|
||||||
|
}
|
||||||
} // end class GameActionUtil
|
} // end class GameActionUtil
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import forge.CardList;
|
|||||||
import forge.CardListFilter;
|
import forge.CardListFilter;
|
||||||
import forge.CardListUtil;
|
import forge.CardListUtil;
|
||||||
import forge.CardUtil;
|
import forge.CardUtil;
|
||||||
import forge.GameAction;
|
import forge.GameActionUtil;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.card.abilityfactory.AbilityFactory;
|
import forge.card.abilityfactory.AbilityFactory;
|
||||||
import forge.card.cardfactory.CardFactoryUtil;
|
import forge.card.cardfactory.CardFactoryUtil;
|
||||||
@@ -77,7 +77,7 @@ public class ComputerUtil {
|
|||||||
final ArrayList<SpellAbility> abilities = new ArrayList<SpellAbility>();
|
final ArrayList<SpellAbility> abilities = new ArrayList<SpellAbility>();
|
||||||
for (SpellAbility sa : all) {
|
for (SpellAbility sa : all) {
|
||||||
//add alternative costs as additional spell abilities
|
//add alternative costs as additional spell abilities
|
||||||
abilities.addAll(GameAction.getAlternativeCosts(sa));
|
abilities.addAll(GameActionUtil.getAlternativeCosts(sa));
|
||||||
abilities.add(sa);
|
abilities.add(sa);
|
||||||
}
|
}
|
||||||
for (final SpellAbility sa : abilities) {
|
for (final SpellAbility sa : abilities) {
|
||||||
@@ -256,7 +256,7 @@ public class ComputerUtil {
|
|||||||
final ArrayList<SpellAbility> abilities = new ArrayList<SpellAbility>();
|
final ArrayList<SpellAbility> abilities = new ArrayList<SpellAbility>();
|
||||||
for (SpellAbility sa : possibleCounters) {
|
for (SpellAbility sa : possibleCounters) {
|
||||||
//add alternative costs as additional spell abilities
|
//add alternative costs as additional spell abilities
|
||||||
abilities.addAll(GameAction.getAlternativeCosts(sa));
|
abilities.addAll(GameActionUtil.getAlternativeCosts(sa));
|
||||||
abilities.add(sa);
|
abilities.add(sa);
|
||||||
}
|
}
|
||||||
for (final SpellAbility sa : abilities) {
|
for (final SpellAbility sa : abilities) {
|
||||||
|
|||||||
Reference in New Issue
Block a user