mirror of
https://github.com/magefree/mage.git
synced 2025-12-30 07:22:03 -08:00
Grave Pact, Dictate of Erebos, Butcher of Malakir, Agent of The Fates, Tribute to the Wild and Yawning Fissure - Fixed that the selection for the object to sacrifice was handled targeted.
This commit is contained in:
parent
04d555d339
commit
fa2f7e2055
2 changed files with 23 additions and 15 deletions
|
|
@ -27,6 +27,8 @@
|
|||
*/
|
||||
package mage.sets.ninthedition;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
|
|
@ -41,7 +43,6 @@ import mage.game.events.GameEvent;
|
|||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
|
||||
/**
|
||||
|
|
@ -121,18 +122,28 @@ class GravePactEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
for (UUID playerId : game.getPlayerList()) {
|
||||
if (!playerId.equals(source.getControllerId())) {
|
||||
List<UUID> perms = new ArrayList<>();
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID playerId : controller.getInRange()) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
Target target = new TargetControlledCreaturePermanent();
|
||||
if (player != null && player.choose(Outcome.Sacrifice, target, source.getSourceId(), game)) {
|
||||
Permanent permanent = game.getPermanent(target.getFirstTarget());
|
||||
if (permanent != null) {
|
||||
permanent.sacrifice(source.getSourceId(), game);
|
||||
if (player != null && !playerId.equals(source.getControllerId())) {
|
||||
TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent();
|
||||
target.setNotTarget(true);
|
||||
if (target.canChoose(player.getId(), game)) {
|
||||
player.chooseTarget(Outcome.Sacrifice, target, source, game);
|
||||
perms.addAll(target.getTargets());
|
||||
}
|
||||
}
|
||||
}
|
||||
for (UUID permID : perms) {
|
||||
Permanent permanent = game.getPermanent(permID);
|
||||
if (permanent != null) {
|
||||
permanent.sacrifice(source.getSourceId(), game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,14 +87,11 @@ public class SacrificeOpponentsEffect extends OneShotEffect {
|
|||
filter.add(new ControllerPredicate(TargetController.YOU));
|
||||
for (UUID playerId : game.getOpponents(source.getControllerId())) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
|
||||
if (player != null) {
|
||||
int numTargets = Math.min(amount.calculate(game, source, this), game.getBattlefield().countAll(filter, player.getId(), game));
|
||||
TargetPermanent target = new TargetPermanent(numTargets, numTargets, filter, false);
|
||||
TargetPermanent target = new TargetPermanent(numTargets, numTargets, filter, true);
|
||||
if (target.canChoose(player.getId(), game)) {
|
||||
while (!target.isChosen() && player.isInGame()) {
|
||||
player.chooseTarget(Outcome.Sacrifice, target, source, game);
|
||||
}
|
||||
player.chooseTarget(Outcome.Sacrifice, target, source, game);
|
||||
perms.addAll(target.getTargets());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue