-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

@@ -366,40 +366,42 @@ public class AbilityFactory_Pump {
tgtCards = tgt.getTargetCards();
else
tgtCards = AbilityFactory.getDefinedCards(sa.getSourceCard(), params.get("Defined"), sa);
if (sa instanceof Ability_Sub)
sb.append(" ");
else
sb.append(name).append(" - ");
for(Card c : tgtCards)
sb.append(c.getName()).append(" ");
if(tgtCards.size() > 0) {
final int atk = getNumAttack(sa);
final int def = getNumDefense(sa);
sb.append("gains ");
if (atk != 0 || def != 0){
if (atk >= 0)
sb.append("+");
sb.append(atk);
sb.append("/");
if (def >= 0)
sb.append("+");
sb.append(def);
sb.append(" ");
}
if (sa instanceof Ability_Sub)
sb.append(" ");
else
sb.append(name).append(" - ");
for (int i=0; i<Keywords.size(); i++)
{
if (!Keywords.get(i).equals("none"))
sb.append(Keywords.get(i)).append(" ");
for(Card c : tgtCards)
sb.append(c.getName()).append(" ");
final int atk = getNumAttack(sa);
final int def = getNumDefense(sa);
sb.append("gains ");
if (atk != 0 || def != 0){
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++)
{
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();
if (abSub != null) {
sb.append(abSub.getStackDescription());

View File

@@ -113,7 +113,7 @@ public class AbilityFactory_Regenerate {
CardList play = AllZoneUtil.getCreaturesInPlay(AllZone.ComputerPlayer);
for(Card card:play) {
if(card.getShield() > 0) return false;
if(!card.canBeShielded() || card.getShield() > 0) return false;
if(CardFactoryUtil.AI_doesCreatureAttack(card)) {
//"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

View File

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

View File

@@ -63,6 +63,11 @@ public class GameAction {
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")) {
CardList pVoids = AllZoneUtil.getCardsInPlay("Planar Void");
for(int i = 0; i < pVoids.size(); i++) {
@@ -2187,7 +2192,7 @@ public class GameAction {
if(!AllZone.GameAction.isCardInPlay(c)
|| (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.setDamage(0);
c.tap();