diff --git a/forge-ai/src/main/java/forge/ai/AiController.java b/forge-ai/src/main/java/forge/ai/AiController.java index 97943fe1750..2c6f0d43f4b 100644 --- a/forge-ai/src/main/java/forge/ai/AiController.java +++ b/forge-ai/src/main/java/forge/ai/AiController.java @@ -422,7 +422,8 @@ public class AiController { } } } - return true; + + return player.canPlayLand(c); } }); return landList; @@ -1174,7 +1175,7 @@ public class AiController { if (landsWannaPlay != null) { landsWannaPlay = filterLandsToPlay(landsWannaPlay); Log.debug("Computer " + game.getPhaseHandler().getPhase().nameForUi); - if (landsWannaPlay != null && !landsWannaPlay.isEmpty() && player.canPlayLand(null)) { + if (landsWannaPlay != null && !landsWannaPlay.isEmpty()) { // TODO search for other land it might want to play? Card land = chooseBestLandToPlay(landsWannaPlay); if (ComputerUtil.getDamageFromETB(player, land) < player.getLife() || !player.canLoseLife() diff --git a/forge-game/src/main/java/forge/game/spellability/LandAbility.java b/forge-game/src/main/java/forge/game/spellability/LandAbility.java index a524a7222a9..a9b26dc7680 100644 --- a/forge-game/src/main/java/forge/game/spellability/LandAbility.java +++ b/forge-game/src/main/java/forge/game/spellability/LandAbility.java @@ -17,13 +17,10 @@ */ package forge.game.spellability; -import forge.game.Game; import forge.game.card.Card; import forge.game.cost.Cost; import forge.game.player.Player; import forge.game.staticability.StaticAbility; -import forge.game.zone.Zone; -import forge.game.zone.ZoneType; public class LandAbility extends Ability { @@ -33,57 +30,14 @@ public class LandAbility extends Ability { setMayPlay(mayPlay); } public LandAbility(Card sourceCard) { - this(sourceCard, sourceCard.getController(), (StaticAbility)null); + this(sourceCard, sourceCard.getController(), null); } @Override public boolean canPlay() { final Card land = this.getHostCard(); final Player p = this.getActivatingPlayer(); - final Game game = p.getGame(); - if (!p.canCastSorcery()) { - return false; - } - // CantBeCast static abilities - for (final Card ca : game.getCardsIn(ZoneType.listValueOf("Battlefield,Command"))) { - final Iterable staticAbilities = ca.getStaticAbilities(); - for (final StaticAbility stAb : staticAbilities) { - if (stAb.applyAbility("CantPlayLand", land, this)) { - return false; - } - } - } - - if (land != null) { - final boolean mayPlay = getMayPlay() != null; - if (land.getOwner() != p && !mayPlay) { - return false; - } - - final Zone zone = game.getZoneOf(land); - if (zone != null && (zone.is(ZoneType.Battlefield) || (!zone.is(ZoneType.Hand) && !mayPlay))) { - return false; - } - } - - // **** Check for land play limit per turn **** - // Dev Mode - if (p.getController().canPlayUnlimitedLands() || p.hasKeyword("You may play any number of additional lands on each of your turns.")) { - return true; - } - - // check for adjusted max lands play per turn - int adjMax = 1; - for (String keyword : p.getKeywords()) { - if (keyword.startsWith("AdjustLandPlays")) { - final String[] k = keyword.split(":"); - adjMax += Integer.valueOf(k[1]); - } - } - if (p.getLandsPlayedThisTurn() < adjMax) { - return true; - } - return false; + return p.canPlayLand(land); } @Override public void resolve() { diff --git a/forge-game/src/main/java/forge/game/staticability/StaticAbilityCantBeCast.java b/forge-game/src/main/java/forge/game/staticability/StaticAbilityCantBeCast.java index 49a95c13fa6..307d64d366a 100644 --- a/forge-game/src/main/java/forge/game/staticability/StaticAbilityCantBeCast.java +++ b/forge-game/src/main/java/forge/game/staticability/StaticAbilityCantBeCast.java @@ -160,6 +160,14 @@ public class StaticAbilityCantBeCast { return false; } + if (params.containsKey("Origin")) { + List src = ZoneType.listValueOf(params.get("Origin")); + + if (!src.contains(card.getZone().getZoneType())) { + return false; + } + } + if (params.containsKey("Player") && (player != null) && !player.isValid(params.get("Player"), hostCard.getController(), hostCard, null)) { return false; diff --git a/forge-gui/res/cardsfolder/upcoming/experimental_frenzy.txt b/forge-gui/res/cardsfolder/upcoming/experimental_frenzy.txt new file mode 100644 index 00000000000..d98744b9149 --- /dev/null +++ b/forge-gui/res/cardsfolder/upcoming/experimental_frenzy.txt @@ -0,0 +1,10 @@ +Name:Experimental Frenzy +ManaCost:3 R +Types:Enchantment +S:Mode$ Continuous | Affected$ Card.TopLibrary+YouCtrl | AffectedZone$ Library | MayLookAt$ Player | Description$ You may look at the top card of your library any time. +S:Mode$ Continuous | Affected$ Card.TopLibrary+YouCtrl | AffectedZone$ Library | MayPlay$ True | Description$ You may play the top card of your library. +S:Mode$ CantPlayLand | Player$ You | Origin$ Hand | Description$ You can't play lands from your hand. +S:Mode$ CantBeCast | ValidCard$ Card | Caster$ You | Origin$ Hand | Description$ You can't play cards from your hand. +SVar:NonStackingEffect:True +A:AB$ Destroy | Cost$ 3 R | Defined$ Self | SpellDescription$ Destroy CARDNAME. +Oracle:You may look at the top card of your library any time.\nYou may play the top card of your library.\nYou can't play cards from your hand.\n{3}{R}: Destroy Experimental Frenzy. \ No newline at end of file