[MIC] Implemented Visions of Glory

This commit is contained in:
Evan Kranzler 2021-09-16 09:34:22 -04:00
parent 244cacfe3b
commit 645779376f
8 changed files with 87 additions and 5 deletions

View file

@ -68,7 +68,7 @@ class StingingStudyEffect extends OneShotEffect {
for (Card commander : game.getCommanderCardsFromAnyZones(player, CommanderCardType.ANY, Zone.BATTLEFIELD, Zone.COMMAND)) {
manaValues.add(commander.getManaValue());
}
int chosenValue = 0;
int chosenValue;
if (manaValues.size() > 1) {
Choice choice = new ChoiceImpl(true);
choice.setChoices(manaValues.stream().map(x -> "" + x).collect(Collectors.toSet()));

View file

@ -0,0 +1,43 @@
package mage.cards.v;
import mage.abilities.costs.costadjusters.CommanderManaValueAdjuster;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.common.CreaturesYouControlCount;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.keyword.FlashbackAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.game.permanent.token.HumanToken;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class VisionsOfGlory extends CardImpl {
public VisionsOfGlory(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{W}");
// Create a 1/1 white Human creature token for each creature you control.
this.getSpellAbility().addEffect(new CreateTokenEffect(
new HumanToken(), CreaturesYouControlCount.instance
).setText("create a 1/1 white Human creature token for each creature you control"));
// Flashback {8}{W}{W}. This spell costs {X} less to cast this way, where X is the greatest mana value of a commander you own on the battlefield or in the command zone.
this.addAbility(new FlashbackAbility(this, new ManaCostsImpl<>("{8}{W}{W}"))
.setAbilityName("This spell costs {X} less to cast this way, where X is the greatest mana value " +
"of a commander you own on the battlefield or in the command zone.")
.setCostAdjuster(CommanderManaValueAdjuster.instance));
}
private VisionsOfGlory(final VisionsOfGlory card) {
super(card);
}
@Override
public VisionsOfGlory copy() {
return new VisionsOfGlory(this);
}
}

View file

@ -137,6 +137,7 @@ public final class MidnightHuntCommander extends ExpansionSet {
cards.add(new SetCardInfo("Undead Augur", 130, Rarity.UNCOMMON, mage.cards.u.UndeadAugur.class));
cards.add(new SetCardInfo("Verdurous Gearhulk", 145, Rarity.MYTHIC, mage.cards.v.VerdurousGearhulk.class));
cards.add(new SetCardInfo("Victory's Envoy", 96, Rarity.RARE, mage.cards.v.VictorysEnvoy.class));
cards.add(new SetCardInfo("Visions of Glory", 32, Rarity.RARE, mage.cards.v.VisionsOfGlory.class));
cards.add(new SetCardInfo("Wild Beastmaster", 146, Rarity.RARE, mage.cards.w.WildBeastmaster.class));
cards.add(new SetCardInfo("Wilhelt, the Rotcleaver", 2, Rarity.MYTHIC, mage.cards.w.WilheltTheRotcleaver.class));
cards.add(new SetCardInfo("Yavimaya Elder", 147, Rarity.COMMON, mage.cards.y.YavimayaElder.class));

View file

@ -543,7 +543,7 @@ public interface Ability extends Controllable, Serializable {
void adjustTargets(Game game);
void setCostAdjuster(CostAdjuster costAdjuster);
Ability setCostAdjuster(CostAdjuster costAdjuster);
CostAdjuster getCostAdjuster();

View file

@ -1323,8 +1323,9 @@ public abstract class AbilityImpl implements Ability {
* @param costAdjuster
*/
@Override
public void setCostAdjuster(CostAdjuster costAdjuster) {
public AbilityImpl setCostAdjuster(CostAdjuster costAdjuster) {
this.costAdjuster = costAdjuster;
return this;
}
@Override

View file

@ -0,0 +1,35 @@
package mage.abilities.costs.costadjusters;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.costs.CostAdjuster;
import mage.constants.CommanderCardType;
import mage.constants.Zone;
import mage.game.Game;
import mage.players.Player;
import mage.util.CardUtil;
/**
* @author TheElk801
*/
public enum CommanderManaValueAdjuster implements CostAdjuster {
instance;
@Override
public void adjustCosts(Ability ability, Game game) {
Player player = game.getPlayer(ability.getControllerId());
if (player == null) {
return;
}
int maxValue = game
.getCommanderCardsFromAnyZones(
player, CommanderCardType.ANY,
Zone.BATTLEFIELD, Zone.COMMAND
)
.stream()
.mapToInt(MageObject::getManaValue)
.max()
.orElse(0);
CardUtil.reduceCost(ability, maxValue);
}
}

View file

@ -177,8 +177,9 @@ public class FlashbackAbility extends SpellAbility {
*
* @param abilityName
*/
public void setAbilityName(String abilityName) {
public FlashbackAbility setAbilityName(String abilityName) {
this.abilityName = abilityName;
return this;
}
}

View file

@ -664,8 +664,9 @@ public class StackAbility extends StackObjectImpl implements Ability {
}
@Override
public void setCostAdjuster(CostAdjuster costAdjuster) {
public StackAbility setCostAdjuster(CostAdjuster costAdjuster) {
this.costAdjuster = costAdjuster;
return this;
}
@Override