forked from github/server
Katpaulte schiessen nicht wenn KAEMPFE FLIEHE gesetzt ist. Wenn Katapulte nicht schiessen, versuchen sie keine alternative Attacke, für die sie bihser das Katapult als Bogen benutzt haben.
This commit is contained in:
parent
ff80cb52ba
commit
895818c7c7
11
src/battle.c
11
src/battle.c
|
@ -2086,12 +2086,13 @@ static void attack(battle * b, troop ta, const att * a, int numattack)
|
||||||
* sonst helden mit feuerschwertern zu maechtig */
|
* sonst helden mit feuerschwertern zu maechtig */
|
||||||
if (numattack == 0 && wp && wp->type->attack) {
|
if (numattack == 0 && wp && wp->type->attack) {
|
||||||
int dead = 0;
|
int dead = 0;
|
||||||
standard_attack = wp->type->attack(&ta, wp->type, &dead);
|
standard_attack = false;
|
||||||
if (!standard_attack)
|
if (wp->type->attack(&ta, wp->type, &dead)) {
|
||||||
reload = true;
|
reload = true;
|
||||||
af->catmsg += dead;
|
af->catmsg += dead;
|
||||||
if (!standard_attack && af->person[ta.index].last_action < b->turn) {
|
if (af->person[ta.index].last_action < b->turn) {
|
||||||
af->person[ta.index].last_action = b->turn;
|
af->person[ta.index].last_action = b->turn;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (standard_attack) {
|
if (standard_attack) {
|
||||||
|
|
|
@ -77,23 +77,29 @@ int *casualties)
|
||||||
battle *b = af->side->battle;
|
battle *b = af->side->battle;
|
||||||
troop dt;
|
troop dt;
|
||||||
int d = 0, enemies;
|
int d = 0, enemies;
|
||||||
weapon *wp = af->person[at->index].missile;
|
weapon *wp;
|
||||||
const resource_type *rtype = rt_find("catapultammo");
|
const resource_type *rtype;
|
||||||
|
|
||||||
|
if (au->status >= ST_AVOID) {
|
||||||
|
/* do not want to waste ammo. no shots fired */
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
wp = af->person[at->index].missile;
|
||||||
assert(wp->type == wtype);
|
assert(wp->type == wtype);
|
||||||
assert(af->person[at->index].reload == 0);
|
assert(af->person[at->index].reload == 0);
|
||||||
|
rtype = rt_find("catapultammo");
|
||||||
|
|
||||||
if (rtype) {
|
if (rtype) {
|
||||||
if (get_pooled(au, rtype, GET_SLACK | GET_RESERVE | GET_POOLED_SLACK, 1) <= 0) {
|
if (get_pooled(au, rtype, GET_SLACK | GET_RESERVE | GET_POOLED_SLACK, 1) <= 0) {
|
||||||
/* No ammo. Use other weapon if available. */
|
return false;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enemies = count_enemies(b, af, FIGHT_ROW, FIGHT_ROW, SELECT_ADVANCE);
|
enemies = count_enemies(b, af, FIGHT_ROW, FIGHT_ROW, SELECT_ADVANCE);
|
||||||
if (enemies > CATAPULT_ATTACKS) enemies = CATAPULT_ATTACKS;
|
if (enemies > CATAPULT_ATTACKS) enemies = CATAPULT_ATTACKS;
|
||||||
if (enemies == 0) {
|
if (enemies == 0) {
|
||||||
return true; /* allow further attacks */
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (af->catmsg == -1) {
|
if (af->catmsg == -1) {
|
||||||
|
@ -139,7 +145,7 @@ int *casualties)
|
||||||
if (casualties) {
|
if (casualties) {
|
||||||
*casualties = d;
|
*casualties = d;
|
||||||
}
|
}
|
||||||
return false; /* keine weitren attacken */
|
return true; /* catapult must reload */
|
||||||
}
|
}
|
||||||
|
|
||||||
void register_weapons(void)
|
void register_weapons(void)
|
||||||
|
|
Loading…
Reference in New Issue