Advertisement
Index154

enccode

Oct 8th, 2019
339
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. note = "options is a String of monster names and modifiers in this order:
  2. Common monsters
  3. Rare monsters
  4. Common modifiers
  5. Rare modifiers";
  6. note = "fight is a String fetched from a quote API cache";
  7.  
  8. upnext = "Split the source list into the individual categories";
  9. options = options.split("###################################");
  10. commonMons = options[0];
  11. rareMons = options[1];
  12. commonMods = options[2];
  13. rareMods = options[3];
  14.  
  15. upnext = "Generate two random numbers between 1 and 100 (inclusive) and set default values";
  16. roll1 = (Math.round(Math.random() * 99 + 1));
  17. roll2 = (Math.round(Math.random() * 99 + 1));
  18. rarity = "Common";
  19. rollcheck1 = 40;
  20. rollcheck2 = 35;
  21.  
  22. upnext = "Set the rarity check values based on the fight variable";
  23. if(fight == "1. yes"){
  24. rollcheck1 = 48;
  25. rollcheck2 = 40;
  26. }
  27.  
  28. upnext = "Check if the first roll is smaller than or equal to rollcheck1. If yes then use the pool for rare modifiers and set rarity to Uncommon (effectively a 40% chance)";
  29. if(roll1 <= rollcheck1){
  30. modifiers = rareMods;
  31. rarity = "Uncommon"
  32. }
  33. else{modifiers = commonMods}
  34.  
  35. upnext = "Check if the second roll is smaller than or equal to rollcheck2. If yes then use the pool for rare monsters and set rarity to Rare";
  36. if(roll2 <= rollcheck2){
  37. monsters = rareMons;
  38. rarity = "Rare"
  39. }
  40. else{monsters = commonMons}
  41.  
  42. upnext = "Check if both rolls resulted in the rare options. If yes then set rarity to Ultra rare";
  43. if(roll1 <= rollcheck1 && roll2 <= rollcheck2){rarity = "Ultra rare"}
  44.  
  45. upnext = "Split the selected modifier and monster pools up and turn them into arrays";
  46. modifiers = modifiers.split(";");
  47. monsters = monsters.split(";");
  48.  
  49. upnext = "Save output after randomly selecting two array fields";
  50. out = modifiers[Math.floor(Math.random() * (modifiers.length - 1))] + monsters[Math.floor(Math.random() * (monsters.length - 1))] + " (" + rarity + ")";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement