1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
/**
* @file
* @brief Boolean feat-related functions lua library "feat".
**/
#include "AppHdr.h"
#include "clua.h"
#include "cluautil.h"
#include "l_libs.h"
#include "env.h"
#include "spl-damage.h"
#include "spl-cast.h"
#include "spl-util.h"
LUAFN(l_spells_mana_cost)
{
spell_type spell = spell_by_name(luaL_checkstring(ls, 1), false);
PLUARET(number, spell_mana(spell));
}
LUAFN(l_spells_range)
{
spell_type spell = spell_by_name(luaL_checkstring(ls, 1), false);
PLUARET(number, spell_range(spell, calc_spell_power(spell, true)));
}
LUAFN(l_spells_fail)
{
spell_type spell = spell_by_name(luaL_checkstring(ls, 1), false);
PLUARET(number, failure_rate_to_int(spell_fail(spell)));
}
static const struct luaL_reg spells_clib[] =
{
{ "mana_cost" , l_spells_mana_cost },
{ "range" , l_spells_range },
{ "fail" , l_spells_fail },
{ NULL, NULL }
};
void cluaopen_spells(lua_State *ls)
{
luaL_openlib(ls, "spells", spells_clib, 0);
}
LUAWRAP(_refrigeration,
cast_los_attack_spell(SPELL_OZOCUBUS_REFRIGERATION,
luaL_checkint(ls, 1), NULL, true))
LUAWRAP(_toxic_radiance,
cast_los_attack_spell(SPELL_OLGREBS_TOXIC_RADIANCE,
luaL_checkint(ls, 1), NULL, true))
const struct luaL_reg spells_dlib[] =
{
{ "refrigeration", _refrigeration },
{ "toxic_radiance", _toxic_radiance },
{ NULL, NULL }
};
|