[CMR] Implemented War Room

This commit is contained in:
Evan Kranzler 2020-10-30 20:16:15 -04:00
parent b3d8d4e079
commit 1c2861671f
2 changed files with 100 additions and 0 deletions

View file

@ -0,0 +1,99 @@
package mage.cards.w;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.PayLifeCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.mana.ColorlessManaAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.FilterMana;
import mage.game.Game;
import mage.players.Player;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class WarRoom extends CardImpl {
public WarRoom(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
// {T}: Add {C}.
this.addAbility(new ColorlessManaAbility());
// {3}, {T}, Pay life equal to the number of colors in your commanders' color identity: Draw a card.
Ability ability = new SimpleActivatedAbility(
new DrawCardSourceControllerEffect(1), new GenericManaCost(3)
);
ability.addCost(new TapSourceCost());
ability.addCost(new PayLifeCost(
WarRoomValue.instance, "life equal to the number of colors in your commanders' color identity"
));
this.addAbility(ability);
}
private WarRoom(final WarRoom card) {
super(card);
}
@Override
public WarRoom copy() {
return new WarRoom(this);
}
}
enum WarRoomValue implements DynamicValue {
instance;
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
Player controller = game.getPlayer(sourceAbility.getControllerId());
if (controller == null) {
return 0;
}
ObjectColor color = new ObjectColor();
for (UUID commanderId : game.getCommandersIds(controller)) {
Card commander = game.getCard(commanderId);
if (commander == null) {
continue;
}
FilterMana commanderMana = commander.getColorIdentity();
if (commanderMana.isWhite()) {
color.setWhite(true);
}
if (commanderMana.isBlue()) {
color.setBlue(true);
}
if (commanderMana.isBlack()) {
color.setBlack(true);
}
if (commanderMana.isRed()) {
color.setRed(true);
}
if (commanderMana.isGreen()) {
color.setGreen(true);
}
}
return color.getColorCount();
}
@Override
public WarRoomValue copy() {
return instance;
}
@Override
public String getMessage() {
return "";
}
}

View file

@ -155,6 +155,7 @@ public final class CommanderLegends extends ExpansionSet {
cards.add(new SetCardInfo("Vault of Champions", 360, Rarity.RARE, mage.cards.v.VaultOfChampions.class));
cards.add(new SetCardInfo("Vial Smasher the Fierce", 540, Rarity.MYTHIC, mage.cards.v.VialSmasherTheFierce.class));
cards.add(new SetCardInfo("Vow of Torment", 159, Rarity.UNCOMMON, mage.cards.v.VowOfTorment.class));
cards.add(new SetCardInfo("War Room", 361, Rarity.RARE, mage.cards.w.WarRoom.class));
cards.add(new SetCardInfo("Warden of Evos Isle", 106, Rarity.UNCOMMON, mage.cards.w.WardenOfEvosIsle.class));
cards.add(new SetCardInfo("Xenagos, God of Revels", 541, Rarity.MYTHIC, mage.cards.x.XenagosGodOfRevels.class));
cards.add(new SetCardInfo("Zur the Enchanter", 544, Rarity.MYTHIC, mage.cards.z.ZurTheEnchanter.class));