Merge branch 'removeNoCyclingRule' into 'master'

Remove no cycling rule

See merge request core-developers/forge!2460
This commit is contained in:
swordshine
2020-01-22 03:43:53 +00:00
5 changed files with 49 additions and 53 deletions

View File

@@ -25,7 +25,6 @@ public enum GlobalRuleChange {
alwaysWither ("All damage is dealt as though it's source had wither."), alwaysWither ("All damage is dealt as though it's source had wither."),
attackerChoosesBlockers ("The attacking player chooses how each creature blocks each turn."), attackerChoosesBlockers ("The attacking player chooses how each creature blocks each turn."),
manapoolsDontEmpty ("Mana pools don't empty as steps and phases end."), manapoolsDontEmpty ("Mana pools don't empty as steps and phases end."),
noCycling ("Players can't cycle cards."),
noCreatureETBTriggers ("Creatures entering the battlefield don't cause abilities to trigger."), noCreatureETBTriggers ("Creatures entering the battlefield don't cause abilities to trigger."),
noCreatureDyingTriggers ("Creatures dying don't cause abilities to trigger."), noCreatureDyingTriggers ("Creatures dying don't cause abilities to trigger."),
noLegendRule ("The legend rule doesn't apply."), noLegendRule ("The legend rule doesn't apply."),

View File

@@ -16,6 +16,7 @@ import forge.game.spellability.AbilityActivated;
import forge.game.spellability.SpellAbility; import forge.game.spellability.SpellAbility;
import forge.game.spellability.TargetChoices; import forge.game.spellability.TargetChoices;
import forge.game.staticability.StaticAbility; import forge.game.staticability.StaticAbility;
import forge.game.zone.Zone;
import forge.game.zone.ZoneType; import forge.game.zone.ZoneType;
import java.util.List; import java.util.List;
@@ -500,17 +501,16 @@ public class CostAdjustment {
} }
if (st.hasParam("AffectedZone")) { if (st.hasParam("AffectedZone")) {
List<ZoneType> zones = ZoneType.listValueOf(st.getParam("AffectedZone")); List<ZoneType> zones = ZoneType.listValueOf(st.getParam("AffectedZone"));
boolean found = false; if (sa.isSpell()) {
for(ZoneType zt : zones) { if (!zones.contains(card.getCastFrom())) {
if(card.isInZone(zt))
{
found = true;
break;
}
}
if(!found) {
return false; return false;
} }
} else {
Zone z = card.getLastKnownZone();
if (z == null || !zones.contains(z.getZoneType())) {
return false;
}
}
} }
if (st.hasParam("ValidTarget")) { if (st.hasParam("ValidTarget")) {
SpellAbility curSa = sa; SpellAbility curSa = sa;

View File

@@ -18,7 +18,6 @@
package forge.game.spellability; package forge.game.spellability;
import forge.game.Game; import forge.game.Game;
import forge.game.GlobalRuleChange;
import forge.game.card.Card; import forge.game.card.Card;
import forge.game.cost.Cost; import forge.game.cost.Cost;
import forge.game.cost.CostPayment; import forge.game.cost.CostPayment;
@@ -101,11 +100,6 @@ public abstract class AbilityActivated extends SpellAbility implements java.io.S
return false; return false;
} }
if (this.isCycling()
&& game.getStaticEffects().getGlobalRuleChange(GlobalRuleChange.noCycling)) {
return false;
}
if (!(this.getRestrictions().canPlay(c, this))) { if (!(this.getRestrictions().canPlay(c, this))) {
return false; return false;
} }

View File

