mirror of
https://github.com/mangosfour/server.git
synced 2025-12-17 16:37:00 +00:00
[12752] Partially fixed death knight runes cooldown
issues: cooldown synchronizes with all other runes (in next commit cooldown will splitted correctly)
This commit is contained in:
parent
04786e7ee8
commit
9decc79dd0
3 changed files with 48 additions and 64 deletions
|
|
@ -2173,18 +2173,21 @@ void Player::Regenerate(Powers power, uint32 diff)
|
|||
if (getClass() != CLASS_DEATH_KNIGHT)
|
||||
break;
|
||||
|
||||
for (uint32 rune = 0; rune < MAX_RUNES; ++rune)
|
||||
{
|
||||
if (uint16 cd = GetRuneCooldown(rune)) // if we have cooldown, reduce it...
|
||||
for (uint8 rune = 0; rune < MAX_RUNES; rune += 2)
|
||||
{
|
||||
uint32 cd_diff = diff;
|
||||
AuraList const& ModPowerRegenPCTAuras = GetAurasByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
|
||||
for (AuraList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
|
||||
if ((*i)->GetModifier()->m_miscvalue == int32(power) && (*i)->GetMiscBValue() == GetCurrentRune(rune))
|
||||
cd_diff = cd_diff * ((*i)->GetModifier()->m_amount + 100) / 100;
|
||||
|
||||
SetRuneCooldown(rune, (cd < cd_diff) ? 0 : cd - cd_diff);
|
||||
uint8 runeToRegen = rune;
|
||||
uint32 cd = GetRuneCooldown(rune);
|
||||
uint32 secondRuneCd = GetRuneCooldown(rune + 1);
|
||||
// Regenerate second rune of the same type only after first rune is off the cooldown
|
||||
if (secondRuneCd && (cd > secondRuneCd || !cd))
|
||||
{
|
||||
++runeToRegen;
|
||||
cd = secondRuneCd;
|
||||
}
|
||||
|
||||
if (cd)
|
||||
SetRuneCooldown(rune, (cd < cd_diff) ? 0 : cd - cd_diff);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -22072,7 +22075,7 @@ void Player::ResyncRunes()
|
|||
for (uint32 i = 0; i < MAX_RUNES; ++i)
|
||||
{
|
||||
data << uint8(GetCurrentRune(i)); // rune type
|
||||
data << uint8(255 - ((GetRuneCooldown(i) / REGEN_TIME_FULL) * 51)); // passed cooldown time (0-255)
|
||||
data << uint8(255 - (GetRuneCooldown(i) * 51)); // passed cooldown time (0-255)
|
||||
}
|
||||
GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4724,28 +4724,22 @@ SpellCastResult Spell::CheckOrTakeRunePower(bool take)
|
|||
return SPELL_CAST_OK;
|
||||
|
||||
SpellRuneCostEntry const* src = sSpellRuneCostStore.LookupEntry(m_spellInfo->runeCostID);
|
||||
|
||||
if (!src)
|
||||
return SPELL_CAST_OK;
|
||||
|
||||
if (src->NoRuneCost() && (!take || src->NoRunicPowerGain()))
|
||||
if (!src || (src->NoRuneCost() && (!take || src->NoRunicPowerGain())))
|
||||
return SPELL_CAST_OK;
|
||||
|
||||
if (take)
|
||||
m_runesState = plr->GetRunesState(); // store previous state
|
||||
|
||||
// at this moment for rune cost exist only no cost mods, and no percent mods
|
||||
int32 runeCostMod = 10000;
|
||||
if (Player* modOwner = plr->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_COST, runeCostMod, this);
|
||||
|
||||
if (runeCostMod > 0)
|
||||
{
|
||||
int32 runeCost[NUM_RUNE_TYPES]; // blood, frost, unholy, death
|
||||
|
||||
// init cost data and apply mods
|
||||
for (uint32 i = 0; i < RUNE_DEATH; ++i)
|
||||
runeCost[i] = runeCostMod > 0 ? src->RuneCost[i] : 0;
|
||||
{
|
||||
runeCost[i] = src->RuneCost[i];
|
||||
if (Player* modOwner = plr->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_COST, runeCost[i], this);
|
||||
}
|
||||
|
||||
|
||||
runeCost[RUNE_DEATH] = 0; // calculated later
|
||||
|
||||
|
|
@ -4753,18 +4747,12 @@ SpellCastResult Spell::CheckOrTakeRunePower(bool take)
|
|||
for (uint32 i = 0; i < MAX_RUNES; ++i)
|
||||
{
|
||||
RuneType rune = plr->GetCurrentRune(i);
|
||||
if (runeCost[rune] <= 0)
|
||||
continue;
|
||||
|
||||
// already used
|
||||
if (plr->GetRuneCooldown(i) != 0)
|
||||
continue;
|
||||
|
||||
if (take)
|
||||
if (!plr->GetRuneCooldown(i) && runeCost[rune] > 0)
|
||||
{
|
||||
plr->SetRuneCooldown(i, RUNE_COOLDOWN); // 5*2=10 sec
|
||||
|
||||
--runeCost[rune];
|
||||
}
|
||||
}
|
||||
|
||||
// collect all not counted rune costs to death runes cost
|
||||
for (uint32 i = 0; i < RUNE_DEATH; ++i)
|
||||
|
|
@ -4774,30 +4762,23 @@ SpellCastResult Spell::CheckOrTakeRunePower(bool take)
|
|||
// scan death runes
|
||||
if (runeCost[RUNE_DEATH] > 0)
|
||||
{
|
||||
for (uint32 i = 0; i < MAX_RUNES && runeCost[RUNE_DEATH]; ++i)
|
||||
for (uint32 i = 0; i < MAX_RUNES; ++i)
|
||||
{
|
||||
RuneType rune = plr->GetCurrentRune(i);
|
||||
if (rune != RUNE_DEATH)
|
||||
continue;
|
||||
|
||||
// already used
|
||||
if (plr->GetRuneCooldown(i) != 0)
|
||||
continue;
|
||||
|
||||
if (take)
|
||||
if (plr->GetRuneCooldown(i) && rune == RUNE_DEATH)
|
||||
{
|
||||
plr->SetRuneCooldown(i, RUNE_COOLDOWN); // 5*2=10 sec
|
||||
|
||||
--runeCost[rune];
|
||||
runeCost[rune]--;
|
||||
|
||||
if (take)
|
||||
plr->ConvertRune(i, plr->GetBaseRune(i));
|
||||
}
|
||||
}
|
||||
|
||||
if (!take && runeCost[RUNE_DEATH] > 0)
|
||||
return SPELL_FAILED_NO_POWER; // not sure if result code is correct
|
||||
}
|
||||
|
||||
if (runeCost[RUNE_DEATH] == 0)
|
||||
return SPELL_FAILED_NO_POWER; // not sure if result code is correct
|
||||
|
||||
if (take)
|
||||
{
|
||||
// you can gain some runic power when use runes
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "12751"
|
||||
#define REVISION_NR "12752"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue