aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/World
diff options
context:
space:
mode:
authorMihapro <miha.penger@outlook.com>2018-01-03 16:39:00 +0100
committerjoschiwald <joschiwald.trinity@gmail.com>2018-01-03 16:39:32 +0100
commit8199eef81cad464bb43f3613ed884a2c8fc3973d (patch)
tree7a17cb8ede0a45814532dd306fcf7f37d2f90ce8 /src/server/scripts/World
parentc2aead1da5b6cb9a3a69e276b3f12a2c76b9ab86 (diff)
Core/Misc: Added helper function Unit::SetFullPower
* Also renamed Unit::getPowerType and Unit::setPowerType to follow style guidelines Ref #20981
Diffstat (limited to 'src/server/scripts/World')
-rw-r--r--src/server/scripts/World/duel_reset.cpp24
1 files changed, 6 insertions, 18 deletions
diff --git a/src/server/scripts/World/duel_reset.cpp b/src/server/scripts/World/duel_reset.cpp
index 1d279f84880..cdf8808aa52 100644
--- a/src/server/scripts/World/duel_reset.cpp
+++ b/src/server/scripts/World/duel_reset.cpp
@@ -45,24 +45,12 @@ class DuelResetScript : public PlayerScript
if (sWorld->getBoolConfig(CONFIG_RESET_DUEL_HEALTH_MANA))
{
player1->SaveHealthBeforeDuel();
- player1->SetHealth(player1->GetMaxHealth());
+ player1->SaveManaBeforeDuel();
+ player1->ResetAllPowers();
player2->SaveHealthBeforeDuel();
- player2->SetHealth(player2->GetMaxHealth());
-
- // check if player1 class uses mana
- if (player1->getPowerType() == POWER_MANA || player1->getClass() == CLASS_DRUID)
- {
- player1->SaveManaBeforeDuel();
- player1->SetPower(POWER_MANA, player1->GetMaxPower(POWER_MANA));
- }
-
- // check if player2 class uses mana
- if (player2->getPowerType() == POWER_MANA || player2->getClass() == CLASS_DRUID)
- {
- player2->SaveManaBeforeDuel();
- player2->SetPower(POWER_MANA, player2->GetMaxPower(POWER_MANA));
- }
+ player2->SaveManaBeforeDuel();
+ player2->ResetAllPowers();
}
}
@@ -89,11 +77,11 @@ class DuelResetScript : public PlayerScript
loser->RestoreHealthAfterDuel();
// check if player1 class uses mana
- if (winner->getPowerType() == POWER_MANA || winner->getClass() == CLASS_DRUID)
+ if (winner->GetPowerType() == POWER_MANA || winner->getClass() == CLASS_DRUID)
winner->RestoreManaAfterDuel();
// check if player2 class uses mana
- if (loser->getPowerType() == POWER_MANA || loser->getClass() == CLASS_DRUID)
+ if (loser->GetPowerType() == POWER_MANA || loser->getClass() == CLASS_DRUID)
loser->RestoreManaAfterDuel();
}
}