New and simplified combat rules.

To activate, define SIMPLE_COMBAT in your settings.h
This commit is contained in:
Enno Rehling 2006-04-10 21:13:22 +00:00
parent 5e57e78818
commit 50b94b730d
2 changed files with 1197 additions and 1156 deletions

View File

@ -1578,8 +1578,10 @@ do_combatspell(troop at, int row)
level = ((cspell_f)sp->sp_function)(fi, level, power, sp); level = ((cspell_f)sp->sp_function)(fi, level, power, sp);
if (level > 0) { if (level > 0) {
pay_spell(mage, sp, level, 1); pay_spell(mage, sp, level, 1);
#ifndef SIMPLE_COMBAT
at.fighter->action_counter++; at.fighter->action_counter++;
at.fighter->side->bf->lastturn = b->turn; 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; af->catmsg += dead;
if (!standard_attack && af->person[ta.index].last_action < b->turn) { if (!standard_attack && af->person[ta.index].last_action < b->turn) {
af->person[ta.index].last_action = b->turn; af->person[ta.index].last_action = b->turn;
#ifndef SIMPLE_COMBAT
af->action_counter++; af->action_counter++;
af->side->bf->lastturn = b->turn; af->side->bf->lastturn = b->turn;
#endif
} }
} }
if (standard_attack) { if (standard_attack) {
@ -2002,14 +2006,18 @@ attack(battle *b, troop ta, const att *a, int numattack)
#ifdef COUNT_DF #ifdef COUNT_DF
if (td.fighter->person[td.index].last_action < b->turn) { if (td.fighter->person[td.index].last_action < b->turn) {
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->action_counter++;
td.fighter->side->bf->lastturn = b->turn; td.fighter->side->bf->lastturn = b->turn;
#endif
} }
#endif #endif
if (ta.fighter->person[ta.index].last_action < b->turn) { if (ta.fighter->person[ta.index].last_action < b->turn) {
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->action_counter++;
ta.fighter->side->bf->lastturn = b->turn; ta.fighter->side->bf->lastturn = b->turn;
#endif
} }
reload = true; reload = true;
if (hits(ta, td, wp)) { if (hits(ta, td, wp)) {
@ -2037,14 +2045,18 @@ attack(battle *b, troop ta, const att *a, int numattack)
#ifdef COUNT_DF #ifdef COUNT_DF
if(td.fighter->person[td.index].last_action < b->turn) { if(td.fighter->person[td.index].last_action < b->turn) {
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->action_counter++;
td.fighter->side->bf->lastturn = b->turn; td.fighter->side->bf->lastturn = b->turn;
#endif
} }
#endif #endif
if(ta.fighter->person[ta.index].last_action < b->turn) { if(ta.fighter->person[ta.index].last_action < b->turn) {
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->action_counter++;
ta.fighter->side->bf->lastturn = b->turn; ta.fighter->side->bf->lastturn = b->turn;
#endif
} }
if (hits(ta, td, NULL)) { if (hits(ta, td, NULL)) {
terminate(td, ta, a->type, a->data.dice, false); 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 #ifdef COUNT_DF
if(td.fighter->person[td.index].last_action < b->turn) { if(td.fighter->person[td.index].last_action < b->turn) {
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->action_counter++;
td.fighter->side->bf->lastturn = b->turn; td.fighter->side->bf->lastturn = b->turn;
#endif
} }
#endif #endif
if(ta.fighter->person[ta.index].last_action < b->turn) { if(ta.fighter->person[ta.index].last_action < b->turn) {
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->action_counter++;
ta.fighter->side->bf->lastturn = b->turn; ta.fighter->side->bf->lastturn = b->turn;
#endif
} }
if (hits(ta, td, NULL)) { if (hits(ta, td, NULL)) {
int c = dice_rand(a->data.dice); int c = dice_rand(a->data.dice);
@ -2083,14 +2099,18 @@ attack(battle *b, troop ta, const att *a, int numattack)
#ifdef COUNT_DF #ifdef COUNT_DF
if(td.fighter->person[td.index].last_action < b->turn) { if(td.fighter->person[td.index].last_action < b->turn) {
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->action_counter++;
td.fighter->side->bf->lastturn = b->turn; td.fighter->side->bf->lastturn = b->turn;
#endif
} }
#endif #endif
if(ta.fighter->person[ta.index].last_action < b->turn) { if(ta.fighter->person[ta.index].last_action < b->turn) {
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->action_counter++;
ta.fighter->side->bf->lastturn = b->turn; ta.fighter->side->bf->lastturn = b->turn;
#endif
} }
if (hits(ta, td, NULL)) { if (hits(ta, td, NULL)) {
drain_exp(td.fighter->unit, dice_rand(a->data.dice)); 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 #ifdef COUNT_DF
if(td.fighter->person[td.index].last_action < b->turn) { if(td.fighter->person[td.index].last_action < b->turn) {
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->action_counter++;
td.fighter->side->bf->lastturn = b->turn; td.fighter->side->bf->lastturn = b->turn;
#endif
} }
#endif #endif
if(ta.fighter->person[ta.index].last_action < b->turn) { if(ta.fighter->person[ta.index].last_action < b->turn) {
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->action_counter++;
ta.fighter->side->bf->lastturn = b->turn; ta.fighter->side->bf->lastturn = b->turn;
#endif
} }
if (hits(ta, td, NULL)) { if (hits(ta, td, NULL)) {
dazzle(b, &td); dazzle(b, &td);
@ -2120,8 +2144,10 @@ attack(battle *b, troop ta, const att *a, int numattack)
if (!td.fighter) return; if (!td.fighter) return;
if(ta.fighter->person[ta.index].last_action < b->turn) { if(ta.fighter->person[ta.index].last_action < b->turn) {
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->action_counter++;
ta.fighter->side->bf->lastturn = b->turn; ta.fighter->side->bf->lastturn = b->turn;
#endif
} }
if (td.fighter->unit->ship) { if (td.fighter->unit->ship) {
td.fighter->unit->ship->damage += DAMAGE_SCALE * dice_rand(a->data.dice); td.fighter->unit->ship->damage += DAMAGE_SCALE * dice_rand(a->data.dice);
@ -2438,10 +2464,12 @@ aftermath(battle * b)
cv_foreach(s, b->sides) { cv_foreach(s, b->sides) {
int snumber = 0; int snumber = 0;
fighter *df; fighter *df;
#ifndef SIMPLE_COMBAT
boolean relevant = false; /* Kampf relevant für diese Partei? */ boolean relevant = false; /* Kampf relevant für diese Partei? */
if (s->bf->lastturn+(b->has_tactics_turn?1:0)>1) { if (s->bf->lastturn+(b->has_tactics_turn?1:0)>1) {
relevant = true; relevant = true;
} }
#endif
s->flee = 0; s->flee = 0;
cv_foreach(df, s->fighters) { cv_foreach(df, s->fighters) {
@ -2451,6 +2479,12 @@ aftermath(battle * b)
int n; int n;
snumber += du->number; 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) { if (relevant) {
fset(du, UFL_NOTMOVING); /* unit cannot move this round */ fset(du, UFL_NOTMOVING); /* unit cannot move this round */
if (df->action_counter >= du->number) { if (df->action_counter >= du->number) {
@ -2459,6 +2493,7 @@ aftermath(battle * b)
fset(du, UFL_LONGACTION); fset(du, UFL_LONGACTION);
} }
} }
#endif
for (n = 0; n != df->alive; ++n) { for (n = 0; n != df->alive; ++n) {
if (df->person[n].hp > 0) { if (df->person[n].hp > 0) {
sum_hp += df->person[n].hp; sum_hp += df->person[n].hp;
@ -3670,7 +3705,9 @@ init_battle(region * r, battle **bp)
} }
} }
/* Ende Fehlerbehandlung */ /* Ende Fehlerbehandlung */
#ifdef SIMPLE_COMBAT
fset(u, UFL_LONGACTION);
#endif
if (b==NULL) { if (b==NULL) {
unit * utmp; unit * utmp;
for (utmp=r->units; utmp!=NULL; utmp=utmp->next) { for (utmp=r->units; utmp!=NULL; utmp=utmp->next) {

View File

@ -44,7 +44,9 @@ extern "C" {
struct bfaction * next; struct bfaction * next;
struct side * sides; struct side * sides;
struct faction *faction; struct faction *faction;
#ifndef SIMPLE_COMBAT
int lastturn; /* last time this struct faction was involved in combat */ int lastturn; /* last time this struct faction was involved in combat */
#endif
boolean attacker; boolean attacker;
} bfaction; } bfaction;
@ -174,7 +176,9 @@ extern "C" {
struct item * items; /* items they take */ struct item * items; /* items they take */
#endif #endif
} run; } run;
#ifndef SIMPLE_COMBAT
int action_counter; /* number of active actions the struct unit did in the fight */ int action_counter; /* number of active actions the struct unit did in the fight */
#endif
#ifdef SHOW_KILLS #ifdef SHOW_KILLS
int kills; int kills;
int hits; int hits;