forked from github/server
Neue Wirkung von Bauernblut
This commit is contained in:
parent
4b5464cfae
commit
c0a7762932
|
@ -160,8 +160,7 @@ get_food(region *r)
|
|||
{
|
||||
unit *u;
|
||||
int peasantfood = rpeasants(r)*10;
|
||||
int bauernblut = 0;
|
||||
boolean bfind = false;
|
||||
unit * demon = r->units;
|
||||
|
||||
/* 1. Versorgung von eigenen Einheiten. Das vorhandene Silber
|
||||
* wird zunächst so auf die Einheiten aufgeteilt, dass idealerweise
|
||||
|
@ -229,41 +228,47 @@ get_food(region *r)
|
|||
}
|
||||
}
|
||||
|
||||
/* 3. bestimmen, wie viele Bauern gefressen werden.
|
||||
* bei fehlenden Bauern den Dämon hungern lassen
|
||||
*/
|
||||
for (u = r->units; u; u = u->next) {
|
||||
if (u->race == new_race[RC_DAEMON]) {
|
||||
/* Alles Bauernblut der Region zählen.
|
||||
* warnung: bauernblut einer partei hilft im moment der anderen
|
||||
* so selten wie das benutzt wird, ist das erstmal wursht,
|
||||
* aber ein TODO fürs BUGS File.
|
||||
* Es ist auch deshalb fast egal, weil es ja im Grunde nicht dem Dämon,
|
||||
* sondern der Region zu gute kommt - und da ist der anwender schnuppe
|
||||
*/
|
||||
if (!bfind) {
|
||||
unit * ud = u;
|
||||
while (ud) {
|
||||
attrib * a = a_find(ud->attribs, &at_bauernblut);
|
||||
if (a) bauernblut += a->data.i;
|
||||
do { ud=ud->next; } while (ud && ud->race!=new_race[RC_DAEMON]);
|
||||
}
|
||||
bfind = true;
|
||||
int hungry = u->number;
|
||||
|
||||
while (demon!=NULL && hungry>0) {
|
||||
/* alwayy start with the first known uint that may have some blood */
|
||||
static const struct potion_type * pt_blood;
|
||||
unit * ud = demon;
|
||||
if (pt_blood==NULL) pt_blood = pt_find("peasantblood");
|
||||
demon = NULL; /* this will be re-set in the loop */
|
||||
while (ud!=NULL) {
|
||||
if (ud->race==new_race[RC_DAEMON]) {
|
||||
if (get_effect(ud, pt_blood)) {
|
||||
/* new best guess for first blood-donor: */
|
||||
if (demon==NULL) demon = ud;
|
||||
/* if he's in our faction, drain him: */
|
||||
if (ud->faction==u->faction) break;
|
||||
}
|
||||
}
|
||||
ud=ud->next;
|
||||
}
|
||||
if (ud!=NULL) {
|
||||
int blut = get_effect(ud, pt_blood);
|
||||
blut = min(blut, hungry);
|
||||
change_effect(ud, pt_blood, -blut);
|
||||
hungry -= blut;
|
||||
}
|
||||
}
|
||||
if (r->planep == NULL || !fval(r->planep, PFL_NOFEED)) {
|
||||
int demons = u->number;
|
||||
if (bauernblut>=demons) {
|
||||
bauernblut -= demons;
|
||||
demons = 0;
|
||||
} else if (bauernblut) {
|
||||
demons-=bauernblut;
|
||||
}
|
||||
if (peasantfood>=demons) {
|
||||
peasantfood -= demons;
|
||||
demons = 0;
|
||||
if (peasantfood>=hungry) {
|
||||
peasantfood -= hungry;
|
||||
hungry = 0;
|
||||
} else {
|
||||
demons -= peasantfood;
|
||||
hungry -= peasantfood;
|
||||
peasantfood = 0;
|
||||
}
|
||||
if (demons > 0) {
|
||||
hunger(demons, u); /* nicht gefütterte dämonen hungern */
|
||||
if (hungry > 0) {
|
||||
hunger(hungry, u); /* nicht gefütterte dämonen hungern */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,9 +87,11 @@ herbsearch(region * r, unit * u, int max)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef OLD_DEMON_POTION
|
||||
attrib_type at_bauernblut = {
|
||||
"bauernblut", NULL, NULL, NULL, NULL, NULL
|
||||
};
|
||||
#endif
|
||||
|
||||
int
|
||||
use_potion(unit * u, const item_type * itype, int amount, const char * cmd)
|
||||
|
@ -99,10 +101,9 @@ use_potion(unit * u, const item_type * itype, int amount, const char * cmd)
|
|||
assert(ptype!=NULL);
|
||||
|
||||
if (use != NULL && use!=ptype) {
|
||||
add_message(&u->faction->msgs,
|
||||
new_message(u->faction,
|
||||
"errusingpotion%u:unit%X:using%s:command",
|
||||
u, use->itype->rtype, cmd));
|
||||
ADDMSG(&u->faction->msgs,
|
||||
msg_message("errusingpotion", "unit using command",
|
||||
u, use->itype->rtype, cmd));
|
||||
return ECUSTOM;
|
||||
}
|
||||
|
||||
|
|
|
@ -83,8 +83,9 @@ void herbsearch(struct region * r, struct unit * u, int max);
|
|||
int use_potion(struct unit * u, const struct item_type * itype, int amount, const char * cmd);
|
||||
void init_potions(void);
|
||||
|
||||
#ifdef OLD_DEMON_POTION
|
||||
extern struct attrib_type at_bauernblut;
|
||||
|
||||
#endif
|
||||
extern int get_effect(const struct unit * u, const struct potion_type * effect);
|
||||
extern int change_effect(struct unit * u, const struct potion_type * effect, int value);
|
||||
extern attrib_type at_effect;
|
||||
|
|
|
@ -3079,7 +3079,6 @@ attrib_init(void)
|
|||
at_register(&at_eventhandler);
|
||||
at_register(&at_stealth);
|
||||
at_register(&at_mage);
|
||||
at_register(&at_bauernblut);
|
||||
at_register(&at_countdown);
|
||||
at_register(&at_showitem);
|
||||
at_register(&at_curse);
|
||||
|
|
|
@ -428,6 +428,7 @@ static const char * it_aliases[][2] = {
|
|||
{ "Runenschwert", "runesword" },
|
||||
{ "p12", "truthpotion" },
|
||||
{ "p1", "goliathwater" },
|
||||
{ "p5", "peasantblood" },
|
||||
{ NULL, NULL },
|
||||
};
|
||||
static const char *
|
||||
|
@ -1392,7 +1393,7 @@ static translate_t translation[] = {
|
|||
{ "Laen", "laen", "laen_p", "laen", "laen_p" },
|
||||
{ "Goliathwasser", "goliathwater", "goliathwater_p", NULL, NULL },
|
||||
{ "Wasser des Lebens", "p2", "p2_p", NULL, NULL },
|
||||
{ "Bauernblut", "p5", "p5_p", NULL, NULL },
|
||||
{ "Bauernblut", "peasantblood", "peasantblood_p", NULL, NULL },
|
||||
{ "Gehirnschmalz", "p6", "p6_p", NULL, NULL },
|
||||
{ "Nestwärme", "p8", "p8_p", NULL, NULL },
|
||||
{ "Pferdeglück", "p9", "p9_p", NULL, NULL },
|
||||
|
@ -1997,21 +1998,21 @@ use_foolpotion(struct unit *u, int targetno, const struct item_type *itype, int
|
|||
static int
|
||||
use_bloodpotion(struct unit *u, const struct potion_type *ptype, int amount, const char *cmd)
|
||||
{
|
||||
int i;
|
||||
assert(ptype==oldpotiontype[P_BAUERNBLUT]);
|
||||
unused(ptype);
|
||||
for (i=0;i!=amount;++i) {
|
||||
if (old_race(u->race) == RC_DAEMON) {
|
||||
attrib * a = (attrib*)a_find(u->attribs, &at_bauernblut);
|
||||
if (!a) a = a_add(&u->attribs, a_new(&at_bauernblut));
|
||||
a->data.i += 100;
|
||||
} else {
|
||||
/* bekommt nicht: */
|
||||
cmistake(u, cmd, 165, MSG_EVENT);
|
||||
u->race = new_race[RC_GHOUL];
|
||||
u_setfaction(u, findfaction(MONSTER_FACTION));
|
||||
break;
|
||||
}
|
||||
if (u->race == new_race[RC_DAEMON] ) {
|
||||
#ifdef OLD_DEMON_POTION
|
||||
attrib * a = (attrib*)a_find(u->attribs, &at_bauernblut);
|
||||
if (!a) a = a_add(&u->attribs, a_new(&at_bauernblut));
|
||||
a->data.i += 100*amount;
|
||||
#else
|
||||
change_effect(u, ptype, 100*amount);
|
||||
#endif
|
||||
} else {
|
||||
/* bekommt nicht: */
|
||||
cmistake(u, cmd, 165, MSG_EVENT);
|
||||
u->race = new_race[RC_GHOUL];
|
||||
u_setfaction(u, findfaction(MONSTER_FACTION));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1506,7 +1506,7 @@
|
|||
<string name="p4">
|
||||
<text locale="de">Wundsalbe</text>
|
||||
</string>
|
||||
<string name="p5">
|
||||
<string name="peasantblood">
|
||||
<text locale="de">Bauernblut</text>
|
||||
</string>
|
||||
<string name="p6">
|
||||
|
@ -1552,7 +1552,7 @@
|
|||
<string name="p4_p">
|
||||
<text locale="de">Wundsalben</text>
|
||||
</string>
|
||||
<string name="p5_p">
|
||||
<string name="peasantblood_p">
|
||||
<text locale="de">Bauernblut</text>
|
||||
</string>
|
||||
<string name="p6_p">
|
||||
|
|
|
@ -1506,7 +1506,7 @@
|
|||
<string name="p4">
|
||||
<text locale="de">Wundsalbe</text>
|
||||
</string>
|
||||
<string name="p5">
|
||||
<string name="peasantblood">
|
||||
<text locale="de">Bauernblut</text>
|
||||
</string>
|
||||
<string name="p6">
|
||||
|
@ -1552,7 +1552,7 @@
|
|||
<string name="p4_p">
|
||||
<text locale="de">Wundsalben</text>
|
||||
</string>
|
||||
<string name="p5_p">
|
||||
<string name="peasantblood_p">
|
||||
<text locale="de">Bauernblut</text>
|
||||
</string>
|
||||
<string name="p6_p">
|
||||
|
|
|
@ -1109,10 +1109,10 @@
|
|||
<string name="p4_p">
|
||||
<text locale="en">ointments</text>
|
||||
</string>
|
||||
<string name="p5">
|
||||
<string name="peasantblood">
|
||||
<text locale="en">peasant blood</text>
|
||||
</string>
|
||||
<string name="p5_p">
|
||||
<string name="peasantblood_p">
|
||||
<text locale="en">peasant bloods</text>
|
||||
</string>
|
||||
<string name="p6">
|
||||
|
|
|
@ -1133,10 +1133,10 @@
|
|||
<string name="p4_p">
|
||||
<text locale="fr">onguents de soin</text>
|
||||
</string>
|
||||
<string name="p5">
|
||||
<string name="peasantblood">
|
||||
<text locale="fr">fiole d'essence vitale</text>
|
||||
</string>
|
||||
<string name="p5_p">
|
||||
<string name="peasantblood_p">
|
||||
<text locale="fr">fioles d'essence vitale</text>
|
||||
</string>
|
||||
<string name="p6">
|
||||
|
|
Loading…
Reference in New Issue