mirror of
https://github.com/magefree/mage.git
synced 2026-01-09 04:12:14 -08:00
[MOM] Implement Sheoldred
This commit is contained in:
parent
dd91a58c85
commit
25e8cf7cef
11 changed files with 258 additions and 70 deletions
|
|
@ -83,7 +83,7 @@ public interface ActivatedAbility extends Ability {
|
|||
|
||||
int getMaxActivationsPerTurn(Game game);
|
||||
|
||||
public void setTiming(TimingRule timing);
|
||||
ActivatedAbility setTiming(TimingRule timing);
|
||||
|
||||
public ActivatedAbility setCondition(Condition condition);
|
||||
ActivatedAbility setCondition(Condition condition);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -241,8 +241,9 @@ public abstract class ActivatedAbilityImpl extends AbilityImpl implements Activa
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setTiming(TimingRule timing) {
|
||||
public ActivatedAbilityImpl setTiming(TimingRule timing) {
|
||||
this.timing = timing;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected boolean hasMoreActivationsThisTurn(Game game) {
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import mage.game.stack.StackObject;
|
|||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.Targets;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
|
@ -89,7 +90,7 @@ public class SagaAbility extends SimpleStaticAbility {
|
|||
}
|
||||
|
||||
public void addChapterEffect(Card card, SagaChapter fromChapter, SagaChapter toChapter, Effect effect, Target target, boolean optional) {
|
||||
addChapterEffect(card, fromChapter, toChapter, new Effects(effect), new Targets(target), optional);
|
||||
addChapterEffect(card, fromChapter, toChapter, new Effects(effect), new Targets(target), optional, null);
|
||||
}
|
||||
|
||||
public void addChapterEffect(Card card, SagaChapter fromChapter, SagaChapter toChapter, Effects effects, Target target) {
|
||||
|
|
@ -97,10 +98,10 @@ public class SagaAbility extends SimpleStaticAbility {
|
|||
}
|
||||
|
||||
public void addChapterEffect(Card card, SagaChapter fromChapter, SagaChapter toChapter, Effects effects, Targets targets) {
|
||||
addChapterEffect(card, fromChapter, toChapter, effects, targets, false);
|
||||
addChapterEffect(card, fromChapter, toChapter, effects, targets, false, null);
|
||||
}
|
||||
|
||||
public void addChapterEffect(Card card, SagaChapter fromChapter, SagaChapter toChapter, Effects effects, Targets targets, boolean optional, Mode... modes) {
|
||||
public void addChapterEffect(Card card, SagaChapter fromChapter, SagaChapter toChapter, Effects effects, Targets targets, boolean optional, TargetAdjuster targetAdjuster, Mode... modes) {
|
||||
for (int i = fromChapter.getNumber(); i <= toChapter.getNumber(); i++) {
|
||||
ChapterTriggeredAbility ability = new ChapterTriggeredAbility(null, SagaChapter.getChapter(i), toChapter, optional, readAhead);
|
||||
for (Effect effect : effects) {
|
||||
|
|
@ -119,6 +120,9 @@ public class SagaAbility extends SimpleStaticAbility {
|
|||
if (i > fromChapter.getNumber()) {
|
||||
ability.setRuleVisible(false);
|
||||
}
|
||||
if (targetAdjuster != null) {
|
||||
ability.setTargetAdjuster(targetAdjuster);
|
||||
}
|
||||
card.addAbility(ability);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,6 @@ public class CardsInHandCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
int workCount = count;
|
||||
StringBuilder sb = new StringBuilder("if");
|
||||
switch (targetController) {
|
||||
case YOU:
|
||||
|
|
@ -97,21 +96,22 @@ public class CardsInHandCondition implements Condition {
|
|||
}
|
||||
switch (this.type) {
|
||||
case FEWER_THAN:
|
||||
sb.append(" less or equal than ");
|
||||
workCount++;
|
||||
sb.append(CardUtil.numberToText(count));
|
||||
sb.append(" or fewer ");
|
||||
break;
|
||||
case MORE_THAN:
|
||||
sb.append(" more than ");
|
||||
sb.append(CardUtil.numberToText(count));
|
||||
sb.append(" or more ");
|
||||
break;
|
||||
case EQUAL_TO:
|
||||
sb.append(" exactly ");
|
||||
if (count > 0) {
|
||||
sb.append(" exactly ");
|
||||
sb.append(CardUtil.numberToText(count));
|
||||
} else {
|
||||
sb.append(" no ");
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (count == 0) {
|
||||
sb.append("no");
|
||||
} else {
|
||||
sb.append(CardUtil.numberToText(workCount));
|
||||
}
|
||||
sb.append(" cards in hand");
|
||||
return sb.toString();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,11 +12,11 @@ import mage.abilities.costs.mana.ManaCosts;
|
|||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.Effects;
|
||||
import mage.constants.EffectType;
|
||||
import mage.constants.TimingRule;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX
|
||||
*/
|
||||
public class ConditionalActivatedAbility extends ActivatedAbilityImpl {
|
||||
|
|
@ -25,6 +25,10 @@ public class ConditionalActivatedAbility extends ActivatedAbilityImpl {
|
|||
|
||||
private String ruleText = null;
|
||||
|
||||
public ConditionalActivatedAbility(Effect effect, Cost cost, Condition condition) {
|
||||
this(Zone.BATTLEFIELD, effect, cost, condition);
|
||||
}
|
||||
|
||||
public ConditionalActivatedAbility(Zone zone, Effect effect, Cost cost, Condition condition) {
|
||||
super(zone, effect, cost);
|
||||
this.condition = condition;
|
||||
|
|
@ -71,13 +75,21 @@ public class ConditionalActivatedAbility extends ActivatedAbilityImpl {
|
|||
if (ruleText != null && !ruleText.isEmpty()) {
|
||||
return ruleText;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder(super.getRule());
|
||||
sb.append(" Activate only ");
|
||||
if (timing == TimingRule.SORCERY) {
|
||||
sb.append("as a sorcery and only");
|
||||
}
|
||||
String conditionText = condition.toString();
|
||||
String additionalText = "if ";
|
||||
if (conditionText.startsWith("during")
|
||||
|| conditionText.startsWith("before")
|
||||
|| conditionText.startsWith("if")) {
|
||||
additionalText = "";
|
||||
sb.append("");
|
||||
} else {
|
||||
sb.append("if ");
|
||||
}
|
||||
return super.getRule() + " Activate only " + additionalText + condition.toString() + ".";
|
||||
sb.append(conditionText);
|
||||
sb.append('.');
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue