mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
fix text generation for SourceHasCounterCondition
This commit is contained in:
parent
46b864755f
commit
91908e0ad2
12 changed files with 42 additions and 19 deletions
|
|
@ -12,6 +12,7 @@ import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
|
|
@ -24,7 +25,7 @@ import java.util.UUID;
|
|||
*/
|
||||
public final class AirbenderAscension extends CardImpl {
|
||||
|
||||
private static final Condition condition = new SourceHasCounterCondition(CounterType.QUEST, 4);
|
||||
private static final Condition condition = new SourceHasCounterCondition(CounterType.QUEST, ComparisonType.MORE_THAN, 3);
|
||||
|
||||
public AirbenderAscension(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}");
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import java.util.UUID;
|
|||
*/
|
||||
public final class BloodchiefAscension extends CardImpl {
|
||||
|
||||
private static final Condition condition = new SourceHasCounterCondition(CounterType.QUEST, 3);
|
||||
private static final Condition condition = new SourceHasCounterCondition(CounterType.QUEST, ComparisonType.MORE_THAN, 2);
|
||||
|
||||
public BloodchiefAscension(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{B}");
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.counters.CounterType;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -18,7 +19,7 @@ import java.util.UUID;
|
|||
*/
|
||||
public final class ChanceEncounter extends CardImpl {
|
||||
|
||||
private static final Condition condition = new SourceHasCounterCondition(CounterType.LUCK, 10);
|
||||
private static final Condition condition = new SourceHasCounterCondition(CounterType.LUCK, ComparisonType.MORE_THAN, 9);
|
||||
|
||||
public ChanceEncounter(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}{R}");
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
package mage.cards.c;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.ActivateIfConditionActivatedAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.condition.common.SourceHasCounterCondition;
|
||||
import mage.abilities.costs.common.CollectEvidenceCost;
|
||||
import mage.abilities.costs.common.SacrificeSourceCost;
|
||||
import mage.abilities.common.ActivateIfConditionActivatedAbility;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.abilities.effects.keyword.SurveilEffect;
|
||||
|
|
@ -12,6 +13,7 @@ import mage.abilities.mana.AnyColorManaAbility;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.counters.CounterType;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -21,6 +23,8 @@ import java.util.UUID;
|
|||
*/
|
||||
public final class Cryptex extends CardImpl {
|
||||
|
||||
private static final Condition condition = new SourceHasCounterCondition(CounterType.UNLOCK, ComparisonType.MORE_THAN, 4);
|
||||
|
||||
public Cryptex(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
|
||||
|
||||
|
|
@ -31,11 +35,11 @@ public final class Cryptex extends CardImpl {
|
|||
this.addAbility(ability);
|
||||
|
||||
// Sacrifice Cryptex: Surveil 3, then draw three cards. Activate only if Cryptex has five or more unlock counters on it.
|
||||
Ability sacAbility = new ActivateIfConditionActivatedAbility(new SurveilEffect(3, false), new SacrificeSourceCost(),
|
||||
new SourceHasCounterCondition(CounterType.UNLOCK, 5));
|
||||
Ability sacAbility = new ActivateIfConditionActivatedAbility(
|
||||
new SurveilEffect(3, false), new SacrificeSourceCost(), condition
|
||||
);
|
||||
sacAbility.addEffect(new DrawCardSourceControllerEffect(3).concatBy(", then"));
|
||||
this.addAbility(sacAbility);
|
||||
|
||||
}
|
||||
|
||||
private Cryptex(final Cryptex card) {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import java.util.UUID;
|
|||
*/
|
||||
public final class EncumberedReejerey extends CardImpl {
|
||||
|
||||
private static final Condition condition = new SourceHasCounterCondition(CounterType.M1M1);
|
||||
private static final Condition condition = new SourceHasCounterCondition(CounterType.M1M1).withText("it has a -1/-1 counter on it");
|
||||
|
||||
public EncumberedReejerey(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}");
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.constants.SubType;
|
||||
import mage.counters.CounterType;
|
||||
|
||||
|
|
@ -23,7 +24,7 @@ import java.util.UUID;
|
|||
*/
|
||||
public final class IngeniousProdigy extends CardImpl {
|
||||
|
||||
private static final Condition condition = new SourceHasCounterCondition(CounterType.P1P1);
|
||||
private static final Condition condition = new SourceHasCounterCondition(CounterType.P1P1, ComparisonType.MORE_THAN, 0);
|
||||
|
||||
public IngeniousProdigy(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{X}{U}");
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.constants.TargetController;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
|
|
@ -24,7 +25,7 @@ import java.util.UUID;
|
|||
*/
|
||||
public final class LuminarchAscension extends CardImpl {
|
||||
|
||||
private static final Condition condition = new SourceHasCounterCondition(CounterType.QUEST, 4);
|
||||
private static final Condition condition = new SourceHasCounterCondition(CounterType.QUEST, ComparisonType.MORE_THAN, 3);
|
||||
|
||||
public LuminarchAscension(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}");
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import java.util.UUID;
|
|||
*/
|
||||
public final class ManaBloom extends CardImpl {
|
||||
|
||||
private static final Condition condition = new SourceHasCounterCondition(CounterType.CHARGE, ComparisonType.EQUAL_TO, 0);
|
||||
private static final Condition condition = new SourceHasCounterCondition(CounterType.CHARGE, ComparisonType.EQUAL_TO, 0).withText("{this} has no charge counters on it");
|
||||
|
||||
public ManaBloom(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{X}{G}");
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ import java.util.UUID;
|
|||
*/
|
||||
public final class SarulfRealmEater extends CardImpl {
|
||||
|
||||
private static final Condition condition = new SourceHasCounterCondition(CounterType.P1P1);
|
||||
private static final Condition condition = new SourceHasCounterCondition(CounterType.P1P1, ComparisonType.MORE_THAN, 0);
|
||||
|
||||
public SarulfRealmEater(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}{G}");
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
|
|
@ -29,7 +30,7 @@ import java.util.UUID;
|
|||
*/
|
||||
public final class SimicAscendancy extends CardImpl {
|
||||
|
||||
private static final Condition condition = new SourceHasCounterCondition(CounterType.GROWTH, 20);
|
||||
private static final Condition condition = new SourceHasCounterCondition(CounterType.GROWTH, ComparisonType.MORE_THAN,19);
|
||||
|
||||
public SimicAscendancy(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{G}{U}");
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import mage.abilities.mana.ActivateIfConditionManaAbility;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.ComparisonType;
|
||||
import mage.constants.ManaType;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
|
|
@ -26,8 +27,8 @@ import java.util.UUID;
|
|||
*/
|
||||
public final class TabletOfCompleation extends CardImpl {
|
||||
|
||||
private static final Condition condition1 = new SourceHasCounterCondition(CounterType.OIL, 2);
|
||||
private static final Condition condition2 = new SourceHasCounterCondition(CounterType.OIL, 5);
|
||||
private static final Condition condition1 = new SourceHasCounterCondition(CounterType.OIL, ComparisonType.MORE_THAN, 1);
|
||||
private static final Condition condition2 = new SourceHasCounterCondition(CounterType.OIL, ComparisonType.MORE_THAN, 4);
|
||||
|
||||
public TabletOfCompleation(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import java.util.Optional;
|
|||
public class SourceHasCounterCondition extends IntCompareCondition {
|
||||
|
||||
private final CounterType counterType;
|
||||
private String text = null;
|
||||
|
||||
public SourceHasCounterCondition(CounterType counterType) {
|
||||
this(counterType, 1);
|
||||
|
|
@ -45,8 +46,16 @@ public class SourceHasCounterCondition extends IntCompareCondition {
|
|||
.orElse(0);
|
||||
}
|
||||
|
||||
public SourceHasCounterCondition withText(String text) {
|
||||
this.text = text;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (this.text != null) {
|
||||
return this.text;
|
||||
}
|
||||
switch (type) {
|
||||
case EQUAL_TO:
|
||||
StringBuilder sb = new StringBuilder("there ");
|
||||
|
|
@ -70,16 +79,20 @@ public class SourceHasCounterCondition extends IntCompareCondition {
|
|||
sb.append(" on {this}");
|
||||
return sb.toString();
|
||||
case OR_GREATER:
|
||||
if (value == 0) {
|
||||
throw new IllegalArgumentException("0 or greater should not be used");
|
||||
switch (value) {
|
||||
case 0:
|
||||
throw new IllegalArgumentException("0 or greater should not be used");
|
||||
case 1:
|
||||
return "{this} has " + counterType.getArticle() + ' ' + counterType.getName() + " counter on it";
|
||||
default:
|
||||
return "there are " + CardUtil.numberToText(value) + " or more " + counterType.getName() + " counters on {this}";
|
||||
}
|
||||
return "there are " + CardUtil.numberToText(value) + " or more " + counterType.getName() + " counters on {this}";
|
||||
case OR_LESS:
|
||||
return "{this} has " + CardUtil.numberToText(value) + " or fewer " + counterType.getName() + " counters on it";
|
||||
case FEWER_THAN:
|
||||
return "{this} has fewer than " + CardUtil.numberToText(value) + ' ' + counterType.getName() + " counters on it";
|
||||
case MORE_THAN:
|
||||
return "{this} has more than " + CardUtil.numberToText(value) + ' ' + counterType.getName() + " counters on it";
|
||||
return "{this} has " + CardUtil.numberToText(value+1) + " or more " + counterType.getName() + " counters on it";
|
||||
default:
|
||||
throw new UnsupportedOperationException("There should be a comparison type");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue