forked from github/server
- prevent familiars from getting new spells - fix existing chaos
This commit is contained in:
parent
46cbe41af2
commit
e9a53fca3f
2 changed files with 41 additions and 0 deletions
|
@ -1,5 +1,13 @@
|
|||
require "multis"
|
||||
|
||||
function apply_fixes()
|
||||
local turn = get_turn()
|
||||
if config.game=="eressea" and turn>654 and turn<662 then
|
||||
print("Fixing familiars")
|
||||
fix_familiars()
|
||||
end
|
||||
end
|
||||
|
||||
function process(orders)
|
||||
local confirmed_multis = { }
|
||||
local suspected_multis = { }
|
||||
|
@ -8,6 +16,7 @@ function process(orders)
|
|||
print("could not read game")
|
||||
return -1
|
||||
end
|
||||
apply_fixes()
|
||||
init_summary()
|
||||
|
||||
-- kill multi-players (external script)
|
||||
|
|
|
@ -51,6 +51,37 @@ tolua_spawn_undead(lua_State * L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
fix_familiars(struct lua_State * L)
|
||||
{
|
||||
faction * f;
|
||||
for (f=factions;f;f=f->next) {
|
||||
unit * u;
|
||||
for (u=f->units;u;u=u->nextF) {
|
||||
struct sc_mage * mage = get_mage(u);
|
||||
if (mage && is_familiar(u)) {
|
||||
if (mage->spells && mage->magietyp==M_GRAY) {
|
||||
equipment * eq;
|
||||
char buffer[64];
|
||||
|
||||
while (mage->spells) {
|
||||
spell_list * slist = mage->spells;
|
||||
mage->spells = mage->spells->next;
|
||||
free(slist);
|
||||
}
|
||||
|
||||
snprintf(buffer, sizeof(buffer), "%s_familiar", u->race->_name[0]);
|
||||
eq = get_equipment(buffer);
|
||||
if (eq) {
|
||||
equip_unit_mask(u, eq, EQUIP_SPELLS);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
bind_eressea(struct lua_State * L)
|
||||
{
|
||||
|
@ -61,6 +92,7 @@ bind_eressea(struct lua_State * L)
|
|||
tolua_function(L, TOLUA_CAST "plan_monsters", tolua_planmonsters);
|
||||
tolua_function(L, TOLUA_CAST "spawn_undead", tolua_spawn_undead);
|
||||
tolua_function(L, TOLUA_CAST "spawn_dragons", tolua_spawn_dragons);
|
||||
tolua_function(L, TOLUA_CAST "fix_familiars", &fix_familiars);
|
||||
}
|
||||
tolua_endmodule(L);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue