mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 03:51:58 -08:00
[ONE] Implement Elesh Norn, Mother of Machines (#9811)
Co-authored-by: Evan Kranzler <theelk801@gmail.com>
This commit is contained in:
parent
cfbe6df16d
commit
c89f3bac00
1 changed files with 146 additions and 0 deletions
146
Mage.Sets/src/mage/cards/e/EleshNornMotherOfMachines.java
Normal file
146
Mage.Sets/src/mage/cards/e/EleshNornMotherOfMachines.java
Normal file
|
|
@ -0,0 +1,146 @@
|
||||||
|
package mage.cards.e;
|
||||||
|
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.MageObject;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.TriggeredAbility;
|
||||||
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
|
||||||
|
import mage.abilities.effects.ReplacementEffectImpl;
|
||||||
|
import mage.abilities.keyword.VigilanceAbility;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.*;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.events.EntersTheBattlefieldEvent;
|
||||||
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.game.events.NumberOfTriggersEvent;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author PurpleCrowbar
|
||||||
|
*/
|
||||||
|
public final class EleshNornMotherOfMachines extends CardImpl {
|
||||||
|
|
||||||
|
public EleshNornMotherOfMachines(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{W}");
|
||||||
|
|
||||||
|
this.addSuperType(SuperType.LEGENDARY);
|
||||||
|
this.subtype.add(SubType.PHYREXIAN, SubType.PRAETOR);
|
||||||
|
this.power = new MageInt(4);
|
||||||
|
this.toughness = new MageInt(7);
|
||||||
|
|
||||||
|
// Vigilance
|
||||||
|
this.addAbility(VigilanceAbility.getInstance());
|
||||||
|
|
||||||
|
// If a permanent entering the battlefield causes a triggered ability of a permanent you control to trigger, that ability triggers an additional time.
|
||||||
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new EleshNornMotherOfMachinesDoublingEffect()));
|
||||||
|
|
||||||
|
// Permanents entering the battlefield don't cause abilities of permanents your opponents control to trigger.
|
||||||
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new EleshNornMotherOfMachinesPreventionEffect()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private EleshNornMotherOfMachines(final EleshNornMotherOfMachines card) {super(card);}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EleshNornMotherOfMachines copy() {return new EleshNornMotherOfMachines(this);}
|
||||||
|
}
|
||||||
|
|
||||||
|
class EleshNornMotherOfMachinesDoublingEffect extends ReplacementEffectImpl {
|
||||||
|
|
||||||
|
EleshNornMotherOfMachinesDoublingEffect() {
|
||||||
|
super(Duration.WhileOnBattlefield, Outcome.Benefit);
|
||||||
|
staticText = "If a permanent entering the battlefield causes a triggered ability of a permanent you control to trigger, that ability triggers an additional time";
|
||||||
|
}
|
||||||
|
|
||||||
|
EleshNornMotherOfMachinesDoublingEffect(final EleshNornMotherOfMachinesDoublingEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EleshNornMotherOfMachinesDoublingEffect copy() {
|
||||||
|
return new EleshNornMotherOfMachinesDoublingEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == GameEvent.EventType.NUMBER_OF_TRIGGERS;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
|
if (event instanceof NumberOfTriggersEvent) {
|
||||||
|
NumberOfTriggersEvent numberOfTriggersEvent = (NumberOfTriggersEvent) event;
|
||||||
|
// Only triggers of the controller of Elesh Norn
|
||||||
|
if (source.isControlledBy(event.getPlayerId())) {
|
||||||
|
GameEvent sourceEvent = numberOfTriggersEvent.getSourceEvent();
|
||||||
|
// Only EtB triggers
|
||||||
|
if (sourceEvent != null
|
||||||
|
&& sourceEvent.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD
|
||||||
|
&& sourceEvent instanceof EntersTheBattlefieldEvent) {
|
||||||
|
EntersTheBattlefieldEvent entersTheBattlefieldEvent = (EntersTheBattlefieldEvent) sourceEvent;
|
||||||
|
// Only for triggers of permanents
|
||||||
|
if (game.getPermanent(numberOfTriggersEvent.getSourceId()) != null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
|
event.setAmount(event.getAmount() + 1);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class EleshNornMotherOfMachinesPreventionEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
|
|
||||||
|
EleshNornMotherOfMachinesPreventionEffect() {
|
||||||
|
super(Duration.WhileOnBattlefield, Outcome.Detriment, false, false);
|
||||||
|
staticText = "Permanents entering the battlefield don't cause abilities of permanents your opponents control to trigger";
|
||||||
|
}
|
||||||
|
|
||||||
|
EleshNornMotherOfMachinesPreventionEffect(final EleshNornMotherOfMachinesPreventionEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EleshNornMotherOfMachinesPreventionEffect copy() {return new EleshNornMotherOfMachinesPreventionEffect(this);}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
|
Ability ability = (Ability) getValue("targetAbility");
|
||||||
|
if (ability != null && ability.getAbilityType() == AbilityType.TRIGGERED && game.getOpponents(source.getControllerId()).contains(ability.getControllerId())) {
|
||||||
|
Permanent enteringPermanent = ((EntersTheBattlefieldEvent) event).getTarget();
|
||||||
|
if (enteringPermanent != null) {
|
||||||
|
return (((TriggeredAbility) ability).checkTrigger(event, game));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getInfoMessage(Ability source, GameEvent event, Game game) {
|
||||||
|
MageObject enteringObject = game.getObject(event.getSourceId());
|
||||||
|
MageObject sourceObject = game.getObject(source);
|
||||||
|
Ability ability = (Ability) getValue("targetAbility");
|
||||||
|
if (enteringObject != null && sourceObject != null && ability != null) {
|
||||||
|
MageObject abilitObject = game.getObject(ability.getSourceId());
|
||||||
|
if (abilitObject != null) {
|
||||||
|
return sourceObject.getLogName() + " prevented ability of " + abilitObject.getLogName()
|
||||||
|
+ " to trigger for " + enteringObject.getLogName() + " entering the battlefield.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue