mirror of
https://github.com/correl/mage.git
synced 2025-01-13 19:11:33 +00:00
- Fixed #9878
This commit is contained in:
parent
ae47bdce15
commit
400602882a
1 changed files with 15 additions and 9 deletions
|
@ -9,19 +9,23 @@ import mage.constants.CardType;
|
|||
import mage.constants.Outcome;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterPermanentCard;
|
||||
import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetAmount;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
import mage.target.common.TargetPermanentAmount;
|
||||
import mage.target.targetpointer.SecondTargetPointer;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.counter.DistributeCountersEffect;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.target.TargetAmount;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.common.TargetCreaturePermanentAmount;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
|
@ -54,8 +58,8 @@ class InvokeJusticeEffect extends OneShotEffect {
|
|||
|
||||
InvokeJusticeEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = ", then distribute four +1/+1 counters among " +
|
||||
"any number of creatures and/or Vehicles target player controls";
|
||||
staticText = ", then distribute four +1/+1 counters among "
|
||||
+ "any number of creatures and/or Vehicles target player controls";
|
||||
this.setTargetPointer(new SecondTargetPointer());
|
||||
}
|
||||
|
||||
|
@ -75,20 +79,22 @@ class InvokeJusticeEffect extends OneShotEffect {
|
|||
if (controller == null || player == null) {
|
||||
return false;
|
||||
}
|
||||
FilterPermanent filter = new FilterPermanent(
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent(
|
||||
"creatures and/or Vehicles controlled by " + player.getName()
|
||||
);
|
||||
filter.add(new ControllerIdPredicate(player.getId()));
|
||||
if (!game.getBattlefield().contains(filter, source, game, 1)) {
|
||||
return false;
|
||||
}
|
||||
TargetAmount target = new TargetPermanentAmount(4, filter);
|
||||
// todo: the pop-up window for assigning the amount of counters uses the damage GUI. it should have its own GUI for assigning counters
|
||||
TargetAmount target = new TargetCreaturePermanentAmount(4, filter);
|
||||
target.setNotTarget(true);
|
||||
controller.choose(outcome, target, source, game);
|
||||
// note, when using TargetAmount, the target must be used to embed the chosen creatures in this case
|
||||
target.chooseTarget(outcome, player.getId(), source, game);
|
||||
for (UUID targetId : target.getTargets()) {
|
||||
Permanent permanent = game.getPermanent(targetId);
|
||||
if (permanent != null) {
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(target.getTargetAmount(targetId)), source, game);
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(target.getTargetAmount(targetId)), source.getControllerId(), source, game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue