ScummVM API documentation
actor_combat.h
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 modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (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, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef BLADERUNNER_ACTOR_COMBAT_H
23 #define BLADERUNNER_ACTOR_COMBAT_H
24 
25 #include "bladerunner/vector.h"
26 
27 namespace BladeRunner {
28 
29 class BladeRunnerEngine;
30 class SaveFileReadStream;
31 class SaveFileWriteStream;
32 
33 class ActorCombat {
34  BladeRunnerEngine *_vm;
35 
36  int _actorId;
37  bool _active;
38  int _state;
39  bool _rangedAttack;
40  int _enemyId;
41  int _waypointType;
42  int _damage;
43  int _fleeRatio;
44  int _coverRatio;
45  int _attackRatio;
46  int _fleeRatioConst;
47  int _coverRatioConst;
48  int _attackRatioConst;
49  int _actorHp;
50  int _range;
51  bool _unstoppable;
52  Vector3 _actorPosition;
53  Vector3 _enemyPosition;
54  int _coversWaypointCount;
55  int _fleeWaypointsCount;
56  int _fleeingTowards;
57 
58 public:
60  ~ActorCombat();
61 
62  void setup();
63 
64  void combatOn(int actorId, int initialState, bool rangedAttack, int enemyId, int waypointType, int fleeRatio, int coverRatio, int attackRatio, int damage, int range, bool unstoppable);
65  void combatOff();
66 
67  void tick();
68 
69  void hitAttempt();
70 
71  void save(SaveFileWriteStream &f);
72  void load(SaveFileReadStream &f);
73 
74 private:
75  void reset();
76 
77  void cover();
78  void approachToCloseAttack();
79  void approachToRangedAttack();
80  void uncover();
81  void aim();
82  void rangedAttack();
83  void closeAttack();
84  void flee();
85 
86  void faceEnemy();
87 
88  int getCoefficientCloseAttack() const;
89  int getCoefficientRangedAttack() const;
90 
91  int getDamageCloseAttack(int min, int max) const;
92  int getDamageRangedAttack(int min, int max) const;
93 
94  int calculateAttackRatio() const;
95  int calculateCoverRatio() const;
96  int calculateFleeRatio() const;
97 
98  bool findClosestPositionToEnemy(Vector3 &output) const;
99 };
100 
101 } // End of namespace BladeRunner
102 
103 #endif
Definition: savefile.h:88
Definition: actor.h:31
Definition: savefile.h:113
Definition: vector.h:47
Definition: bladerunner.h:113
Definition: actor_combat.h:33