bind regeneration (of health and aura) to Lua

This commit is contained in:
Enno Rehling 2012-06-17 22:31:30 -07:00
parent e579210fec
commit 64a91a75a1
9 changed files with 26 additions and 19 deletions

View File

@ -42,6 +42,7 @@ function test_process()
assert_equal("function", _G.type(eressea.process.enter))
assert_equal("function", _G.type(eressea.process.magic))
assert_equal("function", _G.type(eressea.process.give_control))
assert_equal("function", _G.type(eressea.process.regeneration))
end
function test_settings()

View File

@ -224,3 +224,8 @@ end
function test_process_give_control()
eressea.process.give_control()
end
function test_process_regeneration()
eressea.process.regeneration()
end

View File

@ -211,6 +211,11 @@ void process_give_control(void) {
process_cmd(K_CONTACT, give_control_cmd, 0);
}
void process_regeneration(void) {
monthly_healing();
regenerate_aura();
}
void process_enter(int final) {
region * r;
for (r=regions; r; r=r->next) {

View File

@ -34,6 +34,7 @@ void process_contact(void);
void process_enter(int final);
void process_magic(void);
void process_give_control(void);
void process_regeneration(void);
#ifdef __cplusplus
}

View File

@ -31,5 +31,6 @@ module eressea {
void process_enter @ enter(int message); /* ENTER */
void process_magic @ magic(void); /* CAST */
void process_give_control @ give_control(void); /* GIVE CONTROL */
void process_regeneration @ regeneration(void); /* regen health & aura */
}
}

View File

@ -1514,10 +1514,17 @@ void quit(void)
}
}
destroyfaction(f);
} else {
++f->age;
if (f->age + 1 < NewbieImmunity()) {
ADDMSG(&f->msgs, msg_message("newbieimmunity", "turns",
NewbieImmunity() - f->age - 1));
}
if (*fptr == f)
}
if (*fptr == f) {
fptr = &f->next;
}
}
remove_idle_players();
remove_empty_units();
}
@ -3773,7 +3780,7 @@ static double heal_factor(const unit * u)
}
}
static void monthly_healing(void)
void monthly_healing(void)
{
region *r;
static const curse_type *heal_ct = NULL;
@ -3979,19 +3986,6 @@ static void update_spells(void)
}
}
static void age_factions(void)
{
faction *f;
for (f = factions; f; f = f->next) {
++f->age;
if (f->age + 1 < NewbieImmunity()) {
ADDMSG(&f->msgs, msg_message("newbieimmunity", "turns",
NewbieImmunity() - f->age - 1));
}
}
}
int use_cmd(unit * u, struct order *ord)
{
const char *t;
@ -4489,7 +4483,6 @@ void init_processor(void)
}
p += 10;
add_proc_global(p, &age_factions, "Parteienalter++");
add_proc_order(p, K_MAIL, &mail_cmd, 0, "Botschaften");
add_proc_order(p, K_CONTACT, &contact_cmd, 0, "Kontaktieren");
@ -4580,7 +4573,7 @@ void init_processor(void)
p += 10;
add_proc_global(p, &monthly_healing, "Regeneration (HP)");
add_proc_global(p, &regeneration_magiepunkte, "Regeneration (Aura)");
add_proc_global(p, &regenerate_aura, "Regeneration (Aura)");
if (!global.disabled[K_DEFAULT]) {
add_proc_global(p, &defaultorders, "Defaults setzen");
}

View File

@ -51,6 +51,7 @@ extern "C" {
extern void new_units(void);
extern void quit(void);
extern void monthly_healing(void);
extern void renumber_factions(void);
extern void restack_units(void);
extern void update_long_order(struct unit *u);

View File

@ -1445,7 +1445,7 @@ static double regeneration(unit * u)
return aura;
}
void regeneration_magiepunkte(void)
void regenerate_aura(void)
{
region *r;
unit *u;

View File

@ -192,7 +192,7 @@ typedef struct sc_mage {
void magic(void);
void regeneration_magiepunkte(void);
void regenerate_aura(void);
extern struct attrib_type at_seenspell;
extern struct attrib_type at_mage;