Commit Graph
71 Commits
Author SHA1 Message Date
Trazom62 eccf5bf547 Refactor Creature::SelectNearestTarget(float dist)
This function is used in many scripts to find the nearest enemy within the given distance.
However, it had an implicit limit to the ATTACK_DISTANCE. so in many case the "dist" was in fact just ignored.
In other case, the ATTACK_DISTANCE is required. So 2 functions are necessary to avoid ambiguities.

The refactoring is the split of the function in 2: SelectNearestTarget and SelectNearestTargetInAttackDistance.

--HG--
branch : trunk
2010-04-25 12:59:27 +02:00
Spp 74dd02d024 Remove LOTS of compile warnings
--HG--
branch : trunk
2010-04-19 09:26:37 +02:00
Rat 6bcb297de4 *code cleanup
*totally destroyed m_creature, use "me" for future coding

--HG--
branch : trunk
2010-04-14 23:07:41 +02:00
Spp 46f0674e23 Code Style (game + scripts only):
">=" --> " >= " (when needed)
"  >=" --> " >="
">=  " --> ">= "
"<=" --> " <= " (when needed)
"  <=" --> " <="
"<=  " --> "<= "
" ==" --> " =="
"==  " --> "== "

--HG--
branch : trunk
2010-04-07 23:56:35 +02:00
Spp 2454c290b8 Code Style (game + scripts only):
"==" --> " == " (when needed)

--HG--
branch : trunk
2010-04-07 23:25:02 +02:00
Spp 49d05ba9aa Code style (game + scripts only):
"( " --> "("
" )" --> ")"

--HG--
branch : trunk
2010-04-07 22:59:46 +02:00
silver1ce efb123f4f7 prevent stack overflow caused by MoveInLineOfSight calls
should close #995 issue

--HG--
branch : trunk
2010-03-06 18:18:32 +02:00
Xanadu a5d1bc77ab A great purge of obsolete macros.
--HG--
branch : trunk
2010-02-05 00:31:28 +01:00
n0n4m3 99f66a6bc9 Updated copyright for new year.
--HG--
branch : trunk
2010-01-16 20:19:18 +03:00
QAston 8e9d2cdf01 Update aura system:
* Change system logic - unify Auras, AreaAuras and PersistentAreaAuras:
  * Aura has now its owner - which is the WorldObject, which applies aura (creates AuraApplication object) dependant on aura radius, and effect type
  * Owner can be Dynobj (DynObjAura class) for PersistentAreaAuras, or Unit (UnitAura class) for Area and nonArea auras
  * Aura data is shared for all units which have AuraApplication of the Aura
   * Because of that AuraEffect handlers , and periodic tick functions can't modify AuraEffect object (they are const now)
  * Remove spell source and AreaAuraEffect classes
  * Add AuraEffect::UpdatePeriodic function, to allow periodic aura object modification (target independant)
  * Add AuraEffect::CalculateAmount and AuraEffect::CalculateSpellMod function, to allow non-default amount calculation
  * AreaAura updates are done in owner _UpdateSpells cycle
  * Since now you don't need to wait an aura update cycle to get area aura applied on it's correct target list
  * And you can access area aura target list
  * Add basic support for aura amount recalculation
  * Save recalculation state and base amount of auras to db
  * Add AuraEffect::CalculatePeriodic function to determine if aura is periodic, and to set correct tick number after aura is loaded from db
  * Add ChangeAmount function in addition to SetAmount function, to allow easy reapplication of AuraEffect handlers on all targets
  * Sort aura effect handlers in SpellAuras.cpp and .h by their use
  * Add check for already existing aura of that type to some AuraEffect handlers, to prevent incorrect effect removal
  * SPELL_AURA_CONVERT_RUNE and MOD_POWER_REGEN and MOD_REGEN hacky handlers are now implemented correctly
  * Send aura application client update only once per unit update - prevent unnecesary packet spam
 * Fix ByteBuffer::appendPackGUID function - it added additionall 0s at the end of the packet
 * Fix memory leak at player creation (not deleted auras)
 * Updated some naming conventions (too many to mention)
 * Added Unit::GetAuraOfRankedSpell() function
 * Remove procflags on aura remove, use Aura::HandleAuraSpecificMods instead
 * Added functions to maintain owned auras (GetOwnedAuras, GetOwnedAura, RemoveOwnedAura, etc)
 * Implement AURA_INTERRUPT_FLAG_LANDING
 * Implement EffectPlayerNotification (thanks to Spp)
 * Remove wrong aura 304 handler
 * Add better handler for death runes
 * Remove unnecesary variables from DynamicObject class, and cleanup related code, link dynobj duration with aura
 * Add GetAuraEffectTriggerTarget function in CreatureAi for special target selection for periodic trigger auras used in a script
 * Add many assert() procection from idiots using some functions in wrong way
 * I am to lazy to write here anything more
