fixed Rhythm of the Wild not giving Riot to creatures that weren't cast

This commit is contained in:
Evan Kranzler 2019-01-25 10:32:29 -05:00
parent 481b5f04ea
commit 34e3bb42db
4 changed files with 134 additions and 19 deletions

View file

@ -1,7 +1,6 @@
package mage.cards.m;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
@ -10,7 +9,10 @@ import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.continuous.AddCardSubTypeTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
@ -19,14 +21,15 @@ import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class MasterBiomancer extends CardImpl {
public MasterBiomancer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{G}{U}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}{U}");
this.subtype.add(SubType.ELF);
this.subtype.add(SubType.WIZARD);
@ -34,10 +37,10 @@ public final class MasterBiomancer extends CardImpl {
this.toughness = new MageInt(4);
// Each other creature you control enters the battlefield with a number of additional +1/+1 counters on it equal to Master Biomancer's power and as a Mutant in addition to its other types.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new MasterBiomancerEntersBattlefieldEffect()));
this.addAbility(new SimpleStaticAbility(new MasterBiomancerEntersBattlefieldEffect()));
}
public MasterBiomancer(final MasterBiomancer card) {
private MasterBiomancer(final MasterBiomancer card) {
super(card);
}
@ -49,12 +52,12 @@ public final class MasterBiomancer extends CardImpl {
class MasterBiomancerEntersBattlefieldEffect extends ReplacementEffectImpl {
public MasterBiomancerEntersBattlefieldEffect() {
MasterBiomancerEntersBattlefieldEffect() {
super(Duration.WhileOnBattlefield, Outcome.BoostCreature);
staticText = "Each other creature you control enters the battlefield with a number of additional +1/+1 counters on it equal to Master Biomancer's power and as a Mutant in addition to its other types";
staticText = "Each other creature you control enters the battlefield with a number of additional +1/+1 counters on it equal to {this}'s power and as a Mutant in addition to its other types";
}
public MasterBiomancerEntersBattlefieldEffect(MasterBiomancerEntersBattlefieldEffect effect) {
private MasterBiomancerEntersBattlefieldEffect(MasterBiomancerEntersBattlefieldEffect effect) {
super(effect);
}

View file

@ -1,17 +1,21 @@
package mage.cards.r;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.CantBeCounteredControlledEffect;
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
import mage.abilities.effects.common.continuous.GainAbilityControlledSpellsEffect;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.abilities.keyword.HasteAbility;
import mage.abilities.keyword.RiotAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.FilterSpell;
import mage.filter.common.FilterControlledCreaturePermanent;
@ -19,6 +23,14 @@ import mage.filter.common.FilterCreatureSpell;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.filter.predicate.permanent.TokenPredicate;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
* @author TheElk801
@ -44,8 +56,7 @@ public final class RhythmOfTheWild extends CardImpl {
)));
// Nontoken creatures you control have riot.
Ability ability = new SimpleStaticAbility(new GainAbilityControlledSpellsEffect(
new RiotAbility(), new FilterCreatureSpell()).setText("Nontoken creatures you control have riot. <i>(They enter the battlefield with your choice of a +1/+1 counter or haste.)</i>"));
Ability ability = new SimpleStaticAbility(new RhythmOfTheWildEffect());
ability.addEffect(new GainAbilityControlledEffect(
new RiotAbility(), Duration.WhileOnBattlefield, filter2
).setText(""));
@ -61,3 +72,55 @@ public final class RhythmOfTheWild extends CardImpl {
return new RhythmOfTheWild(this);
}
}
class RhythmOfTheWildEffect extends ReplacementEffectImpl {
RhythmOfTheWildEffect() {
super(Duration.WhileOnBattlefield, Outcome.BoostCreature);
staticText = "Nontoken creatures you control have riot. " +
"<i>(They enter the battlefield with your choice of a +1/+1 counter or haste.)</i>";
}
private RhythmOfTheWildEffect(RhythmOfTheWildEffect effect) {
super(effect);
}
@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) {
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
return creature != null
&& creature.isControlledBy(source.getControllerId())
&& creature.isCreature();
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
Player player = game.getPlayer(source.getControllerId());
if (creature == null || player == null) {
return false;
}
if (player.chooseUse(
outcome, "Have " + creature.getLogName() + " enter the battlefield with a +1/+1 counter on it or with haste?",
null, "+1/+1 counter", "Haste", source, game
)) {
game.informPlayers(player.getLogName() + " choose to put a +1/+1 counter on " + creature.getName());
creature.addCounters(CounterType.P1P1.createInstance(), source, game, event.getAppliedEffects());
} else {
ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.Custom);
effect.setTargetPointer(new FixedTarget(creature.getId(), creature.getZoneChangeCounter(game) + 1));
game.addEffect(effect, source);
}
return false;
}
@Override
public RhythmOfTheWildEffect copy() {
return new RhythmOfTheWildEffect(this);
}
}