- Added Sol's "May be played" keyword implementation for non-land cards.

- Added Garruk's Horde.
This commit is contained in:
Sloth
2011-10-24 07:32:49 +00:00
parent e88d5d495b
commit 27b96a3430
8 changed files with 55 additions and 30 deletions

1
.gitattributes vendored
View File

@@ -3044,6 +3044,7 @@ res/cardsfolder/g/gargoyle_sentinel.txt svneol=native#text/plain
res/cardsfolder/g/garruk_primal_hunter.txt svneol=native#text/plain res/cardsfolder/g/garruk_primal_hunter.txt svneol=native#text/plain
res/cardsfolder/g/garruk_wildspeaker.txt svneol=native#text/plain res/cardsfolder/g/garruk_wildspeaker.txt svneol=native#text/plain
res/cardsfolder/g/garruks_companion.txt svneol=native#text/plain res/cardsfolder/g/garruks_companion.txt svneol=native#text/plain
res/cardsfolder/g/garruks_horde.txt -text
res/cardsfolder/g/garruks_packleader.txt svneol=native#text/plain res/cardsfolder/g/garruks_packleader.txt svneol=native#text/plain
res/cardsfolder/g/garza_zol_plague_queen.txt svneol=native#text/plain res/cardsfolder/g/garza_zol_plague_queen.txt svneol=native#text/plain
res/cardsfolder/g/gaseous_form.txt svneol=native#text/plain res/cardsfolder/g/gaseous_form.txt svneol=native#text/plain

View File

@@ -0,0 +1,13 @@
Name:Garruk's Horde
ManaCost:5 G G
Types:Creature Beast
Text:no text
PT:7/7
K:Trample
K:Play with the top card of your library revealed.
S:Mode$ Continuous | Affected$ Creature.TopLibrary | AffectedZone$ Library | AddHiddenKeyword$ HIDDEN May be played | Description$ You may cast the top card of your library if it's a creature card. (Do this only any time you could cast that creature card. You still pay the spell's costs.)
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/garruks_horde.jpg
SetInfo:M12|Rare|http://magiccards.info/scans/en/m12/176.jpg
Oracle:Trample\nPlay with the top card of your library revealed.\nYou may cast the top card of your library if it's a creature card. (Do this only any time you could cast that creature card. You still pay the spell's costs.)
End

View File

