aboutsummaryrefslogtreecommitdiff
path: root/src/bindings/scripts/include
diff options
context:
space:
mode:
authorKudlaty <none@none>2009-08-08 21:29:12 +0200
committerKudlaty <none@none>2009-08-08 21:29:12 +0200
commit10d2625a5ce6ff98b841a97415e08c308d6d9754 (patch)
treeca6bd53eb50ba721b40733d2f1215b4b9b872a9c /src/bindings/scripts/include
parentfdade2435546a6804658cf1e2d61865f6df29e0c (diff)
Merge [SD2]
r1151 Remove old workaround and instead use spell to summon dragonhawk from eggs in ZA. Correct eggs hatched count. - skip r1152 Remove obsolete script function DoZoneInCombat() and replace in code with SetInCombatWithZone(). Requires Mangos 8057+ - skip r1153 Respawn eggs for boss in ZA in case evade. Remove old workaround and summon dragonhawks by spell from all remaining eggs at 35% hp. - skip r1154 Added main spells for first boss in ZA - skip r1155 Added ZA boss' spirit lynx script - skip r1156 Correct typos and errors in misc .txt files - skip r1157 Added abilities and phases for halazzi - skip r1158 Add two lost variables in previous commit, used for reset phase - skip r1159 Use expected movement flag for escortAI (source need more detailed cleanup) - skip r1160 More corrections of movementflags + minor cleanup code. - skip r1161 Correcting boss astromancer and adds' spells. Some minor code cleanup. r1162 Fix typo related to ReceiveEmote() and update code for once script, using spell instead of emote. r1163 Added spells for Unworthy Initiate. - skip r1164 Added ScriptedAI function EnterEvadeIfOutOfCombatArea() used for location check of creatures that are expected to evade when out of certain area. Location coordinates are hard coded for each creature entry. r1165 Replace/use EnterEvadeIfOutOfCombatArea for three bosses, with locations added in previous commit. r1166 Add one more boss to EnterEvadeIfOutOfCombatArea() list and also use boolean for function (to be used if special case evade events are expected). r1167 Remove some old (and wrong/not needed) movementflags, correct remaining to use MONSTER_* - skip r1168 Fixed spellId typo - skip r1169 Added basic support for quest 12733 (change our script to this) r1170 Remove meele attack for mini-boss and add some distance for MoveChase() --HG-- branch : trunk
Diffstat (limited to 'src/bindings/scripts/include')
-rw-r--r--src/bindings/scripts/include/sc_creature.cpp48
-rw-r--r--src/bindings/scripts/include/sc_creature.h5
2 files changed, 52 insertions, 1 deletions
diff --git a/src/bindings/scripts/include/sc_creature.cpp b/src/bindings/scripts/include/sc_creature.cpp
index 0ed59db42bf..5edc67f7120 100644
--- a/src/bindings/scripts/include/sc_creature.cpp
+++ b/src/bindings/scripts/include/sc_creature.cpp
@@ -79,7 +79,7 @@ void SummonList::DespawnAll()
}
}
-ScriptedAI::ScriptedAI(Creature* creature) : CreatureAI(creature), m_creature(creature), IsFleeing(false), CombatMovement(true)
+ScriptedAI::ScriptedAI(Creature* creature) : CreatureAI(creature), m_creature(creature), IsFleeing(false), CombatMovement(true), m_uiEvadeCheckCooldown(2500)
{
HeroicMode = m_creature->GetMap()->IsHeroic();
}
@@ -577,6 +577,52 @@ void ScriptedAI::SetCombatMovement(bool CombatMove)
CombatMovement = CombatMove;
}
+// Hacklike storage used for misc creatures that are expected to evade of outside of a certain area.
+// It is assumed the information is found elswehere and can be handled by mangos. So far no luck finding such information/way to extract it.
+bool ScriptedAI::EnterEvadeIfOutOfCombatArea(const uint32 uiDiff)
+{
+ if (m_uiEvadeCheckCooldown < uiDiff)
+ m_uiEvadeCheckCooldown = 2500;
+ else
+ {
+ m_uiEvadeCheckCooldown -= uiDiff;
+ return false;
+ }
+
+ if (m_creature->IsInEvadeMode() || !m_creature->getVictim())
+ return false;
+
+ float fX = m_creature->GetPositionX();
+ float fY = m_creature->GetPositionY();
+ float fZ = m_creature->GetPositionZ();
+
+ switch(m_creature->GetEntry())
+ {
+ case 12017: // broodlord (not move down stairs)
+ if (fZ > 448.60f)
+ return false;
+ break;
+ case 19516: // void reaver (calculate from center of room)
+ if (m_creature->GetDistance2d(432.59f, 371.93f) < 105.0f)
+ return false;
+ break;
+ case 23578: // jan'alai (calculate by Z)
+ if (fZ > 12.0f)
+ return false;
+ break;
+ case 28860: // sartharion (calculate box)
+ if (fX > 3218.86f && fX < 3275.69f && fY > 572.40f && fY < 484.68f)
+ return false;
+ break;
+ default:
+ error_log("TSCR: EnterEvadeIfOutOfCombatArea used for creature entry %u, but does not have any definition.", m_creature->GetEntry());
+ return false;
+ }
+
+ EnterEvadeMode();
+ return true;
+}
+
/*void Scripted_NoMovementAI::MoveInLineOfSight(Unit *who)
{
if( !m_creature->getVictim() && m_creature->canAttack(who) && ( m_creature->IsHostileTo( who )) && who->isInAccessiblePlaceFor(m_creature) )
diff --git a/src/bindings/scripts/include/sc_creature.h b/src/bindings/scripts/include/sc_creature.h
index e4142780443..b4328f2fd66 100644
--- a/src/bindings/scripts/include/sc_creature.h
+++ b/src/bindings/scripts/include/sc_creature.h
@@ -191,9 +191,14 @@ struct TRINITY_DLL_DECL ScriptedAI : public CreatureAI
void SetEquipmentSlots(bool bLoadDefault, int32 uiMainHand = EQUIP_NO_CHANGE, int32 uiOffHand = EQUIP_NO_CHANGE, int32 uiRanged = EQUIP_NO_CHANGE);
void SetCombatMovement(bool CombatMove);
+
+ bool EnterEvadeIfOutOfCombatArea(const uint32 uiDiff);
protected:
bool CombatMovement;
+
+ private:
+ uint32 m_uiEvadeCheckCooldown;
};
struct TRINITY_DLL_DECL Scripted_NoMovementAI : public ScriptedAI