mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 05:22:02 -08:00
Implemented Outlaws' Merriment
This commit is contained in:
parent
a99afc763d
commit
b245b493b8
7 changed files with 193 additions and 4 deletions
|
|
@ -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(" —<br>");
|
||||
sb.append(". You may choose the same mode more than once.");
|
||||
} else if (chooseText == null) {
|
||||
sb.append(" —");
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue