logoHourGlass
RegDamageCalculateEvent

NL.RegDamageCalculateEvent

NL.RegDamageCalculateEvent(Dofile, FuncName)

函數功能

戰鬥中計算傷害時會觸發該函數

參數說明

  • Dofile:字符串 要加載的腳本文件名,如果爲當前文件,則定義nil即可
  • InitFuncName:字符串 觸發的Lua函數的名稱,該函數的申明格式請參考[DamageCalculateCallBack]

返回值

無返回值

語法

DamageCalculateCallBack(CharIndex, DefCharIndex, OriDamage, Damage, BattleIndex, Com1, Com2, Com3, DefCom1, DefCom2, DefCom3, Flg)

參數說明

  • CharIndex:數值型 響應事件的對象index(攻擊者),該值由Lua引擎傳遞給本函數。
  • DefCharIndex:數值型 響應事件的對象index(防禦者),該值由Lua引擎傳遞給本函數。
  • OriDamage:數值型 未修正傷害,該值由Lua引擎傳遞給本函數。
  • Damage:數值型 修正傷害(真實傷害),該值由Lua引擎傳遞給本函數。
  • BattleIndex:數值型 當前戰鬥index,該值由Lua引擎傳遞給本函數。
  • Com1:數值型 攻擊者使用的動作編號,該值由Lua引擎傳遞給本函數。
  • Com2:數值型 攻擊者攻擊動作的目標對象的位置,該值由Lua引擎傳遞給本函數。
  • Com3:數值型 攻擊者使用的所對應的tech的ID,該值由Lua引擎傳遞給本函數。
  • DefCom1:數值型 防禦者使用的動作編號,該值由Lua引擎傳遞給本函數。
  • DefCom2:數值型 防禦者攻擊動作的目標對象的位置,該值由Lua引擎傳遞給本函數。
  • DefCom3:數值型 防禦者使用的所對應的tech的ID,該值由Lua引擎傳遞給本函數。
  • Flg:數值型 傷害模式,具體查看下面的值說明,該值由Lua引擎傳遞給本函數。

返回值

傷害值數值型

Flg 值說明

  • 0: 普通命中傷害
  • 1: 暴擊傷害
  • 2: 無傷害
  • 3: 閃躲
  • 4: 防禦

參考實例

NL.RegDamageCalculateEvent(nil,"MyDamageCalculateEvent");

function MyDamageCalculateEvent(CharIndex, DefCharIndex, OriDamage, Damage, BattleIndex, Com1, Com2, Com3, DefCom1, DefCom2, DefCom3, Flg)
-- 如果攻擊者普通攻擊,防禦者恰好使用防禦,則傷害加倍
  if Com1 == 4 and Com3 == -1 and DefCom1 == 1 and DefCom3 == -1 then
    return Damage*2
  end
  return Damage
end