Skip to content

Commit

Permalink
fix: avatar cooldown reduction (opentibiabr#2607)
Browse files Browse the repository at this point in the history
# Description

This PR fixes the avatar cooldown reduction spells to be done in the
source and remove from scripts, this is being done to work with opentibiabr#2602.

## Behaviour
### **Actual**

The avatar cooldown reduction is via script.

### **Expected**

The avatar cooldown reduction is via source.

## Type of change

  - [x] Bug fix (non-breaking change which fixes an issue)

## How Has This Been Tested

Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration

- [x] Cast Avatar spell of each vocation with stage 1 in wheel, the
cooldown should be 120 minutes (two hours)
- [x] Cast Avatar spell of each vocation with stage 2 in wheel, the
cooldown should be 90 minutes (one and a half hour)
- [x] Cast Avatar spell of each vocation with stage 3 in wheel, the
cooldown should be 60 minutes (one hour)

**Test Configuration**:

  - Server Version: Latest
  - Client: 13.32
  - Operating System: Windows 11

## Checklist

  - [X] My code follows the style guidelines of this project
  - [X] I have performed a self-review of my own code
  - [X] I checked the PR checks reports
- [X] I have commented my code, particularly in hard-to-understand areas
  - [X] I have made corresponding changes to the documentation
  - [X] My changes generate no new warnings
- [X] I have added tests that prove my fix is effective or that my
feature works

---------

Co-authored-by: GitHub Actions <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
phacUFPE and github-actions[bot] authored May 12, 2024
1 parent 5aeb64c commit a9360fa
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 60 deletions.
15 changes: 2 additions & 13 deletions data/scripts/spells/support/avatar_of_light.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,9 @@ function spell.onCastSpell(creature, variant)
return false
end

local cooldown = 0
if grade >= 3 then
cooldown = 60
elseif grade >= 2 then
cooldown = 90
elseif grade >= 1 then
cooldown = 120
end
local duration = 15000
condition:setTicks(duration)
local conditionCooldown = Condition(CONDITION_SPELLCOOLDOWN, CONDITIONID_DEFAULT, 265)
conditionCooldown:setTicks((cooldown * 1000 * 60) / configManager.getFloat(configKeys.RATE_SPELL_COOLDOWN))
-- creature:getPosition():sendMagicEffect(CONST_ME_AVATAR_APPEAR)
creature:addCondition(conditionCooldown)
creature:getPosition():sendMagicEffect(CONST_ME_AVATAR_APPEAR)
creature:addCondition(condition)
creature:avatarTimer((os.time() * 1000) + duration)
creature:reloadData()
Expand All @@ -43,7 +32,7 @@ spell:words("uteta res sac")
spell:level(300)
spell:mana(1500)
spell:isPremium(true)
spell:cooldown(1000) -- Cooldown is calculated on the casting
spell:cooldown(2 * 60 * 60 * 1000) -- Default cooldown = 2 hours
spell:groupCooldown(2 * 1000)
spell:vocation("paladin;true", "royal paladin;true")
spell:hasParams(true)
Expand Down
15 changes: 2 additions & 13 deletions data/scripts/spells/support/avatar_of_nature.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,9 @@ function spell.onCastSpell(creature, variant)
return false
end

local cooldown = 0
if grade >= 3 then
cooldown = 60
elseif grade >= 2 then
cooldown = 90
elseif grade >= 1 then
cooldown = 120
end
local duration = 15000
condition:setTicks(duration)
local conditionCooldown = Condition(CONDITION_SPELLCOOLDOWN, CONDITIONID_DEFAULT, 267)
conditionCooldown:setTicks((cooldown * 1000 * 60) / configManager.getFloat(configKeys.RATE_SPELL_COOLDOWN))
-- creature:getPosition():sendMagicEffect(CONST_ME_AVATAR_APPEAR)
creature:addCondition(conditionCooldown)
creature:getPosition():sendMagicEffect(CONST_ME_AVATAR_APPEAR)
creature:addCondition(condition)
creature:avatarTimer((os.time() * 1000) + duration)
creature:reloadData()
Expand All @@ -43,7 +32,7 @@ spell:words("uteta res dru")
spell:level(300)
spell:mana(2200)
spell:isPremium(true)
spell:cooldown(1000) -- Cooldown is calculated on the casting
spell:cooldown(2 * 60 * 60 * 1000) -- Default cooldown = 2 hours
spell:groupCooldown(2 * 1000)
spell:vocation("druid;true", "elder druid;true")
spell:hasParams(true)
Expand Down
15 changes: 2 additions & 13 deletions data/scripts/spells/support/avatar_of_steel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,9 @@ function spell.onCastSpell(creature, variant)
return false
end

local cooldown = 0
if grade >= 3 then
cooldown = 60
elseif grade >= 2 then
cooldown = 90
elseif grade >= 1 then
cooldown = 120
end
local duration = 15000
condition:setTicks(duration)
local conditionCooldown = Condition(CONDITION_SPELLCOOLDOWN, CONDITIONID_DEFAULT, 264)
conditionCooldown:setTicks((cooldown * 1000 * 60) / configManager.getFloat(configKeys.RATE_SPELL_COOLDOWN))
-- creature:getPosition():sendMagicEffect(CONST_ME_AVATAR_APPEAR)
creature:addCondition(conditionCooldown)
creature:getPosition():sendMagicEffect(CONST_ME_AVATAR_APPEAR)
creature:addCondition(condition)
creature:avatarTimer((os.time() * 1000) + duration)
creature:reloadData()
Expand All @@ -43,7 +32,7 @@ spell:words("uteta res eq")
spell:level(300)
spell:mana(800)
spell:isPremium(true)
spell:cooldown(1000) -- Cooldown is calculated on the casting
spell:cooldown(2 * 60 * 60 * 1000) -- Default cooldown = 2 hours
spell:groupCooldown(2 * 1000)
spell:vocation("knight;true", "elite knight;true")
spell:hasParams(true)
Expand Down
15 changes: 2 additions & 13 deletions data/scripts/spells/support/avatar_of_storm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,9 @@ function spell.onCastSpell(creature, variant)
return false
end

local cooldown = 0
if grade >= 3 then
cooldown = 60
elseif grade >= 2 then
cooldown = 90
elseif grade >= 1 then
cooldown = 120
end
local duration = 15000
condition:setTicks(duration)
local conditionCooldown = Condition(CONDITION_SPELLCOOLDOWN, CONDITIONID_DEFAULT, 266)
conditionCooldown:setTicks((cooldown * 1000 * 60) / configManager.getFloat(configKeys.RATE_SPELL_COOLDOWN))
-- creature:getPosition():sendMagicEffect(CONST_ME_AVATAR_APPEAR)
creature:addCondition(conditionCooldown)
creature:getPosition():sendMagicEffect(CONST_ME_AVATAR_APPEAR)
creature:addCondition(condition)
creature:avatarTimer((os.time() * 1000) + duration)
creature:reloadData()
Expand All @@ -43,7 +32,7 @@ spell:words("uteta res ven")
spell:level(300)
spell:mana(2200)
spell:isPremium(true)
spell:cooldown(1000) -- Cooldown is calculated on the casting
spell:cooldown(2 * 60 * 60 * 1000) -- Default cooldown = 2 hours
spell:groupCooldown(2 * 1000)
spell:vocation("sorcerer;true", "master sorcerer;true")
spell:hasParams(true)
Expand Down
16 changes: 8 additions & 8 deletions src/creatures/players/wheel/player_wheel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1537,12 +1537,12 @@ void PlayerWheel::registerPlayerBonusData() {
}
if (m_playerBonusData.avatar.light >= 2) {
WheelSpells::Bonus bonus;
bonus.decrease.cooldown = 3 * 60 * 1000;
bonus.decrease.cooldown = 30 * 60 * 1000; // 30 minutes
addSpellBonus("Avatar of Light", bonus);
}
if (m_playerBonusData.avatar.light >= 3) {
WheelSpells::Bonus bonus;
bonus.decrease.cooldown = 2 * 60 * 1000;
bonus.decrease.cooldown = 30 * 60 * 1000; // 30 minutes
addSpellBonus("Avatar of Light", bonus);
}
} else {
Expand All @@ -1555,12 +1555,12 @@ void PlayerWheel::registerPlayerBonusData() {
}
if (m_playerBonusData.avatar.nature >= 2) {
WheelSpells::Bonus bonus;
bonus.decrease.cooldown = 3 * 60 * 1000;
bonus.decrease.cooldown = 30 * 60 * 1000; // 30 minutes
addSpellBonus("Avatar of Nature", bonus);
}
if (m_playerBonusData.avatar.nature >= 3) {
WheelSpells::Bonus bonus;
bonus.decrease.cooldown = 2 * 60 * 1000;
bonus.decrease.cooldown = 30 * 60 * 1000; // 30 minutes
addSpellBonus("Avatar of Nature", bonus);
}
} else {
Expand All @@ -1573,12 +1573,12 @@ void PlayerWheel::registerPlayerBonusData() {
}
if (m_playerBonusData.avatar.steel >= 2) {
WheelSpells::Bonus bonus;
bonus.decrease.cooldown = 3 * 60 * 1000;
bonus.decrease.cooldown = 30 * 60 * 1000; // 30 minutes
addSpellBonus("Avatar of Steel", bonus);
}
if (m_playerBonusData.avatar.steel >= 3) {
WheelSpells::Bonus bonus;
bonus.decrease.cooldown = 2 * 60 * 1000;
bonus.decrease.cooldown = 30 * 60 * 1000; // 30 minutes
addSpellBonus("Avatar of Steel", bonus);
}
} else {
Expand All @@ -1591,12 +1591,12 @@ void PlayerWheel::registerPlayerBonusData() {
}
if (m_playerBonusData.avatar.storm >= 2) {
WheelSpells::Bonus bonus;
bonus.decrease.cooldown = 3 * 60 * 1000;
bonus.decrease.cooldown = 30 * 60 * 1000; // 30 minutes
addSpellBonus("Avatar of Storm", bonus);
}
if (m_playerBonusData.avatar.storm >= 3) {
WheelSpells::Bonus bonus;
bonus.decrease.cooldown = 2 * 60 * 1000;
bonus.decrease.cooldown = 30 * 60 * 1000; // 30 minutes
addSpellBonus("Avatar of Storm", bonus);
}
} else {
Expand Down

0 comments on commit a9360fa

Please sign in to comment.