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 | |
---|
28 | OutdoorPvPObjectiveAI::OutdoorPvPObjectiveAI(Creature &c) : i_creature(c) |
---|
29 | { |
---|
30 | sLog.outDebug("OutdoorPvP objective AI assigned to creature guid %u", c.GetGUIDLow()); |
---|
31 | } |
---|
32 | |
---|
33 | void 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 | sOutdoorPvPMgr.HandleCaptureCreaturePlayerMoveInLos(((Player*)u),&i_creature); |
---|
38 | } |
---|
39 | |
---|
40 | int OutdoorPvPObjectiveAI::Permissible(const Creature * c) |
---|
41 | { |
---|
42 | // only assigned through AI name, never by permissibility check |
---|
43 | return PERMIT_BASE_NO; |
---|
44 | } |
---|
45 | |
---|
46 | bool OutdoorPvPObjectiveAI::IsVisible(Unit *pl) const |
---|
47 | { |
---|
48 | return (pl->GetTypeId() == TYPEID_PLAYER) && (i_creature.GetDistance(pl) < MAX_OUTDOOR_PVP_DISTANCE); |
---|
49 | } |
---|
50 | |
---|
51 | void OutdoorPvPObjectiveAI::AttackStart(Unit *) |
---|
52 | { |
---|
53 | EnterEvadeMode(); |
---|
54 | } |
---|
55 | |
---|
56 | void OutdoorPvPObjectiveAI::EnterEvadeMode() |
---|
57 | { |
---|
58 | i_creature.DeleteThreatList(); |
---|
59 | i_creature.CombatStop(); |
---|
60 | } |
---|
61 | |
---|
62 | void OutdoorPvPObjectiveAI::UpdateAI(const uint32 diff) |
---|
63 | { |
---|
64 | } |
---|