* BUGFIX: Kräuterbeutel und Phiolen

* Beschreibung Mistelzweig
* Implementation Mistelzweig-Effekt
This commit is contained in:
Enno Rehling 2002-01-01 20:51:18 +00:00
parent 455db07050
commit 658c384a92
17 changed files with 175 additions and 53 deletions

View file

@ -0,0 +1,41 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de)
* Henning Peters (faroul@beyond.kn-bremen.de)
* Enno Rehling (enno@eressea-pbem.de)
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
*
* This program may not be used, modified or distributed without
* prior permission by the authors of Eressea.
*/
#include <config.h>
#include "fleechance.h"
#include <attrib.h>
attrib_type at_fleechance = {
"fleechance",
NULL,
NULL,
NULL,
NULL,
NULL,
};
attrib *
make_fleechance(float fleechance)
{
attrib * a = a_new(&at_fleechance);
a->data.flt = fleechance;
return a;
}
void
init_fleechance(void)
{
at_register(&at_fleechance);
}

View file

@ -0,0 +1,18 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de)
* Henning Peters (faroul@beyond.kn-bremen.de)
* Enno Rehling (enno@eressea-pbem.de)
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
*
* This program may not be used, modified or distributed without
* prior permission by the authors of Eressea.
*/
extern struct attrib_type at_fleechance;
extern struct attrib * make_fleechance(float fleechance);
extern void init_fleechance(void);

View file

@ -2041,35 +2041,39 @@ display_item(faction *f, unit *u, const item_type * itype)
FILE *fp;
char t[NAMESIZE + 1];
char filename[MAX_PATH];
const char *name;
const char *name, *info;
if (u && *i_find(&u->items, itype) == NULL) return false;
name = resourcename(itype->rtype, 0);
sprintf(filename, "%s/%s/items/%s", resourcepath(), locale_name(f->locale), name);
fp = fopen(filename, "r");
if (!fp) {
name = locale_string(f->locale, resourcename(itype->rtype, 0));
info = mkname("info", itype->rtype->_name[0]);
name = LOC(u->faction->locale, info);
if (name==info) {
name = resourcename(itype->rtype, 0);
sprintf(filename, "%s/%s/items/%s", resourcepath(), locale_name(f->locale), name);
fp = fopen(filename, "r");
}
if (!fp) {
name = resourcename(itype->rtype, 0);
sprintf(filename, "%s/items/%s", resourcepath(), name);
fp = fopen(filename, "r");
}
if (!fp) return false;
sprintf(buf, "%s: ", LOC(f->locale, name));
while (fgets(t, NAMESIZE, fp) != NULL) {
if (t[strlen(t) - 1] == '\n') {
t[strlen(t) - 1] = 0;
if (!fp) {
name = locale_string(f->locale, resourcename(itype->rtype, 0));
sprintf(filename, "%s/%s/items/%s", resourcepath(), locale_name(f->locale), name);
fp = fopen(filename, "r");
}
strcat(buf, t);
}
fclose(fp);
if (!fp) {
name = resourcename(itype->rtype, 0);
sprintf(filename, "%s/items/%s", resourcepath(), name);
fp = fopen(filename, "r");
}
if (!fp) return false;
addmessage(0, f, buf, MSG_EVENT, ML_IMPORTANT);
sprintf(buf, "%s: ", LOC(f->locale, name));
while (fgets(t, NAMESIZE, fp) != NULL) {
if (t[strlen(t) - 1] == '\n') {
t[strlen(t) - 1] = 0;
}
strcat(buf, t);
}
fclose(fp);
name = buf;
}
addmessage(0, f, name, MSG_EVENT, ML_IMPORTANT);
return true;
}

View file

@ -1466,8 +1466,8 @@ randomevents(void)
&& (u->race->flags & RCF_DESERT)) {
if (fval(u, FL_ISNEW)) continue;
if (rand()%100 < 5) {
ADDMSG(&u->faction->msgs, new_message(u->faction,
"desertion%u:unit%r:region", u, r));
ADDMSG(&u->faction->msgs, msg_message("desertion",
"unit region", u, r));
u_setfaction(u, findfaction(MONSTER_FACTION));
}
}

