healing potion works once per battle with 100%

This commit is contained in:
Steffen Mecke 2016-06-12 21:54:42 +02:00
parent 61d93b7931
commit afdd20c4dd
3 changed files with 12 additions and 26 deletions

View File

@ -7293,8 +7293,8 @@
<type>
<arg name="unit" type="unit"/>
</type>
<text locale="de">"$unit($unit) konnte durch einen Heiltrank überleben."</text>
<text locale="en">"$unit($unit) was saved by a healing potion."</text>
<text locale="de">"Eine Person von $unit($unit) konnte durch einen Heiltrank überleben."</text>
<text locale="en">"A fighter of $unit($unit) was saved by a healing potion."</text>
</message>
<message name="battle::tactics_lost" section="battle">
<type>

View File

@ -1156,7 +1156,6 @@ terminate(troop dt, troop at, int type, const char *damage, bool missile)
unit *au = af->unit;
unit *du = df->unit;
battle *b = df->side->battle;
int heiltrank = 0;
/* Schild */
side *ds = df->side;
@ -1289,7 +1288,7 @@ terminate(troop dt, troop at, int type, const char *damage, bool missile)
}
}
assert(dt.index < du->number);
assert(dt.index >= 0 && dt.index < du->number);
if (rda>0) {
df->person[dt.index].hp -= rda;
if (u_race(au) == get_race(RC_DAEMON)) {
@ -1314,38 +1313,24 @@ terminate(troop dt, troop at, int type, const char *damage, bool missile)
df->person[dt.index].defence--;
}
}
df->person[dt.index].flags = (df->person[dt.index].flags & ~FL_SLEEPING);
return false;
}
/* Sieben Leben */
if (u_race(du) == get_race(RC_CAT) && (chance(1.0 / 7))) {
assert(dt.index >= 0 && dt.index < du->number);
df->person[dt.index].hp = unit_max_hp(du);
return false;
}
/* Heiltrank schluerfen und hoffen */
if (oldpotiontype[P_HEAL]) {
if (get_effect(du, oldpotiontype[P_HEAL]) > 0) {
change_effect(du, oldpotiontype[P_HEAL], -1);
heiltrank = 1;
}
else if (i_get(du->items, oldpotiontype[P_HEAL]->itype) > 0) {
i_change(&du->items, oldpotiontype[P_HEAL]->itype, -1);
change_effect(du, oldpotiontype[P_HEAL], 3);
heiltrank = 1;
}
if (heiltrank && (chance(0.50))) {
{
message *m = msg_message("battle::potionsave", "unit", du);
message_faction(b, du->faction, m);
msg_release(m);
}
assert(dt.index >= 0 && dt.index < du->number);
df->person[dt.index].hp = u_race(du)->hitpoints;
return false;
}
if (oldpotiontype[P_HEAL] && i_get(du->items, oldpotiontype[P_HEAL]->itype) > 0 && !fval(&df->person[dt.index], FL_HEALING_USED)) {
i_change(&du->items, oldpotiontype[P_HEAL]->itype, -1);
message *m = msg_message("battle::potionsave", "unit", du);
message_faction(b, du->faction, m);
msg_release(m);
fset(&df->person[dt.index], FL_HEALING_USED);
df->person[dt.index].hp = u_race(du)->hitpoints*5;
return false;
}
++at.fighter->kills;

View File

@ -137,6 +137,7 @@ extern "C" {
#define FL_SLEEPING 16
#define FL_STUNNED 32 /* eine Runde keinen Angriff */
#define FL_HIT 64 /* the person at attacked */
#define FL_HEALING_USED 128 /* has used a healing potion */
typedef struct troop {
struct fighter *fighter;