[KTK] 2 green cards.

This commit is contained in:
LevelX2 2014-09-07 22:02:00 +02:00
parent 65fdaba28d
commit d6af37eb1a
7 changed files with 395 additions and 28 deletions

View file

@ -0,0 +1,110 @@
/*
* 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.khansoftarkir;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
/**
*
* @author LevelX2
*/
public class HardenedScales extends CardImpl {
public HardenedScales(UUID ownerId) {
super(ownerId, 133, "Hardened Scales", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{G}");
this.expansionSetCode = "KTK";
this.color.setGreen(true);
// If one or more +1/+1 counters would be placed on a creature you control, that many plus one +1/+1 counters are placed on it instead.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new HardenedScalesEffect()));
}
public HardenedScales(final HardenedScales card) {
super(card);
}
@Override
public HardenedScales copy() {
return new HardenedScales(this);
}
}
class HardenedScalesEffect extends ReplacementEffectImpl {
HardenedScalesEffect() {
super(Duration.WhileOnBattlefield, Outcome.BoostCreature, false);
staticText = "If one or more +1/+1 counters would be placed on a creature you control, that many plus one +1/+1 counters are placed on it instead";
}
HardenedScalesEffect(final HardenedScalesEffect effect) {
super(effect);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
int amount = event.getAmount();
event.setAmount(amount + 1);
return false;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.ADD_COUNTERS && event.getData().equals(CounterType.P1P1.getName())) {
Permanent target = game.getPermanent(event.getTargetId());
if (target != null && target.getControllerId().equals(source.getControllerId())
&& target.getCardType().contains(CardType.CREATURE)) {
return true;
}
}
return false;
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public HardenedScalesEffect copy() {
return new HardenedScalesEffect(this);
}
}

View file

@ -0,0 +1,152 @@
/*
* 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.khansoftarkir;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.condition.InvertCondition;
import mage.abilities.condition.common.FerociousCondition;
import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
/**
*
* @author LevelX2
*/
public class SeeTheUnwritten extends CardImpl {
public SeeTheUnwritten(UUID ownerId) {
super(ownerId, 149, "See the Unwritten", Rarity.MYTHIC, new CardType[]{CardType.SORCERY}, "{4}{G}{G}");
this.expansionSetCode = "KTK";
this.color.setGreen(true);
// Reveal the top eight cards of your library. You may put a creature card from among them onto the battlefield. Put the rest into your graveyard.
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
new SeeTheUnwrittenEffect(1),
new InvertCondition(FerociousCondition.getInstance()),
"Reveal the top eight cards of your library. You may put a creature card from among them onto the battlefield. Put the rest into your graveyard"));
// <i>Ferocious</i> - If you control a creature with power 4 or greater, you may put two creature cards onto the battlefield instead of one.
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
new SeeTheUnwrittenEffect(2),
FerociousCondition.getInstance(),
"<br/><br/><i>Ferocious</i> - If you control a creature with power 4 or greater, you may put two creature cards onto the battlefield instead of one"));
}
public SeeTheUnwritten(final SeeTheUnwritten card) {
super(card);
}
@Override
public SeeTheUnwritten copy() {
return new SeeTheUnwritten(this);
}
}
class SeeTheUnwrittenEffect extends OneShotEffect {
private static final FilterCreatureCard filter = new FilterCreatureCard("creature card");
private final int numberOfCardsToPutIntoPlay;
public SeeTheUnwrittenEffect(int numberOfCardsToPutIntoPlay) {
super(Outcome.DrawCard);
this.numberOfCardsToPutIntoPlay = numberOfCardsToPutIntoPlay;
this.staticText = "Reveal the top eight cards of your library. You may put a creature card from among them onto the battlefield. Put the rest into your graveyard";
}
public SeeTheUnwrittenEffect(final SeeTheUnwrittenEffect effect) {
super(effect);
this.numberOfCardsToPutIntoPlay = effect.numberOfCardsToPutIntoPlay;
}
@Override
public SeeTheUnwrittenEffect copy() {
return new SeeTheUnwrittenEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (player != null && sourceObject != null) {
Cards cards = new CardsImpl(Zone.LIBRARY);
boolean properCardFound = false;
int count = Math.min(player.getLibrary().size(), 8);
for (int i = 0; i < count; i++) {
Card card = player.getLibrary().removeFromTop(game);
if (card != null) {
cards.add(card);
if (filter.match(card, source.getSourceId(), source.getControllerId(), game)) {
properCardFound = true;
}
}
}
if (!cards.isEmpty()) {
player.revealCards(sourceObject.getLogName(), cards, game);
TargetCard target = new TargetCard(numberOfCardsToPutIntoPlay, numberOfCardsToPutIntoPlay, Zone.LIBRARY, filter);
if (properCardFound && player.choose(Outcome.PutCreatureInPlay, cards, target, game)) {
for(UUID creatureId: target.getTargets()) {
Card card = game.getCard(creatureId);
if (card != null) {
cards.remove(card);
player.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId());
}
}
}
for (UUID cardId : cards) {
Card card = game.getCard(cardId);
if (card != null) {
player.moveCardToGraveyardWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
}
}
}
return true;
}
return false;
}
}

View file

@ -0,0 +1,87 @@
/*
* 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.khansoftarkir;
import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.TurnedFaceUpTriggeredAbility;
import mage.abilities.costs.common.RevealTargetFromHandCost;
import mage.abilities.effects.common.continious.GainAbilityTargetEffect;
import mage.abilities.keyword.MorphAbility;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.target.common.TargetCardInHand;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author LevelX2
*/
public class TemurCharger extends CardImpl {
private static final FilterCard filter = new FilterCard("a green card in your hand");
static {
filter.add(new ColorPredicate(ObjectColor.GREEN));
}
public TemurCharger(UUID ownerId) {
super(ownerId, 153, "Temur Charger", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{G}");
this.expansionSetCode = "KTK";
this.subtype.add("Horse");
this.color.setGreen(true);
this.power = new MageInt(3);
this.toughness = new MageInt(1);
// Morph - Reveal a green card in your hand.
this.addAbility(new MorphAbility(this, new RevealTargetFromHandCost(new TargetCardInHand(filter))));
// When Temur Charger is turned face up, target creature gains trample until end of turn.
Ability ability = new TurnedFaceUpTriggeredAbility(new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn));
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}
public TemurCharger(final TemurCharger card) {
super(card);
}
@Override
public TemurCharger copy() {
return new TemurCharger(this);
}
}

View file

@ -72,6 +72,7 @@ public class GrislySalvage extends CardImpl {
return new GrislySalvage(this);
}
}
class GrislySalvageEffect extends OneShotEffect {
private static final FilterCard filterPutInHand = new FilterCard("creature or land card to put in hand");

View file

@ -678,12 +678,16 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
@Override
public void addCounters(String name, int amount, Game game, ArrayList<UUID> appliedEffects) {
for (int i = 0; i < amount; i++) {
GameEvent event = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTER, objectId, ownerId, name, amount);
event.setAppliedEffects(appliedEffects);
if (!game.replaceEvent(event)) {
counters.addCounter(name, amount);
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTER_ADDED, objectId, ownerId, name, amount));
GameEvent countersEvent = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTERS, objectId, ownerId, name, amount);
countersEvent.setAppliedEffects(appliedEffects);
if (!game.replaceEvent(countersEvent)) {
for (int i = 0; i < countersEvent.getAmount(); i++) {
GameEvent event = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTER, objectId, ownerId, name, 1);
event.setAppliedEffects(appliedEffects);
if (!game.replaceEvent(event)) {
counters.addCounter(name, 1);
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTER_ADDED, objectId, ownerId, name, 1));
}
}
}
}
@ -695,15 +699,19 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
@Override
public void addCounters(Counter counter, Game game, ArrayList<UUID> appliedEffects) {
int amount = counter.getCount();
for (int i = 0; i < amount; i++) {
GameEvent countersEvent = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTERS, objectId, ownerId, counter.getName(), counter.getCount());
countersEvent.setAppliedEffects(appliedEffects);
if (!game.replaceEvent(countersEvent)) {
int amount = countersEvent.getAmount();
Counter eventCounter = counter.copy();
eventCounter.remove(amount - 1);
GameEvent event = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTER, objectId, ownerId, counter.getName(), counter.getCount());
event.setAppliedEffects(appliedEffects);
if (!game.replaceEvent(event)) {
counters.addCounter(eventCounter);
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTER_ADDED, objectId, ownerId, counter.getName(), counter.getCount()));
for (int i = 0; i < amount; i++) {
GameEvent event = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTER, objectId, ownerId, counter.getName(), 1);
event.setAppliedEffects(appliedEffects);
if (!game.replaceEvent(event)) {
counters.addCounter(eventCounter);
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTER_ADDED, objectId, ownerId, counter.getName(), 1));
}
}
}
}

