[LCI] Implement Curator of Sun's Creation

This commit is contained in:
Susucre 2023-11-01 20:12:49 +01:00
parent 77408164f1
commit bc335b949b
6 changed files with 155 additions and 2 deletions

View file

@ -0,0 +1,83 @@
package mage.cards.c;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.keyword.DiscoverEffect;
import mage.abilities.hint.StaticHint;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import java.util.UUID;
/**
* @author Susucr
*/
public final class CuratorOfSunsCreation extends CardImpl {
public CuratorOfSunsCreation(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.ARTIFICER);
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// Whenever you discover, discover again for the same value. This ability triggers only once per turn.
this.addAbility(new CuratorOfSunsCreationTriggeredAbility());
}
private CuratorOfSunsCreation(final CuratorOfSunsCreation card) {
super(card);
}
@Override
public CuratorOfSunsCreation copy() {
return new CuratorOfSunsCreation(this);
}
}
class CuratorOfSunsCreationTriggeredAbility extends TriggeredAbilityImpl {
CuratorOfSunsCreationTriggeredAbility() {
super(Zone.BATTLEFIELD, null, false);
setTriggersOnceEachTurn(true);
}
private CuratorOfSunsCreationTriggeredAbility(final CuratorOfSunsCreationTriggeredAbility ability) {
super(ability);
}
@Override
public CuratorOfSunsCreationTriggeredAbility copy() {
return new CuratorOfSunsCreationTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DISCOVER;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (!event.getPlayerId().equals(getControllerId())) {
return false;
}
int amount = event.getAmount();
this.getEffects().clear();
this.getEffects().add(new DiscoverEffect(amount));
this.getHints().clear();
this.getHints().add(new StaticHint("Discover amount: " + amount));
return true;
}
@Override
public String getRule() {
return "Whenever you discover, discover again for the same value.";
}
}

View file

@ -55,6 +55,7 @@ public final class TheLostCavernsOfIxalan extends ExpansionSet {
cards.add(new SetCardInfo("Cosmium Confluence", 181, Rarity.RARE, mage.cards.c.CosmiumConfluence.class)); cards.add(new SetCardInfo("Cosmium Confluence", 181, Rarity.RARE, mage.cards.c.CosmiumConfluence.class));
cards.add(new SetCardInfo("Cosmium Kiln", 6, Rarity.UNCOMMON, mage.cards.c.CosmiumKiln.class)); cards.add(new SetCardInfo("Cosmium Kiln", 6, Rarity.UNCOMMON, mage.cards.c.CosmiumKiln.class));
cards.add(new SetCardInfo("Council of Echoes", 51, Rarity.UNCOMMON, mage.cards.c.CouncilOfEchoes.class)); cards.add(new SetCardInfo("Council of Echoes", 51, Rarity.UNCOMMON, mage.cards.c.CouncilOfEchoes.class));
cards.add(new SetCardInfo("Curator of Sun's Creation", 141, Rarity.UNCOMMON, mage.cards.c.CuratorOfSunsCreation.class));
cards.add(new SetCardInfo("Dauntless Dismantler", 8, Rarity.UNCOMMON, mage.cards.d.DauntlessDismantler.class)); cards.add(new SetCardInfo("Dauntless Dismantler", 8, Rarity.UNCOMMON, mage.cards.d.DauntlessDismantler.class));
cards.add(new SetCardInfo("Deep-Cavern Bat", 102, Rarity.UNCOMMON, mage.cards.d.DeepCavernBat.class)); cards.add(new SetCardInfo("Deep-Cavern Bat", 102, Rarity.UNCOMMON, mage.cards.d.DeepCavernBat.class));
cards.add(new SetCardInfo("Deepfathom Echo", 228, Rarity.RARE, mage.cards.d.DeepfathomEcho.class)); cards.add(new SetCardInfo("Deepfathom Echo", 228, Rarity.RARE, mage.cards.d.DeepfathomEcho.class));

View file

@ -0,0 +1,45 @@
package org.mage.test.cards.single.lci;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
/**
* @author Susucr
*/
public class CuratorOfSunsCreationTest extends CardTestPlayerBase {
/**
* {@link mage.cards.c.CuratorOfSunsCreation} <br>
* Curator of Sun's Creation {3}{R} <br>
* Creature Human Artificer <br>
* Whenever you discover, discover again for the same value. This ability triggers only once each turn. <br>
* 3/3
*/
private static final String curator = "Curator of Sun's Creation";
@Test
public void test_trigger() {
setStrictChooseMode(true);
skipInitShuffling();
addCard(Zone.BATTLEFIELD, playerA, curator);
addCard(Zone.HAND, playerA, "Trumpeting Carnosaur"); // {4}{R}{R}, etb discover 5
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 6);
addCard(Zone.LIBRARY, playerA, "Grizzly Bears", 3); // 2/2 for 2
addCard(Zone.LIBRARY, playerA, "Grave Titan"); // cost too much for discover 5
addCard(Zone.LIBRARY, playerA, "Grizzly Bears"); // 2/2 for 2
addCard(Zone.LIBRARY, playerA, "Grave Titan"); // cost too much for discover 5
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Trumpeting Carnosaur");
setChoice(playerA, true); // cast for free from first discover
setChoice(playerA, true); // cast for free from second discover
setStopAt(1, PhaseStep.BEGIN_COMBAT);
execute();
assertPermanentCount(playerA, "Grizzly Bears", 2);
}
}

View file

@ -12,6 +12,7 @@ import mage.filter.FilterCard;
import mage.filter.common.FilterNonlandCard; import mage.filter.common.FilterNonlandCard;
import mage.filter.predicate.mageobject.ManaValuePredicate; import mage.filter.predicate.mageobject.ManaValuePredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.events.DiscoverEvent;
import mage.players.Player; import mage.players.Player;
import mage.util.CardUtil; import mage.util.CardUtil;
@ -82,6 +83,7 @@ public class DiscoverEffect extends OneShotEffect {
} }
cards.retainZone(Zone.EXILED, game); cards.retainZone(Zone.EXILED, game);
player.putCardsOnBottomOfLibrary(cards, game, source, false); player.putCardsOnBottomOfLibrary(cards, game, source, false);
game.fireEvent(new DiscoverEvent(source, player.getId(), amount));
return card; return card;
} }
} }

View file

@ -0,0 +1,14 @@
package mage.game.events;
import mage.abilities.Ability;
import java.util.UUID;
/**
* @author Susucr
*/
public class DiscoverEvent extends GameEvent {
public DiscoverEvent(Ability source, UUID playerId, int amount) {
super(EventType.DISCOVER, null, source, playerId, amount, false);
}
}

View file

@ -528,10 +528,18 @@ public class GameEvent implements Serializable {
targetId player making the choice targetId player making the choice
sourceId sourceId of the ability forcing the choice sourceId sourceId of the ability forcing the choice
playerId controller of the ability forcing the choice playerId controller of the ability forcing the choice
amount numner of times choice is repeated amount number of times choice is repeated
flag not used for this event flag not used for this event
*/ */
FACE_VILLAINOUS_CHOICE, FACE_VILLAINOUS_CHOICE,
/* DISCOVER
targetId not used for this event
sourceId sourceId of the ability discovering
playerId controller of the ability
amount discover value
flag not used for this event
*/
DISCOVER,
//custom events //custom events
CUSTOM_EVENT CUSTOM_EVENT
} }