SuperTuxKart
battle_ai.hpp
1 //
2 // SuperTuxKart - a fun racing game with go-kart
3 // Copyright (C) 2004-2005 Steve Baker <sjbaker1@airmail.net>
4 // Copyright (C) 2006-2007 Eduardo Hernandez Munoz
5 // Copyright (C) 2010-2015 Joerg Henrichs
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; either version 3
10 // of the License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 
21 #ifndef HEADER_BATTLE_AI_HPP
22 #define HEADER_BATTLE_AI_HPP
23 
24 #include "karts/controller/arena_ai.hpp"
25 
26 class ThreeStrikesBattle;
27 class WorldWithRank;
28 
32 class BattleAI : public ArenaAI
33 {
34 protected:
37  ThreeStrikesBattle* m_tsb_world;
38 
39  // ------------------------------------------------------------------------
40  virtual void findClosestKart(bool consider_difficulty,
41  bool find_sta) OVERRIDE;
42  // ------------------------------------------------------------------------
43  virtual int getCurrentNode() const OVERRIDE;
44 
45 private:
46  // ------------------------------------------------------------------------
47  virtual void findTarget() OVERRIDE;
48  // ------------------------------------------------------------------------
49  virtual float getKartDistance(const AbstractKart* kart) const OVERRIDE;
50  // ------------------------------------------------------------------------
51  virtual bool isKartOnRoad() const OVERRIDE;
52  // ------------------------------------------------------------------------
53  virtual bool isWaiting() const OVERRIDE;
54 
55 public:
56  BattleAI(AbstractKart *kart);
57  // ------------------------------------------------------------------------
58  ~BattleAI();
59 
60 };
61 
62 #endif
virtual float getKartDistance(const AbstractKart *kart) const OVERRIDE
Return the distance based on graph distance matrix to any kart.
Definition: battle_ai.cpp:190
An implementation of WorldWithRank, to provide the 3 strikes battle game mode.
Definition: three_strikes_battle.hpp:38
virtual int getCurrentNode() const OVERRIDE
Return the current ArenaNode the AI located on.
Definition: battle_ai.cpp:178
virtual void findClosestKart(bool consider_difficulty, bool find_sta) OVERRIDE
Find the closest kart around this AI, if consider_difficulty is true, AI will try to follow human pla...
Definition: battle_ai.cpp:75
WorldWithRank * m_world
Keep a pointer to world.
Definition: battle_ai.hpp:36
A WorldWithRank is a world where the karts are ranked.
Definition: world_with_rank.hpp:38
virtual bool isWaiting() const OVERRIDE
If true, AI will stop moving.
Definition: battle_ai.cpp:184
virtual bool isKartOnRoad() const OVERRIDE
If true, AI stays on the ArenaNode correctly, otherwise RescueAnimation will be done after sometime.
Definition: battle_ai.cpp:197
The actual battle AI.
Definition: battle_ai.hpp:32
virtual void findTarget() OVERRIDE
Find a suitable target to follow, it will find the closest kart first, it's used as fallback if no it...
Definition: battle_ai.cpp:139
An abstract interface for the actual karts.
Definition: abstract_kart.hpp:61
A base class for AI that use navmesh to work.
Definition: arena_ai.hpp:40