diff --git a/src/alchemy.c b/src/alchemy.c index b51437967..4b7e961a6 100644 --- a/src/alchemy.c +++ b/src/alchemy.c @@ -155,17 +155,6 @@ static int potion_luck(unit *u, region *r, attrib_type *atype, int amount) { return amount; } -static int potion_power(unit *u, int amount) { - int hp = 10 * amount; - - if (hp > u->number) { - hp = u->number; - amount = (hp + 9) % 10; - } - u->hp += hp * unit_max_hp(u) * 4; - return amount; -} - int use_potion(unit * u, const item_type * itype, int amount, struct order *ord) { region *r = u->region; @@ -176,9 +165,6 @@ int use_potion(unit * u, const item_type * itype, int amount, struct order *ord) else if (itype == oldpotiontype[P_HORSE]) { amount = potion_luck(u, r, &at_horseluck, amount); } - else if (itype == oldpotiontype[P_MACHT]) { - amount = potion_power(u, amount); - } else { change_effect(u, itype, 10 * amount); } diff --git a/src/items.c b/src/items.c index 6f1981a08..41617c0d0 100644 --- a/src/items.c +++ b/src/items.c @@ -458,6 +458,25 @@ static int use_ointment(unit *u, const item_type *itype, return potion_ointment(u, amount); } +static int potion_power(unit *u, int amount) { + int hp = 10 * amount; + + if (hp > u->number) { + hp = u->number; + amount = (hp + 9) % 10; + } + u->hp += hp * unit_max_hp(u) * 4; + return amount; +} + +static int use_power_elixir(unit *u, const item_type *itype, + int amount, struct order *ord) +{ + ADDMSG(&u->faction->msgs, msg_message("use_item", + "unit amount item", u, amount, itype->rtype)); + return potion_power(u, amount); +} + void register_itemfunctions(void) { /* have tests: */ @@ -474,5 +493,6 @@ void register_itemfunctions(void) register_item_use(use_bloodpotion, "use_peasantblood"); register_item_use(use_ointment, "use_ointment"); register_item_use(use_healing_potion, "use_p14"); + register_item_use(use_power_elixir, "use_p13"); register_item_use(use_warmthpotion, "use_nestwarmth"); }