forked from github/server
CURSE_ISNEW moved so that it's generally defined by the curse_type, since most spells actually start working in the same round.
This commit is contained in:
parent
af0a7b225a
commit
614aa80bdf
|
@ -69,7 +69,7 @@ attrib_type at_variable = {
|
|||
const char *
|
||||
get_variable(attrib *a, const char *key)
|
||||
{
|
||||
attrib *ap = a_find(a, &at_variable);;
|
||||
attrib *ap = a_find(a, &at_variable);
|
||||
|
||||
while (ap && ap->type==&at_variable) {
|
||||
variable * var = (variable *)ap->data.v;
|
||||
|
|
|
@ -58,6 +58,21 @@
|
|||
#define MAXENTITYHASH 7919
|
||||
curse *cursehash[MAXENTITYHASH];
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
void
|
||||
c_setflag(curse *c, unsigned int flags)
|
||||
{
|
||||
assert(c);
|
||||
c->flags = (c->flags & ~flags) | (flags & (c->type->flags ^ flags));
|
||||
}
|
||||
/* -------------------------------------------------------------------------- */
|
||||
void
|
||||
c_clearflag(curse *c, unsigned int flags)
|
||||
{
|
||||
assert(c);
|
||||
c->flags = (c->flags & ~flags) | (c->type->flags & flags);
|
||||
}
|
||||
|
||||
void
|
||||
chash(curse *c)
|
||||
{
|
||||
|
@ -139,7 +154,8 @@ curse_done(attrib * a) {
|
|||
/* ------------------------------------------------------------- */
|
||||
|
||||
int
|
||||
curse_read(attrib * a, FILE * f) {
|
||||
curse_read(attrib * a, FILE * f)
|
||||
{
|
||||
variant mageid;
|
||||
curse * c = (curse*)a->data.v;
|
||||
const curse_type * ct;
|
||||
|
@ -165,6 +181,7 @@ curse_read(attrib * a, FILE * f) {
|
|||
} else {
|
||||
c->flags = flags;
|
||||
}
|
||||
c_clearflag(c, CURSE_ISNEW);
|
||||
|
||||
#ifdef CONVERT_DBLINK
|
||||
if (global.data_version<DBLINK_VERSION) {
|
||||
|
@ -200,13 +217,15 @@ curse_read(attrib * a, FILE * f) {
|
|||
}
|
||||
|
||||
void
|
||||
curse_write(const attrib * a, FILE * f) {
|
||||
curse_write(const attrib * a, FILE * f)
|
||||
{
|
||||
unsigned int flags;
|
||||
int mage_no;
|
||||
curse * c = (curse*)a->data.v;
|
||||
const curse_type * ct = c->type;
|
||||
|
||||
flags = (c->flags & ~(CURSE_ISNEW));
|
||||
/* copied from c_clearflag */
|
||||
flags = (c->flags & ~CURSE_ISNEW) | (c->type->flags & CURSE_ISNEW);
|
||||
|
||||
if (c->magician) {
|
||||
mage_no = c->magician->no;
|
||||
|
@ -440,14 +459,6 @@ set_cursedmen(curse *c, int cursedmen)
|
|||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
void
|
||||
c_setflag(curse *c, unsigned int flags)
|
||||
{
|
||||
assert(c);
|
||||
c->flags = (c->flags & ~flags) | (flags & (c->type->flags ^ flags));
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
/* Legt eine neue Verzauberung an. Sollte es schon einen Zauber
|
||||
* dieses Typs geben, gibt es den bestehenden zurück.
|
||||
|
@ -464,7 +475,7 @@ make_curse(unit *mage, attrib **ap, const curse_type *ct, double vigour,
|
|||
c = (curse*)a->data.v;
|
||||
|
||||
c->type = ct;
|
||||
c->flags = CURSE_ISNEW;
|
||||
c->flags = 0;
|
||||
c->vigour = vigour;
|
||||
c->duration = duration;
|
||||
c->effect = effect;
|
||||
|
|
|
@ -277,7 +277,8 @@ extern int get_cursedmen(struct unit *u, struct curse *c);
|
|||
* betroffenen Personen zurück. Ansonsten wird 0 zurückgegeben. */
|
||||
|
||||
extern void c_setflag(curse * c, unsigned int flag);
|
||||
/* setzt Spezialflag einer Verzauberung (zB 'dauert ewig') */
|
||||
extern void c_clearflag(curse *c, unsigned int flags);
|
||||
/* setzt/loescht Spezialflag einer Verzauberung (zB 'dauert ewig') */
|
||||
|
||||
void transfer_curse(struct unit * u, struct unit * u2, int n);
|
||||
/* sorgt dafür, das bei der Übergabe von Personen die curse-attribute
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
static message *
|
||||
cinfo_cursed_by_the_gods(const void * obj, typ_t typ, const curse *c, int self)
|
||||
{
|
||||
region *r = (region *)obj;;
|
||||
region *r = (region *)obj;
|
||||
|
||||
unused(typ);
|
||||
unused(self);
|
||||
|
@ -58,7 +58,7 @@ cinfo_cursed_by_the_gods(const void * obj, typ_t typ, const curse *c, int self)
|
|||
|
||||
static struct curse_type ct_godcursezone = {
|
||||
"godcursezone",
|
||||
CURSETYP_NORM, CURSE_IMMUNE, (NO_MERGE),
|
||||
CURSETYP_NORM, CURSE_IMMUNE|CURSE_ISNEW, (NO_MERGE),
|
||||
"Diese Region wurde von den Göttern verflucht. Stinkende Nebel ziehen "
|
||||
"über die tote Erde, furchbare Kreaturen ziehen über das Land. Die Brunnen "
|
||||
"sind vergiftet, und die wenigen essbaren Früchte sind von einem rosa Pilz "
|
||||
|
@ -87,7 +87,7 @@ cinfo_dreamcurse(const void * obj, typ_t typ, const curse *c, int self)
|
|||
|
||||
static struct curse_type ct_gbdream = {
|
||||
"gbdream",
|
||||
CURSETYP_NORM, 0, (NO_MERGE),
|
||||
CURSETYP_NORM, CURSE_ISNEW, (NO_MERGE),
|
||||
"",
|
||||
cinfo_dreamcurse
|
||||
};
|
||||
|
@ -208,7 +208,7 @@ static struct curse_type ct_fogtrap = {
|
|||
};
|
||||
static struct curse_type ct_maelstrom = {
|
||||
"maelstrom",
|
||||
CURSETYP_NORM, 0, (M_DURATION | M_VIGOUR),
|
||||
CURSETYP_NORM, CURSE_ISNEW, (M_DURATION | M_VIGOUR),
|
||||
"Dieser Zauber verursacht einen gigantischen magischen Strudel. Der "
|
||||
"Mahlstrom wird alle Schiffe, die in seinen Sog geraten, schwer "
|
||||
"beschädigen.",
|
||||
|
@ -229,7 +229,7 @@ static struct curse_type ct_drought = {
|
|||
};
|
||||
static struct curse_type ct_badlearn = {
|
||||
"badlearn",
|
||||
CURSETYP_NORM, 0, ( M_DURATION | M_VIGOUR ),
|
||||
CURSETYP_NORM, CURSE_ISNEW, ( M_DURATION | M_VIGOUR ),
|
||||
"Dieser Zauber scheint die Ursache für die Schlaflosigkeit und "
|
||||
"Mattigkeit zu sein, unter der die meisten Leute hier leiden und "
|
||||
"die dazu führt, das Lernen weniger Erfolg bringt. ",
|
||||
|
@ -273,7 +273,7 @@ static struct curse_type ct_peacezone = {
|
|||
/* erschwert geordnete Bewegungen */
|
||||
static struct curse_type ct_disorientationzone = {
|
||||
"disorientationzone",
|
||||
CURSETYP_NORM, 0, NO_MERGE,
|
||||
CURSETYP_NORM, CURSE_ISNEW, NO_MERGE,
|
||||
"",
|
||||
cinfo_simple
|
||||
};
|
||||
|
|
|
@ -178,7 +178,7 @@ cinfo_unit(const void * obj, typ_t typ, const curse *c, int self)
|
|||
|
||||
static struct curse_type ct_orcish = {
|
||||
"orcish",
|
||||
CURSETYP_UNIT, CURSE_SPREADMODULO, M_MEN,
|
||||
CURSETYP_UNIT, CURSE_SPREADMODULO|CURSE_ISNEW, M_MEN,
|
||||
"Dieser Zauber scheint die Einheit zu 'orkisieren'. Wie bei Orks "
|
||||
"ist eine deutliche Neigung zur Fortpflanzung zu beobachten.",
|
||||
cinfo_unit
|
||||
|
|
|
@ -26,9 +26,10 @@
|
|||
#include <kernel/unit.h>
|
||||
|
||||
/* util includes */
|
||||
#include <event.h>
|
||||
#include <resolve.h>
|
||||
#include <base36.h>
|
||||
#include <util/base36.h>
|
||||
#include <util/event.h>
|
||||
#include <util/resolve.h>
|
||||
#include <util/rng.h>
|
||||
|
||||
/* libc includes */
|
||||
#include <assert.h>
|
||||
|
@ -61,7 +62,7 @@ do_shock(unit *u, const char *reason)
|
|||
}
|
||||
|
||||
/* Evt. Talenttageverlust */
|
||||
for (i=0;i!=u->skill_size;++i) if (rand()%5==0) {
|
||||
for (i=0;i!=u->skill_size;++i) if (rng_int()%5==0) {
|
||||
skill * sv = u->skills+i;
|
||||
int weeks = (sv->level * sv->level - sv->level) / 2;
|
||||
int change = (weeks+9) / 10;
|
||||
|
|
Loading…
Reference in New Issue