mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 19:37:02 +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 MAX_RUNES 6
|
||||||
#define RUNE_COOLDOWN 10000 // msec
|
#define RUNE_COOLDOWN (2*5*IN_MILISECONDS) // msec
|
||||||
|
|
||||||
enum RuneType
|
enum RuneType
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -3735,49 +3735,56 @@ SpellCastResult Spell::CheckOrTakeRunePower(bool take)
|
||||||
if (take)
|
if (take)
|
||||||
m_runesState = plr->GetRunesState(); // store previous state
|
m_runesState = plr->GetRunesState(); // store previous state
|
||||||
|
|
||||||
int32 runeCost[NUM_RUNE_TYPES]; // blood, frost, unholy, death
|
// 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);
|
||||||
|
|
||||||
for(uint32 i = 0; i < RUNE_DEATH; ++i)
|
if (runeCostMod > 0)
|
||||||
runeCost[i] = src->RuneCost[i];
|
|
||||||
|
|
||||||
runeCost[RUNE_DEATH] = 0; // calculated later
|
|
||||||
|
|
||||||
for(uint32 i = 0; i < MAX_RUNES; ++i)
|
|
||||||
{
|
{
|
||||||
RuneType rune = plr->GetCurrentRune(i);
|
int32 runeCost[NUM_RUNE_TYPES]; // blood, frost, unholy, death
|
||||||
if (runeCost[rune] <= 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
int32 runeCostTemp = runeCost[rune] * 10000;
|
// init cost data and apply mods
|
||||||
if(Player* modOwner = plr->GetSpellModOwner())
|
for(uint32 i = 0; i < RUNE_DEATH; ++i)
|
||||||
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_COST, runeCostTemp, this);
|
runeCost[i] = runeCostMod > 0 ? src->RuneCost[i] : 0;
|
||||||
|
|
||||||
if (runeCostTemp <= 0)
|
runeCost[RUNE_DEATH] = 0; // calculated later
|
||||||
{
|
|
||||||
--runeCost[rune];
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(plr->GetRuneCooldown(i) == 0)
|
// scan non-death runes (death rune not used explicitly in rune costs)
|
||||||
{
|
|
||||||
if (take)
|
|
||||||
plr->SetRuneCooldown(i, RUNE_COOLDOWN); // 5*2=10 sec
|
|
||||||
|
|
||||||
--runeCost[rune];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(uint32 i = 0; i < RUNE_DEATH; ++i)
|
|
||||||
if(runeCost[i] > 0)
|
|
||||||
runeCost[RUNE_DEATH] += runeCost[i];
|
|
||||||
|
|
||||||
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((plr->GetRuneCooldown(i) == 0) && (rune == RUNE_DEATH))
|
if (runeCost[rune] <= 0)
|
||||||
|
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);
|
||||||
|
if (rune != RUNE_DEATH)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// already used
|
||||||
|
if(plr->GetRuneCooldown(i) != 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (take)
|
if (take)
|
||||||
plr->SetRuneCooldown(i, RUNE_COOLDOWN); // 5*2=10 sec
|
plr->SetRuneCooldown(i, RUNE_COOLDOWN); // 5*2=10 sec
|
||||||
|
|
||||||
|
|
@ -3785,15 +3792,12 @@ SpellCastResult Spell::CheckOrTakeRunePower(bool take)
|
||||||
|
|
||||||
if (take)
|
if (take)
|
||||||
plr->ConvertRune(i, plr->GetBaseRune(i));
|
plr->ConvertRune(i, plr->GetBaseRune(i));
|
||||||
|
|
||||||
if(runeCost[RUNE_DEATH] == 0)
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if(!take && runeCost[RUNE_DEATH] > 0)
|
if(!take && runeCost[RUNE_DEATH] > 0)
|
||||||
return SPELL_FAILED_NO_POWER; // not sure if result code is correct
|
return SPELL_FAILED_NO_POWER; // not sure if result code is correct
|
||||||
|
}
|
||||||
|
|
||||||
if(take)
|
if(take)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "9372"
|
#define REVISION_NR "9373"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue