Implemented Outlaws' Merriment

This commit is contained in:
Evan Kranzler 2019-09-24 21:41:02 -04:00
parent a99afc763d
commit b245b493b8
7 changed files with 193 additions and 4 deletions

View file

@ -0,0 +1,55 @@
package mage.cards.o;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.TargetController;
import mage.game.permanent.token.OutlawsMerrimentClericToken;
import mage.game.permanent.token.OutlawsMerrimentRogueToken;
import mage.game.permanent.token.OutlawsMerrimentWarriorToken;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class OutlawsMerriment extends CardImpl {
public OutlawsMerriment(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}{W}{W}");
// At the beginning of your upkeep, choose one at random. Create a red and white creature token with those characteristics.
// 3/1 Human Warrior with trample and haste.
Ability ability = new BeginningOfUpkeepTriggeredAbility(
new CreateTokenEffect(new OutlawsMerrimentWarriorToken())
.setText("3/1 Human Warrior with trample and haste"),
TargetController.YOU, false
);
// 2/1 Human Cleric with lifelink and haste.
ability.addMode(new Mode(new CreateTokenEffect(new OutlawsMerrimentClericToken())
.setText("2/1 Human Cleric with lifelink and haste")));
// 1/2 Human Rogue with haste and "When this creature enters the battlefield, it deals 1 damage to any target."
ability.addMode(new Mode(new CreateTokenEffect(new OutlawsMerrimentRogueToken())
.setText("1/2 Human Rogue with haste and \"When this creature enters the battlefield, it deals 1 damage to any target.\"")));
ability.getModes().setChooseText("choose one at random. Create a red and white creature token with those characteristics.");
ability.getModes().setRandom(true);
this.addAbility(ability);
}
private OutlawsMerriment(final OutlawsMerriment card) {
super(card);
}
@Override
public OutlawsMerriment copy() {
return new OutlawsMerriment(this);
}
}

View file

