Gesang der Verwirrung bringt Buchhaltung durcheinander

This commit is contained in:
Steffen Mecke 2021-03-21 14:25:42 +01:00 committed by Enno Rehling
parent 19db01af67
commit a713779f34
2 changed files with 61 additions and 3 deletions

View File

@ -138,3 +138,61 @@ function test_appeasement_break_guard()
assert_equal(5, u2.status)
assert_equal(false, u2.guard)
end
local function create_cp_mage(f, r)
local u2 = unit.create(f, r, 1)
u2.race = 'human'
u2.magic = 'cerddor'
u2:set_skill('magic', 20)
u2.aura = 100
u2:add_spell('song_of_confusion')
u2:add_spell('frighten')
u2.status = 3
return u2
end
local function create_cp_front(f, r)
local u2 = unit.create(f, r, 1000)
u2:set_skill('melee', 20)
u2:set_skill('stamina', 3)
u2:add_item('axe', u2.number)
u2:add_item('plate', u2.number)
u2:add_item('shield', u2.number)
u2.hp = u2.hp_max * u2.number
return u2
end
function test_confusion_and_panic()
f = faction.create('demon', "confusion@eressea.de", "de")
f2 = faction.create('demon')
for y = 1, 10 do
local u1, u2, u3, u4, r
r = region.create(0, 2*y, 'plain')
u1 = create_cp_front(f, r)
u2 = create_cp_mage(f, r)
u3 = create_cp_mage(f, r)
u2:add_order('KAMPFZAUBER STUFE 10 "Gesang der Angst"')
u3:add_order('KAMPFZAUBER STUFE 10 "Gesang der Verwirrung"')
create_cp_mage(f, r)
local u4 = create_cp_front(f2, r)
create_cp_mage(f2, r)
create_cp_mage(f2, r)
create_cp_mage(f2, r)
for ux in r.units do
for uy in r.units do
if ux.faction ~= uy.faction then
ux:add_order("ATTACKIERE " .. itoa36(uy.id))
end
end
end
end
for i = 1,10 do
process_orders()
end
-- should not produce "select_enemies has a bug"
-- init_reports()
-- write_reports()
end

View File

@ -1425,7 +1425,7 @@ count_enemies(battle * b, const fighter * af, int minrow, int maxrow,
int sr = statusrow(af->status);
side *as = af->side;
if (b->alive == b->fast.alive && as == b->fast.side && sr == b->fast.status
/*if (b->alive == b->fast.alive && as == b->fast.side && sr == b->fast.status
&& minrow == b->fast.minrow && maxrow == b->fast.maxrow) {
if (b->fast.enemies[select] >= 0) {
return b->fast.enemies[select];
@ -1436,7 +1436,7 @@ count_enemies(battle * b, const fighter * af, int minrow, int maxrow,
}
}
}
else if (select != SELECT_FIND || b->alive != b->fast.alive) {
else*/ if (select != SELECT_FIND || b->alive != b->fast.alive) {
b->fast.side = as;
b->fast.status = sr;
b->fast.minrow = minrow;
@ -2437,7 +2437,7 @@ troop select_ally(fighter * af, int minrow, int maxrow, int allytype)
dt.fighter = df;
return dt;
}
allies -= df->alive;
allies -= (df->alive - df->removed);
}
}
}