- Sound System: Added to enumeration and implemented support for the AddCounter, Damage, Destroy, Discard, Equip, LifeLoss, ManaBurn, Regen, RemoveCounter, and Sacrifice sound effects. Also, some minor fixes.

This commit is contained in:
Agetian
2012-11-13 17:53:51 +00:00
parent ff1c28d1b5
commit f8227efad8
7 changed files with 73 additions and 12 deletions

View File

@@ -1257,6 +1257,9 @@ public class Card extends GameEntity implements Comparable<Card> {
Singletons.getModel().getGame().getTriggerHandler().runTrigger(TriggerType.CounterAdded, runParams); Singletons.getModel().getGame().getTriggerHandler().runTrigger(TriggerType.CounterAdded, runParams);
} }
// play the Add Counter sound
Sounds.AddCounter.play();
this.updateObservers(); this.updateObservers();
} }
@@ -1290,6 +1293,9 @@ public class Card extends GameEntity implements Comparable<Card> {
Singletons.getModel().getGame().getTriggerHandler().runTrigger(TriggerType.CounterAdded, runParams); Singletons.getModel().getGame().getTriggerHandler().runTrigger(TriggerType.CounterAdded, runParams);
} }
// play the Add Counter sound
Sounds.AddCounter.play();
this.updateObservers(); this.updateObservers();
} }
@@ -1360,6 +1366,10 @@ public class Card extends GameEntity implements Comparable<Card> {
} }
} }
} }
// play the Subtract Counter sound
Sounds.RemoveCounter.play();
this.updateObservers(); this.updateObservers();
} }
} }
@@ -3855,6 +3865,9 @@ public class Card extends GameEntity implements Comparable<Card> {
this.addEquipping(c); this.addEquipping(c);
c.addEquippedBy(this); c.addEquippedBy(this);
this.equip(); this.equip();
// Play the Equip sound
Sounds.Equip.play();
} }
/** /**

View File

@@ -1254,6 +1254,9 @@ public class GameAction {
if (c.getCounters(Counters.LOYALTY) <= 0) { if (c.getCounters(Counters.LOYALTY) <= 0) {
Singletons.getModel().getGame().getAction().moveToGraveyard(c); Singletons.getModel().getGame().getAction().moveToGraveyard(c);
// Play the Destroy sound
Sounds.Destroy.play();
} }
final ArrayList<String> types = c.getType(); final ArrayList<String> types = c.getType();
@@ -1298,6 +1301,9 @@ public class GameAction {
for (int i = 0; i < b.size(); i++) { for (int i = 0; i < b.size(); i++) {
Singletons.getModel().getGame().getAction().sacrificeDestroy(b.get(i)); Singletons.getModel().getGame().getAction().sacrificeDestroy(b.get(i));
} }
// Play the Destroy sound
Sounds.Destroy.play();
} }
} }
} // destroyLegendaryCreatures() } // destroyLegendaryCreatures()
@@ -1325,6 +1331,9 @@ public class GameAction {
} }
this.sacrificeDestroy(c); this.sacrificeDestroy(c);
// Play the Sacrifice sound
Sounds.Sacrifice.play();
// Run triggers // Run triggers
final HashMap<String, Object> runParams = new HashMap<String, Object>(); final HashMap<String, Object> runParams = new HashMap<String, Object>();
runParams.put("Card", c); runParams.put("Card", c);
@@ -1376,6 +1385,8 @@ public class GameAction {
GameAction.this.destroy(crd); GameAction.this.destroy(crd);
card.setDamage(0); card.setDamage(0);
// Play the Destroy sound
Sounds.Destroy.play();
} }
}; };
@@ -1388,6 +1399,9 @@ public class GameAction {
} }
} // totem armor } // totem armor
// Play the Destroy sound
Sounds.Destroy.play();
return this.sacrificeDestroy(c); return this.sacrificeDestroy(c);
} }
@@ -1533,6 +1547,10 @@ public class GameAction {
c.tap(); c.tap();
c.addRegeneratedThisTurn(); c.addRegeneratedThisTurn();
game.getCombat().removeFromCombat(c); game.getCombat().removeFromCombat(c);
// Play the Regeneration sound
Sounds.Regen.play();
return false; return false;
} }
@@ -1560,11 +1578,18 @@ public class GameAction {
c.setDamage(0); c.setDamage(0);
this.destroy(crd); this.destroy(crd);
// Play the Destroy sound
Sounds.Destroy.play();
System.out.println("Totem armor destroyed instead of original card"); System.out.println("Totem armor destroyed instead of original card");
return false; return false;
} }
} // totem armor } // totem armor
// Play the Destroy sound
Sounds.Destroy.play();
return this.sacrificeDestroy(c); return this.sacrificeDestroy(c);
} }

View File

@@ -55,6 +55,7 @@ import forge.game.player.Player;
import forge.game.zone.ZoneType; import forge.game.zone.ZoneType;
import forge.gui.GuiChoose; import forge.gui.GuiChoose;
import forge.gui.match.CMatchUI; import forge.gui.match.CMatchUI;
import forge.sound.Sounds;
import forge.util.MyRandom; import forge.util.MyRandom;
@@ -609,6 +610,9 @@ public final class GameActionUtil {
final boolean winFlip = flip == choice.equals("heads"); final boolean winFlip = flip == choice.equals("heads");
final String winMsg = winFlip ? " wins flip." : " loses flip."; final String winMsg = winFlip ? " wins flip." : " loses flip.";
// Play the Flip A Coin sound
Sounds.FlipCoin.play();
JOptionPane.showMessageDialog(null, source.getName() + " - " + caller + winMsg, source.getName(), JOptionPane.showMessageDialog(null, source.getName() + " - " + caller + winMsg, source.getName(),
JOptionPane.PLAIN_MESSAGE); JOptionPane.PLAIN_MESSAGE);
return winFlip; return winFlip;
@@ -689,6 +693,9 @@ public final class GameActionUtil {
Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability); Singletons.getModel().getGame().getStack().addSimultaneousStackEntry(ability);
} }
} }
// Play the Damage sound
Sounds.Damage.play();
} }
// this is for cards like Sengir Vampire // this is for cards like Sengir Vampire
@@ -852,6 +859,9 @@ public final class GameActionUtil {
} }
c.getDamageHistory().registerCombatDamage(player); c.getDamageHistory().registerCombatDamage(player);
// Play the Life Loss sound
Sounds.LifeLoss.play();
} // executeCombatDamageToPlayerEffects } // executeCombatDamageToPlayerEffects
/** /**

View File

@@ -424,6 +424,9 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable {
int burn = p.getManaPool().clearPool(true); int burn = p.getManaPool().clearPool(true);
if (Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_MANABURN)) { if (Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_MANABURN)) {
p.loseLife(burn); p.loseLife(burn);
// Play the Mana Burn sound
Sounds.ManaBurn.play();
} }
p.updateObservers(); p.updateObservers();
} }

View File

@@ -1597,8 +1597,14 @@ public abstract class Player extends GameEntity implements Comparable<Player> {
+ "counters on it instead of putting it into your graveyard.")) + "counters on it instead of putting it into your graveyard."))
&& (null != sa) && !c.getController().equals(sa.getSourceCard().getController())) { && (null != sa) && !c.getController().equals(sa.getSourceCard().getController())) {
game.getAction().discardPutIntoPlayInstead(c); game.getAction().discardPutIntoPlayInstead(c);
// Play the corresponding Put into Play sound
SoundUtils.playCardSoundEffect(c, sa);
} else { } else {
game.getAction().moveToGraveyard(c); game.getAction().moveToGraveyard(c);
// Play the Discard sound
Sounds.Discard.play();
} }
// Run triggers // Run triggers

View File

@@ -50,13 +50,13 @@ public final class SoundUtils {
return; return;
} }
if (sa.isSpell()) {
// if there's a specific effect for this particular card, play it and // if there's a specific effect for this particular card, play it and
// we're done. // we're done.
if (playSpecificCardEffect(source)) { if (playSpecificCardEffect(source)) {
return; return;
} }
if (sa.isSpell()) {
if (source.isCreature() && source.isArtifact()) { if (source.isCreature() && source.isArtifact()) {
Sounds.ArtifactCreature.play(); Sounds.ArtifactCreature.play();
} else if (source.isCreature()) { } else if (source.isCreature()) {

View File

@@ -36,28 +36,32 @@ import forge.properties.ForgePreferences.FPref;
public enum Sounds { public enum Sounds {
// Sounds must be listed in alphabetic order. // Sounds must be listed in alphabetic order.
AddCounter("res/sound/add_counter.wav"),
Artifact("res/sound/artifact.wav"), Artifact("res/sound/artifact.wav"),
ArtifactCreature("res/sound/artifact_creature.wav"), ArtifactCreature("res/sound/artifact_creature.wav"),
BlackLand("res/sound/black_land.wav"), BlackLand("res/sound/black_land.wav"),
BlueLand("res/sound/blue_land.wav"), BlueLand("res/sound/blue_land.wav"),
Counter("res/sound/counter.wav"), /* NOT IMPLEMENTED YET */
Creature("res/sound/creature.wav"), Creature("res/sound/creature.wav"),
Damage("res/sound/damage.wav"), /* NOT IMPLEMENTED YET */ Damage("res/sound/damage.wav"),
Discard("res/sound/discard.wav"), /* NOT IMPLEMENTED YET */ Destroy("res/sound/destroy.wav"),
Discard("res/sound/discard.wav"),
Draw("res/sound/draw.wav"), Draw("res/sound/draw.wav"),
Enchantment("res/sound/enchant.wav"), /* NOT IMPLEMENTED YET */ Enchantment("res/sound/enchant.wav"),
EndOfTurn("res/sound/end_of_turn.wav"), EndOfTurn("res/sound/end_of_turn.wav"),
Equip("res/sound/equip.wav"),
FlipCoin("res/sound/flip_coin.wav"), FlipCoin("res/sound/flip_coin.wav"),
GreenLand("res/sound/green_land.wav"), GreenLand("res/sound/green_land.wav"),
Instant("res/sound/instant.wav"), Instant("res/sound/instant.wav"),
LifeLoss("res/sound/life_loss.wav"), LifeLoss("res/sound/life_loss.wav"),
LoseDuel("res/sound/lose_duel.wav"), LoseDuel("res/sound/lose_duel.wav"),
ManaBurn("res/sound/mana_burn.wav"),
OtherLand("res/sound/other_land.wav"), OtherLand("res/sound/other_land.wav"),
Planeswalker("res/sound/planeswalker.wav"), Planeswalker("res/sound/planeswalker.wav"),
Poison("res/sound/poison.wav"), Poison("res/sound/poison.wav"),
RedLand("res/sound/red_land.wav"), RedLand("res/sound/red_land.wav"),
Regen("res/sound/regeneration.wav"), /* NOT IMPLEMENTED YET */ Regen("res/sound/regeneration.wav"),
Sacrifice("res/sound/sacrifice.wav"), /* NOT IMPLEMENTED YET */ RemoveCounter("res/sound/remove_counter.wav"),
Sacrifice("res/sound/sacrifice.wav"),
Sorcery("res/sound/sorcery.wav"), Sorcery("res/sound/sorcery.wav"),
Shuffle("res/sound/shuffle.wav"), Shuffle("res/sound/shuffle.wav"),
Tap("res/sound/tap.wav"), Tap("res/sound/tap.wav"),