@ -206,6 +206,7 @@ public final class ThroneOfEldraine extends ExpansionSet {
cards.add(new SetCardInfo("Opt", 59, Rarity.COMMON, mage.cards.o.Opt.class));
cards.add(new SetCardInfo("Order of Midnight", 99, Rarity.UNCOMMON, mage.cards.o.OrderOfMidnight.class));
cards.add(new SetCardInfo("Outflank", 23, Rarity.COMMON, mage.cards.o.Outflank.class));
cards.add(new SetCardInfo("Outlaws' Merriment", 198, Rarity.MYTHIC, mage.cards.o.OutlawsMerriment.class));
cards.add(new SetCardInfo("Outmuscle", 170, Rarity.COMMON, mage.cards.o.Outmuscle.class));
cards.add(new SetCardInfo("Overwhelmed Apprentice", 60, Rarity.UNCOMMON, mage.cards.o.OverwhelmedApprentice.class));
cards.add(new SetCardInfo("Piper of the Swarm", 100, Rarity.RARE, mage.cards.p.PiperOfTheSwarm.class));

View file

@ -78,6 +78,7 @@ public final class ThroneOfEldraineCollectorsEdition extends ExpansionSet {
cards.add(new SetCardInfo("Once Upon a Time", 371, Rarity.RARE, mage.cards.o.OnceUponATime.class));
cards.add(new SetCardInfo("Opportunistic Dragon", 364, Rarity.RARE, mage.cards.o.OpportunisticDragon.class));
cards.add(new SetCardInfo("Order of Midnight", 288, Rarity.UNCOMMON, mage.cards.o.OrderOfMidnight.class));
cards.add(new SetCardInfo("Outlaws' Merriment", 382, Rarity.MYTHIC, mage.cards.o.OutlawsMerriment.class));
cards.add(new SetCardInfo("Piper of the Swarm", 355, Rarity.RARE, mage.cards.p.PiperOfTheSwarm.class));
cards.add(new SetCardInfo("Queen of Ice", 285, Rarity.COMMON, mage.cards.q.QueenOfIce.class));
cards.add(new SetCardInfo("Questing Beast", 372, Rarity.MYTHIC, mage.cards.q.QuestingBeast.class));

View file

@ -9,6 +9,7 @@ import mage.filter.FilterPlayer;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetOpponent;
import mage.util.RandomUtil;
import java.util.*;
@ -27,6 +28,8 @@ public class Modes extends LinkedHashMap<UUID, Mode> {
private final Map<UUID, Mode> duplicateModes = new LinkedHashMap<>();
private OptionalAdditionalModeSourceCosts optionalAdditionalModeSourceCosts = null; // only set if costs have to be paid
private Filter maxModesFilter = null; // calculates the max number of available modes
private boolean isRandom = false;
private String chooseText = null;
public Modes() {
this.currentMode = new Mode();
@ -56,6 +59,8 @@ public class Modes extends LinkedHashMap<UUID, Mode> {
this.optionalAdditionalModeSourceCosts = modes.optionalAdditionalModeSourceCosts;
this.maxModesFilter = modes.maxModesFilter; // can't change so no copy needed
this.isRandom = modes.isRandom;
this.chooseText = modes.chooseText;
if (modes.getSelectedModes().isEmpty()) {
this.currentMode = values().iterator().next();
} else {
@ -163,6 +168,12 @@ public class Modes extends LinkedHashMap<UUID, Mode> {
if (this.size() > 1) {
this.selectedModes.clear();
this.duplicateModes.clear();
if (this.isRandom) {
List<Mode> modes = getAvailableModes(source, game);
int r = RandomUtil.nextInt(modes.size());
this.addSelectedMode(modes.get(r).getId());
return true;
}
// check if mode modifying abilities exist
Card card = game.getCard(source.getSourceId());
if (card != null) {
@ -332,7 +343,9 @@ public class Modes extends LinkedHashMap<UUID, Mode> {
return this.getMode().getEffects().getText(this.getMode());
}
StringBuilder sb = new StringBuilder();
if (this.getMaxModesFilter() != null) {
if (this.chooseText != null) {
sb.append(chooseText);
} else if (this.getMaxModesFilter() != null) {
sb.append("choose one or more. Each mode must target ").append(getMaxModesFilter().getMessage());
} else if (this.getMinModes() == 0 && this.getMaxModes() == 1) {
sb.append("choose up to one");
@ -357,11 +370,13 @@ public class Modes extends LinkedHashMap<UUID, Mode> {
}
if (isEachModeMoreThanOnce()) {
sb.append(". You may choose the same mode more than once.<br>");
} else {
sb.append(" &mdash;<br>");
sb.append(". You may choose the same mode more than once.");
} else if (chooseText == null) {
sb.append(" &mdash;");
}
sb.append("<br>");
for (Mode mode : this.values()) {
sb.append("&bull ");
sb.append(mode.getEffects().getTextStartingUpperCase(mode));
@ -401,4 +416,11 @@ public class Modes extends LinkedHashMap<UUID, Mode> {
this.optionalAdditionalModeSourceCosts = optionalAdditionalModeSourceCosts;
}
public void setRandom(boolean isRandom) {
this.isRandom = isRandom;
}
public void setChooseText(String chooseText) {
this.chooseText = chooseText;
}
}

View file

@ -0,0 +1,35 @@
package mage.game.permanent.token;
import mage.MageInt;
import mage.abilities.keyword.HasteAbility;
import mage.abilities.keyword.LifelinkAbility;
import mage.constants.CardType;
import mage.constants.SubType;
/**
* @author TheElk801
*/
public final class OutlawsMerrimentClericToken extends TokenImpl {
public OutlawsMerrimentClericToken() {
super("Human Cleric", "2/1 Human Cleric with lifelink and haste");
cardType.add(CardType.CREATURE);
subtype.add(SubType.HUMAN);
subtype.add(SubType.CLERIC);
color.setWhite(true);
color.setRed(true);
power = new MageInt(2);
toughness = new MageInt(1);
this.addAbility(LifelinkAbility.getInstance());
this.addAbility(HasteAbility.getInstance());
}
private OutlawsMerrimentClericToken(final OutlawsMerrimentClericToken token) {
super(token);
}
public OutlawsMerrimentClericToken copy() {
return new OutlawsMerrimentClericToken(this);
}
}

View file

@ -0,0 +1,40 @@
package mage.game.permanent.token;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.keyword.HasteAbility;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.target.common.TargetAnyTarget;
/**
* @author TheElk801
*/
public final class OutlawsMerrimentRogueToken extends TokenImpl {
public OutlawsMerrimentRogueToken() {
super("Human Rogue", "1/2 Human Rogue with haste and \"When this creature enters the battlefield, it deals 1 damage to any target.\"");
cardType.add(CardType.CREATURE);
subtype.add(SubType.HUMAN);
subtype.add(SubType.ROGUE);
color.setWhite(true);
color.setRed(true);
power = new MageInt(1);
toughness = new MageInt(2);
this.addAbility(HasteAbility.getInstance());
Ability ability = new EntersBattlefieldTriggeredAbility(new DamageTargetEffect(1, "it"));
ability.addTarget(new TargetAnyTarget());
this.addAbility(ability);
}
private OutlawsMerrimentRogueToken(final OutlawsMerrimentRogueToken token) {
super(token);
}
public OutlawsMerrimentRogueToken copy() {
return new OutlawsMerrimentRogueToken(this);
}
}

View file

@ -0,0 +1,35 @@
package mage.game.permanent.token;
import mage.MageInt;
import mage.abilities.keyword.HasteAbility;
import mage.abilities.keyword.TrampleAbility;
import mage.constants.CardType;
import mage.constants.SubType;
/**
* @author TheElk801
*/
public final class OutlawsMerrimentWarriorToken extends TokenImpl {
public OutlawsMerrimentWarriorToken() {
super("Human Warrior", "3/1 Human Warrior with trample and haste");
cardType.add(CardType.CREATURE);
subtype.add(SubType.HUMAN);
subtype.add(SubType.WARRIOR);
color.setWhite(true);
color.setRed(true);
power = new MageInt(3);
toughness = new MageInt(1);
this.addAbility(TrampleAbility.getInstance());
this.addAbility(HasteAbility.getInstance());
}
private OutlawsMerrimentWarriorToken(final OutlawsMerrimentWarriorToken token) {
super(token);
}
public OutlawsMerrimentWarriorToken copy() {
return new OutlawsMerrimentWarriorToken(this);
}
}