mirror of
https://github.com/mangosfour/server.git
synced 2025-12-17 07:37:03 +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)
|
if (getClass() != CLASS_DEATH_KNIGHT)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
for (uint32 rune = 0; rune < MAX_RUNES; ++rune)
|
for (uint8 rune = 0; rune < MAX_RUNES; rune += 2)
|
||||||
{
|
{
|
||||||
if (uint16 cd = GetRuneCooldown(rune)) // if we have cooldown, reduce it...
|
uint32 cd_diff = 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))
|
||||||
{
|
{
|
||||||
uint32 cd_diff = diff;
|
++runeToRegen;
|
||||||
AuraList const& ModPowerRegenPCTAuras = GetAurasByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
|
cd = secondRuneCd;
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cd)
|
||||||
|
SetRuneCooldown(rune, (cd < cd_diff) ? 0 : cd - cd_diff);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -22072,7 +22075,7 @@ void Player::ResyncRunes()
|
||||||
for (uint32 i = 0; i < MAX_RUNES; ++i)
|
for (uint32 i = 0; i < MAX_RUNES; ++i)
|
||||||
{
|
{
|
||||||
data << uint8(GetCurrentRune(i)); // rune type
|
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);
|
GetSession()->SendPacket(&data);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4724,80 +4724,61 @@ SpellCastResult Spell::CheckOrTakeRunePower(bool take)
|
||||||
return SPELL_CAST_OK;
|
return SPELL_CAST_OK;
|
||||||
|
|
||||||
SpellRuneCostEntry const* src = sSpellRuneCostStore.LookupEntry(m_spellInfo->runeCostID);
|
SpellRuneCostEntry const* src = sSpellRuneCostStore.LookupEntry(m_spellInfo->runeCostID);
|
||||||
|
if (!src || (src->NoRuneCost() && (!take || src->NoRunicPowerGain())))
|
||||||
if (!src)
|
|
||||||
return SPELL_CAST_OK;
|
|
||||||
|
|
||||||
if (src->NoRuneCost() && (!take || src->NoRunicPowerGain()))
|
|
||||||
return SPELL_CAST_OK;
|
return SPELL_CAST_OK;
|
||||||
|
|
||||||
if (take)
|
if (take)
|
||||||
m_runesState = plr->GetRunesState(); // store previous state
|
m_runesState = plr->GetRunesState(); // store previous state
|
||||||
|
|
||||||
// at this moment for rune cost exist only no cost mods, and no percent mods
|
int32 runeCost[NUM_RUNE_TYPES]; // blood, frost, unholy, death
|
||||||
int32 runeCostMod = 10000;
|
|
||||||
if (Player* modOwner = plr->GetSpellModOwner())
|
|
||||||
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_COST, runeCostMod, this);
|
|
||||||
|
|
||||||
if (runeCostMod > 0)
|
// init cost data and apply mods
|
||||||
|
for (uint32 i = 0; i < RUNE_DEATH; ++i)
|
||||||
{
|
{
|
||||||
int32 runeCost[NUM_RUNE_TYPES]; // blood, frost, unholy, death
|
runeCost[i] = src->RuneCost[i];
|
||||||
|
if (Player* modOwner = plr->GetSpellModOwner())
|
||||||
|
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_COST, runeCost[i], this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// init cost data and apply mods
|
runeCost[RUNE_DEATH] = 0; // calculated later
|
||||||
for (uint32 i = 0; i < RUNE_DEATH; ++i)
|
|
||||||
runeCost[i] = runeCostMod > 0 ? src->RuneCost[i] : 0;
|
|
||||||
|
|
||||||
runeCost[RUNE_DEATH] = 0; // calculated later
|
// scan non-death runes (death rune not used explicitly in rune costs)
|
||||||
|
for (uint32 i = 0; i < MAX_RUNES; ++i)
|
||||||
|
{
|
||||||
|
RuneType rune = plr->GetCurrentRune(i);
|
||||||
|
if (!plr->GetRuneCooldown(i) && runeCost[rune] > 0)
|
||||||
|
{
|
||||||
|
plr->SetRuneCooldown(i, RUNE_COOLDOWN); // 5*2=10 sec
|
||||||
|
--runeCost[rune];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// scan non-death runes (death rune not used explicitly in rune costs)
|
// collect all not counted rune costs to death runes cost
|
||||||
|
for (uint32 i = 0; i < RUNE_DEATH; ++i)
|
||||||
|
if (runeCost[i] > 0)
|
||||||
|
runeCost[RUNE_DEATH] += runeCost[i];
|
||||||
|
|
||||||
|
// scan death runes
|
||||||
|
if (runeCost[RUNE_DEATH] > 0)
|
||||||
|
{
|
||||||
for (uint32 i = 0; i < MAX_RUNES; ++i)
|
for (uint32 i = 0; i < MAX_RUNES; ++i)
|
||||||
{
|
{
|
||||||
RuneType rune = plr->GetCurrentRune(i);
|
RuneType rune = plr->GetCurrentRune(i);
|
||||||
if (runeCost[rune] <= 0)
|
if (plr->GetRuneCooldown(i) && rune == RUNE_DEATH)
|
||||||
continue;
|
|
||||||
|
|
||||||
// already used
|
|
||||||
if (plr->GetRuneCooldown(i) != 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (take)
|
|
||||||
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)
|
|
||||||
if (runeCost[i] > 0)
|
|
||||||
runeCost[RUNE_DEATH] += runeCost[i];
|
|
||||||
|
|
||||||
// scan death runes
|
|
||||||
if (runeCost[RUNE_DEATH] > 0)
|
|
||||||
{
|
|
||||||
for (uint32 i = 0; i < MAX_RUNES && runeCost[RUNE_DEATH]; ++i)
|
|
||||||
{
|
{
|
||||||
RuneType rune = plr->GetCurrentRune(i);
|
plr->SetRuneCooldown(i, RUNE_COOLDOWN); // 5*2=10 sec
|
||||||
if (rune != RUNE_DEATH)
|
runeCost[rune]--;
|
||||||
continue;
|
|
||||||
|
|
||||||
// already used
|
|
||||||
if (plr->GetRuneCooldown(i) != 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (take)
|
|
||||||
plr->SetRuneCooldown(i, RUNE_COOLDOWN); // 5*2=10 sec
|
|
||||||
|
|
||||||
--runeCost[rune];
|
|
||||||
|
|
||||||
if (take)
|
if (take)
|
||||||
plr->ConvertRune(i, plr->GetBaseRune(i));
|
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)
|
if (take)
|
||||||
{
|
{
|
||||||
// you can gain some runic power when use runes
|
// you can gain some runic power when use runes
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "12751"
|
#define REVISION_NR "12752"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue