big steppy
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

48 line
2.0 KiB

  1. let last_used = {};
  2. let sounds = {
  3. "crush": [["Thump.", "Thoomp."], ["Crunch."], ["Crrruunch."], ["CRUNCH!"], ["CRRRUNNCH!"], ["SKRRRRUNCH!"], ["SKRRRRRRRSMASH!"]],
  4. "swallow": [["Ulp.", "Glp.", "Slurp."], ["Glrph.", "Glurk."], ["Gluuuurrkph!", "Glurp - GLK."],["GLRP!", "GULP!", "GLUK!"],["GLRRRRPKH!", "GLUUUURK!"],["GLUUUUURRPKH!", "GLOOOORPH-GLK!"]],
  5. "liquid": [["Dribble."],["Splat."],["Splash."],["Sploosh."],["SPLASH!"],["SPLOOSH!"],["SPLOOOOOOSH!"]],
  6. "insert": [["Slp.", "Shlk."],["Shlp.", "Shlrp."],["Shlllp."],["SHLP!", "SQUELCH!"],["SHLLLLRP!"]],
  7. "drop": [["Thump."],["Thump!"],["Splat."],["Splat!"],["SPLAT!"]],
  8. "belch": [["Burp.", "Urp."],["Urph.", "Burph."],["Urrrrrph."],["UuuuuuuRRRRRPPHHHhhhh."],["UUUURRRRPHH!"],["BUUUURRRRRRRRPPPHHH!"]],
  9. "fart":
  10. [["Pft."],["Pffft."],["Pfffffbt."],["Frrrrrrrt."],["FRRRRRRRRPBBT!"]],
  11. "scat":
  12. [["Clench."],["Squeeeeeze."],["Squeeeeeeeeeeeze."],["Sqlllllch."],["SQLLLLLLCH!"]],
  13. "digest":
  14. [["Grrgle."],["Grrrrgle"],["Grrrrlglorp."],["GrrrrGLRRRLPH!"],["GRRRRRLGPRLHK!"]],
  15. "goo":
  16. [["Splat."], ["Squish."], ["Squish!"], ["SQLCH!"], ["SQLLLLRCH!"], ["SQQQQUEEEEELLCH!"]],
  17. "vomit":
  18. [["Hurk."], ["Hurrk."], ["Bleugh."], ["Bleugh!"], ["Bleeeugh!"], ["BLEEEUGHK!"]],
  19. "breath":
  20. [["Woosh."],["Fwoosh."],["FWOOSH."],["FWOOSH!"],["FWOOOOOOSH!"]],
  21. "chew":
  22. [["Snap.", "Crack."],["Crunch."],["Crack!"],["CRUNCH!"],["CRRRUNCH!"]]
  23. };
  24. function pickByMass(name, mass) {
  25. let list = sounds[name];
  26. let index = Math.floor(Math.log10(mass/100)/2);
  27. index = Math.max(index, 0);
  28. choice = index < list.length ? list[index] : list[list.length-1];
  29. let subindex = Math.floor(Math.random() * Math.floor(choice.length));
  30. // less likely to repeat
  31. if (last_used[name] != undefined && last_used[name] == subindex) {
  32. subindex = Math.floor(Math.random() * Math.floor(choice.length));
  33. }
  34. last_used[name] = subindex;
  35. return choice[subindex];
  36. }
  37. function getSound(name, mass) {
  38. return "<i>" + pickByMass(name,mass) + "</i>";
  39. }