[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

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