Merge pull request #248 from badgerman/feature/bug-1838-deathcloud-duration

Bug 1838: deathcloud duration and messages
This commit is contained in:
Enno Rehling 2015-07-03 18:32:25 +02:00
commit 40cd6b3bc4
7 changed files with 31 additions and 11 deletions

View file

@ -1182,6 +1182,24 @@
<text locale="en">"$unit($unit) drowns in $region($region)."</text>
</message>
<message name="poison_damage" section="events">
<type>
<arg name="unit" type="unit"/>
<arg name="region" type="region"/>
</type>
<text locale="de">"$unit($unit) nimmt Schaden durch den Giftelementar in $region($region)."</text>
<text locale="en">"$unit($unit) is taking poison damage in $region($region)."</text>
</message>
<message name="poison_death" section="events">
<type>
<arg name="unit" type="unit"/>
<arg name="region" type="region"/>
</type>
<text locale="de">"$unit($unit) stirbt am Schaden durch den Giftelementar in $region($region)."</text>
<text locale="en">"$unit($unit) dies from poison damage taken in $region($region)."</text>
</message>
<message name="drown_amphibian_dead" section="events">
<type>
<arg name="amount" type="int"/>

View file

@ -264,6 +264,7 @@ cr_output_curses(FILE * F, const faction * viewer, const void *obj, objtype_t ty
fprintf(F, "\"%s\"\n", buf);
msg_release(msg);
}
a = a->next;
}
else if (a->type == &at_effect && self) {
effect_data *data = (effect_data *)a->data.v;
@ -276,9 +277,12 @@ cr_output_curses(FILE * F, const faction * viewer, const void *obj, objtype_t ty
fprintf(F, "\"%d %s\"\n", data->value, translate(key,
LOC(default_locale, key)));
}
}
a = a->next;
}
else {
a = a->nexttype;
}
}
}
static int cr_unit(variant var, char *buffer, const void *userdata)

View file

@ -530,7 +530,7 @@ int alliedunit(const unit * u, const faction * f2, int mode)
ally *sf;
int automode;
assert(u->region); /* the unit should be in a region, but it's possible that u->number==0 (TEMP units) */
assert(u && u->region); /* the unit should be in a region, but it's possible that u->number==0 (TEMP units) */
if (u->faction == f2)
return mode;
if (u->faction != NULL && f2 != NULL) {

View file

@ -513,12 +513,9 @@ static curse *make_curse(unit * mage, attrib ** ap, const curse_type * ct,
break;
case CURSETYP_UNIT:
{
c->data.i = men;
break;
}
}
return c;
}

View file

@ -1281,7 +1281,7 @@ static int update_gbdream(const unit * u, int bonus, curse *c, const curse_type
/* wir suchen jeweils den groessten Bonus und den groestsen Malus */
if (sign * effect > sign * bonus) {
if (mage == NULL || mage->number == 0
|| sign>0?alliedunit(mage, u->faction, HELP_GUARD):!alliedunit(mage, u->faction, HELP_GUARD)) {
|| (sign>0?alliedunit(mage, u->faction, HELP_GUARD):!alliedunit(mage, u->faction, HELP_GUARD))) {
bonus = (int)effect;
}
}

View file

@ -2820,9 +2820,9 @@ static int dc_age(struct curse *c)
if (curse_active(c))
while (*up != NULL) {
unit *u = *up;
int hp;
double damage = c->effect * u->number;
freset(u->faction, FFL_SELECT);
if (u->number <= 0 || target_resists_magic(mage, u, TYP_UNIT, 0)) {
up = &u->next;
continue;
@ -2830,8 +2830,9 @@ static int dc_age(struct curse *c)
/* Reduziert durch Magieresistenz */
damage *= (1.0 - magic_resistance(u));
change_hitpoints(u, -(int)damage);
hp = change_hitpoints(u, -(int)damage);
ADDMSG(&u->faction->msgs, msg_message((hp>0)?"poison_damage":"poison_death", "region unit", r, u));
if (*up == u)
up = &u->next;
}

View file

@ -90,8 +90,8 @@ extern "C" {
#define AT_READ_OK 0
#define AT_READ_FAIL -1
#define AT_AGE_REMOVE 0 /* remove the attribute after calling age() */
#define AT_AGE_KEEP 1 /* keep the attribute for another turn */
#define AT_AGE_KEEP 0 /* keep the attribute for another turn */
#define AT_AGE_REMOVE 1 /* remove the attribute after calling age() */
#ifdef __cplusplus
}