mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 13:02:06 -08:00
* Fixed a bug of DealsDamageToOneOrMoreCreaturesTriggeredAbility, added some tests.
This commit is contained in:
parent
d85b9943f1
commit
1de210ab74
4 changed files with 169 additions and 98 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue