mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
Merge pull request #5082 from NoahGleason/Aetherplasm
Implement Aetherplasm
This commit is contained in:
commit
484d981c81
3 changed files with 100 additions and 0 deletions
98
Mage.Sets/src/mage/cards/a/Aetherplasm.java
Normal file
98
Mage.Sets/src/mage/cards/a/Aetherplasm.java
Normal file
|
@ -0,0 +1,98 @@
|
|||
package mage.cards.a;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BlocksTriggeredAbility;
|
||||
import mage.abilities.costs.common.ReturnToHandFromBattlefieldSourceCost;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.DoIfCostPaid;
|
||||
import mage.abilities.effects.common.PutCardFromHandOntoBattlefieldEffect;
|
||||
import mage.abilities.effects.common.ReturnToHandSourceEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.combat.CombatGroup;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInHand;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author noahg
|
||||
*/
|
||||
public final class Aetherplasm extends CardImpl {
|
||||
|
||||
public Aetherplasm(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}{U}");
|
||||
|
||||
this.subtype.add(SubType.ILLUSION);
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(1);
|
||||
|
||||
// Whenever Aetherplasm blocks a creature, you may return Aetherplasm to its owner's hand. If you do, you may put a creature card from your hand onto the battlefield blocking that creature.
|
||||
this.addAbility(new BlocksTriggeredAbility
|
||||
(new DoIfCostPaid(new AetherplasmEffect(), new ReturnToHandFromBattlefieldSourceCost()), false, true));
|
||||
}
|
||||
|
||||
public Aetherplasm(final Aetherplasm card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Aetherplasm copy() {
|
||||
return new Aetherplasm(this);
|
||||
}
|
||||
}
|
||||
|
||||
class AetherplasmEffect extends OneShotEffect {
|
||||
|
||||
public AetherplasmEffect() {
|
||||
super(Outcome.PutCardInPlay);
|
||||
this.staticText = "you may put a creature card from your hand onto the battlefield blocking that creature";
|
||||
}
|
||||
|
||||
public AetherplasmEffect(AetherplasmEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent blockedCreature = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
if (player.chooseUse(Outcome.PutCardInPlay, "Put a creature card from your hand onto the battlefield?", source, game)) {
|
||||
TargetCardInHand target = new TargetCardInHand(StaticFilters.FILTER_CARD_CREATURE_A);
|
||||
if (player.choose(Outcome.PutCardInPlay, target, source.getSourceId(), game)) {
|
||||
Card card = game.getCard(target.getFirstTarget());
|
||||
if (card != null) {
|
||||
if(player.moveCards(card, Zone.BATTLEFIELD, source, game, false, false, false, null)
|
||||
&& game.getCombat() != null && blockedCreature != null){
|
||||
CombatGroup attacker = game.getCombat().findGroup(blockedCreature.getId());
|
||||
Permanent putIntoPlay = game.getPermanent(target.getFirstTarget());
|
||||
if (putIntoPlay != null && putIntoPlay.isCreature() &&attacker != null) {
|
||||
game.getCombat().findGroup(blockedCreature.getId()).addBlocker(putIntoPlay.getId(), source.getControllerId(), game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AetherplasmEffect copy() {
|
||||
return new AetherplasmEffect(this);
|
||||
}
|
||||
}
|
|
@ -29,6 +29,7 @@ public final class Guildpact extends ExpansionSet {
|
|||
this.ratioBoosterMythic = 0;
|
||||
cards.add(new SetCardInfo("Absolver Thrull", 1, Rarity.COMMON, mage.cards.a.AbsolverThrull.class));
|
||||
cards.add(new SetCardInfo("Abyssal Nocturnus", 43, Rarity.RARE, mage.cards.a.AbyssalNocturnus.class));
|
||||
cards.add(new SetCardInfo("Aetherplasm", 22, Rarity.UNCOMMON, mage.cards.a.Aetherplasm.class));
|
||||
cards.add(new SetCardInfo("Agent of Masks", 100, Rarity.UNCOMMON, mage.cards.a.AgentOfMasks.class));
|
||||
cards.add(new SetCardInfo("Angel of Despair", 101, Rarity.RARE, mage.cards.a.AngelOfDespair.class));
|
||||
cards.add(new SetCardInfo("Battering Wurm", 79, Rarity.UNCOMMON, mage.cards.b.BatteringWurm.class));
|
||||
|
|
|
@ -141,6 +141,7 @@ public class DoIfCostPaid extends OneShotEffect {
|
|||
String costText = cost.getText();
|
||||
if (costText != null
|
||||
&& !costText.toLowerCase(Locale.ENGLISH).startsWith("put")
|
||||
&& !costText.toLowerCase(Locale.ENGLISH).startsWith("return")
|
||||
&& !costText.toLowerCase(Locale.ENGLISH).startsWith("exile")
|
||||
&& !costText.toLowerCase(Locale.ENGLISH).startsWith("discard")
|
||||
&& !costText.toLowerCase(Locale.ENGLISH).startsWith("sacrifice")
|
||||
|
|
Loading…
Reference in a new issue