forked from github/server
healing potion works once per battle with 100%
This commit is contained in:
parent
61d93b7931
commit
afdd20c4dd
|
@ -7293,8 +7293,8 @@
|
||||||
<type>
|
<type>
|
||||||
<arg name="unit" type="unit"/>
|
<arg name="unit" type="unit"/>
|
||||||
</type>
|
</type>
|
||||||
<text locale="de">"$unit($unit) konnte durch einen Heiltrank überleben."</text>
|
<text locale="de">"Eine Person von $unit($unit) konnte durch einen Heiltrank überleben."</text>
|
||||||
<text locale="en">"$unit($unit) was saved by a healing potion."</text>
|
<text locale="en">"A fighter of $unit($unit) was saved by a healing potion."</text>
|
||||||
</message>
|
</message>
|
||||||
<message name="battle::tactics_lost" section="battle">
|
<message name="battle::tactics_lost" section="battle">
|
||||||
<type>
|
<type>
|
||||||
|
|
33
src/battle.c
33
src/battle.c
|
@ -1156,7 +1156,6 @@ terminate(troop dt, troop at, int type, const char *damage, bool missile)
|
||||||
unit *au = af->unit;
|
unit *au = af->unit;
|
||||||
unit *du = df->unit;
|
unit *du = df->unit;
|
||||||
battle *b = df->side->battle;
|
battle *b = df->side->battle;
|
||||||
int heiltrank = 0;
|
|
||||||
|
|
||||||
/* Schild */
|
/* Schild */
|
||||||
side *ds = df->side;
|
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) {
|
if (rda>0) {
|
||||||
df->person[dt.index].hp -= rda;
|
df->person[dt.index].hp -= rda;
|
||||||
if (u_race(au) == get_race(RC_DAEMON)) {
|
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].defence--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
df->person[dt.index].flags = (df->person[dt.index].flags & ~FL_SLEEPING);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sieben Leben */
|
/* Sieben Leben */
|
||||||
if (u_race(du) == get_race(RC_CAT) && (chance(1.0 / 7))) {
|
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);
|
df->person[dt.index].hp = unit_max_hp(du);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Heiltrank schluerfen und hoffen */
|
/* Heiltrank schluerfen und hoffen */
|
||||||
if (oldpotiontype[P_HEAL]) {
|
if (oldpotiontype[P_HEAL] && i_get(du->items, oldpotiontype[P_HEAL]->itype) > 0 && !fval(&df->person[dt.index], FL_HEALING_USED)) {
|
||||||
if (get_effect(du, oldpotiontype[P_HEAL]) > 0) {
|
i_change(&du->items, oldpotiontype[P_HEAL]->itype, -1);
|
||||||
change_effect(du, oldpotiontype[P_HEAL], -1);
|
message *m = msg_message("battle::potionsave", "unit", du);
|
||||||
heiltrank = 1;
|
message_faction(b, du->faction, m);
|
||||||
}
|
msg_release(m);
|
||||||
else if (i_get(du->items, oldpotiontype[P_HEAL]->itype) > 0) {
|
fset(&df->person[dt.index], FL_HEALING_USED);
|
||||||
i_change(&du->items, oldpotiontype[P_HEAL]->itype, -1);
|
df->person[dt.index].hp = u_race(du)->hitpoints*5;
|
||||||
change_effect(du, oldpotiontype[P_HEAL], 3);
|
return false;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
++at.fighter->kills;
|
++at.fighter->kills;
|
||||||
|
|
||||||
|
|
|
@ -137,6 +137,7 @@ extern "C" {
|
||||||
#define FL_SLEEPING 16
|
#define FL_SLEEPING 16
|
||||||
#define FL_STUNNED 32 /* eine Runde keinen Angriff */
|
#define FL_STUNNED 32 /* eine Runde keinen Angriff */
|
||||||
#define FL_HIT 64 /* the person at attacked */
|
#define FL_HIT 64 /* the person at attacked */
|
||||||
|
#define FL_HEALING_USED 128 /* has used a healing potion */
|
||||||
|
|
||||||
typedef struct troop {
|
typedef struct troop {
|
||||||
struct fighter *fighter;
|
struct fighter *fighter;
|
||||||
|
|
Loading…
Reference in New Issue