- Costs should not use the terminology "Targeting" since that means something very distinct in Magic

This commit is contained in:
Sol
2013-03-12 02:19:45 +00:00
parent 6ec78bb5d6
commit 60d98a0c12
11 changed files with 36 additions and 36 deletions

View File

@@ -180,7 +180,7 @@ public class ChangeZoneAi extends SpellAbilityAi {
if (part instanceof CostDiscard) {
CostDiscard cd = (CostDiscard) part;
// this is mainly for typecycling
if (!cd.isTargetingThis() || !ComputerUtil.isWorseThanDraw(ai, source)) {
if (!cd.payCostFromSource() || !ComputerUtil.isWorseThanDraw(ai, source)) {
return false;
}
}

View File

@@ -87,7 +87,7 @@ public class DestroyAi extends SpellAbilityAi {
continue;
}
CostSacrifice sacCost = (CostSacrifice) part;
if (sacCost.isTargetingThis() && ComputerUtilCost.canPayCost(ability, c.getController())) {
if (sacCost.payCostFromSource() && ComputerUtilCost.canPayCost(ability, c.getController())) {
return false;
}
}

View File

@@ -70,7 +70,7 @@ public class CostDiscard extends CostPartWithList {
final Integer i = this.convertAmount();
if (this.isTargetingThis()) {
if (this.payCostFromSource()) {
sb.append(this.getType());
} else if (this.getType().equals("Hand")) {
sb.append("your hand");
@@ -109,7 +109,7 @@ public class CostDiscard extends CostPartWithList {
String type = this.getType();
final Integer amount = this.convertAmount();
if (this.isTargetingThis()) {
if (this.payCostFromSource()) {
if (!source.isInZone(ZoneType.Hand)) {
return false;
}
@@ -175,7 +175,7 @@ public class CostDiscard extends CostPartWithList {
final String amount = this.getAmount();
this.resetList();
if (this.isTargetingThis()) {
if (this.payCostFromSource()) {
if (!handList.contains(source)) {
return false;
}
@@ -273,7 +273,7 @@ public class CostDiscard extends CostPartWithList {
this.addToList(ai.getLastDrawnCard());
}
else if (this.isTargetingThis()) {
else if (this.payCostFromSource()) {
if (!hand.contains(source)) {
return false;
}

View File

@@ -493,7 +493,7 @@ public class CostExile extends CostPartWithList {
final Integer i = this.convertAmount();
sb.append("Exile ");
if (this.isTargetingThis()) {
if (this.payCostFromSource()) {
sb.append(this.getType());
if (!this.from.equals(ZoneType.Battlefield)) {
sb.append(" from your ").append(this.from);
@@ -508,7 +508,7 @@ public class CostExile extends CostPartWithList {
final String desc = this.getTypeDescription() == null ? this.getType() : this.getTypeDescription();
sb.append(Cost.convertAmountTypeToWords(i, this.getAmount(), desc));
if (!this.isTargetingThis()) {
if (!this.payCostFromSource()) {
sb.append(" you control");
}
return sb.toString();
@@ -562,7 +562,7 @@ public class CostExile extends CostPartWithList {
typeList = new ArrayList<Card>(activator.getCardsIn(this.getFrom()));
}
}
if (!this.isTargetingThis()) {
if (!this.payCostFromSource()) {
typeList = CardLists.getValidCards(typeList, this.getType().split(";"), activator, source);
final Integer amount = this.convertAmount();
@@ -653,7 +653,7 @@ public class CostExile extends CostPartWithList {
}
Input target = null;
if (this.isTargetingThis()) {
if (this.payCostFromSource()) {
target = new InputExileThis(payment, this, ability);
} else if (this.from.equals(ZoneType.Battlefield) || this.from.equals(ZoneType.Hand)) {
target = new InputExileType(this, payment, this.getType(), c, ability);
@@ -692,7 +692,7 @@ public class CostExile extends CostPartWithList {
@Override
public final boolean decideAIPayment(final AIPlayer ai, final SpellAbility ability, final Card source, final CostPayment payment) {
this.resetList();
if (this.isTargetingThis()) {
if (this.payCostFromSource()) {
this.getList().add(source);
} else if (this.getType().equals("All")) {
this.setList(new ArrayList<Card>(ability.getActivatingPlayer().getCardsIn(this.getFrom())));

View File

@@ -87,7 +87,7 @@ public abstract class CostPart {
*
* @return the this
*/
public final boolean isTargetingThis() {
public final boolean payCostFromSource() {
return this.getType().equals("CARDNAME");
}

View File

@@ -98,7 +98,7 @@ public class CostPutCounter extends CostPartWithList {
sb.append(Cost.convertAmountTypeToWords(i, this.getAmount(), this.counter.getName() + " counter"));
sb.append(" on ");
if (this.isTargetingThis()) {
if (this.payCostFromSource()) {
sb.append(this.getType());
} else {
final String desc = this.getTypeDescription() == null ? this.getType() : this.getTypeDescription();
@@ -129,7 +129,7 @@ public class CostPutCounter extends CostPartWithList {
*/
@Override
public final boolean canPay(final SpellAbility ability, final Card source, final Player activator, final Cost cost, final GameState game) {
if (this.isTargetingThis()) {
if (this.payCostFromSource()) {
if (source.hasKeyword("CARDNAME can't have counters placed on it.")) {
return false;
}
@@ -162,7 +162,7 @@ public class CostPutCounter extends CostPartWithList {
c = AbilityUtils.calculateAmount(source, this.getAmount(), ability);
}
if (this.isTargetingThis()) {
if (this.payCostFromSource()) {
source.addCounter(this.getCounter(), c, false);
} else {
// Put counter on chosen card
@@ -186,7 +186,7 @@ public class CostPutCounter extends CostPartWithList {
c = AbilityUtils.calculateAmount(source, this.getAmount(), ability);
}
if (this.isTargetingThis()) {
if (this.payCostFromSource()) {
source.addCounter(this.getCounter(), c, false);
payment.setPaidManaPart(this);
this.addToList(source);
@@ -208,7 +208,7 @@ public class CostPutCounter extends CostPartWithList {
@Override
public final boolean decideAIPayment(final AIPlayer ai, final SpellAbility ability, final Card source, final CostPayment payment) {
this.resetList();
if (this.isTargetingThis()) {
if (this.payCostFromSource()) {
this.addToList(source);
return true;
} else {

View File

@@ -131,7 +131,7 @@ public class CostRemoveCounter extends CostPartWithList {
sb.append(" from ");
if (this.isTargetingThis()) {
if (this.payCostFromSource()) {
sb.append(this.getType());
} else {
final String desc = this.getTypeDescription() == null ? this.getType() : this.getTypeDescription();
@@ -166,7 +166,7 @@ public class CostRemoveCounter extends CostPartWithList {
final CounterType cntrs = this.getCounter();
final Integer amount = this.convertAmount();
if (this.isTargetingThis()) {
if (this.payCostFromSource()) {
if ((amount != null) && ((source.getCounters(cntrs) - amount) < 0)) {
return false;
}
@@ -204,7 +204,7 @@ public class CostRemoveCounter extends CostPartWithList {
}
}
if (this.isTargetingThis()) {
if (this.payCostFromSource()) {
source.subtractCounter(this.counter, c);
} else {
for (final Card card : this.getList()) {
@@ -227,7 +227,7 @@ public class CostRemoveCounter extends CostPartWithList {
Integer c = this.convertAmount();
int maxCounters = 0;
if (!this.isTargetingThis()) {
if (!this.payCostFromSource()) {
if (c == null) {
final String sVar = ability.getSVar(amount);
// Generalize this
@@ -303,7 +303,7 @@ public class CostRemoveCounter extends CostPartWithList {
}
}
if (!this.isTargetingThis()) {
if (!this.payCostFromSource()) {
this.getList().clear();
final List<Card> typeList =
CardLists.getValidCards(ai.getCardsIn(this.getZone()), this.getType().split(";"), ai, source);

View File

@@ -70,7 +70,7 @@ public class CostReturn extends CostPartWithList {
final Integer i = this.convertAmount();
String pronoun = "its";
if (this.isTargetingThis()) {
if (this.payCostFromSource()) {
sb.append(this.getType());
} else {
final String desc = this.getTypeDescription() == null ? this.getType() : this.getTypeDescription();
@@ -98,7 +98,7 @@ public class CostReturn extends CostPartWithList {
*/
@Override
public final boolean canPay(final SpellAbility ability, final Card source, final Player activator, final Cost cost, final GameState game) {
if (!this.isTargetingThis()) {
if (!this.payCostFromSource()) {
boolean needsAnnoucement = ability.hasParam("Announce") && this.getType().contains(ability.getParam("Announce"));
List<Card> typeList = new ArrayList<Card>(activator.getCardsIn(ZoneType.Battlefield));
@@ -150,7 +150,7 @@ public class CostReturn extends CostPartWithList {
c = AbilityUtils.calculateAmount(source, amount, ability);
}
}
if (this.isTargetingThis()) {
if (this.payCostFromSource()) {
final Input inp = CostReturn.returnThis(ability, payment, this);
Singletons.getModel().getMatch().getInput().setInputInterrupt(inp);
} else {
@@ -170,7 +170,7 @@ public class CostReturn extends CostPartWithList {
@Override
public final boolean decideAIPayment(final AIPlayer ai, final SpellAbility ability, final Card source, final CostPayment payment) {
this.resetList();
if (this.isTargetingThis()) {
if (this.payCostFromSource()) {
this.getList().add(source);
} else {
Integer c = this.convertAmount();

View File

@@ -72,7 +72,7 @@ public class CostReveal extends CostPartWithList {
final String type = this.getType();
final Integer amount = this.convertAmount();
if (this.isTargetingThis()) {
if (this.payCostFromSource()) {
if (!source.isInZone(ZoneType.Hand)) {
return false;
}
@@ -106,7 +106,7 @@ public class CostReveal extends CostPartWithList {
List<Card> hand = new ArrayList<Card>(ai.getCardsIn(ZoneType.Hand));
this.resetList();
if (this.isTargetingThis()) {
if (this.payCostFromSource()) {
if (!hand.contains(source)) {
return false;
}
@@ -156,7 +156,7 @@ public class CostReveal extends CostPartWithList {
final String amount = this.getAmount();
this.resetList();
if (this.isTargetingThis()) {
if (this.payCostFromSource()) {
this.addToList(source);
payment.setPaidManaPart(this);
} else if (this.getType().equals("Hand")) {
@@ -200,7 +200,7 @@ public class CostReveal extends CostPartWithList {
final Integer i = this.convertAmount();
if (this.isTargetingThis()) {
if (this.payCostFromSource()) {
sb.append(this.getType());
} else if (this.getType().equals("Hand")) {
return ("Reveal you hand");

View File

@@ -68,7 +68,7 @@ public class CostSacrifice extends CostPartWithList {
final Integer i = this.convertAmount();
if (this.isTargetingThis()) {
if (this.payCostFromSource()) {
sb.append(this.getType());
} else {
final String desc = this.getTypeDescription() == null ? this.getType() : this.getTypeDescription();
@@ -91,7 +91,7 @@ public class CostSacrifice extends CostPartWithList {
@Override
public final boolean canPay(final SpellAbility ability, final Card source, final Player activator, final Cost cost, final GameState game) {
// You can always sac all
if (!this.isTargetingThis()) {
if (!this.payCostFromSource()) {
// If the sacrificed type is dependant on an annoucement, can't necesarily rule out the CanPlay call
boolean needsAnnoucement = ability.hasParam("Announce") && this.getType().contains(ability.getParam("Announce"));
@@ -155,7 +155,7 @@ public class CostSacrifice extends CostPartWithList {
list = CardLists.getNotType(list, "Creature");
}
if (this.isTargetingThis()) {
if (this.payCostFromSource()) {
final Input inp = CostSacrifice.sacrificeThis(ability, payment, this);
Singletons.getModel().getMatch().getInput().setInputInterrupt(inp);
} else if (amount.equals("All")) {
@@ -196,7 +196,7 @@ public class CostSacrifice extends CostPartWithList {
public final boolean decideAIPayment(final AIPlayer ai, final SpellAbility ability, final Card source, final CostPayment payment) {
this.resetList();
final Player activator = ability.getActivatingPlayer();
if (this.isTargetingThis()) {
if (this.payCostFromSource()) {
this.getList().add(source);
} else if (this.getAmount().equals("All")) {
/*List<Card> typeList = new ArrayList<Card>(activator.getCardsIn(ZoneType.Battlefield));

View File

@@ -86,7 +86,7 @@ public class ComputerUtilCost {
final CounterType type = remCounter.getCounter();
final double percent = type.name().equals("P1P1") ? p1p1Percent : otherPercent;
final int currentNum = source.getCounters(type);
if (!part.isTargetingThis()) {
if (!part.payCostFromSource()) {
if (type.name().equals("P1P1")) {
return false;
}
@@ -224,7 +224,7 @@ public class ComputerUtilCost {
for (final CostPart part : cost.getCostParts()) {
if (part instanceof CostSacrifice) {
final CostSacrifice sac = (CostSacrifice) part;
if (sac.isTargetingThis() && source.isCreature()) {
if (sac.payCostFromSource() && source.isCreature()) {
return false;
}
final String type = sac.getType();