[STX] Implemented Teachings of the Archaics

This commit is contained in:
Evan Kranzler 2021-04-04 23:30:45 -04:00
parent f20c420b4d
commit faa58b613c
2 changed files with 80 additions and 0 deletions

View file

@ -0,0 +1,79 @@
package mage.cards.t;
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.constants.SubType;
import mage.game.Game;
import mage.players.Player;
import java.util.Objects;
import java.util.Set;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class TeachingsOfTheArchaics extends CardImpl {
public TeachingsOfTheArchaics(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{U}");
this.subtype.add(SubType.LESSON);
// If an opponent has more cards in hand than you, draw two cards. Draw three cards instead if an opponent has at least four more cards in hand than you.
this.getSpellAbility().addEffect(new TeachingsOfTheArchaicsEffect());
}
private TeachingsOfTheArchaics(final TeachingsOfTheArchaics card) {
super(card);
}
@Override
public TeachingsOfTheArchaics copy() {
return new TeachingsOfTheArchaics(this);
}
}
class TeachingsOfTheArchaicsEffect extends OneShotEffect {
TeachingsOfTheArchaicsEffect() {
super(Outcome.Benefit);
staticText = "if an opponent has more cards in hand than you, draw two cards. " +
"Draw three cards instead if an opponent has at least four more cards in hand than you";
}
private TeachingsOfTheArchaicsEffect(final TeachingsOfTheArchaicsEffect effect) {
super(effect);
}
@Override
public TeachingsOfTheArchaicsEffect copy() {
return new TeachingsOfTheArchaicsEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
int diff = game
.getOpponents(source.getControllerId())
.stream()
.map(game::getPlayer)
.filter(Objects::nonNull)
.map(Player::getHand)
.mapToInt(Set::size)
.max()
.orElse(0);
diff -= player.getHand().size();
if (diff <= 0) {
return false;
}
return player.drawCards(diff >= 4 ? 3 : 2, source, game) > 0;
}
}

View file

@ -214,6 +214,7 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet {
cards.add(new SetCardInfo("Tanazir Quandrix", 240, Rarity.MYTHIC, mage.cards.t.TanazirQuandrix.class));
cards.add(new SetCardInfo("Tangletrap", 145, Rarity.COMMON, mage.cards.t.Tangletrap.class));
cards.add(new SetCardInfo("Teach by Example", 241, Rarity.COMMON, mage.cards.t.TeachByExample.class));
cards.add(new SetCardInfo("Teachings of the Archaics", 57, Rarity.RARE, mage.cards.t.TeachingsOfTheArchaics.class));
cards.add(new SetCardInfo("Team Pennant", 260, Rarity.UNCOMMON, mage.cards.t.TeamPennant.class));
cards.add(new SetCardInfo("Tempted by the Oriq", 58, Rarity.RARE, mage.cards.t.TemptedByTheOriq.class));
cards.add(new SetCardInfo("Tenured Inkcaster", 88, Rarity.UNCOMMON, mage.cards.t.TenuredInkcaster.class));