[C21] Implemented Battlemage's Braces

This commit is contained in:
Evan Kranzler 2021-04-19 18:07:23 -04:00
parent fbbdb2431d
commit de3388348e
8 changed files with 199 additions and 218 deletions

View file

@ -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();
}
}

View file

@ -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;
}
}

View file

@ -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;
}
}