00001 /****************************************************************************** 00002 * Wormux is a convivial mass murder game. 00003 * Copyright (C) 2001-2004 Lawrence Azzoug. 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 00018 ****************************************************************************** 00019 * Artificial intelligence Shoot module 00020 *****************************************************************************/ 00021 00022 #ifndef AI_SHOOT_MODULE_H 00023 #define AI_SHOOT_MODULE_H 00024 00025 #include "../character/character.h" 00026 00027 class AIShootModule 00028 { 00029 private: 00030 typedef enum { 00031 NO_STRATEGY, 00032 NEAR_FROM_ENEMY, 00033 SHOOT_FROM_POINT 00034 } strategy_t; 00035 00036 uint m_current_time; 00037 00038 Character* m_enemy; 00039 strategy_t m_current_strategy; 00040 bool m_has_finished; 00041 00042 double m_angle; 00043 uint m_last_shoot_time; 00044 00045 // for shooting weapons like gun, shotgun, sniper rifle, m16, ... 00046 bool IsDirectlyShootable(Character& character); 00047 bool FindShootableEnemy(); 00048 00049 // for proximity weapons like dynamite, mine, ... 00050 bool IsNear(Character& character); 00051 bool FindProximityEnemy(); 00052 00053 // Watch the choosen enemy 00054 void ChooseDirection(); 00055 Character* FindEnemy(); 00056 00057 void Shoot(); 00058 public: 00059 AIShootModule(); 00060 void BeginTurn(); 00061 00062 bool Refresh(uint current_time); 00063 }; 00064 00065 #endif