forked from github/server
define SIMPLE_ESCAPE to disable units running to neighbouring regions in combat (step I of new rules)
This commit is contained in:
parent
ca347ea1f7
commit
1d398a46fb
|
@ -121,6 +121,7 @@ army_index(side * s)
|
|||
return s->battle->nsides - s->index - 1;
|
||||
}
|
||||
|
||||
#ifndef SIMPLE_ESCAPE
|
||||
region *
|
||||
fleeregion(const unit * u)
|
||||
{
|
||||
|
@ -150,6 +151,7 @@ fleeregion(const unit * u)
|
|||
return NULL;
|
||||
return neighbours[rng_int() % c];
|
||||
}
|
||||
#endif /* SIMPLE_ESCAPE */
|
||||
|
||||
static char *
|
||||
sidename(side * s, boolean truename)
|
||||
|
@ -482,13 +484,17 @@ static void
|
|||
reportcasualties(battle * b, fighter * fig, int dead)
|
||||
{
|
||||
struct message * m;
|
||||
region * r = NULL;
|
||||
if (fig->alive == fig->unit->number) return;
|
||||
#ifndef SIMPLE_ESCAPE
|
||||
if (fig->run.region == NULL) {
|
||||
fig->run.region = fleeregion(fig->unit);
|
||||
if (fig->run.region == NULL) fig->run.region = b->region;
|
||||
}
|
||||
r = fig->run.region;
|
||||
#endif /* SIMPLE_ESCAPE */
|
||||
m = msg_message("casualties", "unit runto run alive fallen",
|
||||
fig->unit, fig->run.region, fig->run.number, fig->alive, dead);
|
||||
fig->unit, r, fig->run.number, fig->alive, dead);
|
||||
message_all(b, m);
|
||||
msg_release(m);
|
||||
}
|
||||
|
@ -2290,6 +2296,7 @@ loot_items(fighter * corpse)
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef SIMPLE_ESCAPE
|
||||
static void
|
||||
loot_fleeing(fighter* fig, unit* runner)
|
||||
{
|
||||
|
@ -2305,6 +2312,7 @@ merge_fleeloot(fighter* fig, unit* u)
|
|||
{
|
||||
i_merge(&u->items, &fig->run.items);
|
||||
}
|
||||
#endif /* SIMPLE_ESCAPE */
|
||||
|
||||
static boolean
|
||||
seematrix(const faction * f, const side * s)
|
||||
|
@ -2480,22 +2488,30 @@ aftermath(battle * b)
|
|||
/* Zuerst dürfen die Feinde plündern, die mitgenommenen Items
|
||||
* stehen in fig->run.items. Dann werden die Fliehenden auf
|
||||
* die leere (tote) alte Einheit gemapt */
|
||||
#ifdef SIMPLE_ESCAPE
|
||||
if (!fval(df, FIG_NOLOOT)){
|
||||
loot_items(df);
|
||||
}
|
||||
#else
|
||||
if (fval(df, FIG_NOLOOT)){
|
||||
merge_fleeloot(df, du);
|
||||
} else {
|
||||
loot_items(df);
|
||||
loot_fleeing(df, du);
|
||||
}
|
||||
#endif /* SIMPLE_ESCAPE */
|
||||
scale_number(du, df->run.number);
|
||||
du->hp = df->run.hp;
|
||||
set_order(&du->thisorder, NULL);
|
||||
setguard(du, GUARD_NONE);
|
||||
fset(du, UFL_LONGACTION);
|
||||
leave(du->region, du);
|
||||
#ifndef SIMPLE_ESCAPE
|
||||
if (df->run.region) {
|
||||
run_to(du, df->run.region);
|
||||
df->run.region = du->region;
|
||||
}
|
||||
#endif /* SIMPLE_ESCAPE */
|
||||
} else {
|
||||
/* nur teilweise geflohene Einheiten mergen sich wieder */
|
||||
df->alive += df->run.number;
|
||||
|
@ -2503,7 +2519,9 @@ aftermath(battle * b)
|
|||
s->size[statusrow(df->status)] += df->run.number;
|
||||
s->alive += df->run.number;
|
||||
sum_hp += df->run.hp;
|
||||
#ifndef SIMPLE_ESCAPE
|
||||
merge_fleeloot(df, du);
|
||||
#endif /* SIMPLE_ESCAPE */
|
||||
df->run.number = 0;
|
||||
df->run.hp = 0;
|
||||
/* df->run.region = NULL;*/
|
||||
|
@ -2518,7 +2536,9 @@ aftermath(battle * b)
|
|||
/* alle sind tot, niemand geflohen. Einheit auflösen */
|
||||
df->run.number = 0;
|
||||
df->run.hp = 0;
|
||||
#ifndef SIMPLE_ESCAPE
|
||||
df->run.region = NULL;
|
||||
#endif /* SIMPLE_ESCAPE */
|
||||
|
||||
/* Report the casualties */
|
||||
reportcasualties(b, df, dead);
|
||||
|
@ -3539,9 +3559,12 @@ static void
|
|||
flee(const troop dt)
|
||||
{
|
||||
fighter * fig = dt.fighter;
|
||||
|
||||
#ifndef SIMPLE_ESCAPE
|
||||
unit * u = fig->unit;
|
||||
int carry = personcapacity(u) - u->race->weight;
|
||||
int money;
|
||||
|
||||
item ** ip = &u->items;
|
||||
|
||||
while (*ip) {
|
||||
|
@ -3581,6 +3604,7 @@ flee(const troop dt)
|
|||
i_change(&u->items, i_silver, -money);
|
||||
i_change(&fig->run.items, i_silver, +money);
|
||||
}
|
||||
#endif /* SIMPLE_ESCAPE */
|
||||
|
||||
fig->run.hp += fig->person[dt.index].hp;
|
||||
++fig->run.number;
|
||||
|
@ -3904,8 +3928,10 @@ battle_flee(battle * b)
|
|||
|
||||
if (u->ship) continue;
|
||||
dt.fighter = fig;
|
||||
#ifndef SIMPLE_ESCAPE
|
||||
if (!fig->run.region) fig->run.region = fleeregion(u);
|
||||
if (!fig->run.region) continue;
|
||||
#endif /* SIMPLE_ESCAPE */
|
||||
dt.index = fig->alive - fig->removed;
|
||||
while (s->size[SUM_ROW] && dt.index != 0) {
|
||||
double ispaniced = 0.0;
|
||||
|
@ -3938,6 +3964,7 @@ battle_flee(battle * b)
|
|||
if (chance(min(fleechance(u)+ispaniced, 0.90))) {
|
||||
++runners;
|
||||
flee(dt);
|
||||
|
||||
#ifdef SMALL_BATTLE_MESSAGES
|
||||
if (b->small) {
|
||||
sprintf(smallbuf, "%s/%d gelingt es, vom Schlachtfeld zu entkommen.",
|
||||
|
|
|
@ -174,12 +174,14 @@ extern "C" {
|
|||
struct {
|
||||
int number; /* number of people who fled */
|
||||
int hp; /* accumulated hp of fleeing people */
|
||||
#ifndef SIMPLE_ESCAPE
|
||||
struct region *region; /* destination of fleeing people */
|
||||
struct item * items; /* items they take */
|
||||
#endif /* SIMPLE_ESCAPE */
|
||||
} run;
|
||||
#ifndef SIMPLE_COMBAT
|
||||
int action_counter; /* number of active actions the struct unit did in the fight */
|
||||
#endif
|
||||
#endif /* SIMPLE_COMBAT */
|
||||
#ifdef SHOW_KILLS
|
||||
int kills;
|
||||
int hits;
|
||||
|
@ -225,7 +227,9 @@ extern "C" {
|
|||
extern int get_unitrow(const struct fighter * af, const struct side * vs);
|
||||
extern boolean helping(const struct side * as, const struct side * ds);
|
||||
extern void rmfighter(fighter *df, int i);
|
||||
#ifndef SIMPLE_ESCAPE
|
||||
extern struct region * fleeregion(const struct unit * u);
|
||||
#endif
|
||||
extern struct fighter * select_corpse(struct battle * b, struct fighter * af);
|
||||
extern fighter * make_fighter(struct battle * b, struct unit * u, side * s, boolean attack);
|
||||
extern int statusrow(int status);
|
||||
|
|
|
@ -1316,6 +1316,7 @@ sp_denyattack(fighter * fi, int level, double power, spell * sp)
|
|||
/* irgendwie den langen befehl sperren */
|
||||
/* fset(fi, FIG_ATTACKED); */
|
||||
|
||||
#ifndef SIMPLE_ESCAPE
|
||||
/* Hat der Magier ein NACH, wird die angegebene Richtung bevorzugt */
|
||||
switch (get_keyword(mage->thisorder)) {
|
||||
case K_MOVE:
|
||||
|
@ -1332,18 +1333,20 @@ sp_denyattack(fighter * fi, int level, double power, spell * sp)
|
|||
/* bewegung erst am Ende des Kampfes, zusammen mit den normalen
|
||||
* Flüchtlingen */
|
||||
|
||||
if (fi->run.region) {
|
||||
/* wir tun so, als wäre die Person geflohen */
|
||||
fset(fi, FIG_NOLOOT);
|
||||
fi->run.hp = mage->hp;
|
||||
fi->run.number = mage->number;
|
||||
/* fighter leeren */
|
||||
rmfighter(fi, mage->number);
|
||||
if (!fi->run.region) return level;
|
||||
#endif /* SIMPLE_ESCAPE */
|
||||
|
||||
/* wir tun so, als wäre die Person geflohen */
|
||||
fset(fi, FIG_NOLOOT);
|
||||
fi->run.hp = mage->hp;
|
||||
fi->run.number = mage->number;
|
||||
/* fighter leeren */
|
||||
rmfighter(fi, mage->number);
|
||||
|
||||
scat("Das Kampfgetümmel erstirbt und er kann unbehelligt "
|
||||
"seines Weges ziehen.");
|
||||
battlerecord(b, buf);
|
||||
|
||||
scat("Das Kampfgetümmel erstirbt und er kann unbehelligt "
|
||||
"seines Weges ziehen.");
|
||||
battlerecord(b, buf);
|
||||
}
|
||||
return level;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue