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();
final Map<AbilityKey, Object> repParams = AbilityKey.mapFromAffected(source);
repParams.put(AbilityKey.Mana, afterReplace);
repParams.put(AbilityKey.Player, player);
repParams.put(AbilityKey.AbilityMana, root);
repParams.put(AbilityKey.Activator, root == null ? null : root.getActivatingPlayer());
if (root != null && root.isManaAbility()) {
final Map<AbilityKey, Object> repParams = AbilityKey.mapFromAffected(source);
repParams.put(AbilityKey.Mana, afterReplace);
repParams.put(AbilityKey.Player, player);
repParams.put(AbilityKey.AbilityMana, root);
repParams.put(AbilityKey.Activator, root.getActivatingPlayer());
switch (player.getGame().getReplacementHandler().run(ReplacementType.ProduceMana, repParams)) {
case NotReplaced:
break;
case Updated:
afterReplace = (String) repParams.get(AbilityKey.Mana);
break;
default:
return;
switch (player.getGame().getReplacementHandler().run(ReplacementType.ProduceMana, repParams)) {
case NotReplaced:
break;
case Updated:
afterReplace = (String) repParams.get(AbilityKey.Mana);
break;
default:
return;
}
}
//clear lastProduced
@@ -172,7 +174,7 @@ public class AbilityManaPart implements java.io.Serializable {
runParams.put(AbilityKey.Activator, root == null ? null : root.getActivatingPlayer());
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);
}
} // end produceMana(String)

View File

@@ -57,10 +57,11 @@ public class TriggerTapsForMana extends Trigger {
* @param runParams*/
@Override
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")) {
final SpellAbility manaAbility = (SpellAbility) runParams.get(AbilityKey.AbilityMana);
if (manaAbility == null || !manaAbility.getRootAbility().getPayCosts().hasTapCost()) {
if (manaAbility == null || !manaAbility.isManaAbility() || !manaAbility.getPayCosts().hasTapCost()) {
return false;
}
}

View File

@@ -3,7 +3,7 @@ ManaCost:3
Types:Artifact Creature Golem
PT:3/3
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
DeckHints:Type$Enchantment
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
PT:4/3
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:BuffedBy:Instant,Sorcery
DeckHints:Type$Instant|Sorcery