BUG 2437: fetch_astral should have no aura cost when given bad units.

This commit is contained in:
Enno Rehling 2018-05-07 20:22:02 +02:00
parent 68de367a98
commit 6746401330
2 changed files with 31 additions and 1 deletions

View File

@ -19,6 +19,34 @@ local function dump_messages(f)
end
end
function test_fetch_astral()
local r = region.create(0, 0, "plain")
local f = faction.create("human")
local u1 = unit.create(f, r, 1)
local u2 = unit.create(f, r, 1)
u1.magic = "gray"
u1:set_skill("magic", 6)
u1.aura = 0
u1:add_spell("fetch_astral")
u1:clear_orders()
u1:add_order("ZAUBERE Ruf~der~Realitaet " .. itoa36(u2.id))
process_orders()
assert_equal(1, f:count_msg_type('missing_components_list'), 'no components')
u1.aura = 12 -- 2 Aura pro Stufe
process_orders()
assert_equal(12, u1.aura)
assert_equal(1, f:count_msg_type('spellfail_astralonly'), 'astral space')
u1.name = 'Xolgrim'
u1.aura = 12 -- 2 Aura pro Stufe
u2.region = u2.region:get_astral('fog')
process_orders()
assert_equal(0, u1.aura)
assert_equal(u1.region, u2.region)
end
function test_pull_astral()
local r = region.create(0, 0, "plain")
local f = faction.create("human")

View File

@ -5311,7 +5311,7 @@ int sp_fetchastral(castorder * co)
{
int n;
unit *mage = co->magician.u;
int cast_level = co->level;
int cast_level = 0;
spellparameter *pa = co->par;
double power = co->force;
int remaining_cap = (int)((power - 3) * 1500);
@ -5343,6 +5343,7 @@ int sp_fetchastral(castorder * co)
"spellfail_astralonly", ""));
continue;
}
if (rtl != NULL)
free_regionlist(rtl);
rtl = astralregions(u->region, NULL);
@ -5359,6 +5360,7 @@ int sp_fetchastral(castorder * co)
ro = u->region;
}
cast_level = co->level; /* at least one unit could have been teleported */
if (is_cursed(ro->attribs, &ct_astralblock)) {
ADDMSG(&mage->faction->msgs, msg_feedback(mage, co->order,
"spellfail_astralblock", ""));