mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 13:32:06 -08:00
[LCI] Implement Eaten by Piranhas
This commit is contained in:
parent
1a6661e922
commit
ceca8aa5d5
2 changed files with 123 additions and 0 deletions
122
Mage.Sets/src/mage/cards/e/EatenByPiranhas.java
Normal file
122
Mage.Sets/src/mage/cards/e/EatenByPiranhas.java
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
package mage.cards.e;
|
||||
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.abilities.keyword.FlashAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author Susucr
|
||||
*/
|
||||
public final class EatenByPiranhas extends CardImpl {
|
||||
|
||||
public EatenByPiranhas(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}");
|
||||
|
||||
this.subtype.add(SubType.AURA);
|
||||
|
||||
// Flash
|
||||
this.addAbility(FlashAbility.getInstance());
|
||||
|
||||
// Enchant creature
|
||||
TargetPermanent auraTarget = new TargetCreaturePermanent();
|
||||
this.getSpellAbility().addTarget(auraTarget);
|
||||
this.getSpellAbility().addEffect(new AttachEffect(Outcome.UnboostCreature));
|
||||
this.addAbility(new EnchantAbility(auraTarget));
|
||||
|
||||
// Enchanted creature loses all abilities and is a black Skeleton creature with base power and toughness 1/1.
|
||||
this.addAbility(new SimpleStaticAbility(new EatenByPiranhasEffect()));
|
||||
}
|
||||
|
||||
private EatenByPiranhas(final EatenByPiranhas card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EatenByPiranhas copy() {
|
||||
return new EatenByPiranhas(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Inspired by {@link mage.cards.w.WitnessProtection}
|
||||
*/
|
||||
class EatenByPiranhasEffect extends ContinuousEffectImpl {
|
||||
|
||||
private static final ObjectColor color = new ObjectColor("B");
|
||||
|
||||
EatenByPiranhasEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Benefit);
|
||||
staticText = "enchanted creature loses all abilities and is a black Skeleton creature " +
|
||||
"with base power and toughness 1/1";
|
||||
}
|
||||
|
||||
private EatenByPiranhasEffect(final EatenByPiranhasEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EatenByPiranhasEffect copy() {
|
||||
return new EatenByPiranhasEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
Permanent enchantment = source.getSourcePermanentIfItStillExists(game);
|
||||
if (enchantment == null) {
|
||||
return false;
|
||||
}
|
||||
Permanent permanent = game.getPermanent(enchantment.getAttachedTo());
|
||||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
switch (layer) {
|
||||
case TypeChangingEffects_4:
|
||||
permanent.removeAllCardTypes(game);
|
||||
permanent.addCardType(game, CardType.CREATURE);
|
||||
permanent.removeAllSubTypes(game);
|
||||
permanent.addSubType(game, SubType.SKELETON);
|
||||
return true;
|
||||
case ColorChangingEffects_5:
|
||||
permanent.getColor(game).setColor(color);
|
||||
case AbilityAddingRemovingEffects_6:
|
||||
permanent.removeAllAbilities(source.getSourceId(), game);
|
||||
return true;
|
||||
case PTChangingEffects_7:
|
||||
if (sublayer == SubLayer.SetPT_7b) {
|
||||
permanent.getPower().setModifiedBaseValue(1);
|
||||
permanent.getToughness().setModifiedBaseValue(1);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasLayer(Layer layer) {
|
||||
switch (layer) {
|
||||
case TypeChangingEffects_4:
|
||||
case ColorChangingEffects_5:
|
||||
case AbilityAddingRemovingEffects_6:
|
||||
case PTChangingEffects_7:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -99,6 +99,7 @@ public final class TheLostCavernsOfIxalan extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Dreadmaw's Ire", 147, Rarity.UNCOMMON, mage.cards.d.DreadmawsIre.class));
|
||||
cards.add(new SetCardInfo("Dusk Rose Reliquary", 10, Rarity.UNCOMMON, mage.cards.d.DuskRoseReliquary.class));
|
||||
cards.add(new SetCardInfo("Earthshaker Dreadmaw", 183, Rarity.UNCOMMON, mage.cards.e.EarthshakerDreadmaw.class));
|
||||
cards.add(new SetCardInfo("Eaten by Piranhas", 54, Rarity.UNCOMMON, mage.cards.e.EatenByPiranhas.class));
|
||||
cards.add(new SetCardInfo("Echo of Dusk", 104, Rarity.COMMON, mage.cards.e.EchoOfDusk.class));
|
||||
cards.add(new SetCardInfo("Echoing Deeps", 271, Rarity.RARE, mage.cards.e.EchoingDeeps.class));
|
||||
cards.add(new SetCardInfo("Enterprising Scallywag", 148, Rarity.UNCOMMON, mage.cards.e.EnterprisingScallywag.class));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue