mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
cleanup sound
This commit is contained in:
@@ -81,7 +81,7 @@ public class EventVisualizer implements IGameEventVisitor<Void, SoundEffectType>
|
|||||||
if (sa.isSpell()) {
|
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 (getSpecificCardEffect(source)) {
|
if (hasSpecificCardEffect(source)) {
|
||||||
return SoundEffectType.ScriptedEffect;
|
return SoundEffectType.ScriptedEffect;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,33 +130,18 @@ public class EventVisualizer implements IGameEventVisitor<Void, SoundEffectType>
|
|||||||
|
|
||||||
// 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 (getSpecificCardEffect(land)) {
|
if (hasSpecificCardEffect(land)) {
|
||||||
return SoundEffectType.ScriptedEffect;
|
return SoundEffectType.ScriptedEffect;
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<SpellAbility> manaProduced = land.getManaAbility();
|
for (SpellAbility sa : land.getManaAbility()) {
|
||||||
|
|
||||||
for (SpellAbility sa : manaProduced) {
|
|
||||||
|
|
||||||
// Find mana ability if it is somewhere in tail
|
|
||||||
|
|
||||||
String manaColors = sa.getManaPartRecursive().getOrigProduced();
|
String manaColors = sa.getManaPartRecursive().getOrigProduced();
|
||||||
|
|
||||||
if (manaColors.contains("B")) {
|
if (manaColors.contains("B")) return SoundEffectType.BlackLand;
|
||||||
return SoundEffectType.BlackLand;
|
if (manaColors.contains("U")) return SoundEffectType.BlueLand;
|
||||||
}
|
if (manaColors.contains("G")) return SoundEffectType.GreenLand;
|
||||||
if (manaColors.contains("U")) {
|
if (manaColors.contains("R")) return SoundEffectType.RedLand;
|
||||||
return SoundEffectType.BlueLand;
|
if (manaColors.contains("W")) return SoundEffectType.WhiteLand;
|
||||||
}
|
|
||||||
if (manaColors.contains("G")) {
|
|
||||||
return SoundEffectType.GreenLand;
|
|
||||||
}
|
|
||||||
if (manaColors.contains("R")) {
|
|
||||||
return SoundEffectType.RedLand;
|
|
||||||
}
|
|
||||||
if (manaColors.contains("W")) {
|
|
||||||
return SoundEffectType.WhiteLand;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// play a generic land sound if no other sound corresponded to it.
|
// play a generic land sound if no other sound corresponded to it.
|
||||||
@@ -169,7 +154,7 @@ public class EventVisualizer implements IGameEventVisitor<Void, SoundEffectType>
|
|||||||
* @param c the card to play the sound effect for.
|
* @param c the card to play the sound effect for.
|
||||||
* @return the sound effect type
|
* @return the sound effect type
|
||||||
*/
|
*/
|
||||||
private static boolean getSpecificCardEffect(final Card c) {
|
private static boolean hasSpecificCardEffect(final Card c) {
|
||||||
// Implement sound effects for specific cards here, if necessary.
|
// Implement sound effects for specific cards here, if necessary.
|
||||||
String effect = "";
|
String effect = "";
|
||||||
if (null != c) {
|
if (null != c) {
|
||||||
@@ -199,15 +184,6 @@ public class EventVisualizer implements IGameEventVisitor<Void, SoundEffectType>
|
|||||||
return c != null ? c.getSVar("SoundEffect") : "";
|
return c != null ? c.getSVar("SoundEffect") : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine if the event will potentially produce a lot of overlapping
|
|
||||||
* sounds, in which case only one of the must actually be played and the
|
|
||||||
* others must wait on it and only play when the first sound effect is done.
|
|
||||||
*/
|
|
||||||
public boolean isSyncSound(SoundEffectType effect) {
|
|
||||||
|
|
||||||
return effect.getIsSynced();
|
|
||||||
}
|
|
||||||
// These are not used by sound system
|
// These are not used by sound system
|
||||||
public SoundEffectType visit(GameEventGameRestarted event, Void params) { return null; }
|
public SoundEffectType visit(GameEventGameRestarted event, Void params) { return null; }
|
||||||
public SoundEffectType visit(GameEventDuelFinished event, Void params) { return null; }
|
public SoundEffectType visit(GameEventDuelFinished event, Void params) { return null; }
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ public class SoundSystem {
|
|||||||
play(resourceName);
|
play(resourceName);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
boolean isSync = visualizer.isSyncSound(effect);
|
boolean isSync = effect.getIsSynced();
|
||||||
if (isSync) {
|
if (isSync) {
|
||||||
playSync(effect);
|
playSync(effect);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user