mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
Merge pull request #741 from philvt101/master
Add Scuttlemutt and BecomesColorOrColorsTargetEffect
This commit is contained in:
commit
f36a10fb45
1 changed files with 143 additions and 0 deletions
143
Mage.Sets/src/mage/sets/shadowmoor/Scuttlemutt.java
Normal file
143
Mage.Sets/src/mage/sets/shadowmoor/Scuttlemutt.java
Normal file
|
@ -0,0 +1,143 @@
|
|||
/*
|
||||
* 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.shadowmoor;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.ObjectColor;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.abilities.mana.AnyColorManaAbility;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continious.BecomesColorTargetEffect;
|
||||
import mage.choices.ChoiceColor;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author philvt101
|
||||
*/
|
||||
public class Scuttlemutt extends CardImpl {
|
||||
|
||||
public Scuttlemutt(UUID ownerId) {
|
||||
super(ownerId, 263, "Scuttlemutt", Rarity.COMMON, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{3}");
|
||||
this.expansionSetCode = "SHM";
|
||||
this.subtype.add("Scarecrow");
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(2);
|
||||
|
||||
// {tap}: Add one mana of any color to your mana pool.
|
||||
this.addAbility(new AnyColorManaAbility());
|
||||
// {tap}: Target creature becomes the color or colors of your choice until end of turn.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ChangeColorsTargetEffect(), new TapSourceCost());
|
||||
ability.addTarget(new TargetCreaturePermanent());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
public Scuttlemutt(final Scuttlemutt card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Scuttlemutt copy() {
|
||||
return new Scuttlemutt(this);
|
||||
}
|
||||
}
|
||||
|
||||
class ChangeColorsTargetEffect extends OneShotEffect {
|
||||
|
||||
public ChangeColorsTargetEffect() {
|
||||
super(Outcome.Neutral);
|
||||
staticText = "target creature becomes the color or colors of your choice until end of turn";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
Permanent target = game.getPermanent(source.getFirstTarget());
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
if (you != null && target != null) {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if (!you.chooseUse(Outcome.Neutral, "Do you wish to choose another color?", game)) {
|
||||
break;
|
||||
}
|
||||
ChoiceColor choiceColor = new ChoiceColor();
|
||||
you.choose(Outcome.Benefit, choiceColor, game);
|
||||
if (!you.isInGame()) {
|
||||
return false;
|
||||
}
|
||||
game.informPlayers(target.getName() + ": " + you.getName() + " has chosen " + choiceColor.getChoice());
|
||||
if (choiceColor.getColor().isBlack()) {
|
||||
sb.append("B");
|
||||
} else if (choiceColor.getColor().isBlue()) {
|
||||
sb.append("U");
|
||||
} else if (choiceColor.getColor().isRed()) {
|
||||
sb.append("R");
|
||||
} else if (choiceColor.getColor().isGreen()) {
|
||||
sb.append("G");
|
||||
} else if (choiceColor.getColor().isWhite()) {
|
||||
sb.append("W");
|
||||
}
|
||||
}
|
||||
String colors = new String(sb);
|
||||
ObjectColor chosenColors = new ObjectColor(colors);
|
||||
|
||||
|
||||
ContinuousEffect effect = new BecomesColorTargetEffect(chosenColors, Duration.EndOfTurn);
|
||||
effect.setTargetPointer(new FixedTarget(source.getFirstTarget()));
|
||||
game.addEffect(effect, source);
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public ChangeColorsTargetEffect(final ChangeColorsTargetEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChangeColorsTargetEffect copy() {
|
||||
return new ChangeColorsTargetEffect(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in a new issue