From 92e0b5941fb803cdf72b9c5a721b669bd70a2d0b Mon Sep 17 00:00:00 2001 From: DaC Date: Sat, 18 Jun 2011 20:27:43 +0400 Subject: [PATCH] [11644] Sets rage to zero and energie to 100% when entering battleground and arena Move related code to Aura::HandleArenaPreparation (un-)apply code. Signed-off-by: VladimirMangos --- src/game/BattleGround.cpp | 5 ----- src/game/SpellAuras.cpp | 21 +++++++++++++++++---- src/shared/revision_nr.h | 2 +- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index 127bd52a8..edb4b3410 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -1220,13 +1220,8 @@ void BattleGround::AddPlayer(Player *plr) plr->UnsummonPetTemporaryIfAny(); if(GetStatus() == STATUS_WAIT_JOIN) // not started yet - { plr->CastSpell(plr, SPELL_ARENA_PREPARATION, true); - plr->SetHealth(plr->GetMaxHealth()); - plr->SetPower(POWER_MANA, plr->GetMaxPower(POWER_MANA)); - } - plr->CastSpell(plr, SPELL_ARENA_DAMPENING, true); } else diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index a4e8b1d0e..5f1bb6af2 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -8041,13 +8041,26 @@ void Aura::HandleManaShield(bool apply, bool Real) void Aura::HandleArenaPreparation(bool apply, bool Real) { - if(!Real) + if (!Real) return; - if(apply) - GetTarget()->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREPARATION); + Unit* target = GetTarget(); + + target->ApplyModFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREPARATION, apply); + + if (apply) + { + // max regen powers at start preparation + target->SetHealth(target->GetMaxHealth()); + target->SetPower(POWER_MANA, target->GetMaxPower(POWER_MANA)); + target->SetPower(POWER_ENERGY, target->GetMaxPower(POWER_ENERGY)); + } else - GetTarget()->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREPARATION); + { + // reset originally 0 powers at start/leave + target->SetPower(POWER_RAGE, 0); + target->SetPower(POWER_RUNIC_POWER, 0); + } } /** diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 0f15ea739..305d4341e 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "11643" + #define REVISION_NR "11644" #endif // __REVISION_NR_H__