Thanks to Visagalis for testing this patch
PS: Do not make patches like this, please

--HG--
branch : trunk
2010-01-10 01:23:15 +01:00
maximius e6e621bfad *Add virtual bool IsEscorted() to escort_ai.h
*Some minor cleanup and optimization

--HG--
branch : trunk
2009-10-30 18:54:38 -07:00
maximius 3f338cc1c3 *Massive cleanup redux.
--HG--
branch : trunk
2009-10-17 16:20:24 -07:00
maximius e585187b24 *Backed out changeset 3be01fb200a5
--HG--
branch : trunk
2009-10-17 15:51:44 -07:00
maximius 26b5e033ff *Massive cleanup (\n\n -> \n, *\n -> \n, cleanup for(...) to for (...), and some other cleanups by hand)
*Fix a possible crash in Spell::DoAllEffectOnTarget

--HG--
branch : trunk
2009-10-17 15:35:07 -07:00
maximius b4c7a2514d *Blackfathom Deeps - Event: Aku'mai, by Tartalo
*Split Personality Achivement, by Destalker
*Halls of Lightning Fixes, by Destalker
    Volkhan fixes + Achievement
    Ionar Fix - without this he resets each time he is invisible, spamming sparks
    Arcing Burn - should be a debuff (and stackable, stackable part NYI :/)
*Naxxramas - Thaddius - the aura shall affect only the character without the proper aura, by Trazom
*Naxxramas - Kelthuzad - some timer adjustments (may need verification or tweaking) by Cass
*Merges by Stryker, thanks to all authors and testers.
[8458] Re-implement SPELL_AURA_MOD_TARGET_ARMOR_PCT in more porper way for weapon dependent cases. Author: VladimirMangos
[8459] Avoid mutiply apply weapon dependent armor penetration bonus for each weapon. Author: VladimirMangos
[8529] check rune cost only if spell has PowerType == POWER_RUNE. Patch provided by yavi. Author: Ambal
[8532] Fixed situation where some items like 42947 were not giving spell power bonus. By: Ambal
[8533] Not remove timed quest and correctly fail when time runs out. Add function to remove timed quest instead of direct access to set. Author: NoFantasy
[8536] Fixed spell 62776. By: Ambal
[8539] Check pet aura range at area aura update. By: Ambal
[8546] Implement battleground bonusweekends call to arms. Also fix typo in auctionmgr. Author: balrok
[8547] Implemented scriptcall: CorpseRemoved(uint32 & /*respawnDelay*/) it will be called when the corpse of the scripted creature get's removed, it's possible to adjust the next respawn inside the script. Author: balrok
[8561] Replace another auras code call by explicit code
[8566] avoid singleton-lock when accessing BattleGroundMGR::isBGWeekend() Proposed by vladimir. Comitter: balrok

--HG--
branch : trunk
2009-10-09 20:48:55 -07:00
maximius 5b8ee23e47 *Better fix to the waypoint mobs returning to spawn issue, thanks XTElite1
--HG--
branch : trunk
2009-09-17 01:26:54 -07:00
maximius 1be0e825ce *Backed out changeset f2d288ace33d
--HG--
branch : trunk
2009-09-17 01:07:22 -07:00
maximius f7601aa00e *Waypoint creature fix by DearScorpion - "example: the portal dragon in Duskwood will basically return to it's spawnpoint and start over without this patch, with it however it will more or less kill you on the spot and continue its waypoint path where it left off"
--HG--
branch : trunk
2009-09-14 12:40:40 -07:00
megamage 2a4c9bcaf9 *Make position as a class;
--HG--
branch : trunk
2009-08-29 14:58:45 -05:00
megamage ab5f515f21 *Update flame levi script. Allow player to shoot down pyrite container and refill the demolishers.
*Other script-related fixes.

