forked from github/server
"WdL erschafft nur 1 Schoessling pro Trank" Reparatur des vorangegangenen WdL-fixes. Es sollte nicht die Holzmenge, sondern die Trankmenge reduziert werden.
This commit is contained in:
parent
c4abd05ea4
commit
39ada16f6c
|
@ -89,65 +89,67 @@ herbsearch(region * r, unit * u, int max)
|
||||||
int
|
int
|
||||||
use_potion(unit * u, const item_type * itype, int amount, struct order *ord)
|
use_potion(unit * u, const item_type * itype, int amount, struct order *ord)
|
||||||
{
|
{
|
||||||
const potion_type * ptype = resource2potion(itype->rtype);
|
const potion_type * ptype = resource2potion(itype->rtype);
|
||||||
const potion_type * use = ugetpotionuse(u);
|
const potion_type * use = ugetpotionuse(u);
|
||||||
assert(ptype!=NULL);
|
assert(ptype!=NULL);
|
||||||
|
|
||||||
if (use != NULL && use!=ptype) {
|
if (use != NULL && use!=ptype) {
|
||||||
ADDMSG(&u->faction->msgs,
|
ADDMSG(&u->faction->msgs,
|
||||||
msg_message("errusingpotion", "unit using command",
|
msg_message("errusingpotion", "unit using command",
|
||||||
u, use->itype->rtype, ord));
|
u, use->itype->rtype, ord));
|
||||||
return ECUSTOM;
|
return ECUSTOM;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ptype==oldpotiontype[P_LIFE]) {
|
if (ptype==oldpotiontype[P_LIFE]) {
|
||||||
region * r = u->region;
|
region * r = u->region;
|
||||||
int holz = 0, x;
|
int holz = 0;
|
||||||
|
|
||||||
/* für die Aufforstung von Mallornwäldern braucht man Mallorn */
|
/* für die Aufforstung von Mallornwäldern braucht man Mallorn */
|
||||||
if (fval(r, RF_MALLORN)) {
|
if (fval(r, RF_MALLORN)) {
|
||||||
holz = use_pooled(u, rt_find("mallorn"),
|
holz = use_pooled(u, rt_find("mallorn"),
|
||||||
GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, 10*amount);
|
GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, 10*amount);
|
||||||
} else {
|
} else {
|
||||||
holz = use_pooled(u, rt_find("log"),
|
holz = use_pooled(u, rt_find("log"),
|
||||||
GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, 10*amount);
|
GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, 10*amount);
|
||||||
}
|
}
|
||||||
if (r->land==0) holz=0;
|
if (r->land==0) holz=0;
|
||||||
x = holz/10;
|
if (holz<10*amount) {
|
||||||
if (holz%10) ++x;
|
int x = holz/10;
|
||||||
if (x<holz) holz = x;
|
if (holz%10) ++x;
|
||||||
rsettrees(r, 1, rtrees(r, 1) + holz);
|
if (x<amount) amount = x;
|
||||||
|
}
|
||||||
|
rsettrees(r, 1, rtrees(r, 1) + holz);
|
||||||
ADDMSG(&u->faction->msgs, msg_message("growtree_effect",
|
ADDMSG(&u->faction->msgs, msg_message("growtree_effect",
|
||||||
"mage amount", u, holz));
|
"mage amount", u, holz));
|
||||||
} else if (ptype==oldpotiontype[P_HEAL]) {
|
} else if (ptype==oldpotiontype[P_HEAL]) {
|
||||||
return EUNUSABLE;
|
return EUNUSABLE;
|
||||||
} else if (ptype==oldpotiontype[P_HEILWASSER]) {
|
} else if (ptype==oldpotiontype[P_HEILWASSER]) {
|
||||||
u->hp = min(unit_max_hp(u) * u->number, u->hp + 400 * amount);
|
u->hp = min(unit_max_hp(u) * u->number, u->hp + 400 * amount);
|
||||||
} else if (ptype==oldpotiontype[P_PEOPLE]) {
|
} else if (ptype==oldpotiontype[P_PEOPLE]) {
|
||||||
region * r = u->region;
|
region * r = u->region;
|
||||||
attrib * a = (attrib*)a_find(r->attribs, &at_peasantluck);
|
attrib * a = (attrib*)a_find(r->attribs, &at_peasantluck);
|
||||||
if (!a) a = a_add(&r->attribs, a_new(&at_peasantluck));
|
if (!a) a = a_add(&r->attribs, a_new(&at_peasantluck));
|
||||||
a->data.i+=amount;
|
a->data.i+=amount;
|
||||||
} else if (ptype==oldpotiontype[P_HORSE]) {
|
} else if (ptype==oldpotiontype[P_HORSE]) {
|
||||||
region * r = u->region;
|
region * r = u->region;
|
||||||
attrib * a = (attrib*)a_find(r->attribs, &at_horseluck);
|
attrib * a = (attrib*)a_find(r->attribs, &at_horseluck);
|
||||||
if (!a) a = a_add(&r->attribs, a_new(&at_horseluck));
|
if (!a) a = a_add(&r->attribs, a_new(&at_horseluck));
|
||||||
a->data.i+=amount;
|
a->data.i+=amount;
|
||||||
} else if (ptype==oldpotiontype[P_WAHRHEIT]) {
|
} else if (ptype==oldpotiontype[P_WAHRHEIT]) {
|
||||||
fset(u, UFL_DISBELIEVES);
|
fset(u, UFL_DISBELIEVES);
|
||||||
amount=1;
|
amount=1;
|
||||||
} else if (ptype==oldpotiontype[P_MACHT]) {
|
} else if (ptype==oldpotiontype[P_MACHT]) {
|
||||||
/* Verfünffacht die HP von max. 10 Personen in der Einheit */
|
/* Verfünffacht die HP von max. 10 Personen in der Einheit */
|
||||||
u->hp += min(u->number, 10*amount) * unit_max_hp(u) * 4;
|
u->hp += min(u->number, 10*amount) * unit_max_hp(u) * 4;
|
||||||
} else {
|
} else {
|
||||||
change_effect(u, ptype, 10*amount);
|
change_effect(u, ptype, 10*amount);
|
||||||
}
|
}
|
||||||
use_pooled(u, ptype->itype->rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, amount);
|
use_pooled(u, ptype->itype->rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, amount);
|
||||||
usetpotionuse(u, ptype);
|
usetpotionuse(u, ptype);
|
||||||
|
|
||||||
ADDMSG(&u->faction->msgs, msg_message("usepotion",
|
ADDMSG(&u->faction->msgs, msg_message("usepotion",
|
||||||
"unit potion", u, ptype->itype->rtype));
|
"unit potion", u, ptype->itype->rtype));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************/
|
/*****************/
|
||||||
|
|
Loading…
Reference in New Issue