rename global target flag, invert logic

This commit is contained in:
Enno Rehling 2018-05-08 21:43:13 +02:00
parent 4bcaaa5f79
commit ccf09770e3
4 changed files with 12 additions and 11 deletions

View File

@ -411,10 +411,10 @@
<spell name="sparkledream" rank="5" parameters="u" los="true" ship="true" variable="true"> <spell name="sparkledream" rank="5" parameters="u" los="true" ship="true" variable="true">
<resource name="aura" amount="1" cost="level"/> <resource name="aura" amount="1" cost="level"/>
</spell> </spell>
<spell name="pull_astral" rank="7" parameters="ru+" variable="true" target_global="true"> <spell name="pull_astral" rank="7" parameters="ru+" variable="true" globaltarget="true">
<resource name="aura" amount="2" cost="level"/> <resource name="aura" amount="2" cost="level"/>
</spell> </spell>
<spell name="fetch_astral" rank="7" parameters="u+" variable="true" target_global="true"> <spell name="fetch_astral" rank="7" parameters="u+" variable="true" globaltarget="true">
<resource name="aura" amount="2" cost="level"/> <resource name="aura" amount="2" cost="level"/>
</spell> </spell>
<spell name="shockwave" rank="5" variable="true" combat="2"> <spell name="shockwave" rank="5" variable="true" combat="2">

View File

@ -1475,7 +1475,7 @@ verify_ship(region * r, unit * mage, const spell * sp, spllprm * spobj,
{ {
ship *sh = findship(spobj->data.i); ship *sh = findship(spobj->data.i);
if (sh != NULL && sh->region != r && (sp->sptyp & SEARCHLOCAL)) { if (sh != NULL && sh->region != r && (sp->sptyp & GLOBALTARGET) == 0) {
/* Burg muss in gleicher Region sein */ /* Burg muss in gleicher Region sein */
sh = NULL; sh = NULL;
} }
@ -1498,7 +1498,7 @@ verify_building(region * r, unit * mage, const spell * sp, spllprm * spobj,
{ {
building *b = findbuilding(spobj->data.i); building *b = findbuilding(spobj->data.i);
if (b != NULL && b->region != r && (sp->sptyp & SEARCHLOCAL)) { if (b != NULL && b->region != r && (sp->sptyp & GLOBALTARGET) == 0) {
/* Burg muss in gleicher Region sein */ /* Burg muss in gleicher Region sein */
b = NULL; b = NULL;
} }
@ -1552,14 +1552,15 @@ verify_unit(region * r, unit * mage, const spell * sp, spllprm * spobj,
default: default:
assert(!"shouldn't happen, this"); assert(!"shouldn't happen, this");
} }
if (u != NULL && (sp->sptyp & SEARCHLOCAL)) { if (u != NULL) {
if (u->region != r) if (u->region == r) {
u = NULL;
else if (sp->sptyp & TESTCANSEE) {
if (!cansee(mage->faction, r, u, 0) && !ucontact(u, mage)) { if (!cansee(mage->faction, r, u, 0) && !ucontact(u, mage)) {
u = NULL; u = NULL;
} }
} }
else if ((sp->sptyp & GLOBALTARGET) == 0) {
u = NULL;
}
} }
if (u == NULL) { if (u == NULL) {

View File

@ -174,7 +174,7 @@ extern "C" {
#define NOTFAMILIARCAST (1<<12) #define NOTFAMILIARCAST (1<<12)
#define TESTRESISTANCE (1<<13) /* alle Zielobjekte (u, s, b, r) auf #define TESTRESISTANCE (1<<13) /* alle Zielobjekte (u, s, b, r) auf
Magieresistenz prüfen */ Magieresistenz prüfen */
#define SEARCHLOCAL (1<<14) /* Ziel muss in der target_region sein */ #define GLOBALTARGET (1<<14) /* Ziel muss in der target_region sein */
#define TESTCANSEE (1<<15) /* alle Zielunits auf cansee prüfen */ #define TESTCANSEE (1<<15) /* alle Zielunits auf cansee prüfen */
#define ANYTARGET (UNITSPELL|REGIONSPELL|BUILDINGSPELL|SHIPSPELL) /* wirkt auf alle objekttypen (unit, ship, building, region) */ #define ANYTARGET (UNITSPELL|REGIONSPELL|BUILDINGSPELL|SHIPSPELL) /* wirkt auf alle objekttypen (unit, ship, building, region) */

View File

@ -1169,8 +1169,6 @@ static int parse_spells(xmlDocPtr doc)
sp->rank = (char)xml_ivalue(node, "rank", 0); sp->rank = (char)xml_ivalue(node, "rank", 0);
if (xml_bvalue(node, "los", false)) if (xml_bvalue(node, "los", false))
sp->sptyp |= TESTCANSEE; /* must see or have contact */ sp->sptyp |= TESTCANSEE; /* must see or have contact */
if (!xml_bvalue(node, "target_global", false))
sp->sptyp |= SEARCHLOCAL; /* must be in same region */
if (xml_bvalue(node, "ship", false)) if (xml_bvalue(node, "ship", false))
sp->sptyp |= ONSHIPCAST; sp->sptyp |= ONSHIPCAST;
if (xml_bvalue(node, "ocean", false)) if (xml_bvalue(node, "ocean", false))
@ -1180,6 +1178,8 @@ static int parse_spells(xmlDocPtr doc)
if (xml_bvalue(node, "variable", false)) if (xml_bvalue(node, "variable", false))
sp->sptyp |= SPELLLEVEL; sp->sptyp |= SPELLLEVEL;
if (xml_bvalue(node, "globaltarget", false))
sp->sptyp |= GLOBALTARGET; /* target need not be in same region */
if (xml_bvalue(node, "buildingtarget", false)) if (xml_bvalue(node, "buildingtarget", false))
sp->sptyp |= BUILDINGSPELL; sp->sptyp |= BUILDINGSPELL;
if (xml_bvalue(node, "shiptarget", false)) if (xml_bvalue(node, "shiptarget", false))