fix potion-use? need more testing

This commit is contained in:
Enno Rehling 2017-02-27 11:39:55 +01:00
parent 715c8569ba
commit 604b574d0f
4 changed files with 41 additions and 50 deletions

View File

@ -4,8 +4,7 @@
<!-- potions -->
<resource name="p0" appearance="vial">
<item weight="0" score="30">
<function name="use" value="usepotion"/>
<item weight="0" score="30" use="yes">
<potion level="1"/>
<construction skill="alchemy" minskill="2">
<requirement type="h4"/>
@ -15,8 +14,7 @@
</resource>
<resource name="goliathwater" appearance="vial">
<item weight="0" score="30">
<function name="use" value="usepotion"/>
<item weight="0" score="30" use="yes">
<potion level="1"/>
<construction skill="alchemy" minskill="2">
<requirement type="h6"/>
@ -26,8 +24,7 @@
</resource>
<resource name="truthpotion" appearance="vial">
<item weight="0" score="30">
<function name="use" value="usepotion"/>
<item weight="0" score="30" use="yes">
<potion level="1"/>
<construction skill="alchemy" minskill="2">
<requirement type="h0"/>
@ -37,8 +34,7 @@
</resource>
<resource name="p2" appearance="vial">
<item weight="0" score="30">
<function name="use" value="usepotion"/>
<item weight="0" score="30" use="yes">
<potion level="1"/>
<construction skill="alchemy" minskill="2">
<requirement type="h5"/>
@ -48,8 +44,7 @@
</resource>
<resource name="p3" appearance="vial">
<item weight="0" score="60">
<function name="use" value="usepotion"/>
<item weight="0" score="60" use="yes">
<potion level="2"/>
<construction skill="alchemy" minskill="4">
<requirement type="h14"/>
@ -61,8 +56,7 @@
<resource name="ointment" appearance="vial">
<!-- Wundsalbe -->
<item weight="0" score="60">
<function name="use" value="usehealingpotion"/>
<item weight="0" score="60" use="yes">
<potion level="2"/>
<construction skill="alchemy" minskill="4">
<requirement type="h19"/>
@ -74,8 +68,7 @@
<resource name="peasantblood" appearance="vial">
<!-- Bauernblut -->
<item weight="0" score="60">
<function name="use" value="usebloodpotion"/>
<item weight="0" score="60" use="yes">
<potion level="2"/>
<construction skill="alchemy" minskill="4">
<requirement type="h17"/>
@ -87,8 +80,7 @@
</resource>
<resource name="p6" appearance="vial">
<item weight="0" score="90">
<function name="use" value="usepotion"/>
<item weight="0" score="90" use="yes">
<potion level="3"/>
<construction skill="alchemy" minskill="6">
<requirement type="h9"/>
@ -100,8 +92,7 @@
</resource>
<resource name="p7" appearance="vial">
<item weight="0" score="90">
<function name="use" value="usefoolpotion"/>
<item weight="0" score="90" use="yes">
<potion level="3"/>
<construction skill="alchemy" minskill="6">
<requirement type="h2"/>
@ -113,8 +104,7 @@
</resource>
<resource name="nestwarmth" appearance="vial">
<item weight="0" score="90">
<function name="use" value="usewarmthpotion"/>
<item weight="0" score="90" use="yes">
<potion level="3"/>
<construction skill="alchemy" minskill="6">
<requirement type="h18"/>
@ -126,8 +116,7 @@
</resource>
<resource name="p9" appearance="vial">
<item weight="0" score="90">
<function name="use" value="usepotion"/>
<item weight="0" score="90" use="yes">
<potion level="3"/>
<construction skill="alchemy" minskill="6">
<requirement type="h4"/>
@ -139,8 +128,7 @@
</resource>
<resource name="p10" appearance="vial">
<item weight="0" score="90">
<function name="use" value="usepotion"/>
<item weight="0" score="90" use="yes">
<potion level="3"/>
<construction skill="alchemy" minskill="6">
<requirement type="h19"/>
@ -152,8 +140,7 @@
</resource>
<resource name="p11" appearance="vial">
<item weight="0" score="120">
<function name="use" value="usepotion"/>
<item weight="0" score="120" use="yes">
<potion level="4"/>
<construction skill="alchemy" minskill="8">
<requirement type="h14"/>
@ -166,8 +153,7 @@
</resource>
<resource name="p13" appearance="vial">
<item weight="0" score="120">
<function name="use" value="usepotion"/>
<item weight="0" score="120" use="yes">
<potion level="4"/>
<construction skill="alchemy" minskill="8">
<requirement type="h5"/>
@ -181,8 +167,7 @@
</resource>
<resource name="p14" appearance="vial">
<item weight="0" score="120">
<function name="use" value="usepotion"/>
<item weight="0" score="120" use="yes">
<potion level="4"/>
<construction skill="alchemy" minskill="8">
<requirement type="h6"/>

View File

@ -7,64 +7,56 @@
<resource name="ointment" appearance="vial">
<!-- Wundsalbe -->
<item weight="0" score="60">
<function name="use" value="usehealingpotion"/>
<item weight="0" score="60" use="yes">
<potion level="2"/>
</item>
</resource>
<resource name="p13" appearance="vial">
<!-- Elixier der Macht -->
<item weight="0" score="120">
<function name="use" value="usepotion"/>
<item weight="0" score="120" use="yes">
<potion level="4"/>
</item>
</resource>
<resource name="p3" appearance="vial">
<!-- Schaffenstrunk -->
<item weight="0" score="60">
<function name="use" value="usepotion"/>
<item weight="0" score="60" use ="yes">
<potion level="2"/>
</item>
</resource>
<resource name="p14" appearance="vial">
<!-- Heiltrank -->
<item weight="0" score="120">
<function name="use" value="usepotion"/>
<item weight="0" score="120" use="yes">
<potion level="4"/>
</item>
</resource>
<resource name="p0" appearance="vial">
<!-- Siebenmeilentee -->
<item weight="0" score="30">
<function name="use" value="usepotion"/>
<item weight="0" score="30" use="yes">
<potion level="1"/>
</item>
</resource>
<resource name="p2" appearance="vial">
<!-- Wasser des Lebens -->
<item weight="0" score="30">
<function name="use" value="usepotion_delayed"/>
<item weight="0" score="30" use="yes">
<potion level="1"/>
</item>
</resource>
<resource name="peasantblood" appearance="vial">
<!-- Bauernblut -->
<item weight="0" score="60">
<function name="use" value="usebloodpotion"/>
<item weight="0" score="60" use="yes">
<potion level="2"/>
</item>
</resource>
<resource name="p9" appearance="vial">
<!-- Pferdeglück -->
<item weight="0" score="90">
<function name="use" value="usepotion"/>
<item weight="0" score="90" use="yes">
<potion level="3"/>
</item>
</resource>

View File

@ -230,6 +230,21 @@ function test_no_uruk()
assert_equal(f1.race, "orc")
end
function test_ointment()
local r = region.create(0, 0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
local hp = u.hp
u.hp = 0
u:add_item("ointment", 1)
u:clear_orders()
u:add_order("BENUTZEN 1 Wundsalbe")
process_orders()
assert_equal(0, u:get_item("ointment"))
assert_equal(1, f:count_msg_type('usepotion'))
assert_equal(hp, u.hp)
end
function test_bloodpotion_demon()
local r = region.create(0, 0, "plain")
local f = faction.create("noreply@eressea.de", "demon", "de")

View File

@ -1287,13 +1287,12 @@ void register_resources(void)
register_function((pf_generic)res_changehp, "changehp");
register_function((pf_generic)res_changeaura, "changeaura");
register_item_use(use_potion, "usepotion");
register_item_use(use_potion_delayed, "usepotion_delayed");
register_item_use(use_potion_delayed, "use_p2");
register_item_use(use_tacticcrystal, "use_tacticcrystal");
register_item_use(use_birthdayamulet, "use_birthdayamulet");
register_item_use(use_warmthpotion, "usewarmthpotion");
register_item_use(use_warmthpotion, "use_nestwarmth");
register_item_use(use_bloodpotion, "use_peasantblood");
register_item_use(use_healingpotion, "usehealingpotion");
register_item_use(use_healingpotion, "use_ointment");
register_item_use(use_foolpotion, "use_p7");
register_item_use(use_mistletoe, "usemistletoe");
register_item_use(use_magicboost, "usemagicboost");