Module: GamesAndRpgParadise::Mud::Living
Overview
GamesAndRpgParadise::Mud::Living
Constant Summary
collapse
- DEFAULT_HP_FOR_HUMANS =
#
DEFAULT_HP_FOR_HUMANS
#
100
Constants included
from Adverbs
Adverbs::ADVERBS_ABBREVIATED, Adverbs::ARRAY_ADVERBS
Instance Method Summary
collapse
Methods included from Talk
included, #say, #set_how
Methods included from Adverbs
all?, file?, find_adverb_for, keys, n_adverbs?, original_adverbs
Methods included from Hitpoints
#deduct_hp, #hp?, #max_hp?, #modify_health, #sync_hp
Methods included from Gender
#female?, #gender?, #has_gender?, #male?, #neuter?, #set_female, #set_male, #set_neuter, #subjective_case?
Instance Method Details
#can_breathe? ⇒ Boolean
#
can_breathe?
All living objects can breathe. Some conditions however may alter this boolean value, such as suffocation. Maybe this should reside in a module instead.
#
163
164
165
|
# File 'lib/games_and_rpg_paradise/mud/living/living.rb', line 163
def can_breathe?
true
end
|
#can_talk? ⇒ Boolean
Also known as:
can_speak?
#
can_talk?
This will be overruled if the Talk module is included.
#
222
223
224
|
# File 'lib/games_and_rpg_paradise/mud/living/living.rb', line 222
def can_talk?
@can_talk
end
|
#do_die ⇒ Object
#
do_die
This lets a living being die.
If the instance variable @hp is used, then we check on whether it is set to 0 or less. If it is, then the object is consider to be dead.
#
136
137
138
139
140
|
# File 'lib/games_and_rpg_paradise/mud/living/living.rb', line 136
def do_die
@hp = 0 if instance_variable_defined? '@hp'
@is_alive = false
Ghost.new(self)
end
|
#do_resurrect ⇒ Object
Also known as:
resurrect
120
121
122
123
124
125
126
|
# File 'lib/games_and_rpg_paradise/mud/living/living.rb', line 120
def do_resurrect
if instance_variable_defined? '@hp'
@hp = return_default_hp
sync_hp
end
@is_alive = true
end
|
#initialize(run_already = true) ⇒ Object
45
46
47
48
49
50
|
# File 'lib/games_and_rpg_paradise/mud/living/living.rb', line 45
def initialize(
run_already = true
)
reset
run if run_already
end
|
#is_alive? ⇒ Boolean
Also known as:
is_living?, living?, alive
#
is_alive?
This method determines whether the object in question is still “alive” or whether it is not.
#
184
185
186
|
# File 'lib/games_and_rpg_paradise/mud/living/living.rb', line 184
def is_alive?
@is_alive
end
|
#is_dead? ⇒ Boolean
145
146
147
|
# File 'lib/games_and_rpg_paradise/mud/living/living.rb', line 145
def is_dead?
return !@is_alive
end
|
#is_poisoned? ⇒ Boolean
Also known as:
poisoned?, poisoned
#
is_poisoned?
Living beings can be poisoned. This query-method tells us whether we are poisoned or not.
#
173
174
175
|
# File 'lib/games_and_rpg_paradise/mud/living/living.rb', line 173
def is_poisoned?
@is_poisoned
end
|
#my_race? ⇒ Boolean
#
race?
This will return which race this living object is.
#
my_race?
101
102
103
|
# File 'lib/games_and_rpg_paradise/mud/living/living.rb', line 101
def race?
@race
end
|
#race? ⇒ Boolean
Also known as:
race
97
98
99
|
# File 'lib/games_and_rpg_paradise/mud/living/living.rb', line 97
def race?
@race
end
|
#report_race ⇒ Object
106
107
108
|
# File 'lib/games_and_rpg_paradise/mud/living/living.rb', line 106
def report_race
e 'I am of race '+race?+'.'
end
|
#reset ⇒ Object
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
|
# File 'lib/games_and_rpg_paradise/mud/living/living.rb', line 55
def reset
super()
@skills = {} @is_alive = true
@is_poisoned = false
@race = :human
@can_talk = false
end
|
#return_default_hp ⇒ Object
113
114
115
|
# File 'lib/games_and_rpg_paradise/mud/living/living.rb', line 113
def return_default_hp
DEFAULT_HP_FOR_HUMANS
end
|
#return_race ⇒ Boolean
#
race?
This will return which race this living object is.
#
return_race
100
101
102
|
# File 'lib/games_and_rpg_paradise/mud/living/living.rb', line 100
def race?
@race
end
|
#run ⇒ Object
229
230
231
|
# File 'lib/games_and_rpg_paradise/mud/living/living.rb', line 229
def run
determine_the_attributes
end
|
#set_stats_packages(for_this_race = @race) ⇒ Object
#
determine_the_attributes
The human attributes are set to a value of 100 each.
We assume a human with a weight of 100kg, of age 25, and of male gender.
#
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
|
# File 'lib/games_and_rpg_paradise/mud/living/living.rb', line 198
def set_stats_packages(
for_this_race = @race
)
case for_this_race
when :human
@strength = HUMAN_STR_BASE @agility = HUMAN_AGI_BASE @endurance = HUMAN_END_BASE @constitution = HUMAN_CON_BASE @intelligence = HUMAN_INT_BASE @speed_factor = 5 else
e 'Unknown race: '+for_this_race.to_s
end
end
|
#skills? ⇒ Boolean
Also known as:
skills
88
89
90
|
# File 'lib/games_and_rpg_paradise/mud/living/living.rb', line 88
def skills?
@skills
end
|