Additional fixes for 9d9916280a

This commit is contained in:
Oleg Agafonov 2023-05-09 15:05:24 +04:00
parent 9d9916280a
commit 3c66dc8706
5 changed files with 8 additions and 3 deletions

View file

@ -21,7 +21,7 @@ public enum CreaturesAttackingYouCount implements DynamicValue {
public int calculate(Game game, Ability sourceAbility, Effect effect) {
int count = 0;
for (CombatGroup combatGroup : game.getCombat().getGroups()) {
if (combatGroup.getDefenderId().equals(sourceAbility.getControllerId())) {
if (combatGroup.getDefenderId() != null && combatGroup.getDefenderId().equals(sourceAbility.getControllerId())) {
count += combatGroup.getAttackers().size();
}
}

View file

@ -26,6 +26,7 @@ public class AttackingSameNotBandedPredicate implements Predicate<Permanent> {
return combatGroup != null
&& input.isAttacking()
&& input.getBandedCards().isEmpty()
&& combatGroup.getDefenderId() != null
&& combatGroup.getDefenderId().equals(defenderId);
}
}

View file

@ -66,6 +66,10 @@ public class CombatGroup implements Serializable, Copyable<CombatGroup> {
}
/**
*
* @return can be null
*/
public UUID getDefenderId() {
return defenderId;
}