diff --git a/Mage.Sets/src/mage/sets/riseoftheeldrazi/BattleRattleShaman.java b/Mage.Sets/src/mage/sets/riseoftheeldrazi/BattleRattleShaman.java new file mode 100644 index 0000000000..45759b2f29 --- /dev/null +++ b/Mage.Sets/src/mage/sets/riseoftheeldrazi/BattleRattleShaman.java @@ -0,0 +1,72 @@ +/* + * 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.sets.riseoftheeldrazi; + +import java.util.UUID; +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfCombatTriggeredAbility; +import mage.abilities.effects.common.continious.BoostTargetEffect; +import mage.cards.CardImpl; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author jeffwadsworth + */ +public class BattleRattleShaman extends CardImpl { + + public BattleRattleShaman(UUID ownerId) { + super(ownerId, 136, "Battle-Rattle Shaman", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{3}{R}"); + this.expansionSetCode = "ROE"; + this.subtype.add("Goblin"); + this.subtype.add("Shaman"); + + this.color.setRed(true); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // At the beginning of combat on your turn, you may have target creature get +2/+0 until end of turn. + Ability ability = new BeginningOfCombatTriggeredAbility(Constants.Zone.BATTLEFIELD, new BoostTargetEffect(2, 0, Constants.Duration.EndOfTurn), Constants.TargetController.YOU, true); + ability.addTarget(new TargetCreaturePermanent()); + this.addAbility(ability); + + } + + public BattleRattleShaman(final BattleRattleShaman card) { + super(card); + } + + @Override + public BattleRattleShaman copy() { + return new BattleRattleShaman(this); + } +} diff --git a/Mage/src/mage/abilities/common/BeginningOfCombatTriggeredAbility.java b/Mage/src/mage/abilities/common/BeginningOfCombatTriggeredAbility.java new file mode 100644 index 0000000000..3e822afad2 --- /dev/null +++ b/Mage/src/mage/abilities/common/BeginningOfCombatTriggeredAbility.java @@ -0,0 +1,88 @@ +package mage.abilities.common; + +import mage.Constants; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.Effect; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.target.targetpointer.FixedTarget; + +public class BeginningOfCombatTriggeredAbility extends TriggeredAbilityImpl { + private Constants.TargetController targetController; + + public BeginningOfCombatTriggeredAbility(Effect effect, Constants.TargetController targetController, boolean isOptional) { + this(Constants.Zone.BATTLEFIELD, effect, targetController, isOptional); + } + + public BeginningOfCombatTriggeredAbility(Constants.Zone zone, Effect effect, Constants.TargetController targetController, boolean isOptional) { + super(zone, effect, isOptional); + this.targetController = targetController; + } + + public BeginningOfCombatTriggeredAbility(final BeginningOfCombatTriggeredAbility ability) { + super(ability); + this.targetController = ability.targetController; + } + + @Override + public BeginningOfCombatTriggeredAbility copy() { + return new BeginningOfCombatTriggeredAbility(this); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getType() == GameEvent.EventType.BEGIN_COMBAT_STEP_PRE) { + switch (targetController) { + case YOU: + boolean yours = event.getPlayerId().equals(this.controllerId); + if (yours) { + if (getTargets().size() == 0) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getPlayerId())); + } + } + } + return yours; + case OPPONENT: + if (game.getOpponents(this.controllerId).contains(event.getPlayerId())) { + if (getTargets().size() == 0) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getPlayerId())); + } + } + return true; + } + break; + case ANY: + if (getTargets().size() == 0) { + for (Effect effect : this.getEffects()) { + effect.setTargetPointer(new FixedTarget(event.getPlayerId())); + } + } + return true; + } + } + return false; + } + + @Override + public String getRule() { + switch (targetController) { + case YOU: + return "At the beginning of your combat step, " + generateZoneString() + getEffects().getText(modes.getMode()); + case OPPONENT: + return "At the beginning of each opponent's combat step, " + generateZoneString() + getEffects().getText(modes.getMode()); + case ANY: + return "At the beginning of each player's combat step, " + generateZoneString() + getEffects().getText(modes.getMode()); + } + return ""; + } + + private String generateZoneString() { + switch (getZone()) { + case GRAVEYARD: + return "if {this} is in your graveyard, "; + } + return ""; + } +}