Make yield string methods robust to effects that don't have a host card

This commit is contained in:
pfps
2017-01-07 20:17:17 +00:00
parent 17b2b4a810
commit beaffe830b
2 changed files with 11 additions and 3 deletions

View File

@@ -581,9 +581,13 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
}
}
// key for autoyield - the card description (including number) plus the effect description
// key for autoyield - the card description (including number) (if there is a card) plus the effect description
public String yieldKey() {
return getHostCard().toString() + ": " + toUnsuppressedString();
if ( getHostCard() != null ) {
return getHostCard().toString() + ": " + toUnsuppressedString();
} else {
return toUnsuppressedString();
}
}
public String getStackDescription() {

View File

@@ -193,7 +193,11 @@ public class WrappedAbility extends Ability {
@Override
public String yieldKey() {
if ( getTrigger() != null ) {
return getHostCard().toString() + ": " + getTrigger().toString();
if ( getHostCard() != null ) {
return getHostCard().toString() + ": " + getTrigger().toString();
} else {
return getTrigger().toString();
}
} else {
return super.yieldKey();
}