mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
Heartstone, Training Grounds, Power Artifact - Fixed that costs of activated mana abilities were not reduced.
This commit is contained in:
parent
f50e67e385
commit
f16dcac52c
6 changed files with 48 additions and 49 deletions
|
@ -8,6 +8,7 @@ package mage.sets.antiquities;
|
|||
import java.util.UUID;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.ActivatedAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
|
||||
|
@ -45,10 +46,8 @@ public class PowerArtifact extends CardImpl {
|
|||
Ability ability = new EnchantAbility(auraTarget.getTargetName());
|
||||
this.addAbility(ability);
|
||||
|
||||
// The activation cost of target artifact is reduced by {2}. If this would reduce target
|
||||
// artifact's activation cost below {1}, target artifact's activation cost becomes {1}.
|
||||
// Power Artifact has no effect on artifacts that have no activation cost or whose activation
|
||||
// cost is {0}.
|
||||
// Enchanted artifact's activated abilities cost less to activate.
|
||||
// This effect can't reduce the amount of mana an ability costs to activate to less than one mana.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PowerArtifactCostModificationEffect()));
|
||||
}
|
||||
|
||||
|
@ -95,7 +94,8 @@ class PowerArtifactCostModificationEffect extends CostModificationEffectImpl {
|
|||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||
Permanent artifact = game.getPermanent(abilityToModify.getSourceId());
|
||||
if (artifact != null && artifact.getAttachments().contains(source.getSourceId())) {
|
||||
if (abilityToModify.getAbilityType().equals(AbilityType.ACTIVATED)) {
|
||||
if (abilityToModify.getAbilityType().equals(AbilityType.ACTIVATED)
|
||||
|| (abilityToModify.getAbilityType().equals(AbilityType.MANA) && (abilityToModify instanceof ActivatedAbility))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ class GroundingPouncerCondition implements Condition {
|
|||
|
||||
class ActivatedAbilityUsedThisTurnWatcher extends Watcher {
|
||||
|
||||
public Set<UUID> activatedThisTurn = new HashSet<UUID>();
|
||||
public Set<UUID> activatedThisTurn = new HashSet<>();
|
||||
|
||||
public ActivatedAbilityUsedThisTurnWatcher() {
|
||||
super("ActivatedAbilityUsedThisTurn", WatcherScope.GAME);
|
||||
|
|
|
@ -29,11 +29,8 @@ package mage.sets.ravnica;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.ActivatedAbility;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
|
||||
import mage.abilities.mana.ManaAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.AbilityType;
|
||||
import mage.constants.CardType;
|
||||
|
@ -55,9 +52,8 @@ public class SuppressionField extends CardImpl {
|
|||
super(ownerId, 31, "Suppression Field", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}");
|
||||
this.expansionSetCode = "RAV";
|
||||
|
||||
|
||||
// Activated abilities cost {2} more to activate unless they're mana abilities.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SuppressionFieldCostReductionEffect() ));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SuppressionFieldCostReductionEffect()));
|
||||
}
|
||||
|
||||
public SuppressionField(final SuppressionField card) {
|
||||
|
@ -72,7 +68,7 @@ public class SuppressionField extends CardImpl {
|
|||
|
||||
class SuppressionFieldCostReductionEffect extends CostModificationEffectImpl {
|
||||
|
||||
SuppressionFieldCostReductionEffect ( ) {
|
||||
SuppressionFieldCostReductionEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.INCREASE_COST);
|
||||
staticText = "Activated abilities cost {2} more to activate unless they're mana abilities";
|
||||
}
|
||||
|
@ -89,10 +85,7 @@ class SuppressionFieldCostReductionEffect extends CostModificationEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||
if (abilityToModify.getAbilityType().equals(AbilityType.ACTIVATED)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return abilityToModify.getAbilityType().equals(AbilityType.ACTIVATED);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.sets.riseoftheeldrazi;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
|
@ -33,6 +32,7 @@ import java.util.Set;
|
|||
import java.util.UUID;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.ActivatedAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -56,14 +56,14 @@ import mage.util.CardUtil;
|
|||
*/
|
||||
public class TrainingGrounds extends CardImpl {
|
||||
|
||||
public TrainingGrounds (UUID ownerId) {
|
||||
public TrainingGrounds(UUID ownerId) {
|
||||
super(ownerId, 91, "Training Grounds", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{U}");
|
||||
this.expansionSetCode = "ROE";
|
||||
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new TrainingGroundsEffect()));
|
||||
}
|
||||
|
||||
public TrainingGrounds (final TrainingGrounds card) {
|
||||
public TrainingGrounds(final TrainingGrounds card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
@ -90,37 +90,38 @@ class TrainingGroundsEffect extends CostModificationEffectImpl {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source, Ability abilityToModify) {
|
||||
Player controller = game.getPlayer(abilityToModify.getControllerId());
|
||||
if (controller != null){
|
||||
if (controller != null) {
|
||||
Mana mana = abilityToModify.getManaCostsToPay().getMana();
|
||||
int reduceMax = mana.getColorless();
|
||||
if (reduceMax > 0 && mana.count() == mana.getColorless()){
|
||||
if (reduceMax > 0 && mana.count() == mana.getColorless()) {
|
||||
reduceMax--;
|
||||
}
|
||||
if (reduceMax > 2){
|
||||
if (reduceMax > 2) {
|
||||
reduceMax = 2;
|
||||
}
|
||||
if (reduceMax > 0) {
|
||||
ChoiceImpl choice = new ChoiceImpl(true);
|
||||
Set<String> set = new LinkedHashSet<>();
|
||||
|
||||
for(int i = 0; i <= reduceMax; i++){
|
||||
for (int i = 0; i <= reduceMax; i++) {
|
||||
set.add(String.valueOf(i));
|
||||
}
|
||||
choice.setChoices(set);
|
||||
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());
|
||||
CardUtil.reduceCost(abilityToModify, reduce);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||
if (abilityToModify.getAbilityType().equals(AbilityType.ACTIVATED)) {
|
||||
if (abilityToModify.getAbilityType().equals(AbilityType.ACTIVATED)
|
||||
|| (abilityToModify.getAbilityType().equals(AbilityType.MANA) && (abilityToModify instanceof ActivatedAbility))) {
|
||||
//Activated abilities of creatures you control
|
||||
Permanent permanent = game.getPermanent(abilityToModify.getSourceId());
|
||||
if (permanent != null && filter.match(permanent, source.getSourceId(), source.getControllerId(), game)) {
|
||||
|
|
|
@ -34,11 +34,9 @@ import mage.abilities.common.SimpleActivatedAbility;
|
|||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.AbilityType;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.Filter;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.BlockingAttackerIdPredicate;
|
||||
import mage.filter.predicate.permanent.BlockingPredicate;
|
||||
|
@ -53,10 +51,13 @@ import mage.target.common.TargetCreaturePermanent;
|
|||
public class GodosIrregulars extends CardImpl {
|
||||
|
||||
private static final FilterCreaturePermanent basicFilter = new FilterCreaturePermanent("creature blocking it");
|
||||
|
||||
static {
|
||||
basicFilter.add(new BlockingPredicate());
|
||||
}
|
||||
|
||||
public UUID originalAbilityIdToAdjust;
|
||||
|
||||
public GodosIrregulars(UUID ownerId) {
|
||||
super(ownerId, 101, "Godo's Irregulars", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{R}");
|
||||
this.expansionSetCode = "SOK";
|
||||
|
@ -69,12 +70,13 @@ public class GodosIrregulars extends CardImpl {
|
|||
// {R}: Godo's Irregulars deals 1 damage to target creature blocking it.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1), new ManaCostsImpl("{R"));
|
||||
ability.addTarget(new TargetCreaturePermanent());
|
||||
originalAbilityIdToAdjust = ability.getOriginalId();
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getAbilityType().equals(AbilityType.ACTIVATED)) {
|
||||
if (originalAbilityIdToAdjust.equals(ability.getOriginalId())) {
|
||||
ability.getTargets().clear();
|
||||
FilterCreaturePermanent filter = basicFilter.copy();
|
||||
filter.add(new BlockingAttackerIdPredicate(this.getId()));
|
||||
|
@ -85,6 +87,7 @@ public class GodosIrregulars extends CardImpl {
|
|||
|
||||
public GodosIrregulars(final GodosIrregulars card) {
|
||||
super(card);
|
||||
this.originalAbilityIdToAdjust = card.originalAbilityIdToAdjust;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -30,6 +30,7 @@ package mage.sets.stronghold;
|
|||
import java.util.UUID;
|
||||
import mage.Mana;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.ActivatedAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -99,7 +100,8 @@ class HeartstoneEffect extends CostModificationEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||
if (abilityToModify.getAbilityType().equals(AbilityType.ACTIVATED)) {
|
||||
if (abilityToModify.getAbilityType().equals(AbilityType.ACTIVATED)
|
||||
|| (abilityToModify.getAbilityType().equals(AbilityType.MANA) && (abilityToModify instanceof ActivatedAbility))) {
|
||||
// Activated abilities of creatures
|
||||
Permanent permanent = game.getPermanent(abilityToModify.getSourceId());
|
||||
if (permanent != null && filter.match(permanent, source.getSourceId(), source.getControllerId(), game)) {
|
||||
|
|
Loading…
Reference in a new issue