forked from External/mage
Refactor: improved emblem rules generation;
This commit is contained in:
parent
e1630b3c6f
commit
a4e374f96a
11 changed files with 63 additions and 91 deletions
|
|
@ -1,8 +1,5 @@
|
|||
|
||||
package mage.cards.a;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.LoyaltyAbility;
|
||||
import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility;
|
||||
|
|
@ -27,8 +24,10 @@ import mage.players.Player;
|
|||
import mage.target.TargetPlayer;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Styxo
|
||||
*/
|
||||
public final class AurraSingBaneOfJedi extends CardImpl {
|
||||
|
|
@ -39,17 +38,17 @@ public final class AurraSingBaneOfJedi extends CardImpl {
|
|||
|
||||
this.addAbility(new PlaneswalkerEntersWithLoyaltyCountersAbility(3));
|
||||
|
||||
// +1:You may have {this} deal 2 damage to target creature. If you don't, {this} deals 1 damage to you.
|
||||
// +1: You may have {this} deal 2 damage to target creature. If you don't, {this} deals 1 damage to you.
|
||||
Ability ability = new LoyaltyAbility(new AurraSingBaneOfJediEffect(), +1);
|
||||
ability.addTarget(new TargetCreaturePermanent());
|
||||
this.addAbility(ability);
|
||||
|
||||
// -4:Target player gets an emblem wiht "Whenever a nontoken creature you control leave the battlefied, discard a card.".
|
||||
// -4: Target player gets an emblem wiht "Whenever a nontoken creature you control leave the battlefied, discard a card.".
|
||||
ability = new LoyaltyAbility(new GetEmblemTargetPlayerEffect(new AurraSingBaneOfJediEmblem()), -4);
|
||||
ability.addTarget(new TargetPlayer());
|
||||
this.addAbility(ability);
|
||||
|
||||
// -6:Each player discards their hand and sacrificies all creatures he or she controls. Each player's life total becomes 1."
|
||||
// -6: Each player discards their hand and sacrificies all creatures he or she controls. Each player's life total becomes 1."
|
||||
ability = new LoyaltyAbility(new DiscardHandAllEffect(), -6);
|
||||
ability.addEffect(new SacrificeAllEffect());
|
||||
Effect effect = new SetPlayerLifeAllEffect(1, TargetController.ANY);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.g;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.LoyaltyAbility;
|
||||
import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility;
|
||||
|
|
@ -12,7 +10,10 @@ import mage.abilities.effects.common.DestroyTargetEffect;
|
|||
import mage.abilities.effects.common.GetEmblemTargetPlayerEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.filter.predicate.permanent.AnotherPredicate;
|
||||
|
|
@ -25,8 +26,9 @@ import mage.target.TargetPermanent;
|
|||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class GarrukApexPredator extends CardImpl {
|
||||
|
|
@ -62,7 +64,6 @@ public final class GarrukApexPredator extends CardImpl {
|
|||
|
||||
// -8: Target opponent gets an emblem with "Whenever a creature attacks you, it gets +5/+5 and gains trample until end of turn."
|
||||
Effect effect = new GetEmblemTargetPlayerEffect(new GarrukApexPredatorEmblem());
|
||||
effect.setText("Target opponent gets an emblem with \"Whenever a creature attacks you, it gets +5/+5 and gains trample until end of turn.\"");
|
||||
ability = new LoyaltyAbility(effect, -8);
|
||||
ability.addTarget(new TargetOpponent());
|
||||
this.addAbility(ability);
|
||||
|
|
|
|||
|
|
@ -1,22 +1,16 @@
|
|||
|
||||
package mage.cards.r;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
|
||||
import mage.abilities.common.SpellCastControllerTriggeredAbility;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.CopyTargetSpellEffect;
|
||||
import mage.abilities.effects.common.DoIfCostPaid;
|
||||
import mage.abilities.effects.common.CreateTokenCopyTargetEffect;
|
||||
import mage.abilities.effects.common.DoIfCostPaid;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.constants.SuperType;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
|
|
@ -24,8 +18,9 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
|
|||
import mage.filter.predicate.permanent.AnotherPredicate;
|
||||
import mage.filter.predicate.permanent.TokenPredicate;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class RikuOfTwoReflections extends CardImpl {
|
||||
|
|
@ -53,7 +48,6 @@ public final class RikuOfTwoReflections extends CardImpl {
|
|||
|
||||
// Whenever you cast an instant or sorcery spell, you may pay {U}{R}. If you do, copy that spell. You may choose new targets for the copy.
|
||||
Effect effect = new CopyTargetSpellEffect(true);
|
||||
effect.setText("copy that spell. You may choose new targets for the copy");
|
||||
this.addAbility(new SpellCastControllerTriggeredAbility(new DoIfCostPaid(effect, new ManaCostsImpl("{U}{R}")), filter, false, true));
|
||||
|
||||
// Whenever another nontoken creature enters the battlefield under your control, you may pay {G}{U}. If you do, create a token that's a copy of that creature.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.r;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.LoyaltyAbility;
|
||||
|
|
@ -13,14 +11,9 @@ import mage.abilities.effects.RequirementEffect;
|
|||
import mage.abilities.effects.common.DamageAllEffect;
|
||||
import mage.abilities.effects.common.GetEmblemTargetPlayerEffect;
|
||||
import mage.abilities.keyword.PartnerWithAbility;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TurnPhase;
|
||||
import mage.constants.*;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||
import mage.filter.predicate.permanent.TappedPredicate;
|
||||
|
|
@ -29,8 +22,9 @@ import mage.game.command.emblems.RowanKenrithEmblem;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPlayer;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class RowanKenrith extends CardImpl {
|
||||
|
|
@ -54,11 +48,6 @@ public final class RowanKenrith extends CardImpl {
|
|||
|
||||
// -8: Target player gets an emblem with "Whenever you activate an ability that isn't a mana ability, copy it. You may choose new targets for the copy."
|
||||
Effect effect = new GetEmblemTargetPlayerEffect(new RowanKenrithEmblem());
|
||||
effect.setText(
|
||||
"Target player gets an emblem with "
|
||||
+ "\"Whenever you activate an ability that isn't a mana ability, "
|
||||
+ "copy it. You may choose new targets for the copy.\""
|
||||
);
|
||||
ability = new LoyaltyAbility(effect, -8);
|
||||
ability.addTarget(new TargetPlayer());
|
||||
this.addAbility(ability);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.w;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.LoyaltyAbility;
|
||||
import mage.abilities.common.CanBeYourCommanderAbility;
|
||||
|
|
@ -16,11 +14,7 @@ import mage.abilities.effects.common.cost.SpellsCostReductionAllEffect;
|
|||
import mage.abilities.keyword.PartnerWithAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
|
|
@ -29,8 +23,9 @@ import mage.game.command.emblems.WillKenrithEmblem;
|
|||
import mage.target.TargetPlayer;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class WillKenrith extends CardImpl {
|
||||
|
|
@ -60,11 +55,6 @@ public final class WillKenrith extends CardImpl {
|
|||
|
||||
// -8: Target player gets an emblem with "Whenever you cast an instant or sorcery spell, copy it. You may choose new targets for the copy."
|
||||
Effect effect = new GetEmblemTargetPlayerEffect(new WillKenrithEmblem());
|
||||
effect.setText(
|
||||
"Target player gets an emblem with "
|
||||
+ "\"Whenever you cast an instant or sorcery spell, "
|
||||
+ "copy it. You may choose new targets for the copy.\""
|
||||
);
|
||||
ability = new LoyaltyAbility(effect, -8);
|
||||
ability.addTarget(new TargetPlayer());
|
||||
this.addAbility(ability);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package mage.abilities.effects.common;
|
|||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
|
|
@ -17,6 +18,7 @@ public class CopyTargetSpellEffect extends OneShotEffect {
|
|||
|
||||
private final boolean useController;
|
||||
private final boolean useLKI;
|
||||
private String copyThatSpellName = "that spell";
|
||||
|
||||
public CopyTargetSpellEffect() {
|
||||
this(false);
|
||||
|
|
@ -38,6 +40,11 @@ public class CopyTargetSpellEffect extends OneShotEffect {
|
|||
this.useController = effect.useController;
|
||||
}
|
||||
|
||||
public Effect withSpellName(String copyThatSpellName) {
|
||||
this.copyThatSpellName = copyThatSpellName;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Spell spell;
|
||||
|
|
@ -81,7 +88,7 @@ public class CopyTargetSpellEffect extends OneShotEffect {
|
|||
if (!mode.getTargets().isEmpty()) {
|
||||
sb.append("target ").append(mode.getTargets().get(0).getTargetName());
|
||||
} else {
|
||||
sb.append("that spell");
|
||||
sb.append(copyThatSpellName);
|
||||
}
|
||||
sb.append(". You may choose new targets for the copy");
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.MageObject;
|
||||
|
|
@ -10,8 +9,9 @@ import mage.game.Game;
|
|||
import mage.game.command.Emblem;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class GetEmblemTargetPlayerEffect extends OneShotEffect {
|
||||
|
|
@ -53,6 +53,6 @@ public class GetEmblemTargetPlayerEffect extends OneShotEffect {
|
|||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
return "Target " + mode.getTargets().get(0).getTargetName() + " gets an emblem with \"" + emblem.getAbilities().getRules(null) + '"';
|
||||
return "Target " + mode.getTargets().get(0).getTargetName() + " gets an emblem with \"" + emblem.getAbilities().getRules(null).stream().collect(Collectors.joining("; ")) + "\"";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,24 +1,18 @@
|
|||
|
||||
package mage.abilities.effects.common.continuous;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.DependencyType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.PhaseStep;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.Target;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class GainAbilityTargetEffect extends ContinuousEffectImpl {
|
||||
|
|
@ -88,9 +82,7 @@ public class GainAbilityTargetEffect extends ContinuousEffectImpl {
|
|||
return true;
|
||||
}
|
||||
if (durationPhaseStep != null && durationPhaseStep == game.getPhase().getStep().getType()) {
|
||||
if (!sameStep && game.isActivePlayer(durationPlayerId) || game.getPlayer(durationPlayerId).hasReachedNextTurnAfterLeaving()) {
|
||||
return true;
|
||||
}
|
||||
return !sameStep && game.isActivePlayer(durationPlayerId) || game.getPlayer(durationPlayerId).hasReachedNextTurnAfterLeaving();
|
||||
} else {
|
||||
sameStep = false;
|
||||
}
|
||||
|
|
@ -137,21 +129,26 @@ public class GainAbilityTargetEffect extends ContinuousEffectImpl {
|
|||
return staticText;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Target target = mode.getTargets().get(0);
|
||||
if (target.getMaxNumberOfTargets() == Integer.MAX_VALUE) {
|
||||
sb.append("any number of target ").append(target.getTargetName()).append(" gain ");
|
||||
} else if (target.getMaxNumberOfTargets() > 1) {
|
||||
if (target.getNumberOfTargets() < target.getMaxNumberOfTargets()) {
|
||||
sb.append("up to ");
|
||||
}
|
||||
sb.append(target.getMaxNumberOfTargets()).append(" target ").append(target.getTargetName()).append(" gain ");
|
||||
} else {
|
||||
if (!target.getTargetName().toUpperCase(Locale.ENGLISH).startsWith("ANOTHER")) {
|
||||
sb.append("target ");
|
||||
}
|
||||
sb.append(target.getTargetName()).append(" gains ");
|
||||
|
||||
if (mode.getTargets().size() > 0) {
|
||||
Target target = mode.getTargets().get(0);
|
||||
if (target.getMaxNumberOfTargets() == Integer.MAX_VALUE) {
|
||||
sb.append("any number of target ").append(target.getTargetName()).append(" gain ");
|
||||
} else if (target.getMaxNumberOfTargets() > 1) {
|
||||
if (target.getNumberOfTargets() < target.getMaxNumberOfTargets()) {
|
||||
sb.append("up to ");
|
||||
}
|
||||
sb.append(target.getMaxNumberOfTargets()).append(" target ").append(target.getTargetName()).append(" gain ");
|
||||
} else {
|
||||
if (!target.getTargetName().toUpperCase(Locale.ENGLISH).startsWith("ANOTHER")) {
|
||||
sb.append("target ");
|
||||
}
|
||||
sb.append(target.getTargetName()).append(" gains ");
|
||||
}
|
||||
} else {
|
||||
sb.append("gains ");
|
||||
}
|
||||
|
||||
sb.append(ability.getRule());
|
||||
if (durationPhaseStep != null) {
|
||||
sb.append(" until your next ").append(durationPhaseStep.toString().toLowerCase(Locale.ENGLISH));
|
||||
|
|
|
|||
|
|
@ -477,7 +477,7 @@ public final class StaticFilters {
|
|||
FILTER_SPELL_AN_INSTANT_OR_SORCERY.setLockedFilter(true);
|
||||
}
|
||||
|
||||
public static final FilterSpell FILTER_SPELL_INSTANT_OR_SORCERY = new FilterSpell("instant or sorcery spell");
|
||||
public static final FilterSpell FILTER_SPELL_INSTANT_OR_SORCERY = new FilterSpell("an instant or sorcery spell");
|
||||
|
||||
static {
|
||||
FILTER_SPELL_INSTANT_OR_SORCERY.add(Predicates.or(
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.game.command.emblems;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
|
|
@ -13,7 +12,6 @@ import mage.constants.Zone;
|
|||
import mage.game.command.Emblem;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author spjspj
|
||||
*/
|
||||
public final class GarrukApexPredatorEmblem extends Emblem {
|
||||
|
|
@ -25,12 +23,12 @@ public final class GarrukApexPredatorEmblem extends Emblem {
|
|||
|
||||
public GarrukApexPredatorEmblem() {
|
||||
setName("Emblem Garruk");
|
||||
Effect effect = new BoostTargetEffect(5, 5, Duration.EndOfTurn);
|
||||
effect.setText("it gets +5/+5");
|
||||
|
||||
Effect effect = new BoostTargetEffect(-1, 0, Duration.EndOfTurn);
|
||||
effect.setText("it gets -1/-0");
|
||||
Ability ability = new AttackedByCreatureTriggeredAbility(Zone.COMMAND, effect, false, SetTargetPointer.PERMANENT);
|
||||
effect = new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn,
|
||||
"and gains trample until end of turn");
|
||||
ability.addEffect(effect);
|
||||
effect = new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn);
|
||||
ability.addEffect(effect.concatBy("and"));
|
||||
this.getAbilities().add(ability);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.game.command.emblems;
|
||||
|
||||
import mage.abilities.common.SpellCastControllerTriggeredAbility;
|
||||
|
|
@ -8,7 +7,6 @@ import mage.filter.StaticFilters;
|
|||
import mage.game.command.Emblem;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class WillKenrithEmblem extends Emblem {
|
||||
|
|
@ -18,8 +16,7 @@ public final class WillKenrithEmblem extends Emblem {
|
|||
this.setName("Emblem Will Kenrith");
|
||||
this.getAbilities().add(new SpellCastControllerTriggeredAbility(
|
||||
Zone.COMMAND,
|
||||
new CopyTargetSpellEffect(true)
|
||||
.setText("copy that spell. You may choose new targets for the copy"),
|
||||
new CopyTargetSpellEffect(true).withSpellName("it"),
|
||||
StaticFilters.FILTER_SPELL_INSTANT_OR_SORCERY,
|
||||
false,
|
||||
true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue