From f02c4cbaeb3dfc11acab3292fa797af5a9d108ae Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 5 Oct 2019 20:59:55 +0200 Subject: [PATCH] disable magic resistant to prevent 2% intermittent test. --- scripts/tests/e2/spells.lua | 2 ++ src/magic.c | 8 ++++++++ src/spells.c | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/tests/e2/spells.lua b/scripts/tests/e2/spells.lua index 442e83d00..de2386113 100644 --- a/scripts/tests/e2/spells.lua +++ b/scripts/tests/e2/spells.lua @@ -9,6 +9,7 @@ function setup() eressea.settings.set("NewbieImmunity", "0") eressea.settings.set("rules.food.flags", "4") eressea.settings.set("rules.peasants.growth.factor", "0") + eressea.settings.set("magic.resist.enable", "0") eressea.settings.set("magic.fumble.enable", "0") eressea.settings.set("magic.regeneration.enable", "0") end @@ -258,5 +259,6 @@ function test_astral_disruption() u:add_spell("astral_disruption") u:add_order('ZAUBERE STUFE 1 "Stoere Astrale Integritaet"') process_orders() + assert_not_nil(r2:get_curse("astralblock")) assert_equal(r, uh.region) end diff --git a/src/magic.c b/src/magic.c index eed6cda90..5300101d3 100644 --- a/src/magic.c +++ b/src/magic.c @@ -1152,6 +1152,14 @@ target_resists_magic(unit * magician, void *obj, int objtyp, int t_bonus) { variant v02p, v98p, prob = frac_make(t_bonus, 100); attrib *a = NULL; + static bool never_resist; + static int config; + if (config_changed(&config)) { + never_resist = config_get_int("magic.resist.enable", 1) == 0; + } + if (never_resist) { + return false; + } if (magician == NULL || obj == NULL) { return true; diff --git a/src/spells.c b/src/spells.c index 81588ca4a..486a62b71 100644 --- a/src/spells.c +++ b/src/spells.c @@ -5546,7 +5546,7 @@ static void cb_disrupt_astral(region *r2, void *cbdata) { region *rtargets[MAX_SCHEMES]; region *r = co_get_region(co); unit *caster = co_get_caster(co); - int duration = (int)(co->force / 3) + 1; + int duration = (int)(co->force / 3) + 2; if (is_cursed(r2->attribs, &ct_astralblock)) { return;