-add keyword: If CARDNAME would be put into a graveyard this turn, exile it instead.

-tweak CARDNAME can't be regenerated. keyword with my changes (Sloth and I were adding the same keyword at the same time.)
This commit is contained in:
jendave
2011-08-06 13:27:35 +00:00
parent 27d3f312d0
commit c584eec7b0
4 changed files with 43 additions and 32 deletions

View File

@@ -367,39 +367,41 @@ public class AbilityFactory_Pump {
else else
tgtCards = AbilityFactory.getDefinedCards(sa.getSourceCard(), params.get("Defined"), sa); tgtCards = AbilityFactory.getDefinedCards(sa.getSourceCard(), params.get("Defined"), sa);
if (sa instanceof Ability_Sub) if(tgtCards.size() > 0) {
sb.append(" ");
else
sb.append(name).append(" - ");
for(Card c : tgtCards) if (sa instanceof Ability_Sub)
sb.append(c.getName()).append(" "); sb.append(" ");
else
sb.append(name).append(" - ");
final int atk = getNumAttack(sa); for(Card c : tgtCards)
final int def = getNumDefense(sa); sb.append(c.getName()).append(" ");
sb.append("gains "); final int atk = getNumAttack(sa);
if (atk != 0 || def != 0){ final int def = getNumDefense(sa);
if (atk >= 0)
sb.append("+");
sb.append(atk);
sb.append("/");
if (def >= 0)
sb.append("+");
sb.append(def);
sb.append(" ");
}
for (int i=0; i<Keywords.size(); i++) sb.append("gains ");
{ if (atk != 0 || def != 0){
if (!Keywords.get(i).equals("none")) if (atk >= 0)
sb.append(Keywords.get(i)).append(" "); sb.append("+");
sb.append(atk);
sb.append("/");
if (def >= 0)
sb.append("+");
sb.append(def);
sb.append(" ");
}
for (int i=0; i<Keywords.size(); i++)
{
if (!Keywords.get(i).equals("none"))
sb.append(Keywords.get(i)).append(" ");
}
if (!params.containsKey("Permanent"))
sb.append("until end of turn.");
} }
if (!params.containsKey("Permanent"))
sb.append("until end of turn.");
Ability_Sub abSub = sa.getSubAbility(); Ability_Sub abSub = sa.getSubAbility();
if (abSub != null) { if (abSub != null) {
sb.append(abSub.getStackDescription()); sb.append(abSub.getStackDescription());

View File

@@ -113,7 +113,7 @@ public class AbilityFactory_Regenerate {
CardList play = AllZoneUtil.getCreaturesInPlay(AllZone.ComputerPlayer); CardList play = AllZoneUtil.getCreaturesInPlay(AllZone.ComputerPlayer);
for(Card card:play) { for(Card card:play) {
if(card.getShield() > 0) return false; if(!card.canBeShielded() || card.getShield() > 0) return false;
if(CardFactoryUtil.AI_doesCreatureAttack(card)) { if(CardFactoryUtil.AI_doesCreatureAttack(card)) {
//"Fuzzy logic" to determine if using a regenerate ability might be helpful because //"Fuzzy logic" to determine if using a regenerate ability might be helpful because
//we can't wait to decide to play this ability during combat, like the human can //we can't wait to decide to play this ability during combat, like the human can

View File

@@ -1181,6 +1181,10 @@ public class Card extends MyObservable {
nShield = 0; nShield = 0;
} }
public boolean canBeShielded() {
return !hasKeyword("CARDNAME can't be regenerated.");
}
//is this "Card" supposed to be a token? //is this "Card" supposed to be a token?
public void setToken(boolean b) { public void setToken(boolean b) {
token = b; token = b;

View File

@@ -63,6 +63,11 @@ public class GameAction {
return; return;
} }
if(c.hasKeyword("If CARDNAME would be put into a graveyard this turn, exile it instead.")) {
moveTo(AllZone.getZone(Constant.Zone.Exile, c.getOwner()), c);
return;
}
if (AllZoneUtil.isCardInPlay("Planar Void")) { if (AllZoneUtil.isCardInPlay("Planar Void")) {
CardList pVoids = AllZoneUtil.getCardsInPlay("Planar Void"); CardList pVoids = AllZoneUtil.getCardsInPlay("Planar Void");
for(int i = 0; i < pVoids.size(); i++) { for(int i = 0; i < pVoids.size(); i++) {
@@ -2187,7 +2192,7 @@ public class GameAction {
if(!AllZone.GameAction.isCardInPlay(c) if(!AllZone.GameAction.isCardInPlay(c)
|| (c.getKeyword().contains("Indestructible") && (!c.isCreature() || c.getNetDefense() > 0))) return false; || (c.getKeyword().contains("Indestructible") && (!c.isCreature() || c.getNetDefense() > 0))) return false;
if(c.getShield() > 0 && !c.getKeyword().contains("CARDNAME can't be regenerated.")) { if(c.canBeShielded() && c.getShield() > 0) {
c.subtractShield(); c.subtractShield();
c.setDamage(0); c.setDamage(0);
c.tap(); c.tap();