forked from External/mage
[C21] Implemented Battlemage's Braces
This commit is contained in:
parent
fbbdb2431d
commit
de3388348e
8 changed files with 199 additions and 218 deletions
93
Mage.Sets/src/mage/cards/b/BattlemagesBracers.java
Normal file
93
Mage.Sets/src/mage/cards/b/BattlemagesBracers.java
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
package mage.cards.b;
|
||||
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.common.CopyStackAbilityEffect;
|
||||
import mage.abilities.effects.common.DoIfCostPaid;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
|
||||
import mage.abilities.keyword.EquipAbility;
|
||||
import mage.abilities.keyword.HasteAbility;
|
||||
import mage.abilities.mana.ActivatedManaAbilityImpl;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.stack.StackAbility;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class BattlemagesBracers extends CardImpl {
|
||||
|
||||
public BattlemagesBracers(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}{R}");
|
||||
|
||||
this.subtype.add(SubType.EQUIPMENT);
|
||||
|
||||
// Equipped creature has haste.
|
||||
this.addAbility(new SimpleStaticAbility(new GainAbilityAttachedEffect(
|
||||
HasteAbility.getInstance(), AttachmentType.EQUIPMENT, Duration.WhileOnBattlefield
|
||||
)));
|
||||
|
||||
// Whenever an ability of equipped creature is activated, if it isn't a mana ability, you may pay {1}. If you do, copy that ability. You may choose new targets for the copy.
|
||||
this.addAbility(new BattlemagesBracersTriggeredAbility());
|
||||
|
||||
// Equip {2}
|
||||
this.addAbility(new EquipAbility(2));
|
||||
}
|
||||
|
||||
private BattlemagesBracers(final BattlemagesBracers card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BattlemagesBracers copy() {
|
||||
return new BattlemagesBracers(this);
|
||||
}
|
||||
}
|
||||
|
||||
class BattlemagesBracersTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
BattlemagesBracersTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new DoIfCostPaid(new CopyStackAbilityEffect(), new GenericManaCost(1)));
|
||||
}
|
||||
|
||||
private BattlemagesBracersTriggeredAbility(final BattlemagesBracersTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BattlemagesBracersTriggeredAbility copy() {
|
||||
return new BattlemagesBracersTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.ACTIVATED_ABILITY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Permanent equipment = game.getPermanent(this.getSourceId());
|
||||
if (equipment == null || !equipment.isAttachedTo(event.getSourceId())) {
|
||||
return false;
|
||||
}
|
||||
StackAbility stackAbility = (StackAbility) game.getStack().getStackObject(event.getSourceId());
|
||||
if (stackAbility == null || stackAbility.getStackAbility() instanceof ActivatedManaAbilityImpl) {
|
||||
return false;
|
||||
}
|
||||
getEffects().setValue("stackAbility", stackAbility);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever an ability of equipped creature is activated, if it isn't a mana ability, you may pay {1}. " +
|
||||
"If you do, copy that ability. You may choose new targets for the copy.";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,8 @@
|
|||
package mage.cards.i;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.CopyStackAbilityEffect;
|
||||
import mage.abilities.keyword.EquipAbility;
|
||||
import mage.abilities.mana.ActivatedManaAbilityImpl;
|
||||
import mage.cards.CardImpl;
|
||||
|
|
@ -15,10 +13,8 @@ import mage.constants.SubType;
|
|||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.stack.StackAbility;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
|
@ -51,10 +47,10 @@ public final class IllusionistsBracers extends CardImpl {
|
|||
class IllusionistsBracersTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
IllusionistsBracersTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new CopyActivatedAbilityEffect());
|
||||
super(Zone.BATTLEFIELD, new CopyStackAbilityEffect());
|
||||
}
|
||||
|
||||
IllusionistsBracersTriggeredAbility(final IllusionistsBracersTriggeredAbility ability) {
|
||||
private IllusionistsBracersTriggeredAbility(final IllusionistsBracersTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
|
|
@ -71,48 +67,20 @@ class IllusionistsBracersTriggeredAbility extends TriggeredAbilityImpl {
|
|||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Permanent equipment = game.getPermanent(this.getSourceId());
|
||||
if (equipment != null && equipment.isAttachedTo(event.getSourceId())) {
|
||||
StackAbility stackAbility = (StackAbility) game.getStack().getStackObject(event.getSourceId());
|
||||
if (!(stackAbility.getStackAbility() instanceof ActivatedManaAbilityImpl)) {
|
||||
Effect effect = this.getEffects().get(0);
|
||||
effect.setValue("stackAbility", stackAbility);
|
||||
return true;
|
||||
}
|
||||
if (equipment == null || !equipment.isAttachedTo(event.getSourceId())) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
StackAbility stackAbility = (StackAbility) game.getStack().getStackObject(event.getSourceId());
|
||||
if (stackAbility == null || stackAbility.getStackAbility() instanceof ActivatedManaAbilityImpl) {
|
||||
return false;
|
||||
}
|
||||
this.getEffects().setValue("stackAbility", stackAbility);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever an ability of equipped creature is activated, if it isn't a mana ability, copy that ability. You may choose new targets for the copy.";
|
||||
}
|
||||
}
|
||||
|
||||
class CopyActivatedAbilityEffect extends OneShotEffect {
|
||||
|
||||
public CopyActivatedAbilityEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "copy that ability. You may choose new targets for the copy";
|
||||
}
|
||||
|
||||
public CopyActivatedAbilityEffect(final CopyActivatedAbilityEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CopyActivatedAbilityEffect copy() {
|
||||
return new CopyActivatedAbilityEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
StackAbility ability = (StackAbility) getValue("stackAbility");
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
if (ability != null && controller != null && sourcePermanent != null) {
|
||||
ability.createCopyOnStack(game, source, source.getControllerId(), true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return "Whenever an ability of equipped creature is activated, if it isn't a mana ability, " +
|
||||
"copy that ability. You may choose new targets for the copy.";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,33 +1,31 @@
|
|||
|
||||
package mage.cards.k;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.costs.mana.ColoredManaCost;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.common.CopyStackAbilityEffect;
|
||||
import mage.abilities.effects.common.DoIfCostPaid;
|
||||
import mage.abilities.mana.ActivatedManaAbilityImpl;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.stack.StackAbility;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author emerald000
|
||||
*/
|
||||
public final class KurkeshOnakkeAncient extends CardImpl {
|
||||
|
||||
public KurkeshOnakkeAncient(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{R}{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}{R}");
|
||||
addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.OGRE);
|
||||
this.subtype.add(SubType.SPIRIT);
|
||||
|
|
@ -52,7 +50,7 @@ public final class KurkeshOnakkeAncient extends CardImpl {
|
|||
class KurkeshOnakkeAncientTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
KurkeshOnakkeAncientTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new KurkeshOnakkeAncientEffect(), false);
|
||||
super(Zone.BATTLEFIELD, new DoIfCostPaid(new CopyStackAbilityEffect(), new GenericManaCost(1)));
|
||||
}
|
||||
|
||||
KurkeshOnakkeAncientTriggeredAbility(final KurkeshOnakkeAncientTriggeredAbility ability) {
|
||||
|
|
@ -71,18 +69,19 @@ class KurkeshOnakkeAncientTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getPlayerId().equals(getControllerId())) {
|
||||
Card source = game.getPermanentOrLKIBattlefield(event.getSourceId());
|
||||
if (source != null && source.isArtifact()) {
|
||||
StackAbility stackAbility = (StackAbility) game.getStack().getStackObject(event.getSourceId());
|
||||
if (!(stackAbility.getStackAbility() instanceof ActivatedManaAbilityImpl)) {
|
||||
Effect effect = this.getEffects().get(0);
|
||||
effect.setValue("stackAbility", stackAbility);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (!event.getPlayerId().equals(getControllerId())) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
Card source = game.getPermanentOrLKIBattlefield(event.getSourceId());
|
||||
if (source == null || !source.isArtifact()) {
|
||||
return false;
|
||||
}
|
||||
StackAbility stackAbility = (StackAbility) game.getStack().getStackObject(event.getSourceId());
|
||||
if (stackAbility == null || stackAbility.getStackAbility() instanceof ActivatedManaAbilityImpl) {
|
||||
return false;
|
||||
}
|
||||
this.getEffects().setValue("stackAbility", stackAbility);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -90,41 +89,3 @@ class KurkeshOnakkeAncientTriggeredAbility extends TriggeredAbilityImpl {
|
|||
return "Whenever you activate an ability of an artifact, if it isn't a mana ability" + super.getRule();
|
||||
}
|
||||
}
|
||||
|
||||
class KurkeshOnakkeAncientEffect extends OneShotEffect {
|
||||
|
||||
KurkeshOnakkeAncientEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = ", you may pay {R}. If you do, copy that ability. You may choose new targets for the copy";
|
||||
}
|
||||
|
||||
KurkeshOnakkeAncientEffect(final KurkeshOnakkeAncientEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public KurkeshOnakkeAncientEffect copy() {
|
||||
return new KurkeshOnakkeAncientEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
ColoredManaCost cost = new ColoredManaCost(ColoredManaSymbol.R);
|
||||
if (player != null) {
|
||||
if (player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + "? If you do, copy that ability. You may choose new targets for the copy.", source, game)) {
|
||||
if (cost.pay(source, game, source, source.getControllerId(), false)) {
|
||||
StackAbility ability = (StackAbility) getValue("stackAbility");
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
if (ability != null && controller != null) {
|
||||
ability.createCopyOnStack(game, source, source.getControllerId(), true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,21 +1,17 @@
|
|||
package mage.cards.r;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.common.CopyStackAbilityEffect;
|
||||
import mage.abilities.effects.common.DoIfCostPaid;
|
||||
import mage.abilities.mana.ActivatedManaAbilityImpl;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.stack.StackAbility;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
|
@ -44,10 +40,10 @@ public final class RingsOfBrighthearth extends CardImpl {
|
|||
class RingsOfBrighthearthTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
RingsOfBrighthearthTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new RingsOfBrighthearthEffect(), false);
|
||||
super(Zone.BATTLEFIELD, new DoIfCostPaid(new CopyStackAbilityEffect(), new GenericManaCost(2)));
|
||||
}
|
||||
|
||||
RingsOfBrighthearthTriggeredAbility(final RingsOfBrighthearthTriggeredAbility ability) {
|
||||
private RingsOfBrighthearthTriggeredAbility(final RingsOfBrighthearthTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
|
|
@ -63,59 +59,20 @@ class RingsOfBrighthearthTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getPlayerId().equals(getControllerId())) {
|
||||
StackAbility stackAbility = (StackAbility) game.getStack().getStackObject(event.getSourceId());
|
||||
if (stackAbility != null && !(stackAbility.getStackAbility() instanceof ActivatedManaAbilityImpl)) {
|
||||
Effect effect = this.getEffects().get(0);
|
||||
effect.setValue("stackAbility", stackAbility);
|
||||
return true;
|
||||
}
|
||||
if (!event.getPlayerId().equals(getControllerId())) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
StackAbility stackAbility = (StackAbility) game.getStack().getStackObject(event.getSourceId());
|
||||
if (stackAbility == null || stackAbility.getStackAbility() instanceof ActivatedManaAbilityImpl) {
|
||||
return false;
|
||||
}
|
||||
this.getEffects().setValue("stackAbility", stackAbility);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever you activate an ability, if it isn't a mana ability, you may pay {2}. If you do, copy that ability. You may choose new targets for the copy.";
|
||||
}
|
||||
}
|
||||
|
||||
class RingsOfBrighthearthEffect extends OneShotEffect {
|
||||
|
||||
RingsOfBrighthearthEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = ", you may pay {2}. If you do, copy that ability. You may choose new targets for the copy.";
|
||||
}
|
||||
|
||||
RingsOfBrighthearthEffect(final RingsOfBrighthearthEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RingsOfBrighthearthEffect copy() {
|
||||
return new RingsOfBrighthearthEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
ManaCostsImpl cost = new ManaCostsImpl("{2}");
|
||||
if (player != null) {
|
||||
if (cost.canPay(source, source, player.getId(), game)
|
||||
&& player.chooseUse(Outcome.Benefit, "Pay " + cost.getText() + "? If you do, copy that ability. You may choose new targets for the copy.", source, game)) {
|
||||
if (cost.pay(source, game, source, source.getControllerId(), false, null)) {
|
||||
StackAbility ability = (StackAbility) getValue("stackAbility");
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
if (ability != null && controller != null && sourcePermanent != null) {
|
||||
ability.createCopyOnStack(game, source, source.getControllerId(), true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return "Whenever you activate an ability, if it isn't a mana ability, you may pay {2}. " +
|
||||
"If you do, copy that ability. You may choose new targets for the copy.";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ public final class Commander2021Edition extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Author of Shadows", 35, Rarity.RARE, mage.cards.a.AuthorOfShadows.class));
|
||||
cards.add(new SetCardInfo("Barren Moor", 277, Rarity.UNCOMMON, mage.cards.b.BarrenMoor.class));
|
||||
cards.add(new SetCardInfo("Battlefield Forge", 278, Rarity.RARE, mage.cards.b.BattlefieldForge.class));
|
||||
cards.add(new SetCardInfo("Battlemage's Bracers", 48, Rarity.RARE, mage.cards.b.BattlemagesBracers.class));
|
||||
cards.add(new SetCardInfo("Beast Within", 186, Rarity.UNCOMMON, mage.cards.b.BeastWithin.class));
|
||||
cards.add(new SetCardInfo("Biomass Mutation", 209, Rarity.RARE, mage.cards.b.BiomassMutation.class));
|
||||
cards.add(new SetCardInfo("Blasphemous Act", 159, Rarity.RARE, mage.cards.b.BlasphemousAct.class));
|
||||
|
|
|
|||
|
|
@ -48,14 +48,14 @@ public class ActivatePlaneswalkerLoyaltyAbilityTriggeredAbility extends Triggere
|
|||
|| !permanent.hasSubtype(planeswalkerSubType, game)) {
|
||||
return false;
|
||||
}
|
||||
Effect effect = this.getEffects().get(0);
|
||||
effect.setValue("stackAbility", stackAbility);
|
||||
this.getEffects().setValue("stackAbility", stackAbility);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever you activate a loyalty ability of a " + planeswalkerSubType.getDescription() + " planeswalker, " +
|
||||
this.getEffects().get(0).getText(getModes().getMode()) + ".";
|
||||
return "Whenever you activate a loyalty ability of a "
|
||||
+ planeswalkerSubType.getDescription()
|
||||
+ " planeswalker, " + super.getRule();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.game.stack.StackAbility;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class CopyStackAbilityEffect extends OneShotEffect {
|
||||
|
||||
public CopyStackAbilityEffect() {
|
||||
super(Outcome.Copy);
|
||||
staticText = "copy that ability. You may choose new targets for the copy";
|
||||
}
|
||||
|
||||
private CopyStackAbilityEffect(final CopyStackAbilityEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CopyStackAbilityEffect copy() {
|
||||
return new CopyStackAbilityEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
StackAbility ability = (StackAbility) getValue("stackAbility");
|
||||
if (controller == null || ability == null) {
|
||||
return false;
|
||||
}
|
||||
ability.createCopyOnStack(game, source, source.getControllerId(), true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,19 +1,15 @@
|
|||
package mage.game.command.emblems;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.CopyStackAbilityEffect;
|
||||
import mage.abilities.mana.ActivatedManaAbilityImpl;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.command.Emblem;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.stack.StackAbility;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class RowanKenrithEmblem extends Emblem {
|
||||
|
|
@ -28,10 +24,10 @@ public final class RowanKenrithEmblem extends Emblem {
|
|||
class RowanKenrithEmblemTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
RowanKenrithEmblemTriggeredAbility() {
|
||||
super(Zone.COMMAND, new RowanKenrithEmblemEffect(), false);
|
||||
super(Zone.COMMAND, new CopyStackAbilityEffect(), false);
|
||||
}
|
||||
|
||||
RowanKenrithEmblemTriggeredAbility(final RowanKenrithEmblemTriggeredAbility ability) {
|
||||
private RowanKenrithEmblemTriggeredAbility(final RowanKenrithEmblemTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
|
|
@ -47,15 +43,15 @@ class RowanKenrithEmblemTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getPlayerId().equals(getControllerId())) {
|
||||
StackAbility stackAbility = (StackAbility) game.getStack().getStackObject(event.getSourceId());
|
||||
if (stackAbility != null
|
||||
&& !(stackAbility.getStackAbility() instanceof ActivatedManaAbilityImpl)) {
|
||||
game.getState().setValue("rowanStackAbility", stackAbility);
|
||||
return true;
|
||||
}
|
||||
if (!event.getPlayerId().equals(getControllerId())) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
StackAbility stackAbility = (StackAbility) game.getStack().getStackObject(event.getSourceId());
|
||||
if (stackAbility == null || stackAbility.getStackAbility() instanceof ActivatedManaAbilityImpl) {
|
||||
return false;
|
||||
}
|
||||
this.getEffects().setValue("stackAbility", stackAbility);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -63,37 +59,3 @@ class RowanKenrithEmblemTriggeredAbility extends TriggeredAbilityImpl {
|
|||
return "Whenever you activate an ability that isn't a mana ability, copy it. You may choose new targets for the copy.";
|
||||
}
|
||||
}
|
||||
|
||||
class RowanKenrithEmblemEffect extends OneShotEffect {
|
||||
|
||||
RowanKenrithEmblemEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = ", copy it. You may choose new targets for the copy.";
|
||||
}
|
||||
|
||||
RowanKenrithEmblemEffect(final RowanKenrithEmblemEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RowanKenrithEmblemEffect copy() {
|
||||
return new RowanKenrithEmblemEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
StackAbility ability = (StackAbility) game.getState().getValue("rowanStackAbility");
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (ability != null
|
||||
&& controller != null) {
|
||||
ability.createCopyOnStack(game, source, source.getControllerId(), true);
|
||||
game.informPlayers(source.getSourceObjectIfItStillExists(game).getName() + " : " + controller.getLogName() + " copied activated ability");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue