-- Editable configurations for each rune
local runesConfig = {
[2307] = { -- Rune ID for Super SD
name = "Super SD", -- Name of the rune
level = 8, -- Minimum level required to use the rune
magicLevel = 1, -- Minimum magic level required to use the rune
minDamageFactor = 8, -- Minimum damage factor based on magic level
maxDamageFactor = 12, -- Maximum damage factor based on magic level
additionalMinDamage = 50, -- Additional minimum damage
additionalMaxDamage = 85, -- Additional maximum damage
spellGroupId = 24, -- Spell group ID
vocation = {"Sorcerer", "Master Sorcerer"}, -- Vocation that can use the rune
aggressive = false, -- If the rune is aggressive
needTarget = false, -- If the rune requires a target
allowFarUse = true, -- If the rune can be used from a distance
charges = 0, -- number 0 means infinite runes; if you don't want it to be infinite, just set it to number 1.
delay = 2000 -- Delay in milliseconds before casting the next rune
},
-- Add more runes here with their respective configurations
}
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_DEATHDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MORTAREA)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SUDDENDEATH)
combat:setParameter(COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false)
function onGetFormulaValues(player, level, magicLevel)
local runeId = player:getStorageValue(STORAGE_PLAYER_RUNE_ID)
local config = runesConfig[runeId]
if not config then
print("Error: Rune configuration not found for ID " .. runeId)
return 0, 0
end
local min = (level / 6) + (magicLevel * config.minDamageFactor) + config.additionalMinDamage
local max = (level / 6) + (magicLevel * config.maxDamageFactor) + config.additionalMaxDamage
return min, max
end
combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
for runeId, config in pairs(runesConfig) do
local spell = Spell(SPELL_RUNE)
function spell.onCastSpell(creature, variant, isHotkey)
creature:setStorageValue(STORAGE_PLAYER_RUNE_ID, runeId)
local targetTile = Tile(variant:getPosition())
if targetTile then
local topCreature = targetTile:getTopCreature()
if topCreature and not topCreature:isPlayer() then
return combat:execute(creature, variant)
else
creature:sendCancelMessage("You can only use this rune on creatures.")
creature:getPosition():sendMagicEffect(CONST_ME_POFF)
end
end
return combat:execute(creature, variant)
end
spell:name(config.name)
spell:runeId(runeId)
spell:group("attack")
spell:id(config.spellGroupId)
spell:level(config.level)
spell:magicLevel(config.magicLevel)
spell:needTarget(config.needTarget)
spell:isAggressive(config.aggressive)
spell:allowFarUse(config.allowFarUse)
spell:charges(config.charges)
spell:vocation(unpack(config.vocation))
spell:register()
end