- UID
- 10678
- 最後登錄
- 1970-1-1
- 精華
- 閱讀權限
- 100
- 積分
- 5147
- 金錢
- 元
- 威望
- 點
- 貢獻
- 點
|
發表於 2012-5-8 17:02:51
|
顯示全部樓層
updateexp.lua- --UpdateExp
- AdjustData("HP", -Damage, Target) --decrease target HP
- if GetData("HP", Target) <= 0 then -- If it die, cancel the attack
- DeactiveAttackEvent()
- DeactiveAttackEvent(Target)
- end
- if IsTargetEnemy() == 1then -- if attacker is someone can recv gold and exp
- AddMark(Target)
- SetData("WakeUp", 1, Target)
- EnemyLv = GetData("Lv", Target)
- if GetData("HP", Target) <= 0 then -- if it die
- Exp = GetData("ExpGain", Target) --find the bouns exp
- TotalLv = 0
- IncExp = 0
- Teamlist = GetTeamMembers() -- get the member list
- index, member = next(Teamlist, nil) -- get the first member
- while member ~= nil do --while it has member
- if GetData("Lv", member) - EnemyLv < 10 and GetData("HP", member) > 0 and GetSqDistance(member) < 10000 then
- TotalLv = TotalLv + GetData("Lv", member)
- IncExp = IncExp + 10
- end
- index, member = next(Teamlist, index) --get next member
- end
-
- if IncExp ~= 0 then
- Exp = Exp * (90 + IncExp) / 100
- end
- index, member = next(Teamlist, nil) -- get the first member
- if member == nil then -- no team member
- if GetData("Lv") - EnemyLv < 10 then
- AdjustData("Exp" , Exp)
- end
- else
- while member ~= nil do --while it has member
- if GetData("Lv", member) - EnemyLv < 10 and GetData("HP", member) > 0 and GetSqDistance(member) < 10000 then
- ExpGain = Exp * GetData("Lv", member) / TotalLv
- if ExpGain < 1then
- ExpGain = 1
- end
- AdjustData("Exp",ExpGain , member) --increase EXP
- end
- index, member = next(Teamlist, index) --get next member
- end
- end
- scriptName = GetEnemyScript(Target)
- DropTreasure(Target)
- RemoveEnemy(Target)
- if scriptName ~= nil then
- SetData("NPC", 0)
- func = loadfile("script\"..scriptName)
- func()
- end
- end
- end
複製代碼 |
|