Skip to content

Commit

Permalink
Merge pull request #11431 from Susucre/lci-mana-tracking
Browse files Browse the repository at this point in the history
[LCI] Implement Thousand Moons Smithy // Barracks of the Thousand and Brass's Tunnel-Grinder // Tecutlan, the Searing Rift
  • Loading branch information
JayDi85 authored Nov 25, 2023
2 parents ab515e6 + d159c45 commit 99cbddb
Show file tree
Hide file tree
Showing 10 changed files with 639 additions and 0 deletions.
56 changes: 56 additions & 0 deletions Mage.Sets/src/mage/cards/b/BarracksOfTheThousand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package mage.cards.b;

import mage.abilities.common.CastSpellPaidBySourceTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.mana.WhiteManaAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SuperType;
import mage.filter.FilterSpell;
import mage.filter.predicate.Predicates;
import mage.game.permanent.token.GnomeSoldierStarStarToken;

import java.util.UUID;

/**
* @author Susucr
*/
public final class BarracksOfTheThousand extends CardImpl {

private static final FilterSpell filter = new FilterSpell("an artifact or creature spell");

static {
filter.add(Predicates.or(
CardType.ARTIFACT.getPredicate(),
CardType.CREATURE.getPredicate()
));
}

public BarracksOfTheThousand(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT, CardType.LAND}, "");

this.supertype.add(SuperType.LEGENDARY);

// (Transforms from Thousand Moons Smithy.)
this.nightCard = true;

// {T}: Add {W}.
this.addAbility(new WhiteManaAbility());

// Whenever you cast an artifact or creature spell using mana produced by Barracks of the Thousand, create a white Gnome Soldier artifact creature token with "This creature's power and toughness are each equal to the number of artifacts and/or creatures you control."
this.addAbility(new CastSpellPaidBySourceTriggeredAbility(
new CreateTokenEffect(new GnomeSoldierStarStarToken()),
filter, false
));
}

private BarracksOfTheThousand(final BarracksOfTheThousand card) {
super(card);
}

@Override
public BarracksOfTheThousand copy() {
return new BarracksOfTheThousand(this);
}
}
97 changes: 97 additions & 0 deletions Mage.Sets/src/mage/cards/b/BrasssTunnelGrinder.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
package mage.cards.b;

import mage.abilities.Ability;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.condition.common.DescendedThisTurnCondition;
import mage.abilities.condition.common.SourceHasCounterCondition;
import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.dynamicvalue.common.DescendedThisTurnCount;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.RemoveAllCountersSourceEffect;
import mage.abilities.effects.common.TransformSourceEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.TransformAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SuperType;
import mage.constants.TargetController;
import mage.counters.CounterType;
import mage.game.Game;
import mage.players.Player;
import mage.watchers.common.DescendedWatcher;

import java.util.UUID;

/**
* @author Susucr
*/
public final class BrasssTunnelGrinder extends CardImpl {

public BrasssTunnelGrinder(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}{R}");
this.secondSideCardClazz = mage.cards.t.TecutlanTheSearingRift.class;

this.supertype.add(SuperType.LEGENDARY);

// When Brass's Tunnel-Grinder enters the battlefield, discard any number of cards, then draw that many cards plus one.
this.addAbility(new EntersBattlefieldTriggeredAbility(new BrasssTunnelGrinderEffect()));

// At the beginning of your end step, if you descended this turn, put a bore counter on Brass's Tunnel-Grinder. Then if there are three or more bore counters on it, remove those counters and transform it.
this.addAbility(new TransformAbility());
Ability ability = new BeginningOfEndStepTriggeredAbility(
new AddCountersSourceEffect(CounterType.BORE.createInstance()),
TargetController.YOU, DescendedThisTurnCondition.instance, false
);

ConditionalOneShotEffect secondCheck = new ConditionalOneShotEffect(
new RemoveAllCountersSourceEffect(CounterType.BORE),
new SourceHasCounterCondition(CounterType.BORE, 3, Integer.MAX_VALUE),
"Then if there are three or more bore counters on it, remove those counters and transform it"
);
secondCheck.addEffect(new TransformSourceEffect());
ability.addEffect(secondCheck);
ability.addHint(DescendedThisTurnCount.getHint());
this.addAbility(ability, new DescendedWatcher());
}

private BrasssTunnelGrinder(final BrasssTunnelGrinder card) {
super(card);
}

@Override
public BrasssTunnelGrinder copy() {
return new BrasssTunnelGrinder(this);
}
}

class BrasssTunnelGrinderEffect extends OneShotEffect {

BrasssTunnelGrinderEffect() {
super(Outcome.DrawCard);
staticText = "discard any number of cards, then draw that many cards plus one";
}

private BrasssTunnelGrinderEffect(final BrasssTunnelGrinderEffect effect) {
super(effect);
}

@Override
public BrasssTunnelGrinderEffect copy() {
return new BrasssTunnelGrinderEffect(this);
}

@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}

int dicarded = player.discard(0, Integer.MAX_VALUE, false, source, game).size();
player.drawCards(1 + dicarded, source, game);
return true;
}
}
92 changes: 92 additions & 0 deletions Mage.Sets/src/mage/cards/t/TecutlanTheSearingRift.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
package mage.cards.t;

import mage.abilities.Ability;
import mage.abilities.common.CastSpellPaidBySourceTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.keyword.DiscoverEffect;
import mage.abilities.mana.RedManaAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.filter.FilterSpell;
import mage.filter.predicate.mageobject.PermanentPredicate;
import mage.game.Game;
import mage.game.stack.Spell;
import mage.players.Player;

import java.util.UUID;

/**
* @author Susucr
*/
public final class TecutlanTheSearingRift extends CardImpl {

private static final FilterSpell filter = new FilterSpell("a permanent spell");

static {
filter.add(PermanentPredicate.instance);
}

public TecutlanTheSearingRift(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");

this.supertype.add(SuperType.LEGENDARY);
this.subtype.add(SubType.CAVE);

// (Transforms from Brass's Tunnel-Grinder.)
this.nightCard = true;

// {T}: Add {R}.
this.addAbility(new RedManaAbility());

// Whenever you cast a permanent spell using mana produced by Tecutlan, the Searing Rift, discover X, where X is that spell's mana value.
this.addAbility(new CastSpellPaidBySourceTriggeredAbility(
new TecutlanTheSearingRiftEffect(),
filter, true
));
}

private TecutlanTheSearingRift(final TecutlanTheSearingRift card) {
super(card);
}

@Override
public TecutlanTheSearingRift copy() {
return new TecutlanTheSearingRift(this);
}
}

class TecutlanTheSearingRiftEffect extends OneShotEffect {

TecutlanTheSearingRiftEffect() {
super(Outcome.Benefit);
staticText = "discover X, where X is that spell's mana value";
}

private TecutlanTheSearingRiftEffect(final TecutlanTheSearingRiftEffect effect) {
super(effect);
}

@Override
public TecutlanTheSearingRiftEffect copy() {
return new TecutlanTheSearingRiftEffect(this);
}

@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}

Spell spell = game.getSpellOrLKIStack(getTargetPointer().getFirst(game, source));
int mv = spell == null ? 0 : Math.max(0, spell.getManaValue());

DiscoverEffect.doDiscover(controller, mv, game, source);
return true;
}

}
68 changes: 68 additions & 0 deletions Mage.Sets/src/mage/cards/t/ThousandMoonsSmithy.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package mage.cards.t;

import mage.abilities.common.BeginningOfPreCombatMainTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.costs.common.TapTargetCost;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.TransformSourceEffect;
import mage.abilities.keyword.TransformAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SuperType;
import mage.constants.TargetController;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.permanent.TappedPredicate;
import mage.game.permanent.token.GnomeSoldierStarStarToken;
import mage.target.common.TargetControlledPermanent;

import java.util.UUID;

/**
* @author Susucr
*/
public final class ThousandMoonsSmithy extends CardImpl {

public static final FilterControlledPermanent filter =
new FilterControlledPermanent("untapped artifacts and/or creatures you control");

static {
filter.add(TappedPredicate.UNTAPPED);
filter.add(Predicates.or(
CardType.CREATURE.getPredicate(),
CardType.ARTIFACT.getPredicate()
));
}

public ThousandMoonsSmithy(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}{W}{W}");
this.secondSideCardClazz = mage.cards.b.BarracksOfTheThousand.class;

this.supertype.add(SuperType.LEGENDARY);

// When Thousand Moons Smithy enters the battlefield, create a white Gnome Soldier artifact creature token with "This creature's power and toughness are each equal to the number of artifacts and/or creatures you control."
this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new GnomeSoldierStarStarToken())));

// At the beginning of your precombat main phase, you may tap five untapped artifacts and/or creatures you control. If you do, transform Thousand Moons Smithy.
this.addAbility(new TransformAbility());
this.addAbility(new BeginningOfPreCombatMainTriggeredAbility(
new DoIfCostPaid(
new TransformSourceEffect(),
new TapTargetCost(new TargetControlledPermanent(5, filter))
),
TargetController.YOU,
false
));
}

private ThousandMoonsSmithy(final ThousandMoonsSmithy card) {
super(card);
}

