mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +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;
|
||||
|
@ -32,48 +33,46 @@ import mage.util.CardUtil;
|
|||
* @author nick.myers
|
||||
*/
|
||||
public class PowerArtifact extends CardImpl {
|
||||
|
||||
|
||||
public PowerArtifact(UUID ownerId) {
|
||||
super(ownerId, 55, "Power Artifact", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{U}{U}");
|
||||
this.expansionSetCode = "ATQ";
|
||||
this.subtype.add("Aura");
|
||||
|
||||
|
||||
// Enchant artifact
|
||||
TargetPermanent auraTarget = new TargetArtifactPermanent();
|
||||
this.getSpellAbility().addTarget(auraTarget);
|
||||
this.getSpellAbility().addEffect(new AttachEffect(Outcome.Benefit));
|
||||
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}.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PowerArtifactCostModificationEffect()));
|
||||
|
||||
// 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()));
|
||||
}
|
||||
|
||||
|
||||
public PowerArtifact(final PowerArtifact card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PowerArtifact copy() {
|
||||
return new PowerArtifact(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class PowerArtifactCostModificationEffect extends CostModificationEffectImpl {
|
||||
|
||||
|
||||
PowerArtifactCostModificationEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Benefit, CostModificationType.REDUCE_COST);
|
||||
staticText = "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}.";
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
PowerArtifactCostModificationEffect(PowerArtifactCostModificationEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source, Ability abilityToModify) {
|
||||
Player controller = game.getPlayer(abilityToModify.getControllerId());
|
||||
|
@ -90,21 +89,22 @@ class PowerArtifactCostModificationEffect extends CostModificationEffectImpl {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
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;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@Override
|
||||
public PowerArtifactCostModificationEffect copy() {
|
||||
return new PowerArtifactCostModificationEffect(this);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ import mage.watchers.Watcher;
|
|||
*
|
||||
*/
|
||||
public class GroundlingPouncer extends CardImpl {
|
||||
|
||||
|
||||
private String rule = "{this} gets +1/+3 and gains flying until end of turn. Activate this ability only once each turn and only if an opponent controls a creature with flying.";
|
||||
|
||||
public GroundlingPouncer(UUID ownerId) {
|
||||
|
@ -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);
|
||||
|
@ -156,4 +156,4 @@ class ActivatedAbilityUsedThisTurnWatcher extends Watcher {
|
|||
super.reset();
|
||||
this.activatedThisTurn.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ public class TrainingGrounds extends CardImpl {
|
|||
}
|
||||
|
||||
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 FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent();
|
||||
|
||||
|
@ -90,41 +90,42 @@ 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)) {
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -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