1 /* ScummVM - Graphic Adventure Engine 2 * 3 * ScummVM is the legal property of its developers, whose names 4 * are too numerous to list here. Please refer to the COPYRIGHT 5 * file distributed with this source distribution. 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 2 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef BLADERUNNER_ACTOR_COMBAT_H 24 #define BLADERUNNER_ACTOR_COMBAT_H 25 26 #include "bladerunner/vector.h" 27 28 namespace BladeRunner { 29 30 class BladeRunnerEngine; 31 class SaveFileReadStream; 32 class SaveFileWriteStream; 33 34 class ActorCombat { 35 BladeRunnerEngine *_vm; 36 37 int _actorId; 38 bool _active; 39 int _state; 40 bool _rangedAttack; 41 int _enemyId; 42 int _waypointType; 43 int _damage; 44 int _fleeRatio; 45 int _coverRatio; 46 int _attackRatio; 47 int _fleeRatioConst; 48 int _coverRatioConst; 49 int _attackRatioConst; 50 int _actorHp; 51 int _range; 52 bool _unstoppable; 53 Vector3 _actorPosition; 54 Vector3 _enemyPosition; 55 int _coversWaypointCount; 56 int _fleeWaypointsCount; 57 int _fleeingTowards; 58 59 public: 60 ActorCombat(BladeRunnerEngine *vm); 61 ~ActorCombat(); 62 63 void setup(); 64 65 void combatOn(int actorId, int initialState, bool rangedAttack, int enemyId, int waypointType, int fleeRatio, int coverRatio, int attackRatio, int damage, int range, bool unstoppable); 66 void combatOff(); 67 68 void tick(); 69 70 void hitAttempt(); 71 72 void save(SaveFileWriteStream &f); 73 void load(SaveFileReadStream &f); 74 75 private: 76 void reset(); 77 78 void cover(); 79 void approachToCloseAttack(); 80 void approachToRangedAttack(); 81 void uncover(); 82 void aim(); 83 void rangedAttack(); 84 void closeAttack(); 85 void flee(); 86 87 void faceEnemy(); 88 89 int getCoefficientCloseAttack() const; 90 int getCoefficientRangedAttack() const; 91 92 int getDamageCloseAttack(int min, int max) const; 93 int getDamageRangedAttack(int min, int max) const; 94 95 int calculateAttackRatio() const; 96 int calculateCoverRatio() const; 97 int calculateFleeRatio() const; 98 99 bool findClosestPositionToEnemy(Vector3 &output) const; 100 }; 101 102 } // End of namespace BladeRunner 103 104 #endif 105