mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 10:40:06 -08:00
[ECL] Implement Figure of Fable
This commit is contained in:
parent
265fbcfe82
commit
29ab28fd74
4 changed files with 173 additions and 38 deletions
|
|
@ -1,22 +1,17 @@
|
|||
package mage.cards.a;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.MageItem;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.common.CantBeCounteredSourceAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityControllerEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.abilities.keyword.ProtectionAbility;
|
||||
import mage.abilities.keyword.ProtectionFromEachOpponentAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
|
|
@ -40,7 +35,7 @@ public final class AbsoluteVirtue extends CardImpl {
|
|||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
// You have protection from each of your opponents.
|
||||
this.addAbility(new SimpleStaticAbility(new GainAbilityControllerEffect(new AbsoluteVirtueAbility())));
|
||||
this.addAbility(new SimpleStaticAbility(new GainAbilityControllerEffect(new ProtectionFromEachOpponentAbility())));
|
||||
}
|
||||
|
||||
private AbsoluteVirtue(final AbsoluteVirtue card) {
|
||||
|
|
@ -52,34 +47,3 @@ public final class AbsoluteVirtue extends CardImpl {
|
|||
return new AbsoluteVirtue(this);
|
||||
}
|
||||
}
|
||||
|
||||
class AbsoluteVirtueAbility extends ProtectionAbility {
|
||||
|
||||
public AbsoluteVirtueAbility() {
|
||||
super(StaticFilters.FILTER_CARD);
|
||||
}
|
||||
|
||||
private AbsoluteVirtueAbility(final AbsoluteVirtueAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbsoluteVirtueAbility copy() {
|
||||
return new AbsoluteVirtueAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "protection from each of your opponents";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTarget(MageObject source, Game game) {
|
||||
return Optional
|
||||
.ofNullable(source)
|
||||
.map(MageItem::getId)
|
||||
.map(game::getControllerId)
|
||||
.map(uuid -> !game.getOpponents(this.getSourceId()).contains(uuid))
|
||||
.orElse(true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
127
Mage.Sets/src/mage/cards/f/FigureOfFable.java
Normal file
127
Mage.Sets/src/mage/cards/f/FigureOfFable.java
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
package mage.cards.f;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.AddCardSubTypeSourceEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
|
||||
import mage.abilities.effects.common.continuous.SetBasePowerToughnessSourceEffect;
|
||||
import mage.abilities.keyword.ProtectionFromEachOpponentAbility;
|
||||
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.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class FigureOfFable extends CardImpl {
|
||||
|
||||
public FigureOfFable(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{G/W}");
|
||||
|
||||
this.subtype.add(SubType.KITHKIN);
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(1);
|
||||
|
||||
// {G/W}: This creature becomes a Kithkin Scout with base power and toughness 2/3.
|
||||
Ability ability = new SimpleActivatedAbility(new AddCardSubTypeSourceEffect(
|
||||
Duration.Custom, SubType.KITHKIN, SubType.SCOUT
|
||||
).setText("{this} becomes a Kithkin Scout"), new ManaCostsImpl<>("{G/W}"));
|
||||
ability.addEffect(new SetBasePowerToughnessSourceEffect(
|
||||
2, 3, Duration.Custom
|
||||
).setText("with base power and toughness 2/3"));
|
||||
this.addAbility(ability);
|
||||
|
||||
// {1}{G/W}{G/W}: If this creature is a Scout, it becomes a Kithkin Soldier with base power and toughness 4/5.
|
||||
this.addAbility(new SimpleActivatedAbility(new FigureOfFableScoutEffect(), new ManaCostsImpl<>("{1}{G/W}{G/W}")));
|
||||
|
||||
// {3}{G/W}{G/W}{G/W}: If this creature is a Soldier, it becomes a Kithkin Avatar with base power and toughness 7/8 and protection from each of your opponents.
|
||||
this.addAbility(new SimpleActivatedAbility(new FigureOfFableSoldierEffect(), new ManaCostsImpl<>("{3}{G/W}{G/W}{G/W}")));
|
||||
}
|
||||
|
||||
private FigureOfFable(final FigureOfFable card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FigureOfFable copy() {
|
||||
return new FigureOfFable(this);
|
||||
}
|
||||
}
|
||||
|
||||
class FigureOfFableScoutEffect extends OneShotEffect {
|
||||
|
||||
FigureOfFableScoutEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "if {this} is a Scout, it becomes a Kithkin Soldier with base power and toughness 4/5";
|
||||
}
|
||||
|
||||
private FigureOfFableScoutEffect(final FigureOfFableScoutEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FigureOfFableScoutEffect copy() {
|
||||
return new FigureOfFableScoutEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
|
||||
if (permanent == null || !permanent.hasSubtype(SubType.SCOUT, game)) {
|
||||
return false;
|
||||
}
|
||||
game.addEffect(new AddCardSubTypeSourceEffect(
|
||||
Duration.Custom, SubType.KITHKIN, SubType.SOLDIER
|
||||
), source);
|
||||
game.addEffect(new SetBasePowerToughnessSourceEffect(
|
||||
4, 5, Duration.Custom
|
||||
), source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class FigureOfFableSoldierEffect extends OneShotEffect {
|
||||
|
||||
FigureOfFableSoldierEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "if {this} is a Soldier, it becomes a Kithkin Avatar " +
|
||||
"with base power and toughness 7/8 and protection from each of your opponents";
|
||||
}
|
||||
|
||||
private FigureOfFableSoldierEffect(final FigureOfFableSoldierEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FigureOfFableSoldierEffect copy() {
|
||||
return new FigureOfFableSoldierEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
|
||||
if (permanent == null || !permanent.hasSubtype(SubType.SOLDIER, game)) {
|
||||
return false;
|
||||
}
|
||||
game.addEffect(new AddCardSubTypeSourceEffect(
|
||||
Duration.Custom, SubType.KITHKIN, SubType.AVATAR
|
||||
), source);
|
||||
game.addEffect(new SetBasePowerToughnessSourceEffect(
|
||||
7, 8, Duration.Custom
|
||||
), source);
|
||||
game.addEffect(new GainAbilitySourceEffect(
|
||||
new ProtectionFromEachOpponentAbility(), Duration.Custom
|
||||
), source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -29,6 +29,8 @@ public final class LorwynEclipsed extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Deceit", 293, Rarity.MYTHIC, mage.cards.d.Deceit.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Emptiness", 222, Rarity.MYTHIC, mage.cards.e.Emptiness.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Emptiness", 294, Rarity.MYTHIC, mage.cards.e.Emptiness.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Figure of Fable", 224, Rarity.RARE, mage.cards.f.FigureOfFable.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Figure of Fable", 372, Rarity.RARE, mage.cards.f.FigureOfFable.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Formidable Speaker", 176, Rarity.RARE, mage.cards.f.FormidableSpeaker.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Formidable Speaker", 366, Rarity.RARE, mage.cards.f.FormidableSpeaker.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Hallowed Fountain", 265, Rarity.RARE, mage.cards.h.HallowedFountain.class, NON_FULL_USE_VARIOUS));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
package mage.abilities.keyword;
|
||||
|
||||
import mage.MageItem;
|
||||
import mage.MageObject;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class ProtectionFromEachOpponentAbility extends ProtectionAbility {
|
||||
|
||||
public ProtectionFromEachOpponentAbility() {
|
||||
super(StaticFilters.FILTER_CARD);
|
||||
}
|
||||
|
||||
private ProtectionFromEachOpponentAbility(final ProtectionFromEachOpponentAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProtectionFromEachOpponentAbility copy() {
|
||||
return new ProtectionFromEachOpponentAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "protection from each of your opponents";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTarget(MageObject source, Game game) {
|
||||
return Optional
|
||||
.ofNullable(source)
|
||||
.map(MageItem::getId)
|
||||
.map(game::getControllerId)
|
||||
.map(uuid -> !game.getOpponents(this.getSourceId()).contains(uuid))
|
||||
.orElse(true);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue