forked from github/server
split out seaserpent creation for testing
This commit is contained in:
parent
61a1cfa141
commit
9a72157cf3
3 changed files with 26 additions and 8 deletions
|
@ -1,6 +1,7 @@
|
||||||
#include <platform.h>
|
#include <platform.h>
|
||||||
#include "spells/shipcurse.h"
|
#include "spells/shipcurse.h"
|
||||||
#include "monster.h"
|
#include "monster.h"
|
||||||
|
#include "monsters.h"
|
||||||
|
|
||||||
#include <kernel/equipment.h>
|
#include <kernel/equipment.h>
|
||||||
#include <kernel/faction.h>
|
#include <kernel/faction.h>
|
||||||
|
@ -28,7 +29,6 @@ static int tolua_levitate_ship(lua_State * L)
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void spawn_undead(void);
|
extern void spawn_undead(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)
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
#include <platform.h>
|
#include <platform.h>
|
||||||
#include <kernel/config.h>
|
#include <kernel/config.h>
|
||||||
|
|
||||||
|
#include "monsters.h"
|
||||||
|
|
||||||
#include "economy.h"
|
#include "economy.h"
|
||||||
#include "chaos.h"
|
#include "chaos.h"
|
||||||
#include "give.h"
|
#include "give.h"
|
||||||
|
@ -883,7 +885,16 @@ static int nrand(int start, int sub)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Drachen und Seeschlangen können entstehen */
|
unit *spawn_seaserpent(region *r, faction *f) {
|
||||||
|
unit *u = create_unit(r, f, 1, get_race(RC_SEASERPENT), 0, NULL, NULL);
|
||||||
|
fset(u, UFL_ISNEW | UFL_MOVED);
|
||||||
|
equip_unit(u, get_equipment("monster_seaserpent"));
|
||||||
|
return u;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Drachen und Seeschlangen können entstehen
|
||||||
|
*/
|
||||||
void spawn_dragons(void)
|
void spawn_dragons(void)
|
||||||
{
|
{
|
||||||
region *r;
|
region *r;
|
||||||
|
@ -892,13 +903,12 @@ void spawn_dragons(void)
|
||||||
for (r = regions; r; r = r->next) {
|
for (r = regions; r; r = r->next) {
|
||||||
unit *u;
|
unit *u;
|
||||||
|
|
||||||
if (fval(r->terrain, SEA_REGION) && rng_int() % 10000 < 1) {
|
if (fval(r->terrain, SEA_REGION)) {
|
||||||
u = create_unit(r, monsters, 1, get_race(RC_SEASERPENT), 0, NULL, NULL);
|
if (rng_int() % 10000 < 1) {
|
||||||
fset(u, UFL_ISNEW | UFL_MOVED);
|
u = spawn_seaserpent(r, monsters);
|
||||||
equip_unit(u, get_equipment("monster_seaserpent"));
|
}
|
||||||
}
|
}
|
||||||
|
else if ((r->terrain == newterrain(T_GLACIER)
|
||||||
if ((r->terrain == newterrain(T_GLACIER)
|
|
||||||
|| r->terrain == newterrain(T_SWAMP)
|
|| r->terrain == newterrain(T_SWAMP)
|
||||||
|| r->terrain == newterrain(T_DESERT))
|
|| r->terrain == newterrain(T_DESERT))
|
||||||
&& rng_int() % 10000 < (5 + 100 * chaosfactor(r))) {
|
&& rng_int() % 10000 < (5 + 100 * chaosfactor(r))) {
|
||||||
|
|
8
src/monsters.h
Normal file
8
src/monsters.h
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
struct unit;
|
||||||
|
struct region;
|
||||||
|
struct faction;
|
||||||
|
|
||||||
|
struct unit *spawn_seaserpent(struct region *r, struct faction *f);
|
||||||
|
void spawn_dragons(void);
|
Loading…
Reference in a new issue