forked from github/server
lua erweiterung:
unit:cast_spell, um einen zauber zu wirken (vorerst nur testweise, syntac wird sich ändern)
This commit is contained in:
parent
d221ca4db7
commit
ca099ec5ae
1 changed files with 26 additions and 0 deletions
|
@ -192,6 +192,30 @@ unit_setrace(unit& u, const char * rcname)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
unit_castspell(unit& u, const char * name)
|
||||||
|
{
|
||||||
|
spell_list * slist = spells;
|
||||||
|
while (slist!=NULL) {
|
||||||
|
spell * sp = slist->data;
|
||||||
|
if (strcmp(name, sp->sname)==0) {
|
||||||
|
castorder * co = (castorder*)malloc(sizeof(castorder));
|
||||||
|
co->distance = 0;
|
||||||
|
co->familiar = NULL;
|
||||||
|
co->force = sp->level;
|
||||||
|
co->level = sp->level;
|
||||||
|
co->magician = &u;
|
||||||
|
co->order = NULL;
|
||||||
|
co->par = NULL;
|
||||||
|
co->rt = u.region;
|
||||||
|
co->sp = sp;
|
||||||
|
sp->sp_function(co);
|
||||||
|
free(co);
|
||||||
|
}
|
||||||
|
slist=slist->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
unit_addspell(unit& u, const char * name)
|
unit_addspell(unit& u, const char * name)
|
||||||
{
|
{
|
||||||
|
@ -556,6 +580,8 @@ bind_unit(lua_State * L)
|
||||||
.def("set_racename", &unit_setracename)
|
.def("set_racename", &unit_setracename)
|
||||||
.def("add_spell", &unit_addspell)
|
.def("add_spell", &unit_addspell)
|
||||||
.def("remove_spell", &unit_removespell)
|
.def("remove_spell", &unit_removespell)
|
||||||
|
.def("cast_spell", &unit_castspell)
|
||||||
|
|
||||||
.property("magic", &unit_getmagic, &unit_setmagic)
|
.property("magic", &unit_getmagic, &unit_setmagic)
|
||||||
.property("aura", &unit_getaura, &unit_setaura)
|
.property("aura", &unit_getaura, &unit_setaura)
|
||||||
.property("building", &unit_getbuilding, &unit_setbuilding)
|
.property("building", &unit_getbuilding, &unit_setbuilding)
|
||||||
|
|
Loading…
Reference in a new issue