Merge pull request #577 from tool4ever/manafix

Non-mana abilities incorrectly triggering/replaced
This commit is contained in:
Agetian
2022-05-30 12:54:52 +03:00
committed by GitHub
4 changed files with 23 additions and 20 deletions

View File

@@ -126,20 +126,22 @@ public class AbilityManaPart implements java.io.Serializable {
SpellAbility root = sa == null ? null : sa.getRootAbility(); SpellAbility root = sa == null ? null : sa.getRootAbility();
final Map<AbilityKey, Object> repParams = AbilityKey.mapFromAffected(source); if (root != null && root.isManaAbility()) {
repParams.put(AbilityKey.Mana, afterReplace); final Map<AbilityKey, Object> repParams = AbilityKey.mapFromAffected(source);
repParams.put(AbilityKey.Player, player); repParams.put(AbilityKey.Mana, afterReplace);
repParams.put(AbilityKey.AbilityMana, root); repParams.put(AbilityKey.Player, player);
repParams.put(AbilityKey.Activator, root == null ? null : root.getActivatingPlayer()); repParams.put(AbilityKey.AbilityMana, root);
repParams.put(AbilityKey.Activator, root.getActivatingPlayer());
switch (player.getGame().getReplacementHandler().run(ReplacementType.ProduceMana, repParams)) { switch (player.getGame().getReplacementHandler().run(ReplacementType.ProduceMana, repParams)) {
case NotReplaced: case NotReplaced:
break; break;
case Updated: case Updated:
afterReplace = (String) repParams.get(AbilityKey.Mana); afterReplace = (String) repParams.get(AbilityKey.Mana);
break; break;
default: default:
return; return;
}
} }
//clear lastProduced //clear lastProduced
@@ -172,7 +174,7 @@ public class AbilityManaPart implements java.io.Serializable {
runParams.put(AbilityKey.Activator, root == null ? null : root.getActivatingPlayer()); runParams.put(AbilityKey.Activator, root == null ? null : root.getActivatingPlayer());
player.getGame().getTriggerHandler().runTrigger(TriggerType.TapsForMana, runParams, false); player.getGame().getTriggerHandler().runTrigger(TriggerType.TapsForMana, runParams, false);
if (source.isLand() && sa.getPayCosts() != null && sa.getPayCosts().hasTapCost()) { if (source.isLand() && root.isManaAbility() && root.getPayCosts() != null && root.getPayCosts().hasTapCost()) {
player.setTappedLandForManaThisTurn(true); player.setTappedLandForManaThisTurn(true);
} }
} // end produceMana(String) } // end produceMana(String)

View File

@@ -56,11 +56,12 @@ public class TriggerTapsForMana extends Trigger {
/** {@inheritDoc} /** {@inheritDoc}
* @param runParams*/ * @param runParams*/
@Override @Override
public final boolean performTest(final Map<AbilityKey, Object> runParams) { public final boolean performTest(final Map<AbilityKey, Object> runParams) {
//Check for tapping SpellAbility manaAbility = (SpellAbility) runParams.get(AbilityKey.AbilityMana);
// Caged Sun special case
if (!hasParam("NoTapCheck")) { if (!hasParam("NoTapCheck")) {
final SpellAbility manaAbility = (SpellAbility) runParams.get(AbilityKey.AbilityMana); if (manaAbility == null || !manaAbility.isManaAbility() || !manaAbility.getPayCosts().hasTapCost()) {
if (manaAbility == null || !manaAbility.getRootAbility().getPayCosts().hasTapCost()) {
return false; return false;
} }
} }

View File

@@ -3,7 +3,7 @@ ManaCost:3
Types:Artifact Creature Golem Types:Artifact Creature Golem
PT:3/3 PT:3/3
K:Defender K:Defender
S:Mode$ CanAttackDefender | Affected$ Card.Self+enchanted | Description$ As long as CARDNAME is enchanted, it can attack as though it didn't have defender. S:Mode$ CanAttackDefender | ValidCard$ Card.Self+enchanted | Description$ As long as CARDNAME is enchanted, it can attack as though it didn't have defender.
SVar:EnchantMe:Once SVar:EnchantMe:Once
DeckHints:Type$Enchantment DeckHints:Type$Enchantment
Oracle:Defender\nAs long as Pillar of War is enchanted, it can attack as though it didn't have defender. Oracle:Defender\nAs long as Pillar of War is enchanted, it can attack as though it didn't have defender.

View File

@@ -3,7 +3,7 @@ ManaCost:1 U/R U/R
Types:Creature Cyclops Types:Creature Cyclops
PT:4/3 PT:4/3
K:Defender K:Defender
S:Mode$ CanAttackDefender | Affected$ Card.Self | CheckSVar$ X | Description$ As long as you've cast an instant or sorcery spell this turn, CARDNAME can attack as though it didn't have defender. S:Mode$ CanAttackDefender | ValidCard$ Card.Self | CheckSVar$ X | Description$ As long as you've cast an instant or sorcery spell this turn, CARDNAME can attack as though it didn't have defender.
SVar:X:Count$ThisTurnCast_Instant.YouOwn,Sorcery.YouOwn SVar:X:Count$ThisTurnCast_Instant.YouOwn,Sorcery.YouOwn
SVar:BuffedBy:Instant,Sorcery SVar:BuffedBy:Instant,Sorcery
DeckHints:Type$Instant|Sorcery DeckHints:Type$Instant|Sorcery