update abMakeToken to use Ability_Cost

This commit is contained in:
jendave
2011-08-06 08:25:18 +00:00
parent 3f27cdd006
commit c71223d89b

View File

@@ -5792,21 +5792,17 @@ public class CardFactory implements NewConstants {
final String abDesc = k[10]; final String abDesc = k[10];
String fullCost = k[0].substring(11); String fullCost = k[0].substring(11);
String tmpCost = new String(fullCost); final Ability_Cost abCost = new Ability_Cost(fullCost, card.getName(), true);
final boolean tapCost = tmpCost.contains("T") ? true : false;
if(tmpCost.contains("T")) {
tmpCost = tmpCost.replace("T", "");
tmpCost = tmpCost.trim();
}
final String spDesc[] = {"none"}; final String spDesc[] = {"none"};
spDesc[0] = fullCost.toString()+ " - " + abDesc; spDesc[0] = abCost.toString()+ " - " + abDesc;
final SpellAbility abMakeToken = new Ability_Activated(card, tmpCost) { final SpellAbility abMakeToken = new Ability_Activated(card, abCost, null) {
private static final long serialVersionUID = -1415539558367883075L; private static final long serialVersionUID = -1415539558367883075L;
public boolean canPlayAI() { public boolean canPlayAI() {
if (!ComputerUtil.canPayCost(this)) return false; if (!ComputerUtil.canPayCost(this)) return false;
if(xString && CardFactoryUtil.xCount(card, numString) > 0) { if(xString && CardFactoryUtil.xCount(card, numString) == 0) {
return false; return false;
} }
else { else {
@@ -5818,17 +5814,15 @@ public class CardFactory implements NewConstants {
return rr; return rr;
} }
} }
@Override @Override
public boolean canPlay(){ public boolean canPlay(){
//Cost_Payment pay = new Cost_Payment(abCost, this); Cost_Payment pay = new Cost_Payment(abCost, this);
return CardFactoryUtil.canUseAbility(card) && super.canPlay(); return (pay.canPayAdditionalCosts() && CardFactoryUtil.canUseAbility(card) && super.canPlay());
} }
@Override @Override
public void resolve() { public void resolve() {
if(tapCost) {
//TODO - should be part of paying for ability
card.tap();
}
String controller = (controllerString.equals("Controller") ? card.getController() : AllZone.GameAction.getOpponent(card.getController())); String controller = (controllerString.equals("Controller") ? card.getController() : AllZone.GameAction.getOpponent(card.getController()));
if(keywords[0].equals("None")) keywords[0] = ""; if(keywords[0].equals("None")) keywords[0] = "";