big steppy
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 

50 lines
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. "magic":
  24. [["Zap."],["Zap!"],["Fwoosh!"]]
  25. };
  26. function pickByMass(name, mass) {
  27. let list = sounds[name];
  28. let index = Math.floor(Math.log10(mass/100)/2);
  29. index = Math.max(index, 0);
  30. choice = index < list.length ? list[index] : list[list.length-1];
  31. let subindex = Math.floor(Math.random() * Math.floor(choice.length));
  32. // less likely to repeat
  33. if (last_used[name] != undefined && last_used[name] == subindex) {
  34. subindex = Math.floor(Math.random() * Math.floor(choice.length));
  35. }
  36. last_used[name] = subindex;
  37. return choice[subindex];
  38. }
  39. function getSound(name, mass) {
  40. return "<i>" + pickByMass(name,mass) + "</i>";
  41. }