use of mage.abilities.Modes in project mage by magefree.
the class AdventureCardSpellAbility method getRule.
@Override
public String getRule() {
StringBuilder sbRule = new StringBuilder();
sbRule.append(this.nameFull);
sbRule.append(" ");
sbRule.append(manaCosts.getText());
sbRule.append(" — ");
Modes modes = this.getModes();
if (modes.size() <= 1) {
sbRule.append(modes.getMode().getEffects().getTextStartingUpperCase(modes.getMode()));
} else {
sbRule.append(getModes().getText());
}
sbRule.append(" <i>(Then exile this card. You may cast the creature later from exile.)</i>");
return sbRule.toString();
}
use of mage.abilities.Modes in project mage by magefree.
the class StackAbilityView method updateTargets.
private void updateTargets(Game game, StackAbility ability) {
List<String> names = new ArrayList<>();
for (UUID modeId : ability.getModes().getSelectedModes()) {
Mode mode = ability.getModes().get(modeId);
if (!mode.getTargets().isEmpty()) {
addTargets(mode.getTargets(), mode.getEffects(), ability, game);
} 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.isEmpty()) {
overrideTargets(targetList);
for (UUID uuid : targetList) {
MageObject mageObject = game.getObject(uuid);
if (mageObject != null) {
if ((mageObject instanceof Card) && ((Card) mageObject).isFaceDown(game)) {
continue;
}
String newName = GameLog.getColoredObjectIdNameForTooltip(mageObject);
if (!names.contains(newName)) {
names.add(newName);
}
}
}
}
}
}
if (!names.isEmpty()) {
getRules().add("<i>Related objects: " + names + "</i>");
}
// show for modal ability, which mode was choosen
if (ability.isModal()) {
Modes modes = ability.getModes();
for (UUID modeId : modes.getSelectedModes()) {
Mode mode = modes.get(modeId);
this.rules.add("<span color='green'><i>Chosen mode: " + mode.getEffects().getText(mode) + "</i></span>");
}
}
if (HintUtils.ABILITY_HINTS_ENABLE) {
List<String> abilityHints = new ArrayList<>();
for (Hint hint : ability.getHints()) {
abilityHints.add(hint.getText(game, ability));
}
// total hints
if (!abilityHints.isEmpty()) {
rules.add(HintUtils.HINT_START_MARK);
HintUtils.appendHints(rules, abilityHints);
}
}
}
Aggregations