forked from github/server
New and simplified combat rules.
To activate, define SIMPLE_COMBAT in your settings.h
This commit is contained in:
parent
5e57e78818
commit
50b94b730d
2 changed files with 1197 additions and 1156 deletions
|
@ -1578,8 +1578,10 @@ do_combatspell(troop at, int row)
|
|||
level = ((cspell_f)sp->sp_function)(fi, level, power, sp);
|
||||
if (level > 0) {
|
||||
pay_spell(mage, sp, level, 1);
|
||||
#ifndef SIMPLE_COMBAT
|
||||
at.fighter->action_counter++;
|
||||
at.fighter->side->bf->lastturn = b->turn;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1983,8 +1985,10 @@ attack(battle *b, troop ta, const att *a, int numattack)
|
|||
af->catmsg += dead;
|
||||
if (!standard_attack && af->person[ta.index].last_action < b->turn) {
|
||||
af->person[ta.index].last_action = b->turn;
|
||||
#ifndef SIMPLE_COMBAT
|
||||
af->action_counter++;
|
||||
af->side->bf->lastturn = b->turn;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if (standard_attack) {
|
||||
|
@ -2002,14 +2006,18 @@ attack(battle *b, troop ta, const att *a, int numattack)
|
|||
#ifdef COUNT_DF
|
||||
if (td.fighter->person[td.index].last_action < b->turn) {
|
||||
td.fighter->person[td.index].last_action = b->turn;
|
||||
#ifndef SIMPLE_COMBAT
|
||||
td.fighter->action_counter++;
|
||||
td.fighter->side->bf->lastturn = b->turn;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
if (ta.fighter->person[ta.index].last_action < b->turn) {
|
||||
ta.fighter->person[ta.index].last_action = b->turn;
|
||||
#ifndef SIMPLE_COMBAT
|
||||
ta.fighter->action_counter++;
|
||||
ta.fighter->side->bf->lastturn = b->turn;
|
||||
#endif
|
||||
}
|
||||
reload = true;
|
||||
if (hits(ta, td, wp)) {
|
||||
|
@ -2037,14 +2045,18 @@ attack(battle *b, troop ta, const att *a, int numattack)
|
|||
#ifdef COUNT_DF
|
||||
if(td.fighter->person[td.index].last_action < b->turn) {
|
||||
td.fighter->person[td.index].last_action = b->turn;
|
||||
#ifndef SIMPLE_COMBAT
|
||||
td.fighter->action_counter++;
|
||||
td.fighter->side->bf->lastturn = b->turn;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
if(ta.fighter->person[ta.index].last_action < b->turn) {
|
||||
ta.fighter->person[ta.index].last_action = b->turn;
|
||||
#ifndef SIMPLE_COMBAT
|
||||
ta.fighter->action_counter++;
|
||||
ta.fighter->side->bf->lastturn = b->turn;
|
||||
#endif
|
||||
}
|
||||
if (hits(ta, td, NULL)) {
|
||||
terminate(td, ta, a->type, a->data.dice, false);
|
||||
|
@ -2056,14 +2068,18 @@ attack(battle *b, troop ta, const att *a, int numattack)
|
|||
#ifdef COUNT_DF
|
||||
if(td.fighter->person[td.index].last_action < b->turn) {
|
||||
td.fighter->person[td.index].last_action = b->turn;
|
||||
#ifndef SIMPLE_COMBAT
|
||||
td.fighter->action_counter++;
|
||||
td.fighter->side->bf->lastturn = b->turn;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
if(ta.fighter->person[ta.index].last_action < b->turn) {
|
||||
ta.fighter->person[ta.index].last_action = b->turn;
|
||||
#ifndef SIMPLE_COMBAT
|
||||
ta.fighter->action_counter++;
|
||||
ta.fighter->side->bf->lastturn = b->turn;
|
||||
#endif
|
||||
}
|
||||
if (hits(ta, td, NULL)) {
|
||||
int c = dice_rand(a->data.dice);
|
||||
|
@ -2083,14 +2099,18 @@ attack(battle *b, troop ta, const att *a, int numattack)
|
|||
#ifdef COUNT_DF
|
||||
if(td.fighter->person[td.index].last_action < b->turn) {
|
||||
td.fighter->person[td.index].last_action = b->turn;
|
||||
#ifndef SIMPLE_COMBAT
|
||||
td.fighter->action_counter++;
|
||||
td.fighter->side->bf->lastturn = b->turn;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
if(ta.fighter->person[ta.index].last_action < b->turn) {
|
||||
ta.fighter->person[ta.index].last_action = b->turn;
|
||||
#ifndef SIMPLE_COMBAT
|
||||
ta.fighter->action_counter++;
|
||||
ta.fighter->side->bf->lastturn = b->turn;
|
||||
#endif
|
||||
}
|
||||
if (hits(ta, td, NULL)) {
|
||||
drain_exp(td.fighter->unit, dice_rand(a->data.dice));
|
||||
|
@ -2102,14 +2122,18 @@ attack(battle *b, troop ta, const att *a, int numattack)
|
|||
#ifdef COUNT_DF
|
||||
if(td.fighter->person[td.index].last_action < b->turn) {
|
||||
td.fighter->person[td.index].last_action = b->turn;
|
||||
#ifndef SIMPLE_COMBAT
|
||||
td.fighter->action_counter++;
|
||||
td.fighter->side->bf->lastturn = b->turn;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
if(ta.fighter->person[ta.index].last_action < b->turn) {
|
||||
ta.fighter->person[ta.index].last_action = b->turn;
|
||||
#ifndef SIMPLE_COMBAT
|
||||
ta.fighter->action_counter++;
|
||||
ta.fighter->side->bf->lastturn = b->turn;
|
||||
#endif
|
||||
}
|
||||
if (hits(ta, td, NULL)) {
|
||||
dazzle(b, &td);
|
||||
|
@ -2120,8 +2144,10 @@ attack(battle *b, troop ta, const att *a, int numattack)
|
|||
if (!td.fighter) return;
|
||||
if(ta.fighter->person[ta.index].last_action < b->turn) {
|
||||
ta.fighter->person[ta.index].last_action = b->turn;
|
||||
#ifndef SIMPLE_COMBAT
|
||||
ta.fighter->action_counter++;
|
||||
ta.fighter->side->bf->lastturn = b->turn;
|
||||
#endif
|
||||
}
|
||||
if (td.fighter->unit->ship) {
|
||||
td.fighter->unit->ship->damage += DAMAGE_SCALE * dice_rand(a->data.dice);
|
||||
|
@ -2438,10 +2464,12 @@ aftermath(battle * b)
|
|||
cv_foreach(s, b->sides) {
|
||||
int snumber = 0;
|
||||
fighter *df;
|
||||
#ifndef SIMPLE_COMBAT
|
||||
boolean relevant = false; /* Kampf relevant für diese Partei? */
|
||||
if (s->bf->lastturn+(b->has_tactics_turn?1:0)>1) {
|
||||
relevant = true;
|
||||
}
|
||||
#endif
|
||||
s->flee = 0;
|
||||
|
||||
cv_foreach(df, s->fighters) {
|
||||
|
@ -2451,6 +2479,12 @@ aftermath(battle * b)
|
|||
int n;
|
||||
|
||||
snumber += du->number;
|
||||
#ifdef SIMPLE_COMBAT
|
||||
if (battle_was_relevant) {
|
||||
ship * sh = du->ship?du->ship:leftship(du);
|
||||
if (sh) fset(sh, SF_DAMAGED);
|
||||
}
|
||||
#else
|
||||
if (relevant) {
|
||||
fset(du, UFL_NOTMOVING); /* unit cannot move this round */
|
||||
if (df->action_counter >= du->number) {
|
||||
|
@ -2459,6 +2493,7 @@ aftermath(battle * b)
|
|||
fset(du, UFL_LONGACTION);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
for (n = 0; n != df->alive; ++n) {
|
||||
if (df->person[n].hp > 0) {
|
||||
sum_hp += df->person[n].hp;
|
||||
|
@ -3670,7 +3705,9 @@ init_battle(region * r, battle **bp)
|
|||
}
|
||||
}
|
||||
/* Ende Fehlerbehandlung */
|
||||
|
||||
#ifdef SIMPLE_COMBAT
|
||||
fset(u, UFL_LONGACTION);
|
||||
#endif
|
||||
if (b==NULL) {
|
||||
unit * utmp;
|
||||
for (utmp=r->units; utmp!=NULL; utmp=utmp->next) {
|
||||
|
|
|
@ -44,7 +44,9 @@ extern "C" {
|
|||
struct bfaction * next;
|
||||
struct side * sides;
|
||||
struct faction *faction;
|
||||
#ifndef SIMPLE_COMBAT
|
||||
int lastturn; /* last time this struct faction was involved in combat */
|
||||
#endif
|
||||
boolean attacker;
|
||||
} bfaction;
|
||||
|
||||
|
@ -174,7 +176,9 @@ extern "C" {
|
|||
struct item * items; /* items they take */
|
||||
#endif
|
||||
} run;
|
||||
#ifndef SIMPLE_COMBAT
|
||||
int action_counter; /* number of active actions the struct unit did in the fight */
|
||||
#endif
|
||||
#ifdef SHOW_KILLS
|
||||
int kills;
|
||||
int hits;
|
||||
|
|
Loading…
Reference in a new issue