mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Merge pull request #2632 from spjspj/master
spjspj - Fix for Martyr's Bond
This commit is contained in:
commit
9d473500d1
1 changed files with 9 additions and 8 deletions
|
@ -137,10 +137,9 @@ class MartyrsBondEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
List<UUID> perms = new ArrayList<>();
|
List<UUID> perms = new ArrayList<>();
|
||||||
if (source != null) {
|
if (source != null) {
|
||||||
Card sourceCard = game.getCard(source.getSourceId());
|
|
||||||
Permanent saccedPermanent = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source));
|
Permanent saccedPermanent = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source));
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (controller != null && sourceCard != null && saccedPermanent != null) {
|
if (controller != null && saccedPermanent != null) {
|
||||||
FilterControlledPermanent filter = new FilterControlledPermanent();
|
FilterControlledPermanent filter = new FilterControlledPermanent();
|
||||||
String message = "permanent with type (";
|
String message = "permanent with type (";
|
||||||
boolean firstType = true;
|
boolean firstType = true;
|
||||||
|
@ -162,23 +161,25 @@ class MartyrsBondEffect extends OneShotEffect {
|
||||||
|
|
||||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||||
Player player = game.getPlayer(playerId);
|
Player player = game.getPlayer(playerId);
|
||||||
if (player != null && !playerId.equals(source.getControllerId())) {
|
if (player != null && !playerId.equals(controller.getId())) {
|
||||||
TargetControlledPermanent target = new TargetControlledPermanent(filter);
|
TargetControlledPermanent target = new TargetControlledPermanent(1, 1, filter, false);
|
||||||
target.setNotTarget(true);
|
if (target.canChoose(playerId, game)) {
|
||||||
if (target.canChoose(player.getId(), game)) {
|
|
||||||
player.chooseTarget(Outcome.Sacrifice, target, source, game);
|
player.chooseTarget(Outcome.Sacrifice, target, source, game);
|
||||||
perms.addAll(target.getTargets());
|
perms.add(target.getFirstTarget());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean saccedPermaents = false;
|
||||||
for (UUID permID : perms) {
|
for (UUID permID : perms) {
|
||||||
Permanent permanent = game.getPermanent(permID);
|
Permanent permanent = game.getPermanent(permID);
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
permanent.sacrifice(source.getSourceId(), game);
|
permanent.sacrifice(source.getSourceId(), game);
|
||||||
return true;
|
saccedPermaents = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return saccedPermaents;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue