Fixed GoadAttachedAbility in a 2 player game (fixes #7466)

This commit is contained in:
Daniel Bomar 2021-02-03 15:51:48 -06:00
parent 1c2f8f4caa
commit 7da65b38b2
No known key found for this signature in database
GPG key ID: C86C8658F4023918

View file

@ -64,9 +64,15 @@ class GoadAttackEffect extends RestrictionEffect {
@Override
public boolean canAttack(Permanent attacker, UUID defenderId, Ability source, Game game, boolean canUseChooseDialogs) {
if (defenderId == null) {
if (defenderId == null
|| game.getState().getPlayersInRange(attacker.getControllerId(), game).size() == 2) { // just 2 players left, so it may attack you
return true;
}
// A planeswalker controlled by the controller is the defender
if (game.getPermanent(defenderId) != null) {
return !game.getPermanent(defenderId).getControllerId().equals(source.getControllerId());
}
// The controller is the defender
return !defenderId.equals(source.getControllerId());
}
}