Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- note = "options is a String of monster names and modifiers in this order:
- Common monsters
- Rare monsters
- Common modifiers
- Rare modifiers";
- note = "fight is a String fetched from a quote API cache";
- upnext = "Split the source list into the individual categories";
- options = options.split("###################################");
- commonMons = options[0];
- rareMons = options[1];
- commonMods = options[2];
- rareMods = options[3];
- upnext = "Generate two random numbers between 1 and 100 (inclusive) and set default values";
- roll1 = (Math.round(Math.random() * 99 + 1));
- roll2 = (Math.round(Math.random() * 99 + 1));
- rarity = "Common";
- rollcheck1 = 40;
- rollcheck2 = 35;
- upnext = "Set the rarity check values based on the fight variable";
- if(fight == "1. yes"){
- rollcheck1 = 48;
- rollcheck2 = 40;
- }
- 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)";
- if(roll1 <= rollcheck1){
- modifiers = rareMods;
- rarity = "Uncommon"
- }
- else{modifiers = commonMods}
- 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";
- if(roll2 <= rollcheck2){
- monsters = rareMons;
- rarity = "Rare"
- }
- else{monsters = commonMons}
- upnext = "Check if both rolls resulted in the rare options. If yes then set rarity to Ultra rare";
- if(roll1 <= rollcheck1 && roll2 <= rollcheck2){rarity = "Ultra rare"}
- upnext = "Split the selected modifier and monster pools up and turn them into arrays";
- modifiers = modifiers.split(";");
- monsters = monsters.split(";");
- upnext = "Save output after randomly selecting two array fields";
- 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