forgottenserver/data/weapons/scripts/viper_star.lua
Ray 1d735880b3 Moved Creature:addDamageCondition to core (#2339)
* Moved Creature:addDamageCondition from spells lib to core

* Check if target is nil

* Renamed parameter "time" to "period" since it is periodic damage

* Add named constants for damage list types

* Use named constants instead of magic numbers to choose from damage list type

* Use damage list types constants in weapons

* Use more meaningful constants, shortened parameters

* Updated constants in weapons
2017-10-05 21:55:24 +00:00

18 lines
547 B
Lua

local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_GREENSTAR)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true)
combat:setFormula(COMBAT_FORMULA_SKILL, 0, 0, 1, 0)
function onUseWeapon(player, variant)
if not combat:execute(player, variant) then
return false
end
if math.random(1, 100) <= 90 then
return false
end
player:addDamageCondition(Creature(variant:getNumber()), CONDITION_POISON, DAMAGELIST_LOGARITHMIC_DAMAGE, 2)
return true
end