root/trunk/src/game/OutdoorPvPObjectiveAI.cpp @ 198

Revision 186, 2.2 kB (checked in by yumileroy, 17 years ago)

[svn] Remove isVisible function. Check stealth and invisible in canAttack();
Use new remove aura by interrupt flag function.

Original author: megamage
Date: 2008-11-07 09:36:46-06:00

Line 
1/*
2 * Copyright (C) 2008 Trinity <http://www.trinitycore.org/>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#include "OutdoorPvPObjectiveAI.h"
20#include "Creature.h"
21#include "Player.h"
22#include "Unit.h"
23#include "OutdoorPvPMgr.h"
24#include "World.h"
25
26#define MAX_OUTDOOR_PVP_DISTANCE 200 // the max value in capture point type go data0 is 100 currently, so use twice that much to handle leaving as well
27
28OutdoorPvPObjectiveAI::OutdoorPvPObjectiveAI(Creature &c) : i_creature(c)
29{
30    sLog.outDebug("OutdoorPvP objective AI assigned to creature guid %u", c.GetGUIDLow());
31}
32
33void OutdoorPvPObjectiveAI::MoveInLineOfSight(Unit *u)
34{
35    // IsVisible only passes for players in range, so no need to check again
36    // leaving/entering distance will be checked based on go range data
37    if((u->GetTypeId() == TYPEID_PLAYER) && i_creature.IsWithinDistInMap(u, MAX_OUTDOOR_PVP_DISTANCE))
38        sOutdoorPvPMgr.HandleCaptureCreaturePlayerMoveInLos(((Player*)u),&i_creature);
39}
40
41int OutdoorPvPObjectiveAI::Permissible(const Creature * c)
42{
43    // only assigned through AI name, never by permissibility check
44    return PERMIT_BASE_NO;
45}
46
47bool OutdoorPvPObjectiveAI::IsVisible(Unit *pl) const
48{
49    return (pl->GetTypeId() == TYPEID_PLAYER) && (i_creature.GetDistance(pl) < MAX_OUTDOOR_PVP_DISTANCE);
50}
51
52void OutdoorPvPObjectiveAI::AttackStart(Unit *)
53{
54    //EnterEvadeMode();
55}
56
57void OutdoorPvPObjectiveAI::EnterEvadeMode()
58{
59//    i_creature.DeleteThreatList();
60//    i_creature.CombatStop();
61}
62
63void OutdoorPvPObjectiveAI::UpdateAI(const uint32 diff)
64{
65}
Note: See TracBrowser for help on using the browser.