mirror of
https://github.com/correl/mage.git
synced 2024-11-28 11:09:54 +00:00
[MAT] Implement Tazri, Stalwart Survivor
This commit is contained in:
parent
4c13b42dee
commit
4e7e0b2a8d
4 changed files with 363 additions and 83 deletions
|
@ -113,85 +113,85 @@ class KatildaDawnhartPrimeManaEffect extends ManaEffect {
|
|||
|
||||
@Override
|
||||
public List<Mana> getNetMana(Game game, Ability source) {
|
||||
if (game == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
|
||||
if (permanent == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<Mana> netMana = new ArrayList<>();
|
||||
if (game != null) {
|
||||
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
|
||||
if (permanent != null) {
|
||||
ObjectColor color = permanent.getColor(game);
|
||||
if (color.isWhite()) {
|
||||
netMana.add(new Mana(ColoredManaSymbol.W));
|
||||
}
|
||||
if (color.isBlue()) {
|
||||
netMana.add(new Mana(ColoredManaSymbol.U));
|
||||
}
|
||||
if (color.isBlack()) {
|
||||
netMana.add(new Mana(ColoredManaSymbol.B));
|
||||
}
|
||||
if (color.isRed()) {
|
||||
netMana.add(new Mana(ColoredManaSymbol.R));
|
||||
}
|
||||
if (color.isGreen()) {
|
||||
netMana.add(new Mana(ColoredManaSymbol.G));
|
||||
}
|
||||
}
|
||||
ObjectColor color = permanent.getColor(game);
|
||||
if (color.isWhite()) {
|
||||
netMana.add(Mana.WhiteMana(1));
|
||||
}
|
||||
if (color.isBlue()) {
|
||||
netMana.add(Mana.BlueMana(1));
|
||||
}
|
||||
if (color.isBlack()) {
|
||||
netMana.add(Mana.BlackMana(1));
|
||||
}
|
||||
if (color.isRed()) {
|
||||
netMana.add(Mana.RedMana(1));
|
||||
}
|
||||
if (color.isGreen()) {
|
||||
netMana.add(Mana.GreenMana(1));
|
||||
}
|
||||
return netMana;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mana produceMana(Game game, Ability source) {
|
||||
Mana mana = new Mana();
|
||||
if (game != null) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
|
||||
if (controller != null && permanent != null) {
|
||||
Choice choice = new ChoiceImpl();
|
||||
choice.setMessage("Pick a mana color");
|
||||
ObjectColor color = permanent.getColor(game);
|
||||
if (color.isWhite()) {
|
||||
choice.getChoices().add("White");
|
||||
}
|
||||
if (color.isBlue()) {
|
||||
choice.getChoices().add("Blue");
|
||||
}
|
||||
if (color.isBlack()) {
|
||||
choice.getChoices().add("Black");
|
||||
}
|
||||
if (color.isRed()) {
|
||||
choice.getChoices().add("Red");
|
||||
}
|
||||
if (color.isGreen()) {
|
||||
choice.getChoices().add("Green");
|
||||
}
|
||||
if (!choice.getChoices().isEmpty()) {
|
||||
if (choice.getChoices().size() == 1) {
|
||||
choice.setChoice(choice.getChoices().iterator().next());
|
||||
} else {
|
||||
controller.choose(outcome, choice, game);
|
||||
}
|
||||
|
||||
if (choice.getChoice() != null) {
|
||||
switch (choice.getChoice()) {
|
||||
case "White":
|
||||
mana.setWhite(1);
|
||||
break;
|
||||
case "Blue":
|
||||
mana.setBlue(1);
|
||||
break;
|
||||
case "Black":
|
||||
mana.setBlack(1);
|
||||
break;
|
||||
case "Red":
|
||||
mana.setRed(1);
|
||||
break;
|
||||
case "Green":
|
||||
mana.setGreen(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (game == null) {
|
||||
return new Mana();
|
||||
}
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
|
||||
if (controller == null || permanent == null) {
|
||||
return new Mana();
|
||||
}
|
||||
Choice choice = new ChoiceImpl();
|
||||
choice.setMessage("Pick a mana color");
|
||||
ObjectColor color = permanent.getColor(game);
|
||||
if (color.isWhite()) {
|
||||
choice.getChoices().add("White");
|
||||
}
|
||||
if (color.isBlue()) {
|
||||
choice.getChoices().add("Blue");
|
||||
}
|
||||
if (color.isBlack()) {
|
||||
choice.getChoices().add("Black");
|
||||
}
|
||||
if (color.isRed()) {
|
||||
choice.getChoices().add("Red");
|
||||
}
|
||||
if (color.isGreen()) {
|
||||
choice.getChoices().add("Green");
|
||||
}
|
||||
if (choice.getChoices().isEmpty()) {
|
||||
return new Mana();
|
||||
}
|
||||
if (choice.getChoices().size() == 1) {
|
||||
choice.setChoice(choice.getChoices().iterator().next());
|
||||
} else {
|
||||
controller.choose(outcome, choice, game);
|
||||
}
|
||||
if (choice.getChoice() == null) {
|
||||
return new Mana();
|
||||
}
|
||||
switch (choice.getChoice()) {
|
||||
case "White":
|
||||
return Mana.WhiteMana(1);
|
||||
case "Blue":
|
||||
return Mana.BlueMana(1);
|
||||
case "Black":
|
||||
return Mana.BlackMana(1);
|
||||
case "Red":
|
||||
return Mana.RedMana(1);
|
||||
case "Green":
|
||||
return Mana.GreenMana(1);
|
||||
default:
|
||||
return new Mana();
|
||||
}
|
||||
return mana;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.s;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.ConditionalMana;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
|
@ -15,19 +13,19 @@ import mage.abilities.mana.builder.ConditionalManaBuilder;
|
|||
import mage.abilities.mana.conditional.ManaCondition;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.AbilityType;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hanasu
|
||||
*/
|
||||
public final class SoldeviMachinist extends CardImpl {
|
||||
|
||||
public SoldeviMachinist(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{U}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}");
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.WIZARD);
|
||||
this.subtype.add(SubType.ARTIFICER);
|
||||
|
@ -74,13 +72,15 @@ class ArtifactAbilityManaCondition extends ManaCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
if (source != null && source.getAbilityType() == AbilityType.ACTIVATED) {
|
||||
MageObject object = game.getObject(source);
|
||||
if (object != null && object.isArtifact(game)) {
|
||||
return true;
|
||||
}
|
||||
switch (source.getAbilityType()) {
|
||||
case ACTIVATED:
|
||||
case MANA:
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
MageObject object = game.getObject(source);
|
||||
return object != null && object.isArtifact(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
279
Mage.Sets/src/mage/cards/t/TazriStalwartSurvivor.java
Normal file
279
Mage.Sets/src/mage/cards/t/TazriStalwartSurvivor.java
Normal file
|
@ -0,0 +1,279 @@
|
|||
package mage.cards.t;
|
||||
|
||||
import mage.*;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
|
||||
import mage.abilities.effects.mana.ManaEffect;
|
||||
import mage.abilities.mana.ActivatedManaAbilityImpl;
|
||||
import mage.abilities.mana.conditional.ManaCondition;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.Cards;
|
||||
import mage.choices.Choice;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.constants.*;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class TazriStalwartSurvivor extends CardImpl {
|
||||
|
||||
public TazriStalwartSurvivor(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}");
|
||||
|
||||
this.addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.WARRIOR);
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(3);
|
||||
|
||||
// Each creature you control has "{T}: Add one mana of any of this creature's colors. Spend this mana only to activate an ability of a creature. Activate only if this creature has another activated ability."
|
||||
this.addAbility(new SimpleStaticAbility(new GainAbilityControlledEffect(
|
||||
new TazriStalwartSurvivorManaAbility(), Duration.WhileOnBattlefield,
|
||||
StaticFilters.FILTER_PERMANENT_CREATURE
|
||||
).setText("each creature you control has \"{T}: Add one mana of any of this creature's colors. " +
|
||||
"Spend this mana only to activate an ability of a creature. Activate only if " +
|
||||
"this creature has another activated ability.\"")));
|
||||
|
||||
// {W}{U}{B}{R}{G}, {T}: Mill five cards. Put all creature cards with activated abilities that aren't mana abilities from among the milled cards into your hand.
|
||||
Ability ability = new SimpleActivatedAbility(
|
||||
new TazriStalwartSurvivorMillEffect(), new ManaCostsImpl<>("{W}{U}{B}{R}{G}")
|
||||
);
|
||||
ability.addCost(new TapSourceCost());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
private TazriStalwartSurvivor(final TazriStalwartSurvivor card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TazriStalwartSurvivor copy() {
|
||||
return new TazriStalwartSurvivor(this);
|
||||
}
|
||||
}
|
||||
|
||||
class TazriStalwartSurvivorManaAbility extends ActivatedManaAbilityImpl {
|
||||
|
||||
private enum TazriStalwartSurvivorCondition implements Condition {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
|
||||
return permanent != null
|
||||
&& permanent
|
||||
.getAbilities(game)
|
||||
.stream()
|
||||
.filter(ability -> ability.getAbilityType() == AbilityType.ACTIVATED
|
||||
|| ability.getAbilityType() == AbilityType.MANA)
|
||||
.map(Ability::getOriginalId)
|
||||
.anyMatch(abilityId -> !source.getOriginalId().equals(abilityId));
|
||||
}
|
||||
}
|
||||
|
||||
TazriStalwartSurvivorManaAbility() {
|
||||
super(Zone.BATTLEFIELD, new TazriStalwartSurvivorManaEffect(), new TapSourceCost());
|
||||
this.condition = TazriStalwartSurvivorCondition.instance;
|
||||
}
|
||||
|
||||
private TazriStalwartSurvivorManaAbility(final TazriStalwartSurvivorManaAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TazriStalwartSurvivorManaAbility copy() {
|
||||
return new TazriStalwartSurvivorManaAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "{T}: Add one mana of any of this creature's colors. " +
|
||||
"Spend this mana only to activate an ability of a creature. " +
|
||||
"Activate only if this creature has another activated ability.";
|
||||
}
|
||||
}
|
||||
|
||||
class TazriStalwartSurvivorManaEffect extends ManaEffect {
|
||||
|
||||
private static final class TazriStalwartSurvivorConditionalMana extends ConditionalMana {
|
||||
|
||||
public TazriStalwartSurvivorConditionalMana(Mana mana) {
|
||||
super(mana);
|
||||
staticText = "Spend this mana only to activate abilities of creatures";
|
||||
addCondition(new TazriStalwartSurvivorManaCondition());
|
||||
}
|
||||
}
|
||||
|
||||
private static final class TazriStalwartSurvivorManaCondition extends ManaCondition implements Condition {
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
switch (source.getAbilityType()) {
|
||||
case ACTIVATED:
|
||||
case MANA:
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
MageObject object = game.getObject(source);
|
||||
return object != null && object.isCreature(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source, UUID originalId, Cost costsToPay) {
|
||||
return apply(game, source);
|
||||
}
|
||||
}
|
||||
|
||||
public TazriStalwartSurvivorManaEffect() {
|
||||
super();
|
||||
staticText = "Add one mana of any of this creature's colors. " +
|
||||
"Spend this mana only to activate an ability of a creature";
|
||||
}
|
||||
|
||||
private TazriStalwartSurvivorManaEffect(final TazriStalwartSurvivorManaEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TazriStalwartSurvivorManaEffect copy() {
|
||||
return new TazriStalwartSurvivorManaEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Mana> getNetMana(Game game, Ability source) {
|
||||
if (game == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
|
||||
if (permanent == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<Mana> netMana = new ArrayList<>();
|
||||
ObjectColor color = permanent.getColor(game);
|
||||
if (color.isWhite()) {
|
||||
netMana.add(new TazriStalwartSurvivorConditionalMana(Mana.WhiteMana(1)));
|
||||
}
|
||||
if (color.isBlue()) {
|
||||
netMana.add(new TazriStalwartSurvivorConditionalMana(Mana.BlueMana(1)));
|
||||
}
|
||||
if (color.isBlack()) {
|
||||
netMana.add(new TazriStalwartSurvivorConditionalMana(Mana.BlackMana(1)));
|
||||
}
|
||||
if (color.isRed()) {
|
||||
netMana.add(new TazriStalwartSurvivorConditionalMana(Mana.RedMana(1)));
|
||||
}
|
||||
if (color.isGreen()) {
|
||||
netMana.add(new TazriStalwartSurvivorConditionalMana(Mana.GreenMana(1)));
|
||||
}
|
||||
return netMana;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Mana produceMana(Game game, Ability source) {
|
||||
if (game == null) {
|
||||
return new Mana();
|
||||
}
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
|
||||
if (controller == null || permanent == null) {
|
||||
return new Mana();
|
||||
}
|
||||
Choice choice = new ChoiceImpl();
|
||||
choice.setMessage("Pick a mana color");
|
||||
ObjectColor color = permanent.getColor(game);
|
||||
if (color.isWhite()) {
|
||||
choice.getChoices().add("White");
|
||||
}
|
||||
if (color.isBlue()) {
|
||||
choice.getChoices().add("Blue");
|
||||
}
|
||||
if (color.isBlack()) {
|
||||
choice.getChoices().add("Black");
|
||||
}
|
||||
if (color.isRed()) {
|
||||
choice.getChoices().add("Red");
|
||||
}
|
||||
if (color.isGreen()) {
|
||||
choice.getChoices().add("Green");
|
||||
}
|
||||
if (choice.getChoices().isEmpty()) {
|
||||
return new Mana();
|
||||
}
|
||||
if (choice.getChoices().size() == 1) {
|
||||
choice.setChoice(choice.getChoices().iterator().next());
|
||||
} else {
|
||||
controller.choose(outcome, choice, game);
|
||||
}
|
||||
if (choice.getChoice() == null) {
|
||||
return new Mana();
|
||||
}
|
||||
switch (choice.getChoice()) {
|
||||
case "White":
|
||||
return new TazriStalwartSurvivorConditionalMana(Mana.WhiteMana(1));
|
||||
case "Blue":
|
||||
return new TazriStalwartSurvivorConditionalMana(Mana.BlueMana(1));
|
||||
case "Black":
|
||||
return new TazriStalwartSurvivorConditionalMana(Mana.BlackMana(1));
|
||||
case "Red":
|
||||
return new TazriStalwartSurvivorConditionalMana(Mana.RedMana(1));
|
||||
case "Green":
|
||||
return new TazriStalwartSurvivorConditionalMana(Mana.GreenMana(1));
|
||||
default:
|
||||
return new Mana();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class TazriStalwartSurvivorMillEffect extends OneShotEffect {
|
||||
|
||||
TazriStalwartSurvivorMillEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "mill five cards. Put all creature cards with activated abilities " +
|
||||
"that aren't mana abilities from among the milled cards into your hand";
|
||||
}
|
||||
|
||||
private TazriStalwartSurvivorMillEffect(final TazriStalwartSurvivorMillEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TazriStalwartSurvivorMillEffect copy() {
|
||||
return new TazriStalwartSurvivorMillEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
Cards cards = player.millCards(5, source, game);
|
||||
cards.removeIf(uuid -> !game.getCard(uuid).isCreature(game));
|
||||
cards.removeIf(uuid -> game
|
||||
.getCard(uuid)
|
||||
.getAbilities(game)
|
||||
.stream()
|
||||
.map(Ability::getAbilityType)
|
||||
.noneMatch(AbilityType.ACTIVATED::equals));
|
||||
player.moveCards(cards, Zone.HAND, source, game);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -59,6 +59,7 @@ public final class MarchOfTheMachineTheAftermath extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Sarkhan, Soul Aflame", 46, Rarity.MYTHIC, mage.cards.s.SarkhanSoulAflame.class));
|
||||
cards.add(new SetCardInfo("Sigarda, Font of Blessings", 47, Rarity.RARE, mage.cards.s.SigardaFontOfBlessings.class));
|
||||
cards.add(new SetCardInfo("Spark Rupture", 5, Rarity.RARE, mage.cards.s.SparkRupture.class));
|
||||
cards.add(new SetCardInfo("Tazri, Stalwart Survivor", 6, Rarity.RARE, mage.cards.t.TazriStalwartSurvivor.class));
|
||||
cards.add(new SetCardInfo("The Kenriths' Royal Funeral", 34, Rarity.RARE, mage.cards.t.TheKenrithsRoyalFuneral.class));
|
||||
cards.add(new SetCardInfo("Tolarian Contempt", 8, Rarity.UNCOMMON, mage.cards.t.TolarianContempt.class));
|
||||
cards.add(new SetCardInfo("Training Grounds", 9, Rarity.RARE, mage.cards.t.TrainingGrounds.class));
|
||||
|
|
Loading…
Reference in a new issue