mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +00:00
- CheckStyle.
This commit is contained in:
@@ -778,7 +778,7 @@ public class CardFactoryCreatures {
|
|||||||
Zone zone = Singletons.getModel().getGame().getZoneOf(c);
|
Zone zone = Singletons.getModel().getGame().getZoneOf(c);
|
||||||
return zone.is(ZoneType.Battlefield) && c.getController() == ability.getTargetPlayer() && c.canBeTargetedBy(ability);
|
return zone.is(ZoneType.Battlefield) && c.getController() == ability.getTargetPlayer() && c.canBeTargetedBy(ability);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Input onDone() {
|
protected Input onDone() {
|
||||||
final StringBuilder sb = new StringBuilder();
|
final StringBuilder sb = new StringBuilder();
|
||||||
@@ -791,7 +791,7 @@ public class CardFactoryCreatures {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
targetInput.setMessage("Select up to 5 target permanents. Selected (%d) so far. Click OK when done.");
|
targetInput.setMessage("Select up to 5 target permanents. Selected (%d) so far. Click OK when done.");
|
||||||
|
|
||||||
Predicate<Player> canTarget = new Predicate<Player>() {
|
Predicate<Player> canTarget = new Predicate<Player>() {
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ public class CostDiscard extends CostPartWithList {
|
|||||||
return handList.contains(c);
|
return handList.contains(c);
|
||||||
} else {
|
} else {
|
||||||
if (ability.isSpell()) {
|
if (ability.isSpell()) {
|
||||||
handList.remove(source);// can't pay for itself
|
handList.remove(source); // can't pay for itself
|
||||||
}
|
}
|
||||||
boolean sameName = false;
|
boolean sameName = false;
|
||||||
if (type.contains("+WithSameName")) {
|
if (type.contains("+WithSameName")) {
|
||||||
@@ -385,14 +385,14 @@ public class CostDiscard extends CostPartWithList {
|
|||||||
public void selectCard(final Card card) {
|
public void selectCard(final Card card) {
|
||||||
Zone zone = Singletons.getModel().getGame().getZoneOf(card);
|
Zone zone = Singletons.getModel().getGame().getZoneOf(card);
|
||||||
if (zone.is(ZoneType.Hand) && handList.contains(card)) {
|
if (zone.is(ZoneType.Hand) && handList.contains(card)) {
|
||||||
if (!sameName || part.getList().isEmpty()
|
if (!sameName || part.getList().isEmpty()
|
||||||
|| part.getList().get(0).getName().equals(card.getName())) {
|
|| part.getList().get(0).getName().equals(card.getName())) {
|
||||||
// send in List<Card> for Typing
|
// send in List<Card> for Typing
|
||||||
card.getController().discard(card, sp);
|
card.getController().discard(card, sp);
|
||||||
part.addToList(card);
|
part.addToList(card);
|
||||||
handList.remove(card);
|
handList.remove(card);
|
||||||
this.nDiscard++;
|
this.nDiscard++;
|
||||||
|
|
||||||
// in case no more cards in hand
|
// in case no more cards in hand
|
||||||
if (this.nDiscard == nNeeded) {
|
if (this.nDiscard == nNeeded) {
|
||||||
this.done();
|
this.done();
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ public class CostExile extends CostPartWithList {
|
|||||||
} else if (this.getType().equals("All")) {
|
} else if (this.getType().equals("All")) {
|
||||||
sb.append(" all cards from your ").append(this.from);
|
sb.append(" all cards from your ").append(this.from);
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.from.equals(ZoneType.Battlefield)) {
|
if (this.from.equals(ZoneType.Battlefield)) {
|
||||||
final String desc = this.getTypeDescription() == null ? this.getType() : this.getTypeDescription();
|
final String desc = this.getTypeDescription() == null ? this.getType() : this.getTypeDescription();
|
||||||
@@ -150,7 +150,7 @@ public class CostExile extends CostPartWithList {
|
|||||||
List<Card> typeList = new ArrayList<Card>();
|
List<Card> typeList = new ArrayList<Card>();
|
||||||
if (this.getType().equals("All")) {
|
if (this.getType().equals("All")) {
|
||||||
return true; // this will always work
|
return true; // this will always work
|
||||||
}
|
}
|
||||||
if (this.getFrom().equals(ZoneType.Stack)) {
|
if (this.getFrom().equals(ZoneType.Stack)) {
|
||||||
for (int i = 0; i < Singletons.getModel().getGame().getStack().size(); i++) {
|
for (int i = 0; i < Singletons.getModel().getGame().getStack().size(); i++) {
|
||||||
typeList.add(Singletons.getModel().getGame().getStack().peekAbility(i).getSourceCard());
|
typeList.add(Singletons.getModel().getGame().getStack().peekAbility(i).getSourceCard());
|
||||||
@@ -213,7 +213,7 @@ public class CostExile extends CostPartWithList {
|
|||||||
Singletons.getModel().getGame().getAction().exile(card);
|
Singletons.getModel().getGame().getAction().exile(card);
|
||||||
}
|
}
|
||||||
payment.paidCost(this);
|
payment.paidCost(this);
|
||||||
}
|
}
|
||||||
list = CardLists.getValidCards(list, this.getType().split(";"), activator, source);
|
list = CardLists.getValidCards(list, this.getType().split(";"), activator, source);
|
||||||
if (c == null) {
|
if (c == null) {
|
||||||
final String sVar = ability.getSVar(amount);
|
final String sVar = ability.getSVar(amount);
|
||||||
|
|||||||
@@ -494,7 +494,7 @@ public class ManaCost {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String manaColor = mana.getColor();
|
String manaColor = mana.getColor();
|
||||||
|
|
||||||
if (choice.isOr2Colorless() && !this.isColor(InputPayManaCostUtil.getShortColorString(manaColor))) {
|
if (choice.isOr2Colorless() && !this.isColor(InputPayManaCostUtil.getShortColorString(manaColor))) {
|
||||||
this.increaseColorlessMana(1);
|
this.increaseColorlessMana(1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -362,10 +362,14 @@ public class ManaCostShard {
|
|||||||
*/
|
*/
|
||||||
public boolean canBePaidWithManaOfColor(CardColor color) {
|
public boolean canBePaidWithManaOfColor(CardColor color) {
|
||||||
// can pay with life?
|
// can pay with life?
|
||||||
if ( (this.shard & Atom.OR_2_LIFE) != 0 ) return true;
|
if ((this.shard & Atom.OR_2_LIFE) != 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
// can pay with any color?
|
// can pay with any color?
|
||||||
if ( (this.shard & Atom.OR_2_COLORLESS) != 0 || 0 != ( this.shard & Atom.COLORLESS ) ) return true;
|
if ((this.shard & Atom.OR_2_COLORLESS) != 0 || 0 != (this.shard & Atom.COLORLESS)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
// either colored part is empty, or there are same colors in shard and mana source
|
// either colored part is empty, or there are same colors in shard and mana source
|
||||||
return ( 0xFF & this.shard ) == 0 || ( color.getColor() & this.shard ) > 0;
|
return (0xFF & this.shard) == 0 || (color.getColor() & this.shard) > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -178,9 +178,9 @@ public class ManaPool {
|
|||||||
*/
|
*/
|
||||||
public final int clearPool(boolean isEndOfPhase) {
|
public final int clearPool(boolean isEndOfPhase) {
|
||||||
int numRemoved = 0;
|
int numRemoved = 0;
|
||||||
|
|
||||||
if (isEndOfPhase &&
|
if (isEndOfPhase
|
||||||
Singletons.getModel().getGame().getStaticEffects().getGlobalRuleChange(GlobalRuleChange.manapoolsDontEmpty)) {
|
&& Singletons.getModel().getGame().getStaticEffects().getGlobalRuleChange(GlobalRuleChange.manapoolsDontEmpty)) {
|
||||||
return numRemoved;
|
return numRemoved;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ import forge.util.Expressions;
|
|||||||
public abstract class ReplacementEffect extends TriggerReplacementBase {
|
public abstract class ReplacementEffect extends TriggerReplacementBase {
|
||||||
|
|
||||||
private ReplacementLayer layer = ReplacementLayer.None;
|
private ReplacementLayer layer = ReplacementLayer.None;
|
||||||
|
|
||||||
/** The has run. */
|
/** The has run. */
|
||||||
private boolean hasRun = false;
|
private boolean hasRun = false;
|
||||||
|
|
||||||
@@ -102,7 +102,7 @@ public abstract class ReplacementEffect extends TriggerReplacementBase {
|
|||||||
if (Expressions.compare(left, comparator, compareTo)) {
|
if (Expressions.compare(left, comparator, compareTo)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (sa != null && sa.doTrigger(false)){
|
} else if (sa != null && sa.doTrigger(false)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,7 +204,7 @@ public abstract class ReplacementEffect extends TriggerReplacementBase {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.getMapParams().containsKey("PlayerTurn")) {
|
if (this.getMapParams().containsKey("PlayerTurn")) {
|
||||||
if (this.getMapParams().get("PlayerTurn").equals("True") && !Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(this.getHostCard().getController())) {
|
if (this.getMapParams().get("PlayerTurn").equals("True") && !Singletons.getModel().getGame().getPhaseHandler().isPlayerTurn(this.getHostCard().getController())) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ public class ReplacementHandler {
|
|||||||
* the run params,same as for triggers.
|
* the run params,same as for triggers.
|
||||||
* @return true if the event was replaced.
|
* @return true if the event was replaced.
|
||||||
*/
|
*/
|
||||||
public ReplacementResult run(final HashMap<String, Object> runParams, final ReplacementLayer layer,final Player decider) {
|
public ReplacementResult run(final HashMap<String, Object> runParams, final ReplacementLayer layer, final Player decider) {
|
||||||
|
|
||||||
final List<ReplacementEffect> possibleReplacers = new ArrayList<ReplacementEffect>();
|
final List<ReplacementEffect> possibleReplacers = new ArrayList<ReplacementEffect>();
|
||||||
// Round up Non-static replacement effects ("Until EOT," or
|
// Round up Non-static replacement effects ("Until EOT," or
|
||||||
@@ -283,7 +283,7 @@ public class ReplacementHandler {
|
|||||||
} else if (eventToReplace.equals("Moved")) {
|
} else if (eventToReplace.equals("Moved")) {
|
||||||
ret = new ReplaceMoved(mapParams, host);
|
ret = new ReplaceMoved(mapParams, host);
|
||||||
}
|
}
|
||||||
|
|
||||||
String activeZones = mapParams.get("ActiveZones");
|
String activeZones = mapParams.get("ActiveZones");
|
||||||
if (null != activeZones) {
|
if (null != activeZones) {
|
||||||
ret.setActiveZone(EnumSet.copyOf(ZoneType.listValueOf(activeZones)));
|
ret.setActiveZone(EnumSet.copyOf(ZoneType.listValueOf(activeZones)));
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ public enum ReplacementLayer {
|
|||||||
Copy,
|
Copy,
|
||||||
Other,
|
Other,
|
||||||
None;
|
None;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: Write javadoc for this method.
|
* TODO: Write javadoc for this method.
|
||||||
* @param substring
|
* @param substring
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ public abstract class AbilityActivated extends SpellAbility implements java.io.S
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isCycling()
|
if (this.isCycling()
|
||||||
&& Singletons.getModel().getGame().getStaticEffects().getGlobalRuleChange(GlobalRuleChange.noCycling)) {
|
&& Singletons.getModel().getGame().getStaticEffects().getGlobalRuleChange(GlobalRuleChange.noCycling)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -117,7 +117,7 @@ public abstract class AbilityActivated extends SpellAbility implements java.io.S
|
|||||||
|
|
||||||
return CostPayment.canPayAdditionalCosts(this.getPayCosts(), this);
|
return CostPayment.canPayAdditionalCosts(this.getPayCosts(), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see forge.card.spellability.SpellAbility#resolve()
|
* @see forge.card.spellability.SpellAbility#resolve()
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class AbilityManaPart implements java.io.Serializable {
|
|||||||
private String origProduced;
|
private String origProduced;
|
||||||
private String lastExpressChoice = "";
|
private String lastExpressChoice = "";
|
||||||
private String manaRestrictions = "";
|
private String manaRestrictions = "";
|
||||||
transient private ArrayList<Mana> lastProduced = new ArrayList<Mana>();
|
private transient ArrayList<Mana> lastProduced = new ArrayList<Mana>();
|
||||||
private int amount = 1;
|
private int amount = 1;
|
||||||
|
|
||||||
/** The reflected. */
|
/** The reflected. */
|
||||||
@@ -54,13 +54,13 @@ public class AbilityManaPart implements java.io.Serializable {
|
|||||||
/** The canceled. */
|
/** The canceled. */
|
||||||
private boolean canceled = false;
|
private boolean canceled = false;
|
||||||
|
|
||||||
transient private final Card sourceCard;
|
private final transient Card sourceCard;
|
||||||
|
|
||||||
transient private Cost cost;
|
private transient Cost cost;
|
||||||
|
|
||||||
// Spells paid with this mana spell can't be countered.
|
// Spells paid with this mana spell can't be countered.
|
||||||
private boolean cannotCounterSpell;
|
private boolean cannotCounterSpell;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* Constructor for AbilityMana.
|
* Constructor for AbilityMana.
|
||||||
@@ -77,12 +77,12 @@ public class AbilityManaPart implements java.io.Serializable {
|
|||||||
*/
|
*/
|
||||||
public AbilityManaPart(final Card sourceCard, final Map<String, String> params) {
|
public AbilityManaPart(final Card sourceCard, final Map<String, String> params) {
|
||||||
this.sourceCard = sourceCard;
|
this.sourceCard = sourceCard;
|
||||||
|
|
||||||
origProduced = params.containsKey("Produced") ? params.get("Produced") : "1";
|
origProduced = params.containsKey("Produced") ? params.get("Produced") : "1";
|
||||||
if (params.containsKey("RestrictValid")) {
|
if (params.containsKey("RestrictValid")) {
|
||||||
this.manaRestrictions = params.get("RestrictValid");
|
this.manaRestrictions = params.get("RestrictValid");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.cannotCounterSpell = params.containsKey("AddsNoCounter");
|
this.cannotCounterSpell = params.containsKey("AddsNoCounter");
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -91,7 +91,7 @@ public class AbilityManaPart implements java.io.Serializable {
|
|||||||
* <p>
|
* <p>
|
||||||
* produceMana.
|
* produceMana.
|
||||||
* </p>
|
* </p>
|
||||||
* @param ability
|
* @param ability
|
||||||
*/
|
*/
|
||||||
public final void produceMana(SpellAbility sa) {
|
public final void produceMana(SpellAbility sa) {
|
||||||
this.produceMana(this.getManaProduced(), this.getSourceCard().getController(), sa);
|
this.produceMana(this.getManaProduced(), this.getSourceCard().getController(), sa);
|
||||||
@@ -106,7 +106,7 @@ public class AbilityManaPart implements java.io.Serializable {
|
|||||||
* a {@link java.lang.String} object.
|
* a {@link java.lang.String} object.
|
||||||
* @param player
|
* @param player
|
||||||
* a {@link forge.game.player.Player} object.
|
* a {@link forge.game.player.Player} object.
|
||||||
* @param sa
|
* @param sa
|
||||||
*/
|
*/
|
||||||
public final void produceMana(final String produced, final Player player, SpellAbility sa) {
|
public final void produceMana(final String produced, final Player player, SpellAbility sa) {
|
||||||
final Card source = this.getSourceCard();
|
final Card source = this.getSourceCard();
|
||||||
@@ -448,8 +448,8 @@ public class AbilityManaPart implements java.io.Serializable {
|
|||||||
// if (abm.getType() != this.getType()) {
|
// if (abm.getType() != this.getType()) {
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
return cost.equals(abm.cost) && sourceCard.equals(abm.sourceCard);
|
return cost.equals(abm.cost) && sourceCard.equals(abm.sourceCard);
|
||||||
|
|
||||||
// return abm.toUnsuppressedString().equals(this.toUnsuppressedString());
|
// return abm.toUnsuppressedString().equals(this.toUnsuppressedString());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ public class AbilityTriggered extends Ability implements Command {
|
|||||||
return (this.restrictions.length == 1)
|
return (this.restrictions.length == 1)
|
||||||
&& this.restrictions[0].equals("named " + this.getSourceCard().getName());
|
&& this.restrictions[0].equals("named " + this.getSourceCard().getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final boolean isTrigger() {
|
public final boolean isTrigger() {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package forge.card.spellability;
|
package forge.card.spellability;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will collect here essential methods needed to hold ability on stack and resolve
|
* Will collect here essential methods needed to hold ability on stack and resolve.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface ISpellAbility {
|
public interface ISpellAbility {
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public abstract class Spell extends SpellAbility implements java.io.Serializable
|
|||||||
|
|
||||||
/** Constant <code>serialVersionUID=-7930920571482203460L</code>. */
|
/** Constant <code>serialVersionUID=-7930920571482203460L</code>. */
|
||||||
private static final long serialVersionUID = -7930920571482203460L;
|
private static final long serialVersionUID = -7930920571482203460L;
|
||||||
|
|
||||||
private boolean castFaceDown = false;
|
private boolean castFaceDown = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -187,8 +187,8 @@ public abstract class Spell extends SpellAbility implements java.io.Serializable
|
|||||||
public boolean isSpell() { return true; }
|
public boolean isSpell() { return true; }
|
||||||
@Override
|
@Override
|
||||||
public boolean isAbility() { return false; }
|
public boolean isAbility() { return false; }
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* canPlayFromEffectAI.
|
* canPlayFromEffectAI.
|
||||||
@@ -215,7 +215,7 @@ public abstract class Spell extends SpellAbility implements java.io.Serializable
|
|||||||
* @param faceDown the castFaceDown to set
|
* @param faceDown the castFaceDown to set
|
||||||
*/
|
*/
|
||||||
public void setCastFaceDown(boolean faceDown) {
|
public void setCastFaceDown(boolean faceDown) {
|
||||||
this.castFaceDown = faceDown;
|
this.castFaceDown = faceDown;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ public abstract class SpellAbility implements ISpellAbility {
|
|||||||
private List<Card> tappedForConvoke = new ArrayList<Card>();
|
private List<Card> tappedForConvoke = new ArrayList<Card>();
|
||||||
|
|
||||||
private HashMap<String, String> sVars = new HashMap<String, String>();
|
private HashMap<String, String> sVars = new HashMap<String, String>();
|
||||||
|
|
||||||
private AbilityManaPart manaPart = null;
|
private AbilityManaPart manaPart = null;
|
||||||
|
|
||||||
private boolean undoable;
|
private boolean undoable;
|
||||||
@@ -124,7 +124,7 @@ public abstract class SpellAbility implements ISpellAbility {
|
|||||||
public final boolean isManaAbility() {
|
public final boolean isManaAbility() {
|
||||||
return manaPart != null && isAbility();
|
return manaPart != null && isAbility();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public final void setManaPart(AbilityManaPart manaPart) {
|
public final void setManaPart(AbilityManaPart manaPart) {
|
||||||
this.manaPart = manaPart;
|
this.manaPart = manaPart;
|
||||||
@@ -141,7 +141,7 @@ public abstract class SpellAbility implements ISpellAbility {
|
|||||||
public Set<String> getSVars() {
|
public Set<String> getSVars() {
|
||||||
return sVars.keySet();
|
return sVars.keySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* Constructor for SpellAbility.
|
* Constructor for SpellAbility.
|
||||||
@@ -342,7 +342,7 @@ public abstract class SpellAbility implements ISpellAbility {
|
|||||||
public boolean isBuyBackAbility() {
|
public boolean isBuyBackAbility() {
|
||||||
return this.optionalAdditionalCosts.contains("Buyback");
|
return this.optionalAdditionalCosts.contains("Buyback");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* isKicked.
|
* isKicked.
|
||||||
@@ -353,7 +353,7 @@ public abstract class SpellAbility implements ISpellAbility {
|
|||||||
public boolean isKicked() {
|
public boolean isKicked() {
|
||||||
return isOptionalAdditionalCostPaid("Kicker");
|
return isOptionalAdditionalCostPaid("Kicker");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* isOptionalAdditionalCostPaid.
|
* isOptionalAdditionalCostPaid.
|
||||||
@@ -512,7 +512,7 @@ public abstract class SpellAbility implements ISpellAbility {
|
|||||||
return params == null ? null : params.get(key);
|
return params == null ? null : params.get(key);
|
||||||
}
|
}
|
||||||
public boolean hasParam(String key) {
|
public boolean hasParam(String key) {
|
||||||
return params == null ? false: params.containsKey(key);
|
return params == null ? false : params.containsKey(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -520,18 +520,19 @@ public abstract class SpellAbility implements ISpellAbility {
|
|||||||
* @param mapParams
|
* @param mapParams
|
||||||
*/
|
*/
|
||||||
public void copyParamsToMap(Map<String, String> mapParams) {
|
public void copyParamsToMap(Map<String, String> mapParams) {
|
||||||
if ( null != params )
|
if (null != params) {
|
||||||
mapParams.putAll(params);
|
mapParams.putAll(params);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If this is not null, then ability was made in a factory
|
// If this is not null, then ability was made in a factory
|
||||||
public ApiType getApi() {
|
public ApiType getApi() {
|
||||||
return api;
|
return api;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final boolean isCurse() {
|
public final boolean isCurse() {
|
||||||
return this.hasParam("IsCurse");
|
return this.hasParam("IsCurse");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -1664,7 +1665,7 @@ public abstract class SpellAbility implements ISpellAbility {
|
|||||||
public List<Card> knownDetermineDefined(final String defined) {
|
public List<Card> knownDetermineDefined(final String defined) {
|
||||||
final List<Card> ret = new ArrayList<Card>();
|
final List<Card> ret = new ArrayList<Card>();
|
||||||
final ArrayList<Card> list = AbilityFactory.getDefinedCards(getSourceCard(), defined, this);
|
final ArrayList<Card> list = AbilityFactory.getDefinedCards(getSourceCard(), defined, this);
|
||||||
|
|
||||||
for (final Card c : list) {
|
for (final Card c : list) {
|
||||||
final Card actualCard = Singletons.getModel().getGame().getCardState(c);
|
final Card actualCard = Singletons.getModel().getGame().getCardState(c);
|
||||||
ret.add(actualCard);
|
ret.add(actualCard);
|
||||||
@@ -1684,7 +1685,7 @@ public abstract class SpellAbility implements ISpellAbility {
|
|||||||
while (null != parent.getParent()) {
|
while (null != parent.getParent()) {
|
||||||
parent = parent.getParent();
|
parent = parent.getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1701,11 +1702,13 @@ public abstract class SpellAbility implements ISpellAbility {
|
|||||||
*/
|
*/
|
||||||
public SpellAbility getParentTargetingCard() {
|
public SpellAbility getParentTargetingCard() {
|
||||||
SpellAbility parent = this;
|
SpellAbility parent = this;
|
||||||
|
|
||||||
while( parent.getParent() != null)
|
while (parent.getParent() != null) {
|
||||||
{
|
|
||||||
Target tgt = parent.getTarget();
|
Target tgt = parent.getTarget();
|
||||||
if ( tgt != null && tgt.getTargetCards() != null && !tgt.getTargetCards().isEmpty() ) break;
|
if (tgt != null && tgt.getTargetCards() != null && !tgt.getTargetCards().isEmpty()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
parent = parent.getParent();
|
parent = parent.getParent();
|
||||||
}
|
}
|
||||||
return parent;
|
return parent;
|
||||||
@@ -1720,10 +1723,12 @@ public abstract class SpellAbility implements ISpellAbility {
|
|||||||
*/
|
*/
|
||||||
public SpellAbility getParentTargetingSA() {
|
public SpellAbility getParentTargetingSA() {
|
||||||
SpellAbility parent = this;
|
SpellAbility parent = this;
|
||||||
while( parent.getParent() != null)
|
while (parent.getParent() != null) {
|
||||||
{
|
|
||||||
Target tgt = parent.getTarget();
|
Target tgt = parent.getTarget();
|
||||||
if ( tgt != null && tgt.getTargetSAs() != null && !tgt.getTargetSAs().isEmpty() ) break;
|
if (tgt != null && tgt.getTargetSAs() != null && !tgt.getTargetSAs().isEmpty()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
parent = parent.getParent();
|
parent = parent.getParent();
|
||||||
}
|
}
|
||||||
return parent;
|
return parent;
|
||||||
@@ -1738,10 +1743,12 @@ public abstract class SpellAbility implements ISpellAbility {
|
|||||||
*/
|
*/
|
||||||
public SpellAbility getParentTargetingPlayer() {
|
public SpellAbility getParentTargetingPlayer() {
|
||||||
SpellAbility parent = this;
|
SpellAbility parent = this;
|
||||||
while( parent.getParent() != null)
|
while (parent.getParent() != null) {
|
||||||
{
|
|
||||||
Target tgt = parent.getTarget();
|
Target tgt = parent.getTarget();
|
||||||
if ( tgt != null && tgt.getTargetPlayers() != null && !tgt.getTargetPlayers().isEmpty() ) break;
|
if (tgt != null && tgt.getTargetPlayers() != null && !tgt.getTargetPlayers().isEmpty()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
parent = parent.getParent();
|
parent = parent.getParent();
|
||||||
}
|
}
|
||||||
return parent;
|
return parent;
|
||||||
@@ -1759,8 +1766,9 @@ public abstract class SpellAbility implements ISpellAbility {
|
|||||||
* TODO: Write javadoc for this method.
|
* TODO: Write javadoc for this method.
|
||||||
*/
|
*/
|
||||||
public void undo() {
|
public void undo() {
|
||||||
if ( isUndoable() )
|
if (isUndoable()) {
|
||||||
this.payCosts.refundPaidCost(sourceCard);
|
this.payCosts.refundPaidCost(sourceCard);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ public class SpellAbilityRestriction extends SpellAbilityVariables {
|
|||||||
if (cardZone == null || !cardZone.is(this.getZone())) {
|
if (cardZone == null || !cardZone.is(this.getZone())) {
|
||||||
// If Card is not in the default activating zone, do some additional checks
|
// If Card is not in the default activating zone, do some additional checks
|
||||||
// Not a Spell, or on Battlefield, return false
|
// Not a Spell, or on Battlefield, return false
|
||||||
if (!sa.isSpell() || (cardZone != null && ZoneType.Battlefield.equals(cardZone.getZoneType()))
|
if (!sa.isSpell() || (cardZone != null && ZoneType.Battlefield.equals(cardZone.getZoneType()))
|
||||||
|| !this.getZone().equals(ZoneType.Hand)) {
|
|| !this.getZone().equals(ZoneType.Hand)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -513,7 +513,7 @@ public class SpellAbilityVariables {
|
|||||||
public void setKicked(boolean kicked) {
|
public void setKicked(boolean kicked) {
|
||||||
this.kicked = kicked;
|
this.kicked = kicked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ public class SpellPermanent extends Spell {
|
|||||||
} else if (controller.isHuman()) {
|
} else if (controller.isHuman()) {
|
||||||
Singletons.getModel().getMatch().getInput().setInput(SpellPermanent.this.championInputComes);
|
Singletons.getModel().getMatch().getInput().setInput(SpellPermanent.this.championInputComes);
|
||||||
} else { // Computer
|
} else { // Computer
|
||||||
List<Card> computer =
|
List<Card> computer =
|
||||||
CardLists.getValidCards(controller.getCardsIn(ZoneType.Battlefield), SpellPermanent.this.championValid, controller, source);
|
CardLists.getValidCards(controller.getCardsIn(ZoneType.Battlefield), SpellPermanent.this.championValid, controller, source);
|
||||||
computer.remove(source);
|
computer.remove(source);
|
||||||
|
|
||||||
@@ -248,10 +248,10 @@ public class SpellPermanent extends Spell {
|
|||||||
sourceCard.addComesIntoPlayCommand(this.championCommandComes);
|
sourceCard.addComesIntoPlayCommand(this.championCommandComes);
|
||||||
sourceCard.addLeavesPlayCommand(this.championCommandLeavesPlay);
|
sourceCard.addLeavesPlayCommand(this.championCommandLeavesPlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.getManaCost().contains("X"))
|
if (this.getManaCost().contains("X")) {
|
||||||
{
|
|
||||||
if(!this.getSourceCard().getSVar("X").equals("")) {
|
if (!this.getSourceCard().getSVar("X").equals("")) {
|
||||||
this.setSVar("X", this.getSourceCard().getSVar("X"));
|
this.setSVar("X", this.getSourceCard().getSVar("X"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -324,11 +324,11 @@ public class SpellPermanent extends Spell {
|
|||||||
if (mandatory) {
|
if (mandatory) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
final Player ai = getActivatingPlayer();
|
final Player ai = getActivatingPlayer();
|
||||||
final Card card = this.getSourceCard();
|
final Card card = this.getSourceCard();
|
||||||
String mana = this.getPayCosts().getTotalMana();
|
String mana = this.getPayCosts().getTotalMana();
|
||||||
final Cost cost = this.getPayCosts();
|
final Cost cost = this.getPayCosts();
|
||||||
|
|
||||||
if (cost != null) {
|
if (cost != null) {
|
||||||
// AI currently disabled for these costs
|
// AI currently disabled for these costs
|
||||||
if (!CostUtil.checkLifeCost(ai, cost, card, 4, null)) {
|
if (!CostUtil.checkLifeCost(ai, cost, card, 4, null)) {
|
||||||
@@ -347,10 +347,10 @@ public class SpellPermanent extends Spell {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// check on legendary
|
// check on legendary
|
||||||
if (card.isType("Legendary") &&
|
if (card.isType("Legendary")
|
||||||
!Singletons.getModel().getGame().getStaticEffects().getGlobalRuleChange(GlobalRuleChange.noLegendRule)) {
|
&& !Singletons.getModel().getGame().getStaticEffects().getGlobalRuleChange(GlobalRuleChange.noLegendRule)) {
|
||||||
final List<Card> list = ai.getCardsIn(ZoneType.Battlefield);
|
final List<Card> list = ai.getCardsIn(ZoneType.Battlefield);
|
||||||
if (Iterables.any(list, CardPredicates.nameEquals(card.getName()))) {
|
if (Iterables.any(list, CardPredicates.nameEquals(card.getName()))) {
|
||||||
return false;
|
return false;
|
||||||
@@ -391,7 +391,7 @@ public class SpellPermanent extends Spell {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final List<Card> cl = this.championGetCreature.get();
|
final List<Card> cl = this.championGetCreature.get();
|
||||||
if ( !(cl.size() > 0) || !this.getSourceCard().isInZone(ZoneType.Hand)) {
|
if (!(cl.size() > 0) || !this.getSourceCard().isInZone(ZoneType.Hand)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -411,7 +411,7 @@ public class SpellPermanent extends Spell {
|
|||||||
|
|
||||||
private static boolean checkETBEffects(final Card card, final SpellAbility sa, final ApiType api, final Player ai) {
|
private static boolean checkETBEffects(final Card card, final SpellAbility sa, final ApiType api, final Player ai) {
|
||||||
|
|
||||||
if (card.isCreature()
|
if (card.isCreature()
|
||||||
&& Singletons.getModel().getGame().getStaticEffects().getGlobalRuleChange(GlobalRuleChange.noCreatureETBTriggers)) {
|
&& Singletons.getModel().getGame().getStaticEffects().getGlobalRuleChange(GlobalRuleChange.noCreatureETBTriggers)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -564,12 +564,12 @@ public class SpellPermanent extends Spell {
|
|||||||
else {
|
else {
|
||||||
throw new InvalidParameterException("Either ai or sa must be not null!");
|
throw new InvalidParameterException("Either ai or sa must be not null!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exSA.getActivatingPlayer() == null) {
|
if (exSA.getActivatingPlayer() == null) {
|
||||||
throw new InvalidParameterException("Executing SpellAbility for Replacement Effect has no activating player");
|
throw new InvalidParameterException("Executing SpellAbility for Replacement Effect has no activating player");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ETBReplacement uses overriding abilities.
|
// ETBReplacement uses overriding abilities.
|
||||||
// These checks only work if the Executing SpellAbility is an
|
// These checks only work if the Executing SpellAbility is an
|
||||||
// Ability_Sub.
|
// Ability_Sub.
|
||||||
|
|||||||
@@ -716,9 +716,11 @@ public class Target {
|
|||||||
for (final Card c : Singletons.getModel().getGame().getCardsIn(this.tgtZone)) {
|
for (final Card c : Singletons.getModel().getGame().getCardsIn(this.tgtZone)) {
|
||||||
boolean isValidTarget = c.isValid(this.validTgts, this.srcCard.getController(), this.srcCard);
|
boolean isValidTarget = c.isValid(this.validTgts, this.srcCard.getController(), this.srcCard);
|
||||||
boolean canTarget = (!isTargeted || c.canBeTargetedBy(sa));
|
boolean canTarget = (!isTargeted || c.canBeTargetedBy(sa));
|
||||||
boolean isAlreadyTargeted = this.getTargetCards().contains(c);
|
boolean isAlreadyTargeted = this.getTargetCards().contains(c);
|
||||||
//System.out.print(c);
|
//System.out.print(c);
|
||||||
if ( isValidTarget && canTarget && !isAlreadyTargeted ) return true;
|
if (isValidTarget && canTarget && !isAlreadyTargeted) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ public class TargetChoices {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* removeTarget.
|
* removeTarget.
|
||||||
@@ -172,7 +172,7 @@ public class TargetChoices {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* removeTarget.
|
* removeTarget.
|
||||||
@@ -191,7 +191,7 @@ public class TargetChoices {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* Getter for the field <code>targetCards</code>.
|
* Getter for the field <code>targetCards</code>.
|
||||||
|
|||||||
@@ -698,7 +698,7 @@ public class TargetSelection {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* matchesValidSA.
|
* matchesValidSA.
|
||||||
|
|||||||
Reference in New Issue
Block a user