mirror of
https://github.com/magefree/mage.git
synced 2025-12-27 22:12:03 -08:00
Changes to Kicker. Removed unused BuybackManaCost.
This commit is contained in:
parent
8370d2c5a4
commit
8d97ffa9ba
4 changed files with 22 additions and 79 deletions
|
|
@ -58,20 +58,13 @@ public class KickedCondition implements Condition {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Card card = game.getCard(source.getSourceId());
|
||||
if (card != null) {
|
||||
KickerAbility kickerAbility = null;
|
||||
for (Ability ability: card.getAbilities()) {
|
||||
if (ability instanceof KickerAbility) {
|
||||
kickerAbility = (KickerAbility) ability;
|
||||
if(((KickerAbility) ability).isKicked()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
boolean kicked = false;
|
||||
if (kickerAbility != null) {
|
||||
for (OptionalAdditionalCost cost: kickerAbility.getKickerCosts()) {
|
||||
kicked = cost.isActivated();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return kicked;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,57 +0,0 @@
|
|||
/*
|
||||
* 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.mana;
|
||||
|
||||
import mage.abilities.costs.OptionalAdditionalCostImpl;
|
||||
|
||||
/**
|
||||
* This cost defines a Buyback mana cost
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class BuybackManaCost extends OptionalAdditionalCostImpl {
|
||||
|
||||
public BuybackManaCost(String manaString) {
|
||||
super("Buyback","(You may pay an additional {cost} as you cast this spell. If you do, put this card into your hand as it resolves.)",new ManaCostsImpl(manaString));
|
||||
}
|
||||
|
||||
public BuybackManaCost(final BuybackManaCost cost) {
|
||||
super(cost);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuybackManaCost copy() {
|
||||
return new BuybackManaCost(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCastSuffixMessage(int position) {
|
||||
return " with " + name;
|
||||
}
|
||||
}
|
||||
|
|
@ -29,8 +29,6 @@ package mage.abilities.dynamicvalue.common;
|
|||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.OptionalAdditionalCost;
|
||||
import mage.abilities.costs.mana.KickerManaCost;
|
||||
import mage.abilities.costs.mana.MultikickerManaCost;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.keyword.KickerAbility;
|
||||
import mage.cards.Card;
|
||||
|
|
@ -50,21 +48,13 @@ public class MultikickerCount implements DynamicValue {
|
|||
int count = 0;
|
||||
Card card = game.getCard(source.getSourceId());
|
||||
if (card != null) {
|
||||
KickerAbility kickerAbility = null;
|
||||
for (Ability ability: card.getAbilities()) {
|
||||
if (ability instanceof KickerAbility) {
|
||||
kickerAbility = (KickerAbility) ability;
|
||||
count += ((KickerAbility) ability).getKickedCounter();
|
||||
}
|
||||
}
|
||||
if (kickerAbility != null) {
|
||||
for (OptionalAdditionalCost cost: kickerAbility.getKickerCosts()) {
|
||||
count = cost.getActivateCount();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
return 0;
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -70,6 +70,23 @@ public class KickerAbility extends StaticAbility<KickerAbility> implements Optio
|
|||
}
|
||||
}
|
||||
|
||||
public int getKickedCounter() {
|
||||
int counter = 0;
|
||||
for (OptionalAdditionalCost cost: kickerCosts) {
|
||||
counter += cost.getActivateCount();
|
||||
}
|
||||
return counter;
|
||||
}
|
||||
|
||||
public boolean isKicked() {
|
||||
for (OptionalAdditionalCost cost: kickerCosts) {
|
||||
if(cost.isActivated()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<OptionalAdditionalCost> getKickerCosts () {
|
||||
return kickerCosts;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue