mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
* Fixed continuous effect handling of Marsh Casualities, Savage Offensive and Explosive Growth.
This commit is contained in:
parent
1a5afc98a6
commit
4581cfc803
5 changed files with 53 additions and 53 deletions
|
@ -55,8 +55,8 @@ public class ExplosiveGrowth extends CardImpl {
|
|||
// Target creature gets +2/+2 until end of turn. If Explosive Growth was kicked, that creature gets +5/+5 until end of turn instead.
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
this.getSpellAbility().addEffect(new ConditionalContinuousEffect(new BoostTargetEffect(5, 5, Duration.EndOfTurn),
|
||||
new BoostTargetEffect(2, 2, Duration.EndOfTurn), new LockedInCondition(KickedCondition.getInstance()),
|
||||
"Target creature gets +2/+2 until end of turn. If Explosive Growth was kicked, that creature gets +5/+5 until end of turn instead."));
|
||||
new BoostTargetEffect(2, 2, Duration.EndOfTurn), new LockedInCondition(KickedCondition.getInstance()),
|
||||
"Target creature gets +2/+2 until end of turn. If {this} was kicked, that creature gets +5/+5 until end of turn instead."));
|
||||
}
|
||||
|
||||
public ExplosiveGrowth(final ExplosiveGrowth card) {
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
package mage.sets.invasion;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.condition.LockedInCondition;
|
||||
import mage.abilities.condition.common.KickedCondition;
|
||||
import mage.abilities.decorator.ConditionalOneShotEffect;
|
||||
import mage.abilities.effects.common.AddContinuousEffectToGame;
|
||||
|
@ -48,12 +49,12 @@ import mage.filter.predicate.permanent.ControllerPredicate;
|
|||
* @author fireshoes
|
||||
*/
|
||||
public class SavageOffensive extends CardImpl {
|
||||
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures you control");
|
||||
|
||||
static {
|
||||
filter.add(new ControllerPredicate(TargetController.YOU));
|
||||
}
|
||||
}
|
||||
|
||||
public SavageOffensive(UUID ownerId) {
|
||||
super(ownerId, 162, "Savage Offensive", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{1}{R}");
|
||||
|
@ -61,15 +62,15 @@ public class SavageOffensive extends CardImpl {
|
|||
|
||||
// Kicker {G}
|
||||
this.addAbility(new KickerAbility("{G}"));
|
||||
|
||||
|
||||
// Creatures you control gain first strike until end of turn.
|
||||
this.getSpellAbility().addEffect(new GainAbilityAllEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn, filter));
|
||||
|
||||
|
||||
// If Savage Offensive was kicked, they get +1/+1 until end of turn.
|
||||
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
|
||||
new AddContinuousEffectToGame(new BoostControlledEffect(1, 1, Duration.EndOfTurn)),
|
||||
KickedCondition.getInstance(),
|
||||
"If {this} was kicked, they get +1/+1 until end of turn."));
|
||||
new AddContinuousEffectToGame(new BoostControlledEffect(1, 1, Duration.EndOfTurn)),
|
||||
new LockedInCondition(KickedCondition.getInstance()),
|
||||
"If {this} was kicked, they get +1/+1 until end of turn."));
|
||||
}
|
||||
|
||||
public SavageOffensive(final SavageOffensive card) {
|
||||
|
|
|
@ -28,21 +28,19 @@
|
|||
package mage.sets.zendikar;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.LockedInCondition;
|
||||
import mage.abilities.condition.common.KickedCondition;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.decorator.ConditionalContinuousEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostControlledEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostTargetEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
|
||||
import mage.abilities.keyword.FirstStrikeAbility;
|
||||
import mage.abilities.keyword.KickerAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
* @author nantuko, Loki
|
||||
|
@ -53,12 +51,16 @@ public class BoldDefense extends CardImpl {
|
|||
super(ownerId, 3, "Bold Defense", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{2}{W}");
|
||||
this.expansionSetCode = "ZEN";
|
||||
|
||||
|
||||
// Kicker {3}{W} (You may pay an additional {3}{W} as you cast this spell.)
|
||||
this.addAbility(new KickerAbility("{3}{W}"));
|
||||
|
||||
// Creatures you control get +1/+1 until end of turn. If Bold Defense was kicked, instead creatures you control get +2/+2 and gain first strike until end of turn.
|
||||
this.getSpellAbility().addEffect(new BoldDefenseEffect());
|
||||
this.getSpellAbility().addEffect(new ConditionalContinuousEffect(new BoostControlledEffect(2, 2, Duration.EndOfTurn),
|
||||
new BoostTargetEffect(1, 1, Duration.EndOfTurn), new LockedInCondition(KickedCondition.getInstance()),
|
||||
"Creatures you control get +1/+1 until end of turn. If {this} was kicked, instead creatures you control get +2/+2"));
|
||||
this.getSpellAbility().addEffect(new ConditionalContinuousEffect(new GainAbilityControlledEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn, new FilterCreaturePermanent(), false),
|
||||
null, new LockedInCondition(KickedCondition.getInstance()),
|
||||
"and gain first strike until end of turn"));
|
||||
}
|
||||
|
||||
public BoldDefense(final BoldDefense card) {
|
||||
|
@ -70,34 +72,3 @@ public class BoldDefense extends CardImpl {
|
|||
return new BoldDefense(this);
|
||||
}
|
||||
}
|
||||
|
||||
class BoldDefenseEffect extends OneShotEffect {
|
||||
|
||||
public BoldDefenseEffect() {
|
||||
super(Outcome.BoostCreature);
|
||||
this.staticText = "Creatures you control get +1/+1 until end of turn. If {this} was kicked, instead creatures you control get +2/+2 and gain first strike until end of turn";
|
||||
}
|
||||
|
||||
public BoldDefenseEffect(final BoldDefenseEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoldDefenseEffect copy() {
|
||||
return new BoldDefenseEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
if (KickedCondition.getInstance().apply(game, source)) {
|
||||
game.addEffect(new BoostControlledEffect(2, 2, Duration.EndOfTurn), source);
|
||||
game.addEffect(new GainAbilityControlledEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn, new FilterCreaturePermanent(), false), source);
|
||||
} else {
|
||||
game.addEffect(new BoostControlledEffect(1, 1, Duration.EndOfTurn), source);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,10 +28,14 @@
|
|||
package mage.sets.zendikar;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.UUID;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.LockedInCondition;
|
||||
import mage.abilities.condition.common.KickedCondition;
|
||||
import mage.abilities.decorator.ConditionalContinuousEffect;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.keyword.KickerAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.*;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
|
@ -39,10 +43,6 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPlayer;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.keyword.KickerAbility;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
|
@ -64,7 +64,7 @@ public class MarshCasualties extends CardImpl {
|
|||
this.getSpellAbility().addEffect(new ConditionalContinuousEffect(
|
||||
new MarshCasualtiesEffect(-2, -2),
|
||||
new MarshCasualtiesEffect(-1, -1),
|
||||
KickedCondition.getInstance(),
|
||||
new LockedInCondition(KickedCondition.getInstance()),
|
||||
ruleText));
|
||||
this.getSpellAbility().addTarget(new TargetPlayer());
|
||||
}
|
||||
|
@ -124,4 +124,4 @@ class MarshCasualtiesEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -363,4 +363,32 @@ public class KickerTest extends CardTestPlayerBase {
|
|||
assertGraveyardCount(playerA, "Sunscape Battlemage", 1);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Paying the Kicker on "Marsh Casualties" has no effect. Target player's
|
||||
* creatures still only get -1/-1 instead of -2/-2. Was playing against AI.
|
||||
* It was me who cast the spell.
|
||||
*
|
||||
*/
|
||||
@Test
|
||||
public void testMarshCasualties() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 5);
|
||||
|
||||
// Kicker {3}
|
||||
// Creatures target player controls get -1/-1 until end of turn. If Marsh Casualties was kicked, those creatures get -2/-2 until end of turn instead.
|
||||
addCard(Zone.HAND, playerA, "Marsh Casualties", 1); // 2/2 {2}{W}
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Centaur Courser", 1); // 3/3
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Marsh Casualties", playerB);
|
||||
setChoice(playerA, "Yes"); // Pay Kicker
|
||||
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertTappedCount("Swamp", true, 5);
|
||||
assertGraveyardCount(playerA, "Marsh Casualties", 1);
|
||||
assertPowerToughness(playerB, "Centaur Courser", 1, 1);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue