how can i do to decrease damage by 5% on each more player the spell hits?
for example, the spell hit 1 player on area, with 100 damage total right.
but if have two players on area, the spell will not hit 100 damage, but 95 damage.
3 players on area, the spell will hit each player with 90 damage.
but this with a limite maximum of decrease damage 50%.
My Great Fireball spell
for example, the spell hit 1 player on area, with 100 damage total right.
but if have two players on area, the spell will not hit 100 damage, but 95 damage.
3 players on area, the spell will hit each player with 90 damage.
but this with a limite maximum of decrease damage 50%.
My Great Fireball spell
LUA:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
combat:setArea(createCombatArea(AREA_CIRCLE3X3))
function onGetFormulaValues(player, level, maglevel)
local base = 50
local variation = 15
local value = math.random(-variation, variation) + base
local formula = 3 * maglevel + (2 * level)
return -(formula * value / 100)
end
combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
function onCastSpell(creature, variant, isHotkey)
return combat:execute(creature, variant)
end