?? functions.lua
字號:
end
function Ship_BSCrange ( ship_role ) --炮彈基本爆炸范圍
local ship_bscrange=GetChaAttr( ship_role , ATTR_BOAT_BCRANGE )
return ship_bscrange
end
function Ship_BSDef ( ship_role ) --船只基本防御
local ship_bsdef=GetChaAttr( ship_role , ATTR_BDEF )
return ship_bsdef
end
function Ship_BSResist ( ship_role ) --船只基本抵抗
local ship_bsresist=GetChaAttr( ship_role , ATTR_BPDEF )
return ship_bsresist
end
function Ship_BSMxhp ( ship_role ) --船只基本最大耐久
local ship_bsmxhp=GetChaAttr( ship_role , ATTR_BMXHP )
return ship_bsmxhp
end
function Ship_BSHrec ( ship_role ) --船只基本耐久回復速度
local ship_bshrec=GetChaAttr( ship_role , ATTR_BHREC )
return ship_bshrec
end
function Ship_BSSrec ( ship_role ) --船只基本補給消耗速度
local ship_bssrec=GetChaAttr( ship_role , ATTR_BSREC )
return ship_bssrec
end
function Ship_BSMspd ( ship_role ) --船只基本移動速度
local ship_bsmspd=GetChaAttr( ship_role , ATTR_BMSPD )
return ship_bsmspd
end
function Ship_BSMxsp ( ship_role ) --船只基本最大補給值
local ship_bsmxsp=GetChaAttr( ship_role , ATTR_BMXSP )
return ship_bsmxsp
end
--取人物船只屬性的技能影響--------------------------------------------------------------------------------------------------------------------------------------------------------------------
function Ship_MnatkSa ( cha_role ) --船只基本最小攻擊角色技能系數影響
local ship_mnatksa=GetChaAttr( cha_role , ATTR_BOAT_SKILLC_MNATK ) / ATTR_RADIX
return ship_mnatksa
end
function Ship_MnatkSb ( cha_role ) --船只基本最小攻擊角色技能常數影響
local ship_mnatksb=GetChaAttr( cha_role , ATTR_BOAT_SKILLV_MNATK )
return ship_mnatksb
end
function Ship_MxatkSa ( cha_role ) --船只基本最大攻擊角色技能系數影響
local ship_mxatksa=GetChaAttr( cha_role , ATTR_BOAT_SKILLC_MXATK ) / ATTR_RADIX
return ship_mxatksa
end
function Ship_MxatkSb ( cha_role ) --船只基本最大攻擊角色技能常數影響
local ship_mxatksb=GetChaAttr( cha_role , ATTR_BOAT_SKILLV_MXATK )
return ship_mxatksb
end
function Ship_AdisSa ( cha_role ) --船只基本攻擊距離角色技能系數影響
local ship_adissa=GetChaAttr( cha_role , ATTR_BOAT_SKILLC_ADIS ) / ATTR_RADIX
return ship_adissa
end
function Ship_AdisSb ( cha_role ) --船只基本攻擊距離角色技能常數影響
local ship_adissb=GetChaAttr( cha_role , ATTR_BOAT_SKILLV_ADIS )
return ship_adissb
end
function Ship_CspdSa ( cha_role ) --炮彈基本飛行速度角色技能系數影響
local ship_cspdsa=GetChaAttr( cha_role , ATTR_BOAT_SKILLC_CSPD ) / ATTR_RADIX
return ship_cspdsa
end
function Ship_CspdSb ( cha_role ) --炮彈基本飛行速度角色技能常數影響
local ship_cspdsb=GetChaAttr( cha_role , ATTR_BOAT_SKILLV_CSPD )
return ship_cspdsb
end
function Ship_AspdSa ( cha_role ) --炮彈基本攻擊間隔角色技能系數影響
local ship_aspdsa=GetChaAttr( cha_role , ATTR_BOAT_SKILLC_ASPD ) / ATTR_RADIX
return ship_aspdsa
end
function Ship_AspdSb ( cha_role ) --炮彈基本攻擊間隔角色技能常數影響
local ship_aspdsb=GetChaAttr( cha_role , ATTR_BOAT_SKILLV_ASPD )
return ship_aspdsb
end
function Ship_CrangeSa ( cha_role ) --炮彈基本爆炸范圍角色技能系數影響
local ship_crangesa=GetChaAttr( cha_role , ATTR_BOAT_SKILLC_CRANGE ) / ATTR_RADIX
return ship_crangesa
end
function Ship_CrangeSb ( cha_role ) --炮彈基本爆炸范圍角色技能常數影響
local ship_crangesb=GetChaAttr( cha_role , ATTR_BOAT_SKILLV_CRANGE )
return ship_crangesb
end
function Ship_DefSa ( cha_role ) --船只基本防御角色技能系數影響
local ship_defsa=GetChaAttr( cha_role , ATTR_BOAT_SKILLC_DEF ) / ATTR_RADIX
return ship_defsa
end
function Ship_DefSb ( cha_role ) --船只基本防御角色技能常數影響
local ship_defsb=GetChaAttr( cha_role , ATTR_BOAT_SKILLV_DEF )
return ship_defsb
end
function Ship_ResistSa ( cha_role ) --船只基本抵抗角色技能系數影響
local ship_resistsa=GetChaAttr( cha_role , ATTR_BOAT_SKILLC_RESIST ) / ATTR_RADIX
return ship_resistsa
end
function Ship_ResistSb ( cha_role ) --船只基本抵抗角色技能常數影響
local ship_resistsb=GetChaAttr( cha_role , ATTR_BOAT_SKILLV_RESIST )
return ship_resistsb
end
function Ship_MxhpSa ( cha_role ) --船只基本最大耐久角色技能系數影響
local ship_mxhpsa=GetChaAttr( cha_role , ATTR_BOAT_SKILLC_MXUSE ) / ATTR_RADIX
return ship_mxhpsa
end
function Ship_MxhpSb ( cha_role ) --船只基本最大耐久角色技能常數影響
local ship_mxhpsb=GetChaAttr( cha_role , ATTR_BOAT_SKILLV_MXUSE )
return ship_mxhpsb
end
function Ship_HrecSa ( cha_role ) --船只基本耐久回復速度角色技能系數影響
local ship_hrecsa=GetChaAttr( cha_role , ATTR_BOAT_SKILLC_USEREC ) / ATTR_RADIX
return ship_hrecsa
end
function Ship_HrecSb ( cha_role ) --船只基本耐久回復速度角色技能常數影響
local ship_hrecsb=GetChaAttr( cha_role , ATTR_BOAT_SKILLV_USEREC )
return ship_hrecsb
end
function Ship_SrecSa ( cha_role ) --船只基本補給消耗速度角色技能系數影響
local ship_srecsa=GetChaAttr( cha_role , ATTR_BOAT_SKILLC_EXP ) / ATTR_RADIX
return ship_srecsa
end
function Ship_SrecSb ( cha_role ) --船只基本補給消耗速度角色技能常數影響
local ship_srecsb=GetChaAttr( cha_role , ATTR_BOAT_SKILLV_EXP )
return ship_srecsb
end
function Ship_MspdSa ( cha_role ) --船只基本移動速度角色技能系數影響
local ship_mspdsa=GetChaAttr( cha_role , ATTR_BOAT_SKILLC_MSPD ) / ATTR_RADIX
return ship_mspdsa
end
function Ship_MspdSb ( cha_role ) --船只基本移動速度角色技能常數影響
local ship_mspdsb=GetChaAttr( cha_role , ATTR_BOAT_SKILLV_MSPD )
return ship_mspdsb
end
function Ship_MxspSa ( cha_role ) --船只基本最大補給值角色技能系數影響
local ship_mxspsa=GetChaAttr( cha_role , ATTR_BOAT_SKILLC_MXSPLY ) / ATTR_RADIX
return ship_mxspsa
end
function Ship_MxspSb ( cha_role ) --船只基本最大補給值角色技能常數影響
local ship_mxspsb=GetChaAttr( cha_role , ATTR_BOAT_SKILLV_MXSPLY )
return ship_mxspsb
end
--船只最終屬性計算--------------------------------------------------------------------------------------------------------------------------------------------------
function Ship_Mnatk_final ( cha_role , ship_role ) --計算船只最小攻擊
local ship_mnatk= math.floor ( ( Ship_BSMnatk ( ship_role ) * Ship_MnatkSa ( cha_role ) + Ship_MnatkSb ( cha_role ) ) * MnatkSa ( ship_role ) + MnatkSb ( ship_role ) )
return ship_mnatk
end
function Ship_Mnatk ( ship_role ) --船只最小攻擊
local ship_mnatk=GetChaAttr( ship_role , ATTR_MNATK )
return ship_mnatk
end
function Ship_Mxatk_final ( cha_role , ship_role ) --計算船只最大攻擊
local ship_mxatk= math.floor ( ( Ship_BSMxatk ( ship_role ) * Ship_MxatkSa ( cha_role ) + Ship_MxatkSb ( cha_role ) ) * MxatkSa ( ship_role ) + MxatkSb ( ship_role ) )
return ship_mxatk
end
function Ship_Mxatk ( ship_role ) --船只最大攻擊
local ship_mxatk=GetChaAttr( ship_role , ATTR_MXATK )
return ship_mxatk
end
function Ship_Adis_final ( cha_role , ship_role ) --計算船只攻擊距離
local ship_adis= math.floor ( ( Ship_BSAdis ( ship_role ) * Ship_AdisSa ( cha_role ) + Ship_AdisSb ( cha_role ) ) )
return ship_adis
end
function Ship_Adis ( ship_role ) --船只攻擊距離
local ship_adis=GetChaAttr( ship_role , ATTR_ADIS )
return ship_adis
end
function Ship_Cspd_final ( cha_role , ship_role ) --計算船只炮彈飛行速度
local ship_cspd= math.floor ( ( Ship_BSCspd ( ship_role ) * Ship_CspdSa ( cha_role ) + Ship_CspdSb ( cha_role ) ) )
return ship_cspd
end
function Ship_Cspd ( ship_role ) --船只炮彈飛行速度
local ship_cspd=GetChaAttr( ship_role , ATTR_BOAT_CSPD )
return ship_cspd
end
function Ship_Aspd_final ( cha_role , ship_role ) --計算炮彈攻擊間隔
local ship_aspd= math.floor (( Ship_BSAspd ( ship_role ) * Ship_AspdSa ( cha_role ) + Ship_AspdSb ( cha_role ) ) * AspdSa ( ship_role ) + AspdSb ( ship_role ) )
return ship_aspd
end
function Ship_Aspd ( ship_role ) --炮彈攻擊間隔
local ship_aspd=GetChaAttr( ship_role , ATTR_ASPD )
return ship_aspd
end
function Ship_Crange_final ( cha_role , ship_role ) --計算炮彈爆炸范圍
local ship_crange= math.floor ( ( Ship_BSCrange ( ship_role ) * Ship_CrangeSa ( cha_role ) + Ship_CrangeSb ( cha_role ) ) )
return ship_crange
end
function Ship_Crange ( ship_role ) --炮彈爆炸范圍
local ship_crange=GetChaAttr( ship_role , ATTR_CRANGE )
return ship_crange
end
function Ship_Def_final ( cha_role , ship_role ) --計算船只防御
local ship_def= math.floor ( ( Ship_BSDef ( ship_role ) * Ship_DefSa ( cha_role ) + Ship_DefSb ( cha_role ) ) * DefSa ( ship_role ) + DefSb ( ship_role ) )
return ship_def
end
function Ship_Def ( ship_role ) --船只防御
local ship_def=GetChaAttr( ship_role , ATTR_DEF )
return ship_def
end
function Ship_Resist_final ( cha_role ,ship_role ) --計算船只抵抗
local ship_resist= math.floor ( ( Ship_BSResist ( ship_role ) * Ship_ResistSa ( cha_role ) + Ship_ResistSb ( cha_role ) ) * ResistSa ( ship_role ) + ResistSb ( ship_role ) )
return ship_resist
end
function Ship_Resistl ( ship_role ) --船只抵抗
local ship_resist=GetChaAttr( ship_role , ATTR_PDEF )
return ship_resist
end
function Ship_Mxhp_final ( cha_role ,ship_role ) --計算船只最大耐久
local ship_mxhp= math.floor ( ( Ship_BSMxhp ( ship_role ) * Ship_MxhpSa ( cha_role ) + Ship_MxhpSb ( cha_role ) ) * MxhpSa ( ship_role ) + MxhpSb ( ship_role ) )
return ship_mxhp
end
function Ship_Mxhp ( ship_role ) --船只最大耐久
local ship_mxhp=GetChaAttr( ship_role , ATTR_MXHP )
return ship_mxhp
end
function Ship_Hp ( ship_role ) --船只當前耐久
local ship_hp=GetChaAttr( ship_role , ATTR_HP )
return ship_hp
end
function Ship_Hrec_final ( cha_role ,ship_role ) --計算船只耐久回復速度
local ship_hrec= math.floor ( ( Ship_BSHrec ( ship_role ) * Ship_HrecSa ( cha_role ) + Ship_HrecSb ( cha_role ) ) * HrecSa ( ship_role ) + HrecSb ( ship_role ) )
return ship_hrec
end
function Ship_Hrec ( ship_role ) --船只耐久回復速度
local ship_hrec=GetChaAttr( ship_role , ATTR_HREC )
return ship_hrec
end
function Ship_Srec_final ( cha_role ,ship_role ) --計算船只補給消耗速度
local ship_srec= math.floor ( ( Ship_BSSrec ( ship_role ) * Ship_SrecSa ( cha_role ) + Ship_SrecSb ( cha_role ) ) * SrecSa ( ship_role ) + SrecSb ( ship_role ) )
return ship_srec
end
function Ship_Srec ( ship_role ) --船只補給消耗速度
local ship_srec=GetChaAttr( ship_role , ATTR_SREC )
return ship_srec
end
function Ship_Mspd_final ( cha_role ,ship_role ) --計算船只移動速度
local ship_mspd= math.floor ( ( Ship_BSMspd ( ship_role ) * Ship_MspdSa ( cha_role ) + Ship_MspdSb ( cha_role ) ) * MspdSa ( ship_role ) + MspdSb ( ship_role ) )
return ship_mspd
end
function Ship_Mspd ( ship_role ) --船只移動速度
local ship_mspd=GetChaAttr( ship_role , ATTR_MSPD )
return ship_mspd
end
function Ship_Mxsp_final ( cha_role ,ship_role ) --船只最大補給值
local ship_mxsp= math.floor ( ( Ship_BSMxsp ( ship_role ) * Ship_MxspSa ( cha_role ) + Ship_MxspSb ( cha_role ) ) * MxspSa ( ship_role ) + MxspSb ( ship_role ) )
return ship_mxsp
end
function Ship_Mxsp ( ship_role ) --船只最大補給值
local ship_mxsp=GetChaAttr( ship_role , ATTR_MXSP )
return ship_mxsp
end
function Ship_Sp ( ship_role ) --船只當前補給值
local ship_sp=GetChaAttr( ship_role , ATTR_SP )
return ship_sp
end
function Percentage_Random(a)
local x,y=a*1000000000,math.random(0,1000000000)
local z
if y<=x then
z=1
else z=0
end
return z
end
function Dis(a,b,c,d) --[[求(a,b)至(c,d)距離]]--
local x1,y1,x2,y2=a,b,c,d
local dis=math.pow( math.pow(x1-x2, 2) + math.pow(y1-y2, 2), 0.5)
return dis
end
function Check_Direction(a)
--LuaPrint("Enter function Check_Direction(a) --[[determine character direction, x axis of center as 1, anticlockwise as 2, 3, 4, 5, 6, 7, 8
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -