forked from github/server
- ziemlicher Fehler in aftermath: Wenn Einheiten keine Personen verloren haben, haben sie auch keine Hitpoints verloren.
This commit is contained in:
parent
c434b9c9d4
commit
ba620d139a
|
@ -658,6 +658,69 @@ chaosfactor(region * r)
|
||||||
return ((double) a->data.i / 1000.0);
|
return ((double) a->data.i / 1000.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
damage_unit(unit *u, const char *dam, boolean armor, boolean magic)
|
||||||
|
{
|
||||||
|
int *hp = malloc(u->number * sizeof(int));
|
||||||
|
int h;
|
||||||
|
int i, dead = 0, hp_rem = 0, heiltrank;
|
||||||
|
|
||||||
|
if (u->number==0) return 0;
|
||||||
|
h = u->hp/u->number;
|
||||||
|
/* HP verteilen */
|
||||||
|
for (i=0; i<u->number; i++) hp[i] = h;
|
||||||
|
h = u->hp - (u->number * h);
|
||||||
|
for (i=0; i<h; i++) hp[i]++;
|
||||||
|
|
||||||
|
/* Schaden */
|
||||||
|
for (i=0; i<u->number; i++) {
|
||||||
|
int damage = dice_rand(dam);
|
||||||
|
if (magic) damage = (int)(damage * (1.0 - magic_resistance(u)));
|
||||||
|
if (armor) damage -= nb_armor(u, i);
|
||||||
|
hp[i] -= damage;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Auswirkungen */
|
||||||
|
for (i=0; i<u->number; i++) {
|
||||||
|
if (hp[i] <= 0){
|
||||||
|
heiltrank = 0;
|
||||||
|
|
||||||
|
/* Sieben Leben */
|
||||||
|
if (old_race(u->race) == RC_CAT && (chance(1.0 / 7))) {
|
||||||
|
hp[i] = u->hp/u->number;
|
||||||
|
hp_rem += hp[i];
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Heiltrank */
|
||||||
|
if (get_effect(u, oldpotiontype[P_HEAL]) > 0) {
|
||||||
|
change_effect(u, oldpotiontype[P_HEAL], -1);
|
||||||
|
heiltrank = 1;
|
||||||
|
} else if (get_potion(u, P_HEAL) > 0) {
|
||||||
|
i_change(&u->items, oldpotiontype[P_HEAL]->itype, -1);
|
||||||
|
change_effect(u, oldpotiontype[P_HEAL], 3);
|
||||||
|
heiltrank = 1;
|
||||||
|
}
|
||||||
|
if (heiltrank && (chance(0.50))) {
|
||||||
|
hp[i] = u->hp/u->number;
|
||||||
|
hp_rem += hp[i];
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
dead++;
|
||||||
|
} else {
|
||||||
|
hp_rem += hp[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
scale_number(u, u->number - dead);
|
||||||
|
u->hp = hp_rem;
|
||||||
|
|
||||||
|
free(hp);
|
||||||
|
|
||||||
|
return dead;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
drown(region *r)
|
drown(region *r)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2472,12 +2472,13 @@ aftermath(battle * b)
|
||||||
sum_hp += df->person[n].hp;
|
sum_hp += df->person[n].hp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (df->alive == du->number) continue; /* nichts passiert */
|
|
||||||
|
|
||||||
/* die weggerannten werden später subtrahiert! */
|
/* die weggerannten werden später subtrahiert! */
|
||||||
assert(du->number >= 0);
|
assert(du->number >= 0);
|
||||||
|
|
||||||
if (df->run.hp) {
|
if (df->alive == du->number) {
|
||||||
|
du->hp = sum_hp;
|
||||||
|
continue; /* nichts passiert */
|
||||||
|
} else if (df->run.hp) {
|
||||||
#ifndef NO_RUNNING
|
#ifndef NO_RUNNING
|
||||||
if (df->alive == 0) {
|
if (df->alive == 0) {
|
||||||
/* Report the casualties */
|
/* Report the casualties */
|
||||||
|
@ -3903,9 +3904,8 @@ do_battle(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Funktionen, die außerhalb von battle.c verwendet werden. */
|
int
|
||||||
static int
|
nb_armor(const unit *u, int index)
|
||||||
nb_armor(unit *u, int index)
|
|
||||||
{
|
{
|
||||||
int a, av = 0;
|
int a, av = 0;
|
||||||
int geschuetzt = 0;
|
int geschuetzt = 0;
|
||||||
|
@ -3941,66 +3941,3 @@ nb_armor(unit *u, int index)
|
||||||
return av;
|
return av;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
|
||||||
damage_unit(unit *u, const char *dam, boolean armor, boolean magic)
|
|
||||||
{
|
|
||||||
int *hp = malloc(u->number * sizeof(int));
|
|
||||||
int h;
|
|
||||||
int i, dead = 0, hp_rem = 0, heiltrank;
|
|
||||||
|
|
||||||
if (u->number==0) return 0;
|
|
||||||
h = u->hp/u->number;
|
|
||||||
/* HP verteilen */
|
|
||||||
for (i=0; i<u->number; i++) hp[i] = h;
|
|
||||||
h = u->hp - (u->number * h);
|
|
||||||
for (i=0; i<h; i++) hp[i]++;
|
|
||||||
|
|
||||||
/* Schaden */
|
|
||||||
for (i=0; i<u->number; i++) {
|
|
||||||
int damage = dice_rand(dam);
|
|
||||||
if (magic) damage = (int)(damage * (1.0 - magic_resistance(u)));
|
|
||||||
if (armor) damage -= nb_armor(u, i);
|
|
||||||
hp[i] -= damage;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Auswirkungen */
|
|
||||||
for (i=0; i<u->number; i++) {
|
|
||||||
if (hp[i] <= 0){
|
|
||||||
heiltrank = 0;
|
|
||||||
|
|
||||||
/* Sieben Leben */
|
|
||||||
if (old_race(u->race) == RC_CAT && (chance(1.0 / 7))) {
|
|
||||||
hp[i] = u->hp/u->number;
|
|
||||||
hp_rem += hp[i];
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Heiltrank */
|
|
||||||
if (get_effect(u, oldpotiontype[P_HEAL]) > 0) {
|
|
||||||
change_effect(u, oldpotiontype[P_HEAL], -1);
|
|
||||||
heiltrank = 1;
|
|
||||||
} else if (get_potion(u, P_HEAL) > 0) {
|
|
||||||
i_change(&u->items, oldpotiontype[P_HEAL]->itype, -1);
|
|
||||||
change_effect(u, oldpotiontype[P_HEAL], 3);
|
|
||||||
heiltrank = 1;
|
|
||||||
}
|
|
||||||
if (heiltrank && (chance(0.50))) {
|
|
||||||
hp[i] = u->hp/u->number;
|
|
||||||
hp_rem += hp[i];
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
dead++;
|
|
||||||
} else {
|
|
||||||
hp_rem += hp[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
scale_number(u, u->number - dead);
|
|
||||||
u->hp = hp_rem;
|
|
||||||
|
|
||||||
free(hp);
|
|
||||||
|
|
||||||
return dead;
|
|
||||||
}
|
|
||||||
|
|
|
@ -213,7 +213,7 @@ extern "C" {
|
||||||
extern void do_battle(void);
|
extern void do_battle(void);
|
||||||
|
|
||||||
/* for combar spells and special attacks */
|
/* for combar spells and special attacks */
|
||||||
extern int damage_unit(struct unit *u, const char *dam, boolean armor, boolean magic);
|
extern int nb_armor(const struct unit *u, int index);
|
||||||
extern troop select_enemy(struct battle * b, struct fighter * af, int minrow, int maxrow, boolean advance);
|
extern troop select_enemy(struct battle * b, struct fighter * af, int minrow, int maxrow, boolean advance);
|
||||||
extern int count_enemies(struct battle * b, struct side * as, int minrow, int maxrow, boolean advance);
|
extern int count_enemies(struct battle * b, struct side * as, int minrow, int maxrow, boolean advance);
|
||||||
extern boolean terminate(troop dt, troop at, int type, const char *damage, boolean missile);
|
extern boolean terminate(troop dt, troop at, int type, const char *damage, boolean missile);
|
||||||
|
|
|
@ -771,12 +771,10 @@ bewegung_blockiert_von(unit * reisender, region * r)
|
||||||
int sk = eff_skill(u, SK_OBSERVATION, r);
|
int sk = eff_skill(u, SK_OBSERVATION, r);
|
||||||
if (get_item(reisender, I_RING_OF_INVISIBILITY) >= reisender->number &&
|
if (get_item(reisender, I_RING_OF_INVISIBILITY) >= reisender->number &&
|
||||||
!get_item(u, I_AMULET_OF_TRUE_SEEING)) continue;
|
!get_item(u, I_AMULET_OF_TRUE_SEEING)) continue;
|
||||||
if (u->faction==reisender->faction
|
if (u->faction==reisender->faction) contact = true;
|
||||||
|| ucontact(u, reisender)
|
else if (ucontact(u, reisender)) contact = true;
|
||||||
|| alliedunit(u, reisender->faction, HELP_GUARD))
|
else if (alliedunit(u, reisender->faction, HELP_GUARD)) contact = true;
|
||||||
{
|
else if (sk>=perception) {
|
||||||
contact = true;
|
|
||||||
} else if (sk>=perception) {
|
|
||||||
perception = sk;
|
perception = sk;
|
||||||
guard = u;
|
guard = u;
|
||||||
}
|
}
|
||||||
|
@ -2149,8 +2147,7 @@ regain_orientation(region * r)
|
||||||
|
|
||||||
if(r->terrain != T_OCEAN || rand() % 10 >= storms[month(0)]) {
|
if(r->terrain != T_OCEAN || rand() % 10 >= storms[month(0)]) {
|
||||||
remove_curse(&sh->attribs, C_DISORIENTATION, 0);
|
remove_curse(&sh->attribs, C_DISORIENTATION, 0);
|
||||||
add_message(&cap->faction->msgs,
|
ADDMSG(&cap->faction->msgs, msg_message("shipnoconf", "ship", sh));
|
||||||
new_message(cap->faction, "shipnoconf%h:ship", sh));
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2159,8 +2156,7 @@ regain_orientation(region * r)
|
||||||
&& allied(cap, u->faction, HELP_GUARD)
|
&& allied(cap, u->faction, HELP_GUARD)
|
||||||
&& is_disorientated(u) == false) {
|
&& is_disorientated(u) == false) {
|
||||||
remove_curse(&sh->attribs, C_DISORIENTATION, 0);
|
remove_curse(&sh->attribs, C_DISORIENTATION, 0);
|
||||||
add_message(&cap->faction->msgs,
|
ADDMSG(&cap->faction->msgs, msg_message("shipnoconf", "ship", sh));
|
||||||
new_message(cap->faction, "shipnoconf%h:ship", sh));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue