mirror of
https://github.com/correl/mage.git
synced 2025-01-11 11:05:23 +00:00
Some minor changes. Added a Kicker test.
This commit is contained in:
parent
9edc277374
commit
0ef2919a08
3 changed files with 73 additions and 36 deletions
|
@ -55,8 +55,8 @@ public class OrimsChant extends CardImpl {
|
|||
public OrimsChant(UUID ownerId) {
|
||||
super(ownerId, 11, "Orim's Chant", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{W}");
|
||||
this.expansionSetCode = "PLS";
|
||||
this.color.setWhite(true);
|
||||
|
||||
|
||||
// Kicker {W} (You may pay an additional {W} as you cast this spell.)
|
||||
this.addAbility(new KickerAbility("{W}"));
|
||||
|
||||
|
@ -79,6 +79,33 @@ public class OrimsChant extends CardImpl {
|
|||
|
||||
}
|
||||
|
||||
class OrimsChantCantCastEffect extends ContinuousRuleModifyingEffectImpl {
|
||||
|
||||
public OrimsChantCantCastEffect() {
|
||||
super(Duration.EndOfTurn, Outcome.Benefit);
|
||||
staticText = "Target player can't cast spells this turn";
|
||||
}
|
||||
|
||||
public OrimsChantCantCastEffect(final OrimsChantCantCastEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrimsChantCantCastEffect copy() {
|
||||
return new OrimsChantCantCastEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.CAST_SPELL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
return event.getPlayerId() == getTargetPointer().getFirst(game, source);
|
||||
}
|
||||
}
|
||||
|
||||
class OrimsChantEffect extends OneShotEffect {
|
||||
|
||||
public OrimsChantEffect() {
|
||||
|
@ -100,39 +127,7 @@ class OrimsChantEffect extends OneShotEffect {
|
|||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null && KickedCondition.getInstance().apply(game, source)) {
|
||||
game.addEffect(new CantAttackAllAnyPlayerEffect(Duration.EndOfTurn, new FilterCreaturePermanent("creatures")), source);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class OrimsChantCantCastEffect extends ContinuousRuleModifyingEffectImpl {
|
||||
|
||||
public OrimsChantCantCastEffect() {
|
||||
super(Duration.EndOfTurn, Outcome.Benefit);
|
||||
staticText = "Target player can't cast spells this turn";
|
||||
}
|
||||
|
||||
public OrimsChantCantCastEffect(final OrimsChantCantCastEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrimsChantCantCastEffect copy() {
|
||||
return new OrimsChantCantCastEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.CAST_SPELL ) {
|
||||
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
if (player != null && player.getId().equals(event.getPlayerId())) {
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -169,5 +169,38 @@ public class KickerTest extends CardTestPlayerBase {
|
|||
assertPowerToughness(playerA, "Apex Hawks", 2, 2);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* When I cast Orim's Chant with Kicker cost, the player can play spells anyway during the turn.
|
||||
* It seems like the kicker cost trigger an "instead" creatures can't attack.
|
||||
*/
|
||||
@Test
|
||||
public void testOrimsChantskicker() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Raging Goblin", 1); // Haste 1/1
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Plains", 2);
|
||||
// Kicker {W} (You may pay an additional {W} as you cast this spell.)
|
||||
// Target player can't cast spells this turn.
|
||||
// If Orim's Chant was kicked, creatures can't attack this turn.
|
||||
addCard(Zone.HAND, playerA, "Orim's Chant");
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1);
|
||||
addCard(Zone.HAND, playerB, "Lightning Bolt");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Orim's Chant", playerB);
|
||||
setChoice(playerA, "Yes");
|
||||
|
||||
attack(1, playerA, "Raging Goblin");
|
||||
|
||||
castSpell(1, PhaseStep.POSTCOMBAT_MAIN, playerB, "Lightning Bolt", playerA);
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertGraveyardCount(playerA, "Orim's Chant", 1);
|
||||
assertGraveyardCount(playerB, "Lightning Bolt", 0);
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,16 @@ public class CantAttackAllAnyPlayerEffect extends RestrictionEffect {
|
|||
public CantAttackAllAnyPlayerEffect(Duration duration, FilterCreaturePermanent filter) {
|
||||
super(duration);
|
||||
this.filter = filter;
|
||||
staticText = new StringBuilder(filter.getMessage()).append(" can't attack").toString();
|
||||
StringBuilder sb = new StringBuilder(filter.getMessage()).append(" can't attack");
|
||||
if (!duration.toString().isEmpty()) {
|
||||
sb.append(" ");
|
||||
if (duration.equals(Duration.EndOfTurn)) {
|
||||
sb.append(" this turn");
|
||||
} else {
|
||||
sb.append(" ").append(duration.toString());
|
||||
}
|
||||
}
|
||||
staticText = sb.toString();
|
||||
}
|
||||
|
||||
public CantAttackAllAnyPlayerEffect(final CantAttackAllAnyPlayerEffect effect) {
|
||||
|
|
Loading…
Reference in a new issue