- Added the keyword "May be played by your Opponent".

- Added Fiend of the Shadows.
This commit is contained in:
Sloth
2012-02-04 12:29:12 +00:00
parent 977362e2d8
commit 1b782a9a23
9 changed files with 76 additions and 35 deletions

View File

@@ -225,6 +225,11 @@ public class GameAction {
}
copied.setTimestamp(AllZone.getNextTimestamp());
for (String s : copied.getKeyword()) {
if (s.startsWith("May be played")) {
copied.removeAllExtrinsicKeyword(s);
}
}
return copied;
}
@@ -1876,7 +1881,6 @@ public class GameAction {
// for uncastables like lotus bloom, check if manaCost is blank
sa.setActivatingPlayer(human);
if (sa.canPlay() && (!sa.isSpell() || !sa.getManaCost().equals(""))) {
boolean flashb = false;
// check for flashback keywords
@@ -1913,7 +1917,7 @@ public class GameAction {
choices.add(newSA.toString());
map.put(newSA.toString(), newSA);
}
if (!flashb || c.hasKeyword("May be played")) {
if (!flashb || c.hasKeyword("May be played") || c.hasKeyword("May be played by your Opponent")) {
choices.add(sa.toString());
map.put(sa.toString(), sa);
}

View File

@@ -1780,7 +1780,8 @@ public abstract class Player extends GameEntity {
*/
public final void playLand(final Card land) {
if (this.canPlayLand()) {
AllZone.getGameAction().moveToPlay(land);
land.addController(this);
AllZone.getGameAction().moveTo(this.getZone(Constant.Zone.Battlefield), land);
CardFactoryUtil.playLandEffects(land);
this.numLandsPlayed++;

View File

@@ -2412,17 +2412,19 @@ public class CardFactoryUtil {
* getExternalZoneActivationCards.
* </p>
*
* @param player
* @param activator
* a {@link forge.Player} object.
* @return a {@link forge.CardList} object.
*/
public static CardList getExternalZoneActivationCards(final Player player) {
public static CardList getExternalZoneActivationCards(final Player activator) {
CardList cl = new CardList();
Player opponent = activator.getOpponent();
cl.addAll(getActivateablesFromZone(player.getZone(Constant.Zone.Graveyard), player));
cl.addAll(getActivateablesFromZone(player.getZone(Constant.Zone.Exile), player));
cl.addAll(getActivateablesFromZone(player.getZone(Constant.Zone.Library), player));
cl.addAll(getActivateablesFromZone(player.getZone(Constant.Zone.Command), player));
cl.addAll(getActivateablesFromZone(activator.getZone(Constant.Zone.Graveyard), activator));
cl.addAll(getActivateablesFromZone(activator.getZone(Constant.Zone.Exile), activator));
cl.addAll(getActivateablesFromZone(activator.getZone(Constant.Zone.Library), activator));
cl.addAll(getActivateablesFromZone(activator.getZone(Constant.Zone.Command), activator));
cl.addAll(getActivateablesFromZone(opponent.getZone(Constant.Zone.Exile), activator));
return cl;
}
@@ -2434,42 +2436,56 @@ public class CardFactoryUtil {
*
* @param zone
* a PlayerZone object.
* @param player
* @param activator
* a {@link forge.Player} object.
* @return a boolean.
*/
public static CardList getActivateablesFromZone(final PlayerZone zone, final Player player) {
public static CardList getActivateablesFromZone(final PlayerZone zone, final Player activator) {
CardList cl = new CardList(zone.getCards());
cl = cl.filter(new CardListFilter() {
@Override
public boolean addCard(final Card c) {
if (zone.is(Constant.Zone.Graveyard)) {
if (c.hasUnearth()) {
return true;
if (activator.isPlayer(zone.getPlayer())) {
cl = cl.filter(new CardListFilter() {
@Override
public boolean addCard(final Card c) {
if (zone.is(Constant.Zone.Graveyard)) {
if (c.hasUnearth()) {
return true;
}
}
}
if (c.isLand() && c.hasKeyword("May be played")) {
return true;
}
for (final SpellAbility sa : c.getSpellAbility()) {
final Zone restrictZone = sa.getRestrictions().getZone();
if (zone.is(restrictZone)) {
if (c.isLand() && c.hasKeyword("May be played")) {
return true;
}
if (sa.isSpell()
&& (c.hasKeyword("May be played") || (c.hasStartOfKeyword("Flashback") && zone
.is(Zone.Graveyard))) && restrictZone.equals(Zone.Hand)) {
for (final SpellAbility sa : c.getSpellAbility()) {
final Zone restrictZone = sa.getRestrictions().getZone();
if (zone.is(restrictZone)) {
return true;
}
if (sa.isSpell()
&& (c.hasKeyword("May be played") || (c.hasStartOfKeyword("Flashback") && zone
.is(Zone.Graveyard))) && restrictZone.equals(Zone.Hand)) {
return true;
}
}
return false;
}
});
} else {
// the activator is not the owner of the card
cl = cl.filter(new CardListFilter() {
@Override
public boolean addCard(final Card c) {
if (c.hasKeyword("May be played by your Opponent")) {
return true;
}
return false;
}
return false;
}
});
});
}
return cl;
}

View File

@@ -117,7 +117,7 @@ public abstract class Spell extends SpellAbility implements java.io.Serializable
return false;
}
return (card.isInstant() || card.hasKeyword("Flash") || PhaseHandler.canCastSorcery(card.getController()));
return (card.isInstant() || card.hasKeyword("Flash") || PhaseHandler.canCastSorcery(activator));
} // canPlay()
/** {@inheritDoc} */

View File

@@ -228,7 +228,8 @@ public class SpellAbilityRestriction extends SpellAbilityVariables {
return false;
}
if (!this.isAnyPlayer() && !activator.equals(c.getController())) {
if (!this.isAnyPlayer() && !activator.equals(c.getController())
&& !c.hasKeyword("May be played by your Opponent")) {
return false;
}

View File

@@ -412,6 +412,7 @@ public class SpellPermanent extends Spell {
@Override
public void resolve() {
final Card c = this.getSourceCard();
AllZone.getGameAction().moveToPlay(c);
c.addController(this.getActivatingPlayer());
AllZone.getGameAction().moveTo(this.getActivatingPlayer().getZone(Constant.Zone.Battlefield), c);
}
}