mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
Implement Benevolent Unicorn
This commit is contained in:
parent
23271d9b9b
commit
465d8ba254
2 changed files with 95 additions and 0 deletions
94
Mage.Sets/src/mage/cards/b/BenevolentUnicorn.java
Normal file
94
Mage.Sets/src/mage/cards/b/BenevolentUnicorn.java
Normal file
|
@ -0,0 +1,94 @@
|
|||
|
||||
package mage.cards.b;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.game.stack.StackObject;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LoneFox, Ketsuban
|
||||
|
||||
*/
|
||||
public final class BenevolentUnicorn extends CardImpl {
|
||||
|
||||
public BenevolentUnicorn(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{W}");
|
||||
this.subtype.add(SubType.UNICORN);
|
||||
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(2);
|
||||
|
||||
// If a spell would deal damage to a permanent or player, it deals that much damage minus 1 to that permanent or player instead.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BenevolentUnicornEffect()));
|
||||
}
|
||||
|
||||
public BenevolentUnicorn(final BenevolentUnicorn card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BenevolentUnicorn copy() {
|
||||
return new BenevolentUnicorn(this);
|
||||
}
|
||||
}
|
||||
|
||||
class BenevolentUnicornEffect extends ReplacementEffectImpl {
|
||||
|
||||
public BenevolentUnicornEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Benefit);
|
||||
staticText = "If a spell would deal damage to a permanent or player, it deals that much damage minus 1 to that permanent or player instead.";
|
||||
}
|
||||
|
||||
public BenevolentUnicornEffect(final BenevolentUnicornEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BenevolentUnicornEffect copy() {
|
||||
return new BenevolentUnicornEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
event.setAmount(event.getAmount() - 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == EventType.DAMAGE_CREATURE || event.getType() == EventType.DAMAGE_PLANESWALKER || event.getType() == EventType.DAMAGE_PLAYER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
StackObject stackObject = game.getStack().getStackObject(event.getSourceId());
|
||||
if (stackObject == null) {
|
||||
stackObject = (StackObject) game.getLastKnownInformation(event.getSourceId(), Zone.STACK);
|
||||
}
|
||||
if (stackObject instanceof Spell) {
|
||||
return super.applies(event, source, game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -45,6 +45,7 @@ public final class Mirage extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Barbed-Back Wurm", 105, Rarity.UNCOMMON, mage.cards.b.BarbedBackWurm.class));
|
||||
cards.add(new SetCardInfo("Bay Falcon", 54, Rarity.COMMON, mage.cards.b.BayFalcon.class));
|
||||
cards.add(new SetCardInfo("Bazaar of Wonders", 55, Rarity.RARE, mage.cards.b.BazaarOfWonders.class));
|
||||
cards.add(new SetCardInfo("Benevolent Unicorn", 4, Rarity.COMMON, mage.cards.b.BenevolentUnicorn.class));
|
||||
cards.add(new SetCardInfo("Benthic Djinn", 257, Rarity.RARE, mage.cards.b.BenthicDjinn.class));
|
||||
cards.add(new SetCardInfo("Binding Agony", 106, Rarity.COMMON, mage.cards.b.BindingAgony.class));
|
||||
cards.add(new SetCardInfo("Blighted Shaman", 107, Rarity.UNCOMMON, mage.cards.b.BlightedShaman.class));
|
||||
|
|
Loading…
Reference in a new issue