* Fixed a bug of DealsDamageToOneOrMoreCreaturesTriggeredAbility, added some tests.

This commit is contained in:
LevelX2 2016-12-18 17:50:33 +01:00
parent d85b9943f1
commit 1de210ab74
4 changed files with 169 additions and 98 deletions

View file

@ -29,10 +29,11 @@ public class DealsDamageToOneOrMoreCreaturesTriggeredAbility extends DealsDamage
if (super.checkTrigger(event, game)) {
// check that combat damage does only once trigger also if multiple creatures were damaged because they block or were blocked by source
if (game.getTurn().getStepType().equals(PhaseStep.COMBAT_DAMAGE) || game.getTurn().getStepType().equals(PhaseStep.FIRST_COMBAT_DAMAGE)) {
Integer stepHash = (Integer) game.getState().getValue("damageStep" + getOriginalId());
if (stepHash == null || game.getStep().hashCode() != stepHash) {
String stepHash = (String) game.getState().getValue("damageStep" + getOriginalId());
String newStepHash = game.getStep().getType().toString() + game.getTurnNum();
if (stepHash == null || !newStepHash.equals(stepHash)) {
// this ability did not trigger during this damage step
game.getState().setValue("damageStep" + getOriginalId(), game.getStep().hashCode());
game.getState().setValue("damageStep" + getOriginalId(), game.getStep().getType().toString() + game.getTurnNum());
return true;
}
} else {