mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
[WHO] Implement Adipose Offspring (#11570)
* EmergeAbility take a string instead of a ManaCosts object * Save Emerge's sacrificed creature MOR in a costs tag * Implement Adipose Offspring * Fix costs tag clearing while permanent still on the battlefield * improved version of game.getPermanentOrLKIBattlefield with MageObjectReference * Use correct Alien token * cleanup imports * merge fix
This commit is contained in:
parent
01ff7d6e1a
commit
429043d7b5
15 changed files with 150 additions and 37 deletions
|
|
@ -2,7 +2,6 @@ package mage.cards.a;
|
|||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.common.CastSourceTriggeredAbility;
|
||||
import mage.abilities.effects.common.GainLifeEffect;
|
||||
import mage.abilities.effects.common.LoseLifeTargetEffect;
|
||||
|
|
@ -28,7 +27,7 @@ public final class AbundantMaw extends CardImpl {
|
|||
this.toughness = new MageInt(4);
|
||||
|
||||
// Emerge {6}{B}
|
||||
this.addAbility(new EmergeAbility(this, new ManaCostsImpl<>("{6}{B}")));
|
||||
this.addAbility(new EmergeAbility(this, "{6}{B}"));
|
||||
|
||||
// When you cast Abundant Maw, target opponent loses 3 life and you gain 3 life.
|
||||
Ability ability = new CastSourceTriggeredAbility(new LoseLifeTargetEffect(3));
|
||||
|
|
|
|||
84
Mage.Sets/src/mage/cards/a/AdiposeOffspring.java
Normal file
84
Mage.Sets/src/mage/cards/a/AdiposeOffspring.java
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
package mage.cards.a;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.keyword.EmergeAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.AlienToken;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author notgreat
|
||||
*/
|
||||
public final class AdiposeOffspring extends CardImpl {
|
||||
|
||||
public AdiposeOffspring(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}");
|
||||
|
||||
this.subtype.add(SubType.ALIEN);
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(2);
|
||||
|
||||
// Emerge {5}{W}
|
||||
this.addAbility(new EmergeAbility(this, "{5}{W}"));
|
||||
// When Adipose Offspring enters the battlefield, create a 2/2 white Alien creature token. If Adipose Offspring's emerge cost was paid, instead create X of those tokens, where X is the sacrificed creature's toughness.
|
||||
this.addAbility(new EntersBattlefieldAbility(new CreateTokenEffect(new AlienToken(), AdiposeOffspringValue.instance)
|
||||
.setText("create a 2/2 white Alien creature token. If Adipose Offspring's emerge cost was paid, "
|
||||
+"instead create X of those tokens, where X is the sacrificed creature's toughness.")));
|
||||
}
|
||||
|
||||
private AdiposeOffspring(final AdiposeOffspring card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AdiposeOffspring copy() {
|
||||
return new AdiposeOffspring(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
enum AdiposeOffspringValue implements DynamicValue {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
MageObjectReference blank = new MageObjectReference(new UUID(0,0));
|
||||
MageObjectReference mor = CardUtil.getSourceCostsTag(game, sourceAbility, EmergeAbility.EMERGE_ACTIVATION_CREATURE_REFERENCE, blank);
|
||||
if (!mor.equals(blank)) {
|
||||
Permanent creature = mor.getPermanentOrLKIBattlefield(game);
|
||||
if (creature != null) {
|
||||
return creature.getToughness().getValue();
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AdiposeOffspringValue copy() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "One or the sacrificed creature's toughness";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "1";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,8 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.CastSourceTriggeredAbility;
|
||||
import mage.abilities.effects.common.continuous.BoostControlledEffect;
|
||||
|
|
@ -15,10 +13,12 @@ import mage.abilities.keyword.TrampleAbility;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fireshoes
|
||||
|
|
@ -33,7 +33,7 @@ public final class DecimatorOfTheProvinces extends CardImpl {
|
|||
this.toughness = new MageInt(7);
|
||||
|
||||
// Emerge {6}{G}{G}{G}
|
||||
this.addAbility(new EmergeAbility(this, new ManaCostsImpl<>("{6}{G}{G}{G}")));
|
||||
this.addAbility(new EmergeAbility(this, "{6}{G}{G}{G}"));
|
||||
|
||||
// When you cast Decimator of the Provinces, creatures you control get +2/+2 and gain trample until end of turn.
|
||||
Effect effect = new BoostControlledEffect(2, 2, Duration.EndOfTurn);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package mage.cards.d;
|
|||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.CastSourceTriggeredAbility;
|
||||
import mage.abilities.keyword.EmergeAbility;
|
||||
|
|
@ -10,10 +9,7 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.ManaValuePredicate;
|
||||
|
|
@ -23,7 +19,6 @@ import mage.target.TargetCard;
|
|||
import mage.target.common.TargetOpponent;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.Zone;
|
||||
|
||||
/**
|
||||
* @author fireshoes
|
||||
|
|
@ -38,7 +33,7 @@ public final class DistendedMindbender extends CardImpl {
|
|||
this.toughness = new MageInt(5);
|
||||
|
||||
// Emerge {5}{B}{B}
|
||||
this.addAbility(new EmergeAbility(this, new ManaCostsImpl<>("{5}{B}{B}")));
|
||||
this.addAbility(new EmergeAbility(this, "{5}{B}{B}"));
|
||||
|
||||
// When controller cast Distended Mindbender, target opponent reveals their hand. You choose from it a nonland card with converted mana cost 3 or less
|
||||
// and a card with converted mana cost 4 or greater. That player discards those cards.
|
||||
|
|
|
|||
|
|
@ -1,11 +1,9 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.condition.common.SourceEnteredThisTurnCondition;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.decorator.ConditionalContinuousEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
|
||||
import mage.abilities.keyword.EmergeAbility;
|
||||
|
|
@ -14,8 +12,10 @@ import mage.abilities.keyword.HexproofAbility;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -33,7 +33,7 @@ public final class DrownyardBehemoth extends CardImpl {
|
|||
// Flash
|
||||
this.addAbility(FlashAbility.getInstance());
|
||||
// Emerge {7}{U}
|
||||
this.addAbility(new EmergeAbility(this, new ManaCostsImpl<>("{7}{U}")));
|
||||
this.addAbility(new EmergeAbility(this, "{7}{U}"));
|
||||
|
||||
// Drownyard Behemoth has hexproof as long as it entered the battlefield this turn.
|
||||
this.addAbility(new SimpleStaticAbility(new ConditionalContinuousEffect(
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
package mage.cards.e;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.common.CastSourceTriggeredAbility;
|
||||
import mage.abilities.effects.common.TapTargetEffect;
|
||||
import mage.abilities.keyword.EmergeAbility;
|
||||
|
|
@ -15,6 +13,8 @@ import mage.constants.SubType;
|
|||
import mage.filter.StaticFilters;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author emerald000
|
||||
|
|
@ -32,7 +32,7 @@ public final class ElderDeepFiend extends CardImpl {
|
|||
this.addAbility(FlashAbility.getInstance());
|
||||
|
||||
// Emerge {5}{U}{U}
|
||||
this.addAbility(new EmergeAbility(this, new ManaCostsImpl<>("{5}{U}{U}")));
|
||||
this.addAbility(new EmergeAbility(this, "{5}{U}{U}"));
|
||||
|
||||
// When you cast Elder Deep-Fiend, tap up to four target permanents.
|
||||
Ability ability = new CastSourceTriggeredAbility(new TapTargetEffect());
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package mage.cards.f;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.SacrificeSourceTriggeredAbility;
|
||||
|
|
@ -18,6 +17,8 @@ import mage.game.events.GameEvent;
|
|||
import mage.game.permanent.token.EldraziHorrorToken;
|
||||
import mage.game.stack.Spell;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
|
||||
package mage.cards.i;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.common.CastSourceTriggeredAbility;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.keyword.EmergeAbility;
|
||||
|
|
@ -13,6 +11,8 @@ import mage.constants.CardType;
|
|||
import mage.constants.SubType;
|
||||
import mage.game.permanent.token.InsectToken;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
|
||||
|
|
@ -27,7 +27,7 @@ public final class ItOfTheHorridSwarm extends CardImpl {
|
|||
this.toughness = new MageInt(4);
|
||||
|
||||
// Emerge {6}{G}
|
||||
this.addAbility(new EmergeAbility(this, new ManaCostsImpl<>("{6}{G}")));
|
||||
this.addAbility(new EmergeAbility(this, "{6}{G}"));
|
||||
|
||||
// When you cast It of the Horrid Swarm, create two 1/1 green Insect creature tokens.
|
||||
this.addAbility(new CastSourceTriggeredAbility(new CreateTokenEffect(new InsectToken(), 2)));
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
|
||||
package mage.cards.l;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.common.CastSourceTriggeredAbility;
|
||||
import mage.abilities.effects.common.PutOnLibraryTargetEffect;
|
||||
import mage.abilities.keyword.EmergeAbility;
|
||||
|
|
@ -15,6 +13,8 @@ import mage.constants.SubType;
|
|||
import mage.filter.common.FilterNonlandPermanent;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fireshoes
|
||||
|
|
@ -29,7 +29,7 @@ public final class LashweedLurker extends CardImpl {
|
|||
this.toughness = new MageInt(4);
|
||||
|
||||
// Emerge {5}{G}{U}
|
||||
this.addAbility(new EmergeAbility(this, new ManaCostsImpl<>("{5}{G}{U}")));
|
||||
this.addAbility(new EmergeAbility(this, "{5}{G}{U}"));
|
||||
|
||||
// When you cast Lashweed Lurker, you may put target nonland permanent on top of its owner's library.
|
||||
Ability ability = new CastSourceTriggeredAbility(new PutOnLibraryTargetEffect(true), true);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package mage.cards.m;
|
|||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.common.CastSourceTriggeredAbility;
|
||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||
import mage.abilities.keyword.EmergeAbility;
|
||||
|
|
@ -30,7 +29,7 @@ public final class MockeryOfNature extends CardImpl {
|
|||
this.toughness = new MageInt(5);
|
||||
|
||||
// Emerge {7}{G}
|
||||
this.addAbility(new EmergeAbility(this, new ManaCostsImpl<>("{7}{G}")));
|
||||
this.addAbility(new EmergeAbility(this, "{7}{G}"));
|
||||
|
||||
// When you cast Mockery of Nature, you may destroy target artifact or enchantment.
|
||||
Ability ability = new CastSourceTriggeredAbility(new DestroyTargetEffect(), true);
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
|
||||
package mage.cards.v;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.CastSourceTriggeredAbility;
|
||||
import mage.abilities.effects.common.ReturnToHandTargetEffect;
|
||||
|
|
@ -17,6 +15,8 @@ import mage.filter.FilterCard;
|
|||
import mage.filter.predicate.Predicates;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
|
||||
|
|
@ -39,7 +39,7 @@ public final class VexingScuttler extends CardImpl {
|
|||
this.toughness = new MageInt(5);
|
||||
|
||||
// Emerge {6}{U}
|
||||
this.addAbility(new EmergeAbility(this, new ManaCostsImpl<>("{6}{U}")));
|
||||
this.addAbility(new EmergeAbility(this, "{6}{U}"));
|
||||
|
||||
// When you cast Vexing Scuttler, you may return target instant or sorcery card from your graveyard to your hand.
|
||||
Effect effect = new ReturnToHandTargetEffect();
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
|
||||
package mage.cards.w;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.common.CastSourceTriggeredAbility;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.keyword.EmergeAbility;
|
||||
|
|
@ -13,6 +11,8 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fireshoes
|
||||
|
|
@ -27,7 +27,7 @@ public final class WretchedGryff extends CardImpl {
|
|||
this.toughness = new MageInt(4);
|
||||
|
||||
// Emerge {5}{U} (You may cast this spell by sacrificing a creature and paying the emerge cost reduced by that creature's converted mana cost.)
|
||||
this.addAbility(new EmergeAbility(this, new ManaCostsImpl<>("{5}{U}")));
|
||||
this.addAbility(new EmergeAbility(this, "{5}{U}"));
|
||||
|
||||
// When you cast Wretched Gryff, draw a card.
|
||||
this.addAbility(new CastSourceTriggeredAbility(new DrawCardSourceControllerEffect(1)));
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ public final class DoctorWho extends ExpansionSet {
|
|||
|
||||
cards.add(new SetCardInfo("Ace, Fearless Rebel", 98, Rarity.RARE, mage.cards.a.AceFearlessRebel.class));
|
||||
cards.add(new SetCardInfo("Ace's Baseball Bat", 170, Rarity.RARE, mage.cards.a.AcesBaseballBat.class));
|
||||
cards.add(new SetCardInfo("Adipose Offspring", 10, Rarity.RARE, mage.cards.a.AdiposeOffspring.class));
|
||||
cards.add(new SetCardInfo("Adric, Mathematical Genius", 33, Rarity.RARE, mage.cards.a.AdricMathematicalGenius.class));
|
||||
cards.add(new SetCardInfo("Alistair, the Brigadier", 112, Rarity.RARE, mage.cards.a.AlistairTheBrigadier.class));
|
||||
cards.add(new SetCardInfo("All of History, All at Once", 34, Rarity.RARE, mage.cards.a.AllOfHistoryAllAtOnce.class));
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
package mage.abilities.keyword;
|
||||
|
||||
import mage.ApprovingObject;
|
||||
import mage.MageObjectReference;
|
||||
import mage.Mana;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.costs.mana.ManaCost;
|
||||
import mage.abilities.costs.mana.ManaCosts;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.mana.ManaOptions;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.Outcome;
|
||||
|
|
@ -26,10 +28,11 @@ import java.util.UUID;
|
|||
public class EmergeAbility extends SpellAbility {
|
||||
|
||||
private final ManaCosts<ManaCost> emergeCost;
|
||||
public static final String EMERGE_ACTIVATION_CREATURE_REFERENCE = "emergeActivationMOR";
|
||||
|
||||
public EmergeAbility(Card card, ManaCosts<ManaCost> emergeCost) {
|
||||
public EmergeAbility(Card card, String emergeString) {
|
||||
super(card.getSpellAbility());
|
||||
this.emergeCost = emergeCost.copy();
|
||||
this.emergeCost = new ManaCostsImpl<>(emergeString);
|
||||
this.newId(); // Set newId because cards spell ability is copied and needs own id
|
||||
this.setCardName(card.getName() + " with emerge");
|
||||
zone = Zone.HAND;
|
||||
|
|
@ -94,7 +97,9 @@ public class EmergeAbility extends SpellAbility {
|
|||
if (creature != null) {
|
||||
CardUtil.reduceCost(this, creature.getManaValue());
|
||||
if (super.activate(game, false)) {
|
||||
MageObjectReference mor = new MageObjectReference(creature, game);
|
||||
if (creature.sacrifice(this, game)) {
|
||||
this.setCostsTag(EMERGE_ACTIVATION_CREATURE_REFERENCE, mor); //Can access with LKI afterwards
|
||||
return true;
|
||||
} else {
|
||||
activated = false;
|
||||
|
|
|
|||
29
Mage/src/main/java/mage/game/permanent/token/AlienToken.java
Normal file
29
Mage/src/main/java/mage/game/permanent/token/AlienToken.java
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
|
||||
package mage.game.permanent.token;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
|
||||
/**
|
||||
* @author notgreat
|
||||
*/
|
||||
public final class AlienToken extends TokenImpl {
|
||||
|
||||
public AlienToken() {
|
||||
super("Alien Token", "2/2 white Alien creature token");
|
||||
cardType.add(CardType.CREATURE);
|
||||
color.setWhite(true);
|
||||
subtype.add(SubType.ALIEN);
|
||||
power = new MageInt(2);
|
||||
toughness = new MageInt(2);
|
||||
}
|
||||
|
||||
protected AlienToken(final AlienToken token) {
|
||||
super(token);
|
||||
}
|
||||
|
||||
public AlienToken copy() {
|
||||
return new AlienToken(this);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue