mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 19:41:59 -08:00
* AnnihilatorAbility - Fixed that the sacrifice effect was handled targeted.
This commit is contained in:
parent
0a341ea1eb
commit
b14c5d059b
1 changed files with 11 additions and 11 deletions
|
|
@ -79,7 +79,7 @@ public class AnnihilatorAbility extends TriggeredAbilityImpl {
|
||||||
UUID defendingPlayerId = game.getCombat().getDefendingPlayerId(sourceId, game);
|
UUID defendingPlayerId = game.getCombat().getDefendingPlayerId(sourceId, game);
|
||||||
if (defendingPlayerId != null) {
|
if (defendingPlayerId != null) {
|
||||||
// the id has to be set here because the source can be leave battlefield
|
// the id has to be set here because the source can be leave battlefield
|
||||||
for(Effect effect : getEffects()) {
|
for (Effect effect : getEffects()) {
|
||||||
effect.setValue("defendingPlayerId", defendingPlayerId);
|
effect.setValue("defendingPlayerId", defendingPlayerId);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -90,8 +90,8 @@ public class AnnihilatorAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRule() {
|
public String getRule() {
|
||||||
return "Annihilator " + count + "<i>(Whenever this creature attacks, defending player sacrifices " +
|
return "Annihilator " + count + "<i>(Whenever this creature attacks, defending player sacrifices "
|
||||||
(count == 1 ? "a permanent": CardUtil.numberToText(count) + " permanents") + ".)</i>";
|
+ (count == 1 ? "a permanent" : CardUtil.numberToText(count) + " permanents") + ".)</i>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -121,17 +121,17 @@ class AnnihilatorEffect extends OneShotEffect {
|
||||||
UUID defendingPlayerId = (UUID) getValue("defendingPlayerId");
|
UUID defendingPlayerId = (UUID) getValue("defendingPlayerId");
|
||||||
Player player = null;
|
Player player = null;
|
||||||
if (defendingPlayerId != null) {
|
if (defendingPlayerId != null) {
|
||||||
player= game.getPlayer(defendingPlayerId);
|
player = game.getPlayer(defendingPlayerId);
|
||||||
}
|
}
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
int amount = Math.min(count, game.getBattlefield().countAll(filter, player.getId(), game));
|
int amount = Math.min(count, game.getBattlefield().countAll(filter, player.getId(), game));
|
||||||
Target target = new TargetControlledPermanent(amount, amount, filter, false);
|
Target target = new TargetControlledPermanent(amount, amount, filter, true);
|
||||||
if (target.canChoose(player.getId(), game)) {
|
if (target.canChoose(player.getId(), game)) {
|
||||||
while (!target.isChosen() && target.canChoose(player.getId(), game) && player.canRespond()) {
|
while (!target.isChosen() && target.canChoose(player.getId(), game) && player.canRespond()) {
|
||||||
player.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
|
player.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
|
||||||
}
|
}
|
||||||
for (int idx = 0; idx < target.getTargets().size(); idx++) {
|
for (int idx = 0; idx < target.getTargets().size(); idx++) {
|
||||||
Permanent permanent = game.getPermanent((UUID) target.getTargets().get(idx));
|
Permanent permanent = game.getPermanent(target.getTargets().get(idx));
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
permanent.sacrifice(source.getSourceId(), game);
|
permanent.sacrifice(source.getSourceId(), game);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue