use_item message with amount instead of usepotion without.

This commit is contained in:
Enno Rehling 2018-02-17 15:30:38 +01:00
parent 4a3ad7ac84
commit d065cbfca7
5 changed files with 27 additions and 25 deletions

View File

@ -6783,6 +6783,14 @@
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - ${error}."</text>
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - ${error}."</text>
</message>
<message name="usepotion" section="events">
<type>
<arg name="unit" type="unit"/>
<arg name="potion" type="resource"/>
</type>
<text locale="de">"$unit($unit) benutzt $resource($potion,1)."</text>
<text locale="en">"$unit($unit) uses $resource($potion,1)."</text>
</message>
<message name="use_item" section="events">
<type>
<arg name="unit" type="unit"/>
@ -6974,14 +6982,6 @@
<text locale="de">"$unit($unit) verdient am Handel in $region($region) Steuern in Höhe von $int($amount) Silber."</text>
<text locale="en">"$unit($unit) collected $int($amount) silver trade tax in $region($region)."</text>
</message>
<message name="usepotion" section="events">
<type>
<arg name="unit" type="unit"/>
<arg name="potion" type="resource"/>
</type>
<text locale="de">"$unit($unit) benutzt $resource($potion,1)."</text>
<text locale="en">"$unit($unit) uses $resource($potion,1)."</text>
</message>
<message name="pest" section="events">
<type>
<arg name="dead" type="int"/>

View File

@ -38,7 +38,7 @@ function test_nestwarmth_insect()
turn_process()
assert_equal(flags+64, u.flags) -- UFL_WARMTH
assert_equal(1, u:get_item("nestwarmth"))
assert_equal(1, f:count_msg_type('usepotion'))
assert_equal(1, f:count_msg_type('use_item'))
turn_end()
end

View File

@ -135,6 +135,7 @@ function test_use_healing_potion()
turn_process()
assert_equal(530, u.hp)
assert_equal(0, u:get_item("p14"))
assert_equal(1, f:count_msg_type('use_item'))
turn_end()
end
@ -188,7 +189,7 @@ function test_use_ointment()
process_orders()
assert_equal(530, u.hp)
assert_equal(0, u:get_item("ointment"))
assert_equal(1, f:count_msg_type('usepotion'))
assert_equal(1, f:count_msg_type('use_item'))
end
function test_use_domore()
@ -200,7 +201,7 @@ function test_use_domore()
process_orders()
assert_equal(10, u:effect("p3"))
assert_equal(0, u:get_item("p3"))
assert_equal(1, f:count_msg_type('usepotion'))
assert_equal(1, f:count_msg_type('use_item'))
u:clear_orders()
u:set_skill('weaponsmithing', 3)
u:add_item("iron", 2)
@ -221,7 +222,7 @@ function test_bloodpotion_demon()
process_orders()
assert_equal(100, u:effect('peasantblood'))
assert_equal(0, u:get_item("peasantblood"))
assert_equal(1, f:count_msg_type('usepotion'))
assert_equal(1, f:count_msg_type('use_item'))
assert_equal("demon", u.race)
end
@ -235,6 +236,6 @@ function test_bloodpotion_other()
process_orders()
assert_equal(0, u:effect('peasantblood'))
assert_equal(0, u:get_item("peasantblood"))
assert_equal(1, f:count_msg_type('usepotion'))
assert_equal(1, f:count_msg_type('use_item'))
assert_equal("smurf", u.race)
end

View File

@ -202,27 +202,28 @@ int use_potion(unit * u, const item_type * itype, int amount, struct order *ord)
{
region *r = u->region;
ADDMSG(&u->faction->msgs, msg_message("usepotion",
"unit potion", u, itype->rtype));
if (itype == oldpotiontype[P_PEOPLE]) {
return potion_luck(u, r, &at_peasantluck, amount);
amount = potion_luck(u, r, &at_peasantluck, amount);
}
else if (itype == oldpotiontype[P_HORSE]) {
return potion_luck(u, r, &at_horseluck, amount);
amount = potion_luck(u, r, &at_horseluck, amount);
}
else if (itype == oldpotiontype[P_HEAL]) {
return potion_healing(u, amount);
amount = potion_healing(u, amount);
}
else if (itype == oldpotiontype[P_OINTMENT]) {
return potion_ointment(u, amount);
amount = potion_ointment(u, amount);
}
else if (itype == oldpotiontype[P_MACHT]) {
return potion_power(u, amount);
amount = potion_power(u, amount);
}
else {
change_effect(u, itype, 10 * amount);
}
if (amount > 0) {
ADDMSG(&u->faction->msgs, msg_message("use_item",
"unit amount item", u, amount, itype->rtype));
}
return amount;
}

View File

@ -304,8 +304,8 @@ struct order *ord)
use_pooled(u, itype->rtype, GET_SLACK | GET_RESERVE | GET_POOLED_SLACK,
amount);
ADDMSG(&u->faction->msgs, msg_message("usepotion",
"unit potion", u, itype->rtype));
ADDMSG(&u->faction->msgs, msg_message("use_item",
"unit amount item", u, amount, itype->rtype));
return 0;
}
@ -369,8 +369,8 @@ static int use_warmthpotion(unit *u, const item_type *itype,
}
use_pooled(u, itype->rtype, GET_DEFAULT, amount);
ADDMSG(&u->faction->msgs, msg_message("usepotion",
"unit potion", u, itype->rtype));
ADDMSG(&u->faction->msgs, msg_message("use_item",
"unit amount item", u, amount, itype->rtype));
return 0;
}