mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 04:37:00 +00:00
[9373] Fixed rune consume at no rune code mods
Do rune cost calculations only if no no rune cost mod active
This commit is contained in:
parent
40ed0190fa
commit
97cdb501a8
3 changed files with 46 additions and 42 deletions
|
|
@ -289,7 +289,7 @@ struct Areas
|
|||
};
|
||||
|
||||
#define MAX_RUNES 6
|
||||
#define RUNE_COOLDOWN 10000 // msec
|
||||
#define RUNE_COOLDOWN (2*5*IN_MILISECONDS) // msec
|
||||
|
||||
enum RuneType
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3735,49 +3735,56 @@ SpellCastResult Spell::CheckOrTakeRunePower(bool take)
|
|||
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] = src->RuneCost[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 (runeCost[rune] <= 0)
|
||||
continue;
|
||||
|
||||
int32 runeCostTemp = runeCost[rune] * 10000;
|
||||
if(Player* modOwner = plr->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_COST, runeCostTemp, this);
|
||||
|
||||
if (runeCostTemp <= 0)
|
||||
{
|
||||
--runeCost[rune];
|
||||
// already used
|
||||
if(plr->GetRuneCooldown(i) != 0)
|
||||
continue;
|
||||
}
|
||||
|
||||
if(plr->GetRuneCooldown(i) == 0)
|
||||
{
|
||||
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; ++i)
|
||||
for(uint32 i = 0; i < MAX_RUNES && runeCost[RUNE_DEATH]; ++i)
|
||||
{
|
||||
RuneType rune = plr->GetCurrentRune(i);
|
||||
if((plr->GetRuneCooldown(i) == 0) && (rune == RUNE_DEATH))
|
||||
{
|
||||
if (rune != RUNE_DEATH)
|
||||
continue;
|
||||
|
||||
// already used
|
||||
if(plr->GetRuneCooldown(i) != 0)
|
||||
continue;
|
||||
|
||||
if (take)
|
||||
plr->SetRuneCooldown(i, RUNE_COOLDOWN); // 5*2=10 sec
|
||||
|
||||
|
|
@ -3785,15 +3792,12 @@ SpellCastResult Spell::CheckOrTakeRunePower(bool take)
|
|||
|
||||
if (take)
|
||||
plr->ConvertRune(i, plr->GetBaseRune(i));
|
||||
|
||||
if(runeCost[RUNE_DEATH] == 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!take && runeCost[RUNE_DEATH] > 0)
|
||||
return SPELL_FAILED_NO_POWER; // not sure if result code is correct
|
||||
}
|
||||
|
||||
if(take)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "9372"
|
||||
#define REVISION_NR "9373"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue