Merge branch 'guilds_fxes' into 'master'

Experimental Frenzy

See merge request core-developers/forge!954
This commit is contained in:
Michael Kamensky
2018-09-28 09:27:23 +00:00
4 changed files with 23 additions and 50 deletions

View File

@@ -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()

View File

@@ -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<StaticAbility> 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() {

View File

@@ -160,6 +160,14 @@ public class StaticAbilityCantBeCast {
return false;
}
if (params.containsKey("Origin")) {
List<ZoneType> 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;

View File

@@ -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.