From d1751cb0a3a5a97e6a81d3f211be962848a688df Mon Sep 17 00:00:00 2001 From: Christian Schlittchen Date: Fri, 20 Feb 2004 22:41:49 +0000 Subject: [PATCH] - Pyramidenfindezauber interessanter gemacht. --- src/common/kernel/spell.c | 46 ++++++++++++++++++++++++--------------- src/res/messages.xml | 8 ++++--- 2 files changed, 34 insertions(+), 20 deletions(-) diff --git a/src/common/kernel/spell.c b/src/common/kernel/spell.c index 4dc7fe79c..63f85c83b 100644 --- a/src/common/kernel/spell.c +++ b/src/common/kernel/spell.c @@ -7229,32 +7229,44 @@ sp_becomewyrm(castorder *co) * Stufe: unterschiedlich * Gebiet: alle * Wirkung: - * gibt an, ob sich der Magier in einer Pyramidenbauregion - * befindet. + * gibt die ungefaehre Entfernung zur naechstgelegenen Pyramiden- + * region an. * * Flags: */ static int sp_wdwpyramid(castorder *co) { - region *r = co->rt; - unit *mage = (unit *)co->magician; - int cast_level = co->level; - - if(!(landregion(rterrain(r)))){ - cmistake(mage, strdup(co->order), 186, MSG_MAGIC); - return 0; - } + region *r = co->rt; + unit *mage = (unit *)co->magician; + int cast_level = co->level; if(a_find(r->attribs, &at_wdwpyramid) != NULL) { - add_message(&mage->faction->msgs, new_message(mage->faction, - "wdw_pyramidspell_found%u:mage%r:region%s:command", - mage, r, strdup(co->order))); - + ADDMSG(&mage->faction->msgs, msg_message("wdw_pyramidspell_found", + "unit region command", mage, r, strdup(co->order))); } else { - add_message(&mage->faction->msgs, new_message(mage->faction, - "wdw_pyramidspell_notfound%u:mage%r:region%s:command", - mage, r, strdup(co->order))); + region *r2; + int mindist = -1; + int minshowdist; + int maxshowdist; + + for(r2 = regions; r2; r2 = r2->next) { + if(a_find(r->attribs, &at_wdwpyramid) != NULL) { + short dist = distance(mage->region, r2); + if(dist < mindist) { + mindist = dist; + } + } + } + + assert(mindist >= 1); + + minshowdist = mindist - rand()%5; + maxshowdist = minshowdist + 4; + + ADDMSG(&mage->faction->msgs, msg_message("wdw_pyramidspell_notfound", + "unit region command mindist maxdist", mage, r, strdup(co->order), + max(1, minshowdist), maxshowdist)); } return cast_level; diff --git a/src/res/messages.xml b/src/res/messages.xml index 425ac1812..dbe8726c6 100644 --- a/src/res/messages.xml +++ b/src/res/messages.xml @@ -5633,9 +5633,11 @@ + + - "$unit($unit) in $region($region): '$command' - In dieser Regione können keine Pyramiden gebaut werden." - "$unit($unit) in $region($region): '$command' - No pyramids may be build in this region." - "$unit($unit) in $region($region): '$command' - No pyramids may be build in this region." + "$unit($unit) in $region($region): '$command' - In dieser Region können keine Pyramiden gebaut werden. Die nächste Pyramidenregion ist zwischen $int($mindist) und $int($maxdist) Regionen entfernt." + "$unit($unit) in $region($region): '$command' - No pyramids may be build in this region. The closest region to build a pyramid in is between $int($mindist) and $int($maxdist) regions away." + "$unit($unit) in $region($region): '$command' - No pyramids may be build in this region. The closest region to build a pyramid in is between $int($mindist) and $int($maxdist) regions away."