[BRO] Implement Myrel, Shield of Argive

This commit is contained in:
Evan Kranzler 2022-11-10 10:04:30 -05:00
parent 3dc3214388
commit ad67623763
4 changed files with 138 additions and 69 deletions

View file

@ -1,23 +1,14 @@
package mage.cards.g;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.abilities.effects.common.ruleModifying.CantCastOrActivateOpponentsYourTurnEffect;
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.permanent.Permanent;
import mage.players.Player;
import java.util.UUID;
/**
* @author nantuko
@ -25,7 +16,7 @@ import mage.players.Player;
public final class GrandAbolisher extends CardImpl {
public GrandAbolisher(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{W}{W}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}{W}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.CLERIC);
@ -33,7 +24,7 @@ public final class GrandAbolisher extends CardImpl {
this.toughness = new MageInt(2);
// During your turn, your opponents can't cast spells or activate abilities of artifacts, creatures, or enchantments.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GrandAbolisherEffect()));
this.addAbility(new SimpleStaticAbility(new CantCastOrActivateOpponentsYourTurnEffect()));
}
private GrandAbolisher(final GrandAbolisher card) {
@ -45,58 +36,3 @@ public final class GrandAbolisher extends CardImpl {
return new GrandAbolisher(this);
}
}
class GrandAbolisherEffect extends ContinuousRuleModifyingEffectImpl {
public GrandAbolisherEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit);
staticText = "During your turn, your opponents can't cast spells or activate abilities of artifacts, creatures, or enchantments";
}
public GrandAbolisherEffect(final GrandAbolisherEffect effect) {
super(effect);
}
@Override
public GrandAbolisherEffect copy() {
return new GrandAbolisherEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public String getInfoMessage(Ability source, GameEvent event, Game game) {
Player activePlayer = game.getPlayer(game.getActivePlayerId());
MageObject mageObject = game.getObject(source);
if (activePlayer != null && mageObject != null) {
return "You can't cast spells or activate abilities of artifacts, creatures, or enchantments during the turns of " + activePlayer.getLogName() +
" (" + mageObject.getLogName() + ')';
}
return null;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.CAST_SPELL || event.getType() == GameEvent.EventType.ACTIVATE_ABILITY;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (game.isActivePlayer(source.getControllerId()) && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
switch(event.getType()) {
case CAST_SPELL:
return true;
case ACTIVATE_ABILITY:
Permanent permanent = game.getPermanent(event.getSourceId());
if (permanent != null) {
return permanent.isArtifact(game) || permanent.isCreature(game)
|| permanent.isEnchantment(game);
}
}
}
return false;
}
}

View file

@ -0,0 +1,58 @@
package mage.cards.m;
import mage.MageInt;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.ruleModifying.CantCastOrActivateOpponentsYourTurnEffect;
import mage.abilities.hint.Hint;
import mage.abilities.hint.ValueHint;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.filter.common.FilterControlledPermanent;
import mage.game.permanent.token.SoldierArtifactToken;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class MyrelShieldOfArgive extends CardImpl {
private static final DynamicValue xValue = new PermanentsOnBattlefieldCount(
new FilterControlledPermanent(SubType.SOLDIER), null
);
private static final Hint hint = new ValueHint("Soldiers you control", xValue);
public MyrelShieldOfArgive(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.SOLDIER);
this.power = new MageInt(3);
this.toughness = new MageInt(4);
// During your turn, your opponents can't cast spells or activate abilities of artifacts, creatures, or enchantments.
this.addAbility(new SimpleStaticAbility(new CantCastOrActivateOpponentsYourTurnEffect()));
// Whenever Myrel, Shield of Argive attacks, create X 1/1 colorless Soldier artifact creature tokens, where X is the number of Soldiers you control.
this.addAbility(new AttacksTriggeredAbility(
new CreateTokenEffect(new SoldierArtifactToken(), xValue)
).addHint(hint));
}
private MyrelShieldOfArgive(final MyrelShieldOfArgive card) {
super(card);
}
@Override
public MyrelShieldOfArgive copy() {
return new MyrelShieldOfArgive(this);
}
}

View file

@ -186,6 +186,7 @@ public final class TheBrothersWar extends ExpansionSet {
cards.add(new SetCardInfo("Moment of Defiance", 108, Rarity.COMMON, mage.cards.m.MomentOfDefiance.class));
cards.add(new SetCardInfo("Monastery Swiftspear", 144, Rarity.UNCOMMON, mage.cards.m.MonasterySwiftspear.class));
cards.add(new SetCardInfo("Mountain", 274, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Myrel, Shield of Argive", 18, Rarity.MYTHIC, mage.cards.m.MyrelShieldOfArgive.class));
cards.add(new SetCardInfo("No One Left Behind", 109, Rarity.UNCOMMON, mage.cards.n.NoOneLeftBehind.class));
cards.add(new SetCardInfo("Obliterating Bolt", 145, Rarity.UNCOMMON, mage.cards.o.ObliteratingBolt.class));
cards.add(new SetCardInfo("Obstinate Baloth", 187, Rarity.UNCOMMON, mage.cards.o.ObstinateBaloth.class));

View file

@ -0,0 +1,74 @@
package mage.abilities.effects.common.ruleModifying;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
* @author TheElk801
*/
public class CantCastOrActivateOpponentsYourTurnEffect extends ContinuousRuleModifyingEffectImpl {
public CantCastOrActivateOpponentsYourTurnEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit);
staticText = "during your turn, your opponents can't cast spells " +
"or activate abilities of artifacts, creatures, or enchantments";
}
public CantCastOrActivateOpponentsYourTurnEffect(final CantCastOrActivateOpponentsYourTurnEffect effect) {
super(effect);
}
@Override
public CantCastOrActivateOpponentsYourTurnEffect copy() {
return new CantCastOrActivateOpponentsYourTurnEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public String getInfoMessage(Ability source, GameEvent event, Game game) {
Player activePlayer = game.getPlayer(game.getActivePlayerId());
MageObject mageObject = game.getObject(source);
if (activePlayer == null || mageObject == null) {
return null;
}
return "You can't cast spells or activate abilities of artifacts, " +
"creatures, or enchantments during the turns of " +
activePlayer.getLogName() + " (" + mageObject.getLogName() + ')';
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.CAST_SPELL
|| event.getType() == GameEvent.EventType.ACTIVATE_ABILITY;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (!game.isActivePlayer(source.getControllerId())
|| !game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
return false;
}
switch (event.getType()) {
case CAST_SPELL:
return true;
case ACTIVATE_ABILITY:
Permanent permanent = game.getPermanent(event.getSourceId());
return permanent != null
&& permanent.isArtifact(game)
|| permanent.isCreature(game)
|| permanent.isEnchantment(game);
}
return false;
}
}