File: ability.h

package info (click to toggle)
aime 0.60.3-7
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 6,016 kB
  • ctags: 5,217
  • sloc: cpp: 77,611; ansic: 3,765; sh: 2,996; makefile: 234; sed: 93
file content (131 lines) | stat: -rw-r--r-- 4,429 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#ifndef _ABILITY_H
#define _ABILITY_H

#include "mudtypes.h"
#include "entity.h"

class Builder;

enum abil_str_type { Room, Actor, Target };
enum depend_type { ReqIntel, ReqStrength, ReqDexterity, ReqConstitution, 
		   ReqHealth, ReqMaxHealth, ReqEndurance, ReqMagic, 
		   ReqWisdom, ReqCharisma, MustHaveItem };

struct dependency {
	depend_type the_type;
	int			num_value;
	Strings     str_value;
	dependency  *next_depend;
};

class Ability : public Entity {
 public:

   Ability();
   virtual ~Ability();

   char *get_acting_str(abil_str_type the_type);
   int set_acting_str(abil_str_type the_type, char *the_string);

   char *get_success_str(abil_str_type the_type);
   int set_success_str(abil_str_type the_type, char *the_string);

   char *get_failure_str(abil_str_type the_type);
   int set_failure_str(abil_str_type the_type, char *the_string);

   char *get_items_needed();
   void set_items_needed(char *the_string);

   char *get_succ_trig();
   void set_succ_trig(char *the_string);

   char *get_fail_trig();
   void set_fail_trig(char *the_string);

   char *get_attempt_trig();
   void set_attempt_trig(char *the_string);

   void set_drain(int new_drain);
   int get_drain();

   char *get_special_name();
   void set_special_name(char *the_string);

   int set_attrib_succtrig(Parse *the_parsed, Builder *the_builder);
   int set_attrib_failtrig(Parse *the_parsed, Builder *the_builder);
   int set_attrib_attempttrig(Parse *the_parsed, Builder *the_builder);

   int read_ability_attrib(FILE *read_file, ErrLog *error_log, 
                                                          int build_format);

   int set_attrib_acting(abil_str_type message_to, Builder *the_builder);
   int set_attrib_success(abil_str_type message_to, Builder *the_builder);
   int set_attrib_failure(abil_str_type message_to, Builder *the_builder);
   int set_attrib_itemsneeded(Parse *the_parsed, Builder *the_builder);
   int set_attrib_drain(Parse *the_parsed, Builder *the_builder);
   int set_attrib_specials(Parse *the_parsed, Builder *the_builder);
   
   int set_attrib_abil(Builder *the_builder, Parse *the_parsed);

   int write_ability_attrib(FILE *the_file);

   int add_dep_item(dependency *new_item);
   int add_dependency(depend_type the_type, char *the_val);
   int add_dependency(depend_type the_type, int the_val);
   int add_dependency(char *the_type, char *the_val);
   int add_dependency(char *the_type, int the_val);
   char *get_dep_str_value(depend_type the_type);
   int get_dep_int_value(depend_type the_type);
   int set_dep_str_value(depend_type the_type, char *the_str);
   int set_dep_int_value(depend_type the_type, int the_val);
   int set_dep_str_value(char *the_type, char *the_str);
   int set_dep_int_value(char *the_type, int the_val);
   int del_dependency(depend_type the_type);
   int del_dependency(char *the_type);
   int has_dependency(depend_type the_type);
   int copy_dependencies(dependency *the_list);
   dependency *get_dependency_list();
   int copy_ability_attrib(Ability *copy_from);
   int test_success(Individual *the_user, int difficulty);
   int get_mem_size_ability();

   int use_ability(Individual *user, MudObject *target, char *targ_name);
   virtual int check_usage(Individual *user, MudObject *target);

 protected:
   dependency *depend_list;

 private:

 
   // Strings to display when the ability is attempted
   Strings acting_room;    // To the room the actor is in
   Strings acting_actor;   // To the actor
   Strings acting_target;  // To the target
 
   // Strings to display if the ability was a success
   Strings success_room;
   Strings success_actor;
   Strings success_target;

   // Strings to display if the ability failed
   Strings failure_room;
   Strings failure_actor;
   Strings failure_target;

   Strings special_name;    // Special to execute on success

   Strings attempt_trigger; // Search for specials with these triggers on
                            // when the player attempts the ability
   Strings success_trigger; // Search for specials with these triggers on
                            // success in the target
   Strings failed_trigger;  // Search for specials with these triggers on
                            // failure in the target

   int     drain;          // How much this drains the user
                           // Drains endurance for skills
                           // Drains energy for spells

};

#endif