forked from github/server
indentation rules, slightly updated
This commit is contained in:
parent
347a888b67
commit
d940f29a6c
6
Makefile
6
Makefile
|
@ -1,11 +1,9 @@
|
||||||
PROJECT = eressea
|
all: bin/eressea
|
||||||
|
|
||||||
all: bin/$(PROJECT)
|
|
||||||
|
|
||||||
bin:
|
bin:
|
||||||
mkdir bin
|
mkdir bin
|
||||||
|
|
||||||
bin/$(PROJECT): bin/Makefile
|
bin/eressea: bin/Makefile
|
||||||
cd bin ; make
|
cd bin ; make
|
||||||
|
|
||||||
bin/Makefile: bin
|
bin/Makefile: bin
|
||||||
|
|
|
@ -13,31 +13,21 @@
|
||||||
static int tolua_levitate_ship(lua_State * L)
|
static int tolua_levitate_ship(lua_State * L)
|
||||||
{
|
{
|
||||||
ship *sh = (ship *) tolua_tousertype(L, 1, 0);
|
ship *sh = (ship *) tolua_tousertype(L, 1, 0);
|
||||||
|
|
||||||
unit *mage = (unit *) tolua_tousertype(L, 2, 0);
|
unit *mage = (unit *) tolua_tousertype(L, 2, 0);
|
||||||
|
|
||||||
double power = (double)tolua_tonumber(L, 3, 0);
|
double power = (double)tolua_tonumber(L, 3, 0);
|
||||||
|
|
||||||
int duration = (int)tolua_tonumber(L, 4, 0);
|
int duration = (int)tolua_tonumber(L, 4, 0);
|
||||||
|
|
||||||
int cno = levitate_ship(sh, mage, power, duration);
|
int cno = levitate_ship(sh, mage, power, duration);
|
||||||
|
|
||||||
tolua_pushnumber(L, (lua_Number) cno);
|
tolua_pushnumber(L, (lua_Number) cno);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern void spawn_undead(void);
|
extern void spawn_undead(void);
|
||||||
|
|
||||||
extern void spawn_dragons(void);
|
extern void spawn_dragons(void);
|
||||||
|
|
||||||
extern void plan_monsters(struct faction *f);
|
extern void plan_monsters(struct faction *f);
|
||||||
|
|
||||||
|
|
||||||
static int tolua_planmonsters(lua_State * L)
|
static int tolua_planmonsters(lua_State * L)
|
||||||
{
|
{
|
||||||
faction *f = (faction *) tolua_tousertype(L, 1, get_monsters());
|
faction *f = (faction *) tolua_tousertype(L, 1, get_monsters());
|
||||||
|
|
||||||
if (f) {
|
if (f) {
|
||||||
plan_monsters(f);
|
plan_monsters(f);
|
||||||
}
|
}
|
||||||
|
@ -60,17 +50,13 @@ static int tolua_spawn_undead(lua_State * L)
|
||||||
static int fix_familiars(struct lua_State *L)
|
static int fix_familiars(struct lua_State *L)
|
||||||
{
|
{
|
||||||
faction *f;
|
faction *f;
|
||||||
|
|
||||||
for (f = factions; f; f = f->next) {
|
for (f = factions; f; f = f->next) {
|
||||||
unit *u;
|
unit *u;
|
||||||
|
|
||||||
for (u = f->units; u; u = u->nextF) {
|
for (u = f->units; u; u = u->nextF) {
|
||||||
struct sc_mage *mage = get_mage(u);
|
struct sc_mage *mage = get_mage(u);
|
||||||
|
|
||||||
if (mage && is_familiar(u)) {
|
if (mage && is_familiar(u)) {
|
||||||
if (mage->spells && mage->magietyp == M_GRAY) {
|
if (mage->spells && mage->magietyp == M_GRAY) {
|
||||||
equipment *eq;
|
equipment *eq;
|
||||||
|
|
||||||
char buffer[64];
|
char buffer[64];
|
||||||
|
|
||||||
ql_free(mage->spells);
|
ql_free(mage->spells);
|
||||||
|
|
26
src/curses.c
26
src/curses.c
|
@ -36,7 +36,6 @@ typedef struct wallcurse {
|
||||||
void cw_init(attrib * a)
|
void cw_init(attrib * a)
|
||||||
{
|
{
|
||||||
curse *c;
|
curse *c;
|
||||||
|
|
||||||
curse_init(a);
|
curse_init(a);
|
||||||
c = (curse *) a->data.v;
|
c = (curse *) a->data.v;
|
||||||
c->data.v = calloc(sizeof(wallcurse), 1);
|
c->data.v = calloc(sizeof(wallcurse), 1);
|
||||||
|
@ -45,7 +44,6 @@ void cw_init(attrib * a)
|
||||||
void cw_write(const attrib * a, const void *target, storage * store)
|
void cw_write(const attrib * a, const void *target, storage * store)
|
||||||
{
|
{
|
||||||
connection *b = ((wallcurse *) ((curse *) a->data.v)->data.v)->wall;
|
connection *b = ((wallcurse *) ((curse *) a->data.v)->data.v)->wall;
|
||||||
|
|
||||||
curse_write(a, target, store);
|
curse_write(a, target, store);
|
||||||
store->w_int(store, b->id);
|
store->w_int(store, b->id);
|
||||||
}
|
}
|
||||||
|
@ -60,11 +58,8 @@ static int resolve_buddy(variant data, void *addr);
|
||||||
static int cw_read(attrib * a, void *target, storage * store)
|
static int cw_read(attrib * a, void *target, storage * store)
|
||||||
{
|
{
|
||||||
bresolve *br = calloc(sizeof(bresolve), 1);
|
bresolve *br = calloc(sizeof(bresolve), 1);
|
||||||
|
|
||||||
curse *c = (curse *) a->data.v;
|
curse *c = (curse *) a->data.v;
|
||||||
|
|
||||||
wallcurse *wc = (wallcurse *) c->data.v;
|
wallcurse *wc = (wallcurse *) c->data.v;
|
||||||
|
|
||||||
variant var;
|
variant var;
|
||||||
|
|
||||||
curse_read(a, store, target);
|
curse_read(a, store, target);
|
||||||
|
@ -89,11 +84,9 @@ attrib_type at_cursewall = {
|
||||||
ATF_CURSE
|
ATF_CURSE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static int resolve_buddy(variant data, void *addr)
|
static int resolve_buddy(variant data, void *addr)
|
||||||
{
|
{
|
||||||
curse *result = NULL;
|
curse *result = NULL;
|
||||||
|
|
||||||
bresolve *br = (bresolve *) data.v;
|
bresolve *br = (bresolve *) data.v;
|
||||||
|
|
||||||
if (br->id >= 0) {
|
if (br->id >= 0) {
|
||||||
|
@ -101,12 +94,9 @@ static int resolve_buddy(variant data, void *addr)
|
||||||
|
|
||||||
if (b && b->from && b->to) {
|
if (b && b->from && b->to) {
|
||||||
attrib *a = a_find(b->from->attribs, &at_cursewall);
|
attrib *a = a_find(b->from->attribs, &at_cursewall);
|
||||||
|
|
||||||
while (a && a->data.v != br->self) {
|
while (a && a->data.v != br->self) {
|
||||||
curse *c = (curse *) a->data.v;
|
curse *c = (curse *) a->data.v;
|
||||||
|
|
||||||
wallcurse *wc = (wallcurse *) c->data.v;
|
wallcurse *wc = (wallcurse *) c->data.v;
|
||||||
|
|
||||||
if (wc->wall->id == br->id)
|
if (wc->wall->id == br->id)
|
||||||
break;
|
break;
|
||||||
a = a->next;
|
a = a->next;
|
||||||
|
@ -115,9 +105,7 @@ static int resolve_buddy(variant data, void *addr)
|
||||||
a = a_find(b->to->attribs, &at_cursewall);
|
a = a_find(b->to->attribs, &at_cursewall);
|
||||||
while (a && a->type == &at_cursewall && a->data.v != br->self) {
|
while (a && a->type == &at_cursewall && a->data.v != br->self) {
|
||||||
curse *c = (curse *) a->data.v;
|
curse *c = (curse *) a->data.v;
|
||||||
|
|
||||||
wallcurse *wc = (wallcurse *) c->data.v;
|
wallcurse *wc = (wallcurse *) c->data.v;
|
||||||
|
|
||||||
if (wc->wall->id == br->id)
|
if (wc->wall->id == br->id)
|
||||||
break;
|
break;
|
||||||
a = a->next;
|
a = a->next;
|
||||||
|
@ -125,7 +113,6 @@ static int resolve_buddy(variant data, void *addr)
|
||||||
}
|
}
|
||||||
if (a && a->type == &at_cursewall) {
|
if (a && a->type == &at_cursewall) {
|
||||||
curse *c = (curse *) a->data.v;
|
curse *c = (curse *) a->data.v;
|
||||||
|
|
||||||
free(br);
|
free(br);
|
||||||
result = c;
|
result = c;
|
||||||
}
|
}
|
||||||
|
@ -143,7 +130,6 @@ static int resolve_buddy(variant data, void *addr)
|
||||||
static void wall_init(connection * b)
|
static void wall_init(connection * b)
|
||||||
{
|
{
|
||||||
wall_data *fd = (wall_data *) calloc(sizeof(wall_data), 1);
|
wall_data *fd = (wall_data *) calloc(sizeof(wall_data), 1);
|
||||||
|
|
||||||
fd->countdown = -1; /* infinite */
|
fd->countdown = -1; /* infinite */
|
||||||
b->data.v = fd;
|
b->data.v = fd;
|
||||||
}
|
}
|
||||||
|
@ -156,9 +142,7 @@ static void wall_destroy(connection * b)
|
||||||
static void wall_read(connection * b, storage * store)
|
static void wall_read(connection * b, storage * store)
|
||||||
{
|
{
|
||||||
wall_data *fd = (wall_data *) b->data.v;
|
wall_data *fd = (wall_data *) b->data.v;
|
||||||
|
|
||||||
variant mno;
|
variant mno;
|
||||||
|
|
||||||
assert(fd);
|
assert(fd);
|
||||||
if (store->version < STORAGE_VERSION) {
|
if (store->version < STORAGE_VERSION) {
|
||||||
mno.i = store->r_int(store);
|
mno.i = store->r_int(store);
|
||||||
|
@ -179,7 +163,6 @@ static void wall_read(connection * b, storage * store)
|
||||||
static void wall_write(const connection * b, storage * store)
|
static void wall_write(const connection * b, storage * store)
|
||||||
{
|
{
|
||||||
wall_data *fd = (wall_data *) b->data.v;
|
wall_data *fd = (wall_data *) b->data.v;
|
||||||
|
|
||||||
write_unit_reference(fd->mage, store);
|
write_unit_reference(fd->mage, store);
|
||||||
store->w_int(store, fd->force);
|
store->w_int(store, fd->force);
|
||||||
store->w_int(store, fd->countdown);
|
store->w_int(store, fd->countdown);
|
||||||
|
@ -188,7 +171,6 @@ static void wall_write(const connection * b, storage * store)
|
||||||
static int wall_age(connection * b)
|
static int wall_age(connection * b)
|
||||||
{
|
{
|
||||||
wall_data *fd = (wall_data *) b->data.v;
|
wall_data *fd = (wall_data *) b->data.v;
|
||||||
|
|
||||||
--fd->countdown;
|
--fd->countdown;
|
||||||
return (fd->countdown > 0) ? AT_AGE_KEEP : AT_AGE_REMOVE;
|
return (fd->countdown > 0) ? AT_AGE_KEEP : AT_AGE_REMOVE;
|
||||||
}
|
}
|
||||||
|
@ -197,10 +179,8 @@ static region *wall_move(const connection * b, struct unit *u,
|
||||||
struct region *from, struct region *to, boolean routing)
|
struct region *from, struct region *to, boolean routing)
|
||||||
{
|
{
|
||||||
wall_data *fd = (wall_data *) b->data.v;
|
wall_data *fd = (wall_data *) b->data.v;
|
||||||
|
|
||||||
if (!routing && fd->active) {
|
if (!routing && fd->active) {
|
||||||
int hp = dice(3, fd->force) * u->number;
|
int hp = dice(3, fd->force) * u->number;
|
||||||
|
|
||||||
hp = MIN(u->hp, hp);
|
hp = MIN(u->hp, hp);
|
||||||
u->hp -= hp;
|
u->hp -= hp;
|
||||||
if (u->hp) {
|
if (u->hp) {
|
||||||
|
@ -221,7 +201,6 @@ static const char *b_namefirewall(const connection * b, const region * r,
|
||||||
const faction * f, int gflags)
|
const faction * f, int gflags)
|
||||||
{
|
{
|
||||||
const char *bname;
|
const char *bname;
|
||||||
|
|
||||||
unused(f);
|
unused(f);
|
||||||
unused(r);
|
unused(r);
|
||||||
unused(b);
|
unused(b);
|
||||||
|
@ -257,7 +236,6 @@ void convert_firewall_timeouts(connection * b, attrib * a)
|
||||||
while (a) {
|
while (a) {
|
||||||
if (b->type == &bt_firewall && a->type == &at_countdown) {
|
if (b->type == &bt_firewall && a->type == &at_countdown) {
|
||||||
wall_data *fd = (wall_data *) b->data.v;
|
wall_data *fd = (wall_data *) b->data.v;
|
||||||
|
|
||||||
fd->countdown = a->data.i;
|
fd->countdown = a->data.i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -267,7 +245,6 @@ static const char *wisps_name(const connection * b, const region * r,
|
||||||
const faction * f, int gflags)
|
const faction * f, int gflags)
|
||||||
{
|
{
|
||||||
const char *bname;
|
const char *bname;
|
||||||
|
|
||||||
unused(f);
|
unused(f);
|
||||||
unused(r);
|
unused(r);
|
||||||
unused(b);
|
unused(b);
|
||||||
|
@ -290,9 +267,7 @@ static region *wisps_move(const connection * b, struct unit *u,
|
||||||
struct region *from, struct region *next, boolean routing)
|
struct region *from, struct region *next, boolean routing)
|
||||||
{
|
{
|
||||||
direction_t reldir = reldirection(from, next);
|
direction_t reldir = reldirection(from, next);
|
||||||
|
|
||||||
wisps_data *wd = (wisps_data *) b->data.v;
|
wisps_data *wd = (wisps_data *) b->data.v;
|
||||||
|
|
||||||
assert(reldir != D_SPECIAL);
|
assert(reldir != D_SPECIAL);
|
||||||
|
|
||||||
if (routing && wd->wall.active) {
|
if (routing && wd->wall.active) {
|
||||||
|
@ -300,7 +275,6 @@ static region *wisps_move(const connection * b, struct unit *u,
|
||||||
rconnect(from,
|
rconnect(from,
|
||||||
(direction_t) ((reldir + MAXDIRECTIONS - 1) % MAXDIRECTIONS));
|
(direction_t) ((reldir + MAXDIRECTIONS - 1) % MAXDIRECTIONS));
|
||||||
region *rr = rconnect(from, (direction_t) ((reldir + 1) % MAXDIRECTIONS));
|
region *rr = rconnect(from, (direction_t) ((reldir + 1) % MAXDIRECTIONS));
|
||||||
|
|
||||||
/* pick left and right region: */
|
/* pick left and right region: */
|
||||||
if (wd->rnd < 0) {
|
if (wd->rnd < 0) {
|
||||||
wd->rnd = rng_int() % 3;
|
wd->rnd = rng_int() % 3;
|
||||||
|
|
|
@ -20,7 +20,6 @@ extern "C" {
|
||||||
int countdown;
|
int countdown;
|
||||||
} wall_data;
|
} wall_data;
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
22
src/main.c
22
src/main.c
|
@ -15,17 +15,13 @@
|
||||||
#include <tests.h>
|
#include <tests.h>
|
||||||
|
|
||||||
static const char *luafile = "setup.lua";
|
static const char *luafile = "setup.lua";
|
||||||
|
|
||||||
static const char *entry_point = NULL;
|
static const char *entry_point = NULL;
|
||||||
|
|
||||||
static const char *inifile = "eressea.ini";
|
static const char *inifile = "eressea.ini";
|
||||||
|
|
||||||
static int memdebug = 0;
|
static int memdebug = 0;
|
||||||
|
|
||||||
static void parse_config(const char *filename)
|
static void parse_config(const char *filename)
|
||||||
{
|
{
|
||||||
dictionary *d = iniparser_new(filename);
|
dictionary *d = iniparser_new(filename);
|
||||||
|
|
||||||
if (d) {
|
if (d) {
|
||||||
load_inifile(d);
|
load_inifile(d);
|
||||||
|
|
||||||
|
@ -60,7 +56,6 @@ static int usage(const char *prog, const char *arg)
|
||||||
static int parse_args(int argc, char **argv, int *exitcode)
|
static int parse_args(int argc, char **argv, int *exitcode)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
int run_tests = 0;
|
int run_tests = 0;
|
||||||
|
|
||||||
for (i = 1; i != argc; ++i) {
|
for (i = 1; i != argc; ++i) {
|
||||||
|
@ -125,9 +120,7 @@ static int parse_args(int argc, char **argv, int *exitcode)
|
||||||
static void report_segfault(int signo, siginfo_t * sinf, void *arg)
|
static void report_segfault(int signo, siginfo_t * sinf, void *arg)
|
||||||
{
|
{
|
||||||
void *btrace[50];
|
void *btrace[50];
|
||||||
|
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|
||||||
int fd = fileno(stderr);
|
int fd = fileno(stderr);
|
||||||
|
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
@ -160,7 +153,6 @@ void init_crtdbg(void)
|
||||||
{
|
{
|
||||||
#if (defined(_MSC_VER))
|
#if (defined(_MSC_VER))
|
||||||
int flags = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
|
int flags = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
|
||||||
|
|
||||||
if (memdebug == 1) {
|
if (memdebug == 1) {
|
||||||
flags |= _CRTDBG_CHECK_ALWAYS_DF; /* expensive */
|
flags |= _CRTDBG_CHECK_ALWAYS_DF; /* expensive */
|
||||||
} else if (memdebug == 2) {
|
} else if (memdebug == 2) {
|
||||||
|
@ -175,24 +167,17 @@ void init_crtdbg(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static void dump_spells(void)
|
static void dump_spells(void)
|
||||||
{
|
{
|
||||||
struct locale *loc = find_locale("de");
|
struct locale *loc = find_locale("de");
|
||||||
|
|
||||||
FILE *F = fopen("spells.csv", "w");
|
FILE *F = fopen("spells.csv", "w");
|
||||||
|
|
||||||
quicklist *ql;
|
quicklist *ql;
|
||||||
|
|
||||||
int qi;
|
int qi;
|
||||||
|
|
||||||
for (ql = spells, qi = 0; ql; ql_advance(&ql, &qi, 1)) {
|
for (ql = spells, qi = 0; ql; ql_advance(&ql, &qi, 1)) {
|
||||||
spell *sp = (spell *) ql_get(ql, qi);
|
spell *sp = (spell *) ql_get(ql, qi);
|
||||||
|
|
||||||
spell_component *spc = sp->components;
|
spell_component *spc = sp->components;
|
||||||
|
|
||||||
char components[128];
|
char components[128];
|
||||||
|
|
||||||
components[0] = 0;
|
components[0] = 0;
|
||||||
for (; spc->type; ++spc) {
|
for (; spc->type; ++spc) {
|
||||||
strcat(components, LOC(loc, spc->type->_name[0]));
|
strcat(components, LOC(loc, spc->type->_name[0]));
|
||||||
|
@ -207,13 +192,9 @@ static void dump_spells(void)
|
||||||
static void dump_skills(void)
|
static void dump_skills(void)
|
||||||
{
|
{
|
||||||
struct locale *loc = find_locale("de");
|
struct locale *loc = find_locale("de");
|
||||||
|
|
||||||
FILE *F = fopen("skills.csv", "w");
|
FILE *F = fopen("skills.csv", "w");
|
||||||
|
|
||||||
race *rc;
|
race *rc;
|
||||||
|
|
||||||
skill_t sk;
|
skill_t sk;
|
||||||
|
|
||||||
fputs("\"Rasse\",", F);
|
fputs("\"Rasse\",", F);
|
||||||
for (rc = races; rc; rc = rc->next) {
|
for (rc = races; rc; rc = rc->next) {
|
||||||
if (playerrace(rc)) {
|
if (playerrace(rc)) {
|
||||||
|
@ -224,7 +205,6 @@ static void dump_skills(void)
|
||||||
|
|
||||||
for (sk = 0; sk != MAXSKILLS; ++sk) {
|
for (sk = 0; sk != MAXSKILLS; ++sk) {
|
||||||
const char *str = skillname(sk, loc);
|
const char *str = skillname(sk, loc);
|
||||||
|
|
||||||
if (str) {
|
if (str) {
|
||||||
fprintf(F, "\"%s\",", str);
|
fprintf(F, "\"%s\",", str);
|
||||||
for (rc = races; rc; rc = rc->next) {
|
for (rc = races; rc; rc = rc->next) {
|
||||||
|
@ -257,7 +237,6 @@ extern void bind_eressea(struct lua_State *L);
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
static int write_csv = 0;
|
static int write_csv = 0;
|
||||||
|
|
||||||
int err, result = 0;
|
int err, result = 0;
|
||||||
|
|
||||||
setup_signal_handler();
|
setup_signal_handler();
|
||||||
|
@ -304,6 +283,5 @@ int main(int argc, char **argv)
|
||||||
log_close();
|
log_close();
|
||||||
if (global.inifile)
|
if (global.inifile)
|
||||||
iniparser_free(global.inifile);
|
iniparser_free(global.inifile);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,9 +75,7 @@
|
||||||
static void reduce_weight(unit * u)
|
static void reduce_weight(unit * u)
|
||||||
{
|
{
|
||||||
int capacity, weight = 0;
|
int capacity, weight = 0;
|
||||||
|
|
||||||
item **itmp = &u->items;
|
item **itmp = &u->items;
|
||||||
|
|
||||||
int horses = get_resource(u, oldresourcetype[R_HORSE]);
|
int horses = get_resource(u, oldresourcetype[R_HORSE]);
|
||||||
|
|
||||||
if (horses > 0) {
|
if (horses > 0) {
|
||||||
|
@ -88,9 +86,7 @@ static void reduce_weight(unit * u)
|
||||||
/* 0. ditch any vehicles */
|
/* 0. ditch any vehicles */
|
||||||
while (*itmp != NULL) {
|
while (*itmp != NULL) {
|
||||||
item *itm = *itmp;
|
item *itm = *itmp;
|
||||||
|
|
||||||
const item_type *itype = itm->type;
|
const item_type *itype = itm->type;
|
||||||
|
|
||||||
weight += itm->number * itype->weight;
|
weight += itm->number * itype->weight;
|
||||||
if (itype->flags & ITF_VEHICLE) {
|
if (itype->flags & ITF_VEHICLE) {
|
||||||
give_item(itm->number, itm->type, u, NULL, NULL);
|
give_item(itm->number, itm->type, u, NULL, NULL);
|
||||||
|
@ -104,16 +100,13 @@ static void reduce_weight(unit * u)
|
||||||
/* 1. get rid of anything that isn't silver or really lightweight or helpful in combat */
|
/* 1. get rid of anything that isn't silver or really lightweight or helpful in combat */
|
||||||
for (itmp = &u->items; *itmp && capacity > 0;) {
|
for (itmp = &u->items; *itmp && capacity > 0;) {
|
||||||
item *itm = *itmp;
|
item *itm = *itmp;
|
||||||
|
|
||||||
const item_type *itype = itm->type;
|
const item_type *itype = itm->type;
|
||||||
|
|
||||||
weight += itm->number * itype->weight;
|
weight += itm->number * itype->weight;
|
||||||
if (weight > capacity) {
|
if (weight > capacity) {
|
||||||
if (itype->weight >= 10 && itype->rtype->wtype == 0
|
if (itype->weight >= 10 && itype->rtype->wtype == 0
|
||||||
&& itype->rtype->atype == 0) {
|
&& itype->rtype->atype == 0) {
|
||||||
if (itype->capacity < itype->weight) {
|
if (itype->capacity < itype->weight) {
|
||||||
int reduce = MIN(itm->number, -((capacity - weight) / itype->weight));
|
int reduce = MIN(itm->number, -((capacity - weight) / itype->weight));
|
||||||
|
|
||||||
give_item(reduce, itm->type, u, NULL, NULL);
|
give_item(reduce, itm->type, u, NULL, NULL);
|
||||||
weight -= reduce * itype->weight;
|
weight -= reduce * itype->weight;
|
||||||
}
|
}
|
||||||
|
@ -125,13 +118,10 @@ static void reduce_weight(unit * u)
|
||||||
|
|
||||||
for (itmp = &u->items; *itmp && weight > capacity;) {
|
for (itmp = &u->items; *itmp && weight > capacity;) {
|
||||||
item *itm = *itmp;
|
item *itm = *itmp;
|
||||||
|
|
||||||
const item_type *itype = itm->type;
|
const item_type *itype = itm->type;
|
||||||
|
|
||||||
weight += itm->number * itype->weight;
|
weight += itm->number * itype->weight;
|
||||||
if (itype->capacity < itype->weight) {
|
if (itype->capacity < itype->weight) {
|
||||||
int reduce = MIN(itm->number, -((capacity - weight) / itype->weight));
|
int reduce = MIN(itm->number, -((capacity - weight) / itype->weight));
|
||||||
|
|
||||||
give_item(reduce, itm->type, u, NULL, NULL);
|
give_item(reduce, itm->type, u, NULL, NULL);
|
||||||
weight -= reduce * itype->weight;
|
weight -= reduce * itype->weight;
|
||||||
}
|
}
|
||||||
|
@ -154,18 +144,15 @@ static order *monster_attack(unit * u, const unit * target)
|
||||||
return create_order(K_ATTACK, u->faction->locale, "%i", target->no);
|
return create_order(K_ATTACK, u->faction->locale, "%i", target->no);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static order *get_money_for_dragon(region * r, unit * u, int wanted)
|
static order *get_money_for_dragon(region * r, unit * u, int wanted)
|
||||||
{
|
{
|
||||||
unit *u2;
|
unit *u2;
|
||||||
|
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
/* attackiere bewachende einheiten */
|
/* attackiere bewachende einheiten */
|
||||||
for (u2 = r->units; u2; u2 = u2->next) {
|
for (u2 = r->units; u2; u2 = u2->next) {
|
||||||
if (u2 != u && is_guard(u2, GUARD_TAX)) {
|
if (u2 != u && is_guard(u2, GUARD_TAX)) {
|
||||||
order *ord = monster_attack(u, u2);
|
order *ord = monster_attack(u, u2);
|
||||||
|
|
||||||
if (ord)
|
if (ord)
|
||||||
addlist(&u->orders, ord);
|
addlist(&u->orders, ord);
|
||||||
}
|
}
|
||||||
|
@ -184,12 +171,10 @@ static order *get_money_for_dragon(region * r, unit * u, int wanted)
|
||||||
for (u2 = r->units; u2; u2 = u2->next) {
|
for (u2 = r->units; u2; u2 = u2->next) {
|
||||||
if (u2->faction != u->faction && cansee(u->faction, r, u2, 0)) {
|
if (u2->faction != u->faction && cansee(u->faction, r, u2, 0)) {
|
||||||
int m = get_money(u2);
|
int m = get_money(u2);
|
||||||
|
|
||||||
if (m == 0 || is_guard(u2, GUARD_TAX))
|
if (m == 0 || is_guard(u2, GUARD_TAX))
|
||||||
continue;
|
continue;
|
||||||
else {
|
else {
|
||||||
order *ord = monster_attack(u, u2);
|
order *ord = monster_attack(u, u2);
|
||||||
|
|
||||||
if (ord) {
|
if (ord) {
|
||||||
addlist(&u->orders, ord);
|
addlist(&u->orders, ord);
|
||||||
n += m;
|
n += m;
|
||||||
|
@ -211,7 +196,6 @@ static order *get_money_for_dragon(region * r, unit * u, int wanted)
|
||||||
static int all_money(region * r, faction * f)
|
static int all_money(region * r, faction * f)
|
||||||
{
|
{
|
||||||
unit *u;
|
unit *u;
|
||||||
|
|
||||||
int m;
|
int m;
|
||||||
|
|
||||||
m = rmoney(r);
|
m = rmoney(r);
|
||||||
|
@ -229,9 +213,7 @@ static direction_t richest_neighbour(region * r, faction * f, int absolut)
|
||||||
/* m - maximum an Geld, d - Richtung, i - index, t = Geld hier */
|
/* m - maximum an Geld, d - Richtung, i - index, t = Geld hier */
|
||||||
|
|
||||||
double m;
|
double m;
|
||||||
|
|
||||||
double t;
|
double t;
|
||||||
|
|
||||||
direction_t d = NODIRECTION, i;
|
direction_t d = NODIRECTION, i;
|
||||||
|
|
||||||
if (absolut == 1 || rpeasants(r) == 0) {
|
if (absolut == 1 || rpeasants(r) == 0) {
|
||||||
|
@ -244,7 +226,6 @@ static direction_t richest_neighbour(region * r, faction * f, int absolut)
|
||||||
|
|
||||||
for (i = 0; i != MAXDIRECTIONS; i++) {
|
for (i = 0; i != MAXDIRECTIONS; i++) {
|
||||||
region *rn = rconnect(r, i);
|
region *rn = rconnect(r, i);
|
||||||
|
|
||||||
if (rn != NULL && fval(rn->terrain, LAND_REGION)) {
|
if (rn != NULL && fval(rn->terrain, LAND_REGION)) {
|
||||||
if (absolut == 1 || rpeasants(rn) == 0) {
|
if (absolut == 1 || rpeasants(rn) == 0) {
|
||||||
t = (double)all_money(rn, f);
|
t = (double)all_money(rn, f);
|
||||||
|
@ -264,7 +245,6 @@ static direction_t richest_neighbour(region * r, faction * f, int absolut)
|
||||||
static boolean room_for_race_in_region(region * r, const race * rc)
|
static boolean room_for_race_in_region(region * r, const race * rc)
|
||||||
{
|
{
|
||||||
unit *u;
|
unit *u;
|
||||||
|
|
||||||
int c = 0;
|
int c = 0;
|
||||||
|
|
||||||
for (u = r->units; u; u = u->next) {
|
for (u = r->units; u; u = u->next) {
|
||||||
|
@ -281,9 +261,7 @@ static boolean room_for_race_in_region(region * r, const race * rc)
|
||||||
static direction_t random_neighbour(region * r, unit * u)
|
static direction_t random_neighbour(region * r, unit * u)
|
||||||
{
|
{
|
||||||
direction_t i;
|
direction_t i;
|
||||||
|
|
||||||
region *rc;
|
region *rc;
|
||||||
|
|
||||||
int rr, c = 0, c2 = 0;
|
int rr, c = 0, c2 = 0;
|
||||||
|
|
||||||
/* Nachsehen, wieviele Regionen in Frage kommen */
|
/* Nachsehen, wieviele Regionen in Frage kommen */
|
||||||
|
@ -334,9 +312,7 @@ static direction_t random_neighbour(region * r, unit * u)
|
||||||
static direction_t treeman_neighbour(region * r)
|
static direction_t treeman_neighbour(region * r)
|
||||||
{
|
{
|
||||||
direction_t i;
|
direction_t i;
|
||||||
|
|
||||||
int rr;
|
int rr;
|
||||||
|
|
||||||
int c = 0;
|
int c = 0;
|
||||||
|
|
||||||
/* Nachsehen, wieviele Regionen in Frage kommen */
|
/* Nachsehen, wieviele Regionen in Frage kommen */
|
||||||
|
@ -421,17 +397,13 @@ static int dragon_affinity_value(region * r, unit * u)
|
||||||
static attrib *set_new_dragon_target(unit * u, region * r, int range)
|
static attrib *set_new_dragon_target(unit * u, region * r, int range)
|
||||||
{
|
{
|
||||||
int max_affinity = 0;
|
int max_affinity = 0;
|
||||||
|
|
||||||
region *max_region = NULL;
|
region *max_region = NULL;
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
region_list *rptr, *rlist = regions_in_range(r, range, allowed_dragon);
|
region_list *rptr, *rlist = regions_in_range(r, range, allowed_dragon);
|
||||||
|
|
||||||
for (rptr = rlist; rptr; rptr = rptr->next) {
|
for (rptr = rlist; rptr; rptr = rptr->next) {
|
||||||
region *r2 = rptr->data;
|
region *r2 = rptr->data;
|
||||||
|
|
||||||
int affinity = dragon_affinity_value(r2, u);
|
int affinity = dragon_affinity_value(r2, u);
|
||||||
|
|
||||||
if (affinity > max_affinity) {
|
if (affinity > max_affinity) {
|
||||||
max_affinity = affinity;
|
max_affinity = affinity;
|
||||||
max_region = r2;
|
max_region = r2;
|
||||||
|
@ -441,18 +413,14 @@ static attrib *set_new_dragon_target(unit * u, region * r, int range)
|
||||||
free_regionlist(rlist);
|
free_regionlist(rlist);
|
||||||
#else
|
#else
|
||||||
int tx, ty;
|
int tx, ty;
|
||||||
|
|
||||||
for (tx = r->x - range; tx < r->x + range; tx++) {
|
for (tx = r->x - range; tx < r->x + range; tx++) {
|
||||||
for (ty = r->y - range; ty < r->y + range; ty++) {
|
for (ty = r->y - range; ty < r->y + range; ty++) {
|
||||||
region *r2;
|
region *r2;
|
||||||
|
|
||||||
int x = tx, y = ty;
|
int x = tx, y = ty;
|
||||||
|
|
||||||
pnormalize(&x, &y, r->planep);
|
pnormalize(&x, &y, r->planep);
|
||||||
r2 = findregion(x, y);
|
r2 = findregion(x, y);
|
||||||
if (r2 != NULL) {
|
if (r2 != NULL) {
|
||||||
int affinity = dragon_affinity_value(r2, u);
|
int affinity = dragon_affinity_value(r2, u);
|
||||||
|
|
||||||
if (affinity > max_affinity) {
|
if (affinity > max_affinity) {
|
||||||
if (koor_distance(r->x, r->y, x, y) <= range
|
if (koor_distance(r->x, r->y, x, y) <= range
|
||||||
&& path_exists(r, r2, range, allowed_dragon)) {
|
&& path_exists(r, r2, range, allowed_dragon)) {
|
||||||
|
@ -466,7 +434,6 @@ static attrib *set_new_dragon_target(unit * u, region * r, int range)
|
||||||
#endif
|
#endif
|
||||||
if (max_region && max_region != r) {
|
if (max_region && max_region != r) {
|
||||||
attrib *a = a_find(u->attribs, &at_targetregion);
|
attrib *a = a_find(u->attribs, &at_targetregion);
|
||||||
|
|
||||||
if (!a) {
|
if (!a) {
|
||||||
a = a_add(&u->attribs, make_targetregion(max_region));
|
a = a_add(&u->attribs, make_targetregion(max_region));
|
||||||
} else {
|
} else {
|
||||||
|
@ -481,13 +448,9 @@ static order *make_movement_order(unit * u, const region * target, int moves,
|
||||||
boolean(*allowed) (const region *, const region *))
|
boolean(*allowed) (const region *, const region *))
|
||||||
{
|
{
|
||||||
region *r = u->region;
|
region *r = u->region;
|
||||||
|
|
||||||
region **plan;
|
region **plan;
|
||||||
|
|
||||||
int bytes, position = 0;
|
int bytes, position = 0;
|
||||||
|
|
||||||
char zOrder[128], *bufp = zOrder;
|
char zOrder[128], *bufp = zOrder;
|
||||||
|
|
||||||
size_t size = sizeof(zOrder) - 1;
|
size_t size = sizeof(zOrder) - 1;
|
||||||
|
|
||||||
if (monster_is_waiting(u))
|
if (monster_is_waiting(u))
|
||||||
|
@ -505,11 +468,8 @@ static order *make_movement_order(unit * u, const region * target, int moves,
|
||||||
|
|
||||||
while (position != moves && plan[position + 1]) {
|
while (position != moves && plan[position + 1]) {
|
||||||
region *prev = plan[position];
|
region *prev = plan[position];
|
||||||
|
|
||||||
region *next = plan[++position];
|
region *next = plan[++position];
|
||||||
|
|
||||||
direction_t dir = reldirection(prev, next);
|
direction_t dir = reldirection(prev, next);
|
||||||
|
|
||||||
assert(dir != NODIRECTION && dir != D_SPECIAL);
|
assert(dir != NODIRECTION && dir != D_SPECIAL);
|
||||||
if (size > 1) {
|
if (size > 1) {
|
||||||
*bufp++ = ' ';
|
*bufp++ = ' ';
|
||||||
|
@ -530,13 +490,9 @@ static order *make_movement_order(unit * u, const region * target, int moves,
|
||||||
static order *monster_seeks_target(region * r, unit * u)
|
static order *monster_seeks_target(region * r, unit * u)
|
||||||
{
|
{
|
||||||
direction_t d;
|
direction_t d;
|
||||||
|
|
||||||
unit *target = NULL;
|
unit *target = NULL;
|
||||||
|
|
||||||
int dist, dist2;
|
int dist, dist2;
|
||||||
|
|
||||||
direction_t i;
|
direction_t i;
|
||||||
|
|
||||||
region *nr;
|
region *nr;
|
||||||
|
|
||||||
/* Das Monster sucht ein bestimmtes Opfer. Welches, steht
|
/* Das Monster sucht ein bestimmtes Opfer. Welches, steht
|
||||||
|
@ -592,14 +548,12 @@ static order *monster_seeks_target(region * r, unit * u)
|
||||||
static void monster_attacks(unit * u)
|
static void monster_attacks(unit * u)
|
||||||
{
|
{
|
||||||
region *r = u->region;
|
region *r = u->region;
|
||||||
|
|
||||||
unit *u2;
|
unit *u2;
|
||||||
|
|
||||||
for (u2 = r->units; u2; u2 = u2->next) {
|
for (u2 = r->units; u2; u2 = u2->next) {
|
||||||
if (cansee(u->faction, r, u2, 0) && u2->faction != u->faction
|
if (cansee(u->faction, r, u2, 0) && u2->faction != u->faction
|
||||||
&& chance(0.75)) {
|
&& chance(0.75)) {
|
||||||
order *ord = monster_attack(u, u2);
|
order *ord = monster_attack(u, u2);
|
||||||
|
|
||||||
if (ord)
|
if (ord)
|
||||||
addlist(&u->orders, ord);
|
addlist(&u->orders, ord);
|
||||||
}
|
}
|
||||||
|
@ -628,11 +582,8 @@ extern struct attrib_type at_direction;
|
||||||
static order *monster_learn(unit * u)
|
static order *monster_learn(unit * u)
|
||||||
{
|
{
|
||||||
int c = 0;
|
int c = 0;
|
||||||
|
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
skill *sv;
|
skill *sv;
|
||||||
|
|
||||||
const struct locale *lang = u->faction->locale;
|
const struct locale *lang = u->faction->locale;
|
||||||
|
|
||||||
/* Monster lernt ein zufälliges Talent aus allen, in denen es schon
|
/* Monster lernt ein zufälliges Talent aus allen, in denen es schon
|
||||||
|
@ -662,7 +613,6 @@ static order *monster_learn(unit * u)
|
||||||
static boolean check_overpopulated(unit * u)
|
static boolean check_overpopulated(unit * u)
|
||||||
{
|
{
|
||||||
unit *u2;
|
unit *u2;
|
||||||
|
|
||||||
int c = 0;
|
int c = 0;
|
||||||
|
|
||||||
for (u2 = u->region->units; u2; u2 = u2->next) {
|
for (u2 = u->region->units; u2; u2 = u2->next) {
|
||||||
|
@ -679,13 +629,9 @@ static boolean check_overpopulated(unit * u)
|
||||||
static void recruit_dracoids(unit * dragon, int size)
|
static void recruit_dracoids(unit * dragon, int size)
|
||||||
{
|
{
|
||||||
faction *f = dragon->faction;
|
faction *f = dragon->faction;
|
||||||
|
|
||||||
region *r = dragon->region;
|
region *r = dragon->region;
|
||||||
|
|
||||||
const struct item *weapon = NULL;
|
const struct item *weapon = NULL;
|
||||||
|
|
||||||
order *new_order = NULL;
|
order *new_order = NULL;
|
||||||
|
|
||||||
unit *un = createunit(r, f, size, new_race[RC_DRACOID]);
|
unit *un = createunit(r, f, size, new_race[RC_DRACOID]);
|
||||||
|
|
||||||
fset(un, UFL_ISNEW | UFL_MOVED);
|
fset(un, UFL_ISNEW | UFL_MOVED);
|
||||||
|
@ -697,7 +643,6 @@ static void recruit_dracoids(unit * dragon, int size)
|
||||||
setstatus(un, ST_FIGHT);
|
setstatus(un, ST_FIGHT);
|
||||||
for (weapon = un->items; weapon; weapon = weapon->next) {
|
for (weapon = un->items; weapon; weapon = weapon->next) {
|
||||||
const weapon_type *wtype = weapon->type->rtype->wtype;
|
const weapon_type *wtype = weapon->type->rtype->wtype;
|
||||||
|
|
||||||
if (wtype && (wtype->flags & WTF_MISSILE)) {
|
if (wtype && (wtype->flags & WTF_MISSILE)) {
|
||||||
setstatus(un, ST_BEHIND);
|
setstatus(un, ST_BEHIND);
|
||||||
}
|
}
|
||||||
|
@ -713,13 +658,9 @@ static void recruit_dracoids(unit * dragon, int size)
|
||||||
static order *plan_dragon(unit * u)
|
static order *plan_dragon(unit * u)
|
||||||
{
|
{
|
||||||
attrib *ta = a_find(u->attribs, &at_targetregion);
|
attrib *ta = a_find(u->attribs, &at_targetregion);
|
||||||
|
|
||||||
region *r = u->region;
|
region *r = u->region;
|
||||||
|
|
||||||
region *tr = NULL;
|
region *tr = NULL;
|
||||||
|
|
||||||
boolean move = false;
|
boolean move = false;
|
||||||
|
|
||||||
order *long_order = NULL;
|
order *long_order = NULL;
|
||||||
|
|
||||||
reduce_weight(u);
|
reduce_weight(u);
|
||||||
|
@ -732,7 +673,6 @@ static order *plan_dragon(unit * u)
|
||||||
|
|
||||||
if (u->race == new_race[RC_WYRM] && !move) {
|
if (u->race == new_race[RC_WYRM] && !move) {
|
||||||
unit *u2;
|
unit *u2;
|
||||||
|
|
||||||
for (u2 = r->units; u2; u2 = u2->next) {
|
for (u2 = r->units; u2; u2 = u2->next) {
|
||||||
/* wyrme sind einzelgänger */
|
/* wyrme sind einzelgänger */
|
||||||
if (u2 == u) {
|
if (u2 == u) {
|
||||||
|
@ -774,7 +714,6 @@ static order *plan_dragon(unit * u)
|
||||||
}
|
}
|
||||||
if (rng_int() % 100 < 15) {
|
if (rng_int() % 100 < 15) {
|
||||||
const struct locale *lang = u->faction->locale;
|
const struct locale *lang = u->faction->locale;
|
||||||
|
|
||||||
/* do a growl */
|
/* do a growl */
|
||||||
if (rname(tr, lang)) {
|
if (rname(tr, lang)) {
|
||||||
addlist(&u->orders, create_order(K_MAIL, lang, "%s '%s... %s %s %s'",
|
addlist(&u->orders, create_order(K_MAIL, lang, "%s '%s... %s %s %s'",
|
||||||
|
@ -793,7 +732,6 @@ static order *plan_dragon(unit * u)
|
||||||
/* neue dracoiden! */
|
/* neue dracoiden! */
|
||||||
if (r->land && !fval(r->terrain, FORBIDDEN_REGION)) {
|
if (r->land && !fval(r->terrain, FORBIDDEN_REGION)) {
|
||||||
int ra = 20 + rng_int() % 100;
|
int ra = 20 + rng_int() % 100;
|
||||||
|
|
||||||
if (get_money(u) > ra * 50 + 100 && rng_int() % 100 < 50) {
|
if (get_money(u) > ra * 50 + 100 && rng_int() % 100 < 50) {
|
||||||
recruit_dracoids(u, ra);
|
recruit_dracoids(u, ra);
|
||||||
}
|
}
|
||||||
|
@ -802,7 +740,6 @@ static order *plan_dragon(unit * u)
|
||||||
}
|
}
|
||||||
if (long_order == NULL) {
|
if (long_order == NULL) {
|
||||||
skill_t sk = SK_PERCEPTION;
|
skill_t sk = SK_PERCEPTION;
|
||||||
|
|
||||||
/* study perception (or a random useful skill) */
|
/* study perception (or a random useful skill) */
|
||||||
while (!skill_enabled[sk] || u->race->bonus[sk] < -5) {
|
while (!skill_enabled[sk] || u->race->bonus[sk] < -5) {
|
||||||
sk = (skill_t) (rng_int() % MAXSKILLS);
|
sk = (skill_t) (rng_int() % MAXSKILLS);
|
||||||
|
@ -822,14 +759,11 @@ void plan_monsters(faction * f)
|
||||||
|
|
||||||
for (r = regions; r; r = r->next) {
|
for (r = regions; r; r = r->next) {
|
||||||
unit *u;
|
unit *u;
|
||||||
|
|
||||||
double attack_chance = MONSTERATTACK;
|
double attack_chance = MONSTERATTACK;
|
||||||
|
|
||||||
boolean attacking = false;
|
boolean attacking = false;
|
||||||
|
|
||||||
for (u = r->units; u; u = u->next) {
|
for (u = r->units; u; u = u->next) {
|
||||||
attrib *ta;
|
attrib *ta;
|
||||||
|
|
||||||
order *long_order = NULL;
|
order *long_order = NULL;
|
||||||
|
|
||||||
/* Ab hier nur noch Befehle für NPC-Einheiten. */
|
/* Ab hier nur noch Befehle für NPC-Einheiten. */
|
||||||
|
@ -862,7 +796,6 @@ void plan_monsters(faction * f)
|
||||||
ta = a_find(u->attribs, &at_hate);
|
ta = a_find(u->attribs, &at_hate);
|
||||||
if (ta && !monster_is_waiting(u)) {
|
if (ta && !monster_is_waiting(u)) {
|
||||||
unit *tu = (unit *) ta->data.v;
|
unit *tu = (unit *) ta->data.v;
|
||||||
|
|
||||||
if (tu && tu->region == r) {
|
if (tu && tu->region == r) {
|
||||||
addlist(&u->orders, create_order(K_ATTACK, u->faction->locale, "%i",
|
addlist(&u->orders, create_order(K_ATTACK, u->faction->locale, "%i",
|
||||||
tu->no));
|
tu->no));
|
||||||
|
@ -883,7 +816,6 @@ void plan_monsters(faction * f)
|
||||||
/* Einheiten mit Bewegungsplan kriegen ein NACH: */
|
/* Einheiten mit Bewegungsplan kriegen ein NACH: */
|
||||||
if (long_order == NULL) {
|
if (long_order == NULL) {
|
||||||
attrib *ta = a_find(u->attribs, &at_targetregion);
|
attrib *ta = a_find(u->attribs, &at_targetregion);
|
||||||
|
|
||||||
if (ta) {
|
if (ta) {
|
||||||
if (u->region == (region *) ta->data.v) {
|
if (u->region == (region *) ta->data.v) {
|
||||||
a_remove(&u->attribs, ta);
|
a_remove(&u->attribs, ta);
|
||||||
|
@ -946,7 +878,6 @@ void plan_monsters(faction * f)
|
||||||
static double chaosfactor(region * r)
|
static double chaosfactor(region * r)
|
||||||
{
|
{
|
||||||
attrib *a = a_find(r->attribs, &at_chaoscount);
|
attrib *a = a_find(r->attribs, &at_chaoscount);
|
||||||
|
|
||||||
if (!a)
|
if (!a)
|
||||||
return 0;
|
return 0;
|
||||||
return ((double)a->data.i / 1000.0);
|
return ((double)a->data.i / 1000.0);
|
||||||
|
@ -969,7 +900,6 @@ static int nrand(int start, int sub)
|
||||||
void spawn_dragons(void)
|
void spawn_dragons(void)
|
||||||
{
|
{
|
||||||
region *r;
|
region *r;
|
||||||
|
|
||||||
faction *monsters = get_monsters();
|
faction *monsters = get_monsters();
|
||||||
|
|
||||||
for (r = regions; r; r = r->next) {
|
for (r = regions; r; r = r->next) {
|
||||||
|
@ -1012,12 +942,10 @@ void spawn_dragons(void)
|
||||||
void spawn_undead(void)
|
void spawn_undead(void)
|
||||||
{
|
{
|
||||||
region *r;
|
region *r;
|
||||||
|
|
||||||
faction *monsters = get_monsters();
|
faction *monsters = get_monsters();
|
||||||
|
|
||||||
for (r = regions; r; r = r->next) {
|
for (r = regions; r; r = r->next) {
|
||||||
int unburied = deathcount(r);
|
int unburied = deathcount(r);
|
||||||
|
|
||||||
static const curse_type *ctype = NULL;
|
static const curse_type *ctype = NULL;
|
||||||
|
|
||||||
if (!ctype)
|
if (!ctype)
|
||||||
|
@ -1029,16 +957,12 @@ void spawn_undead(void)
|
||||||
if (r->land && unburied > r->land->peasants / 20
|
if (r->land && unburied > r->land->peasants / 20
|
||||||
&& rng_int() % 10000 < (100 + 100 * chaosfactor(r))) {
|
&& rng_int() % 10000 < (100 + 100 * chaosfactor(r))) {
|
||||||
unit *u;
|
unit *u;
|
||||||
|
|
||||||
/* es ist sinnfrei, wenn irgendwo im Wald 3er-Einheiten Untote entstehen.
|
/* es ist sinnfrei, wenn irgendwo im Wald 3er-Einheiten Untote entstehen.
|
||||||
* Lieber sammeln lassen, bis sie mindestens 5% der Bevölkerung sind, und
|
* Lieber sammeln lassen, bis sie mindestens 5% der Bevölkerung sind, und
|
||||||
* dann erst auferstehen. */
|
* dann erst auferstehen. */
|
||||||
int undead = unburied / (rng_int() % 2 + 1);
|
int undead = unburied / (rng_int() % 2 + 1);
|
||||||
|
|
||||||
const race *rc = NULL;
|
const race *rc = NULL;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (r->age < 100)
|
if (r->age < 100)
|
||||||
undead = undead * r->age / 100; /* newbie-regionen kriegen weniger ab */
|
undead = undead * r->age / 100; /* newbie-regionen kriegen weniger ab */
|
||||||
|
|
||||||
|
@ -1082,7 +1006,6 @@ void spawn_undead(void)
|
||||||
|
|
||||||
{
|
{
|
||||||
message *msg = msg_message("undeadrise", "region", r);
|
message *msg = msg_message("undeadrise", "region", r);
|
||||||
|
|
||||||
add_message(&r->msgs, msg);
|
add_message(&r->msgs, msg);
|
||||||
for (u = r->units; u; u = u->next)
|
for (u = r->units; u; u = u->next)
|
||||||
freset(u->faction, FFL_SELECT);
|
freset(u->faction, FFL_SELECT);
|
||||||
|
@ -1096,7 +1019,6 @@ void spawn_undead(void)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int i = deathcount(r);
|
int i = deathcount(r);
|
||||||
|
|
||||||
if (i) {
|
if (i) {
|
||||||
/* Gräber verwittern, 3% der Untoten finden die ewige Ruhe */
|
/* Gräber verwittern, 3% der Untoten finden die ewige Ruhe */
|
||||||
deathcounts(r, (int)(-i * 0.03));
|
deathcounts(r, (int)(-i * 0.03));
|
||||||
|
|
|
@ -31,7 +31,6 @@ void age_firedragon(unit * u)
|
||||||
{
|
{
|
||||||
if (u->number > 0 && rng_int() % 100 < age_chance(u->age, DRAGONAGE, 1)) {
|
if (u->number > 0 && rng_int() % 100 < age_chance(u->age, DRAGONAGE, 1)) {
|
||||||
double q = (double)u->hp / (double)(unit_max_hp(u) * u->number);
|
double q = (double)u->hp / (double)(unit_max_hp(u) * u->number);
|
||||||
|
|
||||||
u->race = new_race[RC_DRAGON];
|
u->race = new_race[RC_DRAGON];
|
||||||
u->irace = NULL;
|
u->irace = NULL;
|
||||||
scale_number(u, 1);
|
scale_number(u, 1);
|
||||||
|
@ -43,7 +42,6 @@ void age_dragon(unit * u)
|
||||||
{
|
{
|
||||||
if (u->number > 0 && rng_int() % 100 < age_chance(u->age, WYRMAGE, 1)) {
|
if (u->number > 0 && rng_int() % 100 < age_chance(u->age, WYRMAGE, 1)) {
|
||||||
double q = (double)u->hp / (double)(unit_max_hp(u) * u->number);
|
double q = (double)u->hp / (double)(unit_max_hp(u) * u->number);
|
||||||
|
|
||||||
u->race = new_race[RC_WYRM];
|
u->race = new_race[RC_WYRM];
|
||||||
u->irace = NULL;
|
u->irace = NULL;
|
||||||
u->hp = (int)(unit_max_hp(u) * u->number * q);
|
u->hp = (int)(unit_max_hp(u) * u->number * q);
|
||||||
|
|
|
@ -28,23 +28,16 @@
|
||||||
#include <util/rng.h>
|
#include <util/rng.h>
|
||||||
|
|
||||||
void age_firedragon(struct unit *u);
|
void age_firedragon(struct unit *u);
|
||||||
|
|
||||||
void age_dragon(struct unit *u);
|
void age_dragon(struct unit *u);
|
||||||
|
|
||||||
void age_illusion(struct unit *u);
|
void age_illusion(struct unit *u);
|
||||||
|
|
||||||
void age_undead(struct unit *u);
|
void age_undead(struct unit *u);
|
||||||
|
|
||||||
void age_skeleton(struct unit *u);
|
void age_skeleton(struct unit *u);
|
||||||
|
|
||||||
void age_zombie(struct unit *u);
|
void age_zombie(struct unit *u);
|
||||||
|
|
||||||
void age_ghoul(struct unit *u);
|
void age_ghoul(struct unit *u);
|
||||||
|
|
||||||
static void oldfamiliars(unit * u)
|
static void oldfamiliars(unit * u)
|
||||||
{
|
{
|
||||||
char fname[64];
|
char fname[64];
|
||||||
|
|
||||||
/* these familiars have no special skills.
|
/* these familiars have no special skills.
|
||||||
*/
|
*/
|
||||||
snprintf(fname, sizeof(fname), "%s_familiar", u->race->_name[0]);
|
snprintf(fname, sizeof(fname), "%s_familiar", u->race->_name[0]);
|
||||||
|
@ -55,7 +48,6 @@ static void oldfamiliars(unit * u)
|
||||||
static void set_show_item(faction * f, item_t i)
|
static void set_show_item(faction * f, item_t i)
|
||||||
{
|
{
|
||||||
attrib *a = a_add(&f->attribs, a_new(&at_showitem));
|
attrib *a = a_add(&f->attribs, a_new(&at_showitem));
|
||||||
|
|
||||||
a->data.v = (void *)olditemtype[i];
|
a->data.v = (void *)olditemtype[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,10 +66,8 @@ static void equip_newunits(const struct equipment *eq, struct unit *u)
|
||||||
case RC_HUMAN:
|
case RC_HUMAN:
|
||||||
if (u->building == NULL) {
|
if (u->building == NULL) {
|
||||||
const building_type *btype = bt_find("castle");
|
const building_type *btype = bt_find("castle");
|
||||||
|
|
||||||
if (btype != NULL) {
|
if (btype != NULL) {
|
||||||
building *b = new_building(btype, r, u->faction->locale);
|
building *b = new_building(btype, r, u->faction->locale);
|
||||||
|
|
||||||
b->size = 10;
|
b->size = 10;
|
||||||
u->building = b;
|
u->building = b;
|
||||||
fset(u, UFL_OWNER);
|
fset(u, UFL_OWNER);
|
||||||
|
@ -90,7 +80,6 @@ static void equip_newunits(const struct equipment *eq, struct unit *u)
|
||||||
case RC_AQUARIAN:
|
case RC_AQUARIAN:
|
||||||
{
|
{
|
||||||
ship *sh = new_ship(st_find("boat"), u->faction->locale, r);
|
ship *sh = new_ship(st_find("boat"), u->faction->locale, r);
|
||||||
|
|
||||||
sh->size = sh->type->construction->maxsize;
|
sh->size = sh->type->construction->maxsize;
|
||||||
u->ship = sh;
|
u->ship = sh;
|
||||||
fset(u, UFL_OWNER);
|
fset(u, UFL_OWNER);
|
||||||
|
|
|
@ -35,7 +35,6 @@
|
||||||
void age_undead(unit * u)
|
void age_undead(unit * u)
|
||||||
{
|
{
|
||||||
region *r = u->region;
|
region *r = u->region;
|
||||||
|
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
/* untote, die einer partei angehoeren, koennen sich
|
/* untote, die einer partei angehoeren, koennen sich
|
||||||
|
@ -45,7 +44,6 @@ void age_undead(unit * u)
|
||||||
if (u->number > UNDEAD_MIN && !is_monsters(u->faction)
|
if (u->number > UNDEAD_MIN && !is_monsters(u->faction)
|
||||||
&& rng_int() % 100 < UNDEAD_BREAKUP) {
|
&& rng_int() % 100 < UNDEAD_BREAKUP) {
|
||||||
int m;
|
int m;
|
||||||
|
|
||||||
unit *u2;
|
unit *u2;
|
||||||
|
|
||||||
n = 0;
|
n = 0;
|
||||||
|
@ -63,9 +61,7 @@ void age_skeleton(unit * u)
|
||||||
{
|
{
|
||||||
if (is_monsters(u->faction) && rng_int() % 100 < age_chance(u->age, 27, 1)) {
|
if (is_monsters(u->faction) && rng_int() % 100 < age_chance(u->age, 27, 1)) {
|
||||||
int n = MAX(1, u->number / 2);
|
int n = MAX(1, u->number / 2);
|
||||||
|
|
||||||
double q = (double)u->hp / (double)(unit_max_hp(u) * u->number);
|
double q = (double)u->hp / (double)(unit_max_hp(u) * u->number);
|
||||||
|
|
||||||
u->race = new_race[RC_SKELETON_LORD];
|
u->race = new_race[RC_SKELETON_LORD];
|
||||||
u->irace = NULL;
|
u->irace = NULL;
|
||||||
scale_number(u, n);
|
scale_number(u, n);
|
||||||
|
@ -77,9 +73,7 @@ void age_zombie(unit * u)
|
||||||
{
|
{
|
||||||
if (is_monsters(u->faction) && rng_int() % 100 < age_chance(u->age, 27, 1)) {
|
if (is_monsters(u->faction) && rng_int() % 100 < age_chance(u->age, 27, 1)) {
|
||||||
int n = MAX(1, u->number / 2);
|
int n = MAX(1, u->number / 2);
|
||||||
|
|
||||||
double q = (double)u->hp / (double)(unit_max_hp(u) * u->number);
|
double q = (double)u->hp / (double)(unit_max_hp(u) * u->number);
|
||||||
|
|
||||||
u->race = new_race[RC_ZOMBIE_LORD];
|
u->race = new_race[RC_ZOMBIE_LORD];
|
||||||
u->irace = NULL;
|
u->irace = NULL;
|
||||||
scale_number(u, n);
|
scale_number(u, n);
|
||||||
|
@ -91,9 +85,7 @@ void age_ghoul(unit * u)
|
||||||
{
|
{
|
||||||
if (is_monsters(u->faction) && rng_int() % 100 < age_chance(u->age, 27, 1)) {
|
if (is_monsters(u->faction) && rng_int() % 100 < age_chance(u->age, 27, 1)) {
|
||||||
int n = MAX(1, u->number / 2);
|
int n = MAX(1, u->number / 2);
|
||||||
|
|
||||||
double q = (double)u->hp / (double)(unit_max_hp(u) * u->number);
|
double q = (double)u->hp / (double)(unit_max_hp(u) * u->number);
|
||||||
|
|
||||||
u->race = new_race[RC_GHOUL_LORD];
|
u->race = new_race[RC_GHOUL_LORD];
|
||||||
u->irace = NULL;
|
u->irace = NULL;
|
||||||
scale_number(u, n);
|
scale_number(u, n);
|
||||||
|
|
|
@ -61,7 +61,6 @@ static void alp_done(attrib * a)
|
||||||
static int alp_verify(attrib * a)
|
static int alp_verify(attrib * a)
|
||||||
{
|
{
|
||||||
alp_data *ad = (alp_data *) a->data.v;
|
alp_data *ad = (alp_data *) a->data.v;
|
||||||
|
|
||||||
if (ad->mage && ad->target)
|
if (ad->mage && ad->target)
|
||||||
return 1;
|
return 1;
|
||||||
return 0; /* remove the attribute */
|
return 0; /* remove the attribute */
|
||||||
|
@ -71,7 +70,6 @@ static void
|
||||||
alp_write(const attrib * a, const void *owner, struct storage *store)
|
alp_write(const attrib * a, const void *owner, struct storage *store)
|
||||||
{
|
{
|
||||||
alp_data *ad = (alp_data *) a->data.v;
|
alp_data *ad = (alp_data *) a->data.v;
|
||||||
|
|
||||||
write_unit_reference(ad->mage, store);
|
write_unit_reference(ad->mage, store);
|
||||||
write_unit_reference(ad->target, store);
|
write_unit_reference(ad->target, store);
|
||||||
}
|
}
|
||||||
|
@ -79,9 +77,7 @@ alp_write(const attrib * a, const void *owner, struct storage *store)
|
||||||
static int alp_read(attrib * a, void *owner, struct storage *store)
|
static int alp_read(attrib * a, void *owner, struct storage *store)
|
||||||
{
|
{
|
||||||
alp_data *ad = (alp_data *) a->data.v;
|
alp_data *ad = (alp_data *) a->data.v;
|
||||||
|
|
||||||
int rm = read_reference(&ad->mage, store, read_unit_reference, resolve_unit);
|
int rm = read_reference(&ad->mage, store, read_unit_reference, resolve_unit);
|
||||||
|
|
||||||
int rt =
|
int rt =
|
||||||
read_reference(&ad->target, store, read_unit_reference, resolve_unit);
|
read_reference(&ad->target, store, read_unit_reference, resolve_unit);
|
||||||
if (rt == 0 && rm == 0 && (!ad->target || !ad->mage)) {
|
if (rt == 0 && rm == 0 && (!ad->target || !ad->mage)) {
|
||||||
|
@ -104,19 +100,12 @@ static attrib_type at_alp = {
|
||||||
int sp_summon_alp(struct castorder *co)
|
int sp_summon_alp(struct castorder *co)
|
||||||
{
|
{
|
||||||
unit *alp, *opfer;
|
unit *alp, *opfer;
|
||||||
|
|
||||||
region *r = co->rt;
|
region *r = co->rt;
|
||||||
|
|
||||||
unit *mage = co->magician.u;
|
unit *mage = co->magician.u;
|
||||||
|
|
||||||
int cast_level = co->level;
|
int cast_level = co->level;
|
||||||
|
|
||||||
spellparameter *pa = co->par;
|
spellparameter *pa = co->par;
|
||||||
|
|
||||||
const struct race *rc = new_race[RC_ALP];
|
const struct race *rc = new_race[RC_ALP];
|
||||||
|
|
||||||
struct faction *f = get_monsters();
|
struct faction *f = get_monsters();
|
||||||
|
|
||||||
struct message *msg;
|
struct message *msg;
|
||||||
|
|
||||||
opfer = pa->param[0]->data.u;
|
opfer = pa->param[0]->data.u;
|
||||||
|
@ -131,9 +120,7 @@ int sp_summon_alp(struct castorder *co)
|
||||||
|
|
||||||
{
|
{
|
||||||
attrib *a = a_add(&alp->attribs, a_new(&at_alp));
|
attrib *a = a_add(&alp->attribs, a_new(&at_alp));
|
||||||
|
|
||||||
alp_data *ad = (alp_data *) a->data.v;
|
alp_data *ad = (alp_data *) a->data.v;
|
||||||
|
|
||||||
ad->mage = mage;
|
ad->mage = mage;
|
||||||
ad->target = opfer;
|
ad->target = opfer;
|
||||||
}
|
}
|
||||||
|
@ -153,21 +140,14 @@ int sp_summon_alp(struct castorder *co)
|
||||||
return cast_level;
|
return cast_level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void alp_findet_opfer(unit * alp, region * r)
|
void alp_findet_opfer(unit * alp, region * r)
|
||||||
{
|
{
|
||||||
curse *c;
|
curse *c;
|
||||||
|
|
||||||
attrib *a = a_find(alp->attribs, &at_alp);
|
attrib *a = a_find(alp->attribs, &at_alp);
|
||||||
|
|
||||||
alp_data *ad = (alp_data *) a->data.v;
|
alp_data *ad = (alp_data *) a->data.v;
|
||||||
|
|
||||||
unit *mage = ad->mage;
|
unit *mage = ad->mage;
|
||||||
|
|
||||||
unit *opfer = ad->target;
|
unit *opfer = ad->target;
|
||||||
|
|
||||||
double effect;
|
double effect;
|
||||||
|
|
||||||
message *msg;
|
message *msg;
|
||||||
|
|
||||||
assert(opfer);
|
assert(opfer);
|
||||||
|
@ -207,7 +187,6 @@ void register_alp(void)
|
||||||
unit *alp_target(unit * alp)
|
unit *alp_target(unit * alp)
|
||||||
{
|
{
|
||||||
alp_data *ad;
|
alp_data *ad;
|
||||||
|
|
||||||
unit *target = NULL;
|
unit *target = NULL;
|
||||||
|
|
||||||
attrib *a = a_find(alp->attribs, &at_alp);
|
attrib *a = a_find(alp->attribs, &at_alp);
|
||||||
|
|
|
@ -47,7 +47,6 @@ extern "C" {
|
||||||
struct unit *alp_target(struct unit *alp);
|
struct unit *alp_target(struct unit *alp);
|
||||||
void alp_findet_opfer(struct unit *alp, struct region *r);
|
void alp_findet_opfer(struct unit *alp, struct region *r);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
||||||
static message *cinfo_building(const void *obj, typ_t typ, const curse * c,
|
static message *cinfo_building(const void *obj, typ_t typ, const curse * c,
|
||||||
int self)
|
int self)
|
||||||
{
|
{
|
||||||
|
@ -53,10 +52,8 @@ static message *cinfo_magicrunes(const void *obj, typ_t typ, const curse * c,
|
||||||
int self)
|
int self)
|
||||||
{
|
{
|
||||||
message *msg = NULL;
|
message *msg = NULL;
|
||||||
|
|
||||||
if (typ == TYP_BUILDING) {
|
if (typ == TYP_BUILDING) {
|
||||||
building *b;
|
building *b;
|
||||||
|
|
||||||
b = (building *) obj;
|
b = (building *) obj;
|
||||||
if (self != 0) {
|
if (self != 0) {
|
||||||
msg =
|
msg =
|
||||||
|
@ -64,7 +61,6 @@ static message *cinfo_magicrunes(const void *obj, typ_t typ, const curse * c,
|
||||||
}
|
}
|
||||||
} else if (typ == TYP_SHIP) {
|
} else if (typ == TYP_SHIP) {
|
||||||
ship *sh;
|
ship *sh;
|
||||||
|
|
||||||
sh = (ship *) obj;
|
sh = (ship *) obj;
|
||||||
if (self != 0) {
|
if (self != 0) {
|
||||||
msg = msg_message("curseinfo::magicrunes_ship", "ship id", sh, c->no);
|
msg = msg_message("curseinfo::magicrunes_ship", "ship id", sh, c->no);
|
||||||
|
@ -93,7 +89,6 @@ static struct curse_type ct_nocostbuilding = { "nocostbuilding",
|
||||||
CURSETYP_NORM, CURSE_NOAGE | CURSE_ONLYONE, NO_MERGE, cinfo_building
|
CURSETYP_NORM, CURSE_NOAGE | CURSE_ONLYONE, NO_MERGE, cinfo_building
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void register_buildingcurse(void)
|
void register_buildingcurse(void)
|
||||||
{
|
{
|
||||||
ct_register(&ct_magicwalls);
|
ct_register(&ct_magicwalls);
|
||||||
|
|
|
@ -109,16 +109,11 @@ static double get_force(double power, int formel)
|
||||||
int sp_kampfzauber(fighter * fi, int level, double power, spell * sp)
|
int sp_kampfzauber(fighter * fi, int level, double power, spell * sp)
|
||||||
{
|
{
|
||||||
battle *b = fi->side->battle;
|
battle *b = fi->side->battle;
|
||||||
|
|
||||||
troop at, dt;
|
troop at, dt;
|
||||||
|
|
||||||
message *m;
|
message *m;
|
||||||
|
|
||||||
/* Immer aus der ersten Reihe nehmen */
|
/* Immer aus der ersten Reihe nehmen */
|
||||||
int force, enemies;
|
int force, enemies;
|
||||||
|
|
||||||
int killed = 0;
|
int killed = 0;
|
||||||
|
|
||||||
const char *damage;
|
const char *damage;
|
||||||
|
|
||||||
if (power <= 0)
|
if (power <= 0)
|
||||||
|
@ -173,14 +168,10 @@ int sp_kampfzauber(fighter * fi, int level, double power, spell * sp)
|
||||||
int sp_petrify(fighter * fi, int level, double power, spell * sp)
|
int sp_petrify(fighter * fi, int level, double power, spell * sp)
|
||||||
{
|
{
|
||||||
battle *b = fi->side->battle;
|
battle *b = fi->side->battle;
|
||||||
|
|
||||||
unit *mage = fi->unit;
|
unit *mage = fi->unit;
|
||||||
|
|
||||||
/* Wirkt auf erste und zweite Reihe */
|
/* Wirkt auf erste und zweite Reihe */
|
||||||
int force, enemies;
|
int force, enemies;
|
||||||
|
|
||||||
int stoned = 0;
|
int stoned = 0;
|
||||||
|
|
||||||
message *m;
|
message *m;
|
||||||
|
|
||||||
force = lovar(get_force(power, 0));
|
force = lovar(get_force(power, 0));
|
||||||
|
@ -196,9 +187,7 @@ int sp_petrify(fighter * fi, int level, double power, spell * sp)
|
||||||
|
|
||||||
while (force && stoned < enemies) {
|
while (force && stoned < enemies) {
|
||||||
troop dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
|
troop dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
|
||||||
|
|
||||||
unit *du = dt.fighter->unit;
|
unit *du = dt.fighter->unit;
|
||||||
|
|
||||||
if (is_magic_resistant(mage, du, 0) == false) {
|
if (is_magic_resistant(mage, du, 0) == false) {
|
||||||
/* person ans ende hinter die lebenden schieben */
|
/* person ans ende hinter die lebenden schieben */
|
||||||
remove_troop(dt);
|
remove_troop(dt);
|
||||||
|
@ -219,16 +208,11 @@ int sp_petrify(fighter * fi, int level, double power, spell * sp)
|
||||||
int sp_stun(fighter * fi, int level, double power, spell * sp)
|
int sp_stun(fighter * fi, int level, double power, spell * sp)
|
||||||
{
|
{
|
||||||
battle *b = fi->side->battle;
|
battle *b = fi->side->battle;
|
||||||
|
|
||||||
unit *mage = fi->unit;
|
unit *mage = fi->unit;
|
||||||
|
|
||||||
message *m;
|
message *m;
|
||||||
|
|
||||||
troop at;
|
troop at;
|
||||||
|
|
||||||
/* Aus beiden Reihen nehmen */
|
/* Aus beiden Reihen nehmen */
|
||||||
int force = 0, enemies;
|
int force = 0, enemies;
|
||||||
|
|
||||||
int stunned;
|
int stunned;
|
||||||
|
|
||||||
if (power <= 0)
|
if (power <= 0)
|
||||||
|
@ -256,9 +240,7 @@ int sp_stun(fighter * fi, int level, double power, spell * sp)
|
||||||
stunned = 0;
|
stunned = 0;
|
||||||
while (force && stunned < enemies) {
|
while (force && stunned < enemies) {
|
||||||
troop dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
|
troop dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
|
||||||
|
|
||||||
fighter *df = dt.fighter;
|
fighter *df = dt.fighter;
|
||||||
|
|
||||||
unit *du = df->unit;
|
unit *du = df->unit;
|
||||||
|
|
||||||
--force;
|
--force;
|
||||||
|
@ -284,11 +266,8 @@ static void scramble_fighters(quicklist * ql)
|
||||||
|
|
||||||
for (qi = 0; qi != qlen; ++qi) {
|
for (qi = 0; qi != qlen; ++qi) {
|
||||||
int qj = qi + (rng_int() % (qlen - qi));
|
int qj = qi + (rng_int() % (qlen - qi));
|
||||||
|
|
||||||
void *a = ql_get(ql, qi);
|
void *a = ql_get(ql, qi);
|
||||||
|
|
||||||
void *b = ql_replace(ql, qj, a);
|
void *b = ql_replace(ql, qj, a);
|
||||||
|
|
||||||
ql_replace(ql, qi, b);
|
ql_replace(ql, qi, b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -297,11 +276,8 @@ static void scramble_fighters(quicklist * ql)
|
||||||
int sp_combatrosthauch(fighter * fi, int level, double power, spell * sp)
|
int sp_combatrosthauch(fighter * fi, int level, double power, spell * sp)
|
||||||
{
|
{
|
||||||
battle *b = fi->side->battle;
|
battle *b = fi->side->battle;
|
||||||
|
|
||||||
quicklist *ql, *fgs;
|
quicklist *ql, *fgs;
|
||||||
|
|
||||||
int force = lovar(power * 15);
|
int force = lovar(power * 15);
|
||||||
|
|
||||||
int qi, k = 0;
|
int qi, k = 0;
|
||||||
|
|
||||||
/* Immer aus der ersten Reihe nehmen */
|
/* Immer aus der ersten Reihe nehmen */
|
||||||
|
@ -310,7 +286,6 @@ int sp_combatrosthauch(fighter * fi, int level, double power, spell * sp)
|
||||||
if (!count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW - 1,
|
if (!count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW - 1,
|
||||||
SELECT_ADVANCE | SELECT_FIND)) {
|
SELECT_ADVANCE | SELECT_FIND)) {
|
||||||
message *msg = msg_message("rust_effect_0", "mage", fi->unit);
|
message *msg = msg_message("rust_effect_0", "mage", fi->unit);
|
||||||
|
|
||||||
message_all(b, msg);
|
message_all(b, msg);
|
||||||
msg_release(msg);
|
msg_release(msg);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -332,17 +307,12 @@ int sp_combatrosthauch(fighter * fi, int level, double power, spell * sp)
|
||||||
|
|
||||||
if (df->weapons) {
|
if (df->weapons) {
|
||||||
int w;
|
int w;
|
||||||
|
|
||||||
for (w = 0; df->weapons[w].type != NULL; ++w) {
|
for (w = 0; df->weapons[w].type != NULL; ++w) {
|
||||||
weapon *wp = df->weapons;
|
weapon *wp = df->weapons;
|
||||||
|
|
||||||
int n = MIN(force, wp->used);
|
int n = MIN(force, wp->used);
|
||||||
|
|
||||||
if (n) {
|
if (n) {
|
||||||
requirement *mat = wp->type->itype->construction->materials;
|
requirement *mat = wp->type->itype->construction->materials;
|
||||||
|
|
||||||
boolean iron = false;
|
boolean iron = false;
|
||||||
|
|
||||||
while (mat && mat->number > 0) {
|
while (mat && mat->number > 0) {
|
||||||
if (mat->rtype == oldresourcetype[R_IRON]) {
|
if (mat->rtype == oldresourcetype[R_IRON]) {
|
||||||
iron = true;
|
iron = true;
|
||||||
|
@ -352,7 +322,6 @@ int sp_combatrosthauch(fighter * fi, int level, double power, spell * sp)
|
||||||
}
|
}
|
||||||
if (iron) {
|
if (iron) {
|
||||||
int p;
|
int p;
|
||||||
|
|
||||||
force -= n;
|
force -= n;
|
||||||
wp->used -= n;
|
wp->used -= n;
|
||||||
k += n;
|
k += n;
|
||||||
|
@ -379,14 +348,12 @@ int sp_combatrosthauch(fighter * fi, int level, double power, spell * sp)
|
||||||
if (k == 0) {
|
if (k == 0) {
|
||||||
/* keine Waffen mehr da, die zerstört werden könnten */
|
/* keine Waffen mehr da, die zerstört werden könnten */
|
||||||
message *msg = msg_message("rust_effect_1", "mage", fi->unit);
|
message *msg = msg_message("rust_effect_1", "mage", fi->unit);
|
||||||
|
|
||||||
message_all(b, msg);
|
message_all(b, msg);
|
||||||
msg_release(msg);
|
msg_release(msg);
|
||||||
fi->magic = 0; /* kämpft nichtmagisch weiter */
|
fi->magic = 0; /* kämpft nichtmagisch weiter */
|
||||||
level = 0;
|
level = 0;
|
||||||
} else {
|
} else {
|
||||||
message *msg = msg_message("rust_effect_2", "mage", fi->unit);
|
message *msg = msg_message("rust_effect_2", "mage", fi->unit);
|
||||||
|
|
||||||
message_all(b, msg);
|
message_all(b, msg);
|
||||||
msg_release(msg);
|
msg_release(msg);
|
||||||
}
|
}
|
||||||
|
@ -396,19 +363,12 @@ int sp_combatrosthauch(fighter * fi, int level, double power, spell * sp)
|
||||||
int sp_sleep(fighter * fi, int level, double power, spell * sp)
|
int sp_sleep(fighter * fi, int level, double power, spell * sp)
|
||||||
{
|
{
|
||||||
battle *b = fi->side->battle;
|
battle *b = fi->side->battle;
|
||||||
|
|
||||||
unit *mage = fi->unit;
|
unit *mage = fi->unit;
|
||||||
|
|
||||||
unit *du;
|
unit *du;
|
||||||
|
|
||||||
troop dt;
|
troop dt;
|
||||||
|
|
||||||
int force, enemies;
|
int force, enemies;
|
||||||
|
|
||||||
int k = 0;
|
int k = 0;
|
||||||
|
|
||||||
message *m;
|
message *m;
|
||||||
|
|
||||||
/* Immer aus der ersten Reihe nehmen */
|
/* Immer aus der ersten Reihe nehmen */
|
||||||
|
|
||||||
force = lovar(power * 25);
|
force = lovar(power * 25);
|
||||||
|
@ -438,17 +398,12 @@ int sp_sleep(fighter * fi, int level, double power, spell * sp)
|
||||||
return level;
|
return level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int sp_speed(fighter * fi, int level, double power, spell * sp)
|
int sp_speed(fighter * fi, int level, double power, spell * sp)
|
||||||
{
|
{
|
||||||
battle *b = fi->side->battle;
|
battle *b = fi->side->battle;
|
||||||
|
|
||||||
int force;
|
int force;
|
||||||
|
|
||||||
int allies;
|
int allies;
|
||||||
|
|
||||||
int targets = 0;
|
int targets = 0;
|
||||||
|
|
||||||
message *m;
|
message *m;
|
||||||
|
|
||||||
force = lovar(power * power * 5);
|
force = lovar(power * power * 5);
|
||||||
|
@ -461,9 +416,7 @@ int sp_speed(fighter * fi, int level, double power, spell * sp)
|
||||||
|
|
||||||
while (force && allies) {
|
while (force && allies) {
|
||||||
troop dt = select_ally(fi, FIGHT_ROW, BEHIND_ROW, ALLY_ANY);
|
troop dt = select_ally(fi, FIGHT_ROW, BEHIND_ROW, ALLY_ANY);
|
||||||
|
|
||||||
fighter *df = dt.fighter;
|
fighter *df = dt.fighter;
|
||||||
|
|
||||||
--allies;
|
--allies;
|
||||||
|
|
||||||
if (df) {
|
if (df) {
|
||||||
|
@ -486,7 +439,6 @@ int sp_speed(fighter * fi, int level, double power, spell * sp)
|
||||||
static skill_t random_skill(unit * u, boolean weighted)
|
static skill_t random_skill(unit * u, boolean weighted)
|
||||||
{
|
{
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
skill *sv;
|
skill *sv;
|
||||||
|
|
||||||
for (sv = u->skills; sv != u->skills + u->skill_size; ++sv) {
|
for (sv = u->skills; sv != u->skills + u->skill_size; ++sv) {
|
||||||
|
@ -527,15 +479,10 @@ static skill_t random_skill(unit * u, boolean weighted)
|
||||||
int sp_mindblast_temp(fighter * fi, int level, double power, spell * sp)
|
int sp_mindblast_temp(fighter * fi, int level, double power, spell * sp)
|
||||||
{
|
{
|
||||||
battle *b = fi->side->battle;
|
battle *b = fi->side->battle;
|
||||||
|
|
||||||
unit *mage = fi->unit;
|
unit *mage = fi->unit;
|
||||||
|
|
||||||
int k = 0, reset = 0, maxloss = (level + 2) / 3;
|
int k = 0, reset = 0, maxloss = (level + 2) / 3;
|
||||||
|
|
||||||
message *m;
|
message *m;
|
||||||
|
|
||||||
int force = lovar(power * 25);
|
int force = lovar(power * 25);
|
||||||
|
|
||||||
int enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
|
int enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
|
||||||
|
|
||||||
if (!enemies) {
|
if (!enemies) {
|
||||||
|
@ -547,7 +494,6 @@ int sp_mindblast_temp(fighter * fi, int level, double power, spell * sp)
|
||||||
|
|
||||||
while (force > 0 && enemies > 0) {
|
while (force > 0 && enemies > 0) {
|
||||||
unit *du;
|
unit *du;
|
||||||
|
|
||||||
troop dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
|
troop dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
|
||||||
|
|
||||||
assert(dt.fighter);
|
assert(dt.fighter);
|
||||||
|
@ -560,12 +506,9 @@ int sp_mindblast_temp(fighter * fi, int level, double power, spell * sp)
|
||||||
if (humanoidrace(du->race) && force >= du->number) {
|
if (humanoidrace(du->race) && force >= du->number) {
|
||||||
if (!is_magic_resistant(mage, du, 0)) {
|
if (!is_magic_resistant(mage, du, 0)) {
|
||||||
skill_t sk = random_skill(du, true);
|
skill_t sk = random_skill(du, true);
|
||||||
|
|
||||||
if (sk != NOSKILL) {
|
if (sk != NOSKILL) {
|
||||||
int n = 1 + rng_int() % maxloss;
|
int n = 1 + rng_int() % maxloss;
|
||||||
|
|
||||||
attrib *a = make_skillmod(sk, SMF_ALWAYS, NULL, 0.0, n);
|
attrib *a = make_skillmod(sk, SMF_ALWAYS, NULL, 0.0, n);
|
||||||
|
|
||||||
/* neat: you can add a whole lot of these to a unit, they stack */
|
/* neat: you can add a whole lot of these to a unit, they stack */
|
||||||
a_add(&du->attribs, a);
|
a_add(&du->attribs, a);
|
||||||
}
|
}
|
||||||
|
@ -580,7 +523,6 @@ int sp_mindblast_temp(fighter * fi, int level, double power, spell * sp)
|
||||||
|
|
||||||
if (reset) {
|
if (reset) {
|
||||||
unit *u;
|
unit *u;
|
||||||
|
|
||||||
for (u = b->region->units; u; u = u->next) {
|
for (u = b->region->units; u; u = u->next) {
|
||||||
freset(u, UFL_MARK);
|
freset(u, UFL_MARK);
|
||||||
}
|
}
|
||||||
|
@ -599,15 +541,10 @@ int sp_mindblast_temp(fighter * fi, int level, double power, spell * sp)
|
||||||
int sp_mindblast(fighter * fi, int level, double power, spell * sp)
|
int sp_mindblast(fighter * fi, int level, double power, spell * sp)
|
||||||
{
|
{
|
||||||
battle *b = fi->side->battle;
|
battle *b = fi->side->battle;
|
||||||
|
|
||||||
unit *mage = fi->unit;
|
unit *mage = fi->unit;
|
||||||
|
|
||||||
int killed = 0, k = 0, reset = 0;
|
int killed = 0, k = 0, reset = 0;
|
||||||
|
|
||||||
message *m;
|
message *m;
|
||||||
|
|
||||||
int force = lovar(power * 25);
|
int force = lovar(power * 25);
|
||||||
|
|
||||||
int enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
|
int enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
|
||||||
|
|
||||||
if (!enemies) {
|
if (!enemies) {
|
||||||
|
@ -619,7 +556,6 @@ int sp_mindblast(fighter * fi, int level, double power, spell * sp)
|
||||||
|
|
||||||
while (enemies > 0 && force > 0) {
|
while (enemies > 0 && force > 0) {
|
||||||
unit *du;
|
unit *du;
|
||||||
|
|
||||||
troop dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
|
troop dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
|
||||||
|
|
||||||
assert(dt.fighter);
|
assert(dt.fighter);
|
||||||
|
@ -632,10 +568,8 @@ int sp_mindblast(fighter * fi, int level, double power, spell * sp)
|
||||||
if (humanoidrace(du->race) && force >= du->number) {
|
if (humanoidrace(du->race) && force >= du->number) {
|
||||||
if (!is_magic_resistant(mage, du, 0)) {
|
if (!is_magic_resistant(mage, du, 0)) {
|
||||||
skill_t sk = random_skill(du, false);
|
skill_t sk = random_skill(du, false);
|
||||||
|
|
||||||
if (sk != NOSKILL) {
|
if (sk != NOSKILL) {
|
||||||
skill *sv = get_skill(du, sk);
|
skill *sv = get_skill(du, sk);
|
||||||
|
|
||||||
int n = 1 + rng_int() % 3;
|
int n = 1 + rng_int() % 3;
|
||||||
|
|
||||||
reduce_skill(du, sv, n);
|
reduce_skill(du, sv, n);
|
||||||
|
@ -658,7 +592,6 @@ int sp_mindblast(fighter * fi, int level, double power, spell * sp)
|
||||||
|
|
||||||
if (reset) {
|
if (reset) {
|
||||||
unit *u;
|
unit *u;
|
||||||
|
|
||||||
for (u = b->region->units; u; u = u->next) {
|
for (u = b->region->units; u; u = u->next) {
|
||||||
freset(u, UFL_MARK);
|
freset(u, UFL_MARK);
|
||||||
}
|
}
|
||||||
|
@ -675,15 +608,10 @@ int sp_mindblast(fighter * fi, int level, double power, spell * sp)
|
||||||
int sp_dragonodem(fighter * fi, int level, double power, spell * sp)
|
int sp_dragonodem(fighter * fi, int level, double power, spell * sp)
|
||||||
{
|
{
|
||||||
battle *b = fi->side->battle;
|
battle *b = fi->side->battle;
|
||||||
|
|
||||||
troop dt;
|
troop dt;
|
||||||
|
|
||||||
troop at;
|
troop at;
|
||||||
|
|
||||||
int force, enemies;
|
int force, enemies;
|
||||||
|
|
||||||
int killed = 0;
|
int killed = 0;
|
||||||
|
|
||||||
const char *damage;
|
const char *damage;
|
||||||
|
|
||||||
/* 11-26 HP */
|
/* 11-26 HP */
|
||||||
|
@ -726,15 +654,10 @@ int sp_dragonodem(fighter * fi, int level, double power, spell * sp)
|
||||||
int sp_immolation(fighter * fi, int level, double power, spell * sp)
|
int sp_immolation(fighter * fi, int level, double power, spell * sp)
|
||||||
{
|
{
|
||||||
battle *b = fi->side->battle;
|
battle *b = fi->side->battle;
|
||||||
|
|
||||||
troop at;
|
troop at;
|
||||||
|
|
||||||
int force, qi, killed = 0;
|
int force, qi, killed = 0;
|
||||||
|
|
||||||
const char *damage;
|
const char *damage;
|
||||||
|
|
||||||
quicklist *fgs, *ql;
|
quicklist *fgs, *ql;
|
||||||
|
|
||||||
message *m;
|
message *m;
|
||||||
|
|
||||||
/* 2d4 HP */
|
/* 2d4 HP */
|
||||||
|
@ -756,9 +679,7 @@ int sp_immolation(fighter * fi, int level, double power, spell * sp)
|
||||||
fgs = fighters(b, fi->side, FIGHT_ROW, AVOID_ROW, FS_ENEMY);
|
fgs = fighters(b, fi->side, FIGHT_ROW, AVOID_ROW, FS_ENEMY);
|
||||||
for (qi = 0, ql = fgs; ql; ql_advance(&ql, &qi, 1)) {
|
for (qi = 0, ql = fgs; ql; ql_advance(&ql, &qi, 1)) {
|
||||||
fighter *df = (fighter *) ql_get(ql, qi);
|
fighter *df = (fighter *) ql_get(ql, qi);
|
||||||
|
|
||||||
int n = df->alive - df->removed;
|
int n = df->alive - df->removed;
|
||||||
|
|
||||||
troop dt;
|
troop dt;
|
||||||
|
|
||||||
dt.fighter = df;
|
dt.fighter = df;
|
||||||
|
@ -784,19 +705,12 @@ int sp_immolation(fighter * fi, int level, double power, spell * sp)
|
||||||
int sp_drainodem(fighter * fi, int level, double power, spell * sp)
|
int sp_drainodem(fighter * fi, int level, double power, spell * sp)
|
||||||
{
|
{
|
||||||
battle *b = fi->side->battle;
|
battle *b = fi->side->battle;
|
||||||
|
|
||||||
troop dt;
|
troop dt;
|
||||||
|
|
||||||
troop at;
|
troop at;
|
||||||
|
|
||||||
int force, enemies;
|
int force, enemies;
|
||||||
|
|
||||||
int drained = 0;
|
int drained = 0;
|
||||||
|
|
||||||
int killed = 0;
|
int killed = 0;
|
||||||
|
|
||||||
const char *damage;
|
const char *damage;
|
||||||
|
|
||||||
message *m;
|
message *m;
|
||||||
|
|
||||||
/* 11-26 HP */
|
/* 11-26 HP */
|
||||||
|
@ -841,19 +755,13 @@ int sp_drainodem(fighter * fi, int level, double power, spell * sp)
|
||||||
int sp_shadowcall(fighter * fi, int level, double power, spell * sp)
|
int sp_shadowcall(fighter * fi, int level, double power, spell * sp)
|
||||||
{
|
{
|
||||||
battle *b = fi->side->battle;
|
battle *b = fi->side->battle;
|
||||||
|
|
||||||
region *r = b->region;
|
region *r = b->region;
|
||||||
|
|
||||||
unit *mage = fi->unit;
|
unit *mage = fi->unit;
|
||||||
|
|
||||||
attrib *a;
|
attrib *a;
|
||||||
|
|
||||||
int force = (int)(get_force(power, 3) / 2);
|
int force = (int)(get_force(power, 3) / 2);
|
||||||
|
|
||||||
unit *u;
|
unit *u;
|
||||||
const char *races[3] = { "shadowbat", "nightmare", "vampunicorn" };
|
const char *races[3] = { "shadowbat", "nightmare", "vampunicorn" };
|
||||||
const race *rc = rc_find(races[rng_int() % 3]);
|
const race *rc = rc_find(races[rng_int() % 3]);
|
||||||
|
|
||||||
message *msg;
|
message *msg;
|
||||||
|
|
||||||
unused(sp);
|
unused(sp);
|
||||||
|
@ -882,17 +790,11 @@ int sp_shadowcall(fighter * fi, int level, double power, spell * sp)
|
||||||
int sp_wolfhowl(fighter * fi, int level, double power, spell * sp)
|
int sp_wolfhowl(fighter * fi, int level, double power, spell * sp)
|
||||||
{
|
{
|
||||||
battle *b = fi->side->battle;
|
battle *b = fi->side->battle;
|
||||||
|
|
||||||
region *r = b->region;
|
region *r = b->region;
|
||||||
|
|
||||||
unit *mage = fi->unit;
|
unit *mage = fi->unit;
|
||||||
|
|
||||||
attrib *a;
|
attrib *a;
|
||||||
|
|
||||||
message *msg;
|
message *msg;
|
||||||
|
|
||||||
int force = (int)(get_force(power, 3) / 2);
|
int force = (int)(get_force(power, 3) / 2);
|
||||||
|
|
||||||
unit *u =
|
unit *u =
|
||||||
create_unit(r, mage->faction, force, new_race[RC_WOLF], 0, NULL, mage);
|
create_unit(r, mage->faction, force, new_race[RC_WOLF], 0, NULL, mage);
|
||||||
unused(sp);
|
unused(sp);
|
||||||
|
@ -926,22 +828,15 @@ int sp_wolfhowl(fighter * fi, int level, double power, spell * sp)
|
||||||
int sp_shadowknights(fighter * fi, int level, double power, spell * sp)
|
int sp_shadowknights(fighter * fi, int level, double power, spell * sp)
|
||||||
{
|
{
|
||||||
unit *u;
|
unit *u;
|
||||||
|
|
||||||
battle *b = fi->side->battle;
|
battle *b = fi->side->battle;
|
||||||
|
|
||||||
region *r = b->region;
|
region *r = b->region;
|
||||||
|
|
||||||
unit *mage = fi->unit;
|
unit *mage = fi->unit;
|
||||||
|
|
||||||
attrib *a;
|
attrib *a;
|
||||||
|
|
||||||
int force = MAX(1, (int)get_force(power, 3));
|
int force = MAX(1, (int)get_force(power, 3));
|
||||||
|
|
||||||
message *msg;
|
message *msg;
|
||||||
|
|
||||||
unused(sp);
|
unused(sp);
|
||||||
|
|
||||||
|
|
||||||
u =
|
u =
|
||||||
create_unit(r, mage->faction, force, new_race[RC_SHADOWKNIGHT], 0, NULL,
|
create_unit(r, mage->faction, force, new_race[RC_SHADOWKNIGHT], 0, NULL,
|
||||||
mage);
|
mage);
|
||||||
|
@ -970,19 +865,12 @@ int sp_shadowknights(fighter * fi, int level, double power, spell * sp)
|
||||||
int sp_strong_wall(fighter * fi, int level, double power, spell * sp)
|
int sp_strong_wall(fighter * fi, int level, double power, spell * sp)
|
||||||
{
|
{
|
||||||
battle *b = fi->side->battle;
|
battle *b = fi->side->battle;
|
||||||
|
|
||||||
unit *mage = fi->unit;
|
unit *mage = fi->unit;
|
||||||
|
|
||||||
building *burg;
|
building *burg;
|
||||||
|
|
||||||
double effect;
|
double effect;
|
||||||
|
|
||||||
static boolean init = false;
|
static boolean init = false;
|
||||||
|
|
||||||
message *msg;
|
message *msg;
|
||||||
|
|
||||||
static const curse_type *strongwall_ct;
|
static const curse_type *strongwall_ct;
|
||||||
|
|
||||||
if (!init) {
|
if (!init) {
|
||||||
init = true;
|
init = true;
|
||||||
strongwall_ct = ct_find("strongwall");
|
strongwall_ct = ct_find("strongwall");
|
||||||
|
@ -1012,15 +900,10 @@ int sp_strong_wall(fighter * fi, int level, double power, spell * sp)
|
||||||
int sp_chaosrow(fighter * fi, int level, double power, spell * sp)
|
int sp_chaosrow(fighter * fi, int level, double power, spell * sp)
|
||||||
{
|
{
|
||||||
battle *b = fi->side->battle;
|
battle *b = fi->side->battle;
|
||||||
|
|
||||||
unit *mage = fi->unit;
|
unit *mage = fi->unit;
|
||||||
|
|
||||||
quicklist *fgs, *ql;
|
quicklist *fgs, *ql;
|
||||||
|
|
||||||
message *m;
|
message *m;
|
||||||
|
|
||||||
const char *mtype;
|
const char *mtype;
|
||||||
|
|
||||||
int qi, k = 0;
|
int qi, k = 0;
|
||||||
|
|
||||||
if (!count_enemies(b, fi, FIGHT_ROW, NUMROWS, SELECT_ADVANCE | SELECT_FIND)) {
|
if (!count_enemies(b, fi, FIGHT_ROW, NUMROWS, SELECT_ADVANCE | SELECT_FIND)) {
|
||||||
|
@ -1040,7 +923,6 @@ int sp_chaosrow(fighter * fi, int level, double power, spell * sp)
|
||||||
|
|
||||||
for (qi = 0, ql = fgs; ql; ql_advance(&ql, &qi, 1)) {
|
for (qi = 0, ql = fgs; ql; ql_advance(&ql, &qi, 1)) {
|
||||||
fighter *df = (fighter *) ql_get(ql, qi);
|
fighter *df = (fighter *) ql_get(ql, qi);
|
||||||
|
|
||||||
int n = df->unit->number;
|
int n = df->unit->number;
|
||||||
|
|
||||||
if (df->alive == 0)
|
if (df->alive == 0)
|
||||||
|
@ -1054,7 +936,6 @@ int sp_chaosrow(fighter * fi, int level, double power, spell * sp)
|
||||||
|
|
||||||
if (chance(power / n)) {
|
if (chance(power / n)) {
|
||||||
int row = statusrow(df->status);
|
int row = statusrow(df->status);
|
||||||
|
|
||||||
df->side->size[row] -= df->alive;
|
df->side->size[row] -= df->alive;
|
||||||
if (df->unit->race->battle_flags & BF_NOBLOCK) {
|
if (df->unit->race->battle_flags & BF_NOBLOCK) {
|
||||||
df->side->nonblockers[row] -= df->alive;
|
df->side->nonblockers[row] -= df->alive;
|
||||||
|
@ -1104,15 +985,10 @@ int sp_chaosrow(fighter * fi, int level, double power, spell * sp)
|
||||||
int sp_flee(fighter * fi, int level, double power, spell * sp)
|
int sp_flee(fighter * fi, int level, double power, spell * sp)
|
||||||
{
|
{
|
||||||
battle *b = fi->side->battle;
|
battle *b = fi->side->battle;
|
||||||
|
|
||||||
unit *mage = fi->unit;
|
unit *mage = fi->unit;
|
||||||
|
|
||||||
quicklist *fgs, *ql;
|
quicklist *fgs, *ql;
|
||||||
|
|
||||||
int force, n, qi;
|
int force, n, qi;
|
||||||
|
|
||||||
int panik = 0;
|
int panik = 0;
|
||||||
|
|
||||||
message *msg;
|
message *msg;
|
||||||
|
|
||||||
switch (sp->id) {
|
switch (sp->id) {
|
||||||
|
@ -1173,15 +1049,10 @@ int sp_flee(fighter * fi, int level, double power, spell * sp)
|
||||||
int sp_hero(fighter * fi, int level, double power, spell * sp)
|
int sp_hero(fighter * fi, int level, double power, spell * sp)
|
||||||
{
|
{
|
||||||
battle *b = fi->side->battle;
|
battle *b = fi->side->battle;
|
||||||
|
|
||||||
int df_bonus = 0;
|
int df_bonus = 0;
|
||||||
|
|
||||||
int force = 0;
|
int force = 0;
|
||||||
|
|
||||||
int allies;
|
int allies;
|
||||||
|
|
||||||
int targets = 0;
|
int targets = 0;
|
||||||
|
|
||||||
message *m;
|
message *m;
|
||||||
|
|
||||||
switch (sp->id) {
|
switch (sp->id) {
|
||||||
|
@ -1203,9 +1074,7 @@ int sp_hero(fighter * fi, int level, double power, spell * sp)
|
||||||
|
|
||||||
while (force && allies) {
|
while (force && allies) {
|
||||||
troop dt = select_ally(fi, FIGHT_ROW, BEHIND_ROW, ALLY_ANY);
|
troop dt = select_ally(fi, FIGHT_ROW, BEHIND_ROW, ALLY_ANY);
|
||||||
|
|
||||||
fighter *df = dt.fighter;
|
fighter *df = dt.fighter;
|
||||||
|
|
||||||
--allies;
|
--allies;
|
||||||
|
|
||||||
if (df) {
|
if (df) {
|
||||||
|
@ -1229,17 +1098,11 @@ int sp_hero(fighter * fi, int level, double power, spell * sp)
|
||||||
int sp_berserk(fighter * fi, int level, double power, spell * sp)
|
int sp_berserk(fighter * fi, int level, double power, spell * sp)
|
||||||
{
|
{
|
||||||
battle *b = fi->side->battle;
|
battle *b = fi->side->battle;
|
||||||
|
|
||||||
int at_bonus = 0;
|
int at_bonus = 0;
|
||||||
|
|
||||||
int df_malus = 0;
|
int df_malus = 0;
|
||||||
|
|
||||||
int force = 0;
|
int force = 0;
|
||||||
|
|
||||||
int allies = 0;
|
int allies = 0;
|
||||||
|
|
||||||
int targets = 0;
|
int targets = 0;
|
||||||
|
|
||||||
message *m;
|
message *m;
|
||||||
|
|
||||||
switch (sp->id) {
|
switch (sp->id) {
|
||||||
|
@ -1264,9 +1127,7 @@ int sp_berserk(fighter * fi, int level, double power, spell * sp)
|
||||||
|
|
||||||
while (force && allies) {
|
while (force && allies) {
|
||||||
troop dt = select_ally(fi, FIGHT_ROW, BEHIND_ROW - 1, ALLY_ANY);
|
troop dt = select_ally(fi, FIGHT_ROW, BEHIND_ROW - 1, ALLY_ANY);
|
||||||
|
|
||||||
fighter *df = dt.fighter;
|
fighter *df = dt.fighter;
|
||||||
|
|
||||||
--allies;
|
--allies;
|
||||||
|
|
||||||
if (df) {
|
if (df) {
|
||||||
|
@ -1291,19 +1152,12 @@ int sp_berserk(fighter * fi, int level, double power, spell * sp)
|
||||||
int sp_frighten(fighter * fi, int level, double power, spell * sp)
|
int sp_frighten(fighter * fi, int level, double power, spell * sp)
|
||||||
{
|
{
|
||||||
battle *b = fi->side->battle;
|
battle *b = fi->side->battle;
|
||||||
|
|
||||||
unit *mage = fi->unit;
|
unit *mage = fi->unit;
|
||||||
|
|
||||||
int at_malus = 0;
|
int at_malus = 0;
|
||||||
|
|
||||||
int df_malus = 0;
|
int df_malus = 0;
|
||||||
|
|
||||||
int force = 0;
|
int force = 0;
|
||||||
|
|
||||||
int enemies = 0;
|
int enemies = 0;
|
||||||
|
|
||||||
int targets = 0;
|
int targets = 0;
|
||||||
|
|
||||||
message *m;
|
message *m;
|
||||||
|
|
||||||
at_malus = MAX(1, level - 4);
|
at_malus = MAX(1, level - 4);
|
||||||
|
@ -1321,9 +1175,7 @@ int sp_frighten(fighter * fi, int level, double power, spell * sp)
|
||||||
|
|
||||||
while (force && enemies) {
|
while (force && enemies) {
|
||||||
troop dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW - 1, SELECT_ADVANCE);
|
troop dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW - 1, SELECT_ADVANCE);
|
||||||
|
|
||||||
fighter *df = dt.fighter;
|
fighter *df = dt.fighter;
|
||||||
|
|
||||||
--enemies;
|
--enemies;
|
||||||
|
|
||||||
if (!df)
|
if (!df)
|
||||||
|
@ -1350,17 +1202,12 @@ int sp_frighten(fighter * fi, int level, double power, spell * sp)
|
||||||
return level;
|
return level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int sp_tiredsoldiers(fighter * fi, int level, double power, spell * sp)
|
int sp_tiredsoldiers(fighter * fi, int level, double power, spell * sp)
|
||||||
{
|
{
|
||||||
battle *b = fi->side->battle;
|
battle *b = fi->side->battle;
|
||||||
|
|
||||||
unit *mage = fi->unit;
|
unit *mage = fi->unit;
|
||||||
|
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
int force = (int)(power * power * 4);
|
int force = (int)(power * power * 4);
|
||||||
|
|
||||||
message *m;
|
message *m;
|
||||||
|
|
||||||
if (!count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW,
|
if (!count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW,
|
||||||
|
@ -1374,7 +1221,6 @@ int sp_tiredsoldiers(fighter * fi, int level, double power, spell * sp)
|
||||||
|
|
||||||
while (force) {
|
while (force) {
|
||||||
troop t = select_enemy(fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
|
troop t = select_enemy(fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
|
||||||
|
|
||||||
fighter *df = t.fighter;
|
fighter *df = t.fighter;
|
||||||
|
|
||||||
if (!df)
|
if (!df)
|
||||||
|
@ -1400,11 +1246,8 @@ int sp_tiredsoldiers(fighter * fi, int level, double power, spell * sp)
|
||||||
int sp_windshield(fighter * fi, int level, double power, spell * sp)
|
int sp_windshield(fighter * fi, int level, double power, spell * sp)
|
||||||
{
|
{
|
||||||
battle *b = fi->side->battle;
|
battle *b = fi->side->battle;
|
||||||
|
|
||||||
int force, at_malus;
|
int force, at_malus;
|
||||||
|
|
||||||
int enemies;
|
int enemies;
|
||||||
|
|
||||||
message *m;
|
message *m;
|
||||||
|
|
||||||
switch (sp->id) {
|
switch (sp->id) {
|
||||||
|
@ -1427,9 +1270,7 @@ int sp_windshield(fighter * fi, int level, double power, spell * sp)
|
||||||
|
|
||||||
while (force && enemies) {
|
while (force && enemies) {
|
||||||
troop dt = select_enemy(fi, BEHIND_ROW, BEHIND_ROW, SELECT_ADVANCE);
|
troop dt = select_enemy(fi, BEHIND_ROW, BEHIND_ROW, SELECT_ADVANCE);
|
||||||
|
|
||||||
fighter *df = dt.fighter;
|
fighter *df = dt.fighter;
|
||||||
|
|
||||||
--enemies;
|
--enemies;
|
||||||
|
|
||||||
if (!df)
|
if (!df)
|
||||||
|
@ -1452,7 +1293,6 @@ int sp_windshield(fighter * fi, int level, double power, spell * sp)
|
||||||
int sp_reeling_arrows(fighter * fi, int level, double power, spell * sp)
|
int sp_reeling_arrows(fighter * fi, int level, double power, spell * sp)
|
||||||
{
|
{
|
||||||
battle *b = fi->side->battle;
|
battle *b = fi->side->battle;
|
||||||
|
|
||||||
message *m;
|
message *m;
|
||||||
|
|
||||||
unused(power);
|
unused(power);
|
||||||
|
@ -1470,11 +1310,8 @@ int sp_denyattack(fighter * fi, int level, double power, spell * sp)
|
||||||
* eine Nachbarregion, wobei ein NACH berücksichtigt wird. Ansonsten
|
* eine Nachbarregion, wobei ein NACH berücksichtigt wird. Ansonsten
|
||||||
* bleibt er stehen und nimmt nicht weiter am Kampf teil. */
|
* bleibt er stehen und nimmt nicht weiter am Kampf teil. */
|
||||||
battle *b = fi->side->battle;
|
battle *b = fi->side->battle;
|
||||||
|
|
||||||
unit *mage = fi->unit;
|
unit *mage = fi->unit;
|
||||||
|
|
||||||
region *r = b->region;
|
region *r = b->region;
|
||||||
|
|
||||||
message *m;
|
message *m;
|
||||||
|
|
||||||
unused(power);
|
unused(power);
|
||||||
|
@ -1505,9 +1342,7 @@ int sp_denyattack(fighter * fi, int level, double power, spell * sp)
|
||||||
static void do_meffect(fighter * af, int typ, int effect, int duration)
|
static void do_meffect(fighter * af, int typ, int effect, int duration)
|
||||||
{
|
{
|
||||||
battle *b = af->side->battle;
|
battle *b = af->side->battle;
|
||||||
|
|
||||||
meffect *me = (meffect *) malloc(sizeof(struct meffect));
|
meffect *me = (meffect *) malloc(sizeof(struct meffect));
|
||||||
|
|
||||||
ql_push(&b->meffects, me);
|
ql_push(&b->meffects, me);
|
||||||
me->magician = af;
|
me->magician = af;
|
||||||
me->typ = typ;
|
me->typ = typ;
|
||||||
|
@ -1518,11 +1353,8 @@ static void do_meffect(fighter * af, int typ, int effect, int duration)
|
||||||
int sp_armorshield(fighter * fi, int level, double power, spell * sp)
|
int sp_armorshield(fighter * fi, int level, double power, spell * sp)
|
||||||
{
|
{
|
||||||
int effect;
|
int effect;
|
||||||
|
|
||||||
int duration;
|
int duration;
|
||||||
|
|
||||||
battle *b = fi->side->battle;
|
battle *b = fi->side->battle;
|
||||||
|
|
||||||
message *m = msg_message("cast_spell_effect", "mage spell", fi->unit, sp);
|
message *m = msg_message("cast_spell_effect", "mage spell", fi->unit, sp);
|
||||||
|
|
||||||
message_all(b, m);
|
message_all(b, m);
|
||||||
|
@ -1547,13 +1379,9 @@ int sp_armorshield(fighter * fi, int level, double power, spell * sp)
|
||||||
int sp_reduceshield(fighter * fi, int level, double power, spell * sp)
|
int sp_reduceshield(fighter * fi, int level, double power, spell * sp)
|
||||||
{
|
{
|
||||||
int effect;
|
int effect;
|
||||||
|
|
||||||
int duration;
|
int duration;
|
||||||
|
|
||||||
battle *b = fi->side->battle;
|
battle *b = fi->side->battle;
|
||||||
|
|
||||||
message *m = msg_message("cast_spell_effect", "mage spell", fi->unit, sp);
|
message *m = msg_message("cast_spell_effect", "mage spell", fi->unit, sp);
|
||||||
|
|
||||||
message_all(b, m);
|
message_all(b, m);
|
||||||
msg_release(m);
|
msg_release(m);
|
||||||
|
|
||||||
|
@ -1577,11 +1405,8 @@ int sp_reduceshield(fighter * fi, int level, double power, spell * sp)
|
||||||
int sp_fumbleshield(fighter * fi, int level, double power, spell * sp)
|
int sp_fumbleshield(fighter * fi, int level, double power, spell * sp)
|
||||||
{
|
{
|
||||||
int effect;
|
int effect;
|
||||||
|
|
||||||
int duration;
|
int duration;
|
||||||
|
|
||||||
battle *b = fi->side->battle;
|
battle *b = fi->side->battle;
|
||||||
|
|
||||||
message *m = msg_message("cast_spell_effect", "mage spell", fi->unit, sp);
|
message *m = msg_message("cast_spell_effect", "mage spell", fi->unit, sp);
|
||||||
|
|
||||||
message_all(b, m);
|
message_all(b, m);
|
||||||
|
@ -1612,7 +1437,6 @@ int sp_fumbleshield(fighter * fi, int level, double power, spell * sp)
|
||||||
static int count_healable(battle * b, fighter * df)
|
static int count_healable(battle * b, fighter * df)
|
||||||
{
|
{
|
||||||
side *s;
|
side *s;
|
||||||
|
|
||||||
int healable = 0;
|
int healable = 0;
|
||||||
|
|
||||||
for (s = b->sides; s != b->sides + b->nsides; ++s) {
|
for (s = b->sides; s != b->sides + b->nsides; ++s) {
|
||||||
|
@ -1627,17 +1451,11 @@ static int count_healable(battle * b, fighter * df)
|
||||||
int sp_reanimate(fighter * fi, int level, double power, spell * sp)
|
int sp_reanimate(fighter * fi, int level, double power, spell * sp)
|
||||||
{
|
{
|
||||||
battle *b = fi->side->battle;
|
battle *b = fi->side->battle;
|
||||||
|
|
||||||
unit *mage = fi->unit;
|
unit *mage = fi->unit;
|
||||||
|
|
||||||
int healable, j = 0;
|
int healable, j = 0;
|
||||||
|
|
||||||
double c = 0.50 + 0.02 * power;
|
double c = 0.50 + 0.02 * power;
|
||||||
|
|
||||||
double k = EFFECT_HEALING_SPELL * power;
|
double k = EFFECT_HEALING_SPELL * power;
|
||||||
|
|
||||||
boolean use_item = get_item(mage, I_AMULET_OF_HEALING) > 0;
|
boolean use_item = get_item(mage, I_AMULET_OF_HEALING) > 0;
|
||||||
|
|
||||||
message *msg;
|
message *msg;
|
||||||
|
|
||||||
if (use_item) {
|
if (use_item) {
|
||||||
|
@ -1649,7 +1467,6 @@ int sp_reanimate(fighter * fi, int level, double power, spell * sp)
|
||||||
healable = (int)MIN(k, healable);
|
healable = (int)MIN(k, healable);
|
||||||
while (healable--) {
|
while (healable--) {
|
||||||
fighter *tf = select_corpse(b, fi);
|
fighter *tf = select_corpse(b, fi);
|
||||||
|
|
||||||
if (tf != NULL && tf->side->casualties > 0
|
if (tf != NULL && tf->side->casualties > 0
|
||||||
&& tf->unit->race != new_race[RC_DAEMON]
|
&& tf->unit->race != new_race[RC_DAEMON]
|
||||||
&& (chance(c))) {
|
&& (chance(c))) {
|
||||||
|
@ -1690,7 +1507,6 @@ int sp_reanimate(fighter * fi, int level, double power, spell * sp)
|
||||||
int sp_keeploot(fighter * fi, int level, double power, spell * sp)
|
int sp_keeploot(fighter * fi, int level, double power, spell * sp)
|
||||||
{
|
{
|
||||||
battle *b = fi->side->battle;
|
battle *b = fi->side->battle;
|
||||||
|
|
||||||
message *m = msg_message("cast_spell_effect", "mage spell", fi->unit, sp);
|
message *m = msg_message("cast_spell_effect", "mage spell", fi->unit, sp);
|
||||||
|
|
||||||
message_all(b, m);
|
message_all(b, m);
|
||||||
|
@ -1704,7 +1520,6 @@ int sp_keeploot(fighter * fi, int level, double power, spell * sp)
|
||||||
static int heal_fighters(quicklist * fgs, int *power, boolean heal_monsters)
|
static int heal_fighters(quicklist * fgs, int *power, boolean heal_monsters)
|
||||||
{
|
{
|
||||||
int healhp = *power, healed = 0, qi;
|
int healhp = *power, healed = 0, qi;
|
||||||
|
|
||||||
quicklist *ql;
|
quicklist *ql;
|
||||||
|
|
||||||
for (qi = 0, ql = fgs; ql; ql_advance(&ql, &qi, 1)) {
|
for (qi = 0, ql = fgs; ql; ql_advance(&ql, &qi, 1)) {
|
||||||
|
@ -1720,18 +1535,15 @@ static int heal_fighters(quicklist * fgs, int *power, boolean heal_monsters)
|
||||||
/* wir heilen erstmal keine Monster */
|
/* wir heilen erstmal keine Monster */
|
||||||
if (heal_monsters || playerrace(df->unit->race)) {
|
if (heal_monsters || playerrace(df->unit->race)) {
|
||||||
int n, hp = df->unit->hp / df->unit->number;
|
int n, hp = df->unit->hp / df->unit->number;
|
||||||
|
|
||||||
int rest = df->unit->hp % df->unit->number;
|
int rest = df->unit->hp % df->unit->number;
|
||||||
|
|
||||||
for (n = 0; n < df->unit->number; n++) {
|
for (n = 0; n < df->unit->number; n++) {
|
||||||
int wound = hp - df->person[n].hp;
|
int wound = hp - df->person[n].hp;
|
||||||
|
|
||||||
if (rest > n)
|
if (rest > n)
|
||||||
++wound;
|
++wound;
|
||||||
|
|
||||||
if (wound > 0 && wound < hp) {
|
if (wound > 0 && wound < hp) {
|
||||||
int heal = MIN(healhp, wound);
|
int heal = MIN(healhp, wound);
|
||||||
|
|
||||||
assert(heal >= 0);
|
assert(heal >= 0);
|
||||||
df->person[n].hp += heal;
|
df->person[n].hp += heal;
|
||||||
healhp = MAX(0, healhp - heal);
|
healhp = MAX(0, healhp - heal);
|
||||||
|
@ -1750,17 +1562,11 @@ static int heal_fighters(quicklist * fgs, int *power, boolean heal_monsters)
|
||||||
int sp_healing(fighter * fi, int level, double power, spell * sp)
|
int sp_healing(fighter * fi, int level, double power, spell * sp)
|
||||||
{
|
{
|
||||||
battle *b = fi->side->battle;
|
battle *b = fi->side->battle;
|
||||||
|
|
||||||
unit *mage = fi->unit;
|
unit *mage = fi->unit;
|
||||||
|
|
||||||
int j = 0;
|
int j = 0;
|
||||||
|
|
||||||
int healhp = (int)power * 200;
|
int healhp = (int)power * 200;
|
||||||
|
|
||||||
quicklist *fgs;
|
quicklist *fgs;
|
||||||
|
|
||||||
message *msg;
|
message *msg;
|
||||||
|
|
||||||
boolean use_item = get_item(mage, I_AMULET_OF_HEALING) > 0;
|
boolean use_item = get_item(mage, I_AMULET_OF_HEALING) > 0;
|
||||||
|
|
||||||
/* bis zu 11 Personen pro Stufe (einen HP müssen sie ja noch
|
/* bis zu 11 Personen pro Stufe (einen HP müssen sie ja noch
|
||||||
|
@ -1798,19 +1604,12 @@ int sp_healing(fighter * fi, int level, double power, spell * sp)
|
||||||
int sp_undeadhero(fighter * fi, int level, double power, spell * sp)
|
int sp_undeadhero(fighter * fi, int level, double power, spell * sp)
|
||||||
{
|
{
|
||||||
battle *b = fi->side->battle;
|
battle *b = fi->side->battle;
|
||||||
|
|
||||||
unit *mage = fi->unit;
|
unit *mage = fi->unit;
|
||||||
|
|
||||||
region *r = b->region;
|
region *r = b->region;
|
||||||
|
|
||||||
quicklist *fgs, *ql;
|
quicklist *fgs, *ql;
|
||||||
|
|
||||||
int qi, n, undead = 0;
|
int qi, n, undead = 0;
|
||||||
|
|
||||||
message *msg;
|
message *msg;
|
||||||
|
|
||||||
int force = (int)get_force(power, 0);
|
int force = (int)get_force(power, 0);
|
||||||
|
|
||||||
double c = 0.50 + 0.02 * power;
|
double c = 0.50 + 0.02 * power;
|
||||||
|
|
||||||
/* Liste aus allen Kämpfern */
|
/* Liste aus allen Kämpfern */
|
||||||
|
@ -1819,7 +1618,6 @@ int sp_undeadhero(fighter * fi, int level, double power, spell * sp)
|
||||||
|
|
||||||
for (qi = 0, ql = fgs; ql; ql_advance(&ql, &qi, 1)) {
|
for (qi = 0, ql = fgs; ql; ql_advance(&ql, &qi, 1)) {
|
||||||
fighter *df = (fighter *) ql_get(ql, qi);
|
fighter *df = (fighter *) ql_get(ql, qi);
|
||||||
|
|
||||||
unit *du = df->unit;
|
unit *du = df->unit;
|
||||||
|
|
||||||
if (force <= 0)
|
if (force <= 0)
|
||||||
|
|
|
@ -62,7 +62,6 @@ static struct curse_type ct_godcursezone = {
|
||||||
cinfo_cursed_by_the_gods,
|
cinfo_cursed_by_the_gods,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------- */
|
||||||
/*
|
/*
|
||||||
* C_GBDREAM
|
* C_GBDREAM
|
||||||
|
@ -136,9 +135,7 @@ cansee_antimagiczone(const struct faction *viewer, const void *obj, typ_t typ,
|
||||||
const curse * c, int self)
|
const curse * c, int self)
|
||||||
{
|
{
|
||||||
region *r;
|
region *r;
|
||||||
|
|
||||||
unit *u = NULL;
|
unit *u = NULL;
|
||||||
|
|
||||||
unit *mage = c->magician;
|
unit *mage = c->magician;
|
||||||
|
|
||||||
unused(typ);
|
unused(typ);
|
||||||
|
@ -188,7 +185,6 @@ static struct curse_type ct_farvision = {
|
||||||
cinfo_farvision
|
cinfo_farvision
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------- */
|
||||||
|
|
||||||
static struct curse_type ct_fogtrap = {
|
static struct curse_type ct_fogtrap = {
|
||||||
|
@ -283,7 +279,6 @@ static struct curse_type ct_healing = {
|
||||||
cinfo_simple
|
cinfo_simple
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void register_regioncurse(void)
|
void register_regioncurse(void)
|
||||||
{
|
{
|
||||||
ct_register(&ct_fogtrap);
|
ct_register(&ct_fogtrap);
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
||||||
message *cinfo_ship(const void *obj, typ_t typ, const curse * c, int self)
|
message *cinfo_ship(const void *obj, typ_t typ, const curse * c, int self)
|
||||||
{
|
{
|
||||||
message *msg;
|
message *msg;
|
||||||
|
@ -79,7 +78,6 @@ static struct curse_type ct_stormwind = { "stormwind",
|
||||||
static int flyingship_read(storage * store, curse * c, void *target)
|
static int flyingship_read(storage * store, curse * c, void *target)
|
||||||
{
|
{
|
||||||
ship *sh = (ship *) target;
|
ship *sh = (ship *) target;
|
||||||
|
|
||||||
c->data.v = sh;
|
c->data.v = sh;
|
||||||
if (store->version < FOSS_VERSION) {
|
if (store->version < FOSS_VERSION) {
|
||||||
sh->flags |= SF_FLYING;
|
sh->flags |= SF_FLYING;
|
||||||
|
@ -93,7 +91,6 @@ static int flyingship_write(storage * store, const curse * c,
|
||||||
const void *target)
|
const void *target)
|
||||||
{
|
{
|
||||||
const ship *sh = (const ship *)target;
|
const ship *sh = (const ship *)target;
|
||||||
|
|
||||||
assert(sh->flags & SF_FLYING);
|
assert(sh->flags & SF_FLYING);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -101,7 +98,6 @@ static int flyingship_write(storage * store, const curse * c,
|
||||||
static int flyingship_age(curse * c)
|
static int flyingship_age(curse * c)
|
||||||
{
|
{
|
||||||
ship *sh = (ship *) c->data.v;
|
ship *sh = (ship *) c->data.v;
|
||||||
|
|
||||||
if (sh && c->duration == 1) {
|
if (sh && c->duration == 1) {
|
||||||
freset(sh, SF_FLYING);
|
freset(sh, SF_FLYING);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -125,7 +121,6 @@ static struct curse_type ct_shipspeedup = { "shipspeedup",
|
||||||
curse *shipcurse_flyingship(ship * sh, unit * mage, double power, int duration)
|
curse *shipcurse_flyingship(ship * sh, unit * mage, double power, int duration)
|
||||||
{
|
{
|
||||||
static const curse_type *ct_flyingship = NULL;
|
static const curse_type *ct_flyingship = NULL;
|
||||||
|
|
||||||
if (!ct_flyingship) {
|
if (!ct_flyingship) {
|
||||||
ct_flyingship = ct_find("flyingship");
|
ct_flyingship = ct_find("flyingship");
|
||||||
assert(ct_flyingship);
|
assert(ct_flyingship);
|
||||||
|
@ -149,7 +144,6 @@ curse *shipcurse_flyingship(ship * sh, unit * mage, double power, int duration)
|
||||||
int levitate_ship(ship * sh, unit * mage, double power, int duration)
|
int levitate_ship(ship * sh, unit * mage, double power, int duration)
|
||||||
{
|
{
|
||||||
curse *c = shipcurse_flyingship(sh, mage, power, duration);
|
curse *c = shipcurse_flyingship(sh, mage, power, duration);
|
||||||
|
|
||||||
if (c) {
|
if (c) {
|
||||||
return c->no;
|
return c->no;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -47,7 +47,6 @@ static message *cinfo_auraboost(const void *obj, typ_t typ, const curse * c,
|
||||||
int self)
|
int self)
|
||||||
{
|
{
|
||||||
struct unit *u = (struct unit *)obj;
|
struct unit *u = (struct unit *)obj;
|
||||||
|
|
||||||
unused(typ);
|
unused(typ);
|
||||||
assert(typ == TYP_UNIT);
|
assert(typ == TYP_UNIT);
|
||||||
|
|
||||||
|
@ -81,7 +80,6 @@ static message *cinfo_slave(const void *obj, typ_t typ, const curse * c,
|
||||||
int self)
|
int self)
|
||||||
{
|
{
|
||||||
unit *u;
|
unit *u;
|
||||||
|
|
||||||
unused(typ);
|
unused(typ);
|
||||||
|
|
||||||
assert(typ == TYP_UNIT);
|
assert(typ == TYP_UNIT);
|
||||||
|
@ -111,12 +109,10 @@ static message *cinfo_calm(const void *obj, typ_t typ, const curse * c,
|
||||||
|
|
||||||
if (c->magician && c->magician->faction) {
|
if (c->magician && c->magician->faction) {
|
||||||
faction *f = c->magician->faction;
|
faction *f = c->magician->faction;
|
||||||
|
|
||||||
unit *u = (unit *) obj;
|
unit *u = (unit *) obj;
|
||||||
|
|
||||||
if (f == NULL || self == 0) {
|
if (f == NULL || self == 0) {
|
||||||
const struct race *rc = u_irace(c->magician);
|
const struct race *rc = u_irace(c->magician);
|
||||||
|
|
||||||
return msg_message("curseinfo::calm_0", "unit race id", u, rc, c->no);
|
return msg_message("curseinfo::calm_0", "unit race id", u, rc, c->no);
|
||||||
}
|
}
|
||||||
return msg_message("curseinfo::calm_1", "unit faction id", u, f, c->no);
|
return msg_message("curseinfo::calm_1", "unit faction id", u, f, c->no);
|
||||||
|
@ -142,7 +138,6 @@ static message *cinfo_speed(const void *obj, typ_t typ, const curse * c,
|
||||||
|
|
||||||
if (self != 0) {
|
if (self != 0) {
|
||||||
unit *u = (unit *) obj;
|
unit *u = (unit *) obj;
|
||||||
|
|
||||||
return msg_message("curseinfo::speed_1", "unit number duration id", u,
|
return msg_message("curseinfo::speed_1", "unit number duration id", u,
|
||||||
c->data.i, c->duration, c->no);
|
c->data.i, c->duration, c->no);
|
||||||
}
|
}
|
||||||
|
@ -166,7 +161,6 @@ message *cinfo_unit(const void *obj, typ_t typ, const curse * c, int self)
|
||||||
|
|
||||||
if (self != 0) {
|
if (self != 0) {
|
||||||
unit *u = (unit *) obj;
|
unit *u = (unit *) obj;
|
||||||
|
|
||||||
return msg_message(mkname("curseinfo", c->type->cname), "unit id", u,
|
return msg_message(mkname("curseinfo", c->type->cname), "unit id", u,
|
||||||
c->no);
|
c->no);
|
||||||
}
|
}
|
||||||
|
@ -191,7 +185,6 @@ static message *cinfo_kaelteschutz(const void *obj, typ_t typ, const curse * c,
|
||||||
|
|
||||||
if (self != 0) {
|
if (self != 0) {
|
||||||
unit *u = (unit *) obj;
|
unit *u = (unit *) obj;
|
||||||
|
|
||||||
return msg_message("curseinfo::warmth_1", "unit number id", u,
|
return msg_message("curseinfo::warmth_1", "unit number id", u,
|
||||||
get_cursedmen(u, c), c->no);
|
get_cursedmen(u, c), c->no);
|
||||||
}
|
}
|
||||||
|
@ -238,9 +231,7 @@ static message *cinfo_sparkle(const void *obj, typ_t typ, const curse * c,
|
||||||
NULL, /* end draig */
|
NULL, /* end draig */
|
||||||
};
|
};
|
||||||
int m, begin = 0, end = 0;
|
int m, begin = 0, end = 0;
|
||||||
|
|
||||||
unit *u;
|
unit *u;
|
||||||
|
|
||||||
unused(typ);
|
unused(typ);
|
||||||
|
|
||||||
assert(typ == TYP_UNIT);
|
assert(typ == TYP_UNIT);
|
||||||
|
@ -262,7 +253,6 @@ static message *cinfo_sparkle(const void *obj, typ_t typ, const curse * c,
|
||||||
return NULL;
|
return NULL;
|
||||||
else {
|
else {
|
||||||
int index = begin + curse_geteffect_int(c) % (end - begin);
|
int index = begin + curse_geteffect_int(c) % (end - begin);
|
||||||
|
|
||||||
return msg_message(mkname("curseinfo", effects[index]), "unit id", u,
|
return msg_message(mkname("curseinfo", effects[index]), "unit id", u,
|
||||||
c->no);
|
c->no);
|
||||||
}
|
}
|
||||||
|
@ -306,7 +296,6 @@ static struct curse_type ct_fumble = {
|
||||||
|
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
static struct curse_type ct_oldrace = {
|
static struct curse_type ct_oldrace = {
|
||||||
"oldrace", CURSETYP_NORM, CURSE_SPREADALWAYS, NO_MERGE, NULL
|
"oldrace", CURSETYP_NORM, CURSE_SPREADALWAYS, NO_MERGE, NULL
|
||||||
};
|
};
|
||||||
|
@ -315,7 +304,6 @@ static struct curse_type ct_magicresistance = {
|
||||||
"magicresistance", CURSETYP_UNIT, CURSE_SPREADMODULO, M_MEN, cinfo_simple
|
"magicresistance", CURSETYP_UNIT, CURSE_SPREADMODULO, M_MEN, cinfo_simple
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
/*
|
/*
|
||||||
* C_SKILL
|
* C_SKILL
|
||||||
|
@ -324,10 +312,8 @@ static struct curse_type ct_magicresistance = {
|
||||||
static int read_skill(struct storage *store, curse * c, void *target)
|
static int read_skill(struct storage *store, curse * c, void *target)
|
||||||
{
|
{
|
||||||
int skill;
|
int skill;
|
||||||
|
|
||||||
if (store->version < CURSETYPE_VERSION) {
|
if (store->version < CURSETYPE_VERSION) {
|
||||||
int men;
|
int men;
|
||||||
|
|
||||||
skill = store->r_int(store);
|
skill = store->r_int(store);
|
||||||
men = store->r_int(store);
|
men = store->r_int(store);
|
||||||
} else {
|
} else {
|
||||||
|
@ -351,9 +337,7 @@ static message *cinfo_skillmod(const void *obj, typ_t typ, const curse * c,
|
||||||
|
|
||||||
if (self != 0) {
|
if (self != 0) {
|
||||||
unit *u = (unit *) obj;
|
unit *u = (unit *) obj;
|
||||||
|
|
||||||
int sk = c->data.i;
|
int sk = c->data.i;
|
||||||
|
|
||||||
if (c->effect > 0) {
|
if (c->effect > 0) {
|
||||||
return msg_message("curseinfo::skill_1", "unit skill id", u, sk, c->no);
|
return msg_message("curseinfo::skill_1", "unit skill id", u, sk, c->no);
|
||||||
} else if (c->effect < 0) {
|
} else if (c->effect < 0) {
|
||||||
|
|
Loading…
Reference in New Issue