Fix crash when getting triggered controler for merged permanent

This commit is contained in:
Lyu Zong-Hong
2021-02-11 14:32:49 +09:00
parent 78928f186d
commit ef13a84d43

View File

@@ -1054,6 +1054,10 @@ public class AbilityUtils {
if (c instanceof SpellAbility) { if (c instanceof SpellAbility) {
o = ((SpellAbility) c).getActivatingPlayer(); o = ((SpellAbility) c).getActivatingPlayer();
} }
// For merged permanent
if (c instanceof CardCollection) {
o = ((CardCollection) c).get(0).getController();
}
} }
else if (defParsed.endsWith("Opponent")) { else if (defParsed.endsWith("Opponent")) {
String triggeringType = defParsed.substring(9); String triggeringType = defParsed.substring(9);
@@ -1065,6 +1069,10 @@ public class AbilityUtils {
if (c instanceof SpellAbility) { if (c instanceof SpellAbility) {
o = ((SpellAbility) c).getActivatingPlayer().getOpponents(); o = ((SpellAbility) c).getActivatingPlayer().getOpponents();
} }
// For merged permanent
if (c instanceof CardCollection) {
o = ((CardCollection) c).get(0).getController().getOpponents();;
}
} }
else if (defParsed.endsWith("Owner")) { else if (defParsed.endsWith("Owner")) {
String triggeringType = defParsed.substring(9); String triggeringType = defParsed.substring(9);
@@ -1073,6 +1081,10 @@ public class AbilityUtils {
if (c instanceof Card) { if (c instanceof Card) {
o = ((Card) c).getOwner(); o = ((Card) c).getOwner();
} }
// For merged permanent
if (c instanceof CardCollection) {
o = ((CardCollection) c).get(0).getOwner();
}
} }
else { else {
final String triggeringType = defParsed.substring(9); final String triggeringType = defParsed.substring(9);