forked from github/server
"Beute von fliehenden Einheiten nach neuen Kampfregeln" only loot for dead units is given to the enemy.
This commit is contained in:
parent
68e2ec932f
commit
6df82c0749
1 changed files with 16 additions and 7 deletions
|
@ -331,6 +331,12 @@ allysf(const side * s, const faction * f)
|
||||||
return allysfm(s, f, HELP_FIGHT);
|
return allysfm(s, f, HELP_FIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
dead_fighters(const fighter * df)
|
||||||
|
{
|
||||||
|
return df->unit->number - df->alive - df->run.number;
|
||||||
|
}
|
||||||
|
|
||||||
fighter *
|
fighter *
|
||||||
select_corpse(battle * b, fighter * af)
|
select_corpse(battle * b, fighter * af)
|
||||||
/* Wählt eine Leiche aus, der af hilft. casualties ist die Anzahl der
|
/* Wählt eine Leiche aus, der af hilft. casualties ist die Anzahl der
|
||||||
|
@ -353,7 +359,7 @@ select_corpse(battle * b, fighter * af)
|
||||||
for (df=s->fighters;df;df=df->next) {
|
for (df=s->fighters;df;df=df->next) {
|
||||||
/* Geflohene haben auch 0 hp, dürfen hier aber nicht ausgewählt
|
/* Geflohene haben auch 0 hp, dürfen hier aber nicht ausgewählt
|
||||||
* werden! */
|
* werden! */
|
||||||
int dead = df->unit->number - (df->alive + df->run.number);
|
int dead = dead_fighters(df);
|
||||||
if (!playerrace(df->unit->race)) continue;
|
if (!playerrace(df->unit->race)) continue;
|
||||||
|
|
||||||
if (af && !helping(af->side, df->side))
|
if (af && !helping(af->side, df->side))
|
||||||
|
@ -2337,13 +2343,16 @@ loot_items(fighter * corpse)
|
||||||
unit * u = corpse->unit;
|
unit * u = corpse->unit;
|
||||||
item * itm = u->items;
|
item * itm = u->items;
|
||||||
battle * b = corpse->side->battle;
|
battle * b = corpse->side->battle;
|
||||||
u->items = NULL;
|
int dead = dead_fighters(corpse);
|
||||||
|
|
||||||
|
if (dead<=0) return;
|
||||||
|
|
||||||
while (itm) {
|
while (itm) {
|
||||||
|
float lootfactor = dead/(float)u->number; /* only loot the dead! */
|
||||||
if (itm->number) {
|
if (itm->number) {
|
||||||
int i = min(10, itm->number);
|
int i = min(10, itm->number);
|
||||||
for (; i != 0; --i) {
|
for (; i != 0; --i) {
|
||||||
int loot = itm->number / i;
|
int loot = (int)(itm->number*lootfactor/i);
|
||||||
/* Looten tun hier immer nur die Gegner. Das ist als Ausgleich für die
|
/* Looten tun hier immer nur die Gegner. Das ist als Ausgleich für die
|
||||||
* neue Loot-regel (nur ganz tote Einheiten) fair.
|
* neue Loot-regel (nur ganz tote Einheiten) fair.
|
||||||
* zusätzlich looten auch geflohene, aber nach anderen Regeln.
|
* zusätzlich looten auch geflohene, aber nach anderen Regeln.
|
||||||
|
@ -2443,7 +2452,7 @@ aftermath(battle * b)
|
||||||
fighter * df;
|
fighter * df;
|
||||||
for (df = s->fighters; df; df=df->next) {
|
for (df = s->fighters; df; df=df->next) {
|
||||||
unit *du = df->unit;
|
unit *du = df->unit;
|
||||||
int dead = du->number - df->alive - df->run.number;
|
int dead = dead_fighters(df);
|
||||||
int pr_mercy = 0;
|
int pr_mercy = 0;
|
||||||
#ifdef KARMA_MODULE
|
#ifdef KARMA_MODULE
|
||||||
const attrib *a= a_find(du->attribs, &at_prayer_effect);
|
const attrib *a= a_find(du->attribs, &at_prayer_effect);
|
||||||
|
@ -2468,7 +2477,7 @@ aftermath(battle * b)
|
||||||
/* do not change dead here, or loop will not terminate! recalculate later */
|
/* do not change dead here, or loop will not terminate! recalculate later */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dead = du->number - df->alive - df->run.number;
|
dead = dead_fighters(df);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* Regeneration durch PR_MERCY */
|
/* Regeneration durch PR_MERCY */
|
||||||
|
@ -2481,7 +2490,7 @@ aftermath(battle * b)
|
||||||
/* do not change dead here, or loop will not terminate! recalculate later */
|
/* do not change dead here, or loop will not terminate! recalculate later */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dead = du->number - df->alive - df->run.number;
|
dead = dead_fighters(df);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* tote insgesamt: */
|
/* tote insgesamt: */
|
||||||
|
@ -2526,7 +2535,7 @@ aftermath(battle * b)
|
||||||
|
|
||||||
for (df=s->fighters;df;df=df->next) {
|
for (df=s->fighters;df;df=df->next) {
|
||||||
unit *du = df->unit;
|
unit *du = df->unit;
|
||||||
int dead = du->number - df->alive - df->run.number;
|
int dead = dead_fighters(df);
|
||||||
int sum_hp = 0;
|
int sum_hp = 0;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue