mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
- Added Barrenton Medic, Kinscaer Harpoonist, Knacksaw Clique.
This commit is contained in:
parent
7547f98536
commit
12c09545b5
6 changed files with 471 additions and 51 deletions
80
Mage.Sets/src/mage/sets/shadowmoor/BarrentonMedic.java
Normal file
80
Mage.Sets/src/mage/sets/shadowmoor/BarrentonMedic.java
Normal file
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* 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.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.PutCountersSourceCost;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.effects.common.PreventDamageTargetEffect;
|
||||
import mage.abilities.effects.common.UntapSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.target.common.TargetCreatureOrPlayer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
|
||||
*/
|
||||
public class BarrentonMedic extends CardImpl<BarrentonMedic> {
|
||||
|
||||
public BarrentonMedic(UUID ownerId) {
|
||||
super(ownerId, 4, "Barrenton Medic", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{4}{W}");
|
||||
this.expansionSetCode = "SHM";
|
||||
this.subtype.add("Kithkin");
|
||||
this.subtype.add("Cleric");
|
||||
|
||||
this.color.setWhite(true);
|
||||
this.power = new MageInt(0);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
// {tap}: Prevent the next 1 damage that would be dealt to target creature or player this turn.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PreventDamageTargetEffect(Duration.EndOfTurn, 1), new TapSourceCost());
|
||||
ability.addTarget(new TargetCreatureOrPlayer(true));
|
||||
this.addAbility(ability);
|
||||
|
||||
// Put a -1/-1 counter on Barrenton Medic: Untap Barrenton Medic.
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new UntapSourceEffect(), new PutCountersSourceCost(CounterType.M1M1.createInstance(1))));
|
||||
}
|
||||
|
||||
public BarrentonMedic(final BarrentonMedic card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BarrentonMedic copy() {
|
||||
return new BarrentonMedic(this);
|
||||
}
|
||||
}
|
|
@ -33,7 +33,7 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.common.ActivateIfConditionActivatedAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.condition.common.MyTurnCondition;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.abilities.costs.common.PutCountersSourceCost;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.effects.common.DiscardTargetEffect;
|
||||
import mage.abilities.effects.common.UntapSourceEffect;
|
||||
|
@ -41,12 +41,8 @@ import mage.cards.CardImpl;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.Counter;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -71,7 +67,7 @@ public class CinderhazeWretch extends CardImpl<CinderhazeWretch> {
|
|||
this.addAbility(ability);
|
||||
|
||||
// Put a -1/-1 counter on Cinderhaze Wretch: Untap Cinderhaze Wretch.
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new UntapSourceEffect(), new PutCounterSourceCost(CounterType.M1M1.createInstance(1))));
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new UntapSourceEffect(), new PutCountersSourceCost(CounterType.M1M1.createInstance(1))));
|
||||
|
||||
}
|
||||
|
||||
|
@ -84,47 +80,3 @@ public class CinderhazeWretch extends CardImpl<CinderhazeWretch> {
|
|||
return new CinderhazeWretch(this);
|
||||
}
|
||||
}
|
||||
|
||||
class PutCounterSourceCost extends CostImpl<PutCounterSourceCost> {
|
||||
|
||||
private int amount;
|
||||
private String name;
|
||||
private Counter counter;
|
||||
|
||||
public PutCounterSourceCost(Counter counter) {
|
||||
this.counter = counter.copy();
|
||||
this.amount = counter.getCount();
|
||||
this.name = counter.getName();
|
||||
this.text = new StringBuilder("Put ").append((amount == 1 ? "a" : CardUtil.numberToText(amount)))
|
||||
.append(" ").append(name).append(" counter").append((amount != 1 ? "s" : ""))
|
||||
.append(" on {this}").toString();
|
||||
|
||||
}
|
||||
|
||||
public PutCounterSourceCost(PutCounterSourceCost cost) {
|
||||
super(cost);
|
||||
this.counter = cost.counter;
|
||||
this.amount = cost.amount;
|
||||
this.name = cost.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPay(UUID sourceId, UUID controllerId, Game game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
Permanent permanent = game.getPermanent(sourceId);
|
||||
if (permanent != null) {
|
||||
permanent.addCounters(counter, game);
|
||||
this.paid = true;
|
||||
}
|
||||
return paid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PutCounterSourceCost copy() {
|
||||
return new PutCounterSourceCost(this);
|
||||
}
|
||||
}
|
||||
|
|
80
Mage.Sets/src/mage/sets/shadowmoor/KinscaerHarpoonist.java
Normal file
80
Mage.Sets/src/mage/sets/shadowmoor/KinscaerHarpoonist.java
Normal file
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* 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.abilities.Ability;
|
||||
import mage.abilities.common.AttacksTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.continious.LoseAbilityTargetEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Rarity;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
|
||||
*/
|
||||
public class KinscaerHarpoonist extends CardImpl<KinscaerHarpoonist> {
|
||||
|
||||
public KinscaerHarpoonist(UUID ownerId) {
|
||||
super(ownerId, 41, "Kinscaer Harpoonist", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{3}{U}");
|
||||
this.expansionSetCode = "SHM";
|
||||
this.subtype.add("Kithkin");
|
||||
this.subtype.add("Soldier");
|
||||
|
||||
this.color.setBlue(true);
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(2);
|
||||
|
||||
// Flying
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
// Whenever Kinscaer Harpoonist attacks, you may have target creature lose flying until end of turn.
|
||||
Effect effect = new LoseAbilityTargetEffect(FlyingAbility.getInstance(), Duration.EndOfTurn);
|
||||
effect.setText("you may have target creature lose flying until end of turn");
|
||||
Ability ability = new AttacksTriggeredAbility(effect, true);
|
||||
ability.addTarget(new TargetCreaturePermanent(true));
|
||||
this.addAbility(ability);
|
||||
|
||||
}
|
||||
|
||||
public KinscaerHarpoonist(final KinscaerHarpoonist card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public KinscaerHarpoonist copy() {
|
||||
return new KinscaerHarpoonist(this);
|
||||
}
|
||||
}
|
168
Mage.Sets/src/mage/sets/shadowmoor/KnacksawClique.java
Normal file
168
Mage.Sets/src/mage/sets/shadowmoor/KnacksawClique.java
Normal file
|
@ -0,0 +1,168 @@
|
|||
/*
|
||||
* 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.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.UntapSourceCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.AsThoughEffectImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.AsThoughEffectType;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetOpponent;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
|
||||
*/
|
||||
public class KnacksawClique extends CardImpl<KnacksawClique> {
|
||||
|
||||
public KnacksawClique(UUID ownerId) {
|
||||
super(ownerId, 42, "Knacksaw Clique", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{U}");
|
||||
this.expansionSetCode = "SHM";
|
||||
this.subtype.add("Faerie");
|
||||
this.subtype.add("Rogue");
|
||||
|
||||
this.color.setBlue(true);
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
// Flying
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
// {1}{U}, {untap}: Target opponent exiles the top card of his or her library. Until end of turn, you may play that card.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new KnacksawCliqueEffect(), new ManaCostsImpl("{1}{U}"));
|
||||
ability.addCost(new UntapSourceCost());
|
||||
ability.addTarget(new TargetOpponent(true));
|
||||
this.addAbility(ability);
|
||||
|
||||
}
|
||||
|
||||
public KnacksawClique(final KnacksawClique card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public KnacksawClique copy() {
|
||||
return new KnacksawClique(this);
|
||||
}
|
||||
}
|
||||
|
||||
class KnacksawCliqueEffect extends OneShotEffect<KnacksawCliqueEffect> {
|
||||
|
||||
public KnacksawCliqueEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "Target opponent exiles the top card of his or her library. Until end of turn, you may play that card";
|
||||
}
|
||||
|
||||
public KnacksawCliqueEffect(final KnacksawCliqueEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public KnacksawCliqueEffect copy() {
|
||||
return new KnacksawCliqueEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player opponent = game.getPlayer(source.getFirstTarget());
|
||||
if (opponent != null) {
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
UUID exileId = CardUtil.getCardExileZoneId(game, source);
|
||||
Card card = opponent.getLibrary().getFromTop(game);
|
||||
if (card != null
|
||||
&& you != null) {
|
||||
card.moveToExile(exileId, "Knacksaw Clique", source.getSourceId(), game);
|
||||
if (card.getSpellAbility() != null) {
|
||||
game.addEffect(new KnacksawCliqueCastFromExileEffect(card.getId(), exileId), source);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class KnacksawCliqueCastFromExileEffect extends AsThoughEffectImpl<KnacksawCliqueCastFromExileEffect> {
|
||||
|
||||
private UUID cardId;
|
||||
private UUID exileId;
|
||||
|
||||
public KnacksawCliqueCastFromExileEffect(UUID cardId, UUID exileId) {
|
||||
super(AsThoughEffectType.CAST, Duration.EndOfTurn, Outcome.Benefit);
|
||||
staticText = "Until end of turn, you may play that card";
|
||||
this.cardId = cardId;
|
||||
this.exileId = exileId;
|
||||
}
|
||||
|
||||
public KnacksawCliqueCastFromExileEffect(final KnacksawCliqueCastFromExileEffect effect) {
|
||||
super(effect);
|
||||
this.cardId = effect.cardId;
|
||||
this.exileId = effect.exileId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public KnacksawCliqueCastFromExileEffect copy() {
|
||||
return new KnacksawCliqueCastFromExileEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(UUID sourceId, Ability source, Game game) {
|
||||
if (sourceId.equals(this.cardId)) {
|
||||
Card card = game.getCard(this.cardId);
|
||||
if (card != null
|
||||
&& game.getState().getExile().getExileZone(exileId).contains(cardId)) {
|
||||
if (card.getSpellAbility() != null
|
||||
&& card.getSpellAbility().spellCanBeActivatedRegularlyNow(source.getControllerId(), game)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* 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.abilities.costs.common;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.CostImpl;
|
||||
import mage.counters.Counter;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public class PutCountersSourceCost extends CostImpl<PutCountersSourceCost> {
|
||||
|
||||
private int amount;
|
||||
private String name;
|
||||
private Counter counter;
|
||||
|
||||
public PutCountersSourceCost(Counter counter) {
|
||||
this.counter = counter.copy();
|
||||
this.amount = counter.getCount();
|
||||
this.name = counter.getName();
|
||||
this.text = new StringBuilder("Put ").append((amount == 1 ? "a" : CardUtil.numberToText(amount)))
|
||||
.append(" ").append(name).append(" counter").append((amount != 1 ? "s" : ""))
|
||||
.append(" on {this}").toString();
|
||||
|
||||
}
|
||||
|
||||
public PutCountersSourceCost(PutCountersSourceCost cost) {
|
||||
super(cost);
|
||||
this.counter = cost.counter;
|
||||
this.amount = cost.amount;
|
||||
this.name = cost.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPay(UUID sourceId, UUID controllerId, Game game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
|
||||
Permanent permanent = game.getPermanent(sourceId);
|
||||
if (permanent != null) {
|
||||
permanent.addCounters(counter, game);
|
||||
this.paid = true;
|
||||
}
|
||||
return paid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PutCountersSourceCost copy() {
|
||||
return new PutCountersSourceCost(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package mage.abilities.effects.common.continious;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public class LoseAbilityTargetEffect extends ContinuousEffectImpl<LoseAbilityTargetEffect>{
|
||||
|
||||
protected Ability ability;
|
||||
|
||||
public LoseAbilityTargetEffect(Ability ability){
|
||||
this(ability, Duration.WhileOnBattlefield);
|
||||
}
|
||||
|
||||
public LoseAbilityTargetEffect(Ability ability, Duration duration){
|
||||
super(duration, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.LoseAbility);
|
||||
this.ability = ability;
|
||||
}
|
||||
|
||||
public LoseAbilityTargetEffect(final LoseAbilityTargetEffect effect){
|
||||
super(effect);
|
||||
this.ability = effect.ability.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoseAbilityTargetEffect copy(){
|
||||
return new LoseAbilityTargetEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source){
|
||||
Permanent permanent = game.getPermanent(source.getFirstTarget());
|
||||
if(permanent != null){
|
||||
while(permanent.getAbilities().contains(ability)){
|
||||
permanent.getAbilities().remove(ability);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in a new issue