Merge pull request #3590 from spjspj/master

Implement 1 cards (HOU)
This commit is contained in:
spjspj 2017-07-04 22:10:34 +10:00 committed by GitHub
commit 1ff86f2574
3 changed files with 93 additions and 38 deletions

View file

@ -29,19 +29,18 @@ package mage.cards.c;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect; import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.SourcePermanentPowerCount;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.discard.DiscardControllerEffect;
import mage.abilities.keyword.EternalizeAbility; import mage.abilities.keyword.EternalizeAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/** /**
* *
@ -58,7 +57,14 @@ public class ChampionOfWits extends CardImpl {
this.toughness = new MageInt(1); this.toughness = new MageInt(1);
// When Champion of Wits enters the battlefield, you may draw cards equal to its power. If you do, discard two cards // When Champion of Wits enters the battlefield, you may draw cards equal to its power. If you do, discard two cards
this.addAbility(new EntersBattlefieldTriggeredAbility(new ChampionOfWitsEffect(), true)); DynamicValue xValue = new SourcePermanentPowerCount();
Effect effect = new DrawCardSourceControllerEffect(xValue);
effect.setText("you may draw cards equal to its power");
Ability ability = new EntersBattlefieldTriggeredAbility(effect, true);
effect = new DiscardControllerEffect(2);
effect.setText("If you do, discard two cards");
ability.addEffect(effect);
this.addAbility(ability);
// Eternalize {5}{U}{U} // Eternalize {5}{U}{U}
this.addAbility(new EternalizeAbility(new ManaCostsImpl("{5}{U}{U}"), this)); this.addAbility(new EternalizeAbility(new ManaCostsImpl("{5}{U}{U}"), this));
@ -73,33 +79,3 @@ public class ChampionOfWits extends CardImpl {
return new ChampionOfWits(this); return new ChampionOfWits(this);
} }
} }
class ChampionOfWitsEffect extends OneShotEffect {
public ChampionOfWitsEffect() {
super(Outcome.Benefit);
staticText = "you may draw cards equal to its power. If you do, discard two cards.";
}
public ChampionOfWitsEffect(final ChampionOfWitsEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller != null && permanent != null && sourceObject != null) {
controller.drawCards(permanent.getPower().getValue(), game);
controller.discard(2, false, source, game);
return true;
}
return false;
}
@Override
public ChampionOfWitsEffect copy() {
return new ChampionOfWitsEffect(this);
}
}

View file

@ -0,0 +1,78 @@
/*
* 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.r;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.SourcePermanentPowerCount;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.abilities.keyword.EternalizeAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author spjspj
*/
public class ResilientKhenra extends CardImpl {
public ResilientKhenra(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}");
this.subtype.add("Jackal");
this.subtype.add("Wizard");
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// When Resilient Khenra enters the battlefield, you may have target creature get +X/+X until end of turn, where X is Resilient Khenra's power.
DynamicValue xValue = new SourcePermanentPowerCount();
Ability ability = new EntersBattlefieldTriggeredAbility(new BoostTargetEffect(xValue, xValue, Duration.EndOfTurn, true), true);
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
// Eternalize {4}{G}{G}
this.addAbility(new EternalizeAbility(new ManaCostsImpl("{4}{G}{G}"), this));
}
public ResilientKhenra(final ResilientKhenra card) {
super(card);
}
@Override
public ResilientKhenra copy() {
return new ResilientKhenra(this);
}
}

View file

@ -142,6 +142,7 @@ public class HourOfDevastation extends ExpansionSet {
cards.add(new SetCardInfo("Razaketh's Rite", 74, Rarity.UNCOMMON, mage.cards.r.RazakethsRite.class)); cards.add(new SetCardInfo("Razaketh's Rite", 74, Rarity.UNCOMMON, mage.cards.r.RazakethsRite.class));
cards.add(new SetCardInfo("Reason // Believe", 154, Rarity.RARE, mage.cards.r.ReasonBelieve.class)); cards.add(new SetCardInfo("Reason // Believe", 154, Rarity.RARE, mage.cards.r.ReasonBelieve.class));
cards.add(new SetCardInfo("Refuse // Cooperate", 156, Rarity.RARE, mage.cards.r.RefuseCooperate.class)); cards.add(new SetCardInfo("Refuse // Cooperate", 156, Rarity.RARE, mage.cards.r.RefuseCooperate.class));
cards.add(new SetCardInfo("Resilient Khenra", 131, Rarity.RARE, mage.cards.r.ResilientKhenra.class));
cards.add(new SetCardInfo("Resolute Survivors", 142, Rarity.UNCOMMON, mage.cards.r.ResoluteSurvivors.class)); cards.add(new SetCardInfo("Resolute Survivors", 142, Rarity.UNCOMMON, mage.cards.r.ResoluteSurvivors.class));
cards.add(new SetCardInfo("Rhonas's Last Stand", 132, Rarity.RARE, mage.cards.r.RhonassLastStand.class)); cards.add(new SetCardInfo("Rhonas's Last Stand", 132, Rarity.RARE, mage.cards.r.RhonassLastStand.class));
cards.add(new SetCardInfo("Rhonas's Stalwart", 133, Rarity.COMMON, mage.cards.r.RhonassStalwart.class)); cards.add(new SetCardInfo("Rhonas's Stalwart", 133, Rarity.COMMON, mage.cards.r.RhonassStalwart.class));