Class: GamesAndRpgParadise::Gamebook::LoneWolf::Character

Inherits:
Object
  • Object
show all
Includes:
Base::Extensions
Defined in:
lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb

Overview

#

Constant Summary collapse

ARRAY_CIRCLE_OF_SPIRIT =
#

GamesAndRpgParadise::Gamebook::LoneWolf::Character::ARRAY_CIRCLE_OF_SPIRIT

#
%w( Psi-surge Psi-screen Nexus Divination )
ARRAY_CIRCLE_OF_SOLARIS =
#

GamesAndRpgParadise::Gamebook::LoneWolf::Character::ARRAY_CIRCLE_OF_SOLARIS

#
%w( Invisibility Huntmastery Pathsmanship )
ARRAY_CIRCLE_OF_FIRE =
#

GamesAndRpgParadise::Gamebook::LoneWolf::Character::ARRAY_CIRCLE_OF_FIRE

#
%w( Weaponmastery Huntmastery )
ARRAY_CIRCLE_OF_LIGHT =
#

GamesAndRpgParadise::Gamebook::LoneWolf::Character::ARRAY_CIRCLE_OF_LIGHT

#
['Animal Control','Curing']

Constants included from CommonExtensions

CommonExtensions::CONTROL_C_CODE, CommonExtensions::N

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Base::Extensions::CommandlineArguments

#commandline_arguments?, #filter_away_commandline_arguments, #first_argument?, #first_non_hyphened_argument?, #set_commandline_arguments

Methods included from CommonExtensions

#cat, #cd, #cliner, #copy_file, #delete, #dirname_but_retains_the_trailing_slash, #disable_colours, #ensure_that_the_log_directory_exists, #esystem, #get_user_input, #infer_the_namespace, #is_on_roebe?, #mkdir, #mkdir_then_cd_into_it, #mv, #namespace?, #opne, #opnn, #project_base_directory?, #project_image_directory?, #project_yaml_directory?, #rds, #register_sigint, #remove_this_directory, #rename_file, #reset_the_internal_hash, #return_pwd, #return_today, #touch_file, #wrap, #write_what_into

Constructor Details

#initializeCharacter

#

initialize

#


62
63
64
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 62

def initialize
  reset
end

Class Method Details

.available_kai_disciplines?Boolean

#

GamesAndRpgParadise::Gamebook::LoneWolf::Character.available_kai_disciplines?

This method will return an Array, containing all registered kai-disciplines. This depends on a certain .yml file.

#

Returns:

  • (Boolean)


857
858
859
860
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 857

def self.available_kai_disciplines?
  _ = file_all_kai_disciplines
  return YAML.load_file(_).keys
end

.file_all_kai_disciplinesObject

#

GamesAndRpgParadise::Gamebook::LoneWolf::Character.file_all_kai_disciplines

#


865
866
867
868
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 865

def self.file_all_kai_disciplines
  return ::GamesAndRpgParadise.project_base_dir?+
         'yaml/gamebooks/misc/all_kai_disciplines_for_the_lone_wolf_series.yml'
end

.load_character(from_here = log_dir?+'long_wolf_character.yml') ⇒ Object

#

GamesAndRpgParadise::Gamebook::LoneWolf::Character.load_character

This method must return the loaded character as-is.

#


559
560
561
562
563
564
565
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 559

def self.load_character(
    from_here = log_dir?+'long_wolf_character.yml'
  )
  character = Character.new
  character.load_this_file(from_here)
  return character
end

.save_character(dataset, store_here = log_dir?+'long_wolf_character.yml') ⇒ Object

#

GamesAndRpgParadise::Gamebook::LoneWolf::Character.save_character

#


873
874
875
876
877
878
879
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 873

def self.save_character(
    dataset,
    store_here = log_dir?+'long_wolf_character.yml'
  )
  character = Character.new(dataset)
  character.do_save(store_here)
end

Instance Method Details

#add_a_random_disciplineObject

#

add_a_random_discipline