View file

@ -64,6 +64,7 @@ typedef enum combatmagic {
/* attributes includes */
#include <attributes/key.h>
#include <attributes/fleechance.h>
#include <attributes/racename.h>
#include <attributes/otherfaction.h>
#include <attributes/moved.h>
@ -2078,8 +2079,8 @@ double
fleechance(unit * u)
{
double c = 0.20; /* Fluchtwahrscheinlichkeit in % */
region *r = u->region;
region * r = u->region;
attrib * a = a_find(u->attribs, &at_fleechance);
/* Einheit u versucht, dem Getümmel zu entkommen */
c += (eff_skill(u, SK_STEALTH, r) * 0.05);
@ -2096,6 +2097,8 @@ fleechance(unit * u)
c = min(c, 0.75);
}
if (a!=NULL) c += a->data.flt;
return c;
}

View file

@ -2013,6 +2013,7 @@ init_tokens(const struct locale * lang)
init_directions(&lnames->directions, lang);
for (rc=races;rc;rc=rc->next) {
addtoken(&lnames->races, LOC(lang, rc_name(rc, 1)), (void*)rc);
addtoken(&lnames->races, LOC(lang, rc_name(rc, 0)), (void*)rc);
}
for (i=0;i!=MAXPARAMS;++i)
addtoken(&lnames->tokens[UT_PARAM], LOC(lang, parameters[i]), (void*)i);

View file

@ -32,6 +32,7 @@
#include "unit.h"
/* util includes */
#include <message.h>
#include <functions.h>
#include <goodies.h>
@ -1329,6 +1330,7 @@ static translate_t translation[] = {
{ "Mallorn", "mallorn", "mallorn_p", "mallorn", "mallorn_p" },
{ "Wagen", "cart", "cart_p", "cart", "cart_p" },
{ "Plattenpanzer", "plate", "plate_p", "plate", "plate_p" },
{ "Trollgürtel", "trollbelt", "trollbelt_p", "trollbelt", "trollbelt_p" },
{ "Balsam", "balm", "balm_p", "balm", "balm_p" },
{ "Gewürz", "spice", "spice_p", "spice", "spice_p" },
{ "Myrrhe", "myrrh", "myrrh_p", "myrrh", "myrrh_p" },
@ -1913,6 +1915,23 @@ use_bloodpotion(struct unit *u, const struct potion_type *ptype, const char *cmd
return 0;
}
#include <attributes/fleechance.h>
static int
use_mistletoe(struct unit * user, const struct item_type * itype, const char * cmd)
{
if (user->number!=1) {
ADDMSG(&user->faction->msgs, msg_message("use_singleperson",
"unit item region command", user, itype, user->region, cmd));
return -1;
}
new_use_pooled(user, itype->rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, 1);
a_add(&user->attribs, make_fleechance((float)1.0));
ADDMSG(&user->faction->msgs, msg_message("use_item",
"unit item", user, itype));
return 0;
}
void
init_oldpotions(void)
{
@ -2394,6 +2413,7 @@ init_items(void)
register_function((pf_generic)use_antimagiccrystal, "useantimagiccrystal");
register_function((pf_generic)use_warmthpotion, "usewarmthpotion");
register_function((pf_generic)use_bloodpotion, "usebloodpotion");
register_function((pf_generic)use_mistletoe, "usemistletoe");
register_function((pf_generic)give_horses, "givehorses");
}

View file

@ -293,6 +293,7 @@ int
read_messages(FILE * F, struct xml_stack * stack)
{
xml_state state;
memset(&state, 0, sizeof(state));
return xml_parse(F, &msgcallback, &state, stack);
}

View file

@ -4437,7 +4437,7 @@ sp_recruit(castorder *co)
rsetpeasants(r, rpeasants(r) - n);
u = create_unit(r, f, n, f->race, 0, (n == 1 ? "Bauer" : "Bauern"), mage);
set_string(&u->thisorder, locale_string(u->faction->locale, keywords[K_WORK]));
set_string(&u->thisorder, locale_string(u->faction->locale, "defaultorder"));
sprintf(buf, "%s konnte %d %s anwerben", unitname(mage), n,
n == 1 ? "Bauer" : "Bauern");
@ -4956,7 +4956,7 @@ sp_illusionary_shapeshift(castorder *co)
sprintf(buf, "%s %s keine %s-Gestalt annehmen.",
unitname(u),
u->number > 1 ? "können" : "kann",
rc_name(rc, 2));
LOC(u->faction->locale, rc_name(rc, 2)));
addmessage(r, mage->faction, buf, MSG_MAGIC, ML_MISTAKE);
return 0;
}
@ -4967,7 +4967,7 @@ sp_illusionary_shapeshift(castorder *co)
u->irace = rc;
sprintf(buf, "%s läßt %s als %s erscheinen.",
unitname(mage), unitname(u), rc_name(rc, u->number != 1));
unitname(mage), unitname(u), LOC(u->faction->locale, rc_name(rc, u->number != 1)));
addmessage(r, mage->faction, buf, MSG_MAGIC, ML_INFO);
return cast_level;

