1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-03-23 11:15:37 -09:00

[C21] Implemented Inkshield

This commit is contained in:
Evan Kranzler 2021-04-14 08:33:34 -04:00
parent 644d3e413b
commit 06aba8beff
2 changed files with 75 additions and 0 deletions
Mage.Sets/src/mage

View file

@ -0,0 +1,74 @@
package mage.cards.i;
import mage.abilities.Ability;
import mage.abilities.effects.PreventionEffectData;
import mage.abilities.effects.PreventionEffectImpl;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.token.SilverquillToken;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class Inkshield extends CardImpl {
public Inkshield(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{W}{B}");
// Prevent all combat damage that would be dealt to you this turn. For each 1 damage prevented this way, create a 2/1 white and black Inkling creature token with flying.
this.getSpellAbility().addEffect(new InkshieldEffect());
}
private Inkshield(final Inkshield card) {
super(card);
}
@Override
public Inkshield copy() {
return new Inkshield(this);
}
}
class InkshieldEffect extends PreventionEffectImpl {
InkshieldEffect() {
super(Duration.EndOfTurn, Integer.MAX_VALUE, true, false);
staticText = "prevent all combat damage that would be dealt to you this turn. " +
"For each 1 damage prevented this way, create a 2/1 white and black Inkling creature token with flying";
}
private InkshieldEffect(final InkshieldEffect effect) {
super(effect);
}
@Override
public InkshieldEffect copy() {
return new InkshieldEffect(this);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGE_PLAYER;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return super.applies(event, source, game) && source.isControlledBy(event.getTargetId());
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
PreventionEffectData preventionEffectData = preventDamageAction(event, source, game);
if (preventionEffectData.getPreventedDamage() > 0) {
new CreateTokenEffect(new SilverquillToken(), preventionEffectData.getPreventedDamage()).apply(game, source);
}
return true;
}
}

View file

@ -149,6 +149,7 @@ public final class Commander2021Edition extends ExpansionSet {
cards.add(new SetCardInfo("Incubation Druid", 195, Rarity.RARE, mage.cards.i.IncubationDruid.class));
cards.add(new SetCardInfo("Infernal Offering", 146, Rarity.RARE, mage.cards.i.InfernalOffering.class));
cards.add(new SetCardInfo("Inferno Project", 52, Rarity.RARE, mage.cards.i.InfernoProject.class));
cards.add(new SetCardInfo("Inkshield", 71, Rarity.RARE, mage.cards.i.Inkshield.class));
cards.add(new SetCardInfo("Inspiring Refrain", 27, Rarity.RARE, mage.cards.i.InspiringRefrain.class));
cards.add(new SetCardInfo("Izzet Boilerworks", 294, Rarity.UNCOMMON, mage.cards.i.IzzetBoilerworks.class));
cards.add(new SetCardInfo("Izzet Signet", 247, Rarity.COMMON, mage.cards.i.IzzetSignet.class));