mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
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:
parent
ec917c7a50
commit
2463418eca
1 changed files with 19 additions and 2 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue