mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
* Training Grounds - Fixed that the reduction did not work correctly with hybrid mana. Fixed the check what ability is an activated ability (fixes #754).
This commit is contained in:
parent
fe10cde2b9
commit
972fe78898
1 changed files with 7 additions and 7 deletions
|
@ -35,9 +35,12 @@ import mage.Mana;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.ActivatedAbility;
|
import mage.abilities.ActivatedAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
import mage.abilities.costs.mana.ManaCost;
|
||||||
|
import mage.abilities.costs.mana.ManaCosts;
|
||||||
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
|
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.choices.ChoiceImpl;
|
import mage.choices.ChoiceImpl;
|
||||||
|
import mage.constants.AbilityType;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.CostModificationType;
|
import mage.constants.CostModificationType;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
|
@ -48,6 +51,7 @@ import mage.filter.common.FilterControlledCreaturePermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
import mage.util.CardUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -76,10 +80,7 @@ public class TrainingGrounds extends CardImpl {
|
||||||
class TrainingGroundsEffect extends CostModificationEffectImpl {
|
class TrainingGroundsEffect extends CostModificationEffectImpl {
|
||||||
|
|
||||||
private static final String effectText = "Activated abilities of creatures you control cost up to {2} less to activate. This effect can't reduce the amount of mana an ability costs to activate to less than one mana";
|
private static final String effectText = "Activated abilities of creatures you control cost up to {2} less to activate. This effect can't reduce the amount of mana an ability costs to activate to less than one mana";
|
||||||
private static final FilterControlledCreaturePermanent filter;
|
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent();
|
||||||
static {
|
|
||||||
filter = new FilterControlledCreaturePermanent();
|
|
||||||
}
|
|
||||||
|
|
||||||
public TrainingGroundsEffect() {
|
public TrainingGroundsEffect() {
|
||||||
super(Duration.Custom, Outcome.Benefit, CostModificationType.REDUCE_COST);
|
super(Duration.Custom, Outcome.Benefit, CostModificationType.REDUCE_COST);
|
||||||
|
@ -113,8 +114,7 @@ class TrainingGroundsEffect extends CostModificationEffectImpl {
|
||||||
choice.setMessage("Reduce ability cost");
|
choice.setMessage("Reduce ability cost");
|
||||||
if(controller.choose(Outcome.Benefit, choice, game)){
|
if(controller.choose(Outcome.Benefit, choice, game)){
|
||||||
int reduce = Integer.parseInt(choice.getChoice());
|
int reduce = Integer.parseInt(choice.getChoice());
|
||||||
mana.setColorless(mana.getColorless() - reduce);
|
CardUtil.reduceCost(abilityToModify, reduce);
|
||||||
abilityToModify.getManaCostsToPay().load(mana.toString());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -124,7 +124,7 @@ class TrainingGroundsEffect extends CostModificationEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||||
if (abilityToModify instanceof ActivatedAbility) {
|
if (abilityToModify.getAbilityType().equals(AbilityType.ACTIVATED)) {
|
||||||
//Activated abilities of creatures you control
|
//Activated abilities of creatures you control
|
||||||
Permanent permanent = game.getPermanent(abilityToModify.getSourceId());
|
Permanent permanent = game.getPermanent(abilityToModify.getSourceId());
|
||||||
if (permanent != null && filter.match(permanent, source.getSourceId(), source.getControllerId(), game)) {
|
if (permanent != null && filter.match(permanent, source.getSourceId(), source.getControllerId(), game)) {
|
||||||
|
|
Loading…
Reference in a new issue