SA: field delve renamed, isTap/untapAbility removed (cost takes care of that), isTrigger declared by overload in AbilityTriggered

This commit is contained in:
Maxmtg
2012-11-10 22:05:09 +00:00
parent 0e84ac4d82
commit 61b4169f73
9 changed files with 30 additions and 106 deletions

View File

@@ -1723,7 +1723,7 @@ public class GameAction {
}
if (spell.isSpell()) {
if (spell.getIsDelve()) {
if (spell.isDelve()) {
final int cardsInGrave = originalCard.getController().getCardsIn(ZoneType.Graveyard).size();
final Player pc = originalCard.getController();
@@ -2010,12 +2010,6 @@ public class GameAction {
}
game.getStack().add(sa);
if (sa.isTapAbility() && !sa.wasCancelled()) {
sa.getSourceCard().tap();
}
if (sa.isUntapAbility()) {
sa.getSourceCard().untap();
}
return;
} else {
Singletons.getModel().getMatch().getInput().setInput(sa.getAfterPayMana());
@@ -2062,12 +2056,6 @@ public class GameAction {
if (manaCost.isPaid() && (sa.getBeforePayMana() == null)) {
if (sa.getAfterPayMana() == null) {
AbilityFactory.resolve(sa, false);
if (sa.isTapAbility() && !sa.wasCancelled()) {
sa.getSourceCard().tap();
}
if (sa.isUntapAbility()) {
sa.getSourceCard().untap();
}
return;
} else {
Singletons.getModel().getMatch().getInput().setInput(sa.getAfterPayMana());

View File

@@ -3963,7 +3963,7 @@ public class CardFactoryUtil {
}
if (card.hasKeyword("Delve")) {
card.getSpellAbilities().get(0).setIsDelve(true);
card.getSpellAbilities().get(0).setDelve(true);
}
if (card.hasStartOfKeyword("Haunt")) {

View File

@@ -82,7 +82,6 @@ public class AbilityTriggered extends Ability implements Command {
*/
public AbilityTriggered(final Card sourceCard, final Command sourceCommand, final ZCTrigger situation) {
super(sourceCard, "0");
this.setTrigger(true);
this.todo = sourceCommand;
this.trigger = situation;
if (this.todo instanceof AbilityTriggered) {
@@ -181,4 +180,9 @@ public class AbilityTriggered extends Ability implements Command {
return (this.restrictions.length == 1)
&& this.restrictions[0].equals("named " + this.getSourceCard().getName());
}
@Override
public final boolean isTrigger() {
return true;
}
}

View File

@@ -72,17 +72,14 @@ public abstract class SpellAbility implements ISpellAbility {
private boolean trigger = false;
private boolean optionalTrigger = false;
private int sourceTrigger = -1;
private boolean mandatory = false;
private boolean temporarilySuppressed = false;
private boolean tapAbility;
private boolean untapAbility;
private boolean flashBackAbility = false;
private boolean multiKicker = false;
private boolean replicate = false;
private boolean xCost = false;
private boolean cycling = false;
private boolean isDelve = false;
private boolean delve = false;
private Input beforePayMana;
private Input afterResolve;
@@ -335,38 +332,6 @@ public abstract class SpellAbility implements ISpellAbility {
public boolean isSpell() { return false; }
public boolean isAbility() { return true; }
/**
* <p>
* isTapAbility.
* </p>
*
* @return a boolean.
*/
public boolean isTapAbility() {
return this.tapAbility;
}
/**
* <p>
* isUntapAbility.
* </p>
*
* @return a boolean.
*/
public boolean isUntapAbility() {
return this.untapAbility;
}
/**
* <p>
* makeUntapAbility.
* </p>
*/
public void makeUntapAbility() {
this.untapAbility = true;
this.tapAbility = false;
}
/**
* <p>
* isBuyBackAbility.
@@ -1499,18 +1464,6 @@ public abstract class SpellAbility implements ISpellAbility {
return this.sourceTrigger;
}
/**
* <p>
* Setter for the field <code>mandatory</code>.
* </p>
*
* @param mand
* a boolean.
*/
public final void setMandatory(final boolean mand) {
this.mandatory = mand;
}
/**
* <p>
* isMandatory.
@@ -1518,8 +1471,8 @@ public abstract class SpellAbility implements ISpellAbility {
*
* @return a boolean.
*/
public final boolean isMandatory() {
return this.mandatory;
public boolean isMandatory() {
return false;
}
/**
@@ -1610,8 +1563,8 @@ public abstract class SpellAbility implements ISpellAbility {
*
* @return the isDelve
*/
public final boolean getIsDelve() {
return this.isDelve;
public final boolean isDelve() {
return this.delve;
}
/**
@@ -1620,8 +1573,8 @@ public abstract class SpellAbility implements ISpellAbility {
* @param isDelve0
* the isDelve to set
*/
public final void setIsDelve(final boolean isDelve0) {
this.isDelve = isDelve0;
public final void setDelve(final boolean isDelve0) {
this.delve = isDelve0;
}
/**

View File

@@ -33,6 +33,8 @@ public class WrappedAbility extends Ability implements ISpellAbility {
final private Trigger regtrig;
final private Player decider;
boolean mandatory = false;
public WrappedAbility(final Trigger regTrig, final SpellAbility sa0, final Player decider0) {
super(regTrig.getHostCard(), "0");
regtrig = regTrig;
@@ -47,6 +49,19 @@ public class WrappedAbility extends Ability implements ISpellAbility {
}
public final void setMandatory(final boolean mand) {
this.mandatory = mand;
}
/**
* @return the mandatory
*/
@Override
public boolean isMandatory() {
return mandatory;
}
@Override
public String getParam(String key) { return sa.getParam(key); }
@@ -281,16 +296,6 @@ public class WrappedAbility extends Ability implements ISpellAbility {
return sa.isSpell();
}
@Override
public boolean isTapAbility() {
return sa.isTapAbility();
}
@Override
public boolean isUntapAbility() {
return sa.isUntapAbility();
}
@Override
public boolean isXCost() {
return sa.isXCost();

View File

@@ -152,12 +152,6 @@ public class InputPayManaCost extends InputMana {
// Kher Keep, Pendelhaven, Blinkmoth Nexus, and Mikokoro, Center of the
// Sea, ....
if (this.originalCard.equals(card) && this.spell.isTapAbility()) {
// I'm not sure if this actually prevents anything that wouldn't be
// handled by canPlay below
return;
}
this.manaCost = InputPayManaCostUtil.activateManaAbility(this.spell, card, this.manaCost);
// only show message if this is the active input
@@ -204,16 +198,6 @@ public class InputPayManaCost extends InputMana {
Singletons.getControl().getPlayer().getManaPool().clearManaPaid(this.spell, false);
this.resetManaCost();
// if tap ability, tap card
if (this.spell.isTapAbility()) {
this.originalCard.tap();
}
if (this.spell.isUntapAbility()) {
this.originalCard.untap();
}
// if this is a spell, move it to the Stack ZOne
if (this.spell.isSpell()) {
this.spell.setSourceCard(Singletons.getModel().getGame().getAction().moveToStack(this.originalCard));
}

View File

@@ -49,10 +49,6 @@ public class InputPayManaCost2 extends InputMana {
public void selectCard(final Card card, final PlayerZone zone) {
// prevent cards from tapping themselves if ability is a
// tapability, although it should already be tapped
if (sa.getSourceCard().equals(card) && sa.isTapAbility()) {
return;
}
this.manaCost = InputPayManaCostUtil.activateManaAbility(sa, card, this.manaCost);
if (this.manaCost.isPaid()) {

View File

@@ -379,11 +379,6 @@ public class InputPayManaCostUtil {
// selectCard
@Override
public void selectCard(final Card card, final PlayerZone zone) {
if (sa.getSourceCard().equals(card) && sa.isTapAbility()) {
// this really shouldn't happen but just in case
return;
}
this.manaCost = activateManaAbility(sa, card, this.manaCost);
if (this.manaCost.isPaid()) {
if (!this.colorsPaid.contains(this.manaCost.getColorsPaid())) {

View File

@@ -2174,8 +2174,7 @@ public class Upkeep extends Phase {
return false;
}
for (SpellAbility sa : c.getAllSpellAbilities()) {
if (sa.isTapAbility()
|| sa.getPayCosts() != null && sa.getPayCosts().getTap()) {
if ( sa.getPayCosts() != null && sa.getPayCosts().getTap()) {
return false;
}
}