53 return MAX(.01, .3 - (rp->
diff - 10 - skill->
level) * .03);
56 return .5 + .02 * (float)(skill->
level - rp->
diff);
58 return MIN(.95, .70 + (skill->
level - rp->
diff - 10) * .01);
71 FAIL_UNLESS(chance >= .00999,
"success can't be less than .01 but got %f for %d rp, %d skill", chance, rp.
diff, skill.
level);
72 FAIL_UNLESS(chance <= .95,
"success can't be more than .95 but got %f for %d rp, %d skill", chance, rp.
diff, skill.
level);
81 Suite *s = suite_create(
"alchemy");
82 TCase *tc_core = tcase_create(
"Core");
87 suite_add_tcase(s, tc_core);
88 tcase_add_test(tc_core, test_recipe_chance);
96 SRunner *sr = srunner_create(s);
98 srunner_set_xml(sr, LOGDIR
"/unit/server/alchemy.xml");
99 srunner_set_log(sr, LOGDIR
"/unit/server/alchemy.out");
100 srunner_run_all(sr, CK_ENV);
101 nf = srunner_ntests_failed(sr);
103 return (nf == 0) ? EXIT_SUCCESS : EXIT_FAILURE;