introduce hits counter in physical damage and introduce poison strike spell

This commit is contained in:
ErikasKontenis 2020-10-16 11:05:13 +03:00
parent fd05f5ee15
commit 093ac51d31
3 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,20 @@
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_GREEN_RINGS)
function onGetFormulaValues(player, level, maglevel)
local base = 45
local variation = 10
local formula = 3 * maglevel + (2 * level)
local min = (formula * (base - variation)) / 100
local max = (formula * (base + variation)) / 100
return -min, -max
end
combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
function onCastSpell(creature, variant)
return combat:execute(creature, variant)
end

View File

@ -140,6 +140,12 @@
<vocation name="Master Sorcerer" />
<vocation name="Elder Druid" />
</instant>
<instant name="Poison Strike" words="exori pox" lvl="12" mana="20" prem="1" cooldown="1000" range="3" direction="1" blockwalls="1" needlearn="0" script="spells/poison strike.lua">
<vocation name="Sorcerer" />
<vocation name="Druid" />
<vocation name="Master Sorcerer" />
<vocation name="Elder Druid" />
</instant>
<instant name="Great Light" words="utevo gran lux" lvl="13" mana="60" aggressive="0" selftarget="1" needlearn="0" script="spells/great light.lua">
<vocation name="Sorcerer" />
<vocation name="Druid" />

View File

@ -281,9 +281,21 @@ function onSay(player, words, param)
message = message .. "Min: " .. defensiveDamageContainer[1] .. ", Max: " .. defensiveDamageContainer[2] .. "\n"
message = message .. "\nFirst 100 Hits Damage Simulator in Offensive Fighting\n"
local creatureHealth = creature:getType():getMaxHealth()
local creatureHitsTillDeath = 1
for i=1,100 do
local damageContainer = getTotalDamage(creature, weapon, ammunition, vocation, attack, skillValue, FIGHTMODE_ATTACK)
message = message .. "Hit: " .. i .. ", Damage: " .. damageContainer[0] .. "\n"
creatureHealth = creatureHealth + damageContainer[0]
if creatureHealth > 0 then
creatureHitsTillDeath = creatureHitsTillDeath + 1
end
end
if creatureHealth <= 0 then
message = message .. "\nIt would take you approximately " .. creatureHitsTillDeath .. " hits to slain " .. creature:getName() .. ".\n"
else
message = message .. "\nIt would take you more than 100 hits to slain " .. creature:getName() .. ".\n"
end
player:showTextDialog(weapon and weapon:getId() or 2950, message, false)
return false