#


259
260
261
262
263
264
265
266
267
268
269
270
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 259

def add_a_random_discipline
  _ = available_kai_disciplines?
  _ = _.sample
  array = kai_disciplines?
  if array.include? _
    e 'Can not add '+_+' as it is already part '\
      'of the available kai disciplines.' 
  else
    array << _
  end
  set_kai_disciplines(_)
end

#add_n_gold_coins(i) ⇒ Object

#

add_n_gold_coins

This method can be used to add n gold coins.

#


321
322
323
324
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 321

def add_n_gold_coins(i)
  i = i.to_i
  set_n_gold_coins(n_gold_coins? + i)
end

#add_n_to_max_endurance(i) ⇒ Object Also known as: increase_max_endurance_by

#

add_n_to_max_endurance

#


593
594
595
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 593

def add_n_to_max_endurance(i)
  @internal_hash[:max_endurance] += i.to_i
end

#add_new_combat_skill_and_endurance_valueObject

#

add_new_combat_skill_and_endurance_value

#


422
423
424
425
426
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 422

def add_new_combat_skill_and_endurance_value
  set_current_combat_skill(GamesAndRpgParadise.roll_complex_die('1W10+10').to_s) # Formula.
  set_current_endurance(GamesAndRpgParadise.roll_complex_die('1W10+20').to_s) # Formula.
  @internal_hash[:max_endurance] = current_endurance?
end

#add_this_equipment(i) ⇒ Object Also known as: add, add_this_item_to_the_equipment

#

add_this_equipment (add tag)

#


402
403
404
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 402

def add_this_equipment(i)
  @internal_hash[:equipment] << i
end

#available_kai_disciplines?Boolean

#

available_kai_disciplines?

This method will return an Array holding all tai-disciplines.

This does NOT mean that the character at hand has these disciplines.

This method also assumes that the .yml file at hand will exist at all times, which may not be the case.

Actually it had to be changed, because an instance of character may not always be available, so it was moved into its own toplevel-method here.

#

Returns:

  • (Boolean)


543
544
545
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 543

def available_kai_disciplines?
  ::GamesAndRpgParadise::Gamebook::LoneWolf::Character.available_kai_disciplines?
end

#batch_add(i) ⇒ Object

#

batch_add

#


410
411
412
413
414
415
416
417
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 410

def batch_add(i)
  i = i.dup if i.frozen?
  i.strip!
  splitted = i.split("\n")
  splitted.each {|this_item|
    add_this_equipment(this_item)
  }
end

#circle_of_fire_completed?Boolean

#

circle_of_fire_completed?

A completed Circle of Fire will add 1 CS and 2 EP.

#

Returns:

  • (Boolean)


694
695
696
697
698
699
700
701
702
703
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 694

def circle_of_fire_completed?
  _ = disciplines?
  if _ and 
     _.include?(ARRAY_CIRCLE_OF_FIRE[0]) and
     _.include?(ARRAY_CIRCLE_OF_FIRE[1])
    true
  else
    false
  end
end

#circle_of_light_completed?Boolean

#

circle_of_light_completed?

A completed Circle of Light will add 0 CS and 3 EP.

#

Returns:

  • (Boolean)


745
746
747
748
749
750
751
752
753
754
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 745

def circle_of_light_completed?
  _ = disciplines?
  if _ and
     _.include?(ARRAY_CIRCLE_OF_LIGHT[0]) and
     _.include?(ARRAY_CIRCLE_OF_LIGHT[1])
    true
  else
    false
  end
end

#circle_of_solaris_completed?Boolean

#

circle_of_solaris_completed?

A completed Circle of Solaris will add 1 CS and 3 EP.

#

Returns:

  • (Boolean)


728
729
730
731
732
733
734
735
736
737
738
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 728

def circle_of_solaris_completed?
  _ = disciplines?
  if _ and
     _.include?(ARRAY_CIRCLE_OF_SOLARIS[0]) and
     _.include?(ARRAY_CIRCLE_OF_SOLARIS[1]) and
     _.include?(ARRAY_CIRCLE_OF_SOLARIS[2])
    true
  else
    false
  end
end

#circle_of_spirit_completed?Boolean

#

circle_of_spirit_completed?

A completed Circle of Spirit will add 3 CS and 3 EP.

#

Returns:

  • (Boolean)


710
711
712
713
714
715
716
717
718
719
720
721
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 710

def circle_of_spirit_completed?
  _ = disciplines?
  if _ and
     _.include?(ARRAY_CIRCLE_OF_SPIRIT[0]) and
     _.include?(ARRAY_CIRCLE_OF_SPIRIT[1]) and
     _.include?(ARRAY_CIRCLE_OF_SPIRIT[2]) and
     _.include?(ARRAY_CIRCLE_OF_SPIRIT[3])
    true
  else
    false
  end
end

#combat_skill?Boolean Also known as: current_stärke?, current_combat_skill?, current_CS?

#

combat_skill?

#

Returns:

  • (Boolean)


600
601
602
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 600

def combat_skill?
  @internal_hash[:current_combat_skill]
end

#comments?Boolean

#

comments?

#

Returns:

  • (Boolean)


329
330
331
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 329

def comments?
  @internal_hash[:comments]
end

#completed_circles?Boolean

#

completed_circles?

#

Returns:

  • (Boolean)


230
231
232
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 230

def completed_circles?
  @internal_hash[:completed_circles]
end

#current_endurance?Boolean Also known as: endurance?

#

current_endurance?

This method will return the current endurance-value.

#

Returns:

  • (Boolean)


784
785
786
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 784

def current_endurance?
  internal_hash[:current_endurance]
end

#debug_method_add_custom_values_for_nowObject

#

debug_method_add_custom_values_for_now

The following method is not called regularly - only if I need to initialize a new game for any custom character. Or testing a custom character.

#


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
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 73

def debug_method_add_custom_values_for_now
  # ======================================================================= #
  # === :kai_disciplines
  #
  # Only list tai-disciplines that this character is able to perform.
  # ======================================================================= #
  @internal_hash[:kai_disciplines] = []
  # ======================================================================= #
  # Next, we append the tai-disciplines to that array - this is now
  # done for debugging purposes, but should be removed at a later
  # point in time.
  # ======================================================================= #
  @internal_hash[:kai_disciplines] << 'Healing'
  @internal_hash[:kai_disciplines] << 'Mindshield'
  @internal_hash[:kai_disciplines] << 'Sixth Sense'
  @internal_hash[:kai_disciplines] << 'Camouflage'
  @internal_hash[:kai_disciplines].sort!
  # Next the Magnakai abilities.
  # Kai Master Superior, which means that you have learnt three of the Magnaka
  @internal_hash[:kai_disciplines] << 'Invisibility'
  @internal_hash[:kai_disciplines] << 'Divination'
  @internal_hash[:kai_disciplines] << 'Pathsmanship'
  set_n_gold_coins(37)
  set_endurance(26)
  set_max_endurance(26)
  set_initial_combat_skill(19)
  set_current_combat_skill(19)
  set_n_laumspur_potions(0)
  set_n_arrows(4)
  set_completed_circles(
    [:circle_of_light]
  )
  add_n_to_max_endurance(3) # ^^^ due to circle of light
  batch_add('

- Summersword +8 CS
- Silver Bow of Duadon +3 on each roll, +2 because of weapon mastery

- Brass Whistle     # 2
- Vial of Blue Pills for breahe underwater # 3
- Silk Jacket      # 4
- Crystal Decanter # 5
- Silver Bowl #6
- Vial of Gold Dust #7
- Psychic Ring      # -, small, can be worn freely
- Signet Ring       # -, small, can be worn freely
- Laumspur:  0
- Fireseeds: 3
- Black Key (Special Item)
- Potion of Alether: 1, will increase effective CS by +2
- 3x laumspur MEALs
  ')
end

#do_dieObject Also known as: dies

#

do_die

#


252
253
254
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 252

def do_die
  set_is_alive(false)
end

#do_healObject Also known as: heal

#

do_heal (heal tag)

This method will heal the character, that is, set the current number of endurance points to the maximal number.

#


629
630
631
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 629

def do_heal
  set_current_endurance(:maximum)
end

#do_save(store_here = log_dir?+'lone_wolf_character_'+ name?.to_s. downcase.tr(' ','_')+'.yml', dataset = internal_hash? ) ⇒ Object Also known as: save, store, save_into_file

#

do_save (save tag, do_save tag)

This method will save the important parts of this class.

#


829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 829

def do_save(
    store_here = log_dir?+'lone_wolf_character_'+
                 name?.to_s.
                 downcase.tr(' ','_')+'.yml',
    dataset    = internal_hash?
  )
  require 'save_file'
  base_dir = File.dirname(store_here)
  # ======================================================================= #
  # We must ensure that the base-directory exists. If not we will create
  # it.
  # ======================================================================= #
  unless File.directory? base_dir
    mkdir(base_dir)
  end
  what = YAML.dump(dataset)
  SaveFile.write_what_into(what, store_here)
  return store_here # Return where it was saved, too.
end

#equipment?Boolean

#

equipment?

#

Returns:

  • (Boolean)


371
372
373
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 371

def equipment?
  @internal_hash[:equipment]
end

#has_curing_ability?Boolean

#

has_curing_ability?

This method can be used to query whether the main actor has the curing discipline, whcih is an advanced Magnakai ability.

#

Returns:

  • (Boolean)


639
640
641
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 639

def has_curing_ability?
  disciplines?.include?('Curing')
end

#has_healing_ability?Boolean

#

has_healing_ability?

This method can be used to query whether the main actor has the healing discipline.

#

Returns:

  • (Boolean)


619
620
621
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 619

def has_healing_ability?
  disciplines? and disciplines?.include?('Healing')
end

#increase_combat_skill_by(i = 1) ⇒ Object

#

increase_combat_skill_by

#


609
610
611
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 609

def increase_combat_skill_by(i = 1)
  @internal_hash[:current_combat_skill] += i
end

#initial_combat_skill?Boolean Also known as: combat_skill_base_value?, initial_CS?

#

combat_skill_base_value?

#

Returns:

  • (Boolean)


482
483
484
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 482

def initial_combat_skill?
  @internal_hash[:initial_combat_skill]
end

#internal_hash?Boolean Also known as: internal_hash

#

internal_hash

#

Returns:

  • (Boolean)


438
439
440
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 438

def internal_hash?
  @internal_hash
end

#is_alive?Boolean

#

is_alive?

#

Returns:

  • (Boolean)


490
491
492
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 490

def is_alive?
  @internal_hash[:is_alive]
end

#is_lone_wolf?Boolean

#

is_lone_wolf?

#

Returns:

  • (Boolean)


586
587
588
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 586

def is_lone_wolf?
  true
end

#is_now_deadObject

#

is_now_dead

#


497
498
499
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 497

def is_now_dead
  @internal_hash[:is_alive] = false
end

#kai_disciplines?Boolean Also known as: disciplines?, array_kai_disciplines

#

kai_disciplines?

#

Returns:

  • (Boolean)


809
810
811
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 809

def kai_disciplines?
  @internal_hash[:kai_disciplines]
end

#load_this_file(this_file) ⇒ Object Also known as: load_character, load_dataset_from_this_file, load_from_this_file

#

load_this_file (load tag)

This method can be used for load-related functionality.

#


572
573
574
575
576
577
578
579
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 572

def load_this_file(this_file)
  @internal_hash.clear
  dataset = YAML.load_file(this_file)
  dataset.each_pair {|key, value|
    setter_method = "set_#{key}"
    send(setter_method, value)
  }
end

#log_dir?Boolean

#

log_dir?

#

Returns:

  • (Boolean)


550
551
552
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 550

def log_dir?
  '/home/x/Temp/rpg_paradise/'
end

#max_endurance?Boolean Also known as: maximal_endurance?

#

max_endurance?

#

Returns:

  • (Boolean)


685
686
687
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 685

def max_endurance?
  @internal_hash[:max_endurance]
end

#n_alether_potions?Boolean

#

n_alether_potions?

#

Returns:

  • (Boolean)


385
386
387
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 385

def n_alether_potions?
  @internal_hash[:n_alether_potions]
end

#n_arrows?Boolean

#

n_arrows?

#

Returns:

  • (Boolean)


518
519
520
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 518

def n_arrows?
  @internal_hash[:n_arrows]
end

#n_gold_coins?Boolean Also known as: gold?

#

n_gold_coins?

#

Returns:

  • (Boolean)


304
305
306
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 304

def n_gold_coins?
  @internal_hash[:n_gold_coins]
end

#n_kai_disciplines?Boolean

#

n_kai_disciplines?

Return how many tai-disciplines this actor knows.

#

Returns:

  • (Boolean)


287
288
289
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 287

def n_kai_disciplines?
  @internal_hash[:kai_disciplines].size
end

#n_laumspur_potions?Boolean Also known as: n_laumspur?

#

n_laumspur_potions?

#

Returns:

  • (Boolean)


378
379
380
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 378

def n_laumspur_potions?
  @internal_hash[:n_laumspur_potions]
end

#n_meals?Boolean

#

n_meals?

#

Returns:

  • (Boolean)


431
432
433
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 431

def n_meals?
  @internal_hash[:n_meals]
end

#n_quivers?Boolean

#

n_quivers?

#

Returns:

  • (Boolean)


525
526
527
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 525

def n_quivers?
  @internal_hash[:n_quivers]
end

#name?Boolean

#

name?

#

Returns:

  • (Boolean)


343
344
345
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 343

def name?
  @name
end

#resetObject

#

reset (reset tag)

#


350
351
352
353
354
355
356
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 350

def reset
  reset_to_the_original_gamestate
  # ======================================================================= #
  # === :equipment
  # ======================================================================= #
  @internal_hash[:equipment] = []
end

#reset_to_the_original_gamestateObject

#

reset_to_the_original_gamestate

#


130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 130

def reset_to_the_original_gamestate
  # ======================================================================= #
  # === @internal_hash
  #
  # This hash will keep track of all data that should be stored.
  # ======================================================================= #
  @internal_hash = {}
  # ======================================================================= #
  # === :n_arrows
  # ======================================================================= #
  @internal_hash[:n_arrows] = 0
  # ======================================================================= #
  # === :n_quivers
  # ======================================================================= #
  @internal_hash[:n_quivers] = 0
  # ======================================================================= #
  # === :n_meals
  # ======================================================================= #
  @internal_hash[:n_meals] = 0
  # ======================================================================= #
  # === :n_gold_coins
  # ======================================================================= #
  @internal_hash[:n_gold_coins]  = 0
  # ======================================================================= #
  # === :n_laumspur_potions
  # ======================================================================= #
  @internal_hash[:n_laumspur_potions] = 0
  # ======================================================================= #
  # === :n_alether_potions
  # ======================================================================= #
  @internal_hash[:n_alether_potions] = 0
  # ======================================================================= #
  # === :current_endurance
  # ======================================================================= #
  @internal_hash[:current_endurance]     = 0
  # ======================================================================= #
  # === :max_endurance
  # ======================================================================= #
  @internal_hash[:max_endurance] = 0
  # ======================================================================= #
  # === :current_combat_skill
  #
  # This is the current, effective combat skill.
  # ======================================================================= #
  @internal_hash[:current_combat_skill]  = 0
  # ======================================================================= #
  # === :initial_combat_skill
  #
  # The initial combat skill is the one that is picked on character
  # creation time.
  #
  # This must be the initial base value, which the actor got from
  # rolling a D10 and adding 10 to it.
  # ======================================================================= #
  @internal_hash[:initial_combat_skill] = 0 # 10-19 range.
  # ======================================================================= #
  # === :completed_circles
  #
  # This refers to completed cirles of power. These are available only
  # at a later stage.
  # ======================================================================= #
  @internal_hash[:completed_circles]  = []
  # ======================================================================= #
  # === :is_alive
  # ======================================================================= #
  @internal_hash[:is_alive] = true
  # ======================================================================= #
  # === :weapons
  # ======================================================================= #
  @internal_hash[:weapons] = []
  # ======================================================================= #
  # === :comments
  #
  # This variable can be used to store comments.
  # ======================================================================= #
  @internal_hash[:comments] = []
  # ======================================================================= #
  # === :kai_disciplines
  # ======================================================================= #
  @internal_hash[:kai_disciplines] = []
  # ======================================================================= #
  # === @name
  #
  # This is mostly just a generic name. We probably do not have to
  # be more specific here. For now we will also not store this
  # variable.
  # ======================================================================= #
  @name = 'Lone Wolf Actor'
end

#set_comments(i) ⇒ Object

#

set_comments

#


336
337
338
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 336

def set_comments(i)
  @internal_hash[:comments] = [i].flatten.compact
end

#set_completed_circles(i) ⇒ Object

#

set_completed_circles

#


223
224
225
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 223

def set_completed_circles(i)
  @internal_hash[:completed_circles] = [i].flatten
end

#set_current_combat_skill(i) ⇒ Object Also known as: set_combat_skill, set_current_stärke, set_max_combat_skill

#

set_current_combat_skill

This is the effective combat skill - that is the one that is used for the current combat at hand.

#


465
466
467
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 465

def set_current_combat_skill(i)
  @internal_hash[:current_combat_skill] = i.to_i
end

#set_current_endurance(i) ⇒ Object Also known as: set_endurance, endurance=, set_base_endurance

#

set_current_endurance

#


759
760
761
762
763
764
765
766
767
768
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 759

def set_current_endurance(i)
  case i
  # ======================================================================= #
  # === :maximum
  # ======================================================================= #
  when :maximum
    i = max_endurance?
  end
  internal_hash[:current_endurance] = i.to_i
end

#set_equipment(i) ⇒ Object Also known as: equipment=

#

set_equipment

#


361
362
363
364
365
366
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 361

def set_equipment(i)
  if i.is_a?(String) and i.strip.include?("\n")
    i = i.strip.split("\n")
  end
  @internal_hash[:equipment] = [i].flatten.compact
end

#set_initial_combat_skill(i) ⇒ Object Also known as: set_combat_skill_base_value, combat_skill=

#

set_initial_combat_skill

#


474
475
476
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 474

def set_initial_combat_skill(i)
  @internal_hash[:initial_combat_skill] = i.to_i
end

#set_is_alive(i) ⇒ Object

#

set_is_alive

#


245
246
247
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 245

def set_is_alive(i)
  @internal_hash[:is_alive] = i
end

#set_kai_disciplines(i) ⇒ Object

#

set_kai_disciplines

#


275
276
277
278
279
280
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 275

def set_kai_disciplines(i)
  if i.is_a?(String) and i.include?("\n")
    i = i.strip.split("\n")
  end
  @internal_hash[:kai_disciplines] = [i].flatten.compact
end

#set_max_endurance(i) ⇒ Object

#

set_max_endurance

#


775
776
777
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 775

def set_max_endurance(i)
  @internal_hash[:max_endurance] = i.to_i
end

#set_n_alether_potions(i) ⇒ Object Also known as: set_n_alether, alether=

#

set_n_alether_potions

#


817
818
819
820
821
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 817

def set_n_alether_potions(i)
  i = i.to_i # Must always be a positive number.
  i = 0 if i < 0
  @internal_hash[:n_alether_potions] = i
end

#set_n_arrows(i) ⇒ Object Also known as: arrows=

#

set_n_arrows

#


504
505
506
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 504

def set_n_arrows(i)
  @internal_hash[:n_arrows] = i.to_i # Always store it as Integer value.
end

#set_n_gold_coins(i) ⇒ Object Also known as: set_n_gold, n_gold_coins=

#

set_n_gold_coins

#


311
312
313
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 311

def set_n_gold_coins(i)
  @internal_hash[:n_gold_coins] = i.to_i
end

#set_n_laumspur_potions(i) ⇒ Object Also known as: set_n_laumspur, laumspur=

#

set_n_laumspur_potions

#


392
393
394
395
396
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 392

def set_n_laumspur_potions(i)
  i = i.to_i # Must always be a positive number.
  i = 0 if i < 0
  @internal_hash[:n_laumspur_potions] = i
end

#set_n_meals(i) ⇒ Object Also known as: n_meals=, meals=

#

set_n_meals

#


237
238
239
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 237

def set_n_meals(i)
  @internal_hash[:n_meals] = i.to_i # This must always be a number.
end

#set_n_quivers(i) ⇒ Object Also known as: quivers=

#

set_n_quivers

#


511
512
513
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 511

def set_n_quivers(i)
  @internal_hash[:n_quivers] = i.to_i # Always store it as Integer value.
end

#set_weapons(i) ⇒ Object Also known as: weapons=

#

set_weapons

Note that this method will turn Strings into an Array, if they contain at the least one newline character.

#


659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 659

def set_weapons(i)
  if i.is_a?(String)
    i = i.split("\n").map {|entry|
      if entry.include? '#'
        entry = entry.split('#').first # We will ignore comments.
      end
      entry.rstrip
    }
  end
  # ======================================================================= #
  # This must always be kept an Array, which the next line ensures.
  # ======================================================================= #
  i = [i].flatten.compact
  @internal_hash[:weapons] = i
end

#show_short_summaryObject Also known as: summary, summary?, report

#

show_short_summary

#


791
792
793
794
795
796
797
798
799
800
801
802
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 791

def show_short_summary
  e 'CS:       '+initial_CS?.to_s+' / '+current_CS?.to_s
  e '='*80
  e 'EN:       '+current_endurance?.to_s
  e 'EN (max): '+max_endurance?.to_s
  e 'Weapons:'
  weapons?.each {|this_weapon|
    e "  - #{this_weapon}"
  }
  e 'n gold coins: '+n_gold_coins?.to_s
  e '='*80
end

#tai_disciplines=(i) ⇒ Object

#

tai_disciplines

#


294
295
296
297
298
299
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 294

def tai_disciplines=(i)
  if i.is_a?(String) and i.include? "\n"
    i = i.split("\n")
  end
  @internal_hash[:kai_disciplines] = [i].flatten
end

#try_to_add_n_hitpoints(i) ⇒ Object

#

try_to_add_n_hitpoints

This actually adds to endurance.

#


447
448
449
450
451
452
453
454
455
456
457
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 447

def try_to_add_n_hitpoints(i)
  i = i.to_i
  if current_endurance?.is_a? String
    set_current_endurance(current_endurance?.to_i)
  end
  if (current_endurance? + i) <= max_endurance?.to_i
    set_current_endurance(current_endurance? + i)
  else
    set_endurance(max_endurance?)
  end
end

#try_to_regenerate_n_hp(i = 1) ⇒ Object

#

try_to_regenerate_n_hp

#


646
647
648
649
650
651
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 646

def try_to_regenerate_n_hp(i = 1)
  new_value = current_endurance?.to_i + 1
  if new_value <= max_endurance?
    set_current_endurance(new_value)
  end
end

#weapons?Boolean

#

weapons?

#

Returns:

  • (Boolean)


678
679
680
# File 'lib/games_and_rpg_paradise/gamebooks/lone_wolf/character.rb', line 678

def weapons?
  @internal_hash[:weapons]
end