forked from github/server
Bergwächter können auch ohne Waffen bewachen.
This commit is contained in:
parent
56a28511a4
commit
97342e5b81
10 changed files with 204 additions and 172 deletions
|
@ -1195,7 +1195,7 @@ can_guard(const unit * guard, const unit * u)
|
||||||
{
|
{
|
||||||
if (fval(guard, UFL_ISNEW)) return false;
|
if (fval(guard, UFL_ISNEW)) return false;
|
||||||
if (guard->number<=0 || !cansee(guard->faction, guard->region, u, 0)) return false;
|
if (guard->number<=0 || !cansee(guard->faction, guard->region, u, 0)) return false;
|
||||||
if (besieged(guard) || !armedmen(guard)) return false;
|
if (besieged(guard) || !(fval(guard->race, RCF_UNARMEDGUARD) || armedmen(guard))) return false;
|
||||||
|
|
||||||
return !alliedunit(guard, u->faction, HELP_GUARD);
|
return !alliedunit(guard, u->faction, HELP_GUARD);
|
||||||
}
|
}
|
||||||
|
@ -1208,92 +1208,91 @@ enum {
|
||||||
static void
|
static void
|
||||||
allocate_resource(unit * u, const resource_type * rtype, int want)
|
allocate_resource(unit * u, const resource_type * rtype, int want)
|
||||||
{
|
{
|
||||||
const item_type * itype = resource2item(rtype);
|
const item_type * itype = resource2item(rtype);
|
||||||
region * r = u->region;
|
region * r = u->region;
|
||||||
int busy = u->number;
|
int busy = u->number;
|
||||||
int dm = 0;
|
int dm = 0;
|
||||||
allocation_list * alist;
|
allocation_list * alist;
|
||||||
allocation * al;
|
allocation * al;
|
||||||
attrib * a = a_find(rtype->attribs, &at_resourcelimit);
|
attrib * a = a_find(rtype->attribs, &at_resourcelimit);
|
||||||
resource_limit * rdata = (resource_limit*)a->data.v;
|
resource_limit * rdata = (resource_limit*)a->data.v;
|
||||||
int amount, skill;
|
int amount, skill;
|
||||||
|
|
||||||
/* momentan kann man keine ressourcen abbauen, wenn man dafür
|
/* momentan kann man keine ressourcen abbauen, wenn man dafür
|
||||||
* Materialverbrauch hat: */
|
* Materialverbrauch hat: */
|
||||||
assert(itype!=NULL && (itype->construction==NULL || itype->construction->materials==NULL));
|
assert(itype!=NULL && (itype->construction==NULL || itype->construction->materials==NULL));
|
||||||
assert(rdata!=NULL);
|
assert(rdata!=NULL);
|
||||||
|
|
||||||
if (rdata->limit!=NULL) {
|
if (rdata->limit!=NULL) {
|
||||||
int avail = rdata->limit(r, rtype);
|
int avail = rdata->limit(r, rtype);
|
||||||
if (avail<=0) {
|
if (avail<=0) {
|
||||||
cmistake(u, u->thisorder, 121, MSG_PRODUCE);
|
cmistake(u, u->thisorder, 121, MSG_PRODUCE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itype == olditemtype[I_LAEN]) {
|
if (itype == olditemtype[I_LAEN]) {
|
||||||
struct building * b = inside_building(u);
|
struct building * b = inside_building(u);
|
||||||
const struct building_type * btype = b?b->type:NULL;
|
const struct building_type * btype = b?b->type:NULL;
|
||||||
if (btype != bt_find("mine")) {
|
if (btype != bt_find("mine")) {
|
||||||
cmistake(u, u->thisorder, 104, MSG_PRODUCE);
|
cmistake(u, u->thisorder, 104, MSG_PRODUCE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (besieged(u)) {
|
if (besieged(u)) {
|
||||||
cmistake(u, u->thisorder, 60, MSG_PRODUCE);
|
cmistake(u, u->thisorder, 60, MSG_PRODUCE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rdata->guard!=0) {
|
if (rdata->guard!=0) {
|
||||||
unit * u2;
|
unit * u2;
|
||||||
for (u2 = r->units; u2; u2 = u2->next) {
|
for (u2 = r->units; u2; u2 = u2->next) {
|
||||||
if ((getguard(u2) & rdata->guard) && can_guard(u2, u)) {
|
if ((getguard(u2) & rdata->guard) && can_guard(u2, u)) {
|
||||||
ADDMSG(&u->faction->msgs,
|
ADDMSG(&u->faction->msgs,
|
||||||
msg_feedback(u, u->thisorder, "region_guarded", "guard", u2));
|
msg_feedback(u, u->thisorder, "region_guarded", "guard", u2));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Bergwächter können Abbau von Eisen/Laen durch Bewachen verhindern.
|
/* Bergwächter können Abbau von Eisen/Laen durch Bewachen verhindern.
|
||||||
* Als magische Wesen 'sehen' Bergwächter alles und werden durch
|
* Als magische Wesen 'sehen' Bergwächter alles und werden durch
|
||||||
* Belagerung nicht aufgehalten. (Ansonsten wie oben bei Elfen anpassen).
|
* Belagerung nicht aufgehalten. (Ansonsten wie oben bei Elfen anpassen).
|
||||||
*/
|
*/
|
||||||
if (itype == olditemtype[I_IRON] || itype == olditemtype[I_LAEN]) {
|
if (itype == olditemtype[I_IRON] || itype == olditemtype[I_LAEN]) {
|
||||||
unit * u2;
|
unit * u2;
|
||||||
for (u2 = r->units; u2; u2 = u2->next ) {
|
for (u2 = r->units; u2; u2 = u2->next ) {
|
||||||
if (getguard(u) & GUARD_MINING
|
if (getguard(u) & GUARD_MINING
|
||||||
&& !fval(u2, UFL_ISNEW)
|
&& !fval(u2, UFL_ISNEW)
|
||||||
&& u2->number
|
&& u2->number
|
||||||
&& !alliedunit(u2, u->faction, HELP_GUARD))
|
&& !alliedunit(u2, u->faction, HELP_GUARD))
|
||||||
{
|
{
|
||||||
ADDMSG(&u->faction->msgs,
|
ADDMSG(&u->faction->msgs,
|
||||||
msg_feedback(u, u->thisorder, "region_guarded", "guard", u2));
|
msg_feedback(u, u->thisorder, "region_guarded", "guard", u2));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(itype->construction->skill!=0 || "limited resource needs a required skill for making it");
|
assert(itype->construction->skill!=0 || "limited resource needs a required skill for making it");
|
||||||
skill = eff_skill(u, itype->construction->skill, u->region);
|
skill = eff_skill(u, itype->construction->skill, u->region);
|
||||||
if (skill == 0) {
|
if (skill == 0) {
|
||||||
skill_t sk = itype->construction->skill;
|
skill_t sk = itype->construction->skill;
|
||||||
add_message(&u->faction->msgs,
|
add_message(&u->faction->msgs,
|
||||||
msg_feedback(u, u->thisorder, "skill_needed", "skill", sk));
|
msg_feedback(u, u->thisorder, "skill_needed", "skill", sk));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (skill < itype->construction->minskill) {
|
if (skill < itype->construction->minskill) {
|
||||||
skill_t sk = itype->construction->skill;
|
skill_t sk = itype->construction->skill;
|
||||||
add_message(&u->faction->msgs,
|
add_message(&u->faction->msgs,
|
||||||
msg_feedback(u, u->thisorder, "manufacture_skills", "skill minskill product",
|
msg_feedback(u, u->thisorder, "manufacture_skills", "skill minskill product",
|
||||||
sk, itype->construction->minskill, itype->rtype));
|
sk, itype->construction->minskill, itype->rtype));
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
struct building * b = inside_building(u);
|
struct building * b = inside_building(u);
|
||||||
const struct building_type * btype = b?b->type:NULL;
|
const struct building_type * btype = b?b->type:NULL;
|
||||||
|
|
||||||
if (rdata->modifiers) {
|
if (rdata->modifiers) {
|
||||||
resource_mod * mod = rdata->modifiers;
|
resource_mod * mod = rdata->modifiers;
|
||||||
for (;mod->flags!=0;++mod) {
|
for (;mod->flags!=0;++mod) {
|
||||||
|
@ -1306,51 +1305,51 @@ allocate_resource(unit * u, const resource_type * rtype, int want)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (itype == olditemtype[I_IRON] && btype == bt_find("mine")) {
|
} else if (itype == olditemtype[I_IRON] && btype == bt_find("mine")) {
|
||||||
++skill;
|
++skill;
|
||||||
}
|
}
|
||||||
else if (itype == olditemtype[I_STONE] && btype == bt_find("quarry")) {
|
else if (itype == olditemtype[I_STONE] && btype == bt_find("quarry")) {
|
||||||
++skill;
|
++skill;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
amount = skill * u->number;
|
amount = skill * u->number;
|
||||||
/* nun ist amount die Gesamtproduktion der Einheit (in punkten) */
|
/* nun ist amount die Gesamtproduktion der Einheit (in punkten) */
|
||||||
|
|
||||||
/* mit Flinkfingerring verzehnfacht sich die Produktion */
|
/* mit Flinkfingerring verzehnfacht sich die Produktion */
|
||||||
amount += skill * min(u->number, get_item(u,I_RING_OF_NIMBLEFINGER)) * 9;
|
amount += skill * min(u->number, get_item(u,I_RING_OF_NIMBLEFINGER)) * 9;
|
||||||
|
|
||||||
/* Schaffenstrunk: */
|
/* Schaffenstrunk: */
|
||||||
if ((dm = get_effect(u, oldpotiontype[P_DOMORE])) != 0) {
|
if ((dm = get_effect(u, oldpotiontype[P_DOMORE])) != 0) {
|
||||||
dm = min(dm, u->number);
|
dm = min(dm, u->number);
|
||||||
change_effect(u, oldpotiontype[P_DOMORE], -dm);
|
change_effect(u, oldpotiontype[P_DOMORE], -dm);
|
||||||
amount += dm * skill; /* dm Personen produzieren doppelt */
|
amount += dm * skill; /* dm Personen produzieren doppelt */
|
||||||
}
|
}
|
||||||
|
|
||||||
amount /= itype->construction->minskill;
|
amount /= itype->construction->minskill;
|
||||||
|
|
||||||
/* Limitierung durch Parameter m. */
|
/* Limitierung durch Parameter m. */
|
||||||
if (want > 0 && want < amount) amount = want;
|
if (want > 0 && want < amount) amount = want;
|
||||||
|
|
||||||
busy = (amount + skill - 1) / skill; /* wieviel leute tun etwas? */
|
busy = (amount + skill - 1) / skill; /* wieviel leute tun etwas? */
|
||||||
|
|
||||||
alist = allocations;
|
alist = allocations;
|
||||||
while (alist && alist->type!=rtype) alist = alist->next;
|
while (alist && alist->type!=rtype) alist = alist->next;
|
||||||
if (!alist) {
|
if (!alist) {
|
||||||
alist = calloc(sizeof(struct allocation_list), 1);
|
alist = calloc(sizeof(struct allocation_list), 1);
|
||||||
alist->next = allocations;
|
alist->next = allocations;
|
||||||
alist->type = rtype;
|
alist->type = rtype;
|
||||||
allocations = alist;
|
allocations = alist;
|
||||||
}
|
}
|
||||||
al = new_allocation();
|
al = new_allocation();
|
||||||
al->want = amount;
|
al->want = amount;
|
||||||
al->save = 1.0;
|
al->save = 1.0;
|
||||||
al->next = alist->data;
|
al->next = alist->data;
|
||||||
al->unit = u;
|
al->unit = u;
|
||||||
alist->data = al;
|
alist->data = al;
|
||||||
|
|
||||||
if (rdata->modifiers) {
|
if (rdata->modifiers) {
|
||||||
struct building * b = inside_building(u);
|
struct building * b = inside_building(u);
|
||||||
const struct building_type * btype = b?b->type:NULL;
|
const struct building_type * btype = b?b->type:NULL;
|
||||||
|
|
||||||
resource_mod * mod = rdata->modifiers;
|
resource_mod * mod = rdata->modifiers;
|
||||||
for (;mod->flags!=0;++mod) {
|
for (;mod->flags!=0;++mod) {
|
||||||
if (mod->flags & RMF_SAVEMATERIAL) {
|
if (mod->flags & RMF_SAVEMATERIAL) {
|
||||||
|
@ -1362,21 +1361,21 @@ allocate_resource(unit * u, const resource_type * rtype, int want)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (itype==olditemtype[I_IRON]) {
|
} else if (itype==olditemtype[I_IRON]) {
|
||||||
struct building * b = inside_building(u);
|
struct building * b = inside_building(u);
|
||||||
const struct building_type * btype = b?b->type:NULL;
|
const struct building_type * btype = b?b->type:NULL;
|
||||||
if (btype==bt_find("mine"))
|
if (btype==bt_find("mine"))
|
||||||
al->save *= 0.5;
|
al->save *= 0.5;
|
||||||
if (u->race == new_race[RC_DWARF]) {
|
if (u->race == new_race[RC_DWARF]) {
|
||||||
al->save *= 0.75;
|
al->save *= 0.75;
|
||||||
}
|
}
|
||||||
} else if (itype==olditemtype[I_STONE]) {
|
} else if (itype==olditemtype[I_STONE]) {
|
||||||
struct building * b = inside_building(u);
|
struct building * b = inside_building(u);
|
||||||
const struct building_type * btype = b?b->type:NULL;
|
const struct building_type * btype = b?b->type:NULL;
|
||||||
if (btype==bt_find("quarry"))
|
if (btype==bt_find("quarry"))
|
||||||
al->save = al->save*0.5;
|
al->save = al->save*0.5;
|
||||||
if (u->race == new_race[RC_TROLL])
|
if (u->race == new_race[RC_TROLL])
|
||||||
al->save = al->save*0.75;
|
al->save = al->save*0.75;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
|
@ -2547,17 +2547,31 @@ combatspell_cmd(unit * u, struct order * ord)
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
/* Beachten: einige Monster sollen auch unbewaffent die Region bewachen
|
/* Beachten: einige Monster sollen auch unbewaffent die Region bewachen
|
||||||
* können */
|
* können */
|
||||||
|
|
||||||
|
enum { E_GUARD_OK, E_GUARD_UNARMED, E_GUARD_NEWBIE };
|
||||||
|
|
||||||
|
static int
|
||||||
|
can_start_guarding(const unit * u)
|
||||||
|
{
|
||||||
|
if (fval(u->race, RCF_UNARMEDGUARD)) return E_GUARD_OK;
|
||||||
|
if (!armedmen(u)) return E_GUARD_UNARMED;
|
||||||
|
if (u->faction->age < NewbieImmunity()) return E_GUARD_NEWBIE;
|
||||||
|
return E_GUARD_OK;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
update_guards(void)
|
update_guards(void)
|
||||||
{
|
{
|
||||||
region *r;
|
const region *r;
|
||||||
unit *u;
|
|
||||||
|
|
||||||
for (r = regions; r; r = r->next)
|
for (r = regions; r; r = r->next) {
|
||||||
|
unit *u;
|
||||||
for (u = r->units; u; u = u->next) {
|
for (u = r->units; u; u = u->next) {
|
||||||
if (getguard(u) && (!armedmen(u) || u->faction->age < NewbieImmunity()))
|
if (can_start_guarding(u)!=E_GUARD_OK) {
|
||||||
setguard(u, GUARD_NONE);
|
setguard(u, GUARD_NONE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -2582,12 +2596,15 @@ guard_on_cmd(unit * u, struct order * ord)
|
||||||
/* Monster der Monsterpartei dürfen immer bewachen */
|
/* Monster der Monsterpartei dürfen immer bewachen */
|
||||||
if (u->faction == findfaction(MONSTER_FACTION)) {
|
if (u->faction == findfaction(MONSTER_FACTION)) {
|
||||||
guard(u, GUARD_ALL);
|
guard(u, GUARD_ALL);
|
||||||
} else if (!armedmen(u)) {
|
|
||||||
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "unit_unarmed", ""));
|
|
||||||
} else if (u->faction->age < NewbieImmunity()) {
|
|
||||||
cmistake(u, ord, 304, MSG_EVENT);
|
|
||||||
} else {
|
} else {
|
||||||
guard(u, GUARD_ALL);
|
int err = can_start_guarding(u);
|
||||||
|
if (err==E_GUARD_UNARMED) {
|
||||||
|
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "unit_unarmed", ""));
|
||||||
|
} else if (err==E_GUARD_NEWBIE) {
|
||||||
|
cmistake(u, ord, 304, MSG_EVENT);
|
||||||
|
} else {
|
||||||
|
guard(u, GUARD_ALL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -850,13 +850,13 @@ bewegung_blockiert_von(unit * reisender, region * r)
|
||||||
static boolean
|
static boolean
|
||||||
is_guardian(unit * u2, unit *u, unsigned int mask)
|
is_guardian(unit * u2, unit *u, unsigned int mask)
|
||||||
{
|
{
|
||||||
if (u2->faction == u->faction) return false;
|
if (u2->faction == u->faction) return false;
|
||||||
if ((getguard(u2) & mask) == 0) return false;
|
if ((getguard(u2) & mask) == 0) return false;
|
||||||
if (u2->number == 0) return false;
|
if (u2->number == 0) return false;
|
||||||
if (alliedunit(u2, u->faction, HELP_GUARD)) return false;
|
if (alliedunit(u2, u->faction, HELP_GUARD)) return false;
|
||||||
if (ucontact(u2, u)) return false;
|
if (ucontact(u2, u)) return false;
|
||||||
if (besieged(u2)) return false;
|
if (besieged(u2)) return false;
|
||||||
if (!armedmen(u2)) return false;
|
if (!armedmen(u2) && !fval(u2->race, RCF_UNARMEDGUARD)) return false;
|
||||||
if (!cansee(u2->faction, u->region, u, 0)) return false;
|
if (!cansee(u2->faction, u->region, u, 0)) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -865,11 +865,11 @@ is_guardian(unit * u2, unit *u, unsigned int mask)
|
||||||
unit *
|
unit *
|
||||||
is_guarded(region * r, unit * u, unsigned int mask)
|
is_guarded(region * r, unit * u, unsigned int mask)
|
||||||
{
|
{
|
||||||
unit *u2;
|
unit *u2;
|
||||||
|
|
||||||
for (u2 = r->units; u2; u2 = u2->next)
|
for (u2 = r->units; u2; u2 = u2->next)
|
||||||
if (is_guardian(u2, u, mask)) return u2;
|
if (is_guardian(u2, u, mask)) return u2;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *shortdirections[MAXDIRECTIONS] =
|
static const char *shortdirections[MAXDIRECTIONS] =
|
||||||
|
|
|
@ -118,23 +118,24 @@ extern int rc_specialdamage(const race *, const race *, const struct weapon_type
|
||||||
|
|
||||||
#define RCF_MOVERANDOM (1<<4)
|
#define RCF_MOVERANDOM (1<<4)
|
||||||
#define RCF_CANNOTMOVE (1<<5)
|
#define RCF_CANNOTMOVE (1<<5)
|
||||||
#define RCF_LEARN (1<<6) /* Lernt automatisch wenn struct faction == 0 */
|
#define RCF_LEARN (1<<6) /* Lernt automatisch wenn struct faction == 0 */
|
||||||
#define RCF_FLY (1<<7) /* kann fliegen */
|
#define RCF_FLY (1<<7) /* kann fliegen */
|
||||||
#define RCF_SWIM (1<<8) /* kann schwimmen */
|
#define RCF_SWIM (1<<8) /* kann schwimmen */
|
||||||
#define RCF_WALK (1<<9) /* kann über Land gehen */
|
#define RCF_WALK (1<<9) /* kann über Land gehen */
|
||||||
#define RCF_NOLEARN (1<<10) /* kann nicht normal lernen */
|
#define RCF_NOLEARN (1<<10) /* kann nicht normal lernen */
|
||||||
#define RCF_NOTEACH (1<<11) /* kann nicht lehren */
|
#define RCF_NOTEACH (1<<11) /* kann nicht lehren */
|
||||||
#define RCF_HORSE (1<<12) /* Einheit ist Pferd, sozusagen */
|
#define RCF_HORSE (1<<12) /* Einheit ist Pferd, sozusagen */
|
||||||
#define RCF_DESERT (1<<13) /* 5% Chance, das Einheit desertiert */
|
#define RCF_DESERT (1<<13) /* 5% Chance, das Einheit desertiert */
|
||||||
#define RCF_ILLUSIONARY (1<<14) /* (Illusion & Spell) Does not drop items. */
|
#define RCF_ILLUSIONARY (1<<14) /* (Illusion & Spell) Does not drop items. */
|
||||||
#define RCF_ABSORBPEASANTS (1<<15) /* Tötet und absorbiert Bauern */
|
#define RCF_ABSORBPEASANTS (1<<15) /* Tötet und absorbiert Bauern */
|
||||||
#define RCF_NOHEAL (1<<16) /* Einheit kann nicht geheilt werden */
|
#define RCF_NOHEAL (1<<16) /* Einheit kann nicht geheilt werden */
|
||||||
#define RCF_NOWEAPONS (1<<17) /* Einheit kann keine Waffen benutzen */
|
#define RCF_NOWEAPONS (1<<17) /* Einheit kann keine Waffen benutzen */
|
||||||
#define RCF_SHAPESHIFT (1<<18) /* Kann TARNE RASSE benutzen. */
|
#define RCF_SHAPESHIFT (1<<18) /* Kann TARNE RASSE benutzen. */
|
||||||
#define RCF_SHAPESHIFTANY (1<<19) /* Kann TARNE RASSE "string" benutzen. */
|
#define RCF_SHAPESHIFTANY (1<<19) /* Kann TARNE RASSE "string" benutzen. */
|
||||||
#define RCF_UNDEAD (1<<20) /* Undead. */
|
#define RCF_UNDEAD (1<<20) /* Undead. */
|
||||||
#define RCF_DRAGON (1<<21) /* Drachenart (für Zauber)*/
|
#define RCF_DRAGON (1<<21) /* Drachenart (für Zauber)*/
|
||||||
#define RCF_COASTAL (1<<22) /* kann in Landregionen an der Küste sein */
|
#define RCF_COASTAL (1<<22) /* kann in Landregionen an der Küste sein */
|
||||||
|
#define RCF_UNARMEDGUARD (1<<23) /* kann ohne Waffen bewachen */
|
||||||
|
|
||||||
/* Economic flags */
|
/* Economic flags */
|
||||||
#define NOGIVE (1<<0) /* gibt niemals nix */
|
#define NOGIVE (1<<0) /* gibt niemals nix */
|
||||||
|
|
|
@ -1412,6 +1412,7 @@ parse_races(xmlDocPtr doc)
|
||||||
if (xml_bvalue(node, "cannotmove", false)) rc->flags |= RCF_CANNOTMOVE;
|
if (xml_bvalue(node, "cannotmove", false)) rc->flags |= RCF_CANNOTMOVE;
|
||||||
if (xml_bvalue(node, "fly", false)) rc->flags |= RCF_FLY;
|
if (xml_bvalue(node, "fly", false)) rc->flags |= RCF_FLY;
|
||||||
if (xml_bvalue(node, "coastal", false)) rc->flags |= RCF_COASTAL;
|
if (xml_bvalue(node, "coastal", false)) rc->flags |= RCF_COASTAL;
|
||||||
|
if (xml_bvalue(node, "unarmedguard", false)) rc->flags |= RCF_UNARMEDGUARD;
|
||||||
if (xml_bvalue(node, "swim", false)) rc->flags |= RCF_SWIM;
|
if (xml_bvalue(node, "swim", false)) rc->flags |= RCF_SWIM;
|
||||||
if (xml_bvalue(node, "walk", false)) rc->flags |= RCF_WALK;
|
if (xml_bvalue(node, "walk", false)) rc->flags |= RCF_WALK;
|
||||||
if (xml_bvalue(node, "nolearn", false)) rc->flags |= RCF_NOLEARN;
|
if (xml_bvalue(node, "nolearn", false)) rc->flags |= RCF_NOLEARN;
|
||||||
|
|
|
@ -39,6 +39,7 @@ using namespace luabind;
|
||||||
static int
|
static int
|
||||||
lua_addequipment(const char * eqname, const char * iname, const char * value)
|
lua_addequipment(const char * eqname, const char * iname, const char * value)
|
||||||
{
|
{
|
||||||
|
if (iname==NULL) return -1;
|
||||||
const struct item_type * itype = it_find(iname);
|
const struct item_type * itype = it_find(iname);
|
||||||
if (itype==NULL) return -1;
|
if (itype==NULL) return -1;
|
||||||
equipment_setitem(create_equipment(eqname), itype, value);
|
equipment_setitem(create_equipment(eqname), itype, value);
|
||||||
|
|
|
@ -161,11 +161,13 @@ faction_delete_variable(faction& f, const char *key)
|
||||||
static int
|
static int
|
||||||
faction_additem(faction& f, const char * iname, int number)
|
faction_additem(faction& f, const char * iname, int number)
|
||||||
{
|
{
|
||||||
const item_type * itype = it_find(iname);
|
if (iname!=NULL) {
|
||||||
if (itype!=NULL) {
|
const item_type * itype = it_find(iname);
|
||||||
item * i = i_change(&f.items, itype, number);
|
if (itype!=NULL) {
|
||||||
return i?i->number:0;
|
item * i = i_change(&f.items, itype, number);
|
||||||
} // if (itype!=NULL)
|
return i?i->number:0;
|
||||||
|
} // if (itype!=NULL)
|
||||||
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -296,11 +296,13 @@ region_items(const region& r) {
|
||||||
static int
|
static int
|
||||||
region_additem(region& r, const char * iname, int number)
|
region_additem(region& r, const char * iname, int number)
|
||||||
{
|
{
|
||||||
const item_type * itype = it_find(iname);
|
if (iname!=NULL) {
|
||||||
if (itype!=NULL && r.land) {
|
const item_type * itype = it_find(iname);
|
||||||
item * i = i_change(&r.land->items, itype, number);
|
if (itype!=NULL && r.land) {
|
||||||
return i?i->number:0;
|
item * i = i_change(&r.land->items, itype, number);
|
||||||
} // if (itype!=NULL)
|
return i?i->number:0;
|
||||||
|
} // if (itype!=NULL)
|
||||||
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -114,9 +114,11 @@ unit_getnumber(const unit& u)
|
||||||
static int
|
static int
|
||||||
unit_getitem(const unit& u, const char * iname)
|
unit_getitem(const unit& u, const char * iname)
|
||||||
{
|
{
|
||||||
const item_type * itype = it_find(iname);
|
if (iname!=NULL) {
|
||||||
if (itype!=NULL) {
|
const item_type * itype = it_find(iname);
|
||||||
return i_get(u.items, itype);
|
if (itype!=NULL) {
|
||||||
|
return i_get(u.items, itype);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -124,6 +126,13 @@ unit_getitem(const unit& u, const char * iname)
|
||||||
static int
|
static int
|
||||||
unit_additem(unit& u, const char * iname, int number)
|
unit_additem(unit& u, const char * iname, int number)
|
||||||
{
|
{
|
||||||
|
if (iname!=NULL) {
|
||||||
|
const item_type * itype = it_find(iname);
|
||||||
|
if (itype!=NULL) {
|
||||||
|
item * i = i_change(&u.items, itype, number);
|
||||||
|
return i?i->number:0;
|
||||||
|
} // if (itype!=NULL)
|
||||||
|
}
|
||||||
const item_type * itype = it_find(iname);
|
const item_type * itype = it_find(iname);
|
||||||
if (itype!=NULL) {
|
if (itype!=NULL) {
|
||||||
item * i = i_change(&u.items, itype, number);
|
item * i = i_change(&u.items, itype, number);
|
||||||
|
|
|
@ -644,7 +644,7 @@
|
||||||
<ai splitsize="1"/>
|
<ai splitsize="1"/>
|
||||||
<attack type="1" damage="1d4"/>
|
<attack type="1" damage="1d4"/>
|
||||||
</race>
|
</race>
|
||||||
<race name="mountainguard" magres="0.500000" maxaura="1.000000" regaura="0.500000" recruitcost="50000" weight="10000" capacity="2000" speed="0.000000" hp="1000" ac="12" damage="2d40" unarmedattack="0" unarmeddefense="0" attackmodifier="6" defensemodifier="8" cannotmove="yes" nolearn="yes" teach="no" noweapons="yes" giveitem="yes">
|
<race name="mountainguard" unarmedguard="yes" magres="0.500000" maxaura="1.000000" regaura="0.500000" recruitcost="50000" weight="10000" capacity="2000" speed="0.000000" hp="1000" ac="12" damage="2d40" unarmedattack="0" unarmeddefense="0" attackmodifier="6" defensemodifier="8" cannotmove="yes" nolearn="yes" teach="no" noweapons="yes" giveitem="yes">
|
||||||
<ai splitsize="1"/>
|
<ai splitsize="1"/>
|
||||||
<attack type="4" damage="2d40"/>
|
<attack type="4" damage="2d40"/>
|
||||||
</race>
|
</race>
|
||||||
|
|
Loading…
Reference in a new issue