Breath of Fury must successfully sacrifice its attached creature in order for the remainder of the effect to happen

This commit is contained in:
Duncan Townsend 2015-01-22 17:41:12 -05:00
parent 91b8089455
commit 542997be8f
No known key found for this signature in database
GPG key ID: C00ECDF315F7A593

View file

@ -145,22 +145,20 @@ class BreathOfFuryEffect extends OneShotEffect {
filter.add(new CanBeEnchantedPredicate(enchantment));
Target target = new TargetControlledCreaturePermanent(filter);
target.setNotTarget(true);
if (enchantedCreature != null && controller != null) {
// sacrifice the enchanted creature (don't check return state because controller has sarificed independant if something replaced later);
// e.g. Commander replacement effect going to command zone
enchantedCreature.sacrifice(source.getSourceId(), game);
if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) {
controller.choose(outcome, target, source.getSourceId(), game);
Permanent newCreature = game.getPermanent(target.getFirstTarget());
if (newCreature != null &&
newCreature.addAttachment(enchantment.getId(), game)) {
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(new FilterControlledCreaturePermanent(), controller.getId(), game)) {
permanent.untap(game);
}
game.getState().getTurnMods().add(new TurnMod(source.getControllerId(), TurnPhase.COMBAT, null, false));
// It's important to check that the creature was successfully sacrificed here. Effects that prevent sacrifice will also prevent Breath of Fury's effect from working.
// Commanders going to the command zone and Rest in Peace style replacement effects don't make Permanent.sacrifice return false.
if (enchantedCreature != null && controller != null
&& enchantedCreature.sacrifice(source.getSourceId(), game)
&& target.canChoose(source.getSourceId(), source.getControllerId(), game)) {
controller.choose(outcome, target, source.getSourceId(), game);
Permanent newCreature = game.getPermanent(target.getFirstTarget());
if (newCreature != null &&
newCreature.addAttachment(enchantment.getId(), game)) {
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(new FilterControlledCreaturePermanent(), controller.getId(), game)) {
permanent.untap(game);
}
game.getState().getTurnMods().add(new TurnMod(source.getControllerId(), TurnPhase.COMBAT, null, false));
}
return true;
}