Planeshift
combatmanager.h
Go to the documentation of this file.
1 /*
2  * combatmanager.h
3  *
4  * Copyright (C) 2001-2002 Atomic Blue (info@planeshift.it, http://www.atomicblue.org)
5  *
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation (version 2 of the License)
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
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 
20 #ifndef __COMBATMANAGER_H__
21 #define __COMBATMANAGER_H__
22 
23 //=============================================================================
24 // Local Includes
25 //=============================================================================
26 #include "msgmanager.h"
27 
28 
29 #define SECONDS_BEFORE_SPARING_DEFEATED 30
30 
31 class psCombatGameEvent;
32 struct Stance;
33 
35 {
44 };
45 
46 class LocationType;
47 class MathScriptEngine;
48 class MathScript;
49 
55 class CombatManager: public MessageManager<CombatManager>
56 {
57 public:
58 
59  CombatManager(CacheManager* cachemanager, EntityManager* entitymanager);
60  bool InitializePVP();
61 
62  virtual ~CombatManager();
63 
65  bool AttackSomeone(gemActor* attacker, gemActor* target, const Stance& stance);
66 
68  void StopAttack(gemActor* attacker);
69 
70  bool InPVPRegion(csVector3 &pos, iSector* sector);
71 
80  static const Stance &GetStance(CacheManager* cachemanager, csString name);
81 
90  static const Stance &GetRaisedActorStance(CacheManager* cachemanager, gemActor* attacker);
91 
100  static const Stance &GetLoweredActorStance(CacheManager* cachemanager, gemActor* attacker);
101 
103  {
104  return entityManager;
105  };
106 
107  csArray<INVENTORY_SLOT_NUMBER> targetLocations;
108  void SetCombat(gemActor* combatant, const Stance& stance);
109  void NotifyTarget(gemActor* attacker, gemObject* target);
110  void sendAttackList(MsgEntry* me, Client* client);
111  void sendAttackQueue(MsgEntry* me, Client* client);
112  void sendAttackQueue(psCharacter* character);
113 private:
114  csRandomGen* randomgen;
115  LocationType* pvp_region;
116  CacheManager* cacheManager;
117  EntityManager* entityManager;
118 
119 
120  void HandleDeathEvent(MsgEntry* me,Client* client);
121 
122 };
123 
125 {
126 public:
128  void Trigger();
129 
130 protected:
131  csWeakRef<Client> loser;
132 
133 };
134 
135 #endif
bool InitializePVP()
Manages CEL entities on the server.
Definition: entitymanager.h:77
csWeakRef< Client > loser
virtual ~CombatManager()
A MathScript is a mini-program to run.
Definition: mathscript.h:442
The structure of 1 queue entry (pointer to a message)
Definition: message.h:143
static const Stance & GetLoweredActorStance(CacheManager *cachemanager, gemActor *attacker)
Gets increased combat stance of particular attacker.
EntityManager * GetEntityManager()
This stores a vector of positions listing a set of points defining a common type of location...
Definition: location.h:275
csArray< INVENTORY_SLOT_NUMBER > targetLocations
Any semi-autonomous object, either a player or an NPC.
Definition: gem.h:1170
This class handles all calculations around combat, using statistics and information from the pspcchar...
Definition: combatmanager.h:55
bool AttackSomeone(gemActor *attacker, gemActor *target, const Stance &stance)
This is how you start an attack sequence.
void sendAttackList(MsgEntry *me, Client *client)
This class collects data of a netclient.
Definition: client.h:95
static const Stance & GetStance(CacheManager *cachemanager, csString name)
Gets combat stance by name.
void NotifyTarget(gemActor *attacker, gemObject *target)
static const Stance & GetRaisedActorStance(CacheManager *cachemanager, gemActor *attacker)
Gets increased combat stance of particular attacker.
This class manages the caching of data that is unchanging during server operation.
Definition: cachemanager.h:234
void StopAttack(gemActor *attacker)
This is how you break an attack sequence off, through death or user command.
A gemObject is any solid, graphical object visible in PS with normal physics and normal collision det...
Definition: gem.h:314
void sendAttackQueue(MsgEntry *me, Client *client)
This holds all the formulas loaded from the MathScript table and provides a container for them...
Definition: mathscript.h:51
All scheduled events must inherit from this class.
Definition: gameevent.h:36
COMBATMANAGER_ATTACKTYPE
Definition: combatmanager.h:34
bool InPVPRegion(csVector3 &pos, iSector *sector)
void SetCombat(gemActor *combatant, const Stance &stance)
Provides a manager to facilitate subscriptions.
Definition: msgmanager.h:106
CombatManager(CacheManager *cachemanager, EntityManager *entitymanager)