@@ -25,7 +25,6 @@ import forge.game.spellability.SpellAbility;
import forge.game.zone.ZoneType; import forge.game.zone.ZoneType;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* The Class StaticAbility_CantBeCast. * The Class StaticAbility_CantBeCast.
@@ -44,44 +43,43 @@ public class StaticAbilityCantBeCast {
* @return true, if successful * @return true, if successful
*/ */
public static boolean applyCantBeCastAbility(final StaticAbility stAb, final Card card, final Player activator) { public static boolean applyCantBeCastAbility(final StaticAbility stAb, final Card card, final Player activator) {
final Map<String, String> params = stAb.getMapParams();
final Card hostCard = stAb.getHostCard(); final Card hostCard = stAb.getHostCard();
if (params.containsKey("ValidCard") if (stAb.hasParam("ValidCard")
&& !card.isValid(params.get("ValidCard").split(","), hostCard.getController(), hostCard, null)) { && !card.isValid(stAb.getParam("ValidCard").split(","), hostCard.getController(), hostCard, null)) {
return false; return false;
} }
if (params.containsKey("Caster") && (activator != null) if (stAb.hasParam("Caster") && (activator != null)
&& !activator.isValid(params.get("Caster"), hostCard.getController(), hostCard, null)) { && !activator.isValid(stAb.getParam("Caster"), hostCard.getController(), hostCard, null)) {
return false; return false;
} }
if (params.containsKey("OnlySorcerySpeed") && (activator != null) && activator.canCastSorcery()) { if (stAb.hasParam("OnlySorcerySpeed") && (activator != null) && activator.canCastSorcery()) {
return false; return false;
} }
if (params.containsKey("Origin")) { if (stAb.hasParam("Origin")) {
List<ZoneType> src = ZoneType.listValueOf(params.get("Origin")); List<ZoneType> src = ZoneType.listValueOf(stAb.getParam("Origin"));
if (!src.contains(activator.getGame().getZoneOf(card).getZoneType())) { if (!src.contains(activator.getGame().getZoneOf(card).getZoneType())) {
return false; return false;
} }
} }
if (params.containsKey("NonCasterTurn") && (activator != null) if (stAb.hasParam("NonCasterTurn") && (activator != null)
&& activator.getGame().getPhaseHandler().isPlayerTurn(activator)) { && activator.getGame().getPhaseHandler().isPlayerTurn(activator)) {
return false; return false;
} }
if (params.containsKey("cmcGT") && (activator != null) if (stAb.hasParam("cmcGT") && (activator != null)
&& (card.getCMC() <= CardLists.getType(activator.getCardsIn(ZoneType.Battlefield), && (card.getCMC() <= CardLists.getType(activator.getCardsIn(ZoneType.Battlefield),
params.get("cmcGT")).size())) { stAb.getParam("cmcGT")).size())) {
return false; return false;
} }
if (params.containsKey("NumLimitEachTurn") && activator != null) { if (stAb.hasParam("NumLimitEachTurn") && activator != null) {
int limit = Integer.parseInt(params.get("NumLimitEachTurn")); int limit = Integer.parseInt(stAb.getParam("NumLimitEachTurn"));
String valid = params.containsKey("ValidCard") ? params.get("ValidCard") : "Card"; String valid = stAb.hasParam("ValidCard") ? stAb.getParam("ValidCard") : "Card";
List<Card> thisTurnCast = CardUtil.getThisTurnCast(valid, card); List<Card> thisTurnCast = CardUtil.getThisTurnCast(valid, card);
if (CardLists.filterControlledBy(thisTurnCast, activator).size() < limit) { if (CardLists.filterControlledBy(thisTurnCast, activator).size() < limit) {
return false; return false;
@@ -94,7 +92,7 @@ public class StaticAbilityCantBeCast {
/** /**
* Applies Cant Be Activated ability. * Applies Cant Be Activated ability.
* *
* @param staticAbility * @param stAb
* a StaticAbility * a StaticAbility
* @param card * @param card
* the card * the card
@@ -102,43 +100,49 @@ public class StaticAbilityCantBeCast {
* a SpellAbility * a SpellAbility
* @return true, if successful * @return true, if successful
*/ */
public static boolean applyCantBeActivatedAbility(final StaticAbility staticAbility, final Card card, public static boolean applyCantBeActivatedAbility(final StaticAbility stAb, final Card card,
final SpellAbility spellAbility) { final SpellAbility spellAbility) {
final Map<String, String> params = staticAbility.getMapParams(); final Card hostCard = stAb.getHostCard();
final Card hostCard = staticAbility.getHostCard();
final Player activator = spellAbility.getActivatingPlayer(); final Player activator = spellAbility.getActivatingPlayer();
if (params.containsKey("ValidCard") if (stAb.hasParam("ValidCard")
&& !card.isValid(params.get("ValidCard").split(","), hostCard.getController(), hostCard, null)) { && !card.isValid(stAb.getParam("ValidCard").split(","), hostCard.getController(), hostCard, null)) {
return false; return false;
} }
if (params.containsKey("AffectedZone") && !card.isInZone(ZoneType.smartValueOf(params.get("AffectedZone")))) { if (stAb.hasParam("ValidSA")
&& !spellAbility.isValid(stAb.getParam("ValidSA").split(","), hostCard.getController(), hostCard, null)) {
return false; return false;
} }
if (params.containsKey("Activator") && (activator != null)
&& !activator.isValid(params.get("Activator"), hostCard.getController(), hostCard, spellAbility)) { if (stAb.hasParam("AffectedZone") && !card.isInZone(ZoneType.smartValueOf(stAb.getParam("AffectedZone")))) {
return false; return false;
} }
if (params.containsKey("NonMana") && (spellAbility.isManaAbility())) { if (stAb.hasParam("Activator") && (activator != null)
&& !activator.isValid(stAb.getParam("Activator"), hostCard.getController(), hostCard, spellAbility)) {
return false; return false;
} }
if (params.containsKey("NonLoyalty") && spellAbility.isPwAbility()) { // TODO refactor this ones using ValidSA above
if (stAb.hasParam("NonMana") && (spellAbility.isManaAbility())) {
return false; return false;
} }
if (params.containsKey("Loyalty") && !spellAbility.isPwAbility()) { if (stAb.hasParam("NonLoyalty") && spellAbility.isPwAbility()) {
return false; return false;
} }
if (params.containsKey("TapAbility") && !(spellAbility.getPayCosts().hasTapCost())) { if (stAb.hasParam("Loyalty") && !spellAbility.isPwAbility()) {
return false; return false;
} }
if (params.containsKey("NonActivatorTurn") && (activator != null) if (stAb.hasParam("TapAbility") && !(spellAbility.getPayCosts().hasTapCost())) {
return false;
}
if (stAb.hasParam("NonActivatorTurn") && (activator != null)
&& activator.getGame().getPhaseHandler().isPlayerTurn(activator)) { && activator.getGame().getPhaseHandler().isPlayerTurn(activator)) {
return false; return false;
} }
@@ -158,24 +162,23 @@ public class StaticAbilityCantBeCast {
* @return true, if successful * @return true, if successful
*/ */
public static boolean applyCantPlayLandAbility(final StaticAbility stAb, final Card card, final Player player) { public static boolean applyCantPlayLandAbility(final StaticAbility stAb, final Card card, final Player player) {
final Map<String, String> params = stAb.getMapParams();
final Card hostCard = stAb.getHostCard(); final Card hostCard = stAb.getHostCard();
if (params.containsKey("ValidCard") if (stAb.hasParam("ValidCard")
&& (card == null || !card.isValid(params.get("ValidCard").split(","), hostCard.getController(), hostCard, null))) { && (card == null || !card.isValid(stAb.getParam("ValidCard").split(","), hostCard.getController(), hostCard, null))) {
return false; return false;
} }
if (params.containsKey("Origin")) { if (stAb.hasParam("Origin")) {
List<ZoneType> src = ZoneType.listValueOf(params.get("Origin")); List<ZoneType> src = ZoneType.listValueOf(stAb.getParam("Origin"));
if (!src.contains(card.getZone().getZoneType())) { if (!src.contains(card.getZone().getZoneType())) {
return false; return false;
} }
} }
if (params.containsKey("Player") && (player != null) if (stAb.hasParam("Player") && (player != null)
&& !player.isValid(params.get("Player"), hostCard.getController(), hostCard, null)) { && !player.isValid(stAb.getParam("Player"), hostCard.getController(), hostCard, null)) {
return false; return false;
} }

View File

@@ -1,7 +1,7 @@
Name:Stabilizer Name:Stabilizer
ManaCost:2 ManaCost:2
Types:Artifact Types:Artifact
S:Mode$ Continuous | GlobalRule$ Players can't cycle cards. | Description$ Players can't cycle cards. S:Mode$ CantBeActivated | ValidSA$ Activated.Cycling | Description$ Players can't cycle cards.
SVar:NonStackingEffect:True SVar:NonStackingEffect:True
AI:RemoveDeck:Random AI:RemoveDeck:Random
SVar:Picture:http://www.wizards.com/global/images/magic/general/stabilizer.jpg SVar:Picture:http://www.wizards.com/global/images/magic/general/stabilizer.jpg