mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00: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);
|
||||
if (defendingPlayerId != null) {
|
||||
// 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);
|
||||
}
|
||||
return true;
|
||||
|
@ -90,8 +90,8 @@ public class AnnihilatorAbility extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Annihilator " + count + "<i>(Whenever this creature attacks, defending player sacrifices " +
|
||||
(count == 1 ? "a permanent": CardUtil.numberToText(count) + " permanents") + ".)</i>";
|
||||
return "Annihilator " + count + "<i>(Whenever this creature attacks, defending player sacrifices "
|
||||
+ (count == 1 ? "a permanent" : CardUtil.numberToText(count) + " permanents") + ".)</i>";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -121,17 +121,17 @@ class AnnihilatorEffect extends OneShotEffect {
|
|||
UUID defendingPlayerId = (UUID) getValue("defendingPlayerId");
|
||||
Player player = null;
|
||||
if (defendingPlayerId != null) {
|
||||
player= game.getPlayer(defendingPlayerId);
|
||||
player = game.getPlayer(defendingPlayerId);
|
||||
}
|
||||
if (player != null) {
|
||||
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)) {
|
||||
while (!target.isChosen() && target.canChoose(player.getId(), game) && player.canRespond()) {
|
||||
player.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
|
||||
}
|
||||
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) {
|
||||
permanent.sacrifice(source.getSourceId(), game);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue