add cast check

This commit is contained in:
CCTV-1
2020-01-02 12:17:38 +08:00
parent 51fae70e24
commit 8ebabd978f

View File

@@ -47,6 +47,14 @@ public class AttachEffect extends SpellAbilityEffect {
attachTo = targets.get(0); attachTo = targets.get(0);
} }
String attachToName = null;
if (attachTo instanceof Card) {
attachToName = CardTranslation.getTranslatedName(((Card)attachTo).getName());
}
else {
attachToName = attachTo.toString();
}
final Player p = sa.getActivatingPlayer(); final Player p = sa.getActivatingPlayer();
if (sa.hasParam("Object")) { if (sa.hasParam("Object")) {
@@ -62,7 +70,7 @@ public class AttachEffect extends SpellAbilityEffect {
// If Cast Targets will be checked on the Stack // If Cast Targets will be checked on the Stack
for (final Card attachment : attachments) { for (final Card attachment : attachments) {
String message = Localizer.getInstance().getMessage("lblDoYouWantAttachSourceToTarget", CardTranslation.getTranslatedName(attachment.getName()), CardTranslation.getTranslatedName(((Card)attachTo).getName())); String message = Localizer.getInstance().getMessage("lblDoYouWantAttachSourceToTarget", CardTranslation.getTranslatedName(attachment.getName()), attachToName);
if ( sa.hasParam("Optional") && !p.getController().confirmAction(sa, null, message) ) if ( sa.hasParam("Optional") && !p.getController().confirmAction(sa, null, message) )
continue; continue;
handleAttachment(attachment, attachTo, sa); handleAttachment(attachment, attachTo, sa);