mirror of
https://github.com/correl/mage.git
synced 2024-12-27 20:06:31 +00:00
Implemented Hateful Eidolon
This commit is contained in:
parent
107fd080b9
commit
f23841ce02
2 changed files with 105 additions and 0 deletions
104
Mage.Sets/src/mage/cards/h/HatefulEidolon.java
Normal file
104
Mage.Sets/src/mage/cards/h/HatefulEidolon.java
Normal file
|
@ -0,0 +1,104 @@
|
||||||
|
package mage.cards.h;
|
||||||
|
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.MageItem;
|
||||||
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
|
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||||
|
import mage.abilities.keyword.LifelinkAbility;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.SubType;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import mage.filter.FilterPermanent;
|
||||||
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
|
import mage.filter.predicate.permanent.EnchantedPredicate;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.game.events.ZoneChangeEvent;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public final class HatefulEidolon extends CardImpl {
|
||||||
|
|
||||||
|
public HatefulEidolon(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT, CardType.CREATURE}, "{B}");
|
||||||
|
|
||||||
|
this.subtype.add(SubType.SPIRIT);
|
||||||
|
this.power = new MageInt(1);
|
||||||
|
this.toughness = new MageInt(2);
|
||||||
|
|
||||||
|
// Lifelink
|
||||||
|
this.addAbility(LifelinkAbility.getInstance());
|
||||||
|
|
||||||
|
// Whenever an enchanted creature dies, draw a card for each Aura you controlled that was attached to it.
|
||||||
|
this.addAbility(new HatefulEidolonTriggeredAbility());
|
||||||
|
}
|
||||||
|
|
||||||
|
private HatefulEidolon(final HatefulEidolon card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HatefulEidolon copy() {
|
||||||
|
return new HatefulEidolon(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class HatefulEidolonTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
|
private static final FilterPermanent filter = new FilterCreaturePermanent();
|
||||||
|
|
||||||
|
static {
|
||||||
|
filter.add(EnchantedPredicate.instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
HatefulEidolonTriggeredAbility() {
|
||||||
|
super(Zone.BATTLEFIELD, null, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private HatefulEidolonTriggeredAbility(final HatefulEidolonTriggeredAbility ability) {
|
||||||
|
super(ability);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HatefulEidolonTriggeredAbility copy() {
|
||||||
|
return new HatefulEidolonTriggeredAbility(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == GameEvent.EventType.ZONE_CHANGE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
|
ZoneChangeEvent zEvent = (ZoneChangeEvent) event;
|
||||||
|
if (!zEvent.isDiesEvent() || !filter.match(zEvent.getTarget(), game)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
int auraCount = zEvent
|
||||||
|
.getTarget()
|
||||||
|
.getAttachments()
|
||||||
|
.stream()
|
||||||
|
.map(game::getPermanentOrLKIBattlefield)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.filter(permanent -> permanent.hasSubtype(SubType.AURA, game))
|
||||||
|
.map(MageItem::getId)
|
||||||
|
.filter(this.getControllerId()::equals)
|
||||||
|
.mapToInt(x -> 1)
|
||||||
|
.sum();
|
||||||
|
this.getEffects().clear();
|
||||||
|
this.addEffect(new DrawCardSourceControllerEffect(auraCount));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getRule() {
|
||||||
|
return "Whenever an enchanted creature dies, draw a card for each Aura you controlled that was attached to it.";
|
||||||
|
}
|
||||||
|
}
|
|
@ -86,6 +86,7 @@ public final class TherosBeyondDeath extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Grasping Giant", 288, Rarity.RARE, mage.cards.g.GraspingGiant.class));
|
cards.add(new SetCardInfo("Grasping Giant", 288, Rarity.RARE, mage.cards.g.GraspingGiant.class));
|
||||||
cards.add(new SetCardInfo("Gray Merchant of Asphodel", 99, Rarity.UNCOMMON, mage.cards.g.GrayMerchantOfAsphodel.class));
|
cards.add(new SetCardInfo("Gray Merchant of Asphodel", 99, Rarity.UNCOMMON, mage.cards.g.GrayMerchantOfAsphodel.class));
|
||||||
cards.add(new SetCardInfo("Haktos the Unscarred", 218, Rarity.RARE, mage.cards.h.HaktosTheUnscarred.class));
|
cards.add(new SetCardInfo("Haktos the Unscarred", 218, Rarity.RARE, mage.cards.h.HaktosTheUnscarred.class));
|
||||||
|
cards.add(new SetCardInfo("Hateful Eidolon", 101, Rarity.UNCOMMON, mage.cards.h.HatefulEidolon.class));
|
||||||
cards.add(new SetCardInfo("Heliod's Intervention", 19, Rarity.RARE, mage.cards.h.HeliodsIntervention.class));
|
cards.add(new SetCardInfo("Heliod's Intervention", 19, Rarity.RARE, mage.cards.h.HeliodsIntervention.class));
|
||||||
cards.add(new SetCardInfo("Heliod's Pilgrim", 20, Rarity.COMMON, mage.cards.h.HeliodsPilgrim.class));
|
cards.add(new SetCardInfo("Heliod's Pilgrim", 20, Rarity.COMMON, mage.cards.h.HeliodsPilgrim.class));
|
||||||
cards.add(new SetCardInfo("Heliod, Sun-Crowned", 18, Rarity.MYTHIC, mage.cards.h.HeliodSunCrowned.class));
|
cards.add(new SetCardInfo("Heliod, Sun-Crowned", 18, Rarity.MYTHIC, mage.cards.h.HeliodSunCrowned.class));
|
||||||
|
|
Loading…
Reference in a new issue