Fixed that combat damage triggered abilities go to stack during the related combat step.

This commit is contained in:
LevelX2 2018-01-27 17:56:46 +01:00
parent 2f016c8ea6
commit f5499531c7
5 changed files with 26 additions and 15 deletions

View file

@ -72,7 +72,7 @@ public class ControlledCreaturesDealCombatDamagePlayerTriggeredAbility extends T
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DAMAGED_PLAYER
|| event.getType() == EventType.END_COMBAT_STEP_POST
|| event.getType() == EventType.COMBAT_DAMAGE_STEP_PRIORITY
|| event.getType() == EventType.ZONE_CHANGE;
}
@ -86,7 +86,7 @@ public class ControlledCreaturesDealCombatDamagePlayerTriggeredAbility extends T
damagedPlayerIds.add(event.getPlayerId());
}
}
if (event.getType() == EventType.END_COMBAT_STEP_POST) {
if (event.getType() == EventType.COMBAT_DAMAGE_STEP_PRIORITY) {
if (madeDamage) {
Set<UUID> damagedPlayersCopy = new HashSet<>();
damagedPlayersCopy.addAll(damagedPlayerIds);

View file

@ -69,7 +69,7 @@ public class GameEvent implements Serializable {
BEGIN_COMBAT_STEP_PRE, BEGIN_COMBAT_STEP, BEGIN_COMBAT_STEP_POST,
DECLARE_ATTACKERS_STEP_PRE, DECLARE_ATTACKERS_STEP, DECLARE_ATTACKERS_STEP_POST,
DECLARE_BLOCKERS_STEP_PRE, DECLARE_BLOCKERS_STEP, DECLARE_BLOCKERS_STEP_POST,
COMBAT_DAMAGE_STEP_PRE, COMBAT_DAMAGE_STEP, COMBAT_DAMAGE_STEP_POST,
COMBAT_DAMAGE_STEP, COMBAT_DAMAGE_STEP_PRE, COMBAT_DAMAGE_STEP_PRIORITY, COMBAT_DAMAGE_STEP_POST,
END_COMBAT_STEP_PRE, END_COMBAT_STEP, END_COMBAT_STEP_POST,
POSTCOMBAT_MAIN_PHASE, POSTCOMBAT_MAIN_PHASE_PRE, POSTCOMBAT_MAIN_PHASE_POST,
POSTCOMBAT_MAIN_STEP_PRE, POSTCOMBAT_MAIN_STEP, POSTCOMBAT_MAIN_STEP_POST,

View file

@ -25,13 +25,13 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.game.turn;
import java.util.UUID;
import mage.constants.PhaseStep;
import mage.game.Game;
import mage.game.combat.CombatGroup;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
/**
@ -51,6 +51,12 @@ public class CombatDamageStep extends Step {
super(step);
}
@Override
public void priority(Game game, UUID activePlayerId, boolean resuming) {
game.fireEvent(new GameEvent(EventType.COMBAT_DAMAGE_STEP_PRIORITY, null, null, activePlayerId));
super.priority(game, activePlayerId, resuming);
}
@Override
public boolean skipStep(Game game, UUID activePlayerId) {
if (game.getCombat().noAttackers()) {
@ -62,14 +68,14 @@ public class CombatDamageStep extends Step {
@Override
public void beginStep(Game game, UUID activePlayerId) {
super.beginStep(game, activePlayerId);
for (CombatGroup group: game.getCombat().getGroups()) {
for (CombatGroup group : game.getCombat().getGroups()) {
group.assignDamageToBlockers(false, game);
}
for (CombatGroup group : game.getCombat().getBlockingGroups()) {
group.assignDamageToAttackers(false, game);
}
for (CombatGroup group: game.getCombat().getGroups()) {
for (CombatGroup group : game.getCombat().getGroups()) {
group.applyDamage(game);
}

View file

@ -25,13 +25,13 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.game.turn;
import java.util.UUID;
import mage.constants.PhaseStep;
import mage.game.Game;
import mage.game.combat.CombatGroup;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
/**
@ -51,6 +51,12 @@ public class FirstCombatDamageStep extends Step {
super(step);
}
@Override
public void priority(Game game, UUID activePlayerId, boolean resuming) {
game.fireEvent(new GameEvent(EventType.COMBAT_DAMAGE_STEP_PRIORITY, null, null, activePlayerId));
super.priority(game, activePlayerId, resuming);
}
@Override
public boolean skipStep(Game game, UUID activePlayerId) {
if (game.getCombat().noAttackers()) {
@ -65,14 +71,14 @@ public class FirstCombatDamageStep extends Step {
@Override
public void beginStep(Game game, UUID activePlayerId) {
super.beginStep(game, activePlayerId);
for (CombatGroup group: game.getCombat().getGroups()) {
for (CombatGroup group : game.getCombat().getGroups()) {
group.assignDamageToBlockers(true, game);
}
for (CombatGroup group : game.getCombat().getBlockingGroups()) {
group.assignDamageToAttackers(true, game);
}
for (CombatGroup group: game.getCombat().getGroups()) {
for (CombatGroup group : game.getCombat().getGroups()) {
group.applyDamage(game);
}

View file

@ -1,16 +1,16 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
@ -20,12 +20,11 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.game.turn;
import java.io.Serializable;