mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
Added delirium hint as enum
This commit is contained in:
parent
330f8cf5d0
commit
6a7253d22f
4 changed files with 80 additions and 22 deletions
|
@ -1,7 +1,5 @@
|
||||||
|
|
||||||
package mage.cards.i;
|
package mage.cards.i;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
|
@ -12,6 +10,7 @@ import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
||||||
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
|
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
|
||||||
import mage.abilities.effects.common.CreateTokenEffect;
|
import mage.abilities.effects.common.CreateTokenEffect;
|
||||||
import mage.abilities.effects.common.LoseLifeTargetEffect;
|
import mage.abilities.effects.common.LoseLifeTargetEffect;
|
||||||
|
import mage.abilities.hint.DeliriumHint;
|
||||||
import mage.abilities.keyword.ReachAbility;
|
import mage.abilities.keyword.ReachAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
|
@ -24,8 +23,9 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||||
import mage.game.permanent.token.SpiderToken;
|
import mage.game.permanent.token.SpiderToken;
|
||||||
import mage.target.common.TargetOpponent;
|
import mage.target.common.TargetOpponent;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author fireshoes
|
* @author fireshoes
|
||||||
*/
|
*/
|
||||||
public final class IshkanahGrafwidow extends CardImpl {
|
public final class IshkanahGrafwidow extends CardImpl {
|
||||||
|
@ -37,7 +37,7 @@ public final class IshkanahGrafwidow extends CardImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
public IshkanahGrafwidow(UUID ownerId, CardSetInfo setInfo) {
|
public IshkanahGrafwidow(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{G}");
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}");
|
||||||
addSuperType(SuperType.LEGENDARY);
|
addSuperType(SuperType.LEGENDARY);
|
||||||
this.subtype.add(SubType.SPIDER);
|
this.subtype.add(SubType.SPIDER);
|
||||||
this.power = new MageInt(3);
|
this.power = new MageInt(3);
|
||||||
|
@ -52,8 +52,8 @@ public final class IshkanahGrafwidow extends CardImpl {
|
||||||
new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new SpiderToken(), 3), false),
|
new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new SpiderToken(), 3), false),
|
||||||
DeliriumCondition.instance,
|
DeliriumCondition.instance,
|
||||||
"<i>Delirium</i> — When {this} enters the battlefield, if there are four or more card types among cards in your graveyard, "
|
"<i>Delirium</i> — When {this} enters the battlefield, if there are four or more card types among cards in your graveyard, "
|
||||||
+ "create three 1/2 green Spider creature tokens with reach.");
|
+ "create three 1/2 green Spider creature tokens with reach.");
|
||||||
this.addAbility(ability);
|
this.addAbility(ability.addHint(DeliriumHint.instance));
|
||||||
|
|
||||||
// {5}{B}: Target opponent loses 1 life for each Spider you control.
|
// {5}{B}: Target opponent loses 1 life for each Spider you control.
|
||||||
PermanentsOnBattlefieldCount count = new PermanentsOnBattlefieldCount(filter);
|
PermanentsOnBattlefieldCount count = new PermanentsOnBattlefieldCount(filter);
|
||||||
|
|
|
@ -1,17 +1,11 @@
|
||||||
|
|
||||||
package mage.abilities.condition.common;
|
package mage.abilities.condition.common;
|
||||||
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.condition.Condition;
|
import mage.abilities.condition.Condition;
|
||||||
import mage.cards.Card;
|
import mage.abilities.dynamicvalue.common.CardTypesInGraveyardCount;
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.players.Player;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
*
|
|
||||||
* @author fireshoes
|
* @author fireshoes
|
||||||
*/
|
*/
|
||||||
public enum DeliriumCondition implements Condition {
|
public enum DeliriumCondition implements Condition {
|
||||||
|
@ -20,15 +14,7 @@ public enum DeliriumCondition implements Condition {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
return CardTypesInGraveyardCount.instance.calculate(game, source, null) >= 4;
|
||||||
if (controller != null) {
|
|
||||||
EnumSet<CardType> foundCardTypes = EnumSet.noneOf(CardType.class);
|
|
||||||
for (Card card : controller.getGraveyard().getCards(game)) {
|
|
||||||
foundCardTypes.addAll(card.getCardType());
|
|
||||||
}
|
|
||||||
return foundCardTypes.size() >= 4;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
package mage.abilities.dynamicvalue.common;
|
||||||
|
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.dynamicvalue.DynamicValue;
|
||||||
|
import mage.abilities.effects.Effect;
|
||||||
|
import mage.cards.Card;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.players.Player;
|
||||||
|
|
||||||
|
import java.util.EnumSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author JayDi85
|
||||||
|
*/
|
||||||
|
public enum CardTypesInGraveyardCount implements DynamicValue {
|
||||||
|
|
||||||
|
instance;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||||
|
Player controller = game.getPlayer(sourceAbility.getControllerId());
|
||||||
|
if (controller != null) {
|
||||||
|
EnumSet<CardType> foundCardTypes = EnumSet.noneOf(CardType.class);
|
||||||
|
for (Card card : controller.getGraveyard().getCards(game)) {
|
||||||
|
foundCardTypes.addAll(card.getCardType());
|
||||||
|
}
|
||||||
|
return foundCardTypes.size();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CardTypesInGraveyardCount copy() {
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "1";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMessage() {
|
||||||
|
return "the number of opponents you attacked this turn";
|
||||||
|
}
|
||||||
|
}
|
25
Mage/src/main/java/mage/abilities/hint/DeliriumHint.java
Normal file
25
Mage/src/main/java/mage/abilities/hint/DeliriumHint.java
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
package mage.abilities.hint;
|
||||||
|
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.condition.common.DeliriumCondition;
|
||||||
|
import mage.abilities.dynamicvalue.common.CardTypesInGraveyardCount;
|
||||||
|
import mage.game.Game;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author JayDi85
|
||||||
|
*/
|
||||||
|
public enum DeliriumHint implements Hint {
|
||||||
|
|
||||||
|
instance;
|
||||||
|
private static final ConditionHint hint = new ConditionHint(DeliriumCondition.instance, "4+ card types in the graveyard");
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getText(Game game, Ability ability) {
|
||||||
|
return hint.getText(game, ability) + " (current: " + CardTypesInGraveyardCount.instance.calculate(game, ability, null) + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Hint copy() {
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue