try to use LKI if source == null

This commit is contained in:
Loki 2011-12-18 18:23:21 +04:00
parent 7bd38bb208
commit 757df393f9
2 changed files with 6 additions and 0 deletions

View file

@ -92,6 +92,9 @@ class SpikeshotGoblinEffect extends OneShotEffect<SpikeshotGoblinEffect> {
public boolean apply(Game game, Ability source) {
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (sourcePermanent == null) {
sourcePermanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Constants.Zone.BATTLEFIELD);
}
if (sourcePermanent != null && permanent != null) {
permanent.damage(sourcePermanent.getPower().getValue(), source.getId(), game, true, false);
return true;

View file

@ -89,6 +89,9 @@ class SpikeshotElderEffect extends OneShotEffect<SpikeshotElderEffect> {
public boolean apply(Game game, Ability source) {
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (sourcePermanent == null) {
sourcePermanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Constants.Zone.BATTLEFIELD);
}
if (sourcePermanent != null && permanent != null) {
permanent.damage(sourcePermanent.getPower().getValue(), source.getId(), game, true, false);
return true;