View file

@ -25,6 +25,7 @@ typedef struct attrib {
afun f;
void * v;
int i;
float flt;
char c;
short s;
short sa[2];

View file

@ -98,6 +98,7 @@ xml_parse(FILE * stream, struct xml_callbacks * cb, void * data, xml_stack * sta
{
xml_stack * start = stack;
enum { TAG, ENDTAG, ATNAME, ATVALUE, PLAIN } state = PLAIN;
boolean startline = true;
char tokbuffer[1024];
char * pos = tokbuffer;
int quoted = 0;
@ -199,8 +200,20 @@ xml_parse(FILE * stream, struct xml_callbacks * cb, void * data, xml_stack * sta
case '>':
*pos='\0';
return cb_error(stack, tokbuffer, line, XML_INVALIDCHAR, data);
case '\n':
/* ignore */
if (!startline) *pos++ = ' ';
startline = true;
break;
case ' ':
case '\t':
if (!startline) {
*pos++ = (char)c;
}
break;
default:
*pos++ = (char)c;
startline = false;
}
break; /* case PLAIN */
case TAG:
@ -219,6 +232,7 @@ xml_parse(FILE * stream, struct xml_callbacks * cb, void * data, xml_stack * sta
}
if (cb && cb->tagbegin) cb->tagbegin(stack, data);
state = PLAIN;
startline = true;
pos = tokbuffer;
break;
default:

View file

@ -717,7 +717,11 @@ main(int argc, char *argv[])
for (u=r->units;u;u=u->next) scale_number(u, 1);
}
}
if (g_writemap) return crwritemap();
if (g_writemap) return crwritemap();
{
faction * monster = findfaction(MONSTER_FACTION);
display_item(monster, monster->units, it_find("mistletoe"));
}
if ((i=processturn(orders))!=0) return i;
#ifdef CLEANUP_CODE

View file

@ -317,36 +317,44 @@
<text locale="en">"'$command' - $unit($unit) marched into $region($region) during the last turn and is too exhausted to attack."</text>
</message>
<message name="mistake">
<message name="use_singleperson" section="errors">
<type>
<arg name="unit" type="unit"></arg>
<arg name="item" type="resource"></arg>
<arg name="region" type="region"></arg>
<arg name="command" type="string"></arg>
</type>
<text locale="de">"$unit($unit) in $region($region): '$command' - $resource($item,0) können nur von Ein-Personen Einheiten benutzt werden."</text>
<text locale="en">"$unit($unit) in $region($region): '$command' - $resource($item,0) can only be used by single-person units."</text>
</message>
<message name="use_item" section="events">
<type>
<arg name="unit" type="unit"></arg>
<arg name="item" type="resource"></arg>
</type>
<text locale="de">"$unit($unit) benutzt ein $resource($item,1)."</text>
<text locale="en">"$unit($unit) uses a $resource($item,1)."</text>
</message>
<message name="mistake" section="errors">
<type>
<arg name="unit" type="unit"></arg>
<arg name="region" type="region"></arg>
<arg name="command" type="string"></arg>
<arg name="error" type="string"></arg>
</type>
<locale name="de">
<nr section="errors">
<text>"$unit($unit) in $region($region): '$command' - ${error}."</text>
</nr>
</locale>
<text locale="de">"$unit($unit) in $region($region): '$command' - ${error}."</text>
</message>
<message name="error1">
<message name="error1" section="errors">
<type>
<arg name="unit" type="unit"></arg>
<arg name="region" type="region"></arg>
<arg name="command" type="string"></arg>
</type>
<locale name="de">
<nr section="errors">
<text>"$unit($unit) in $region($region): '$command' - Auf dem Schiff befinden sich zuwenig erfahrene Seeleute."</text>
</nr>
</locale>
<locale name="en">
<nr section="errors">
<text>"$unit($unit) in $region($region): '$command' - There are not enough experienced sailors on board the ship."</text>
</nr>
</locale>
<text locale="de">"$unit($unit) in $region($region): '$command' - Auf dem Schiff befinden sich zuwenig erfahrene Seeleute."</text>
<text locale="en">"$unit($unit) in $region($region): '$command' - There are not enough experienced sailors on board the ship."</text>
</message>
<message name="error2">
@ -7345,7 +7353,7 @@
<text locale="de">"Zur Feier des Geburtstags von ${name} wird in $region($region) ein großes Feuerwerk abgebrannt, welches noch hier zu bewundern ist. Kaskaden bunter Sterne, leuchtende Wasserfälle aus Licht und strahlende Feuerdrachen erhellen den Himmel."</text>
<text locale="en">"A large firework in honor of ${name}, visible all over the sky, has been started in $region($region)."
</message>
<message name="birthday_firework_local">
<type>
<arg name="unit" type="unit"></arg>
@ -7354,7 +7362,7 @@
<text locale="de">"Zur Feier des Geburtstags von ${name} brennt $unit($unit) ein großes Feuerwerk ab. Kaskaden bunter Sterne, leuchtende Wasserfälle aus Licht und strahlende Feuerdrachen erhellen den Himmel."</text>
<text locale="en">"A large firework in honor of ${name} is visible all over the sky."</text>
</message>
<message name="birthday_firework_noname">
<type>
<arg name="unit" type="unit"></arg>

View file

@ -5,6 +5,15 @@
</comment>
<strings>
<namespace name="info">
<string name="mistletoe">
<text locale="de">Im Mistelzweig ruht eine magische Kraft
besonderer Art. Der Anwender wird von seinen Feinden in Frieden
gelassen, eine Woche lang läßt jeder Kämpfer ihn unbeschadet
seines Weges ziehen.</text>
<text locale="en">The magical misteltoe has a wonderous property: It's use will make one person able to escape unharmed from every conflict, no enemy will lay hand on the bearer for one week.</text>
</string>
</namespace>
<namespace name="race">
<string name="clone">
<text locale="de">Klon</text>

View file

@ -9,7 +9,6 @@
<include file="races.xml"></include>
<include file="resources.xml"></include>
<include file="items.xml"></include>
<game name="Eressea" welcome="eressea">
<comment>Game specific</comment>

View file

@ -9,7 +9,6 @@
<include file="races.xml"></include>
<include file="resources.xml"></include>
<include file="items.xml"></include>
<game name="Vinyambar I" units="250" welcome="vinyambar">
<comment>Game specific</comment>

View file

@ -8,7 +8,7 @@
<include file="en/strings.xml"></include>
<include file="races.xml"></include>
<include file="items.xml"></include>
<include file="resources.xml"></include>
<game name="Vinyambar II" units="250" welcome="vinyambar">
<comment>Game specific</comment>