AI: fixed error on targeting activated ability on stack (closes #12437);

This commit is contained in:
Oleg Agafonov 2024-06-08 23:14:14 +04:00
parent e2066f41ab
commit 8f70039e3e

View file

@ -730,19 +730,24 @@ public class ComputerPlayer6 extends ComputerPlayer {
xInfo = "x" + target.getTargetAmount(selectedId) + " "; xInfo = "x" + target.getTargetAmount(selectedId) + " ";
} }
String targetInfo; String targetInfo = null;
Player player = game.getPlayer(selectedId); Player player = game.getPlayer(selectedId);
MageObject object = game.getObject(selectedId);
mage.game.stack.Spell spell = game.getSpellOrLKIStack(selectedId);
if (player != null) { if (player != null) {
targetInfo = player.getName(); targetInfo = player.getName();
} else if (object != null) { }
if (targetInfo == null) {
MageObject object = game.getObject(selectedId);
if (object != null) {
targetInfo = object.getIdName(); targetInfo = object.getIdName();
} else if (spell != null) { }
targetInfo = "spell - " + CardUtil.substring(spell.toString(), 20, "..."); }
} else { if (targetInfo == null) {
StackObject stackObject = game.getState().getStack().getStackObject(selectedId);
if (stackObject != null) {
targetInfo = CardUtil.substring(stackObject.toString(), 20, "...");
}
}
if (targetInfo == null) {
targetInfo = "unknown"; targetInfo = "unknown";
} }
allTargetsInfo.add(xInfo + targetInfo); allTargetsInfo.add(xInfo + targetInfo);