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
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);
effect.setTargetPointer(new FixedTarget(creature.getId()));
game.addEffect(effect, source);

View file

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