Breath of Fury had strange behavior when it was attached to a creature other than the one that caused its trigger when its trigger resolved. Fixed.

This commit is contained in:
Duncan Townsend 2015-01-24 20:23:48 -05:00
parent ec917c7a50
commit 2463418eca
No known key found for this signature in database
GPG key ID: C00ECDF315F7A593

View file

@ -157,8 +157,25 @@ class BreathOfFuryEffect extends OneShotEffect {
&& target.canChoose(source.getSourceId(), controller.getId(), game)) { && target.canChoose(source.getSourceId(), controller.getId(), game)) {
controller.choose(outcome, target, source.getSourceId(), game); controller.choose(outcome, target, source.getSourceId(), game);
Permanent newCreature = game.getPermanent(target.getFirstTarget()); Permanent newCreature = game.getPermanent(target.getFirstTarget());
if (newCreature != null && boolean success = false;
newCreature.addAttachment(enchantment.getId(), game)) { if (newCreature != null) {
Permanent oldCreature = game.getPermanent(enchantment.getAttachedTo());
if (oldCreature != null) {
if (oldCreature.getId().equals(newCreature.getId())) {
success = true;
} else {
if (oldCreature.removeAttachment(enchantment.getId(), game)
&& newCreature.addAttachment(enchantment.getId(), game)) {
game.informPlayers(enchantment.getLogName() + " was unattached from " + oldCreature.getLogName() + " and attached to " + newCreature.getLogName());
success = true;
}
}
} else if (newCreature.addAttachment(enchantment.getId(), game)) {
game.informPlayers(enchantment.getLogName() + " was attached to " + newCreature.getLogName());
success = true;
}
}
if (success) {
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(new FilterControlledCreaturePermanent(), controller.getId(), game)) { for (Permanent permanent : game.getBattlefield().getAllActivePermanents(new FilterControlledCreaturePermanent(), controller.getId(), game)) {
permanent.untap(game); permanent.untap(game);
} }