* Stinkdrinker Bandit - Fixed that it applies boost more than once in multiplayer games (fixes #3542).

This commit is contained in:
LevelX2 2017-07-09 20:43:06 +02:00
parent a28dc88479
commit e8f4b8947e
2 changed files with 20 additions and 12 deletions

View file

@ -53,7 +53,7 @@ import mage.game.permanent.Permanent;
* @author BursegSardaukar
*/
public class StinkdrinkerBandit extends CardImpl {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("Rogue");
static {
@ -61,7 +61,7 @@ public class StinkdrinkerBandit extends CardImpl {
}
public StinkdrinkerBandit(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{B}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}");
this.subtype.add("Goblin");
this.subtype.add("Rogue");
@ -71,10 +71,10 @@ public class StinkdrinkerBandit extends CardImpl {
// Prowl {1}, {B} (You may cast this for its prowl cost if you dealt combat damage to a player this turn with a Goblin or Rogue.)
this.addAbility(new ProwlAbility(this, "{1}{B}"));
// Whenever a Rogue you control attacks and isn't blocked, it gets +2/+1 until end of turn.
// Whenever a Rogue you control attacks and isn't blocked, it gets +2/+1 until end of turn.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(
new StinkdrinkerBanditTriggeredAbility(), Duration.WhileOnBattlefield,
filter, "Whenever a Rogue you control attacks and isn't blocked, it gets +2/+1 until end of turn")));
new StinkdrinkerBanditTriggeredAbility(), Duration.WhileOnBattlefield,
filter, "Whenever a Rogue you control attacks and isn't blocked, it gets +2/+1 until end of turn")));
}
public StinkdrinkerBandit(final StinkdrinkerBandit card) {
@ -111,8 +111,10 @@ class StinkdrinkerBanditTriggeredAbility extends TriggeredAbilityImpl {
public boolean checkTrigger(GameEvent event, Game game) {
Permanent sourcePermanent = game.getPermanent(getSourceId());
if (sourcePermanent.isAttacking()) {
for (CombatGroup combatGroup: game.getCombat().getGroups()) {
if (combatGroup.getBlockers().isEmpty() && combatGroup.getAttackers().contains(getSourceId())) {
for (CombatGroup combatGroup : game.getCombat().getGroups()) {
if (combatGroup.getBlockers().isEmpty()
&& combatGroup.getDefenderId().equals(event.getTargetId())
&& combatGroup.getAttackers().contains(getSourceId())) {
return true;
}
}

View file

@ -1,5 +1,6 @@
package org.mage.test.multiplayer;
import java.io.FileNotFoundException;
import mage.constants.MultiplayerAttackOption;
import mage.constants.PhaseStep;
import mage.constants.RangeOfInfluence;
@ -10,8 +11,6 @@ import mage.game.GameException;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestMultiPlayerBase;
import java.io.FileNotFoundException;
public class MultiplayerTriggerTest extends CardTestMultiPlayerBase {
@Override
@ -26,9 +25,15 @@ public class MultiplayerTriggerTest extends CardTestMultiPlayerBase {
}
@Test
public void testMultiplayerAttackStinkdrinkerBanditTrigger(){
String pestermite = "Pestermite";
String stinkdrinker = "Stinkdrinker Bandit";
public void testMultiplayerAttackStinkdrinkerBanditTrigger() {
// Flash
// Flying
// When Pestermite enters the battlefield, you may tap or untap target permanent.
String pestermite = "Pestermite"; // 2/1
// Prowl {1}, {B} (You may cast this for its prowl cost if you dealt combat damage to a player this turn with a Goblin or Rogue.)
// Whenever a Rogue you control attacks and isn't blocked, it gets +2/+1 until end of turn.
String stinkdrinker = "Stinkdrinker Bandit"; // 2/1
addCard(Zone.BATTLEFIELD, playerA, stinkdrinker);
addCard(Zone.BATTLEFIELD, playerA, pestermite, 1);
@ -38,6 +43,7 @@ public class MultiplayerTriggerTest extends CardTestMultiPlayerBase {
setStopAt(1, PhaseStep.POSTCOMBAT_MAIN);
execute();
assertPowerToughness(playerA, stinkdrinker, 4, 2);
assertPowerToughness(playerA, pestermite, 4, 2);
}
}