forked from github/server
use_item message with amount instead of usepotion without.
This commit is contained in:
parent
4a3ad7ac84
commit
d065cbfca7
|
@ -6783,6 +6783,14 @@
|
||||||
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - ${error}."</text>
|
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - ${error}."</text>
|
||||||
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - ${error}."</text>
|
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - ${error}."</text>
|
||||||
</message>
|
</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">
|
<message name="use_item" section="events">
|
||||||
<type>
|
<type>
|
||||||
<arg name="unit" type="unit"/>
|
<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="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>
|
<text locale="en">"$unit($unit) collected $int($amount) silver trade tax in $region($region)."</text>
|
||||||
</message>
|
</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">
|
<message name="pest" section="events">
|
||||||
<type>
|
<type>
|
||||||
<arg name="dead" type="int"/>
|
<arg name="dead" type="int"/>
|
||||||
|
|
|
@ -38,7 +38,7 @@ function test_nestwarmth_insect()
|
||||||
turn_process()
|
turn_process()
|
||||||
assert_equal(flags+64, u.flags) -- UFL_WARMTH
|
assert_equal(flags+64, u.flags) -- UFL_WARMTH
|
||||||
assert_equal(1, u:get_item("nestwarmth"))
|
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()
|
turn_end()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -135,6 +135,7 @@ function test_use_healing_potion()
|
||||||
turn_process()
|
turn_process()
|
||||||
assert_equal(530, u.hp)
|
assert_equal(530, u.hp)
|
||||||
assert_equal(0, u:get_item("p14"))
|
assert_equal(0, u:get_item("p14"))
|
||||||
|
assert_equal(1, f:count_msg_type('use_item'))
|
||||||
turn_end()
|
turn_end()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -188,7 +189,7 @@ function test_use_ointment()
|
||||||
process_orders()
|
process_orders()
|
||||||
assert_equal(530, u.hp)
|
assert_equal(530, u.hp)
|
||||||
assert_equal(0, u:get_item("ointment"))
|
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
|
end
|
||||||
|
|
||||||
function test_use_domore()
|
function test_use_domore()
|
||||||
|
@ -200,7 +201,7 @@ function test_use_domore()
|
||||||
process_orders()
|
process_orders()
|
||||||
assert_equal(10, u:effect("p3"))
|
assert_equal(10, u:effect("p3"))
|
||||||
assert_equal(0, u:get_item("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:clear_orders()
|
||||||
u:set_skill('weaponsmithing', 3)
|
u:set_skill('weaponsmithing', 3)
|
||||||
u:add_item("iron", 2)
|
u:add_item("iron", 2)
|
||||||
|
@ -221,7 +222,7 @@ function test_bloodpotion_demon()
|
||||||
process_orders()
|
process_orders()
|
||||||
assert_equal(100, u:effect('peasantblood'))
|
assert_equal(100, u:effect('peasantblood'))
|
||||||
assert_equal(0, u:get_item("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)
|
assert_equal("demon", u.race)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -235,6 +236,6 @@ function test_bloodpotion_other()
|
||||||
process_orders()
|
process_orders()
|
||||||
assert_equal(0, u:effect('peasantblood'))
|
assert_equal(0, u:effect('peasantblood'))
|
||||||
assert_equal(0, u:get_item("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)
|
assert_equal("smurf", u.race)
|
||||||
end
|
end
|
||||||
|
|
|
@ -202,27 +202,28 @@ int use_potion(unit * u, const item_type * itype, int amount, struct order *ord)
|
||||||
{
|
{
|
||||||
region *r = u->region;
|
region *r = u->region;
|
||||||
|
|
||||||
ADDMSG(&u->faction->msgs, msg_message("usepotion",
|
|
||||||
"unit potion", u, itype->rtype));
|
|
||||||
|
|
||||||
if (itype == oldpotiontype[P_PEOPLE]) {
|
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]) {
|
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]) {
|
else if (itype == oldpotiontype[P_HEAL]) {
|
||||||
return potion_healing(u, amount);
|
amount = potion_healing(u, amount);
|
||||||
}
|
}
|
||||||
else if (itype == oldpotiontype[P_OINTMENT]) {
|
else if (itype == oldpotiontype[P_OINTMENT]) {
|
||||||
return potion_ointment(u, amount);
|
amount = potion_ointment(u, amount);
|
||||||
}
|
}
|
||||||
else if (itype == oldpotiontype[P_MACHT]) {
|
else if (itype == oldpotiontype[P_MACHT]) {
|
||||||
return potion_power(u, amount);
|
amount = potion_power(u, amount);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
change_effect(u, itype, 10 * amount);
|
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;
|
return amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -304,8 +304,8 @@ struct order *ord)
|
||||||
use_pooled(u, itype->rtype, GET_SLACK | GET_RESERVE | GET_POOLED_SLACK,
|
use_pooled(u, itype->rtype, GET_SLACK | GET_RESERVE | GET_POOLED_SLACK,
|
||||||
amount);
|
amount);
|
||||||
|
|
||||||
ADDMSG(&u->faction->msgs, msg_message("usepotion",
|
ADDMSG(&u->faction->msgs, msg_message("use_item",
|
||||||
"unit potion", u, itype->rtype));
|
"unit amount item", u, amount, itype->rtype));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -369,8 +369,8 @@ static int use_warmthpotion(unit *u, const item_type *itype,
|
||||||
}
|
}
|
||||||
use_pooled(u, itype->rtype, GET_DEFAULT, amount);
|
use_pooled(u, itype->rtype, GET_DEFAULT, amount);
|
||||||
|
|
||||||
ADDMSG(&u->faction->msgs, msg_message("usepotion",
|
ADDMSG(&u->faction->msgs, msg_message("use_item",
|
||||||
"unit potion", u, itype->rtype));
|
"unit amount item", u, amount, itype->rtype));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue