|
1 | | -/// Randomized plant stat with a set amount of inaccuracy |
2 | | -#define RANDOMIZE_PLANT_STAT(plant_stat, inaccuracy) ((inaccuracy && plant_stat >= round(1 / inaccuracy, 1)) ? \ |
3 | | - ("[plant_stat + rand(inaccuracy)*plant_stat - inaccuracy]-[plant_stat + rand(inaccuracy)*plant_stat]") : plant_stat) |
4 | | - |
5 | 1 | // ******************************************************** |
6 | 2 | // Here's all the seeds (plants) that can be used in hydro |
7 | 3 | // ******************************************************** |
|
304 | 300 | if(get_gene(/datum/plant_gene/trait/plant_type/alien_properties)) |
305 | 301 | text += "- Plant type: [span_warning("UNKNOWN")] \n" |
306 | 302 | if(!check_skills || user.skill_check(SKILL_SCIENCE, EXP_HIGH)) |
307 | | - var/inaccuracy = check_skills ? (EXP_GENIUS - user.get_skill(SKILL_SCIENCE)) / (EXP_GENIUS * 4) : 0 |
| 303 | + var/inaccuracy = check_skills ? (EXP_GENIUS - user.get_skill(SKILL_SCIENCE)) / (EXP_GENIUS * 2) : 0 |
308 | 304 | if(potency != -1) |
309 | | - text += "- Potency: [RANDOMIZE_PLANT_STAT(potency, inaccuracy)]\n" |
| 305 | + text += "- Potency: [randomize_plant_stat(potency, inaccuracy * 100, 0)]\n" |
310 | 306 | if(yield != -1) |
311 | | - text += "- Yield: [RANDOMIZE_PLANT_STAT(yield, inaccuracy)]\n" |
312 | | - text += "- Maturation speed: [RANDOMIZE_PLANT_STAT(maturation, inaccuracy)]\n" |
| 307 | + text += "- Yield: [randomize_plant_stat(yield, inaccuracy * 10, 2)]\n" |
| 308 | + text += "- Maturation speed: [randomize_plant_stat(maturation, inaccuracy * 10, 4)]\n" |
313 | 309 | if(yield != -1) |
314 | | - text += "- Production speed: [RANDOMIZE_PLANT_STAT(production, inaccuracy)]\n" |
315 | | - text += "- Endurance: [RANDOMIZE_PLANT_STAT(endurance, inaccuracy)]\n" |
316 | | - text += "- Lifespan: [RANDOMIZE_PLANT_STAT(lifespan, inaccuracy)]\n" |
317 | | - text += "- Weed Growth Rate: [RANDOMIZE_PLANT_STAT(weed_rate, inaccuracy)]\n" |
318 | | - text += "- Weed Vulnerability: [RANDOMIZE_PLANT_STAT(weed_chance, inaccuracy)]\n" |
| 310 | + text += "- Production speed: [randomize_plant_stat(production, inaccuracy * 10, 6)]\n" |
| 311 | + text += "- Endurance: [randomize_plant_stat(endurance, inaccuracy * 100, 8)]\n" |
| 312 | + text += "- Lifespan: [randomize_plant_stat(lifespan, inaccuracy * 100, 10)]\n" |
| 313 | + text += "- Weed Growth Rate: [randomize_plant_stat(weed_rate, inaccuracy * 10, 12)]\n" |
| 314 | + text += "- Weed Vulnerability: [randomize_plant_stat(weed_chance, inaccuracy * 10, 14)]\n" |
319 | 315 | if(rarity) |
320 | 316 | text += "- Species Discovery Value: [rarity]\n" |
321 | 317 | if(!check_skills || user.skill_check(SKILL_SCIENCE, EXP_MID)) |
|
330 | 326 |
|
331 | 327 | return text |
332 | 328 |
|
| 329 | +/// Randomizes and displays a plant stat. |
| 330 | +/obj/item/seeds/proc/randomize_plant_stat(plant_stat, inaccuracy = 0, hash_offset = 0) |
| 331 | + if(!inaccuracy) |
| 332 | + return plant_stat |
| 333 | + hash_offset += 1 + (GLOB.round_id % 16) |
| 334 | + var/raw_hash = copytext(md5("[potency]/[yield]/[maturation]/[production]/[endurance]/[lifespan]/[weed_rate]/[weed_chance]/[inaccuracy]/[REF(src)]"), \ |
| 335 | + hash_offset, hash_offset + 2) |
| 336 | + var/random_offset = round(inaccuracy * hex2num(raw_hash) / 255) |
| 337 | + if(plant_stat + random_offset - inaccuracy < 0) // keep it in bounds |
| 338 | + random_offset += -(plant_stat + random_offset - inaccuracy) |
| 339 | + return "[plant_stat + random_offset - inaccuracy]-[plant_stat + random_offset + inaccuracy]" |
| 340 | + |
333 | 341 | /obj/item/seeds/proc/on_chem_reaction(datum/reagents/S) //in case seeds have some special interaction with special chems |
334 | 342 | return |
335 | 343 |
|
|
0 commit comments