* Halvar, God of Battle - fixed rollback error on attached permanent die;

This commit is contained in:
Oleg Agafonov 2021-03-07 18:28:19 +04:00
parent 0e916b6e29
commit 6e661e6d97
4 changed files with 10 additions and 6 deletions

View file

@ -189,7 +189,8 @@ class HalvarGodOfBattlePredicate implements ObjectSourcePlayerPredicate<ObjectSo
@Override
public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
UUID attachedTo = input.getObject().getAttachedTo();
return attachedTo != null && filter.match(game.getPermanent(attachedTo), input.getSourceId(), input.getPlayerId(), game);
Permanent permanent = game.getPermanent(attachedTo);
return permanent != null && filter.match(permanent, input.getSourceId(), input.getPlayerId(), game);
}
@Override

View file

@ -22,6 +22,7 @@ import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
/**
* @author LevelX2
@ -101,8 +102,9 @@ class PathOfMettleTriggeredAbility extends TriggeredAbilityImpl {
int attackerCount = 0;
if (game.getCombat() != null) {
if (isControlledBy(game.getCombat().getAttackingPlayerId())) {
for (UUID attacker : game.getCombat().getAttackers()) {
if (filter.match(game.getPermanent(attacker), game)) {
for (UUID attackerId : game.getCombat().getAttackers()) {
Permanent attacker = game.getPermanent(attackerId);
if (attacker != null && filter.match(attacker, game)) {
attackerCount++;
}
}

View file

@ -55,8 +55,8 @@ public class AttacksWithCreaturesTriggeredAbility extends TriggeredAbilityImpl {
if (game.getCombat().getAttackingPlayerId().equals(getControllerId())) {
int attackerCount = 0;
for (UUID attackerId : game.getCombat().getAttackers()) {
Permanent permanent = game.getPermanent(attackerId);
if (permanent != null && filter.match(game.getPermanent(attackerId), game)) {
Permanent attacker = game.getPermanent(attackerId);
if (attacker != null && filter.match(attacker, game)) {
attackerCount++;
}
}

View file

@ -22,7 +22,8 @@ public class AttachedToPredicate implements Predicate<Permanent> {
@Override
public boolean apply(Permanent input, Game game) {
UUID attachedTo = input.getAttachedTo();
return attachedTo != null && filter.match(game.getPermanent(attachedTo), game);
Permanent permanent = game.getPermanent(attachedTo);
return permanent != null && filter.match(permanent, game);
}
@Override