diff --git a/Mage.Sets/src/mage/cards/h/Heartstone.java b/Mage.Sets/src/mage/cards/h/Heartstone.java index 9b65d308f3e..65c244fea56 100644 --- a/Mage.Sets/src/mage/cards/h/Heartstone.java +++ b/Mage.Sets/src/mage/cards/h/Heartstone.java @@ -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; } } diff --git a/Mage.Sets/src/mage/cards/t/TrainingGrounds.java b/Mage.Sets/src/mage/cards/t/TrainingGrounds.java index ea756b64133..4e4488b5d41 100644 --- a/Mage.Sets/src/mage/cards/t/TrainingGrounds.java +++ b/Mage.Sets/src/mage/cards/t/TrainingGrounds.java @@ -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()); } diff --git a/Mage.Sets/src/mage/cards/z/ZirdaTheDawnwaker.java b/Mage.Sets/src/mage/cards/z/ZirdaTheDawnwaker.java index 6e612343eb5..f86246c513e 100644 --- a/Mage.Sets/src/mage/cards/z/ZirdaTheDawnwaker.java +++ b/Mage.Sets/src/mage/cards/z/ZirdaTheDawnwaker.java @@ -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