aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/Level1.cpp2
-rw-r--r--src/game/ThreatManager.cpp15
-rw-r--r--src/game/Totem.cpp16
-rw-r--r--src/game/Totem.h2
4 files changed, 34 insertions, 1 deletions
diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp
index aeac3989301..c5247fa1538 100644
--- a/src/game/Level1.cpp
+++ b/src/game/Level1.cpp
@@ -1241,7 +1241,7 @@ bool ChatHandler::HandleModifyScaleCommand(const char* args)
return false;
float Scale = (float)atof((char*)args);
- if (Scale > 3.0f || Scale <= 0.0f)
+ if (Scale > 10.0f || Scale <= 0.0f)
{
SendSysMessage(LANG_BAD_VALUE);
SetSentErrorMessage(true);
diff --git a/src/game/ThreatManager.cpp b/src/game/ThreatManager.cpp
index ab6e02801c9..16372b989e2 100644
--- a/src/game/ThreatManager.cpp
+++ b/src/game/ThreatManager.cpp
@@ -267,12 +267,27 @@ HostilReference* ThreatContainer::selectNextVictim(Creature* pAttacker, HostilRe
{
HostilReference* currentRef = NULL;
bool found = false;
+
+ std::list<HostilReference*>::iterator lastRef = iThreatList.end();
+ lastRef--;
+
for(std::list<HostilReference*>::iterator iter = iThreatList.begin(); iter != iThreatList.end() && !found; ++iter)
{
currentRef = (*iter);
Unit* target = currentRef->getTarget();
assert(target); // if the ref has status online the target must be there !
+
+ // some units are prefered in comparison to others
+ if(iter != lastRef && (target->IsImmunedToDamage(pAttacker->GetMeleeDamageSchoolMask(), false) ||
+ target->hasUnitState(UNIT_STAT_CONFUSED | UNIT_STAT_FLEEING)
+ ) )
+ {
+ // current victim is a second choice target, so don't compare threat with it below
+ if(currentRef == pCurrentVictim)
+ pCurrentVictim = NULL;
+ continue;
+ }
if(!pAttacker->IsOutOfThreatArea(target)) // skip non attackable currently targets
{
diff --git a/src/game/Totem.cpp b/src/game/Totem.cpp
index a891087d4ac..2c776918608 100644
--- a/src/game/Totem.cpp
+++ b/src/game/Totem.cpp
@@ -161,3 +161,19 @@ void Totem::SetTypeBySummonSpell(SpellEntry const * spellProto)
if(spellProto->SpellIconID==2056)
m_type = TOTEM_STATUE; //Jewelery statue
}
+
+bool Totem::IsImmunedToSpell(SpellEntry const* spellInfo, bool useCharges)
+{
+ for (int i=0;i<3;i++)
+ {
+ switch(spellInfo->EffectApplyAuraName[i])
+ {
+ case SPELL_AURA_PERIODIC_DAMAGE:
+ case SPELL_AURA_PERIODIC_LEECH:
+ return true;
+ default:
+ continue;
+ }
+ }
+ return Creature::IsImmunedToSpell(spellInfo, useCharges);
+} \ No newline at end of file
diff --git a/src/game/Totem.h b/src/game/Totem.h
index 442cef809b9..bccd269410c 100644
--- a/src/game/Totem.h
+++ b/src/game/Totem.h
@@ -54,6 +54,8 @@ class Totem : public Creature
void UpdateMaxPower(Powers /*power*/) {}
void UpdateAttackPowerAndDamage(bool /*ranged*/ ) {}
void UpdateDamagePhysical(WeaponAttackType /*attType*/) {}
+
+ bool IsImmunedToSpell(SpellEntry const* spellInfo, bool useCharges = false);
protected:
TotemType m_type;