forked from External/mage
* Shaman of the Great Hunt - Fixed that it triggerd also for other players.
This commit is contained in:
parent
23e24f32ba
commit
6b431be2ba
3 changed files with 43 additions and 15 deletions
|
|
@ -29,15 +29,18 @@ package mage.sets.legions;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.DealsDamageToAPlayerAllTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.CreateTokenTargetEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.token.SliverToken;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -54,10 +57,8 @@ public class BroodSliver extends CardImpl {
|
|||
this.toughness = new MageInt(3);
|
||||
|
||||
// Whenever a Sliver deals combat damage to a player, its controller may put a 1/1 colorless Sliver creature token onto the battlefield.
|
||||
Effect effect = new CreateTokenTargetEffect(new SliverToken());
|
||||
effect.setText("its controller may put a 1/1 colorless Sliver creature token onto the battlefield");
|
||||
this.addAbility(new DealsDamageToAPlayerAllTriggeredAbility(effect,
|
||||
new FilterCreaturePermanent("Sliver", "a Sliver"), true, SetTargetPointer.PLAYER, true));
|
||||
this.addAbility(new DealsDamageToAPlayerAllTriggeredAbility(new BroodSliverEffect(),
|
||||
new FilterCreaturePermanent("Sliver", "a Sliver"), false, SetTargetPointer.PLAYER, true));
|
||||
}
|
||||
|
||||
public BroodSliver(final BroodSliver card) {
|
||||
|
|
@ -69,3 +70,32 @@ public class BroodSliver extends CardImpl {
|
|||
return new BroodSliver(this);
|
||||
}
|
||||
}
|
||||
|
||||
class BroodSliverEffect extends OneShotEffect {
|
||||
|
||||
public BroodSliverEffect() {
|
||||
super(Outcome.PutCardInPlay);
|
||||
this.staticText = "its controller may put a 1/1 colorless Sliver creature token onto the battlefield";
|
||||
}
|
||||
|
||||
public BroodSliverEffect(final BroodSliverEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BroodSliverEffect copy() {
|
||||
return new BroodSliverEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player permanentController = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
if (permanentController != null) {
|
||||
if (permanentController.chooseUse(outcome, "put a 1/1 colorless Sliver creature token onto the battlefield", source, game)) {
|
||||
return new SliverToken().putOntoBattlefield(1, game, source.getSourceId(), permanentController.getId());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,24 +15,23 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
|
|||
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
|
||||
*/
|
||||
public class BroodSliverTest extends CardTestPlayerBase {
|
||||
|
||||
|
||||
/*
|
||||
Reported bug: It lets the controller of Brood Sliver choose whether or not the token is created, instead of the attacking Sliver's controller.
|
||||
*/
|
||||
*/
|
||||
@Test
|
||||
public void testTokenCreatedBySliverController() {
|
||||
|
||||
|
||||
// Brood Sliver {4}{G} 3/3 Sliver
|
||||
// Whenever a Sliver deals combat damage to a player, its controller may put a 1/1 colorless Sliver creature token onto the battlefield.
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Brood Sliver");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Venom Sliver"); // 1/1 deathtouch granting sliver
|
||||
|
||||
|
||||
attack(1, playerA, "Venom Sliver");
|
||||
setChoice(playerA, "Yes"); // controller of Venom Sliver dealing damage should get the choice to create token
|
||||
setChoice(playerB, "No"); // Brood Sliver controller should not be given choice in the first place
|
||||
setStopAt(1, PhaseStep.END_COMBAT);
|
||||
execute();
|
||||
|
||||
|
||||
assertLife(playerB, 19);
|
||||
assertPermanentCount(playerA, "Sliver", 1);
|
||||
assertPermanentCount(playerB, "Sliver", 0);
|
||||
|
|
|
|||
|
|
@ -73,12 +73,11 @@ public class DealsDamageToAPlayerAllTriggeredAbility extends TriggeredAbilityImp
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (!onlyCombat || ((DamagedPlayerEvent) event).isCombatDamage()) {
|
||||
Permanent permanent = game.getPermanent(event.getSourceId());
|
||||
if (permanent != null) {
|
||||
controllerId = permanent.getControllerId();
|
||||
if (filter.match(permanent, sourceId, controllerId, game)) {
|
||||
if (filter.match(permanent, getSourceId(), getControllerId(), game)) {
|
||||
if (!setTargetPointer.equals(SetTargetPointer.NONE)) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setValue("damage", event.getAmount());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue