ScummVM API documentation
weapons.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  * Based on the original sources
22  * Faery Tale II -- The Halls of the Dead
23  * (c) 1993-1996 The Wyrmkeep Entertainment Co.
24  */
25 
26 #ifndef SAGA2_WEAPONS_H
27 #define SAGA2_WEAPONS_H
28 
29 namespace Saga2 {
30 
31 struct ResourceItemEffect;
32 
33 class Actor;
34 class GameObject;
35 class ProtoEffect;
36 
37 ProtoEffect *createNewProtoEffect(Common::SeekableReadStream *stream);
38 
39 //-----------------------------------------------------------------------
40 
41 class WeaponEffect {
42 public:
43  WeaponEffect *_next; // pointer to additional effects
44 
45  WeaponEffect() : _next(NULL) {}
46  virtual ~WeaponEffect() {}
47  virtual void implement(Actor *enactor, GameObject *target, GameObject *strikingObj, uint8 strength) = 0;
48 };
49 
50 //-----------------------------------------------------------------------
51 
53  ProtoEffect *_effect;
54 
55 public:
56  WeaponProtoEffect(Common::SeekableReadStream *stream) : _effect(createNewProtoEffect(stream)) {
57  }
59 
60  void implement(Actor *enactor, GameObject*target, GameObject *strikingObj, uint8 strength);
61 };
62 
63 //-----------------------------------------------------------------------
64 
66  effectDamageTypes _type;// damage type
67  int8 _dice; // # of dice to roll
68  int8 _sides; // # of sides on dice
69  int8 _skillDice; // multiply additional dice
70  int8 _base; // absolute damage amount
71  int8 _skillBase;
72 
73 public:
74  WeaponStrikeEffect(effectDamageTypes t, int8 d, int8 s, int8 sd, int8 b, int8 sb) :
75  _type(t), _dice(d), _sides(s), _skillDice(sd), _base(b), _skillBase(sb) {
76  }
77 
78  void implement(Actor *enactor, GameObject *target, GameObject *strikingObj, uint8 trength);
79 };
80 
81 //-----------------------------------------------------------------------
82 
83 class WeaponStuff {
84  weaponID _master; // index in array
85  WeaponEffect *_effects; // the effects of this weapon
86 
87 public:
88  WeaponStuff();
89  ~WeaponStuff();
90  void setID(weaponID id) {
91  _master = id;
92  }
93  void addEffect(WeaponEffect *we);
94  void addEffect(Common::SeekableReadStream *stream);
95  void killEffects();
96  void implement(Actor *enactor, GameObject *target, GameObject *strikingObj, uint8 strength);
97 };
98 
99 //-----------------------------------------------------------------------
100 
101 
102 void initWeapons();
103 void cleanupWeapons();
104 
105 WeaponStuff &getWeapon(weaponID i);
106 
107 GameObject *getShieldItem(GameObject *defender);
108 
109 } // End of namespace Saga2
110 
111 #endif
Definition: actor.h:32
Definition: weapons.h:65
Definition: stream.h:745
Definition: actor.h:589
Definition: weapons.h:41
Definition: weapons.h:52
Definition: objects.h:118
Definition: effects.h:348
Definition: weapons.h:83