forked from github/server
fixed bug #1879: CAST should not prevent FOLLOW UNIT
This commit is contained in:
parent
72579b0272
commit
b02f275582
|
@ -1171,3 +1171,21 @@ function test_bug_1875_use_own_first()
|
|||
assert_equal(99, u:get_potion("peasantblood")) -- unit uses one peasantblood effect
|
||||
assert_equal(99, u2:get_potion("peasantblood")) -- u2 uses its own effect before u's
|
||||
end
|
||||
|
||||
|
||||
function test_bug_1879_follow_unit()
|
||||
local r = region.create(0, 0, "plain")
|
||||
local r1 = region.create(1, 0, "plain")
|
||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
||||
local u1, u2 = two_units(r, f, f)
|
||||
u1:clear_orders()
|
||||
u1:set_skill("magic", 10)
|
||||
u1:add_order("ZAUBERE STUFE 1 Kleine Flüche")
|
||||
u1:add_order("FOLGEN EINHEIT " .. itoa36(u2.id))
|
||||
u2:clear_orders()
|
||||
u2:add_order("NACH o")
|
||||
process_orders()
|
||||
assert_equal(u1.region.id, r1.id)
|
||||
assert_equal(u2.region.id, r1.id)
|
||||
end
|
||||
|
||||
|
|
|
@ -3711,7 +3711,7 @@ void update_long_order(unit * u)
|
|||
case K_CAST:
|
||||
/* dient dazu, das neben Zaubern kein weiterer Befehl
|
||||
* ausgeführt werden kann, Zaubern ist ein kurzer Befehl */
|
||||
set_order(&u->thisorder, NULL);
|
||||
set_order(&u->thisorder, copy_order(ord));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -2743,13 +2743,15 @@ void magic(void)
|
|||
continue;
|
||||
}
|
||||
|
||||
for (ord = u->orders; ord; ord = ord->next) {
|
||||
if (get_keyword(ord) == K_CAST) {
|
||||
castorder *co = cast_cmd(u, ord);
|
||||
fset(u, UFL_LONGACTION | UFL_NOTMOVING);
|
||||
if (co) {
|
||||
const spell *sp = co->sp;
|
||||
add_castorder(&spellranks[sp->rank], co);
|
||||
if (u->thisorder != NULL) {
|
||||
for (ord = u->orders; ord; ord = ord->next) {
|
||||
if (get_keyword(ord) == K_CAST) {
|
||||
castorder *co = cast_cmd(u, ord);
|
||||
fset(u, UFL_LONGACTION | UFL_NOTMOVING);
|
||||
if (co) {
|
||||
const spell *sp = co->sp;
|
||||
add_castorder(&spellranks[sp->rank], co);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2697,12 +2697,13 @@ void follow_unit(unit * u)
|
|||
attrib *a2 = a_find(u2->attribs, &at_follow);
|
||||
if (a2 != NULL) {
|
||||
unit *u3 = a2->data.v;
|
||||
follow = (u3 && u2->region == u2->region);
|
||||
follow = (u3 && u2->region == u3->region);
|
||||
}
|
||||
}
|
||||
if (follow) {
|
||||
fset(u, UFL_FOLLOWING);
|
||||
fset(u2, UFL_FOLLOWED);
|
||||
/* FOLLOW unit on a (potentially) moving unit prevents long orders */
|
||||
set_order(&u->thisorder, NULL);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue