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