Fix - target pointer should be set from wrapper effects.

This commit is contained in:
North 2012-03-30 22:19:20 +03:00
parent c9ddaac961
commit c8b6dde3d9
3 changed files with 7 additions and 0 deletions

View file

@ -48,8 +48,10 @@ public class ConditionalContinousEffect extends ContinuousEffectImpl<Conditional
@Override
public boolean apply(Constants.Layer layer, Constants.SubLayer sublayer, Ability source, Game game) {
if (condition.apply(game, source)) {
effect.setTargetPointer(this.targetPointer);
return effect.apply(layer, sublayer, source, game);
} else if (otherwiseEffect != null) {
otherwiseEffect.setTargetPointer(this.targetPointer);
return otherwiseEffect.apply(layer, sublayer, source, game);
}
return false;
@ -58,8 +60,10 @@ public class ConditionalContinousEffect extends ContinuousEffectImpl<Conditional
@Override
public boolean apply(Game game, Ability source) {
if (condition.apply(game, source)) {
effect.setTargetPointer(this.targetPointer);
return effect.apply(game, source);
} else if (otherwiseEffect != null) {
otherwiseEffect.setTargetPointer(this.targetPointer);
return otherwiseEffect.apply(game, source);
}
return false;

View file

@ -67,8 +67,10 @@ public class ConditionalOneShotEffect extends OneShotEffect<ConditionalOneShotEf
@Override
public boolean apply(Game game, Ability source) {
if (condition.apply(game, source)) {
effect.setTargetPointer(this.targetPointer);
return effect.apply(game, source);
} else if (otherwiseEffect != null) {
otherwiseEffect.setTargetPointer(this.targetPointer);
return otherwiseEffect.apply(game, source);
}
return false;

View file

@ -31,6 +31,7 @@ public class DoIfCostPaid extends OneShotEffect<DoIfCostPaid> {
if (player.chooseUse(executingEffect.getOutcome(), "Pay " + cost.getText() + " and " + executingEffect.getText(source.getModes().getMode()), game)) {
cost.clearPaid();
if (cost.pay(source, game, source.getId(), source.getControllerId(), false)) {
executingEffect.setTargetPointer(this.targetPointer);
return executingEffect.apply(game, source);
}
}