forked from External/mage
[AFR] Implementing dungeon mechanic (ready for review) (#7937)
* added dungeon and dungeon room class * [AFR] Implemented Tomb of Annihilation * [AFR] Implemented Shortcut Seeker * [AFR] Implemented Gloom Stalker * [AFR] Implemented Nadaar, Selfless Paladin * added room triggers * added more venturing code, currently untested * fixed error * moved venture into dungeon from player class to game class * removed unnecessary sourceobject from dungeon * fixed npe error * added dungeon completion * fixed concurrent modification exception * added logging * added proper copy methods * added views * updated room text generation * added some missing code * finished implementing CompletedDungeonCondition * [AFR] Implemented Ellywick Tumblestrum * [AFR] Implemented Lost Mine of Phandelver * added choice dialog for dungeons * [AFR] Implemented Dungeon of the Mad Mage * small text fix * added initial dungeon test * [AFR] Implemented Cloister Gargoyle * [AFR] Implemented Dungeon Crawler * small text change for dungeon rooms * added more tests * some simplification to dungeon props * updated testing helper functions * added currently failing test for venturing on separate steps and turns * added tests for dungeon completion * fixed missing trigger visual and dungeons not persisting through turns * some text updates * added rollback test * added a test for multiple dungeons at once * added one more condition test
This commit is contained in:
parent
c6d08ce344
commit
bb591dd038
42 changed files with 2481 additions and 144 deletions
|
|
@ -1,26 +1,20 @@
|
|||
|
||||
|
||||
package mage.game.command;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Viserion
|
||||
*/
|
||||
public class Command extends ArrayList<CommandObject> {
|
||||
|
||||
public Command () {}
|
||||
|
||||
public Command(final Command command) {
|
||||
addAll(command);
|
||||
public Command() {
|
||||
}
|
||||
|
||||
/*public void checkTriggers(GameEvent event, Game game) {
|
||||
for (CommandObject commandObject: this) {
|
||||
commandObject.checkTriggers(event, game);
|
||||
private Command(final Command command) {
|
||||
for (CommandObject commandObject : command) {
|
||||
add(commandObject.copy());
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
public Command copy() {
|
||||
return new Command(this);
|
||||
|
|
|
|||
371
Mage/src/main/java/mage/game/command/Dungeon.java
Normal file
371
Mage/src/main/java/mage/game/command/Dungeon.java
Normal file
|
|
@ -0,0 +1,371 @@
|
|||
package mage.game.command;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Abilities;
|
||||
import mage.abilities.AbilitiesImpl;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.mana.ManaCost;
|
||||
import mage.abilities.costs.mana.ManaCosts;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.text.TextPart;
|
||||
import mage.cards.FrameStyle;
|
||||
import mage.choices.Choice;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.game.Game;
|
||||
import mage.game.command.dungeons.DungeonOfTheMadMage;
|
||||
import mage.game.command.dungeons.LostMineOfPhandelver;
|
||||
import mage.game.command.dungeons.TombOfAnnihilation;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.players.Player;
|
||||
import mage.util.GameLog;
|
||||
import mage.util.SubTypes;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class Dungeon implements CommandObject {
|
||||
|
||||
private static final Set<String> dungeonNames = new HashSet<>();
|
||||
|
||||
static {
|
||||
dungeonNames.add("Tomb of Annihilation");
|
||||
dungeonNames.add("Lost Mine of Phandelver");
|
||||
dungeonNames.add("Dungeon of the Mad Mage");
|
||||
}
|
||||
|
||||
private static final ArrayList<CardType> emptySet = new ArrayList<>(Arrays.asList(CardType.DUNGEON));
|
||||
private static final ObjectColor emptyColor = new ObjectColor();
|
||||
private static final ManaCosts<ManaCost> emptyCost = new ManaCostsImpl<>();
|
||||
|
||||
private final String name;
|
||||
private UUID id;
|
||||
private UUID controllerId;
|
||||
private boolean copy;
|
||||
private MageObject copyFrom; // copied card INFO (used to call original adjusters)
|
||||
private FrameStyle frameStyle;
|
||||
private final Abilities<Ability> abilites = new AbilitiesImpl<>();
|
||||
private final String expansionSetCodeForImage;
|
||||
private final List<DungeonRoom> dungeonRooms = new ArrayList<>();
|
||||
private DungeonRoom currentRoom = null;
|
||||
|
||||
public Dungeon(String name, String expansionSetCodeForImage) {
|
||||
this.id = UUID.randomUUID();
|
||||
this.name = name;
|
||||
this.expansionSetCodeForImage = expansionSetCodeForImage;
|
||||
}
|
||||
|
||||
public Dungeon(final Dungeon dungeon) {
|
||||
this.id = dungeon.id;
|
||||
this.name = dungeon.name;
|
||||
this.frameStyle = dungeon.frameStyle;
|
||||
this.controllerId = dungeon.controllerId;
|
||||
this.copy = dungeon.copy;
|
||||
this.copyFrom = (dungeon.copyFrom != null ? dungeon.copyFrom : null);
|
||||
this.expansionSetCodeForImage = dungeon.expansionSetCodeForImage;
|
||||
this.copyRooms(dungeon);
|
||||
}
|
||||
|
||||
private void copyRooms(Dungeon dungeon) {
|
||||
Map<String, DungeonRoom> copyMap = new HashMap<>();
|
||||
for (DungeonRoom dungeonRoom : dungeon.dungeonRooms) {
|
||||
DungeonRoom copiedRoom = copyMap.computeIfAbsent(dungeonRoom.getName(), (s) -> dungeonRoom.copy());
|
||||
for (DungeonRoom nextRoom : dungeonRoom.getNextRooms()) {
|
||||
copiedRoom.addNextRoom(copyMap.computeIfAbsent(nextRoom.getName(), (s) -> nextRoom.copy()));
|
||||
}
|
||||
this.addRoom(copiedRoom);
|
||||
}
|
||||
this.currentRoom = copyMap.computeIfAbsent(dungeon.currentRoom.getName(), (s) -> dungeon.currentRoom.copy());
|
||||
}
|
||||
|
||||
public void addRoom(DungeonRoom room) {
|
||||
this.dungeonRooms.add(room);
|
||||
room.getRoomTriggeredAbility().setSourceId(id);
|
||||
this.abilites.add(room.getRoomTriggeredAbility());
|
||||
}
|
||||
|
||||
public void moveToNextRoom(UUID playerId, Game game) {
|
||||
if (currentRoom == null) {
|
||||
currentRoom = dungeonRooms.get(0);
|
||||
} else {
|
||||
currentRoom = currentRoom.chooseNextRoom(playerId, game);
|
||||
}
|
||||
Player player = game.getPlayer(getControllerId());
|
||||
if (player != null) {
|
||||
game.informPlayers(player.getLogName() + " has entered " + currentRoom.getName());
|
||||
}
|
||||
game.fireEvent(GameEvent.getEvent(
|
||||
GameEvent.EventType.ROOM_ENTERED, currentRoom.getId(), null, playerId
|
||||
));
|
||||
}
|
||||
|
||||
public DungeonRoom getCurrentRoom() {
|
||||
return currentRoom;
|
||||
}
|
||||
|
||||
public boolean hasNextRoom() {
|
||||
return currentRoom != null && currentRoom.hasNextRoom();
|
||||
}
|
||||
|
||||
public List<String> getRules() {
|
||||
List<String> rules = new ArrayList<>();
|
||||
rules.add("<i>(" + (
|
||||
currentRoom != null ?
|
||||
"Currently in " + currentRoom.getName() :
|
||||
"Not currently in a room"
|
||||
) + ")</i>");
|
||||
dungeonRooms.stream().map(DungeonRoom::toString).forEach(rules::add);
|
||||
return rules;
|
||||
}
|
||||
|
||||
public static Dungeon selectDungeon(UUID playerId, Game game) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
Choice choice = new ChoiceImpl(true);
|
||||
choice.setMessage("Choose a dungeon to venture into");
|
||||
choice.setChoices(dungeonNames);
|
||||
player.choose(Outcome.Neutral, choice, game);
|
||||
switch (choice.getChoice()) {
|
||||
case "Tomb of Annihilation":
|
||||
return new TombOfAnnihilation();
|
||||
case "Lost Mine of Phandelver":
|
||||
return new LostMineOfPhandelver();
|
||||
case "Dungeon of the Mad Mage":
|
||||
return new DungeonOfTheMadMage();
|
||||
default:
|
||||
throw new UnsupportedOperationException("A dungeon should have been chosen");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FrameStyle getFrameStyle() {
|
||||
return frameStyle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void assignNewId() {
|
||||
this.id = UUID.randomUUID();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MageObject getSourceObject() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getSourceId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getControllerId() {
|
||||
return this.controllerId;
|
||||
}
|
||||
|
||||
public void setControllerId(UUID controllerId) {
|
||||
this.controllerId = controllerId;
|
||||
this.abilites.setControllerId(controllerId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCopy(boolean isCopy, MageObject copyFrom) {
|
||||
this.copy = isCopy;
|
||||
this.copyFrom = (copyFrom != null ? copyFrom.copy() : null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCopy() {
|
||||
return this.copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MageObject getCopyFrom() {
|
||||
return this.copyFrom;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdName() {
|
||||
return getName() + " [" + getId().toString().substring(0, 3) + ']';
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLogName() {
|
||||
return GameLog.getColoredObjectIdName(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getImageName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setName(String name) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<CardType> getCardType() {
|
||||
return emptySet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SubTypes getSubtype() {
|
||||
return new SubTypes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SubTypes getSubtype(Game game) {
|
||||
return new SubTypes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSubtype(SubType subtype, Game game) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumSet<SuperType> getSuperType() {
|
||||
return EnumSet.noneOf(SuperType.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Abilities<Ability> getAbilities() {
|
||||
return abilites;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasAbility(Ability ability, Game game) {
|
||||
return getAbilities().contains(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectColor getColor() {
|
||||
return emptyColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectColor getColor(Game game) {
|
||||
return emptyColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectColor getFrameColor(Game game) {
|
||||
return emptyColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ManaCosts<ManaCost> getManaCost() {
|
||||
return emptyCost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getManaValue() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MageInt getPower() {
|
||||
return MageInt.EmptyMageInt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MageInt getToughness() {
|
||||
return MageInt.EmptyMageInt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStartingLoyalty() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setStartingLoyalty(int startingLoyalty) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustCosts(Ability ability, Game game) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dungeon copy() {
|
||||
return new Dungeon(this);
|
||||
}
|
||||
|
||||
public String getExpansionSetCodeForImage() {
|
||||
return expansionSetCodeForImage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getZoneChangeCounter(Game game) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateZoneChangeCounter(Game game, ZoneChangeEvent event) {
|
||||
throw new UnsupportedOperationException("Unsupported operation");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setZoneChangeCounter(int value, Game game) {
|
||||
throw new UnsupportedOperationException("Unsupported operation");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAllCreatureTypes(Game game) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIsAllCreatureTypes(boolean value) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIsAllCreatureTypes(Game game, boolean value) {
|
||||
}
|
||||
|
||||
public void discardEffects() {
|
||||
for (Ability ability : abilites) {
|
||||
for (Effect effect : ability.getEffects()) {
|
||||
if (effect instanceof ContinuousEffect) {
|
||||
((ContinuousEffect) effect).discard();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TextPart> getTextParts() {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextPart addTextPart(TextPart textPart) {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePTCDA() {
|
||||
}
|
||||
}
|
||||
167
Mage/src/main/java/mage/game/command/DungeonRoom.java
Normal file
167
Mage/src/main/java/mage/game/command/DungeonRoom.java
Normal file
|
|
@ -0,0 +1,167 @@
|
|||
package mage.game.command;
|
||||
|
||||
import mage.abilities.TriggeredAbility;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.stack.StackAbility;
|
||||
import mage.game.stack.StackObject;
|
||||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class DungeonRoom {
|
||||
|
||||
private final UUID id;
|
||||
private final String name;
|
||||
private final List<DungeonRoom> nextRooms = new ArrayList<>();
|
||||
private final RoomTriggeredAbility roomTriggeredAbility;
|
||||
|
||||
public DungeonRoom(String name, Effect... effects) {
|
||||
this.id = UUID.randomUUID();
|
||||
this.name = name;
|
||||
roomTriggeredAbility = new RoomTriggeredAbility(this, effects);
|
||||
}
|
||||
|
||||
private DungeonRoom(final DungeonRoom room) {
|
||||
this.id = room.id;
|
||||
this.name = room.name;
|
||||
this.roomTriggeredAbility = new RoomTriggeredAbility(this, room.roomTriggeredAbility);
|
||||
}
|
||||
|
||||
public DungeonRoom copy() {
|
||||
return new DungeonRoom(this);
|
||||
}
|
||||
|
||||
public void addTarget(Target target) {
|
||||
roomTriggeredAbility.addTarget(target);
|
||||
}
|
||||
|
||||
public void addNextRoom(DungeonRoom room) {
|
||||
nextRooms.add(room);
|
||||
}
|
||||
|
||||
public RoomTriggeredAbility getRoomTriggeredAbility() {
|
||||
return roomTriggeredAbility;
|
||||
}
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return roomTriggeredAbility.getText();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public boolean hasNextRoom() {
|
||||
return !nextRooms.isEmpty();
|
||||
}
|
||||
|
||||
List<DungeonRoom> getNextRooms() {
|
||||
return nextRooms;
|
||||
}
|
||||
|
||||
public DungeonRoom chooseNextRoom(UUID playerId, Game game) {
|
||||
switch (nextRooms.size()) {
|
||||
case 0:
|
||||
return null;
|
||||
case 1:
|
||||
return nextRooms.get(0);
|
||||
case 2:
|
||||
DungeonRoom room1 = nextRooms.get(0);
|
||||
DungeonRoom room2 = nextRooms.get(1);
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player == null) {
|
||||
return null;
|
||||
}
|
||||
return player.chooseUse(
|
||||
Outcome.Neutral, "Choose which room to go to",
|
||||
null, room1.name, room2.name, null, game
|
||||
) ? room1 : room2;
|
||||
default:
|
||||
throw new UnsupportedOperationException("there shouldn't be more than two rooms to go to");
|
||||
}
|
||||
}
|
||||
|
||||
String generateDestinationText() {
|
||||
if (nextRooms.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
return " <i>(Leads to "
|
||||
+ nextRooms
|
||||
.stream()
|
||||
.map(DungeonRoom::getName)
|
||||
.reduce((a, b) -> a + " or " + b)
|
||||
.orElse("")
|
||||
+ ")</i>";
|
||||
}
|
||||
|
||||
public static boolean isRoomTrigger(StackObject stackObject) {
|
||||
return stackObject instanceof StackAbility
|
||||
&& stackObject.getStackAbility() instanceof RoomTriggeredAbility;
|
||||
}
|
||||
|
||||
public static boolean isRoomTrigger(TriggeredAbility ability) {
|
||||
return ability instanceof RoomTriggeredAbility;
|
||||
}
|
||||
}
|
||||
|
||||
class RoomTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
private final DungeonRoom room;
|
||||
|
||||
RoomTriggeredAbility(DungeonRoom room, Effect... effects) {
|
||||
super(Zone.COMMAND, null, false);
|
||||
this.room = room;
|
||||
for (Effect effect : effects) {
|
||||
this.addEffect(effect);
|
||||
}
|
||||
this.setRuleVisible(false);
|
||||
}
|
||||
|
||||
RoomTriggeredAbility(DungeonRoom room, final RoomTriggeredAbility ability) {
|
||||
super(ability);
|
||||
this.room = room;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.ROOM_ENTERED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
return event.getTargetId().equals(room.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoomTriggeredAbility copy() {
|
||||
return new RoomTriggeredAbility(this.room, this);
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return room.getName() + " — "
|
||||
+ CardUtil.getTextWithFirstCharUpperCase(super.getRule())
|
||||
+ room.generateDestinationText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "When you enter this room, " + super.getRule() + " <i>(" + room.getName() + ")</i>";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,189 @@
|
|||
package mage.game.command.dungeons;
|
||||
|
||||
import mage.ApprovingObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.effects.common.GainLifeEffect;
|
||||
import mage.abilities.effects.common.combat.CantAttackTargetEffect;
|
||||
import mage.abilities.effects.keyword.ScryEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.command.Dungeon;
|
||||
import mage.game.command.DungeonRoom;
|
||||
import mage.game.permanent.token.SkeletonToken2;
|
||||
import mage.game.permanent.token.TreasureToken;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInHand;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class DungeonOfTheMadMage extends Dungeon {
|
||||
|
||||
public DungeonOfTheMadMage() {
|
||||
super("Dungeon of the Mad Mage", "AFR");
|
||||
// (1) Yawning Portal — You gain 1 life. (→ 2)
|
||||
DungeonRoom yawningPortal = new DungeonRoom("Yawning Portal", new GainLifeEffect(1));
|
||||
|
||||
// (2) Dungeon Level — Scry 1. (→ 3a or 3b)
|
||||
DungeonRoom dungeonLevel = new DungeonRoom(
|
||||
"Dungeon Level", new ScryEffect(1, false)
|
||||
);
|
||||
|
||||
// (3a) Goblin Bazaar — Create a Treasure token. (→ 4)
|
||||
DungeonRoom goblinBazaar = new DungeonRoom("Goblin Bazaar", new CreateTokenEffect(new TreasureToken()));
|
||||
|
||||
// (3b) Twisted Caverns — Target creature can't attack until your next turn. (→ 4)
|
||||
DungeonRoom twistedCaverns = new DungeonRoom(
|
||||
"Twisted Caverns", new CantAttackTargetEffect(Duration.UntilYourNextTurn)
|
||||
);
|
||||
twistedCaverns.addTarget(new TargetCreaturePermanent());
|
||||
|
||||
// (4) Lost Level — Scry 2. (→ 5a or 5b)
|
||||
DungeonRoom lostLevel = new DungeonRoom("Lost Level", new ScryEffect(2, false));
|
||||
|
||||
// (5a) Runestone Caverns — Exile the top two cards of your library. You may play them. (→ 6)
|
||||
DungeonRoom runestoneCaverns = new DungeonRoom("Runestone Caverns", new RunestoneCavernsEffect());
|
||||
|
||||
// (5b) Muiral's Graveyard — Create two 1/1 black Skeleton creature tokens. (→ 6)
|
||||
DungeonRoom muiralsGraveyard = new DungeonRoom(
|
||||
"Muiral's Graveyard", new CreateTokenEffect(new SkeletonToken2(), 2)
|
||||
);
|
||||
|
||||
// (6) Deep Mines — Scry 3. (→ 7)
|
||||
DungeonRoom deepMines = new DungeonRoom("Deep Mines", new ScryEffect(3, false));
|
||||
|
||||
// (7) Mad Wizard's Lair — Draw three cards and reveal them. You may cast one of them without paying its mana cost.
|
||||
DungeonRoom madWizardsLair = new DungeonRoom("Mad Wizard's Lair", new MadWizardsLairEffect());
|
||||
|
||||
yawningPortal.addNextRoom(dungeonLevel);
|
||||
dungeonLevel.addNextRoom(goblinBazaar);
|
||||
dungeonLevel.addNextRoom(twistedCaverns);
|
||||
goblinBazaar.addNextRoom(lostLevel);
|
||||
twistedCaverns.addNextRoom(lostLevel);
|
||||
lostLevel.addNextRoom(runestoneCaverns);
|
||||
lostLevel.addNextRoom(muiralsGraveyard);
|
||||
runestoneCaverns.addNextRoom(deepMines);
|
||||
muiralsGraveyard.addNextRoom(deepMines);
|
||||
deepMines.addNextRoom(madWizardsLair);
|
||||
|
||||
this.addRoom(yawningPortal);
|
||||
this.addRoom(dungeonLevel);
|
||||
this.addRoom(goblinBazaar);
|
||||
this.addRoom(twistedCaverns);
|
||||
this.addRoom(lostLevel);
|
||||
this.addRoom(runestoneCaverns);
|
||||
this.addRoom(muiralsGraveyard);
|
||||
this.addRoom(deepMines);
|
||||
this.addRoom(madWizardsLair);
|
||||
}
|
||||
|
||||
private DungeonOfTheMadMage(final DungeonOfTheMadMage dungeon) {
|
||||
super(dungeon);
|
||||
}
|
||||
|
||||
public DungeonOfTheMadMage copy() {
|
||||
return new DungeonOfTheMadMage(this);
|
||||
}
|
||||
}
|
||||
|
||||
class RunestoneCavernsEffect extends OneShotEffect {
|
||||
|
||||
RunestoneCavernsEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "exile the top two cards of your library. You may play them";
|
||||
}
|
||||
|
||||
private RunestoneCavernsEffect(final RunestoneCavernsEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RunestoneCavernsEffect copy() {
|
||||
return new RunestoneCavernsEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 2));
|
||||
if (cards.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
player.moveCards(cards, Zone.EXILED, source, game);
|
||||
while (!cards.isEmpty()) {
|
||||
for (Card card : cards.getCards(game)) {
|
||||
if (!player.chooseUse(Outcome.PlayForFree, "Play " + card.getName() + "?", source, game)) {
|
||||
continue;
|
||||
}
|
||||
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE);
|
||||
player.cast(
|
||||
player.chooseAbilityForCast(card, game, false),
|
||||
game, false, new ApprovingObject(source, game)
|
||||
);
|
||||
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
|
||||
}
|
||||
cards.retainZone(Zone.EXILED, game);
|
||||
if (cards.isEmpty() || !player.chooseUse(
|
||||
Outcome.PlayForFree, "Continue playing the exiled cards?", source, game
|
||||
)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class MadWizardsLairEffect extends OneShotEffect {
|
||||
|
||||
MadWizardsLairEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "draw three cards and reveal them. You may cast one of them without paying its mana cost";
|
||||
}
|
||||
|
||||
private MadWizardsLairEffect(final MadWizardsLairEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MadWizardsLairEffect copy() {
|
||||
return new MadWizardsLairEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 3));
|
||||
if (player.drawCards(3, source, game) != cards.size()) {
|
||||
return true;
|
||||
}
|
||||
player.revealCards(source, cards, game);
|
||||
TargetCardInHand target = new TargetCardInHand(0, 1, StaticFilters.FILTER_CARD_NON_LAND);
|
||||
player.choose(Outcome.PlayForFree, cards, target, game);
|
||||
Card card = player.getHand().get(target.getFirstTarget(), game);
|
||||
if (card == null) {
|
||||
return true;
|
||||
}
|
||||
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE);
|
||||
player.cast(
|
||||
player.chooseAbilityForCast(card, game, true),
|
||||
game, true, new ApprovingObject(source, game)
|
||||
);
|
||||
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
package mage.game.command.dungeons;
|
||||
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.GainLifeEffect;
|
||||
import mage.abilities.effects.common.LoseLifeOpponentsEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostTargetEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
|
||||
import mage.abilities.effects.keyword.ScryEffect;
|
||||
import mage.constants.Duration;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.command.Dungeon;
|
||||
import mage.game.command.DungeonRoom;
|
||||
import mage.game.permanent.token.GoblinToken;
|
||||
import mage.game.permanent.token.TreasureToken;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class LostMineOfPhandelver extends Dungeon {
|
||||
|
||||
public LostMineOfPhandelver() {
|
||||
super("Lost Mine of Phandelver", "AFR");
|
||||
// (1) Cave Entrance — Scry 1. (→ 2a or 2b)
|
||||
DungeonRoom caveEntrance = new DungeonRoom(
|
||||
"Cave Entrance", new ScryEffect(1, false)
|
||||
);
|
||||
|
||||
// (2a) Goblin Lair — Create a 1/1 red Goblin creature token. (→ 3a or 3b)
|
||||
DungeonRoom goblinLair = new DungeonRoom("Goblin Lair", new CreateTokenEffect(new GoblinToken()));
|
||||
|
||||
// (2b) Mine Tunnels — Create a Treasure token. (→ 3b or 3c)
|
||||
DungeonRoom mineTunnels = new DungeonRoom("Mine Tunnels", new CreateTokenEffect(new TreasureToken()));
|
||||
|
||||
// (3a) Storeroom — Put a +1/+1 counter on target creature. (→ 4)
|
||||
DungeonRoom storeroom = new DungeonRoom(
|
||||
"Storeroom", new AddCountersTargetEffect(CounterType.P1P1.createInstance())
|
||||
);
|
||||
storeroom.addTarget(new TargetCreaturePermanent());
|
||||
|
||||
// (3b) Dark Pool — Each opponent loses 1 life and you gain 1 life. (→ 4)
|
||||
DungeonRoom darkPool = new DungeonRoom(
|
||||
"Dark Pool", new LoseLifeOpponentsEffect(1),
|
||||
new GainLifeEffect(1).concatBy("and")
|
||||
);
|
||||
|
||||
// (3c) Fungi Cavern — Target creature gets -4/-0 until your next turn. (→ 4)
|
||||
DungeonRoom fungiCavern = new DungeonRoom(
|
||||
"Fungi Cavern", new BoostTargetEffect(-4, 0, Duration.UntilYourNextTurn)
|
||||
);
|
||||
fungiCavern.addTarget(new TargetCreaturePermanent());
|
||||
|
||||
// (4) Temple of Dumathoin — Draw a card.
|
||||
DungeonRoom templeOfDumathoin = new DungeonRoom(
|
||||
"Temple of Dumathoin", new DrawCardSourceControllerEffect(1)
|
||||
);
|
||||
|
||||
caveEntrance.addNextRoom(goblinLair);
|
||||
caveEntrance.addNextRoom(mineTunnels);
|
||||
goblinLair.addNextRoom(storeroom);
|
||||
goblinLair.addNextRoom(darkPool);
|
||||
mineTunnels.addNextRoom(darkPool);
|
||||
mineTunnels.addNextRoom(fungiCavern);
|
||||
storeroom.addNextRoom(templeOfDumathoin);
|
||||
darkPool.addNextRoom(templeOfDumathoin);
|
||||
fungiCavern.addNextRoom(templeOfDumathoin);
|
||||
|
||||
this.addRoom(caveEntrance);
|
||||
this.addRoom(goblinLair);
|
||||
this.addRoom(mineTunnels);
|
||||
this.addRoom(storeroom);
|
||||
this.addRoom(darkPool);
|
||||
this.addRoom(fungiCavern);
|
||||
this.addRoom(templeOfDumathoin);
|
||||
}
|
||||
|
||||
private LostMineOfPhandelver(final LostMineOfPhandelver dungeon) {
|
||||
super(dungeon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LostMineOfPhandelver copy() {
|
||||
return new LostMineOfPhandelver(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,266 @@
|
|||
package mage.game.command.dungeons;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.common.CardTypeAssignment;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.effects.common.LoseLifeAllPlayersEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.game.Game;
|
||||
import mage.game.command.Dungeon;
|
||||
import mage.game.command.DungeonRoom;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.TheAtropalToken;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetControlledPermanent;
|
||||
import mage.target.common.TargetDiscard;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class TombOfAnnihilation extends Dungeon {
|
||||
|
||||
static final FilterControlledPermanent filter
|
||||
= new FilterControlledPermanent("an artifact, a creature, or a land");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.or(
|
||||
CardType.ARTIFACT.getPredicate(),
|
||||
CardType.CREATURE.getPredicate(),
|
||||
CardType.LAND.getPredicate()
|
||||
));
|
||||
}
|
||||
|
||||
public TombOfAnnihilation() {
|
||||
super("Tomb of Annihilation", "AFR");
|
||||
// (1) Trapped Entry — Each player loses 1 life. (→ 2a or 2b)
|
||||
DungeonRoom trappedEntry = new DungeonRoom("Trapped Entry", new LoseLifeAllPlayersEffect(1));
|
||||
|
||||
// (2a) Veils of Fear — Each player loses 2 life unless they discard a card. (→ 3)
|
||||
DungeonRoom veilsOfFear = new DungeonRoom("Veils of Fear", new VeilsOfFearEffect());
|
||||
|
||||
// (2b) Oubliette — Discard a card and sacrifice an artifact, a creature, and a land. (→ 4)
|
||||
DungeonRoom oubliette = new DungeonRoom("Oubliette", new OublietteEffect());
|
||||
|
||||
// (3) Sandfall Cell — Each player loses 2 life unless they sacrifice an artifact, a creature, or a land. (→ 4)
|
||||
DungeonRoom sandfallCell = new DungeonRoom("Sandfall Cell", new SandfallCellEffect());
|
||||
|
||||
// (4) Cradle of the Death God — Create The Atropal, a legendary 4/4 black God Horror creature token with deathtouch.
|
||||
DungeonRoom cradleOfTheDeathGod = new DungeonRoom("Cradle of the Death God", new CreateTokenEffect(new TheAtropalToken()));
|
||||
|
||||
trappedEntry.addNextRoom(veilsOfFear);
|
||||
trappedEntry.addNextRoom(oubliette);
|
||||
veilsOfFear.addNextRoom(sandfallCell);
|
||||
oubliette.addNextRoom(sandfallCell);
|
||||
sandfallCell.addNextRoom(cradleOfTheDeathGod);
|
||||
|
||||
this.addRoom(trappedEntry);
|
||||
this.addRoom(veilsOfFear);
|
||||
this.addRoom(oubliette);
|
||||
this.addRoom(sandfallCell);
|
||||
this.addRoom(cradleOfTheDeathGod);
|
||||
}
|
||||
|
||||
private TombOfAnnihilation(final TombOfAnnihilation dungeon) {
|
||||
super(dungeon);
|
||||
}
|
||||
|
||||
public TombOfAnnihilation copy() {
|
||||
return new TombOfAnnihilation(this);
|
||||
}
|
||||
}
|
||||
|
||||
class VeilsOfFearEffect extends OneShotEffect {
|
||||
|
||||
VeilsOfFearEffect() {
|
||||
super(Outcome.Neutral);
|
||||
staticText = "each player loses 2 life unless they discard a card";
|
||||
}
|
||||
|
||||
private VeilsOfFearEffect(final VeilsOfFearEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VeilsOfFearEffect copy() {
|
||||
return new VeilsOfFearEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Map<UUID, Card> map = new HashMap<>();
|
||||
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player == null) {
|
||||
continue;
|
||||
}
|
||||
TargetDiscard target = new TargetDiscard(0, 1, StaticFilters.FILTER_CARD, playerId);
|
||||
player.choose(Outcome.PreventDamage, target, source.getSourceId(), game);
|
||||
map.put(playerId, game.getCard(target.getFirstTarget()));
|
||||
}
|
||||
for (Map.Entry<UUID, Card> entry : map.entrySet()) {
|
||||
Player player = game.getPlayer(entry.getKey());
|
||||
if (player == null) {
|
||||
continue;
|
||||
}
|
||||
if (entry.getValue() != null) {
|
||||
player.discard(entry.getValue(), false, source, game);
|
||||
} else {
|
||||
player.loseLife(2, game, source, false);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class OublietteEffect extends OneShotEffect {
|
||||
|
||||
OublietteEffect() {
|
||||
super(Outcome.Sacrifice);
|
||||
staticText = "discard a card and sacrifice an artifact, a creature, and a land";
|
||||
}
|
||||
|
||||
private OublietteEffect(final OublietteEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OublietteEffect copy() {
|
||||
return new OublietteEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
player.discard(1, false, false, source, game);
|
||||
int saccable = OublietteTarget.checkTargetCount(source, game);
|
||||
if (saccable < 1) {
|
||||
return true;
|
||||
}
|
||||
OublietteTarget target = new OublietteTarget(Math.min(saccable, 3));
|
||||
player.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
|
||||
for (UUID targetId : target.getTargets()) {
|
||||
Permanent permanent = game.getPermanent(targetId);
|
||||
if (permanent != null) {
|
||||
permanent.sacrifice(source, game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class OublietteTarget extends TargetControlledPermanent {
|
||||
|
||||
private static final CardTypeAssignment cardTypeAssigner = new CardTypeAssignment(
|
||||
CardType.ARTIFACT,
|
||||
CardType.CREATURE,
|
||||
CardType.LAND
|
||||
);
|
||||
private static final FilterControlledPermanent filter = TombOfAnnihilation.filter.copy();
|
||||
|
||||
static {
|
||||
filter.setMessage("an artifact, a creature, and a land");
|
||||
}
|
||||
|
||||
OublietteTarget(int numTargets) {
|
||||
super(numTargets, numTargets, filter, true);
|
||||
}
|
||||
|
||||
private OublietteTarget(final OublietteTarget target) {
|
||||
super(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OublietteTarget copy() {
|
||||
return new OublietteTarget(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTarget(UUID playerId, UUID id, Ability ability, Game game) {
|
||||
if (!super.canTarget(playerId, id, ability, game)) {
|
||||
return false;
|
||||
}
|
||||
Permanent permanent = game.getPermanent(id);
|
||||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
if (this.getTargets().isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
Cards cards = new CardsImpl(this.getTargets());
|
||||
cards.add(permanent);
|
||||
return cardTypeAssigner.getRoleCount(cards, game) >= cards.size();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
|
||||
Set<UUID> possibleTargets = super.possibleTargets(sourceId, sourceControllerId, game);
|
||||
possibleTargets.removeIf(uuid -> !this.canTarget(sourceControllerId, uuid, null, game));
|
||||
return possibleTargets;
|
||||
}
|
||||
|
||||
static int checkTargetCount(Ability source, Game game) {
|
||||
List<Permanent> permanents = game
|
||||
.getBattlefield()
|
||||
.getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game);
|
||||
return cardTypeAssigner.getRoleCount(new CardsImpl(permanents), game);
|
||||
}
|
||||
}
|
||||
|
||||
class SandfallCellEffect extends OneShotEffect {
|
||||
|
||||
SandfallCellEffect() {
|
||||
super(Outcome.Neutral);
|
||||
staticText = "each player loses 2 life unless they sacrifice an artifact, a creature, or a land";
|
||||
}
|
||||
|
||||
private SandfallCellEffect(final SandfallCellEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SandfallCellEffect copy() {
|
||||
return new SandfallCellEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Map<UUID, Permanent> map = new HashMap<>();
|
||||
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player == null) {
|
||||
continue;
|
||||
}
|
||||
TargetPermanent target = new TargetPermanent(0, 1, TombOfAnnihilation.filter, true);
|
||||
player.choose(Outcome.PreventDamage, target, source.getSourceId(), game);
|
||||
map.put(playerId, game.getPermanent(target.getFirstTarget()));
|
||||
}
|
||||
for (Map.Entry<UUID, Permanent> entry : map.entrySet()) {
|
||||
Player player = game.getPlayer(entry.getKey());
|
||||
if (player == null) {
|
||||
continue;
|
||||
}
|
||||
if (entry.getValue() != null) {
|
||||
entry.getValue().sacrifice(source, game);
|
||||
} else {
|
||||
player.loseLife(2, game, source, false);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
package mage.game.command.emblems;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.continuous.BoostControlledEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
|
||||
import mage.abilities.hint.Hint;
|
||||
import mage.abilities.keyword.HasteAbility;
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
import mage.constants.Duration;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.command.Emblem;
|
||||
import mage.watchers.common.CompletedDungeonWatcher;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class EllywickTumblestrumEmblem extends Emblem {
|
||||
|
||||
// −7: You get an emblem with "Creatures you control have trample and haste and get +2/+2 for each differently named dungeon you've completed."
|
||||
public EllywickTumblestrumEmblem() {
|
||||
this.setName("Emblem Ellywick");
|
||||
this.setExpansionSetCodeForImage("AFR");
|
||||
Ability ability = new SimpleStaticAbility(new GainAbilityControlledEffect(
|
||||
TrampleAbility.getInstance(), Duration.EndOfGame,
|
||||
StaticFilters.FILTER_PERMANENT_CREATURES
|
||||
));
|
||||
ability.addEffect(new GainAbilityControlledEffect(
|
||||
HasteAbility.getInstance(), Duration.EndOfGame,
|
||||
StaticFilters.FILTER_PERMANENT_CREATURES
|
||||
).setText("and haste"));
|
||||
ability.addEffect(new BoostControlledEffect(
|
||||
EllywickTumblestrumEmblemValue.instance,
|
||||
EllywickTumblestrumEmblemValue.instance,
|
||||
Duration.EndOfGame
|
||||
).setText("and get +2/+2 for each differently named dungeon you've completed"));
|
||||
this.getAbilities().add(ability.addHint(EllywickTumblestrumEmblemHint.instance));
|
||||
}
|
||||
}
|
||||
|
||||
enum EllywickTumblestrumEmblemValue implements DynamicValue {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
return 2 * CompletedDungeonWatcher.getCompletedNames(sourceAbility.getControllerId(), game).size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EllywickTumblestrumEmblemValue copy() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
enum EllywickTumblestrumEmblemHint implements Hint {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public String getText(Game game, Ability ability) {
|
||||
Set<String> names = CompletedDungeonWatcher.getCompletedNames(ability.getControllerId(), game);
|
||||
if (names.isEmpty()) {
|
||||
return "No dungeons completed";
|
||||
}
|
||||
return "Completed dungeons: " + String.join(", ", names);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EllywickTumblestrumEmblemHint copy() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue