testing spells is a lot easier when you can disable fumbles

all tun_tests tests pass
This commit is contained in:
Enno Rehling 2012-05-19 18:50:28 -07:00
parent 3fa4a31d14
commit bcd6991703
3 changed files with 8 additions and 1 deletions

View File

@ -4,6 +4,7 @@ module("tests.spells", package.seeall, lunit.testcase)
function setup()
free_game()
settings.set("magic.fumble.enable", "0")
end
function test_roi()

View File

@ -1119,7 +1119,7 @@ const item_type *finditemtype(const char *name, const struct locale *lang)
in->next = inames;
in->lang = lang;
do {
m = cb_find_prefix(&cb_items, "", 1, matches, CB_BATCHSIZE, offset);
m = cb_find_prefix(&cb_items, "", 0, matches, CB_BATCHSIZE, offset);
if (m) {
int i;
offset += m;
@ -1207,6 +1207,8 @@ void test_clear_resources(void)
r_hp = r_silver = r_aura = r_permaura = r_unit = 0;
i_silver = 0;
inames = 0; /* TODO: this is a terrible hack, the whole inames global state must die */
}
#endif

View File

@ -1314,7 +1314,11 @@ boolean fumble(region * r, unit * u, const spell * sp, int cast_grade)
int patzer = (int)(((double)x * 40.0) - 20.0);
struct building *b = inside_building(u);
const struct building_type *btype = b ? b->type : NULL;
int fumble_enabled = get_param_int(global.parameters, "magic.fumble.enable", 1);
if (!fumble_enabled) {
return false;
}
if (btype)
patzer -= btype->fumblebonus;
/* CHAOSPATZERCHANCE 10 : +10% Chance zu Patzern */