forked from github/server
Exploit, Magier heilen Truppen höher als ihre HP vor dem Kampf waren.
This commit is contained in:
parent
c297b20177
commit
2dc454a5fd
|
@ -1599,6 +1599,46 @@ sp_keeploot(fighter * fi, int level, double power, spell * sp)
|
||||||
return level;
|
return level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
heal_fighters(cvector *fgs, int * power, boolean heal_monsters)
|
||||||
|
{
|
||||||
|
int healhp = *power;
|
||||||
|
int healed = 0;
|
||||||
|
void **fig;
|
||||||
|
|
||||||
|
for (fig = fgs->begin; fig != fgs->end; ++fig) {
|
||||||
|
fighter *df = *fig;
|
||||||
|
|
||||||
|
if (healhp<=0) break;
|
||||||
|
|
||||||
|
/* Untote kann man nicht heilen */
|
||||||
|
if (fval(df->unit->race, RCF_NOHEAL)) continue;
|
||||||
|
|
||||||
|
/* wir heilen erstmal keine Monster */
|
||||||
|
if (heal_monsters || playerrace(df->unit->race)) {
|
||||||
|
int n, hp = df->unit->hp / df->unit->number;
|
||||||
|
int rest = df->unit->hp % df->unit->number;
|
||||||
|
|
||||||
|
for (n = 0; n < df->unit->number; n++) {
|
||||||
|
int wound = hp - df->person[n].hp;
|
||||||
|
if (rest>n) ++wound;
|
||||||
|
|
||||||
|
if (wound > 0 && wound < hp) {
|
||||||
|
int heal = min(healhp, wound);
|
||||||
|
assert(heal>=0);
|
||||||
|
df->person[n].hp += heal;
|
||||||
|
healhp = max(0, healhp - heal);
|
||||||
|
++healed;
|
||||||
|
if (healhp<=0) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*power = healhp;
|
||||||
|
return healed;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
sp_healing(fighter * fi, int level, double power, spell * sp)
|
sp_healing(fighter * fi, int level, double power, spell * sp)
|
||||||
{
|
{
|
||||||
|
@ -1606,11 +1646,9 @@ sp_healing(fighter * fi, int level, double power, spell * sp)
|
||||||
unit *mage = fi->unit;
|
unit *mage = fi->unit;
|
||||||
int minrow = FIGHT_ROW;
|
int minrow = FIGHT_ROW;
|
||||||
int maxrow = AVOID_ROW;
|
int maxrow = AVOID_ROW;
|
||||||
int healhp;
|
int j = 0;
|
||||||
int hp, wound;
|
int healhp = (int)power;
|
||||||
int n, j = 0;
|
|
||||||
cvector *fgs;
|
cvector *fgs;
|
||||||
void **fig;
|
|
||||||
|
|
||||||
sprintf(buf, "%s kümmert sich um die Verletzten", unitname(mage));
|
sprintf(buf, "%s kümmert sich um die Verletzten", unitname(mage));
|
||||||
|
|
||||||
|
@ -1630,58 +1668,10 @@ sp_healing(fighter * fi, int level, double power, spell * sp)
|
||||||
|
|
||||||
fgs = fighters(b, fi, minrow, maxrow, FS_HELP);
|
fgs = fighters(b, fi, minrow, maxrow, FS_HELP);
|
||||||
v_scramble(fgs->begin, fgs->end);
|
v_scramble(fgs->begin, fgs->end);
|
||||||
|
j += heal_fighters(fgs, &healhp, false);
|
||||||
healhp = (int)power;
|
j += heal_fighters(fgs, &healhp, true);
|
||||||
for (fig = fgs->begin; fig != fgs->end; ++fig) {
|
|
||||||
fighter *df = *fig;
|
|
||||||
|
|
||||||
if (healhp<=0) break;
|
|
||||||
|
|
||||||
/* wir heilen erstmal keine Monster */
|
|
||||||
if (!playerrace(df->unit->race))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
hp = unit_max_hp(df->unit);
|
|
||||||
for (n = 0; n < df->unit->number; n++) {
|
|
||||||
if (!healhp)
|
|
||||||
break;
|
|
||||||
wound = hp - df->person[n].hp;
|
|
||||||
if ( wound > 0 && wound < hp) {
|
|
||||||
int heal = min(healhp, wound);
|
|
||||||
assert(heal>=0);
|
|
||||||
df->person[n].hp += heal;
|
|
||||||
healhp = max(0, healhp - heal);
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* haben wir noch HP übrig, so heilen wir nun auch Monster */
|
|
||||||
for (fig = fgs->begin; fig != fgs->end; ++fig) {
|
|
||||||
fighter *df = *fig;
|
|
||||||
|
|
||||||
if (healhp<=0) break;
|
|
||||||
|
|
||||||
/* Untote kann man nicht heilen */
|
|
||||||
if (fval(df->unit->race, RCF_NOHEAL))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
hp = unit_max_hp(df->unit);
|
|
||||||
for (n = 0; n < df->unit->number; n++) {
|
|
||||||
if (healhp<=0) break;
|
|
||||||
|
|
||||||
wound = hp - df->person[n].hp;
|
|
||||||
if ( wound > 0 && wound < hp) {
|
|
||||||
int heal = min(healhp, wound);
|
|
||||||
assert(heal>=0);
|
|
||||||
df->person[n].hp += heal;
|
|
||||||
healhp = max(0, healhp - heal);
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cv_kill(fgs);
|
cv_kill(fgs);
|
||||||
|
|
||||||
|
|
||||||
if (j == 0) {
|
if (j == 0) {
|
||||||
scat(", doch niemand mußte magisch geheilt werden.");
|
scat(", doch niemand mußte magisch geheilt werden.");
|
||||||
level = 0;
|
level = 0;
|
||||||
|
|
|
@ -1277,7 +1277,7 @@ travel_route(unit * u, region_list * route_begin, region_list * route_end, order
|
||||||
/* effect of borders */
|
/* effect of borders */
|
||||||
while (b!=NULL) {
|
while (b!=NULL) {
|
||||||
if (b->type->move) {
|
if (b->type->move) {
|
||||||
b->type->move(b, u, current, next, false);
|
b->type->move(b, u, current, next, false);
|
||||||
}
|
}
|
||||||
b = b->next;
|
b = b->next;
|
||||||
}
|
}
|
||||||
|
|
|
@ -291,15 +291,7 @@ unit_max_hp(const unit * u)
|
||||||
|
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
boolean is_undead(const unit *u)
|
|
||||||
{
|
|
||||||
return u->race == RC_UNDEAD || u->race == RC_SKELETON
|
|
||||||
|| u->race == RC_SKELETON_LORD || u->race == RC_ZOMBIE
|
|
||||||
|| u->race == RC_ZOMBIE_LORD || u->race == RC_GHOUL
|
|
||||||
|| u->race == RC_GHOUL_LORD;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
boolean
|
boolean
|
||||||
r_insectstalled(const region * r)
|
r_insectstalled(const region * r)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue