📄 itemeffect.lua
字号:
function hp_med_min( role , Item ) --[[迷你hp回复药品公式]]--
--LuaPrint("Enter function hp_med_min() --[[mini HP recovery potion formula]]--")
local hp = GetChaAttr( role , ATTR_HP )
local con = Con(role)
--LG("Potion Usage", "Current HP= ", hp , "\n" )
if hp <= 0 then --人物死亡时不可使用
--LuaPrint("Character dead or illegal HP value")
--LG("Potion Usage", "Character dead or illegal HP value","\n" )
return
end
hp_resume = 20 +con*5
hp = hp + hp_resume
mxhp = GetChaAttr( role , ATTR_MXHP)
if hp > mxhp then --加超过最大hp时返回为最大hp
hp = mxhp
--LG("Potion Usage", "Max HP cap reached", "\n" )
end
--LG("Potion Usage", "HP recovered to", hp ,"\n" )
SetCharaAttr(hp, role, ATTR_HP)
--LuaPrint("Out function hp_med_min() --[[mini HP recovery potion formula]]--")
end
function hp_med_small(role, Item ) --[[小型血瓶公式]]--
--LuaPrint("Enter function hp_med_small() --[[small HP potion formula]]--")
local hp = GetChaAttr(role, ATTR_HP)
local con = Con(role)
--LG("Potion Usage", "Current HP= ", hp , "\n" )
if hp <= 0 then
--LuaPrint("Character dead or illegal HP value") return
--LG("Potion Usage", "Character dead or illegal HP value","\n" )
end
hp_resume = 20+ con*5
hp = hp + hp_resume
mxhp = GetChaAttr(role,ATTR_MXHP)
if hp > mxhp then --加超过最大hp时返回为最大hp
hp = mxhp
--LG("Potion Usage", "Max HP cap reached", "\n" )
end
--LG("Potion Usage", "HP recovered to", hp ,"\n" )
SetCharaAttr(hp, role, ATTR_HP)
--LuaPrint("Out function hp_med_small() --[[small HP potion formula]]--")
end
----[[面包公式]]--————————————————————————————————————————————————————————————————————————————
function ItemUse_BREAD (role, Item ) --[[面包公式]]--
local hp = GetChaAttr(role, ATTR_HP)
--LG("Potion Usage", "Current HP= ", hp , "\n" )
if hp <= 0 then
--LuaPrint("Character dead or illegal HP value") return
--LG("Potion Usage", "Character dead or illegal HP value","\n" )
end
hp_resume = 80
hp = hp + hp_resume
mxhp = GetChaAttr(role,ATTR_MXHP)
if hp > mxhp then --加超过最大hp时返回为最大hp
hp = mxhp
--LG("Potion Usage", "Max HP cap reached", "\n" )
end
--LG("Potion Usage", "HP recovered to", hp ,"\n" )
SetCharaAttr(hp, role, ATTR_HP)
--LuaPrint("Out function hp_med_small() --[[Elven Fruit formula]]--")
end
----[[苹果公式]]--————————————————————————————————————————————————————————————————————————————
function ItemUse_APPLE ( role , Item ) --[[苹果公式]]--
local hp = GetChaAttr(role, ATTR_HP)
--LG("Potion Usage", "Current HP= ", hp , "\n" )
if hp <= 0 then
--LuaPrint("Character dead or illegal HP value") return
--LG("Potion Usage", "Character dead or illegal HP value","\n" )
end
hp_resume = 20
hp = hp + hp_resume
mxhp = GetChaAttr(role,ATTR_MXHP)
if hp > mxhp then --加超过最大hp时返回为最大hp
hp = mxhp
--LG("Potion Usage", "Max HP cap reached", "\n" )
end
--LG("Potion Usage", "HP recovered to", hp ,"\n" )
SetCharaAttr(hp, role, ATTR_HP)
--LuaPrint("Out function hp_med_small( role ) --[[Elven Fruit formula]]--")
end
----[[蛋糕公式]]--————————————————————————————————————————————————————————————————————————————
function ItemUse_CAKE ( role , Item ) --[[蛋糕公式]]--
local hp = GetChaAttr(role, ATTR_HP)
--LG("Potion Usage", "Current HP= ", hp , "\n" )
if hp <= 0 then
--LuaPrint("Character dead or illegal HP value") return
--LG("Potion Usage", "Character dead or illegal HP value","\n" )
end
hp_resume = 180
hp = hp + hp_resume
mxhp = GetChaAttr(role,ATTR_MXHP)
if hp > mxhp then --加超过最大hp时返回为最大hp
hp = mxhp
--LG("Potion Usage", "Max HP cap reached", "\n" )
end
--LG("Potion Usage", "HP recovered to", hp ,"\n" )
SetCharaAttr(hp, role, ATTR_HP)
--LuaPrint("Out function hp_med_small( role ) --[[Elven Fruit formula]]--")
end
--function ItemUse_CAKE ( role )
-- local str = GetChaAttr( role , ATTR_BSTR )
-- local ap = GetChaAttr( role , ATTR_AP )
-- SystemNotice ( role , "strength before edit is"..str )
-- SystemNotice ( role , "attribute before editing is"..ap )
-- if str <= 5 then
-- SystemNotice ( role , "You do not have enough points to reset. Reset failed" )
-- return
-- end
-- local str_dif = 1
-- local ap_dif = 1
-- str = str - str_dif
-- ap = ap + 1
--
-- SystemNotice ( role , "strength before edit is"..str )
-- SystemNotice ( role , "attribute point edited as"..ap )
-- SetCharaAttr ( str , role , ATTR_BSTR )
-- SetCharaAttr ( ap , role , ATTR_AP )
--end
-- function ItemUse_CAKE ( role ) --[[蛋糕公式]]--
-- local cha = TurnToCha ( cha )
-- local x_give = 0
-- local y_give = 0
-- local script_count = CheckBagItem ( cha , 887 ) --检查背包中兑换券数量
-- local DiamondId = Roll_DiamondId ( cha ) --随机兑换宝石的种类
-- if script_count >= 1 then
-- x_del = DelBagItem ( cha , 887 , 1 )
-- if x_del == 1 then
-- x_give = GiveItem ( cha , 0 , DiamondId , 1 , 101 ) --兑换宝石
--
-- y_give = GiveItem ( cha , 0 , 885 , 1 , 101 ) --兑换精炼石
--
--
-- else
-- SystemNotice ( cha , "Unable to deduct Gem Voucher" )
-- end
-- else
-- SystemNotice ( cha , "You need to have a Lv 1 Gem Voucher in order to redeem" )
-- end
-- if x_give == 1 and y_give ==1 then
-- return 1
-- else
-- return 0
-- end
--end
--
--
--
----[[精灵果公式]]--————————————————————————————————————————————————————————————————————————————
function ItemUse_JLG( role , Item ) --[[精灵果公式]]--
local hp = GetChaAttr(role, ATTR_HP)
--LG("Potion Usage", "Current HP= ", hp , "\n" )
if hp <= 0 then
--LuaPrint("Character dead or illegal HP value") return
--LG("Potion Usage", "Character dead or illegal HP value","\n" )
end
hp_resume = 15
hp = hp + hp_resume
mxhp = GetChaAttr(role,ATTR_MXHP)
if hp > mxhp then --加超过最大hp时返回为最大hp
hp = mxhp
--LG("Potion Usage", "Max HP cap reached", "\n" )
end
--LG("Potion Usage", "HP recovered to", hp ,"\n" )
SetCharaAttr(hp, role, ATTR_HP)
--LuaPrint("Out function hp_med_small( role ) --[[Elven Fruit formula]]--")
end
function ItemUse_SZ ( role , Item ) --[[沙枣]]--
local hp = GetChaAttr(role, ATTR_HP)
--LG("Potion Usage", "Current HP= ", hp , "\n" )
if hp <= 0 then
--LuaPrint("Character dead or illegal HP value") return
--LG("Potion Usage", "Character dead or illegal HP value","\n" )
end
hp_resume = 20
hp = hp + hp_resume
mxhp = GetChaAttr(role,ATTR_MXHP)
if hp > mxhp then --加超过最大hp时返回为最大hp
hp = mxhp
--LG("Potion Usage", "Max HP cap reached", "\n" )
end
--LG("Potion Usage", "HP recovered to", hp ,"\n" )
SetCharaAttr(hp, role, ATTR_HP)
--LuaPrint("Out function hp_med_small( role ) --[[Elven Fruit formula]]--")
end
function ItemUse_MG ( role , Item ) --[[蘑菇]]--
local hp = GetChaAttr(role, ATTR_HP)
--LG("Potion Usage", "Current HP= ", hp , "\n" )
if hp <= 0 then
--LuaPrint("Character dead or illegal HP value") return
--LG("Potion Usage", "Character dead or illegal HP value","\n" )
end
hp_resume = 35
hp = hp + hp_resume
mxhp = GetChaAttr(role,ATTR_MXHP)
if hp > mxhp then --加超过最大hp时返回为最大hp
hp = mxhp
--LG("Potion Usage", "Max HP cap reached", "\n" )
end
--LG("Potion Usage", "HP recovered to", hp ,"\n" )
SetCharaAttr(hp, role, ATTR_HP)
--LuaPrint("Out function hp_med_small( role ) --[[Elven Fruit formula]]--")
end
function ItemUse_MTLG ( role , Item ) --[[曼陀罗果]]--
local hp = GetChaAttr(role, ATTR_HP)
--LG("Potion Usage", "Current HP= ", hp , "\n" )
if hp <= 0 then
--LuaPrint("Character dead or illegal HP value") return
--LG("Potion Usage", "Character dead or illegal HP value","\n" )
end
hp_resume = 40
hp = hp + hp_resume
mxhp = GetChaAttr(role,ATTR_MXHP)
if hp > mxhp then --加超过最大hp时返回为最大hp
hp = mxhp
--LG("Potion Usage", "Max HP cap reached", "\n" )
end
--LG("Potion Usage", "HP recovered to", hp ,"\n" )
SetCharaAttr(hp, role, ATTR_HP)
--LuaPrint("Out function hp_med_small( role ) --[[Elven Fruit formula]]--")
end
function ItemUse_BG ( role , Item ) --[[冰果]]--
local hp = GetChaAttr(role, ATTR_HP)
--LG("Potion Usage", "Current HP= ", hp , "\n" )
if hp <= 0 then
--LuaPrint("Character dead or illegal HP value") return
--LG("Potion Usage", "Character dead or illegal HP value","\n" )
end
hp_resume = 50
hp = hp + hp_resume
mxhp = GetChaAttr(role,ATTR_MXHP)
if hp > mxhp then --加超过最大hp时返回为最大hp
hp = mxhp
--LG("Potion Usage", "Max HP cap reached", "\n" )
end
--LG("Potion Usage", "HP recovered to", hp ,"\n" )
SetCharaAttr(hp, role, ATTR_HP)
--LuaPrint("Out function hp_med_small( role ) --[[Elven Fruit formula]]--")
end
function ItemUse_WCG( role , Item ) --[[五彩果]]--
local hp = GetChaAttr(role, ATTR_HP)
--LG("Potion Usage", "Current HP= ", hp , "\n" )
if hp <= 0 then
--LuaPrint("Character dead or illegal HP value") return
--LG("Potion Usage", "Character dead or illegal HP value","\n" )
end
hp_resume = 108
hp = hp + hp_resume
mxhp = GetChaAttr(role,ATTR_MXHP)
if hp > mxhp then --加超过最大hp时返回为最大hp
hp = mxhp
--LG("Potion Usage", "Max HP cap reached", "\n" )
end
--LG("Potion Usage", "HP recovered to", hp ,"\n" )
SetCharaAttr(hp, role, ATTR_HP)
--LuaPrint("Out function hp_med_small( role ) --[[Elven Fruit formula]]--")
end
function ItemUse_JLGZ( role , Item ) --[[精灵果汁]]--
local hp = GetChaAttr(role, ATTR_HP)
--LG("Potion Usage", "Current HP= ", hp , "\n" )
if hp <= 0 then
--LuaPrint("Character dead or illegal HP value") return
--LG("Potion Usage", "Character dead or illegal HP value","\n" )
end
hp_resume = 250
hp = hp + hp_resume
mxhp = GetChaAttr(role,ATTR_MXHP)
if hp > mxhp then --加超过最大hp时返回为最大hp
hp = mxhp
--LG("Potion Usage", "Max HP cap reached", "\n" )
end
--LG("Potion Usage", "HP recovered to", hp ,"\n" )
SetCharaAttr(hp, role, ATTR_HP)
--LuaPrint("Out function hp_med_small( role ) --[[Elven Fruit formula]]--")
end
function ItemUse_SZC( role , Item ) --[[沙枣茶]]--
local hp = GetChaAttr(role, ATTR_HP)
--LG("Potion Usage", "Current HP= ", hp , "\n" )
if hp <= 0 then
--LuaPrint("Character dead or illegal HP value") return
--LG("Potion Usage", "Character dead or illegal HP value","\n" )
end
hp_resume = 300
hp = hp + hp_resume
mxhp = GetChaAttr(role,ATTR_MXHP)
if hp > mxhp then --加超过最大hp时返回为最大hp
hp = mxhp
--LG("Potion Usage", "Max HP cap reached", "\n" )
end
--LG("Potion Usage", "HP recovered to", hp ,"\n" )
SetCharaAttr(hp, role, ATTR_HP)
--LuaPrint("Out function hp_med_small( role ) --[[Elven Fruit formula]]--")
end
function ItemUse_MGT( role , Item ) --[[蘑菇汤]]--
local hp = GetChaAttr(role, ATTR_HP)
--LG("Potion Usage", "Current HP= ", hp , "\n" )
if hp <= 0 then
--LuaPrint("Character dead or illegal HP value") return
--LG("Potion Usage", "Character dead or illegal HP value","\n" )
end
hp_resume = 350
hp = hp + hp_resume
mxhp = GetChaAttr(role,ATTR_MXHP)
if hp > mxhp then --加超过最大hp时返回为最大hp
hp = mxhp
--LG("Potion Usage", "Max HP cap reached", "\n" )
end
--LG("Potion Usage", "HP recovered to", hp ,"\n" )
SetCharaAttr(hp, role, ATTR_HP)
--LuaPrint("Out function hp_med_small( role ) --[[Elven Fruit formula]]--")
end
function ItemUse_MTLGZ( role , Item ) --[[曼陀罗果汁]]--
local hp = GetChaAttr(role, ATTR_HP)
--LG("Potion Usage", "Current HP= ", hp , "\n" )
if hp <= 0 then
--LuaPrint("Character dead or illegal HP value") return
--LG("Potion Usage", "Character dead or illegal HP value","\n" )
end
hp_resume = 400
hp = hp + hp_resume
mxhp = GetChaAttr(role,ATTR_MXHP)
if hp > mxhp then --加超过最大hp时返回为最大hp
hp = mxhp
--LG("Potion Usage", "Max HP cap reached", "\n" )
end
--LG("Potion Usage", "HP recovered to", hp ,"\n" )
SetCharaAttr(hp, role, ATTR_HP)
--LuaPrint("Out function hp_med_small( role ) --[[Elven Fruit formula]]--")
end
function ItemUse_BQL( role , Item ) --[[冰激凌]]--
local hp = GetChaAttr(role, ATTR_HP)
--LG("Potion Usage", "Current HP= ", hp , "\n" )
if hp <= 0 then
--LuaPrint("Character dead or illegal HP value") return
--LG("Potion Usage", "Character dead or illegal HP value","\n" )
end
hp_resume = 450
hp = hp + hp_resume
mxhp = GetChaAttr(role,ATTR_MXHP)
if hp > mxhp then --加超过最大hp时返回为最大hp
hp = mxhp
--LG("Potion Usage", "Max HP cap reached", "\n" )
end
--LG("Potion Usage", "HP recovered to", hp ,"\n" )
SetCharaAttr(hp, role, ATTR_HP)
--LuaPrint("Out function hp_med_small( role ) --[[Elven Fruit formula]]--")
end
function ItemUse_WCLLZ( role , Item ) --[[五彩琉璃汁]]--
local hp = GetChaAttr(role, ATTR_HP)
--LG("Potion Usage", "Current HP= ", hp , "\n" )
if hp <= 0 then
--LuaPrint("Character dead or illegal HP value") return
--LG("Potion Usage", "Character dead or illegal HP value","\n" )
end
hp_resume = 500
hp = hp + hp_resume
mxhp = GetChaAttr(role,ATTR_MXHP)
if hp > mxhp then --加超过最大hp时返回为最大hp
hp = mxhp
--LG("Potion Usage", "Max HP cap reached", "\n" )
end
--LG("Potion Usage", "HP recovered to", hp ,"\n" )
SetCharaAttr(hp, role, ATTR_HP)
--LuaPrint("Out function hp_med_small( role ) --[[Elven Fruit formula]]--")
end
function ItemUse_ZHGZ( role , Item ) --[[综合果汁]]--
local hp = GetChaAttr(role, ATTR_HP)
--LG("Potion Usage", "Current HP= ", hp , "\n" )
if hp <= 0 then
--LuaPrint("Character dead or illegal HP value") return
--LG("Potion Usage", "Character dead or illegal HP value","\n" )
end
hp_resume = 550
hp = hp + hp_resume
mxhp = GetChaAttr(role,ATTR_MXHP)
if hp > mxhp then --加超过最大hp时返回为最大hp
hp = mxhp
--LG("Potion Usage", "Max HP cap reached", "\n" )
end
--LG("Potion Usage", "HP recovered to", hp ,"\n" )
SetCharaAttr(hp, role, ATTR_HP)
--LuaPrint("Out function hp_med_small( role ) --[[Elven Fruit formula]]--")
end
function ItemUse_YYCY( role , Item ) --[[药用草叶]]--
local sp = GetChaAttr(role, ATTR_SP)
--LG("Potion Usage", "Current SP= ", sp , "\n" )
sp_resume = 4
sp = sp + sp_resume
mxsp = GetChaAttr(role,ATTR_MXSP)
if sp > mxsp then --加超过最大sp时返回为最大sp
sp = mxsp
--LG("Potion Usage", "Reached Max SP cap", "\n" )
end
--LG("Potion Usage", "SP recovered to", sp ,"\n" )
SetCharaAttr(sp, role, ATTR_SP)
end
function ItemUse_MHHB( role , Item ) --[[梦幻花瓣]]--
local sp = GetChaAttr(role, ATTR_SP)
--LG("Potion Usage", "Current SP= ", sp , "\n" )
sp_resume = 8
sp = sp + sp_resume
mxsp = GetChaAttr(role,ATTR_MXSP)
if sp > mxsp then --加超过最大sp时返回为最大sp
sp = mxsp
--LG("Potion Usage", "Reached Max SP cap", "\n" )
end
--LG("Potion Usage", "SP recovered to", sp ,"\n" )
SetCharaAttr(sp, role, ATTR_SP)
end
function ItemUse_QYGS( role , Item ) --[[奇异果实]]--
local sp = GetChaAttr(role, ATTR_SP)
--LG("Potion Usage", "Current SP= ", sp , "\n" )
sp_resume = 18
sp = sp + sp_resume
mxsp = GetChaAttr(role,ATTR_MXSP)
if sp > mxsp then --加超过最大sp时返回为最大sp
sp = mxsp
--LG("Potion Usage", "Reached Max SP cap", "\n" )
end
--LG("Potion Usage", "SP recovered to", sp ,"\n" )
SetCharaAttr(sp, role, ATTR_SP)
end
function ItemUse_BFCY( role , Item ) --[[冰封草芽]]--
local sp = GetChaAttr(role, ATTR_SP)
--LG("Potion Usage", "Current SP= ", sp , "\n" )
sp_resume = 22
sp = sp + sp_resume
mxsp = GetChaAttr(role,ATTR_MXSP)
if sp > mxsp then --加超过最大sp时返回为最大sp
sp = mxsp
--LG("Potion Usage", "Reached Max SP cap", "\n" )
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -