This commit is contained in:
jeffwadsworth 2020-07-07 10:34:09 -05:00
parent 019bbafd20
commit 181eb871fe
3 changed files with 30 additions and 20 deletions

View file

@ -23,7 +23,9 @@ public final class Heartstone extends CardImpl {
public Heartstone(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
// Activated abilities of creatures cost {1} less to activate. This effect can't reduce the amount of mana an ability costs to activate to less than one mana.
// Activated abilities of creatures cost {1} 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 HeartstoneEffect()));
}
@ -39,7 +41,8 @@ public final class Heartstone extends CardImpl {
class HeartstoneEffect extends CostModificationEffectImpl {
private static final String effectText = "Activated abilities of creatures cost {1} less to activate. This effect can't reduce the mana in that cost to less than one mana.";
private static final String effectText = "Activated abilities of creatures cost "
+ "{1} less to activate. This effect can't reduce the mana in that cost to less than one mana.";
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
public HeartstoneEffect() {
@ -64,10 +67,12 @@ class HeartstoneEffect extends CostModificationEffectImpl {
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (abilityToModify.getAbilityType() == AbilityType.ACTIVATED
|| (abilityToModify.getAbilityType() == AbilityType.MANA && (abilityToModify instanceof ActivatedAbility))) {
|| (abilityToModify.getAbilityType() == 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)) {
Permanent permanent = game.getPermanentOrLKIBattlefield(abilityToModify.getSourceId());
if (permanent != null
&& filter.match(permanent, source.getSourceId(), source.getControllerId(), game)) {
return true;
}
}

View file

@ -13,7 +13,6 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.util.CardUtil;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.UUID;
@ -26,7 +25,8 @@ public final class TrainingGrounds extends CardImpl {
public TrainingGrounds(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{U}");
// 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.
// 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.
this.addAbility(new SimpleStaticAbility(new TrainingGroundsEffect()));
}
@ -42,7 +42,8 @@ public final 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. "
private static final String effectText = "Activated abilities of creatures you control "
+ "cost up to {2} less to activate. "
+ "This effect can't reduce the mana in that cost to less than one mana";
TrainingGroundsEffect() {
@ -101,8 +102,9 @@ class TrainingGroundsEffect extends CostModificationEffectImpl {
return false;
}
//Activated abilities of creatures you control
Permanent permanent = game.getPermanent(abilityToModify.getSourceId());
return permanent != null && permanent.isCreature()
Permanent permanent = game.getPermanentOrLKIBattlefield(abilityToModify.getSourceId());
return permanent != null
&& permanent.isCreature()
&& permanent.isControlledBy(source.getControllerId());
}

View file

@ -40,7 +40,8 @@ public final class ZirdaTheDawnwaker extends CardImpl {
// Companion Each permanent card in your starting deck has an activated ability.
this.addAbility(new CompanionAbility(ZirdaTheDawnwakerCompanionCondition.instance));
// Abilities you activate that aren't mana abilities cost {2} less to activate. This effect can't reduce the mana in that cost to less than one mana.
// Abilities you activate that aren't mana abilities cost {2} less to activate.
// This effect can't reduce the mana in that cost to less than one mana.
this.addAbility(new SimpleStaticAbility(new ZirdaTheDawnwakerEffect()));
// {1}, {T}: Target creature can't block this turn.
@ -76,11 +77,11 @@ enum ZirdaTheDawnwakerCompanionCondition implements CompanionCondition {
.stream()
.filter(MageObject::isPermanent)
.allMatch(card -> card
.getAbilities()
.stream()
.map(Ability::getAbilityType)
.anyMatch(abilityType -> abilityType == AbilityType.ACTIVATED
|| abilityType == AbilityType.MANA)
.getAbilities()
.stream()
.map(Ability::getAbilityType)
.anyMatch(abilityType -> abilityType == AbilityType.ACTIVATED
|| abilityType == AbilityType.MANA)
);
}
}
@ -89,8 +90,8 @@ class ZirdaTheDawnwakerEffect extends CostModificationEffectImpl {
ZirdaTheDawnwakerEffect() {
super(Duration.Custom, Outcome.Benefit, CostModificationType.REDUCE_COST);
staticText = "Abilities you activate that aren't mana abilities cost {2} less to activate. " +
"This effect can't reduce the mana in that cost to less than one mana.";
staticText = "Abilities you activate that aren't mana abilities cost {2} less to activate. "
+ "This effect can't reduce the mana in that cost to less than one mana.";
}
private ZirdaTheDawnwakerEffect(final ZirdaTheDawnwakerEffect effect) {
@ -101,7 +102,8 @@ class ZirdaTheDawnwakerEffect extends CostModificationEffectImpl {
public boolean apply(Game game, Ability source, Ability abilityToModify) {
Mana mana = abilityToModify.getManaCostsToPay().getMana();
int reduceMax = mana.getGeneric();
if (reduceMax > 0 && mana.count() == mana.getGeneric()) {
if (reduceMax > 0
&& mana.count() == mana.getGeneric()) {
reduceMax--;
}
reduceMax = Math.min(reduceMax, 2);
@ -116,7 +118,8 @@ class ZirdaTheDawnwakerEffect extends CostModificationEffectImpl {
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
return abilityToModify.getAbilityType() == AbilityType.ACTIVATED
&& abilityToModify.isControlledBy(source.getControllerId());
&& abilityToModify.isControlledBy(source.getControllerId())
&& abilityToModify.getAbilityType() != AbilityType.MANA; // no mana abilities
}
@Override