@Override public void adjustTargets(Ability ability, Game game) { if (ability.getOriginalId().equals(originalId)) { for (Effect effect : ability.getEffects()) { UUID opponentId = effect.getTargetPointer().getFirst(game, ability); Player opponent = game.getPlayer(opponentId); if (opponent != null) { effect.setTargetPointer(new FirstTargetPointer()); FilterCreaturePermanent filter = new FilterCreaturePermanent("a creature from the active opponent"); filter.add(new ControllerIdPredicate(opponentId)); Target target = new TargetCreaturePermanent(filter); ability.addTarget(target); } } } }
private void updateTargets(Game game, StackAbility ability) { List<String> names = new ArrayList<>(); for (Mode mode : ability.getModes().getSelectedModes()) { if (mode.getTargets().size() > 0) { setTargets(mode.getTargets()); } else { List<UUID> targetList = new ArrayList<>(); for (Effect effect : mode.getEffects()) { TargetPointer targetPointer = effect.getTargetPointer(); if (targetPointer instanceof FixedTarget) { targetList.add(((FixedTarget) targetPointer).getTarget()); } } if (targetList.size() > 0) { overrideTargets(targetList); for (UUID uuid : targetList) { MageObject mageObject = game.getObject(uuid); if (mageObject != null) { if ((mageObject instanceof Card) && ((Card) mageObject).isFaceDown(game)) { continue; } names.add(GameLog.getColoredObjectIdNameForTooltip(mageObject)); } } } } } if (!names.isEmpty()) { getRules().add("<i>Related objects: " + names.toString() + "</i>"); } // show for modal ability, which mode was choosen if (ability.isModal()) { Modes modes = ability.getModes(); for (Mode mode : modes.getSelectedModes()) { this.rules.add( "<span color='green'><i>Chosen mode: " + mode.getEffects().getText(mode) + "</i></span>"); } } }
private void updateTargets(Game game, StackAbility ability) { List<String> names = new ArrayList<>(); for (UUID modeId : ability.getModes().getSelectedModes()) { ability.getModes().setMode(ability.getModes().get(modeId)); if (ability.getTargets().size() > 0) { setTargets(ability.getTargets()); } else { List<UUID> targetList = new ArrayList<>(); for (Effect effect : ability.getEffects()) { TargetPointer targetPointer = effect.getTargetPointer(); if (targetPointer instanceof FixedTarget) { targetList.add(((FixedTarget) targetPointer).getTarget()); } } if (targetList.size() > 0) { overrideTargets(targetList); for (UUID uuid : targetList) { MageObject mageObject = game.getObject(uuid); if (mageObject != null) { names.add(mageObject.getLogName()); } } } } } if (!names.isEmpty()) { getRules().add("<i>Targets: " + names.toString() + "</i>"); } // show for modal ability, which mode was choosen if (ability.isModal()) { Modes modes = ability.getModes(); for (UUID modeId : modes.getSelectedModes()) { modes.setMode(modes.get(modeId)); this.rules.add( "<span color='green'><i>Chosen mode: " + ability.getEffects().getText(modes.get(modeId)) + "</i></span>"); } } }