From 5c1a2f7a430584923cf848360b07c6474e4f65de Mon Sep 17 00:00:00 2001 From: magenoxx Date: Fri, 3 Aug 2012 17:11:16 +0400 Subject: [PATCH] Madness fixes. Removed end_of_turn sound --- .../src/main/java/mage/client/game/GamePanel.java | 3 +-- Mage/src/mage/abilities/AbilityImpl.java | 1 + .../mage/abilities/keyword/MadnessAbility.java | 15 +++++++++++---- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Mage.Client/src/main/java/mage/client/game/GamePanel.java b/Mage.Client/src/main/java/mage/client/game/GamePanel.java index 1db5a0b7e2..b6e4060151 100644 --- a/Mage.Client/src/main/java/mage/client/game/GamePanel.java +++ b/Mage.Client/src/main/java/mage/client/game/GamePanel.java @@ -48,7 +48,6 @@ import mage.client.dialog.*; import mage.client.game.FeedbackPanel.FeedbackMode; import mage.client.plugins.adapters.MageActionCallback; import mage.client.plugins.impl.Plugins; -import mage.client.util.AudioManager; import mage.client.util.Config; import mage.client.util.GameManager; import mage.client.util.PhaseManager; @@ -408,7 +407,7 @@ public class GamePanel extends javax.swing.JPanel { this.txtPhase.setText(""); } if (game.getPhase() != null && game.getPhase().toString().equals("End") && game.getStep().toString().equals("End Turn")) { - AudioManager.playEndTurn(); + //AudioManager.playEndTurn(); } if (game.getStep() != null) diff --git a/Mage/src/mage/abilities/AbilityImpl.java b/Mage/src/mage/abilities/AbilityImpl.java index 0834f352e4..40632a1579 100644 --- a/Mage/src/mage/abilities/AbilityImpl.java +++ b/Mage/src/mage/abilities/AbilityImpl.java @@ -211,6 +211,7 @@ public abstract class AbilityImpl> implements Ability { return false; } } + //20100716 - 601.2g if (!costs.pay(this, game, sourceId, controllerId, noMana)) { logger.debug("activate failed - non mana costs"); diff --git a/Mage/src/mage/abilities/keyword/MadnessAbility.java b/Mage/src/mage/abilities/keyword/MadnessAbility.java index 7e67b220d9..ebb18e7ee8 100644 --- a/Mage/src/mage/abilities/keyword/MadnessAbility.java +++ b/Mage/src/mage/abilities/keyword/MadnessAbility.java @@ -8,6 +8,7 @@ import mage.abilities.StaticAbility; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.Cost; +import mage.abilities.costs.mana.ManaCost; import mage.abilities.effects.AsThoughEffectImpl; import mage.abilities.effects.OneShotEffect; import mage.cards.Card; @@ -105,13 +106,18 @@ class MadnessPlayEffect extends AsThoughEffectImpl { if (card != null && card.getOwnerId().equals(source.getControllerId()) && game.getState().getZone(source.getSourceId()) == Constants.Zone.EXILED) { Object object = game.getState().getValue("madness_" + card.getId()); if (object != null && object.equals(true)) { + Object alfreadyConfirmed = game.getState().getValue("madness_ok_" + card.getId()); + if (alfreadyConfirmed != null) { + return true; + } Player player = game.getPlayer(card.getOwnerId()); String message = "Cast " + card.getName() + " by its madness cost?"; if (player != null && player.chooseUse(Constants.Outcome.Benefit, message, game)) { - if (cost.pay(card.getSpellAbility(), game, sourceId, player.getId(), false)) { - card.getSpellAbility().getManaCostsToPay().clear(); - return true; - } + Cost costToPay = cost.copy(); + card.getSpellAbility().getManaCostsToPay().clear(); + card.getSpellAbility().getManaCostsToPay().add((ManaCost)costToPay); + game.getState().setValue("madness_ok_" + card.getId(), true); + return true; } } } @@ -232,6 +238,7 @@ class MadnessCleanUpWatcher extends WatcherImpl { game.informPlayers("Madness cost wasn't paied. " + card.getName() + " was put to its owner's graveyard."); // reset game.getState().setValue("madness_" + card.getId(), null); + game.getState().setValue("madness_ok_" + card.getId(), null); } card.moveToZone(Constants.Zone.GRAVEYARD, sourceId, game, true); }