aboutsummaryrefslogtreecommitdiff
path: root/src/server/game
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game')
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp38
-rw-r--r--src/server/game/Entities/Unit/Unit.h24
-rw-r--r--src/server/game/Spells/Spell.cpp81
3 files changed, 57 insertions, 86 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index e7e29fe2588..cc0b338de3f 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -5668,17 +5668,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
break;
}
}
-
- // Retaliation
- if (dummySpell->SpellFamilyFlags[1] & 0x8)
- {
- // check attack comes not from behind
- if (!HasInArc(M_PI, victim) || HasUnitState(UNIT_STATE_STUNNED))
- return false;
-
- triggered_spell_id = 22858;
- break;
- }
// Second Wind
if (dummySpell->SpellIconID == 1697)
{
@@ -5708,19 +5697,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
triggered_spell_id = 58374;
break;
}
- // Glyph of Sunder Armor
- if (dummySpell->Id == 58387)
- {
- if (!victim || !victim->IsAlive() || !procSpell)
- return false;
-
- target = SelectNearbyTarget(victim);
- if (!target)
- return false;
-
- triggered_spell_id = 58567;
- break;
- }
break;
}
case SPELLFAMILY_WARLOCK:
@@ -9365,9 +9341,7 @@ void Unit::SetMinion(Minion *minion, bool apply)
}
if (minion->m_Properties && minion->m_Properties->Type == SUMMON_TYPE_MINIPET)
- {
SetCritterGUID(minion->GetGUID());
- }
// PvP, FFAPvP
minion->SetByteValue(UNIT_FIELD_BYTES_2, 1, GetByteValue(UNIT_FIELD_BYTES_2, 1));
@@ -13274,12 +13248,14 @@ void Unit::SetLevel(uint8 lvl)
{
SetUInt32Value(UNIT_FIELD_LEVEL, lvl);
- // group update
- if (GetTypeId() == TYPEID_PLAYER && ToPlayer()->GetGroup())
- ToPlayer()->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_LEVEL);
+ if (Player* player = ToPlayer())
+ {
+ // group update
+ if (player->GetGroup())
+ player->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_LEVEL);
- if (GetTypeId() == TYPEID_PLAYER)
- sWorld->UpdateCharacterNameDataLevel(ToPlayer()->GetGUIDLow(), lvl);
+ sWorld->UpdateCharacterNameDataLevel(GetGUIDLow(), lvl);
+ }
}
void Unit::SetHealth(uint32 val)
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index bae10abe85b..41b181e54f8 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -2261,12 +2261,23 @@ namespace Trinity
{
public:
PowerPctOrderPred(Powers power, bool ascending = true) : _power(power), _ascending(ascending) { }
- bool operator() (Unit const* a, Unit const* b) const
+
+ bool operator()(WorldObject const* objA, WorldObject const* objB) const
+ {
+ Unit const* a = objA->ToUnit();
+ Unit const* b = objB->ToUnit();
+ float rA = (a && a->GetMaxPower(_power)) ? float(a->GetPower(_power)) / float(a->GetMaxPower(_power)) : 0.0f;
+ float rB = (b && b->GetMaxPower(_power)) ? float(b->GetPower(_power)) / float(b->GetMaxPower(_power)) : 0.0f;
+ return _ascending ? rA < rB : rA > rB;
+ }
+
+ bool operator()(Unit const* a, Unit const* b) const
{
float rA = a->GetMaxPower(_power) ? float(a->GetPower(_power)) / float(a->GetMaxPower(_power)) : 0.0f;
float rB = b->GetMaxPower(_power) ? float(b->GetPower(_power)) / float(b->GetMaxPower(_power)) : 0.0f;
return _ascending ? rA < rB : rA > rB;
}
+
private:
Powers const _power;
bool const _ascending;
@@ -2277,12 +2288,23 @@ namespace Trinity
{
public:
HealthPctOrderPred(bool ascending = true) : _ascending(ascending) { }
+
+ bool operator()(WorldObject const* objA, WorldObject const* objB) const
+ {
+ Unit const* a = objA->ToUnit();
+ Unit const* b = objB->ToUnit();
+ float rA = (a && a->GetMaxHealth()) ? float(a->GetHealth()) / float(a->GetMaxHealth()) : 0.0f;
+ float rB = (b && b->GetMaxHealth()) ? float(b->GetHealth()) / float(b->GetMaxHealth()) : 0.0f;
+ return _ascending ? rA < rB : rA > rB;
+ }
+
bool operator() (Unit const* a, Unit const* b) const
{
float rA = a->GetMaxHealth() ? float(a->GetHealth()) / float(a->GetMaxHealth()) : 0.0f;
float rB = b->GetMaxHealth() ? float(b->GetHealth()) / float(b->GetMaxHealth()) : 0.0f;
return _ascending ? rA < rB : rA > rB;
}
+
private:
bool const _ascending;
};
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 08e0323b491..3c2e06bb631 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -1276,17 +1276,6 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge
maxSize = m_spellInfo->MaxAffectedTargets;
power = POWER_HEALTH;
break;
- case 57669: // Replenishment
- // In arenas Replenishment may only affect the caster
- if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->InArena())
- {
- unitTargets.clear();
- unitTargets.push_back(m_caster);
- break;
- }
- maxSize = 10;
- power = POWER_MANA;
- break;
default:
break;
}
@@ -1319,22 +1308,6 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge
++itr;
}
break;
- case SPELLFAMILY_DRUID:
- if (m_spellInfo->SpellFamilyFlags[1] == 0x04000000) // Wild Growth
- {
- maxSize = m_caster->HasAura(62970) ? 6 : 5; // Glyph of Wild Growth
- power = POWER_HEALTH;
- }
- else
- break;
-
- // Remove targets outside caster's raid
- for (std::list<Unit*>::iterator itr = unitTargets.begin(); itr != unitTargets.end();)
- if (!(*itr)->IsInRaidWith(m_caster))
- itr = unitTargets.erase(itr);
- else
- ++itr;
- break;
default:
break;
}
@@ -1427,33 +1400,33 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplici
break;
case TARGET_DEST_CASTER_FISHING:
{
- float min_dis = m_spellInfo->GetMinRange(true);
- float max_dis = m_spellInfo->GetMaxRange(true);
- float dis = (float)rand_norm() * (max_dis - min_dis) + min_dis;
- float x, y, z, angle;
- angle = (float)rand_norm() * static_cast<float>(M_PI * 35.0f / 180.0f) - static_cast<float>(M_PI * 17.5f / 180.0f);
- m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE, dis, angle);
-
- float ground = z;
- float liquidLevel = m_caster->GetMap()->GetWaterOrGroundLevel(x, y, z, &ground);
- if (liquidLevel <= ground) // When there is no liquid Map::GetWaterOrGroundLevel returns ground level
- {
- SendCastResult(SPELL_FAILED_NOT_HERE);
- SendChannelUpdate(0);
- finish(false);
- return;
- }
-
- if (ground + 0.75 > liquidLevel)
- {
- SendCastResult(SPELL_FAILED_TOO_SHALLOW);
- SendChannelUpdate(0);
- finish(false);
- return;
- }
-
- dest = SpellDestination(x, y, liquidLevel, m_caster->GetOrientation());
- break;
+ float minDist = m_spellInfo->GetMinRange(true);
+ float maxDist = m_spellInfo->GetMaxRange(true);
+ float dist = frand(minDist, maxDist);
+ float x, y, z, angle;
+ float angle = float(rand_norm()) * static_cast<float>(M_PI * 35.0f / 180.0f) - static_cast<float>(M_PI * 17.5f / 180.0f);
+ m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE, dis, angle);
+
+ float ground = z;
+ float liquidLevel = m_caster->GetMap()->GetWaterOrGroundLevel(x, y, z, &ground);
+ if (liquidLevel <= ground) // When there is no liquid Map::GetWaterOrGroundLevel returns ground level
+ {
+ SendCastResult(SPELL_FAILED_NOT_HERE);
+ SendChannelUpdate(0);
+ finish(false);
+ return;
+ }
+
+ if (ground + 0.75 > liquidLevel)
+ {
+ SendCastResult(SPELL_FAILED_TOO_SHALLOW);
+ SendChannelUpdate(0);
+ finish(false);
+ return;
+ }
+
+ dest = SpellDestination(x, y, liquidLevel, m_caster->GetOrientation());
+ break;
}
default:
{