mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 11:02:00 -08:00
[DSK] Implement Zimone, All-Questioning
This commit is contained in:
parent
f3624e9ca3
commit
64774b457f
4 changed files with 165 additions and 0 deletions
109
Mage.Sets/src/mage/cards/z/ZimoneAllQuestioning.java
Normal file
109
Mage.Sets/src/mage/cards/z/ZimoneAllQuestioning.java
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
package mage.cards.z;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.PrimoTheIndivisibleToken;
|
||||
import mage.game.permanent.token.Token;
|
||||
import mage.util.CardUtil;
|
||||
import mage.watchers.common.LandfallWatcher;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class ZimoneAllQuestioning extends CardImpl {
|
||||
|
||||
public ZimoneAllQuestioning(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}{U}");
|
||||
|
||||
this.supertype.add(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.WIZARD);
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(1);
|
||||
|
||||
// At the beginning of your end step, if a land entered the battlefield under your control this turn and you control a prime number of lands, create Primo, the Indivisible, a legendary 0/0 green and blue Fractal creature token, then put that many +1/+1 counters on it.
|
||||
this.addAbility(new BeginningOfEndStepTriggeredAbility(
|
||||
new ZimoneAllQuestioningEffect(), TargetController.YOU,
|
||||
ZimoneAllQuestioningCondition.instance, false
|
||||
), new LandfallWatcher());
|
||||
}
|
||||
|
||||
private ZimoneAllQuestioning(final ZimoneAllQuestioning card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ZimoneAllQuestioning copy() {
|
||||
return new ZimoneAllQuestioning(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum ZimoneAllQuestioningCondition implements Condition {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return game
|
||||
.getState()
|
||||
.getWatcher(LandfallWatcher.class)
|
||||
.landPlayed(source.getControllerId())
|
||||
&& CardUtil.isPrime(game
|
||||
.getBattlefield()
|
||||
.count(StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND, source.getControllerId(), source, game));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "a land entered the battlefield under your control this turn and you control a prime number of lands";
|
||||
}
|
||||
}
|
||||
|
||||
class ZimoneAllQuestioningEffect extends OneShotEffect {
|
||||
|
||||
ZimoneAllQuestioningEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "create Primo, the Indivisible, a legendary 0/0 green and blue " +
|
||||
"Fractal creature token, then put that many +1/+1 counters on it";
|
||||
}
|
||||
|
||||
private ZimoneAllQuestioningEffect(final ZimoneAllQuestioningEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ZimoneAllQuestioningEffect copy() {
|
||||
return new ZimoneAllQuestioningEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Token token = new PrimoTheIndivisibleToken();
|
||||
token.putOntoBattlefield(1, game, source);
|
||||
int count = game.getBattlefield().count(
|
||||
StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND,
|
||||
source.getControllerId(), source, game
|
||||
);
|
||||
if (count < 1) {
|
||||
return true;
|
||||
}
|
||||
for (UUID tokenId : token.getLastAddedTokenIds()) {
|
||||
Permanent permanent = game.getPermanent(tokenId);
|
||||
if (permanent != null) {
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(count), source, game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -35,5 +35,6 @@ public final class DuskmournHouseOfHorror extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Swamp", 274, Rarity.LAND, mage.cards.basiclands.Swamp.class, FULL_ART_BFZ_VARIOUS));
|
||||
cards.add(new SetCardInfo("The Wandering Rescuer", 41, Rarity.MYTHIC, mage.cards.t.TheWanderingRescuer.class));
|
||||
cards.add(new SetCardInfo("Toby, Beastie Befriender", 35, Rarity.RARE, mage.cards.t.TobyBeastieBefriender.class));
|
||||
cards.add(new SetCardInfo("Zimone, All-Questioning", 241, Rarity.RARE, mage.cards.z.ZimoneAllQuestioning.class));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
package mage.game.permanent.token;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class PrimoTheIndivisibleToken extends TokenImpl {
|
||||
|
||||
public PrimoTheIndivisibleToken() {
|
||||
super("Primo, the Indivisible", "Primo, the Indivisible, a legendary 0/0 green and blue Fractal creature token");
|
||||
supertype.add(SuperType.LEGENDARY);
|
||||
cardType.add(CardType.CREATURE);
|
||||
subtype.add(SubType.FRACTAL);
|
||||
color.setGreen(true);
|
||||
color.setBlue(true);
|
||||
power = new MageInt(0);
|
||||
toughness = new MageInt(0);
|
||||
}
|
||||
|
||||
private PrimoTheIndivisibleToken(final PrimoTheIndivisibleToken token) {
|
||||
super(token);
|
||||
}
|
||||
|
||||
public PrimoTheIndivisibleToken copy() {
|
||||
return new PrimoTheIndivisibleToken(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -716,6 +716,30 @@ public final class CardUtil {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a given integer is prime
|
||||
*
|
||||
* @param number
|
||||
* @return
|
||||
*/
|
||||
public static boolean isPrime(int number) {
|
||||
// if it's 1 or less it's not prime
|
||||
if (number < 2) {
|
||||
return false;
|
||||
}
|
||||
// easy to check 2 and 3 first
|
||||
if (number == 2 || number == 3) {
|
||||
return true;
|
||||
}
|
||||
// sieve of eratosthenes, only need to check up to sqrt(x) to find a divisor
|
||||
for (int i = 2; i * i <= number; i++) {
|
||||
if (number % i == 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static String createObjectRealtedWindowTitle(Ability source, Game game, String textSuffix) {
|
||||
String title;
|
||||
if (source != null) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue