mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
[LTR] Implement Frodo, Sauron's Bane
This commit is contained in:
parent
8585a7c570
commit
9385a31c4a
5 changed files with 115 additions and 11 deletions
86
Mage.Sets/src/mage/cards/f/FrodoSauronsBane.java
Normal file
86
Mage.Sets/src/mage/cards/f/FrodoSauronsBane.java
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
package mage.cards.f;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.condition.common.SourceHasSubtypeCondition;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.decorator.ConditionalOneShotEffect;
|
||||
import mage.abilities.effects.common.AddContinuousEffectToGame;
|
||||
import mage.abilities.effects.common.LoseGameTargetPlayerEffect;
|
||||
import mage.abilities.effects.common.continuous.AddCardSubTypeSourceEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
|
||||
import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect;
|
||||
import mage.abilities.effects.keyword.TheRingTemptsYouEffect;
|
||||
import mage.abilities.keyword.LifelinkAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class FrodoSauronsBane extends CardImpl {
|
||||
|
||||
private static final Condition condition1 = new SourceHasSubtypeCondition(SubType.CITIZEN);
|
||||
private static final Condition condition2 = new SourceHasSubtypeCondition(SubType.SCOUT);
|
||||
|
||||
public FrodoSauronsBane(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}");
|
||||
|
||||
this.addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.HALFLING);
|
||||
this.subtype.add(SubType.CITIZEN);
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(2);
|
||||
|
||||
// {W/B}{W/B}: If Frodo, Sauron's Bane is a Citizen, it becomes a Halfling Scout with base power and toughness 2/3 and lifelink.
|
||||
this.addAbility(new SimpleActivatedAbility(
|
||||
new ConditionalOneShotEffect(new AddContinuousEffectToGame(
|
||||
new AddCardSubTypeSourceEffect(Duration.Custom, SubType.HALFLING, SubType.SCOUT),
|
||||
new SetBasePowerToughnessSourceEffect(2, 3, Duration.Custom, SubLayer.SetPT_7b, true),
|
||||
new GainAbilitySourceEffect(LifelinkAbility.getInstance(), Duration.Custom)
|
||||
), condition1, "if {this} is a Citizen, it becomes a Halfling Scout with base power and toughness 2/3 and lifelink"),
|
||||
new ManaCostsImpl<>("{W/B}{W/B}")
|
||||
));
|
||||
|
||||
// {B}{B}{B}: If Frodo is a Scout, it becomes a Halfling Rogue with "Whenever this creature deals combat damage to a player, that player loses the game if the Ring has tempted you four or more times this game. Otherwise, the Ring tempts you."
|
||||
this.addAbility(new SimpleActivatedAbility(new ConditionalOneShotEffect(
|
||||
new AddContinuousEffectToGame(
|
||||
new AddCardSubTypeSourceEffect(Duration.Custom, SubType.HALFLING, SubType.ROGUE),
|
||||
new GainAbilitySourceEffect(new DealsCombatDamageToAPlayerTriggeredAbility(
|
||||
new ConditionalOneShotEffect(
|
||||
new LoseGameTargetPlayerEffect(), new TheRingTemptsYouEffect(),
|
||||
FrodoSauronsBaneCondition.instance, "that player loses the game " +
|
||||
"if the Ring has tempted you four or more times this game. Otherwise, the Ring tempts you"
|
||||
), false, true), Duration.Custom)
|
||||
), condition2, "if {this} is a Scout, it becomes a Halfling Rogue with " +
|
||||
"\"Whenever this creature deals combat damage to a player, that player loses the game " +
|
||||
"if the Ring has tempted you four or more times this game. Otherwise, the Ring tempts you.\""
|
||||
), new ManaCostsImpl<>("{B}{B}{B}")));
|
||||
}
|
||||
|
||||
private FrodoSauronsBane(final FrodoSauronsBane card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FrodoSauronsBane copy() {
|
||||
return new FrodoSauronsBane(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum FrodoSauronsBaneCondition implements Condition {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
// TODO: Implement when mechanic is known
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -63,7 +63,7 @@ public final class HeroOfBretagard extends CardImpl {
|
|||
), condition, "As long as {this} has five or more counters on it, it has flying"
|
||||
));
|
||||
ability.addEffect(new ConditionalContinuousEffect(new AddCardSubTypeSourceEffect(
|
||||
Duration.WhileOnBattlefield, SubType.ANGEL
|
||||
Duration.WhileOnBattlefield, true, SubType.ANGEL
|
||||
), condition, "and is an Angel in addition to its other types."));
|
||||
this.addAbility(ability);
|
||||
|
||||
|
|
@ -72,7 +72,7 @@ public final class HeroOfBretagard extends CardImpl {
|
|||
IndestructibleAbility.getInstance(), Duration.WhileOnBattlefield
|
||||
), condition2, "As long as {this} has ten or more counters on it, it has indestructible"));
|
||||
ability.addEffect(new ConditionalContinuousEffect(new AddCardSubTypeSourceEffect(
|
||||
Duration.WhileOnBattlefield, SubType.GOD
|
||||
Duration.WhileOnBattlefield, true, SubType.GOD
|
||||
), condition2, "and is a God in addition to its other types."));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ public final class TheLordOfTheRingsTalesOfMiddleEarth extends ExpansionSet {
|
|||
|
||||
cards.add(new SetCardInfo("Aragorn and Arwen, Wed", 287, Rarity.MYTHIC, mage.cards.a.AragornAndArwenWed.class));
|
||||
cards.add(new SetCardInfo("Forest", 280, Rarity.LAND, mage.cards.basiclands.Forest.class, FULL_ART_BFZ_VARIOUS));
|
||||
cards.add(new SetCardInfo("Frodo, Sauron's Bane", 18, Rarity.RARE, mage.cards.f.FrodoSauronsBane.class));
|
||||
cards.add(new SetCardInfo("Gandalf the Grey", 207, Rarity.RARE, mage.cards.g.GandalfTheGrey.class));
|
||||
cards.add(new SetCardInfo("Gollum, Patient Plotter", 84, Rarity.UNCOMMON, mage.cards.g.GollumPatientPlotter.class));
|
||||
cards.add(new SetCardInfo("Island", 274, Rarity.LAND, mage.cards.basiclands.Island.class, FULL_ART_BFZ_VARIOUS));
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
|
||||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.Effects;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
|
|
@ -14,16 +14,18 @@ import mage.game.Game;
|
|||
*/
|
||||
public class AddContinuousEffectToGame extends OneShotEffect {
|
||||
|
||||
private final ContinuousEffect effect;
|
||||
private final Effects effects = new Effects();
|
||||
|
||||
public AddContinuousEffectToGame(ContinuousEffect effect) {
|
||||
public AddContinuousEffectToGame(ContinuousEffect... effects) {
|
||||
super(Outcome.Benefit);
|
||||
this.effect = effect;
|
||||
for (ContinuousEffect effect : effects) {
|
||||
this.effects.add(effect);
|
||||
}
|
||||
}
|
||||
|
||||
public AddContinuousEffectToGame(final AddContinuousEffectToGame effect) {
|
||||
super(effect);
|
||||
this.effect = effect.effect;
|
||||
this.effects.addAll(effect.effects);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -33,12 +35,14 @@ public class AddContinuousEffectToGame extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
game.addEffect(effect, source);
|
||||
for (Effect effect : this.effects) {
|
||||
game.addEffect((ContinuousEffect) effect, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
return effect.getText(mode);
|
||||
return effects.getText(mode);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,10 +17,16 @@ import java.util.Locale;
|
|||
*/
|
||||
public class AddCardSubTypeSourceEffect extends ContinuousEffectImpl {
|
||||
|
||||
private final boolean inAddition;
|
||||
private final List<SubType> addedSubTypes = new ArrayList<>();
|
||||
|
||||
public AddCardSubTypeSourceEffect(Duration duration, SubType... addedSubType) {
|
||||
this(duration, false, addedSubType);
|
||||
}
|
||||
|
||||
public AddCardSubTypeSourceEffect(Duration duration, boolean inAddition, SubType... addedSubType) {
|
||||
super(duration, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit);
|
||||
this.inAddition = inAddition;
|
||||
for (SubType cardType : addedSubType) {
|
||||
this.addedSubTypes.add(cardType);
|
||||
}
|
||||
|
|
@ -28,6 +34,7 @@ public class AddCardSubTypeSourceEffect extends ContinuousEffectImpl {
|
|||
|
||||
private AddCardSubTypeSourceEffect(final AddCardSubTypeSourceEffect effect) {
|
||||
super(effect);
|
||||
this.inAddition = effect.inAddition;
|
||||
this.addedSubTypes.addAll(effect.addedSubTypes);
|
||||
}
|
||||
|
||||
|
|
@ -41,6 +48,9 @@ public class AddCardSubTypeSourceEffect extends ContinuousEffectImpl {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null && affectedObjectList.contains(new MageObjectReference(permanent, game))) {
|
||||
if (!inAddition) {
|
||||
permanent.removeAllCreatureTypes(game);
|
||||
}
|
||||
for (SubType cardType : addedSubTypes) {
|
||||
permanent.addSubType(game, cardType);
|
||||
}
|
||||
|
|
@ -75,7 +85,10 @@ public class AddCardSubTypeSourceEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
sb.append(subType.toString().toLowerCase(Locale.ENGLISH)).append(" ");
|
||||
}
|
||||
sb.append(" in addition to its other types ").append(this.getDuration().toString());
|
||||
if (inAddition) {
|
||||
sb.append(" in addition to its other types ");
|
||||
}
|
||||
sb.append(this.getDuration().toString());
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue