Implemented Infinite Hourglass, updated upkeep-only text generation

This commit is contained in:
Evan Kranzler 2017-09-30 10:39:49 -04:00
parent c6f8489ef3
commit d15ed359ce
5 changed files with 109 additions and 5 deletions

View file

@ -0,0 +1,92 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.cards.i;
import java.util.UUID;
import mage.abilities.ActivatedAbility;
import mage.abilities.common.ActivateIfConditionActivatedAbility;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.IsStepCondition;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.dynamicvalue.common.CountersSourceCount;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.continuous.BoostAllEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.effects.common.counter.RemoveCounterSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.PhaseStep;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.counters.CounterType;
/**
*
* @author TheElk801
*/
public class InfiniteHourglass extends CardImpl {
public InfiniteHourglass(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}");
// At the beginning of your upkeep, put a time counter on Infinite Hourglass.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new AddCountersSourceEffect(CounterType.TIME.createInstance()), TargetController.YOU, false));
// All creatures get +1/+0 for each time counter on Infinite Hourglass.
this.addAbility(new SimpleStaticAbility(
Zone.BATTLEFIELD,
new BoostAllEffect(
new CountersSourceCount(CounterType.TIME),
new StaticValue(0),
Duration.WhileOnBattlefield
)
));
// {3}: Remove a time counter from Infinite Hourglass. Any player may activate this ability but only during any upkeep step.
ActivatedAbility ability = new ActivateIfConditionActivatedAbility(
Zone.BATTLEFIELD,
new RemoveCounterSourceEffect(CounterType.TIME.createInstance()),
new GenericManaCost(3),
new IsStepCondition(PhaseStep.UPKEEP, false)
);
ability.setMayActivate(TargetController.ANY);
this.addAbility(ability);
}
public InfiniteHourglass(final InfiniteHourglass card) {
super(card);
}
@Override
public InfiniteHourglass copy() {
return new InfiniteHourglass(this);
}
}

View file

@ -220,6 +220,7 @@ public class FifthEdition extends ExpansionSet {
cards.add(new SetCardInfo("Imposing Visage", 241, Rarity.COMMON, mage.cards.i.ImposingVisage.class));
cards.add(new SetCardInfo("Incinerate", 242, Rarity.COMMON, mage.cards.i.Incinerate.class));
cards.add(new SetCardInfo("Inferno", 243, Rarity.RARE, mage.cards.i.Inferno.class));
cards.add(new SetCardInfo("Infinite Hourglass", 378, Rarity.RARE, mage.cards.i.InfiniteHourglass.class));
cards.add(new SetCardInfo("Initiates of the Ebon Hand", 31, Rarity.COMMON, InitiatesOfTheEbonHand.class));
cards.add(new SetCardInfo("Instill Energy", 166, Rarity.UNCOMMON, mage.cards.i.InstillEnergy.class));
cards.add(new SetCardInfo("Ironclaw Orcs", 245, Rarity.COMMON, mage.cards.i.IronclawOrcs.class));

View file

@ -171,6 +171,7 @@ public class IceAge extends ExpansionSet {
cards.add(new SetCardInfo("Incinerate", 194, Rarity.COMMON, mage.cards.i.Incinerate.class));
cards.add(new SetCardInfo("Infernal Darkness", 23, Rarity.RARE, mage.cards.i.InfernalDarkness.class));
cards.add(new SetCardInfo("Infernal Denizen", 24, Rarity.RARE, mage.cards.i.InfernalDenizen.class));
cards.add(new SetCardInfo("Infinite Hourglass", 298, Rarity.RARE, mage.cards.i.InfiniteHourglass.class));
cards.add(new SetCardInfo("Infuse", 80, Rarity.COMMON, mage.cards.i.Infuse.class));
cards.add(new SetCardInfo("Island", 334, Rarity.LAND, mage.cards.basiclands.Island.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Island", 335, Rarity.LAND, mage.cards.basiclands.Island.class, NON_FULL_USE_VARIOUS));

View file

@ -29,6 +29,7 @@ package mage.abilities;
import java.util.UUID;
import mage.abilities.mana.ManaOptions;
import mage.constants.TargetController;
import mage.game.Game;
/**
@ -39,6 +40,8 @@ public interface ActivatedAbility extends Ability {
boolean canActivate(UUID playerId, Game game);
public void setMayActivate(TargetController mayActivate);
/**
* Returns the minimal possible cost for what the ability can be activated
* or cast

View file

@ -25,7 +25,6 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.condition.common;
import mage.abilities.Ability;
@ -42,11 +41,11 @@ public class IsStepCondition implements Condition {
protected PhaseStep phaseStep;
protected boolean onlyDuringYourSteps;
public IsStepCondition(PhaseStep phaseStep) {
public IsStepCondition(PhaseStep phaseStep) {
this(phaseStep, true);
}
public IsStepCondition(PhaseStep phaseStep, boolean onlyDuringYourSteps) {
public IsStepCondition(PhaseStep phaseStep, boolean onlyDuringYourSteps) {
this.phaseStep = phaseStep;
this.onlyDuringYourSteps = onlyDuringYourSteps;
}
@ -58,7 +57,15 @@ public class IsStepCondition implements Condition {
@Override
public String toString() {
return new StringBuilder("during ").append(onlyDuringYourSteps ? "your ":"the ").append(phaseStep.getStepText()).toString();
StringBuilder sb = new StringBuilder("during ");
if (onlyDuringYourSteps) {
sb.append("your ");
} else if (phaseStep == PhaseStep.UPKEEP) {
sb.append("any upkeep step");
} else {
sb.append("the ").append(phaseStep.getStepText());
}
return sb.toString();
}
}