forked from github/server
Vertraute und Kampfzauber separated combat spells from regular attacks to allow monsters without regular attacks to have combat spells.
This commit is contained in:
parent
10e5dfb92e
commit
71dc067213
|
@ -1940,14 +1940,16 @@ attack(battle *b, troop ta, const att *a, int numattack)
|
||||||
int offset = row - FIGHT_ROW;
|
int offset = row - FIGHT_ROW;
|
||||||
|
|
||||||
switch(a->type) {
|
switch(a->type) {
|
||||||
case AT_STANDARD: /* Waffen, mag. Gegenstände, Kampfzauber */
|
|
||||||
case AT_COMBATSPELL:
|
case AT_COMBATSPELL:
|
||||||
if (numattack==0 && af->magic > 0) {
|
if (numattack==0 && af->magic > 0) {
|
||||||
/* Magier versuchen immer erstmal zu zaubern, erst wenn das
|
/* Magier versuchen immer erstmal zu zaubern, erst wenn das
|
||||||
* fehlschlägt, wird af->magic == 0 und der Magier kämpft
|
* fehlschlägt, wird af->magic == 0 und der Magier kämpft
|
||||||
* konventionell weiter */
|
* konventionell weiter */
|
||||||
do_combatspell(ta, row);
|
do_combatspell(ta, row);
|
||||||
} else {
|
}
|
||||||
|
break;
|
||||||
|
case AT_STANDARD: /* Waffen, mag. Gegenstände, Kampfzauber */
|
||||||
|
if (numattack > 0 || af->magic <= 0) {
|
||||||
weapon * wp = ta.fighter->person[ta.index].missile;
|
weapon * wp = ta.fighter->person[ta.index].missile;
|
||||||
if (row==FIGHT_ROW) wp = preferred_weapon(ta, true);
|
if (row==FIGHT_ROW) wp = preferred_weapon(ta, true);
|
||||||
/* Sonderbehandlungen */
|
/* Sonderbehandlungen */
|
||||||
|
|
|
@ -98,6 +98,9 @@ rc_new(const char * zName)
|
||||||
sprintf(zBuffer, "%s_x", zName);
|
sprintf(zBuffer, "%s_x", zName);
|
||||||
rc->_name[3] = strdup(zBuffer);
|
rc->_name[3] = strdup(zBuffer);
|
||||||
rc->precombatspell = NULL;
|
rc->precombatspell = NULL;
|
||||||
|
|
||||||
|
rc->attack[0].type = AT_COMBATSPELL;
|
||||||
|
rc->attack[1].type = AT_NONE;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1181,6 +1181,7 @@ parse_races(xmlDocPtr doc)
|
||||||
race * rc;
|
race * rc;
|
||||||
xmlXPathObjectPtr result;
|
xmlXPathObjectPtr result;
|
||||||
int k;
|
int k;
|
||||||
|
struct att * attack;
|
||||||
|
|
||||||
property = xmlGetProp(node, BAD_CAST "name");
|
property = xmlGetProp(node, BAD_CAST "name");
|
||||||
assert(property!=NULL);
|
assert(property!=NULL);
|
||||||
|
@ -1358,19 +1359,20 @@ parse_races(xmlDocPtr doc)
|
||||||
/* reading eressea/races/race/attack */
|
/* reading eressea/races/race/attack */
|
||||||
xpath->node = node;
|
xpath->node = node;
|
||||||
result = xmlXPathEvalExpression(BAD_CAST "attack", xpath);
|
result = xmlXPathEvalExpression(BAD_CAST "attack", xpath);
|
||||||
|
attack = rc->attack;
|
||||||
for (k=0;k!=result->nodesetval->nodeNr;++k) {
|
for (k=0;k!=result->nodesetval->nodeNr;++k) {
|
||||||
xmlNodePtr node = result->nodesetval->nodeTab[k];
|
xmlNodePtr node = result->nodesetval->nodeTab[k];
|
||||||
struct att * a = &rc->attack[k];
|
while (attack->type!=AT_NONE) ++attack;
|
||||||
|
|
||||||
property = xmlGetProp(node, BAD_CAST "damage");
|
property = xmlGetProp(node, BAD_CAST "damage");
|
||||||
if (property!=NULL) {
|
if (property!=NULL) {
|
||||||
a->data.dice = strdup((const char*)property);
|
attack->data.dice = strdup((const char*)property);
|
||||||
xmlFree(property);
|
xmlFree(property);
|
||||||
} else {
|
} else {
|
||||||
a->data.sp = xml_spell(node, "spell");
|
attack->data.sp = xml_spell(node, "spell");
|
||||||
}
|
}
|
||||||
a->type = xml_ivalue(node, "type", 0);
|
attack->type = xml_ivalue(node, "type", 0);
|
||||||
a->flags = xml_ivalue(node, "flags", 0);
|
attack->flags = xml_ivalue(node, "flags", 0);
|
||||||
}
|
}
|
||||||
xmlXPathFreeObject(result);
|
xmlXPathFreeObject(result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,7 +155,7 @@ fix_demand(region *r)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* nach 150 Rudnen ist Neustart erlaubt */
|
/* nach 150 Runden ist Neustart erlaubt */
|
||||||
#define MINAGE_MULTI 150
|
#define MINAGE_MULTI 150
|
||||||
newfaction *
|
newfaction *
|
||||||
read_newfactions(const char * filename)
|
read_newfactions(const char * filename)
|
||||||
|
@ -513,7 +513,8 @@ autoseed(newfaction ** players, int nsize, boolean new_island)
|
||||||
if (r->terrain==T_OCEAN && p==0 && (rmin==NULL || r->age<=MAXAGEDIFF)) {
|
if (r->terrain==T_OCEAN && p==0 && (rmin==NULL || r->age<=MAXAGEDIFF)) {
|
||||||
direction_t d;
|
direction_t d;
|
||||||
for (d=0;d!=MAXDIRECTIONS;++d) {
|
for (d=0;d!=MAXDIRECTIONS;++d) {
|
||||||
if (rconnect(r, d)==NULL) break;
|
region * rn = rconnect(r, d);
|
||||||
|
if (rn==NULL) break;
|
||||||
}
|
}
|
||||||
if (d!=MAXDIRECTIONS) {
|
if (d!=MAXDIRECTIONS) {
|
||||||
rmin=r;
|
rmin=r;
|
||||||
|
|
Loading…
Reference in New Issue