canary/data/scripts/spells/support/protector.lua
Paco def12a7fcd
feat: add configurable retro spell learning system (#3971)
Add a config boolean to enable the retro spell learning system.

Main changes:
- Add retro spell learning support behind a configuration option.
- Update all spells to respect the new config.
- Update spell-related NPCs to handle the learning system according to TibiaWiki behavior.
- Update Dawnport NPCs for the retro spell learning flow.
- Update the Rookgaard Oracle to handle Monk vocation selection.

Validation:
- Debugged and tested on tibiatales.com using the Canary/TFS Crystal server distribution.

This allows servers to enable classic spell-learning behavior via config while keeping the existing spell behavior configurable.
2026-05-29 12:17:08 -03:00

37 lines
1.3 KiB
Lua

local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false)
local skill = Condition(CONDITION_ATTRIBUTES)
skill:setParameter(CONDITION_PARAM_SUBID, AttrSubId_BloodRageProtector)
skill:setParameter(CONDITION_PARAM_TICKS, 13000)
skill:setParameter(CONDITION_PARAM_SKILL_SHIELDPERCENT, 220)
skill:setParameter(CONDITION_PARAM_BUFF_DAMAGEDEALT, 65)
skill:setParameter(CONDITION_PARAM_BUFF_DAMAGERECEIVED, 85)
skill:setParameter(CONDITION_PARAM_BUFF_SPELL, true)
combat:addCondition(skill)
local spell = Spell("instant")
function spell.onCastSpell(creature, variant)
if creature:getCondition(CONDITION_ATTRIBUTES, CONDITIONID_COMBAT, AttrSubId_BloodRageProtector) then
creature:removeCondition(CONDITION_ATTRIBUTES, CONDITIONID_COMBAT, AttrSubId_BloodRageProtector)
end
return combat:execute(creature, variant)
end
spell:name("Protector")
spell:words("utamo tempo")
spell:group("support", "focus")
spell:vocation("knight;true", "elite knight;true")
spell:castSound(SOUND_EFFECT_TYPE_SPELL_PROTECTOR)
spell:id(132)
spell:cooldown(2 * 1000)
spell:groupCooldown(2 * 1000, 2 * 1000)
spell:level(55)
spell:mana(200)
spell:isSelfTarget(true)
spell:isAggressive(false)
spell:isPremium(true)
spell:register()