TankAICurrentMove.h

Go to the documentation of this file.
00001 ////////////////////////////////////////////////////////////////////////////////
00002 //    Scorched3D (c) 2000-2009
00003 //
00004 //    This file is part of Scorched3D.
00005 //
00006 //    Scorched3D is free software; you can redistribute it and/or modify
00007 //    it under the terms of the GNU General Public License as published by
00008 //    the Free Software Foundation; either version 2 of the License, or
00009 //    (at your option) any later version.
00010 //
00011 //    Scorched3D is distributed in the hope that it will be useful,
00012 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //    GNU General Public License for more details.
00015 //
00016 //    You should have received a copy of the GNU General Public License
00017 //    along with Scorched3D; if not, write to the Free Software
00018 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 ////////////////////////////////////////////////////////////////////////////////
00020 
00021 #if !defined(AFX_TankAICurrentMove_H__5F21C9C7_0F71_4CCC_ABB9_976CF0A5C5EC__INCLUDED_)
00022 #define AFX_TankAICurrentMove_H__5F21C9C7_0F71_4CCC_ABB9_976CF0A5C5EC__INCLUDED_
00023 
00024 #include <tankai/TankAICurrentTarget.h>
00025 #include <tankai/TankAICurrentMoveWeapons.h>
00026 #include <common/Vector.h>
00027 
00028 class TankAICurrentMove
00029 {
00030 public:
00031         TankAICurrentMove();
00032         virtual ~TankAICurrentMove();
00033 
00034         virtual bool parseConfig(XMLNode *node);
00035 
00036         void clear();
00037         void playMove(Tank *tank, 
00038                 TankAIWeaponSets::WeaponSet *weapons,
00039                 bool useBatteries);
00040 
00041         TankAICurrentTarget &getTargets() { return targets_; }
00042 
00043 protected:
00044         struct ShotRecord
00045         {
00046                 Vector position;
00047                 float projectileCurrentDistance;
00048                 float sniperCurrentDistance;
00049         };
00050 
00051         std::map<Tank *, ShotRecord> shotRecords_;
00052         TankAICurrentTarget targets_;
00053         float totalDamageBeforeMove_;
00054         bool useResign_, useFuel_;
00055         float movementDamage_, movementDamageChance_, movementLife_;
00056         float movementRandom_, movementCloseness_;
00057         float groupShotChance_, groupTargetDistance_;
00058         int groupShotSize_;
00059         float resignLife_;
00060         float largeWeaponUseDistance_;
00061         float sniperUseDistance_;
00062         float sniperStartDistance_, sniperEndDistance_;
00063         float sniperMinDecrement_, sniperMaxDecrement_;
00064         float sniperMovementFactor_;
00065         float projectileStartDistance_, projectileEndDistance_;
00066         float projectileMinDecrement_, projectileMaxDecrement_;
00067         float projectileMovementFactor_;
00068         float projectileMinDistance_;
00069 
00070         bool shootAtTank(Tank *tank, Tank *targetTank, 
00071                 TankAICurrentMoveWeapons &weapons);
00072         bool makeProjectileShot(Tank *tank, Tank *targetTank,
00073                 TankAICurrentMoveWeapons &weapons);
00074         bool makeSniperShot(Tank *tank, Tank *targetTank,
00075                 TankAICurrentMoveWeapons &weapons);
00076         bool makeLaserSniperShot(Tank *tank, Tank *targetTank, 
00077                 TankAICurrentMoveWeapons &weapons);
00078         bool makeBurriedShot(Tank *tank, Tank *targetTank, 
00079                 TankAICurrentMoveWeapons &weapons);
00080         bool makeMoveShot(Tank *tank, 
00081                 TankAIWeaponSets::WeaponSet *weapons,
00082                 std::list<Tank *> &sortedTanks);
00083         bool makeGroupShot(Tank *tank, 
00084                 TankAIWeaponSets::WeaponSet *weapons,
00085                 std::list<Tank *> &sortedTanks);
00086 
00087         bool inHole(Vector &position);
00088         Vector lowestHighest(TankAICurrentMoveWeapons &weapons,
00089                 Vector &position, bool highest);
00090 
00091         float getShotDistance(Tank *tank, bool projectile);
00092         void shotAtTank(Tank *tank, bool projectile, float newDistance);
00093         bool useAvailableBatteries(Tank *tank);
00094         void setWeapon(Tank *tank, Accessory *accessory);
00095         void useBattery(Tank *tank, unsigned int batteryId);
00096         void resign(Tank *tank);
00097         void skipMove(Tank *tank);
00098         void fireShot(Tank *tank);
00099 
00100 };
00101 
00102 #endif // !defined(AFX_TankAICurrentMove_H__5F21C9C7_0F71_4CCC_ABB9_976CF0A5C5EC__INCLUDED_)

Generated on Mon Feb 16 15:14:53 2009 for Scorched3D by  doxygen 1.5.3