View file

@ -125,6 +125,7 @@ public class GameEvent {
ATTACH, ATTACHED,
UNATTACH, UNATTACHED,
ADD_COUNTER, COUNTER_ADDED,
ADD_COUNTERS, COUNTERS_ADDED, /* COUNTERS_ADDED not implemented yet */
COUNTER_REMOVED,
LOSE_CONTROL, LOST_CONTROL,
GAIN_CONTROL, GAINED_CONTROL,

View file

@ -227,27 +227,35 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
@Override
public void addCounters(String name, int amount, Game game, ArrayList<UUID> appliedEffects) {
for (int i = 0; i < amount; i++) {
GameEvent event = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTER, objectId, controllerId, name, 1);
event.setAppliedEffects(appliedEffects);
if (!game.replaceEvent(event)) {
counters.addCounter(name, 1);
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTER_ADDED, objectId, controllerId, name, 1));
GameEvent countersEvent = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTERS, objectId, controllerId, name, amount);
countersEvent.setAppliedEffects(appliedEffects);
if (!game.replaceEvent(countersEvent)) {
for (int i = 0; i < countersEvent.getAmount(); i++) {
GameEvent event = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTER, objectId, controllerId, name, 1);
event.setAppliedEffects(appliedEffects);
if (!game.replaceEvent(event)) {
counters.addCounter(name, 1);
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTER_ADDED, objectId, controllerId, name, 1));
}
}
}
}
@Override
public void addCounters(Counter counter, Game game, ArrayList<UUID> appliedEffects) {
int amount = counter.getCount();
for (int i = 0; i < amount; i++) {
Counter eventCounter = counter.copy();
eventCounter.remove(amount - 1);
GameEvent event = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTER, objectId, controllerId, counter.getName(), 1);
event.setAppliedEffects(appliedEffects);
if (!game.replaceEvent(event)) {
counters.addCounter(eventCounter);
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTER_ADDED, objectId, controllerId, counter.getName(), 1));
GameEvent countersEvent = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTERS, objectId, controllerId, counter.getName(), counter.getCount());
countersEvent.setAppliedEffects(appliedEffects);
if (!game.replaceEvent(countersEvent)) {
int amount = countersEvent.getAmount();
for (int i = 0; i < amount; i++) {
Counter eventCounter = counter.copy();
eventCounter.remove(eventCounter.getCount() - 1);
GameEvent event = GameEvent.getEvent(GameEvent.EventType.ADD_COUNTER, objectId, controllerId, counter.getName(), 1);
event.setAppliedEffects(appliedEffects);
if (!game.replaceEvent(event)) {
counters.addCounter(eventCounter);
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COUNTER_ADDED, objectId, controllerId, counter.getName(), 1));
}
}
}
}