- little fixes

This commit is contained in:
Jeff 2019-03-06 17:11:45 -06:00
parent ee3f592186
commit 5220e44b16
2 changed files with 13 additions and 7 deletions

View file

@ -39,13 +39,15 @@ public class LoseLifeTargetEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
boolean applied = false;
for (UUID playerId : targetPointer.getTargets(game, source)) { for (UUID playerId : targetPointer.getTargets(game, source)) {
Player player = game.getPlayer(playerId); Player player = game.getPlayer(playerId);
if (player != null) { if (player != null
player.loseLife(amount.calculate(game, source, this), game, false); && player.loseLife(amount.calculate(game, source, this), game, false) > 0) {
applied = true;
} }
} }
return true; return applied;
} }
@Override @Override

View file

@ -46,6 +46,7 @@ public class SacrificeEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
boolean applied = false;
for (UUID playerId : targetPointer.getTargets(game, source)) { for (UUID playerId : targetPointer.getTargets(game, source)) {
Player player = game.getPlayer(playerId); Player player = game.getPlayer(playerId);
if (player != null) { if (player != null) {
@ -56,19 +57,22 @@ public class SacrificeEffect extends OneShotEffect {
amount = Math.min(amount, realCount); amount = Math.min(amount, realCount);
Target target = new TargetPermanent(amount, amount, newFilter, true); Target target = new TargetPermanent(amount, amount, newFilter, true);
if (amount > 0 && target.canChoose(source.getSourceId(), player.getId(), game)) { if (amount > 0 && target.canChoose(source.getSourceId(), player.getId(), game)) {
while (!target.isChosen() && target.canChoose(player.getId(), game) && player.canRespond()) { while (!target.isChosen()
&& target.canChoose(player.getId(), game)
&& player.canRespond()) {
player.chooseTarget(Outcome.Sacrifice, target, source, game); player.chooseTarget(Outcome.Sacrifice, target, source, game);
} }
for (int idx = 0; idx < target.getTargets().size(); idx++) { for (int idx = 0; idx < target.getTargets().size(); idx++) {
Permanent permanent = game.getPermanent(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)) {
applied = true;
} }
} }
} }
} }
} }
return true; return applied;
} }
public void setAmount(DynamicValue amount) { public void setAmount(DynamicValue amount) {