Fixed a bug of Chemister's Trick with overload that affected creatures not forced to attack.

This commit is contained in:
LevelX2 2012-12-28 23:55:47 +01:00
parent dfc1854f9e
commit e269a63e04
2 changed files with 8 additions and 7 deletions

View file

@ -106,7 +106,7 @@ class ChemistersTrickEffect extends OneShotEffect<ChemistersTrickEffect> {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
for (Permanent creature : game.getBattlefield().getAllActivePermanents(filter, game)) { for (Permanent creature : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
AttacksIfAbleTargetEffect effect = new AttacksIfAbleTargetEffect(Duration.EndOfTurn); AttacksIfAbleTargetEffect effect = new AttacksIfAbleTargetEffect(Duration.EndOfTurn);
effect.setTargetPointer(new FixedTarget(creature.getId())); effect.setTargetPointer(new FixedTarget(creature.getId()));
game.addEffect(effect, source); game.addEffect(effect, source);

View file

@ -56,8 +56,7 @@ public class AttacksIfAbleTargetEffect extends RequirementEffect<AttacksIfAbleTa
@Override @Override
public boolean applies(Permanent permanent, Ability source, Game game) { public boolean applies(Permanent permanent, Ability source, Game game) {
Permanent creature = game.getPermanent(source.getFirstTarget()); if (this.getTargetPointer().getTargets(game, source).contains(permanent.getId())) {
if (creature != null && creature.getId().equals(permanent.getId())) {
return true; return true;
} }
return false; return false;
@ -75,10 +74,12 @@ public class AttacksIfAbleTargetEffect extends RequirementEffect<AttacksIfAbleTa
@Override @Override
public String getText(Mode mode) { public String getText(Mode mode) {
if (this.duration == Duration.EndOfTurn) if (this.duration == Duration.EndOfTurn) {
return "Target " + mode.getTargets().get(0).getTargetName() + " attacks this turn if able"; return new StringBuilder("Target ").append(mode.getTargets().get(0).getTargetName()).append(" attacks this turn if able").toString();
else }
return "Target " + mode.getTargets().get(0).getTargetName() + " attacks each turn if able"; else {
return new StringBuilder("Target ").append(mode.getTargets().get(0).getTargetName()).append(" attacks each turn if able").toString();
}
} }
} }