@@ -5057,21 +5057,25 @@ public class Card extends GameEntity implements Comparable<Card> {
CardList list = this.getOwner().getCardsIn(Zone.Graveyard); CardList list = this.getOwner().getCardsIn(Zone.Graveyard);
if (!list.getAbove(source, this)) if (!list.getAbove(source, this))
return false; return false;
}else if (Property.startsWith("DirectlyAbove")){ // "Are Directly Above" Source } else if (Property.startsWith("DirectlyAbove")){ // "Are Directly Above" Source
CardList list = this.getOwner().getCardsIn(Zone.Graveyard); CardList list = this.getOwner().getCardsIn(Zone.Graveyard);
if (!list.getDirectlyAbove(source, this)) if (!list.getDirectlyAbove(source, this))
return false; return false;
}else if (Property.startsWith("TopGraveyardCreature")){ } else if (Property.startsWith("TopGraveyardCreature")){
CardList list = this.getOwner().getCardsIn(Zone.Graveyard); CardList list = this.getOwner().getCardsIn(Zone.Graveyard);
list = list.getType("Creature"); list = list.getType("Creature");
list.reverse(); list.reverse();
if (list.isEmpty() || !this.equals(list.get(0))) if (list.isEmpty() || !this.equals(list.get(0)))
return false; return false;
}else if (Property.startsWith("TopGraveyard")){ } else if (Property.startsWith("TopGraveyard")){
CardList list = this.getOwner().getCardsIn(Zone.Graveyard); CardList list = this.getOwner().getCardsIn(Zone.Graveyard);
list.reverse(); list.reverse();
if (list.isEmpty() || !this.equals(list.get(0))) if (list.isEmpty() || !this.equals(list.get(0)))
return false; return false;
} else if (Property.startsWith("TopLibrary")){
CardList list = this.getOwner().getCardsIn(Zone.Library);
if (list.isEmpty() || !this.equals(list.get(0)))
return false;
} else if (Property.startsWith("Cloned")) { } else if (Property.startsWith("Cloned")) {
if (cloneOrigin == null || !cloneOrigin.equals(source)) return false; if (cloneOrigin == null || !cloneOrigin.equals(source)) return false;
} else if (Property.startsWith("DamagedBy")) { } else if (Property.startsWith("DamagedBy")) {

View File

@@ -797,7 +797,7 @@ public class ComputerUtil {
CardList lands = computer.getCardsIn(Zone.Graveyard).getType("Land"); CardList lands = computer.getCardsIn(Zone.Graveyard).getType("Land");
for (Card crd : lands){ for (Card crd : lands){
if (crd.isLand() && crd.hasKeyword("May be played")) if (crd.isLand() && crd.hasStartOfKeyword("May be played"))
landList.add(crd); landList.add(crd);
} }

View File

@@ -1584,7 +1584,7 @@ public class GameAction {
if (c.isLand() && human.canPlayLand()) { if (c.isLand() && human.canPlayLand()) {
PlayerZone zone = AllZone.getZoneOf(c); PlayerZone zone = AllZone.getZoneOf(c);
if (zone.is(Zone.Hand) || (!zone.is(Zone.Battlefield)) && c.hasKeyword("May be played")) { if (zone.is(Zone.Hand) || (!zone.is(Zone.Battlefield)) && c.hasStartOfKeyword("May be played")) {
choices.add("Play land"); choices.add("Play land");
} }
} }
@@ -1630,23 +1630,10 @@ public class GameAction {
* @param c a {@link forge.Card} object. * @param c a {@link forge.Card} object.
*/ */
public final void playCardNoCost(final Card c) { public final void playCardNoCost(final Card c) {
//SpellAbility[] choices = (SpellAbility[]) c.getSpells().toArray();
ArrayList<SpellAbility> choices = c.getBasicSpells(); ArrayList<SpellAbility> choices = c.getBasicSpells();
SpellAbility sa; SpellAbility sa;
//TODO add Buyback, Kicker, ... , spells here //TODO add Buyback, Kicker, ... , spells here
/*
ArrayList<SpellAbility> additional = c.getAdditionalCostSpells();
for (SpellAbility s : additional)
{
}
*/
/*
System.out.println(choices.length);
for(int i = 0; i < choices.length; i++)
System.out.println(choices[i]);
*/
if (choices.size() == 0) { if (choices.size() == 0) {
return; return;
} else if (choices.size() == 1) { } else if (choices.size() == 1) {

View File

@@ -718,13 +718,16 @@ public class AbilityFactory_Pump {
} }
} }
Zone pumpZone = params.containsKey("PumpZone") ? Zone.smartValueOf(params.get("PumpZone")) : Zone.Battlefield;
int size = tgtCards.size(); int size = tgtCards.size();
for (int j = 0; j < size; j++) { for (int j = 0; j < size; j++) {
final Card tgtC = tgtCards.get(j); final Card tgtC = tgtCards.get(j);
// only pump things in play // only pump things in PumpZone
if (!AllZoneUtil.isCardInPlay(tgtC)) if (!AllZoneUtil.getCardsIn(pumpZone).contains(tgtC)) {
continue; continue;
}
// if pump is a target, make sure we can still target now // if pump is a target, make sure we can still target now
if (tgt != null && !CardFactoryUtil.canTarget(AF.getHostCard(), tgtC)) if (tgt != null && !CardFactoryUtil.canTarget(AF.getHostCard(), tgtC))
@@ -736,8 +739,10 @@ public class AbilityFactory_Pump {
for(int i=0;i<untargetedCards.size();i++) { for(int i=0;i<untargetedCards.size();i++) {
final Card tgtC = untargetedCards.get(i); final Card tgtC = untargetedCards.get(i);
if(!AllZoneUtil.isCardInPlay(tgtC)) // only pump things in PumpZone
continue; if (!AllZoneUtil.getCardsIn(pumpZone).contains(tgtC)) {
continue;
}
applyPump(sa,tgtC); applyPump(sa,tgtC);
} }

View File

@@ -2630,6 +2630,7 @@ public class CardFactoryUtil {
List<Zone> sb = new ArrayList<Constant.Zone>(3); List<Zone> sb = new ArrayList<Constant.Zone>(3);
sb.add(Constant.Zone.Graveyard); sb.add(Constant.Zone.Graveyard);
sb.add(Constant.Zone.Exile); sb.add(Constant.Zone.Exile);
sb.add(Constant.Zone.Library);
sb.add(Constant.Zone.Command); sb.add(Constant.Zone.Command);
CardList cl = player.getCardsIn(sb); CardList cl = player.getCardsIn(sb);
cl.addAll(AllZone.getStackZone().getCards()); cl.addAll(AllZone.getStackZone().getCards());
@@ -2661,20 +2662,21 @@ public class CardFactoryUtil {
} }
if (c.isLand() && !zone.is(Constant.Zone.Battlefield) && c.hasKeyword("May be played")) { if (c.isLand() && !zone.is(Constant.Zone.Battlefield) && c.hasStartOfKeyword("May be played")) {
return true; return true;
} }
for (SpellAbility sa : c.getSpellAbility()) { for (SpellAbility sa : c.getSpellAbility()) {
if (AllZone.getZoneOf(c).is(sa.getRestrictions().getZone())) { Zone restrictZone = sa.getRestrictions().getZone();
if (zone.is(restrictZone)) {
return true; return true;
} }
// TODO - Yawgmoth's Will check here, lots of testing before adding if (sa.isSpell() && !zone.is(Zone.Battlefield) && c.hasStartOfKeyword("May be played")
// this though && restrictZone.equals(Zone.Hand))
// if (!zone.is(Constant.Zone.Battlefield) && {
// c.hasKeyword("May be played") && sa.isSpell()) return true;
// return true; }
} }
return false; return false;

View File

@@ -147,8 +147,21 @@ public class SpellAbility_Restriction extends SpellAbility_Variables {
* @return a boolean. * @return a boolean.
*/ */
public boolean canPlay(Card c, SpellAbility sa) { public boolean canPlay(Card c, SpellAbility sa) {
if (!AllZone.getZoneOf(c).is(zone) || c.isPhasedOut()) if (c.isPhasedOut()) {
return false; return false;
}
PlayerZone cardZone = AllZone.getZoneOf(c);
if (!cardZone.is(zone)) {
// If Card is not in the default activating zone, do some additional checks
// Not a Spell, or on Battlefield, return false
if (!sa.isSpell() || cardZone.is(Zone.Battlefield)) {
return false;
}
else if (!c.hasStartOfKeyword("May be played") || !zone.equals(Zone.Hand)) {
return false;
}
}
Player activator = sa.getActivatingPlayer(); Player activator = sa.getActivatingPlayer();
if (activator == null) { if (activator == null) {