diff options
| author | azazel <none@none> | 2010-08-26 01:20:57 +0600 |
|---|---|---|
| committer | azazel <none@none> | 2010-08-26 01:20:57 +0600 |
| commit | 341e6303effccfdbfb6b67ae0d8fe6933f56ed3b (patch) | |
| tree | eff917fec707c7097a7b408ce15842ff24d8ddb4 /src/server/scripts/World | |
| parent | bb5f7b64927713911331f81f9c0a5abc33e0c3ab (diff) | |
Core:
* add helping methods for manipulating unit's health and use it where applicable
* fix some conversion warnings and cleanup code (formatting, CRLF, tabs to spaces)
--HG--
branch : trunk
Diffstat (limited to 'src/server/scripts/World')
| -rw-r--r-- | src/server/scripts/World/boss_emeriss.cpp | 2 | ||||
| -rw-r--r-- | src/server/scripts/World/boss_taerar.cpp | 2 | ||||
| -rw-r--r-- | src/server/scripts/World/boss_ysondre.cpp | 2 | ||||
| -rw-r--r-- | src/server/scripts/World/mob_generic_creature.cpp | 4 | ||||
| -rw-r--r-- | src/server/scripts/World/npcs_special.cpp | 10 |
5 files changed, 10 insertions, 10 deletions
diff --git a/src/server/scripts/World/boss_emeriss.cpp b/src/server/scripts/World/boss_emeriss.cpp index eedd7a90f22..db19ccbbeb4 100644 --- a/src/server/scripts/World/boss_emeriss.cpp +++ b/src/server/scripts/World/boss_emeriss.cpp @@ -112,7 +112,7 @@ public: //CorruptionofEarth_Timer //CorruptionofEarth at 75%, 50% and 25% - if ((me->GetHealth()*100 / me->GetMaxHealth()) <= (100-(25*m_uiCorruptionsCasted))) + if (!HealthAbovePct(100 - 25 * m_uiCorruptionsCasted)) { ++m_uiCorruptionsCasted; // prevent casting twice on same hp DoScriptText(SAY_CASTCORRUPTION, me); diff --git a/src/server/scripts/World/boss_taerar.cpp b/src/server/scripts/World/boss_taerar.cpp index cef9db43e1c..8e5e66629e6 100644 --- a/src/server/scripts/World/boss_taerar.cpp +++ b/src/server/scripts/World/boss_taerar.cpp @@ -162,7 +162,7 @@ public: m_uiBellowingRoar_Timer -= uiDiff; //Summon 3 Shades at 75%, 50% and 25% (if bShades is true we already left in line 117, no need to check here again) - if (!m_bShades && (me->GetHealth()*100 / me->GetMaxHealth()) <= (100-(25*m_uiShadesSummoned))) + if (!m_bShades && !HealthAbovePct(100 - 25 * m_uiShadesSummoned)) { if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) { diff --git a/src/server/scripts/World/boss_ysondre.cpp b/src/server/scripts/World/boss_ysondre.cpp index 97cbbecf0e6..0371d516776 100644 --- a/src/server/scripts/World/boss_ysondre.cpp +++ b/src/server/scripts/World/boss_ysondre.cpp @@ -128,7 +128,7 @@ public: m_uiLightningWave_Timer -= uiDiff; //Summon Druids - if ((me->GetHealth()*100 / me->GetMaxHealth()) <= (100-(25*m_uiSummonDruidModifier))) + if (!HealthAbovePct(100 - 25 * m_uiSummonDruidModifier)) { DoScriptText(SAY_SUMMONDRUIDS, me); diff --git a/src/server/scripts/World/mob_generic_creature.cpp b/src/server/scripts/World/mob_generic_creature.cpp index 0b1317f9b99..19f7c990eae 100644 --- a/src/server/scripts/World/mob_generic_creature.cpp +++ b/src/server/scripts/World/mob_generic_creature.cpp @@ -97,7 +97,7 @@ public: SpellEntry const *info = NULL; //Select a healing spell if less than 30% hp - if (me->GetHealth()*100 / me->GetMaxHealth() < 30) + if (HealthBelowPct(30)) info = SelectSpell(me, 0, 0, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING); //No healing spell available, select a hostile spell @@ -128,7 +128,7 @@ public: SpellEntry const *info = NULL; //Select a healing spell if less than 30% hp ONLY 33% of the time - if (me->GetHealth()*100 / me->GetMaxHealth() < 30 && rand() % 3 == 0) + if (HealthBelowPct(30) && rand() % 3 == 0) info = SelectSpell(me, 0, 0, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING); //No healing spell available, See if we can cast a ranged spell (Range must be greater than ATTACK_DISTANCE) diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index f5f56ab6783..f205f2ab099 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -723,15 +723,15 @@ public: { //lower max health case 12923: case 12938: //Injured Soldier - me->SetHealth(uint32(me->GetMaxHealth()*.75)); + me->SetHealth(me->CountPctFromMaxHealth(75)); break; case 12924: case 12936: //Badly injured Soldier - me->SetHealth(uint32(me->GetMaxHealth()*.50)); + me->SetHealth(me->CountPctFromMaxHealth(50)); break; case 12925: case 12937: //Critically injured Soldier - me->SetHealth(uint32(me->GetMaxHealth()*.25)); + me->SetHealth(me->CountPctFromMaxHealth(25)); break; } } @@ -782,7 +782,7 @@ public: //lower HP on every world tick makes it a useful counter, not officlone though if (me->isAlive() && me->GetHealth() > 6) { - me->SetHealth(uint32(me->GetHealth()-5)); + me->ModifyHealth(-5); } if (me->isAlive() && me->GetHealth() <= 6) @@ -924,7 +924,7 @@ public: me->SetStandState(UNIT_STAND_STATE_KNEEL); //expect database to have RegenHealth=0 - me->SetHealth(int(me->GetMaxHealth()*0.7f)); + me->SetHealth(me->CountPctFromMaxHealth(70)); } void EnterCombat(Unit * /*who*/) {} |
