Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- WAZNE rejstracja skryptu w onSpawn w creature scripts WAZNE!!!!!
- --[[
- []= {mele_dmg_absorb= , ene_dmg_absorb= , atk_ki_dmg = , atk_ki_dmg = },
- []= {mele_dmg_absorb= , ene_dmg_absorb= ,}
- []= {mele_dmg_absorb= , ene_dmg_absorb= ,}
- []= {mele_dmg_absorb= , ene_dmg_absorb= ,}
- []= {mele_dmg_absorb= , ene_dmg_absorb= ,}
- []= {mele_dmg_absorb= , ene_dmg_absorb= ,}
- --]]
- local bonus_transform_dmg_absorb={
- [1]= {mele_dmg_absorb= 0, ene_dmg_absorb= 0, atk_mele_dmg = 0 , atk_ki_dmg = 0},
- [2]= {mele_dmg_absorb= 4, ene_dmg_absorb= 4, atk_mele_dmg = 2, atk_ki_dmg = 2},
- [3]= {mele_dmg_absorb= 6, ene_dmg_absorb= 6, atk_mele_dmg = 4, atk_ki_dmg = 4},
- [4]= {mele_dmg_absorb= 8, ene_dmg_absorb= 8, atk_mele_dmg = 6, atk_ki_dmg = 6},
- [5]= {mele_dmg_absorb= 10, ene_dmg_absorb= 10, atk_mele_dmg = 8, atk_ki_dmg = 8},
- [6]= {mele_dmg_absorb= 12, ene_dmg_absorb= 12, atk_mele_dmg = 12, atk_ki_dmg = 12},
- }
- local function modifyDamage(attacker, primaryDamage, primaryType, cid, item, fromPosition, itemEx, toPosition, ItemType)
- if not attacker then
- return primaryDamage, primaryType
- end
- local Vocation = attacker:isPlayer() and attacker:getVocation():getId()
- local bonus_data = bonus_transform_dmg_absorb[Vocation]
- if attacker and attacker:isPlayer() then
- if primaryType == COMBAT_PHYSICALDAMAGE then
- local atk_mele = primaryDamage
- local dmgmelebonus = atk_mele * (bonus_data.atk_mele_dmg / 100)
- primaryDamage = atk_mele + dmgmelebonus
- print("wartosc atk_mele razy procenty:" .. dmgmelebonus)
- print("wartosc atk_mele wczesniej:" .. atk_mele)
- print("wartosc atk_mele suma:" .. primaryDamage)
- ---======================================================================================-------------------
- ---===================SYSTEM , PUNCH, SLASH========================================--------------------
- --==========================================================================================
- local LVLSKILL = 0
- local CHANCE = 0
- local WEAPON = attacker:getWeaponType()
- local DMGMULTIPLIER = 1.25
- print(WEAPON)
- ---WEPON TYPE CHYBA ,9 WEAPON_GLOVER ,10WEAPON_KI_BLASTING,11WEAPON_MIECZ
- if WEAPON == 9 then --Glover
- LVLSKILL = attacker:getSkillLevel(SKILL_SILA) --- 11 sKILL STRENGHT
- elseif WEAPON == 11 then --MIECZ
- LVLSKILL = attacker:getSkillLevel(SKILL_MIECZ) ---12 SKILL SWORD FIGHTING
- elseif WEAPON == 0 then --REKA
- LVLSKILL = attacker:getSkillLevel(SKILL_SILA)---
- end
- print(LVLSKILL)
- if LVLSKILL >= 10 and LVLSKILL < 110 then
- CHANCE = 100
- elseif LVLSKILL >= 110 and LVLSKILL < 120 then
- CHANCE = 15
- elseif LVLSKILL >= 120 and LVLSKILL < 130 then
- CHANCE = 20
- elseif LVLSKILL >= 130 then
- CHANCE = 25
- end
- if math.random(100) <= CHANCE then
- primaryDamage = primaryDamage * DMGMULTIPLIER
- print("wartosc atk_mele po critic sytemie suma:" .. primaryDamage)
- if WEAPON == 9 then
- ---------------------------------------
- ---???????????????????????????????????---
- --?????LOAD ATTACK ATTRIBUTE ITEM???????????---
- --???????????????????????????????????????????--
- ---------------------------------------
- if attackAttribute >= 10 then
- attacker:addSkillTries(9, 1)
- if attackAttribute >= 20 then
- attacker:addSkillTries(9, 1)
- if attackAttribute >= 30 then
- attacker:addSkillTries(9, 1)
- if attackAttribute >= 40 then
- attacker:addSkillTries(9, 1)
- if attackAttribute >= 50 then
- attacker:addSkillTries(9, 1)
- if attackAttribute >= 60 then
- attacker:addSkillTries(9, 1)
- if attackAttribute >= 70 then
- attacker:addSkillTries(9, 1)
- if attackAttribute >= 80 then
- attacker:addSkillTries(9, 1)
- if attackAttribute >= 90 then
- attacker:addSkillTries(9, 1)
- end
- end
- end
- end
- end
- end
- end
- end
- end
- attacker:say("Punch!")
- elseif WEAPON == 11 then
- attacker:say("Slash!")
- elseif WEAPON == 0 then
- attacker:say("Punch!")
- end
- end
- ---======================================================================================-------------------
- ---======================KONIEC SYTSTEMU===================================================-------------------
- ---======================================================================================-------------------
- elseif primaryType == COMBAT_DROWNDAMAGE then
- local atk_ene = primaryDamage
- local dmgenebonus = atk_ene * (bonus_data.atk_ki_dmg / 100)
- primaryDamage = atk_ene + dmgenebonus
- print("wartosc atk_eneKI razy procenty:" .. dmgenebonus)
- print("wartosc atk_eneKI wczesniej:" .. atk_ene)
- print("wartosc atk_eneKI suma:" .. primaryDamage)
- ---======================================================================================-------------------
- ---======================kod SYTSTEMU STRIKE===================================================-------------------
- ---======================================================================================-------------------
- local LVLS = 0
- local CHNSE = 0
- local WEAPONE = attacker:getWeaponType()
- local DMGMULTIPLIERY = 1.25
- print(WEAPON)
- if WEAPONE == 10 then --ball
- LVLS = attacker:getSkillLevel(SKILL_KI_BLASTING)
- end
- if LVLS >= 10 and LVLS < 110 then
- CHNSE = 100
- elseif LVLS >= 110 and LVLS < 120 then
- CHNSE = 15
- elseif LVLS >= 120 and LVLS < 130 then
- CHNSE = 20
- elseif LVLS >= 130 then
- CHNSE = 25
- end
- if math.random(100) <= CHNSE then
- primaryDamage = primaryDamage * DMGMULTIPLIERY
- print("wartosc atk_ki po critic sytemie suma:" .. primaryDamage)
- if WEAPONE == 10 then
- attacker:say("Strike!")
- end
- end
- ---======================================================================================-------------------
- ---======================KONIEC SYTSTEMU===================================================-------------------
- ---======================================================================================-------------------
- end
- end
- return primaryDamage, primaryType
- end
- -- WAZNE rejstracja skryptu w onSpawn w creature scripts WAZNE!!!!!
- local cEvent = CreatureEvent("HpChange")
- function cEvent.onHealthChange(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
- if attacker then
- local playerId = attacker:getId()
- primaryDamage, primaryType = modifyDamage(attacker, primaryDamage, primaryType)
- if creature and creature:isPlayer() then
- local totalDamage = primaryDamage
- local getVocationId = creature:getVocation():getId()
- local bonus_data = bonus_transform_dmg_absorb[getVocationId]
- --absorb mele z transformacji i z skilli
- if primaryType == COMBAT_PHYSICALDAMAGE then
- local meledmg = totalDamage
- if creature:getSkillLevel(8) <= 130 then --- 8 oznzcza skill defence
- creature:addSkillTries(8, 1) --- 8 oznzcza skill defence
- end
- if creature:getStorageValue(9998) == -1 or creature:getStorageValue(9998) == nil then
- creature:setStorageValue(9998,2)
- end
- local procentdefabsorbu = creature:getSkillLevel(8)/5
- print("wartosc def skill/5:" .. procentdefabsorbu)
- print("wartosc procentowa absorbu mele z transformacji:" .. bonus_data.mele_dmg_absorb)
- local transform_and_def_absorb_bonus = procentdefabsorbu + bonus_data.mele_dmg_absorb
- print("wartosc procentowa bonusu absorb mele z transformacji dodana do z skilla, czyli suma procentowa absorb:" .. transform_and_def_absorb_bonus)
- if creature:getStorageValue(9998) ~= transform_and_def_absorb_bonus then
- creature:setStorageValue(9998, transform_and_def_absorb_bonus)
- end
- print("wartosc procentowa absorb z storage:" .. creature:getStorageValue(9998))
- print("wartosc ataku mele przed obliczeniami:" .. primaryDamage)
- local absorbdefValue = creature:getStorageValue(9998)
- local damagedefReduction = meledmg * (absorbdefValue / 100)
- primaryDamage = meledmg - damagedefReduction
- secondaryDamage = meledmg - damagedefReduction
- print("wartosc ataku mele po obnizeniu o absorb def:" .. primaryDamage)
- --------------------------------------------------------------------------------------------------------------------
- ---SYSTEM DODGE NA OBRAZENIA MELE---------
- ---------------------------------------------------------------------------------------------------------------------
- local skillLevel = creature:getSkillLevel(8)
- local dodgechance = 0
- if skillLevel >= 10 and skillLevel < 110 then
- dodgechance = 100
- elseif skillLevel >= 110 and skillLevel < 120 then
- dodgechance = 15
- elseif skillLevel >= 120 and skillLevel < 130 then
- dodgechance = 20
- elseif skillLevel >= 130 then
- dodgechance = 25
- end
- -- Wylosuj czy unik występuje
- if math.random(100) <= dodgechance then
- creature:say("Dodge!") -- Wyświetl komunikat
- primaryDamage = 0 -- Ustaw obrażenia na 0
- secondaryDamage = 0
- end
- ---------------------------------------------------------------------------------------------------------------------
- ---------------------------------------------------------------------------------------------------------------------
- --absorb ki i balla z transformacji i skilli
- elseif primaryType == COMBAT_DROWNDAMAGE then
- local kidmg = totalDamage
- if creature:getSkillLevel(7) <= 130 then --- 7 oznzcza skill energy
- creature:addSkillTries(7, 1)
- end
- if creature:getStorageValue(9999) == -1 or creature:getStorageValue(9999) == nil then
- creature:setStorageValue(9999,2)
- end
- local procentabsorbu=creature:getSkillLevel(7)/5
- print("wartosc ene skill/5:" .. procentabsorbu)
- print("wartosc procentowa absorbu ene z transformacji:" .. bonus_data.ene_dmg_absorb)
- local transform_and_ene_absorb_bonus = procentabsorbu + bonus_data.ene_dmg_absorb
- print("wartosc procentowa bonusu absorb ene z transformacji dodana do z skilla, czyli suma procentowa absorb:" .. transform_and_ene_absorb_bonus)
- if creature:getStorageValue(9999) ~= transform_and_ene_absorb_bonus then
- creature:setStorageValue(9999,transform_and_ene_absorb_bonus)
- end
- print("wartosc procentowa absorb z storage:" .. creature:getStorageValue(9999))
- print("wartosc ataku ene przed obliczeniami:" .. primaryDamage)
- local absorbValue = creature:getStorageValue(9999)
- local damageReduction = kidmg * (absorbValue / 100)
- primaryDamage = kidmg - damageReduction
- secondaryDamage = kidmg - damageReduction
- print("wartosc ataku ki po obnizeniu o absorb ene:" .. primaryDamage)
- --------------------------------------------------------------------------------------------------------------------
- ---SYSTEM MISS NA OBRAZENIA KI---------
- ---------------------------------------------------------------------------------------------------------------------
- local skillLevel = creature:getSkillLevel(7) ----Skill 7 to energy
- local dodgechance = 0
- if skillLevel >= 10 and skillLevel < 110 then
- dodgechance = 100
- elseif skillLevel >= 110 and skillLevel < 120 then
- dodgechance = 15
- elseif skillLevel >= 120 and skillLevel < 130 then
- dodgechance = 20
- elseif skillLevel >= 130 then
- dodgechance = 25
- end
- -- Wylosuj czy unik występuje
- if math.random(100) <= dodgechance then
- creature:say("Miss!") -- Wyświetl komunikat
- primaryDamage = 0 -- Ustaw obrażenia na 0
- secondaryDamage = 0
- end
- ---------------------------------------------------------------------------------------------------------------------
- ---------------------------------------------------------------------------------------------------------------------
- end
- end
- end
- return primaryDamage, primaryType, secondaryDamage, secondaryType, origin
- end
- cEvent:register()
- local lEvent = CreatureEvent("HpLogin")
- function lEvent.onLogin(player)
- -- WAZNE rejstracja skryptu w onSpawn w creature scripts WAZNE!!!!!
- player:registerEvent("HpChange")
- --[[ local vocationId = 1 -- Identyfikator klasy (zmień na właściwy identyfikator swojej klasy)
- local skillType = 5 -- Identyfikator umiejętności (zmień na właściwy identyfikator swojej umiejętności)
- local vocation = Vocation(vocationId) -- Tworzymy obiekt reprezentujący klasę o danym identyfikatorze
- print("Wymagane próby dla umiejętności " .. skillType .. " w klasie " .. vocation:getName() .. ":")
- for skillLevel = 10, 130 do
- local requiredTries = vocation:getRequiredSkillTries(skillType, skillLevel)
- print("Poziom " .. skillLevel .. ": " .. requiredTries .. " prób")
- end--]]
- return true
- end
- lEvent:register()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement