cosmetix
[k8-i-v-a-n.git] / src / game / god.h
blob8be7ff8c35b2a1c72e50c3ee7280d97ea6d0549b
1 /*
3 * Iter Vehemens ad Necem (IVAN)
4 * Copyright (C) Timo Kiviluoto
5 * Released under the GNU General
6 * Public License
8 * See LICENSING which should be included
9 * along with this file for more details
13 #ifndef __GOD_H__
14 #define __GOD_H__
16 #include "ivancommon.h"
18 #include "ivandef.h"
21 class outputfile;
22 class inputfile;
23 class god;
24 class liquid;
25 class team;
26 struct materialdatabase;
29 typedef god* (*godspawner)();
32 class godprototype {
33 public:
34 godprototype (godspawner, cchar *);
35 virtual ~godprototype () {}
37 god *Spawn () const { return Spawner(); }
38 god *SpawnAndLoad (inputfile &) const;
39 cchar *GetClassID() const { return ClassID; }
40 int GetIndex() const { return Index; }
42 private:
43 int Index;
44 godspawner Spawner;
45 cchar *ClassID;
49 class god {
50 protected:
51 virtual void PrayGoodEffect () = 0;
52 virtual void PrayBadEffect () = 0;
54 protected:
55 int Relation, LastPray;
56 sLong Timer;
57 truth Known;
59 public:
60 typedef godprototype prototype;
62 public:
63 god ();
64 virtual ~god () {}
66 public:
67 virtual void Pray ();
68 virtual cchar *GetName () const = 0;
69 virtual cchar *GetDescription () const = 0;
70 cchar *GetPersonalPronoun () const;
71 cchar *GetObjectPronoun () const;
72 virtual int GetAlignment () const = 0;
73 festring GetCompleteDescription () const;
74 void ApplyDivineTick ();
75 void AdjustRelation (god *, int, truth);
76 void AdjustRelation (int);
77 void AdjustTimer (sLong);
78 void Save (outputfile &) const;
79 void Load (inputfile &);
80 void SetRelation (int Value) { Relation = Value; }
81 void SetTimer (sLong Value) { Timer = Value; }
82 truth ReceiveOffer (item *);
83 virtual int GetBasicAlignment () const;
84 int GetRelation () const { return Relation; }
85 void PrintRelation () const;
86 void SetIsKnown (truth What) { Known = What; }
87 truth IsKnown () const { return Known; }
88 void PlayerKickedAltar () { AdjustRelation(-100); }
89 void PlayerKickedFriendsAltar () { AdjustRelation(-50); }
90 virtual truth PlayerVomitedOnAltar (liquid *);
91 character *CreateAngel (team *, int = 0);
92 virtual col16 GetColor () const = 0;
93 virtual col16 GetEliteColor () const = 0;
94 virtual const prototype *GetProtoType () const = 0;
95 int GetType () const { return GetProtoType()->GetIndex(); }
96 virtual truth ForceGiveBodyPart () const { return false; }
97 virtual truth HealRegeneratingBodyParts () const { return false; }
98 virtual truth LikesMaterial (const materialdatabase *, ccharacter *) const;
99 truth TryToAttachBodyPart (character *);
100 truth TryToHardenBodyPart (character *);
101 virtual truth MutatesBodyParts () const { return false; }
102 virtual int GetSex () const = 0;
103 void SignalRandomAltarGeneration (const std::vector<v2> &);
104 virtual truth LikesVomit () const { return false; }
108 #ifdef __FILE_OF_STATIC_GOD_PROTOTYPE_DEFINITIONS__
109 #define GOD_PROTO(name)\
110 template<> const godprototype\
111 name##sysbase::ProtoType((godspawner)(&name##sysbase::Spawn), #name);
112 #else
113 #define GOD_PROTO(name)
114 #endif
116 #define GOD(name, base)\
117 class name;\
118 typedef simplesysbase<name, base, godprototype> name##sysbase;\
119 GOD_PROTO(name)\
120 class name : public name##sysbase
123 #endif