mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
- GlobalRuleChange enum now has an associated text.
This commit is contained in:
@@ -95,25 +95,7 @@ public class StaticAbilityContinuous {
|
|||||||
//Global rules changes
|
//Global rules changes
|
||||||
if (params.containsKey("GlobalRule")) {
|
if (params.containsKey("GlobalRule")) {
|
||||||
final StaticEffects effects = Singletons.getModel().getGame().getStaticEffects();
|
final StaticEffects effects = Singletons.getModel().getGame().getStaticEffects();
|
||||||
if (params.get("GlobalRule").equals("Damage can't be prevented.")) {
|
effects.setGlobalRuleChange(GlobalRuleChange.fromString(params.get("GlobalRule")));
|
||||||
effects.setGlobalRuleChange(GlobalRuleChange.noPrevention);
|
|
||||||
} else if (params.get("GlobalRule").equals("All damage is dealt as though it's source had wither.")) {
|
|
||||||
effects.setGlobalRuleChange(GlobalRuleChange.alwaysWither);
|
|
||||||
} else if (params.get("GlobalRule").equals("The legend rule doesn't apply.")) {
|
|
||||||
effects.setGlobalRuleChange(GlobalRuleChange.noLegendRule);
|
|
||||||
} else if (params.get("GlobalRule").equals("Mana pools don't empty as steps and phases end.")) {
|
|
||||||
effects.setGlobalRuleChange(GlobalRuleChange.manapoolsDontEmpty);
|
|
||||||
} else if (params.get("GlobalRule").equals("Players can't cycle cards.")) {
|
|
||||||
effects.setGlobalRuleChange(GlobalRuleChange.noCycling);
|
|
||||||
} else if (params.get("GlobalRule").equals("Creatures entering the battlefield don't cause abilities to trigger.")) {
|
|
||||||
effects.setGlobalRuleChange(GlobalRuleChange.noCreatureETBTriggers);
|
|
||||||
} else if (params.get("GlobalRule").equals("No more than one creature can block each combat.")) {
|
|
||||||
effects.setGlobalRuleChange(GlobalRuleChange.onlyOneBlocker);
|
|
||||||
} else if (params.get("GlobalRule").equals("No more than one creature can attack each turn.")) {
|
|
||||||
effects.setGlobalRuleChange(GlobalRuleChange.onlyOneAttackerATurn);
|
|
||||||
} else if (params.get("GlobalRule").equals("No more than one creature can attack each combat.")) {
|
|
||||||
effects.setGlobalRuleChange(GlobalRuleChange.onlyOneAttackerACombat);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params.containsKey("SetPower")) {
|
if (params.containsKey("SetPower")) {
|
||||||
|
|||||||
@@ -22,13 +22,29 @@ package forge.game;
|
|||||||
*/
|
*/
|
||||||
public enum GlobalRuleChange {
|
public enum GlobalRuleChange {
|
||||||
|
|
||||||
alwaysWither,
|
alwaysWither ("All damage is dealt as though it's source had wither."),
|
||||||
manapoolsDontEmpty,
|
manapoolsDontEmpty ("Mana pools don't empty as steps and phases end."),
|
||||||
noCycling,
|
noCycling ("Players can't cycle cards."),
|
||||||
noCreatureETBTriggers,
|
noCreatureETBTriggers ("Creatures entering the battlefield don't cause abilities to trigger."),
|
||||||
noLegendRule,
|
noLegendRule ("The legend rule doesn't apply."),
|
||||||
noPrevention,
|
noPrevention ("Damage can't be prevented."),
|
||||||
onlyOneAttackerATurn,
|
onlyOneAttackerATurn ("No more than one creature can attack each turn."),
|
||||||
onlyOneAttackerACombat,
|
onlyOneAttackerACombat ("No more than one creature can attack each combat."),
|
||||||
onlyOneBlocker
|
onlyOneBlocker ("No more than one creature can block each combat.");
|
||||||
|
|
||||||
|
private final String ruleText;
|
||||||
|
|
||||||
|
private GlobalRuleChange(String text) {
|
||||||
|
ruleText = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GlobalRuleChange fromString(String text) {
|
||||||
|
for (final GlobalRuleChange v : GlobalRuleChange.values()) {
|
||||||
|
if (v.ruleText.compareToIgnoreCase(text) == 0) {
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new RuntimeException("Element " + text + " not found in GlobalRuleChange enum");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user