mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
Implemented Mythos of Illuna
This commit is contained in:
parent
1f2cc93fef
commit
d3ac65b68b
3 changed files with 116 additions and 0 deletions
108
Mage.Sets/src/mage/cards/m/MythosOfIlluna.java
Normal file
108
Mage.Sets/src/mage/cards/m/MythosOfIlluna.java
Normal file
|
@ -0,0 +1,108 @@
|
||||||
|
package mage.cards.m;
|
||||||
|
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
|
import mage.abilities.condition.CompoundCondition;
|
||||||
|
import mage.abilities.condition.Condition;
|
||||||
|
import mage.abilities.condition.common.ManaWasSpentCondition;
|
||||||
|
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.abilities.effects.common.CreateTokenCopyTargetEffect;
|
||||||
|
import mage.abilities.effects.common.FightTargetSourceEffect;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.ColoredManaSymbol;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.TargetController;
|
||||||
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.target.TargetPermanent;
|
||||||
|
import mage.watchers.common.ManaSpentToCastWatcher;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public final class MythosOfIlluna extends CardImpl {
|
||||||
|
|
||||||
|
public MythosOfIlluna(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{U}{U}");
|
||||||
|
|
||||||
|
// Create a token that's a copy of target permanent. If {R}{G} was spent to cast this spell, instead create a token that's a copy of that permanent, except the token has "When this permanent enters the battlefield, if it's a creature, it fights up to one target creature you don't control."
|
||||||
|
this.getSpellAbility().addEffect(new MythosOfIllunaEffect());
|
||||||
|
this.getSpellAbility().addTarget(new TargetPermanent());
|
||||||
|
this.getSpellAbility().addWatcher(new ManaSpentToCastWatcher());
|
||||||
|
}
|
||||||
|
|
||||||
|
private MythosOfIlluna(final MythosOfIlluna card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MythosOfIlluna copy() {
|
||||||
|
return new MythosOfIlluna(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class MythosOfIllunaEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
private static final Condition condition = new CompoundCondition(
|
||||||
|
new ManaWasSpentCondition(ColoredManaSymbol.R),
|
||||||
|
new ManaWasSpentCondition(ColoredManaSymbol.G)
|
||||||
|
);
|
||||||
|
private static final FilterCreaturePermanent filter
|
||||||
|
= new FilterCreaturePermanent("creature you don't control");
|
||||||
|
|
||||||
|
static {
|
||||||
|
filter.add(TargetController.NOT_YOU.getControllerPredicate());
|
||||||
|
}
|
||||||
|
|
||||||
|
MythosOfIllunaEffect() {
|
||||||
|
super(Outcome.Benefit);
|
||||||
|
staticText = "Create a token that's a copy of target permanent. " +
|
||||||
|
"If {R}{G} was spent to cast this spell, instead create a token that's a copy of that permanent, " +
|
||||||
|
"except the token has \"When this permanent enters the battlefield, if it's a creature, " +
|
||||||
|
"it fights up to one target creature you don't control.\"";
|
||||||
|
}
|
||||||
|
|
||||||
|
private MythosOfIllunaEffect(final MythosOfIllunaEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MythosOfIllunaEffect copy() {
|
||||||
|
return new MythosOfIllunaEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Permanent permanent = game.getPermanent(source.getFirstTarget());
|
||||||
|
if (permanent == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(source.getControllerId());
|
||||||
|
if (condition.apply(game, source)) {
|
||||||
|
Ability ability = new ConditionalInterveningIfTriggeredAbility(
|
||||||
|
new EntersBattlefieldTriggeredAbility(new FightTargetSourceEffect()),
|
||||||
|
MythosOfIllunaCondition.instance, "When this permanent enters the battlefield, " +
|
||||||
|
"if it's a creature, it fights up to one target creature you don't control."
|
||||||
|
);
|
||||||
|
ability.addTarget(new TargetPermanent(0, 1, filter, false));
|
||||||
|
effect.addAdditionalAbilities(ability);
|
||||||
|
}
|
||||||
|
return effect.apply(game, source);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum MythosOfIllunaCondition implements Condition {
|
||||||
|
instance;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
|
return permanent != null && permanent.isCreature();
|
||||||
|
}
|
||||||
|
}
|
|
@ -204,6 +204,7 @@ public final class IkoriaLairOfBehemoths extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Mysterious Egg", 3, Rarity.COMMON, mage.cards.m.MysteriousEgg.class));
|
cards.add(new SetCardInfo("Mysterious Egg", 3, Rarity.COMMON, mage.cards.m.MysteriousEgg.class));
|
||||||
cards.add(new SetCardInfo("Mystic Subdual", 57, Rarity.UNCOMMON, mage.cards.m.MysticSubdual.class));
|
cards.add(new SetCardInfo("Mystic Subdual", 57, Rarity.UNCOMMON, mage.cards.m.MysticSubdual.class));
|
||||||
cards.add(new SetCardInfo("Mythos of Brokkos", 168, Rarity.RARE, mage.cards.m.MythosOfBrokkos.class));
|
cards.add(new SetCardInfo("Mythos of Brokkos", 168, Rarity.RARE, mage.cards.m.MythosOfBrokkos.class));
|
||||||
|
cards.add(new SetCardInfo("Mythos of Illuna", 58, Rarity.RARE, mage.cards.m.MythosOfIlluna.class));
|
||||||
cards.add(new SetCardInfo("Mythos of Nethroi", 97, Rarity.RARE, mage.cards.m.MythosOfNethroi.class));
|
cards.add(new SetCardInfo("Mythos of Nethroi", 97, Rarity.RARE, mage.cards.m.MythosOfNethroi.class));
|
||||||
cards.add(new SetCardInfo("Necropanther", 196, Rarity.UNCOMMON, mage.cards.n.Necropanther.class));
|
cards.add(new SetCardInfo("Necropanther", 196, Rarity.UNCOMMON, mage.cards.n.Necropanther.class));
|
||||||
cards.add(new SetCardInfo("Nethroi, Apex of Death", 197, Rarity.MYTHIC, mage.cards.n.NethroiApexOfDeath.class));
|
cards.add(new SetCardInfo("Nethroi, Apex of Death", 197, Rarity.MYTHIC, mage.cards.n.NethroiApexOfDeath.class));
|
||||||
|
|
|
@ -21,6 +21,7 @@ import mage.util.functions.ApplyToPermanent;
|
||||||
import mage.util.functions.EmptyApplyToPermanent;
|
import mage.util.functions.EmptyApplyToPermanent;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@ -46,6 +47,7 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect {
|
||||||
private ObjectColor color;
|
private ObjectColor color;
|
||||||
private boolean useLKI = false;
|
private boolean useLKI = false;
|
||||||
private boolean isntLegendary = false;
|
private boolean isntLegendary = false;
|
||||||
|
private final List<Ability> additionalAbilities = new ArrayList();
|
||||||
|
|
||||||
public CreateTokenCopyTargetEffect(boolean useLKI) {
|
public CreateTokenCopyTargetEffect(boolean useLKI) {
|
||||||
this();
|
this();
|
||||||
|
@ -202,6 +204,7 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect {
|
||||||
if (color != null) {
|
if (color != null) {
|
||||||
token.getColor(game).setColor(color);
|
token.getColor(game).setColor(color);
|
||||||
}
|
}
|
||||||
|
additionalAbilities.stream().forEach(token::addAbility);
|
||||||
|
|
||||||
token.putOntoBattlefield(number, game, source.getSourceId(), playerId == null ? source.getControllerId() : playerId, tapped, attacking, attackedPlayer);
|
token.putOntoBattlefield(number, game, source.getSourceId(), playerId == null ? source.getControllerId() : playerId, tapped, attacking, attackedPlayer);
|
||||||
for (UUID tokenId : token.getLastAddedTokenIds()) { // by cards like Doubling Season multiple tokens can be added to the battlefield
|
for (UUID tokenId : token.getLastAddedTokenIds()) { // by cards like Doubling Season multiple tokens can be added to the battlefield
|
||||||
|
@ -302,4 +305,8 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect {
|
||||||
game.addDelayedTriggeredAbility(new AtTheEndOfCombatDelayedTriggeredAbility(exileEffect), source);
|
game.addDelayedTriggeredAbility(new AtTheEndOfCombatDelayedTriggeredAbility(exileEffect), source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addAdditionalAbilities(Ability... abilities) {
|
||||||
|
Arrays.stream(abilities).forEach(this.additionalAbilities::add);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue