make Worms of the Earth into a GlobalRuleChange

This commit is contained in:
Hanmac
2017-08-13 18:35:10 +00:00
parent 8b282818e9
commit 14d5034b8e
3 changed files with 33 additions and 4 deletions

View File

@@ -258,6 +258,36 @@ public class GameAction {
}
}
// special rule for Worms of the Earth
if (toBattlefield && game.getStaticEffects().getGlobalRuleChange(GlobalRuleChange.noLandBattlefield)) {
// something that is already a Land cant enter the battlefield
if (c.isLand()) {
return c;
}
// check if something would be a land
Card noLandLKI = CardUtil.getLKICopy(c);
//setZone is not enough
//noLandLKI.setZone(zoneTo);
noLandLKI.setImmutable(true); // immu doesn't trigger Zone
zoneTo.add(noLandLKI);
noLandLKI.setImmutable(false); // but need to remove that or Static doesn't find it
checkStaticAbilities(false, Sets.newHashSet(noLandLKI));
boolean noLand = noLandLKI.isLand();
zoneTo.remove(noLandLKI);
// reset static
checkStaticAbilities(false, Sets.newHashSet(noLandLKI));
if(noLand) {
// if something would only be a land when entering the battlefield and not before
// put it into the graveyard instead
zoneTo = c.getOwner().getZone(ZoneType.Graveyard);
}
}
if (!suppress) {
if (zoneFrom == null) {
copied.getOwner().addInboundToken(copied);

View File

@@ -34,7 +34,8 @@ public enum GlobalRuleChange {
onlyOneBlocker ("No more than one creature can block each combat."),
onlyTwoBlockers ("No more than two creatures can block each combat."),
toughnessAssignsDamage ("Each creature assigns combat damage equal to its toughness rather than its power."),
blankIsChaos("Each blank roll of the planar dice is a {CHAOS} roll.");
blankIsChaos("Each blank roll of the planar dice is a {CHAOS} roll."),
noLandBattlefield("Lands can't enter the battlefield.");
private final String ruleText;

View File

@@ -2,9 +2,7 @@ Name:Worms of the Earth
ManaCost:2 B B B
Types:Enchantment
S:Mode$ CantPlayLand | Description$ Players can't play lands.
R:Event$ Moved | ActiveZones$ Battlefield | Origin$ Battlefield,Hand,Library,Graveyard,Exile,Command | Destination$ Battlefield | ValidCard$ Land | Prevent$ True | Description$ Lands can't enter the battlefield.
R:Event$ Moved | ActiveZones$ Battlefield | Origin$ Stack | Destination$ Battlefield | ValidCard$ Land | ReplaceWith$ MoveToGraveyard | Description$ Lands can't enter the battlefield.
SVar:MoveToGraveyard:DB$ ChangeZone | Destination$ Graveyard | Defined$ ReplacedCard
S:Mode$ Continuous | EffectZone$ Battlefield | GlobalRule$ Lands can't enter the battlefield. | Description$ Lands can't enter the battlefield.
T:Mode$ Phase | Phase$ Upkeep | TriggerZones$ Battlefield | Execute$ RepeatAbility | TriggerDescription$ At the beginning of each upkeep, any player may sacrifice two lands or have CARDNAME deal 5 damage to him or her. If a player does either, destroy CARDNAME.
SVar:RepeatAbility:DB$ RepeatEach | RepeatPlayers$ Player | RepeatSubAbility$ DBChoose
SVar:DBChoose:DB$ GenericChoice | Defined$ Player.IsRemembered | Choices$ SacTwoLands,DealDmg | AILogic$ PayUnlessCost