--HG--
branch : trunk
2009-08-28 11:26:20 -05:00
megamage a795df9cca *Remove function passengerleft
--HG--
branch : trunk
2009-08-27 19:26:18 -05:00
megamage 5c82ba864d *Use ai function issummonedby to handle creature trigger spells.
--HG--
branch : trunk
2009-08-22 21:26:48 -05:00
megamage c88304af95 *Add some vehicle ai functions.
--HG--
branch : trunk
2009-08-15 20:36:54 -05:00
QAston 8898e9f420 *Fix the bug that escorted creatures return to their spawnpoint after engaging combat.
--HG--
branch : trunk
2009-07-14 20:15:47 +02:00
megamage 5aa9fdb556 *Still use the old updatevictim functions for most scripts because some old scripts may cause crash using new function.
--HG--
branch : trunk
2009-06-05 14:37:15 -05:00
megamage 239919abb2 *Check reactstate in UpdateVictim.
--HG--
branch : trunk
2009-05-21 17:19:10 -05:00
megamage 6473e94358 *Update Naxx scripts. Now only Kelthuzad is incompleted
--HG--
branch : trunk
2009-05-20 11:44:38 -05:00
megamage c583767ad6 *Update gluth script.
--HG--
branch : trunk
2009-05-16 16:52:57 -05:00
megamage 819326f286 *Update some instance script functions.
--HG--
branch : trunk
2009-05-16 14:49:30 -05:00
megamage 8994cbe081 *Update some script functions.
--HG--
branch : trunk
2009-05-13 10:54:11 -05:00
megamage 91558b8b29 *Try to fix build in Linux.
--HG--
branch : trunk
2009-05-11 13:15:16 -05:00
megamage f631b2a2d6 *Update creature AI functions.
--HG--
branch : trunk
2009-05-11 11:46:48 -05:00
megamage 55d52e22a8 *Fix build.
--HG--
branch : trunk
2009-05-10 16:31:43 -05:00
megamage dcf41256dd *Move some AI functions to core. No real change.
--HG--
branch : trunk
2009-05-10 16:07:49 -05:00
megamage 40a8e6d3ab *Rename some script functions (no real change).
--HG--
branch : trunk
2009-05-10 14:29:28 -05:00
megamage e69d2cbed9 [7776] Completed implementation of CMSG_SPELLCLICK Author: arrai
For vehicles, you have to add the correct SPELL_AURA_CONTROL_VEHICLE spells to
    npc_spellclick_spells, otherwise you won't be able to use them

--HG--
branch : trunk
2009-05-05 16:56:15 -05:00
megamage f4f61852c2 *Add ai function spellclick
--HG--
branch : trunk
2009-05-03 10:45:57 -05:00
megamage ce68fc9c64 *Update some naxx boss scripts.
--HG--
branch : trunk
2009-04-29 00:15:18 -05:00
megamage 2b753d0f23 [7723] New AI call EnterCombat called at enter creature to combat (and re-enter if leave by some reason). Author: VladimirMangos
--HG--
branch : trunk
2009-04-27 19:14:37 -05:00
megamage f5fff5b186 *Add a new class for event based scripts. Two examples are given.
--HG--
branch : trunk
2009-04-22 23:03:49 -05:00
Machiavelli b92eac3b27 Merge SD2 up to r967
--HG--
branch : trunk
2009-04-19 21:16:11 +02:00
megamage c5310844db [7672] Move ReceiveEmote from script API to AI API. Author: VladimirMangos
This is also fix triggering ReceiveEmote for EventAI broken at it move to core.

--HG--
branch : trunk
2009-04-15 17:29:33 -05:00
megamage 8e910aca6b *Merge.
--HG--
branch : trunk
2009-04-15 12:05:59 -05:00
megamage fc2a30a53d *Fix broken creature ai in 2697.
--HG--
branch : trunk
2009-04-15 11:45:59 -05:00
megamage ceae9b8e0f [7668] Cleanup In CreatureAI function descriptions and AttackStart/AttackedBy use. Author: VladimirMangos
* Use AI::AttackStart calls only in case explicit request creature attack from core or AI code "attack it if can".
      Like taunt, pet handler attack command.
    * Use AI::AttackedBy for reaction at hostile action "do something at hostile action"
      Like non-dot damage, swing, negative spell landing, or fade fear/etc.
      And provided by default call AttackStart if no current target.

    This fix some problems, like:
    * Civilian will react propertly at attack by another creature (not pet or player).
    * Will not cases (at least triggred by core) when attack target start run to attacker before any real hostile action apply.

*Note: AttackBy is still disabled until proved useful to TC.

--HG--
branch : trunk
2009-04-14 21:07:52 -05:00
megamage 3a65800218 [7667] Add to CreatureAI field pointing to creature itself. Use it instead diff. fields in subclases. Author: VladimirMangos
Also send pointer to AI constructors ans mark constructors as explicit.

    This changes allow move now some generic often used AI code to CreatureAI helper functions.

--HG--
branch : trunk
2009-04-14 19:54:49 -05:00
megamage 6b11f9a511 *Call new function InitializeAI() instead of Reset() to do one-time work.
--HG--
branch : trunk
2009-04-13 17:53:09 -05:00
megamage f59c4debf6 [7622] Added creatureAI with related database tables. Author: AlexDereka
*Note: three tables are renamed.

--HG--
branch : trunk
2009-04-07 19:38:09 -05:00
megamage 8408fb7cd3 *Merge.
--HG--
branch : trunk
2009-03-31 18:21:45 -06:00
megamage 7f209249a2 *Do not call reset in construct funciton of script.
*Add function doaction to safely pass parameters between scripts.

--HG--
branch : trunk
2009-03-31 18:12:49 -06:00