mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
refactor: improved EachOpponentPermanentTargetsAdjuster and few card fixes (#12102)
* Wreck and Rebuild: Return a land, not a creature * Sinister Concierge should still gain suspend with 0 targets * Fixed Tolarian Contempt
This commit is contained in:
parent
fd0da67e46
commit
124d60e2b7
26 changed files with 65 additions and 38 deletions
|
|
@ -11,25 +11,23 @@ import mage.target.TargetPermanent;
|
|||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author notgreat
|
||||
*/
|
||||
public class EachOpponentPermanentTargetsAdjuster implements TargetAdjuster {
|
||||
private final TargetPermanent blueprintTarget;
|
||||
|
||||
private TargetPermanent blueprintTarget = null;
|
||||
/**
|
||||
* Duplicates the permanent target for each opponent.
|
||||
* Filtering of permanent's controllers will be handled inside, so
|
||||
* do not pass a blueprint target with a controller restriction filter/predicate.
|
||||
*
|
||||
* @param blueprintTarget The target to be duplicated per opponent
|
||||
*/
|
||||
public EachOpponentPermanentTargetsAdjuster(TargetPermanent blueprintTarget) {
|
||||
this.blueprintTarget = blueprintTarget.copy(); //Defensively copy the blueprint to ensure immutability
|
||||
public EachOpponentPermanentTargetsAdjuster() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (blueprintTarget == null) {
|
||||
blueprintTarget = (TargetPermanent) ability.getTargets().get(0).copy();
|
||||
}
|
||||
ability.getTargets().clear();
|
||||
for (UUID opponentId : game.getOpponents(ability.getControllerId())) {
|
||||
Player opponent = game.getPlayer(opponentId);
|
||||
|
|
@ -40,7 +38,7 @@ public class EachOpponentPermanentTargetsAdjuster implements TargetAdjuster {
|
|||
Filter<Permanent> filter = newTarget.getFilter();
|
||||
filter.add(new ControllerIdPredicate(opponentId));
|
||||
if (newTarget.canChoose(ability.getControllerId(), ability, game)) {
|
||||
filter.setMessage(filter.getMessage()+" controlled by " + opponent.getLogName());
|
||||
filter.setMessage(filter.getMessage() + " controlled by " + opponent.getLogName());
|
||||
ability.addTarget(newTarget);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue