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.
 
 
 

52 line
2.1 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. "drip":
  6. [["Drip."], ["Dribble"], ["Drip-sploosh"], ["Dribble-SPLOOSH!"], ["SPLOOOOOSH!!"]],
  7. "liquid": [["Sploosh."], ["Gush!"], ["SPLOOSH!"], ["SPLOOSH!"], ["SPLOOOOOOSH!"]],
  8. "insert": [["Slp.", "Shlk."], ["Shlp.", "Shlrp."], ["Shlllp."], ["SHLP!", "SQUELCH!"], ["SHLLLLRP!"]],
  9. "drop": [["Thump."], ["Thump!"], ["Splat."], ["Splat!"], ["SPLAT!"]],
  10. "belch": [["Burp.", "Urp."], ["Urph.", "Burph."], ["Urrrrrph."], ["UuuuuuuRRRRRPPHHHhhhh."], ["UUUURRRRPHH!"], ["BUUUURRRRRRRRPPPHHH!"]],
  11. "fart":
  12. [["Pft."], ["Pffft."], ["Pfffffbt."], ["Frrrrrrrt."], ["FRRRRRRRRPBBT!"]],
  13. "scat":
  14. [["Clench."], ["Squeeeeeze."], ["Squeeeeeeeeeeeze."], ["Sqlllllch."], ["SQLLLLLLCH!"]],
  15. "digest":
  16. [["Grrgle."], ["Grrrrgle"], ["Grrrrlglorp."], ["GrrrrGLRRRLPH!"], ["GRRRRRLGPRLHK!"]],
  17. "goo":
  18. [["Splat."], ["Squish."], ["Squish!"], ["SQLCH!"], ["SQLLLLRCH!"], ["SQQQQUEEEEELLCH!"]],
  19. "vomit":
  20. [["Hurk."], ["Hurrk."], ["Bleugh."], ["Bleugh!"], ["Bleeeugh!"], ["BLEEEUGHK!"]],
  21. "breath":
  22. [["Woosh."], ["Fwoosh."], ["FWOOSH."], ["FWOOSH!"], ["FWOOOOOOSH!"]],
  23. "chew":
  24. [["Snap.", "Crack."], ["Crunch."], ["Crack!"], ["CRUNCH!"], ["CRRRUNCH!"]],
  25. "magic":
  26. [["Zap."], ["Zap!"], ["Fwoosh!"]]
  27. };
  28. function pickByMass(name, mass) {
  29. let list = sounds[name];
  30. let index = Math.floor(Math.log10(mass / 100) / 2);
  31. index = Math.max(index, 0);
  32. choice = index < list.length ? list[index] : list[list.length - 1];
  33. let subindex = Math.floor(Math.random() * Math.floor(choice.length));
  34. // less likely to repeat
  35. if (last_used[name] != undefined && last_used[name] == subindex) {
  36. subindex = Math.floor(Math.random() * Math.floor(choice.length));
  37. }
  38. last_used[name] = subindex;
  39. return choice[subindex];
  40. }
  41. function getSound(name, mass) {
  42. return "<i>" + pickByMass(name, mass) + "</i>";
  43. }