@Override
public ThousandMoonsSmithy copy() {
return new ThousandMoonsSmithy(this);
}
}
4 changes: 4 additions & 0 deletions Mage.Sets/src/mage/sets/TheLostCavernsOfIxalan.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ private TheLostCavernsOfIxalan() {
cards.add(new SetCardInfo("Another Chance", 90, Rarity.COMMON, mage.cards.a.AnotherChance.class));
cards.add(new SetCardInfo("Armored Kincaller", 174, Rarity.COMMON, mage.cards.a.ArmoredKincaller.class));
cards.add(new SetCardInfo("Attentive Sunscribe", 4, Rarity.COMMON, mage.cards.a.AttentiveSunscribe.class));
cards.add(new SetCardInfo("Barracks of the Thousand", 39, Rarity.RARE, mage.cards.b.BarracksOfTheThousand.class));
cards.add(new SetCardInfo("Bartolome del Presidio", 224, Rarity.UNCOMMON, mage.cards.b.BartolomeDelPresidio.class));
cards.add(new SetCardInfo("Basking Capybara", 175, Rarity.COMMON, mage.cards.b.BaskingCapybara.class));
cards.add(new SetCardInfo("Bat Colony", 5, Rarity.UNCOMMON, mage.cards.b.BatColony.class));
Expand All @@ -67,6 +68,7 @@ private TheLostCavernsOfIxalan() {
cards.add(new SetCardInfo("Brackish Blunder", 46, Rarity.COMMON, mage.cards.b.BrackishBlunder.class));
cards.add(new SetCardInfo("Braided Net", 47, Rarity.RARE, mage.cards.b.BraidedNet.class));
cards.add(new SetCardInfo("Braided Quipu", 47, Rarity.RARE, mage.cards.b.BraidedQuipu.class));
cards.add(new SetCardInfo("Brass's Tunnel-Grinder", 135, Rarity.RARE, mage.cards.b.BrasssTunnelGrinder.class));
cards.add(new SetCardInfo("Brazen Blademaster", 136, Rarity.COMMON, mage.cards.b.BrazenBlademaster.class));
cards.add(new SetCardInfo("Breeches, Eager Pillager", 137, Rarity.RARE, mage.cards.b.BreechesEagerPillager.class));
cards.add(new SetCardInfo("Bringer of the Last Gift", 94, Rarity.RARE, mage.cards.b.BringerOfTheLastGift.class));
Expand Down Expand Up @@ -310,6 +312,7 @@ private TheLostCavernsOfIxalan() {
cards.add(new SetCardInfo("Synapse Necromage", 125, Rarity.UNCOMMON, mage.cards.s.SynapseNecromage.class));
cards.add(new SetCardInfo("Tarrian's Soulcleaver", 264, Rarity.RARE, mage.cards.t.TarriansSoulcleaver.class));
cards.add(new SetCardInfo("Tectonic Hazard", 169, Rarity.COMMON, mage.cards.t.TectonicHazard.class));
cards.add(new SetCardInfo("Tecutlan, the Searing Rift", 135, Rarity.RARE, mage.cards.t.TecutlanTheSearingRift.class));
cards.add(new SetCardInfo("Temple of Civilization", 26, Rarity.MYTHIC, mage.cards.t.TempleOfCivilization.class));
cards.add(new SetCardInfo("Temple of Cultivation", 204, Rarity.MYTHIC, mage.cards.t.TempleOfCultivation.class));
cards.add(new SetCardInfo("Temple of Cyclical Time", 67, Rarity.MYTHIC, mage.cards.t.TempleOfCyclicalTime.class));
Expand All @@ -327,6 +330,7 @@ private TheLostCavernsOfIxalan() {
cards.add(new SetCardInfo("The Skullspore Nexus", 212, Rarity.MYTHIC, mage.cards.t.TheSkullsporeNexus.class));
cards.add(new SetCardInfo("Thousand Moons Crackshot", 37, Rarity.COMMON, mage.cards.t.ThousandMoonsCrackshot.class));
cards.add(new SetCardInfo("Thousand Moons Infantry", 38, Rarity.COMMON, mage.cards.t.ThousandMoonsInfantry.class));
cards.add(new SetCardInfo("Thousand Moons Smithy", 39, Rarity.RARE, mage.cards.t.ThousandMoonsSmithy.class));
cards.add(new SetCardInfo("Thrashing Brontodon", 216, Rarity.UNCOMMON, mage.cards.t.ThrashingBrontodon.class));
cards.add(new SetCardInfo("Threefold Thunderhulk", 265, Rarity.RARE, mage.cards.t.ThreefoldThunderhulk.class));
cards.add(new SetCardInfo("Throne of the Grim Captain", 266, Rarity.RARE, mage.cards.t.ThroneOfTheGrimCaptain.class));
Expand Down
Loading

0 comments on commit 99cbddb

Please sign in to comment.