mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 03:51:58 -08:00
- Fixed #5614
This commit is contained in:
parent
9a1edf7689
commit
26fd9f6088
3 changed files with 37 additions and 41 deletions
|
|
@ -2,26 +2,26 @@ package mage.cards.p;
|
|||
|
||||
import mage.MageInt;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.LoseLifeTargetEffect;
|
||||
import mage.abilities.effects.common.SacrificeEffect;
|
||||
import mage.abilities.effects.mana.BasicManaEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.predicate.permanent.AnotherPredicate;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.target.common.TargetControlledPermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.effects.common.LoseLifeTargetEffect;
|
||||
import mage.abilities.effects.common.SacrificeEffect;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.target.common.TargetControlledPermanent;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
|
|
@ -53,9 +53,9 @@ public final class PriestOfForgottenGods extends CardImpl {
|
|||
new SacrificeEffect(StaticFilters.FILTER_PERMANENT_CREATURE, 1, "")
|
||||
.setText("and sacrifice a creature")
|
||||
);
|
||||
ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(2, 2, filter, true)));
|
||||
ability.addEffect(new BasicManaEffect(Mana.BlackMana(2)).setText("You add {B}{B}"));
|
||||
ability.addEffect(new DrawCardSourceControllerEffect(1).setText("and draw a card"));
|
||||
ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(2, 2, filter, true)));
|
||||
ability.addTarget(new TargetPlayer(0, Integer.MAX_VALUE, false));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
|
|
@ -39,12 +39,13 @@ public class LoseLifeTargetEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
if (player != null) {
|
||||
player.loseLife(amount.calculate(game, source, this), game, false);
|
||||
return true;
|
||||
for (UUID playerId : targetPointer.getTargets(game, source)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
player.loseLife(amount.calculate(game, source, this), game, false);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||
|
|
@ -46,30 +46,25 @@ public class SacrificeEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
FilterPermanent newFilter = filter.copy(); // filter can be static, so it's important to copy here
|
||||
newFilter.add(new ControllerIdPredicate(player.getId()));
|
||||
|
||||
int amount = count.calculate(game, source, this);
|
||||
int realCount = game.getBattlefield().countAll(newFilter, player.getId(), game);
|
||||
amount = Math.min(amount, realCount);
|
||||
|
||||
Target target = new TargetPermanent(amount, amount, newFilter, true);
|
||||
|
||||
if (amount > 0 && target.canChoose(source.getSourceId(), player.getId(), game)) {
|
||||
while (!target.isChosen() && target.canChoose(player.getId(), game) && player.canRespond()) {
|
||||
player.chooseTarget(Outcome.Sacrifice, target, source, game);
|
||||
}
|
||||
|
||||
for (int idx = 0; idx < target.getTargets().size(); idx++) {
|
||||
Permanent permanent = game.getPermanent(target.getTargets().get(idx));
|
||||
|
||||
if (permanent != null) {
|
||||
permanent.sacrifice(source.getSourceId(), game);
|
||||
for (UUID playerId : targetPointer.getTargets(game, source)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
FilterPermanent newFilter = filter.copy(); // filter can be static, so it's important to copy here
|
||||
newFilter.add(new ControllerIdPredicate(player.getId()));
|
||||
int amount = count.calculate(game, source, this);
|
||||
int realCount = game.getBattlefield().countAll(newFilter, player.getId(), game);
|
||||
amount = Math.min(amount, realCount);
|
||||
Target target = new TargetPermanent(amount, amount, newFilter, true);
|
||||
if (amount > 0 && target.canChoose(source.getSourceId(), player.getId(), game)) {
|
||||
while (!target.isChosen() && target.canChoose(player.getId(), game) && player.canRespond()) {
|
||||
player.chooseTarget(Outcome.Sacrifice, target, source, game);
|
||||
}
|
||||
for (int idx = 0; idx < target.getTargets().size(); idx++) {
|
||||
Permanent permanent = game.getPermanent(target.getTargets().get(idx));
|
||||
if (permanent != null) {
|
||||
permanent.sacrifice(source.getSourceId(), game);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue