Fumble effect not working per #5155 feedback

Bug on Fumble: Hello,I casted "Fumble" (Battlebond) targeting a Serra Ascendant, the spell resolved but the ascendant stayed on the battlefield. (reported by Endymion / 2018-07-20 15:28:06.142).
This commit is contained in:
Michael Simons 2018-08-03 00:21:16 -04:00 committed by GitHub
parent 097569148e
commit 79e94eef8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -66,7 +66,7 @@ class FumbleEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId());
Permanent permanent = game.getPermanent(source.getTargets().getFirstTarget());
Player player = game.getPlayer(source.getControllerId());
if (player == null || permanent == null) {
return false;
@ -75,10 +75,15 @@ class FumbleEffect extends OneShotEffect {
for (UUID permId : permanent.getAttachments()) {
Permanent attachment = game.getPermanent(permId);
if (attachment != null) {
attachments.add(permanent);
if (attachment.hasSubtype(SubType.AURA, game) || attachment.hasSubtype(SubType.EQUIPMENT, game)) {
attachments.add(attachment);
}
}
}
new ReturnToHandTargetEffect().apply(game, source);
if (!attachments.isEmpty()) {
Target target = new TargetCreaturePermanent(1, 1, StaticFilters.FILTER_PERMANENT_CREATURE, true);
Permanent newCreature = null;
if (player.choose(Outcome.BoostCreature, target, source.getSourceId(), game)) {
@ -95,6 +100,7 @@ class FumbleEffect extends OneShotEffect {
attachment.attachTo(newCreature.getId(), game);
}
}
}
return true;
}
}