[STX] Implemented Golden Ratio

This commit is contained in:
Evan Kranzler 2021-03-31 08:50:01 -04:00
parent dd8586cd15
commit 473eca6bfc
2 changed files with 78 additions and 0 deletions

View file

@ -0,0 +1,77 @@
package mage.cards.g;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.players.Player;
import java.util.Objects;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class GoldenRatio extends CardImpl {
public GoldenRatio(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{G}{U}");
// Draw a card for each different power among creatures you control.
this.getSpellAbility().addEffect(new GoldenRatioEffect());
}
private GoldenRatio(final GoldenRatio card) {
super(card);
}
@Override
public GoldenRatio copy() {
return new GoldenRatio(this);
}
}
class GoldenRatioEffect extends OneShotEffect {
GoldenRatioEffect() {
super(Outcome.Benefit);
staticText = "draw a card for each different power among creatures you control";
}
private GoldenRatioEffect(final GoldenRatioEffect effect) {
super(effect);
}
@Override
public GoldenRatioEffect copy() {
return new GoldenRatioEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
int unique = game
.getBattlefield()
.getActivePermanents(
StaticFilters.FILTER_CONTROLLED_CREATURE,
source.getControllerId(), source.getSourceId(), game
)
.stream()
.filter(Objects::nonNull)
.map(MageObject::getPower)
.mapToInt(MageInt::getValue)
.distinct()
.map(x -> 1)
.sum();
return player.drawCards(unique, source, game) > 0;
}
}

View file

@ -55,6 +55,7 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet {
cards.add(new SetCardInfo("Frostboil Snarl", 265, Rarity.RARE, mage.cards.f.FrostboilSnarl.class));
cards.add(new SetCardInfo("Furycalm Snarl", 266, Rarity.RARE, mage.cards.f.FurycalmSnarl.class));
cards.add(new SetCardInfo("Go Blank", 72, Rarity.UNCOMMON, mage.cards.g.GoBlank.class));
cards.add(new SetCardInfo("Golden Ratio", 190, Rarity.UNCOMMON, mage.cards.g.GoldenRatio.class));
cards.add(new SetCardInfo("Grinning Ignus", 104, Rarity.UNCOMMON, mage.cards.g.GrinningIgnus.class));
cards.add(new SetCardInfo("Heated Debate", 106, Rarity.COMMON, mage.cards.h.HeatedDebate.class));
cards.add(new SetCardInfo("Igneous Inspiration", 107, Rarity.UNCOMMON, mage.cards.i.IgneousInspiration.class));