forked from External/mage
Rework implementation of anchor words (#13518)
* refactor anchor word implementation * fix error * [TDM] Implement Windcrag Siege
This commit is contained in:
parent
3c6e055f41
commit
56a05a7843
27 changed files with 610 additions and 638 deletions
75
Mage/src/main/java/mage/constants/ModeChoice.java
Normal file
75
Mage/src/main/java/mage/constants/ModeChoice.java
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
package mage.constants;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public enum ModeChoice {
|
||||
|
||||
KHANS("Khans"),
|
||||
DRAGONS("Dragons"),
|
||||
|
||||
MARDU("Mardu"),
|
||||
TEMUR("Temur"),
|
||||
ABZAN("Abzan"),
|
||||
JESKAI("Jeskai"),
|
||||
SULTAI("Sultai"),
|
||||
|
||||
MIRRAN("Mirran"),
|
||||
PHYREXIAN("Phyrexian "),
|
||||
|
||||
ODD("odd"),
|
||||
EVEN("even"),
|
||||
|
||||
BELIEVE("Believe"),
|
||||
DOUBT("Doubt"),
|
||||
|
||||
NCR("NCR"),
|
||||
LEGION("Legion"),
|
||||
|
||||
BROTHERHOOD("Brotherhood"),
|
||||
ENCLAVE("Enclave"),
|
||||
|
||||
ISLAND("Island"),
|
||||
SWAMP("Swamp"),
|
||||
|
||||
LEFT("left"),
|
||||
RIGHT("right");
|
||||
|
||||
private static class ModeChoiceCondition implements Condition {
|
||||
|
||||
private final ModeChoice modeChoice;
|
||||
|
||||
ModeChoiceCondition(ModeChoice modeChoice) {
|
||||
this.modeChoice = modeChoice;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return modeChoice.checkMode(game, source);
|
||||
}
|
||||
}
|
||||
|
||||
private final String name;
|
||||
private final ModeChoiceCondition condition;
|
||||
|
||||
ModeChoice(String name) {
|
||||
this.name = name;
|
||||
this.condition = new ModeChoiceCondition(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public ModeChoiceCondition getCondition() {
|
||||
return condition;
|
||||
}
|
||||
|
||||
public boolean checkMode(Game game, Ability source) {
|
||||
return Objects.equals(game.getState().getValue(source.getSourceId() + "_modeChoice"), name);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue