mirror of
https://github.com/correl/mage.git
synced 2025-01-12 03:00:13 +00:00
Implemented Druid of Horns
This commit is contained in:
parent
85b6d8408a
commit
63b4d4346c
2 changed files with 107 additions and 0 deletions
106
Mage.Sets/src/mage/cards/d/DruidOfHorns.java
Normal file
106
Mage.Sets/src/mage/cards/d/DruidOfHorns.java
Normal file
|
@ -0,0 +1,106 @@
|
|||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.constants.SubType;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.token.BeastToken;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.target.Target;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class DruidOfHorns extends CardImpl {
|
||||
|
||||
public DruidOfHorns(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}");
|
||||
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.DRUID);
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(3);
|
||||
|
||||
// Whenever you cast an Aura spell that targets Druid of Horns, create a 3/3 green Beast creature token.
|
||||
this.addAbility(new DruidOfHornsTriggeredAbility());
|
||||
}
|
||||
|
||||
public DruidOfHorns(final DruidOfHorns card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DruidOfHorns copy() {
|
||||
return new DruidOfHorns(this);
|
||||
}
|
||||
}
|
||||
|
||||
class DruidOfHornsTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public DruidOfHornsTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new CreateTokenEffect(new BeastToken()), false);
|
||||
}
|
||||
|
||||
public DruidOfHornsTriggeredAbility(final DruidOfHornsTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DruidOfHornsTriggeredAbility copy() {
|
||||
return new DruidOfHornsTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.SPELL_CAST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getPlayerId().equals(this.getControllerId())) {
|
||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||
if (checkSpell(spell, game)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean checkSpell(Spell spell, Game game) {
|
||||
if (spell != null && spell.hasSubtype(SubType.AURA, game)) {
|
||||
SpellAbility sa = spell.getSpellAbility();
|
||||
for (UUID modeId : sa.getModes().getSelectedModes()) {
|
||||
Mode mode = sa.getModes().get(modeId);
|
||||
for (Target target : mode.getTargets()) {
|
||||
if (!target.isNotTarget() && target.getTargets().contains(this.getSourceId())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
for (Effect effect : mode.getEffects()) {
|
||||
for (UUID targetId : effect.getTargetPointer().getTargets(game, sa)) {
|
||||
if (targetId.equals(this.getSourceId())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever you cast an Aura spell that targets {this}, " + super.getRule();
|
||||
}
|
||||
}
|
|
@ -85,6 +85,7 @@ public final class CoreSet2019 extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Djinn of Wishes", 52, Rarity.RARE, mage.cards.d.DjinnOfWishes.class));
|
||||
cards.add(new SetCardInfo("Draconic Disciple", 215, Rarity.UNCOMMON, mage.cards.d.DraconicDisciple.class));
|
||||
cards.add(new SetCardInfo("Dragon's Hoard", 232, Rarity.RARE, mage.cards.d.DragonsHoard.class));
|
||||
cards.add(new SetCardInfo("Druid of Horns", 176, Rarity.UNCOMMON, mage.cards.d.DruidOfHorns.class));
|
||||
cards.add(new SetCardInfo("Druid of the Cowl", 177, Rarity.COMMON, mage.cards.d.DruidOfTheCowl.class));
|
||||
cards.add(new SetCardInfo("Dryad Greenseeker", 178, Rarity.UNCOMMON, mage.cards.d.DryadGreenseeker.class));
|
||||
cards.add(new SetCardInfo("Dwarven Priest", 11, Rarity.COMMON, mage.cards.d.DwarvenPriest.class));
|
||||
|
|
Loading…
Reference in a new issue