mirror of
https://github.com/correl/mage.git
synced 2024-11-14 19:19:32 +00:00
Fix #9623
This commit is contained in:
parent
32d6525239
commit
4b469c8840
1 changed files with 3 additions and 20 deletions
|
@ -8,9 +8,6 @@ import mage.game.events.GameEvent;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
@ -33,23 +30,9 @@ public class EnchantedPlayerAttackedTriggeredAbility extends TriggeredAbilityImp
|
|||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Permanent enchantment = game.getPermanentOrLKIBattlefield(getSourceId());
|
||||
Player controller = game.getPlayer(getControllerId());
|
||||
Player attacker = game.getPlayer(game.getCombat().getAttackingPlayerId());
|
||||
if (controller == null || attacker == null || enchantment == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Player enchantedPlayer = game.getPlayer(enchantment.getAttachedTo());
|
||||
if (enchantedPlayer == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Set<UUID> opponentIds = game.getOpponents(controller.getId());
|
||||
if (!opponentIds.contains(attacker.getId()) || !opponentIds.contains(enchantedPlayer.getId())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return game.getCombat().getPlayerDefenders(game, false).contains(enchantment.getAttachedTo());
|
||||
return enchantment != null
|
||||
&& game.getState().getPlayersInRange(getControllerId(), game).contains(game.getCombat().getAttackingPlayerId())
|
||||
&& game.getCombat().getPlayerDefenders(game, false).contains(enchantment.getAttachedTo());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue