mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
Attacking you abilities and filters - fixed that planeswalker removes from a combat can cause a game error (NPE error, example: Curse of Hospitality)
This commit is contained in:
parent
1f4dfd08ce
commit
9d9916280a
9 changed files with 68 additions and 6 deletions
|
|
@ -2557,6 +2557,7 @@ public abstract class GameImpl implements Game {
|
|||
.getGroups()
|
||||
.stream()
|
||||
.map(CombatGroup::getDefenderId)
|
||||
.filter(Objects::nonNull)
|
||||
.noneMatch(perm.getId()::equals)
|
||||
&& this.getPlayer(perm.getProtectorId()) == null
|
||||
|| perm.isControlledBy(perm.getProtectorId())) {
|
||||
|
|
|
|||
|
|
@ -1594,6 +1594,7 @@ public class Combat implements Serializable, Copyable<Combat> {
|
|||
.stream()
|
||||
.filter(group -> group.getAttackers().contains(attackerId))
|
||||
.map(CombatGroup::getDefenderId)
|
||||
.filter(Objects::nonNull)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public class CombatGroup implements Serializable, Copyable<CombatGroup> {
|
|||
protected List<UUID> attackerOrder = new ArrayList<>();
|
||||
protected Map<UUID, UUID> players = new HashMap<>();
|
||||
protected boolean blocked;
|
||||
protected UUID defenderId; // planeswalker or player
|
||||
protected UUID defenderId; // planeswalker or player, can be null after remove from combat (e.g. due damage)
|
||||
protected UUID defendingPlayerId;
|
||||
protected boolean defenderIsPermanent;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue