Class: GamesAndRpgParadise::ShakesAndFidgets::Character

Inherits:
Object
  • Object
show all
Defined in:
lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb

Overview

GamesAndRpgParadise::ShakesAndFidgets::Character

Constant Summary collapse

ARRAY_RACES =
#

ARRAY_RACES

Different races can be picked. Orc adds +1 to strength for instance but deduct -1 from intelligence.

#
%w(
  elf
  dwarf
  human
  gnome
  orc
  goblin
  demon
)+['dark elf']
RJUST =
#

RJUST

#
14
ARRAY_AVAILABLE_LAYERS =
#

ARRAY_AVAILABLE_LAYERS

#
[
  :head, :torso,     :waist,
  :neck, :left_hand, :right_hand,
  :feet, :charm,     :weapon,
  :inventory 
]

Instance Method Summary collapse

Constructor Details

#initialize(run_already = true) ⇒ Character

#

initialize

#


51
52
53
54
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 51

def initialize(run_already = true)
  reset
  run if run_already
end

Instance Method Details

#abenteuerlust?Boolean Also known as: motivation, abenteuerlust

#

abenteuerlust?

#

Returns:

  • (Boolean)


601
602
603
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 601

def abenteuerlust?
  @abenteuerlust # Query the @abenteuerlust vaule.
end

#add_honour(i) ⇒ Object

#

add_honour

#


202
203
204
205
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 202

def add_honour(i)
  i = i.to_i
  @honour += i
end

#add_money(i) ⇒ Object Also known as: add_cash

#

add_money

Use this money to add some coins to the character in question.

#


369
370
371
372
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 369

def add_money(i)
  i = i.to_i
  set_money(@n_silver_coins+i)
end

#add_motivation(i = '10-50') ⇒ Object Also known as: add_abenteuerlust

#

add_motivation

Use this method when you wish to add motivation to a weary hero.

#


249
250
251
252
253
254
255
256
257
258
259
260
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 249

def add_motivation(i = '10-50')
  if i.is_a? String
    i.delete!('+') if i.include? '+'
    if i.include? '-'
      min, max = i.split('-')
      i = (min..max).map(&:to_i)
    end
  end
  i = i.sample if i.is_a? Array
  i = i.to_i
  @abenteuerlust += i
end

#add_to_inventory(i) ⇒ Object

#

add_to_inventory

#


125
126
127
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 125

def add_to_inventory(i)
  @inventory << i
end

#add_xp(i) ⇒ Object

#

add_xp

#


301
302
303
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 301

def add_xp(i)
  @xp += i.to_i
end

#all_armoursObject

#

all_armours

This method will return a hash with all armours.

#


286
287
288
289
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 286

def all_armours # Give a description of armours.
  result = @layers.keys.map {|x| x.name? } # This is a hash.
  return result
end

#armours?Boolean Also known as: layers

#

armours?

#

Returns:

  • (Boolean)


691
692
693
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 691

def armours?
  @layers # So that we can access to the armours.
end

#available_stats?Boolean Also known as: attributes, attributes?

#

available_stats?

#

Returns:

  • (Boolean)


543
544
545
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 543

def available_stats?
  @attributes
end

#calculate_bonus_from_armoursObject

#

calculate_bonus_from_armours

#


139
140
141
142
143
144
145
146
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 139

def calculate_bonus_from_armours
  get_all_layers.each { |layer| # layer could be :torso, :feet and so forth.
    possible_armour = @layers[layer]
    if possible_armour.respond_to? :attribute_boosts
      modify_attribute(possible_armour.attribute_boosts)
    end
  }
end

#calculate_level_from_xpObject Also known as: calculate_level_from_xp?

#

calculate_level_from_xp

#


385
386
387
388
389
390
391
392
393
394
395
396
397
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 385

def calculate_level_from_xp
  xp = xp?
  between_these_two_levels = [] # This Array will keep track of our level.
  INVERTED_XP_LEVELS.each_pair {|key, value|
    if key < xp
      between_these_two_levels[0] = value unless between_these_two_levels.size > 1
    end
    if key > xp
      between_these_two_levels << value unless between_these_two_levels.size > 1
    end
  }
  return between_these_two_levels.first # The first entry has the right number.
end

#cash?Boolean Also known as: money?, coins?, silver_coins?, n_money?, gold, gold?

#

cash?

#

Returns:

  • (Boolean)


721
722
723
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 721

def cash?
  @n_silver_coins
end

#character_class?Boolean

#

character_class?

#

Returns:

  • (Boolean)


650
651
652
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 650

def character_class?
  @character_class
end

#debugObject

#

debug

#


265
266
267
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 265

def debug
  pp @attributes
end

#deduct_money(i) ⇒ Object

#

deduct_money

#


377
378
379
380
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 377

def deduct_money(i)
  i = i.to_i
  set_money(@n_silver_coins-i)
end

#deduct_motivation(i = 5) ⇒ Object

#

deduct_motivation

#


239
240
241
242
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 239

def deduct_motivation(i = 5)
  @abenteuerlust -= i.to_i
  @abenteuerlust = 0 if @abenteuerlust < 0 # Required Safeguard.
end

#dex?Boolean

#

dex?

#

Returns:

  • (Boolean)


522
523
524
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 522

def dex?
  get_value_for_this_attribute('geschick')
end

#ehre?Boolean Also known as: ehre

#

ehre?

How much fame (“ehre”) this character has.

#

Returns:

  • (Boolean)


735
736
737
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 735

def ehre?
  @ehre
end

#endurance?Boolean

#

endurance?

#

Returns:

  • (Boolean)


508
509
510
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 508

def endurance?
  get_value_for_this_attribute('ausdauer')
end

#feedback_nameObject

#

feedback_name

#


224
225
226
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 224

def feedback_name
  e @name
end

#find_proper_name_for_this_attribute(i) ⇒ Object

#

find_proper_name_for_this_attribute

#


416
417
418
419
420
421
422
423
424
425
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 416

def find_proper_name_for_this_attribute(i)
  if @attributes.has_key? i
    result = i
  else
    all_matches = @attributes.keys.select {|entry| entry =~ /#{i}/ }
    all_matches = all_matches.first unless all_matches.empty?
    result  = all_matches
  end
  return result
end

#get_all_layersObject

#

get_all_layers

This returns an array of all layers that can change the Attributes.

#


153
154
155
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 153

def get_all_layers
  ARRAY_AVAILABLE_LAYERS
end

#get_value_for_this_attribute(i = '') ⇒ Object

#

get_value_for_this_attribute

You can use this method to query the value of an attribute.

Usage example:

get_value_for_this_attribute('int')
#


576
577
578
579
580
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 576

def get_value_for_this_attribute(i = '')
  result = find_proper_name_for_this_attribute(i)
  result = @attributes[result]
  return result
end

#increase(this_attribute, by_how_much = 1) ⇒ Object

#

increase

Use this method to increase an attribute of the character.

#


432
433
434
435
436
437
438
439
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 432

def increase(
    this_attribute, by_how_much = 1
  )
  this_attribute = find_proper_name_for_this_attribute(this_attribute)
  value = get_value_for_this_attribute(this_attribute) + by_how_much
  _ = this_attribute+' = '+value.to_s
  set_attribute(_)
end

#int?Boolean

#

int?

#

Returns:

  • (Boolean)


515
516
517
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 515

def int?
  get_value_for_this_attribute('int')
end

#inventory?Boolean Also known as: inventory

#

inventory?

#

Returns:

  • (Boolean)


132
133
134
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 132

def inventory?
  @inventory # What the character carries.
end

#level?Boolean Also known as: level

#

level?

#

Returns:

  • (Boolean)


174
175
176
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 174

def level?
  @level
end

#luck?Boolean

#

luck?

#

Returns:

  • (Boolean)


501
502
503
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 501

def luck?
  get_value_for_this_attribute('glück')
end

#modify_attribute(array) ⇒ Object

#

modify_attribute

Use this to modify an attribute.

#


162
163
164
165
166
167
168
169
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 162

def modify_attribute(array)
  unless array.empty?
    array = array.flatten
    attribute = array[0].downcase
    boost     = array[1] # How much to boost
    @attributes[attribute] = @attributes[attribute] + boost 
  end
end

#name=(i) ⇒ Object

#

name=

#


360
361
362
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 360

def name=(i)
  @name = i
end

#name?Boolean Also known as: name

#

name?

#

Returns:

  • (Boolean)


353
354
355
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 353

def name?
  @name
end

#original_attributes?Boolean Also known as: original_attributes

#

original_attributes?

#

Returns:

  • (Boolean)


487
488
489
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 487

def original_attributes?
  @original_attributes
end

#padding?Boolean

#

padding?

#

Returns:

  • (Boolean)


320
321
322
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 320

def padding?
  18
end

#pick_random_raceObject

#

pick_random_race

This method will select a random race.

#


684
685
686
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 684

def pick_random_race
  set_race(ARRAY_RACES.sample)
end

#pilze(i = '-1') ⇒ Object

#

pilze

#


308
309
310
311
312
313
314
315
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 308

def pilze(i = '-1')
  if i.to_s.include? '-'
    i = i.to_s.delete('-')
    @n_pilze -= i.to_i
  end
  i = i.to_i
  @n_pilze = i
end

#race?Boolean

#

race?

#

Returns:

  • (Boolean)


698
699
700
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 698

def race?
  @race
end

#report_abenteuerlustObject

#

report_abenteuerlust

#


444
445
446
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 444

def report_abenteuerlust
  eparse ('Abenteuerlust:').ljust(padding?)+abenteuerlust?.to_s.rjust(RJUST)
end

#report_character_classObject

#

report_character_class

#


657
658
659
660
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 657

def report_character_class
  eparse ('Character class:').ljust(padding?)+
         character_class?.to_s.capitalize.rjust(RJUST)
end

#report_fameObject Also known as: fame?

#

report_fame

#


402
403
404
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 402

def report_fame
  eparse ('Fame:').ljust(padding?)+ehre?.to_s.rjust(RJUST)
end

#report_levelObject

#

report_level

#


409
410
411
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 409

def report_level
  eparse ('Level:').ljust(padding?)+calculate_level_from_xp?.to_s.rjust(RJUST)
end

#report_moneyObject

#

report_money

Report how much money the character has.

#


707
708
709
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 707

def report_money
  eparse ('Money:').ljust(padding?)+gold?.to_s.rjust(RJUST)
end

#report_nameObject

#

report_name

#


334
335
336
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 334

def report_name
  eparse ('Name:').ljust(padding?)+name?.to_s.rjust(RJUST)
end

#report_raceObject

#

report_race

#


714
715
716
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 714

def report_race
  eparse ('Race:').ljust(padding?)+race?.to_s.rjust(RJUST)
end

#report_statsObject

#

report_stats

#


451
452
453
454
455
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 451

def report_stats
  attributes?.each_pair {|key, value|
    eparse (key.to_s.capitalize+':').ljust(padding?)+value.to_s.rjust(RJUST)
  }
end

#report_xpObject

#

report_xp

#


327
328
329
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 327

def report_xp
  eparse ('XP:').ljust(padding?)+xp?.to_s.rjust(RJUST)
end

#resetObject

#

reset

#


59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 59

def reset
  @original_attributes = {} # Need to keep a copy, so that we can calulcate the stat-increase.
  pick_random_race
  reset_layers
  reset_attributes
  # ======================================================================= #
  # Set initial value to zero.
  # ======================================================================= #
  set_attributes '
    stärke:      0
    geschick:    0
    intelligenz: 0
    ausdauer:    0
    glück:       0
  '
  set_abenteuerlust # This is also called "Motivation".
  set_xp
  set_name
  set_ehre
  set_money
  @n_pilze = 0
  @honour  = 0
  @level   = 0
end

#reset_attributesObject

#

reset_attributes

#


94
95
96
97
98
99
100
101
102
103
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 94

def reset_attributes
  # ======================================================================= #
  # === @attributes
  # ======================================================================= #
  @attributes = {}
  # ======================================================================= #
  # === @inventory
  # ======================================================================= #
  @inventory  = []
end

#reset_layersObject

#

reset_layers

#


108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 108

def reset_layers # This clears the layers again.
  @layers = {} # Keeps track of the various layers.
  @layers[:head]       = ''
  @layers[:torso]      = ''
  @layers[:waist]      = ''
  @layers[:neck]       = ''
  @layers[:left_hand]  = '' # This is for rings.
  @layers[:right_hand] = ''
  @layers[:feet]       = ''
  @layers[:charm]      = '' # The lucky charm.
  @layers[:weapon]     = ''
  @layers[:inventory]  = [] # We must remember that we only have 5 slots available here.
end

#runObject

#

run

General run method.

#


744
745
746
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 744

def run
  set_class
end

#set_abenteuerlust(i = 100) ⇒ Object Also known as: abenteuerlust=

#

set_abenteuerlust

#


231
232
233
234
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 231

def set_abenteuerlust(i = 100) # Set the motivation.
  i = i.to_i # Always want integers here.
  @abenteuerlust = i
end

#set_agility(i) ⇒ Object

#

set_agility

#


181
182
183
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 181

def set_agility(i)
  set_attribute('geschick: '+i.to_s)
end

#set_attribute(i) ⇒ Object

#

set_attribute

#


551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 551

def set_attribute(i) # Use only this method when setting the attribute.
  if i.is_a? String
    i.strip!
    if i.include? '='
      i = i.split('=')
    else
      i = i.gsub(/:/,'').split(' ')
    end
  end
  splitted = i
  value = splitted[1]
  value.strip! if value.is_a? String
  value = value.to_i
  this_attribute = splitted.first.dup.force_encoding(ENCODING_ISO).strip
  @attributes[this_attribute] = value #.dup.force_encoding(ENCODING_ISO)
end

#set_attributes(i) ⇒ Object

#

set_attributes

#


460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 460

def set_attributes(i)
  if i.is_a? String
    i = i.split(N)
    i.map! {|entry| entry.strip }
    i.reject! {|entry| entry.empty? }
    i.each {|entry|
      splitted = entry.split(':')
      attribute_value = splitted.last
      case entry
      when /stärke/      # === strength
        set_strength(attribute_value)
      when /geschick/    # === dexterity
        set_agility(attribute_value)
      when /intelligenz/ # === intelligence
        set_intelligence(attribute_value)
      when /ausdauer/
        set_endurance(attribute_value)
      when /glück/
        set_luck(attribute_value)
      end
    }
  end
end

#set_character_class(i) ⇒ Object

#

set_character_class

#


665
666
667
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 665

def set_character_class(i)
  @character_class = i
end

#set_class(i = 'kundschafter') ⇒ Object

#

set_class

There are four classes to pick from:

(1) Kundschafter
(2) Magier
(3) Krieger
(4) Berserker
#


617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 617

def set_class(i = 'kundschafter') # Sets a class.
  case i.to_s # case tag
  when '1','scout','kundschafter'
    i = 'scout'
  when '2','mage','magier'
    i = 'mage'
  when '3','fighter','warrior','default','krieger'
    i = 'warrior'
  when '4','berserker'
    i = 'berserker'
  end
  # ======================================================================= #
  # Here we load the dataset from the Yaml file. This will be UTF
  # encoded.
  # ======================================================================= #
  @yaml_dataset = YAML.load_file(BASE_STATS_FOR_THE_CLASSES)
  @yaml_dataset[i].each { |line|
    # ===================================================================== #
    # Turn the first entry into ISO encoding next.
    # ===================================================================== #
    line[0] = line[0].to_s.dup.force_encoding(Encoding::ENCODING_ISO)
    first   = line.first
    last    = line.last
    set_attribute(line)
    @original_attributes[first] = last
  }
  remove_instance_variable(:@yaml_dataset) # won't need it anymore.
  set_character_class(i)
end

#set_ehre(i = '0') ⇒ Object

#

set_ehre

#


210
211
212
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 210

def set_ehre(i = '0') # Was ist Ehre?
  @ehre = i.to_i
end

#set_endurance(i) ⇒ Object

#

set_endurance

#


188
189
190
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 188

def set_endurance(i)
  set_attribute('ausdauer: '+i.to_s)
end

#set_intelligence(i) ⇒ Object

#

set_intelligence

#


195
196
197
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 195

def set_intelligence(i)
  set_attribute('intelligenz: '+i.to_s)
end

#set_luck(i) ⇒ Object

#

set_luck

#


529
530
531
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 529

def set_luck(i)
  set_attribute('glück: '+i.to_s)
end

#set_money(i = 500) ⇒ Object

#

set_money

10 silver coins is 1 gold coin.

We will calculate in silver coins.

#


345
346
347
348
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 345

def set_money(i = 500)
  i = 0 if i < 0
  @n_silver_coins = i
end

#set_name(i = 'shevegen') ⇒ Object

#

set_name

#


217
218
219
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 217

def set_name(i = 'shevegen')
  @name = i
end

#set_portrait(file_location) ⇒ Object

#

set_portrait

#


87
88
89
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 87

def set_portrait(file_location) # Where to keep the graphic-location.
  @portrait_location = file_location
end

#set_race(i = :elf) ⇒ Object Also known as: race=

#

set_race

These 7 races are possible:

elf, dwarf, human, gnome, orc, dark elf, goblin, demon
#


675
676
677
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 675

def set_race(i = :elf)
  @race = i.to_s
end

#set_strength(i) ⇒ Object

#

set_strength

#


536
537
538
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 536

def set_strength(i)
  set_attribute('stärke: '+i.to_s)
end

#set_xp(i = 0) ⇒ Object

#

set_xp

#


294
295
296
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 294

def set_xp(i = 0)
  @xp = i
end

#stats?Boolean

#

stats?

This method will return a Hash.

#

Returns:

  • (Boolean)


594
595
596
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 594

def stats?
  attributes?
end

#strength?Boolean

#

strength?

#

Returns:

  • (Boolean)


494
495
496
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 494

def strength?
  get_value_for_this_attribute('stärke')
end

#try_to_equip(this_armour = Armour.new) ⇒ Object Also known as: equip_randomly

#

try_to_equip

#


272
273
274
275
276
277
278
279
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 272

def try_to_equip(this_armour = Armour.new) # wear armour here.
  if this_armour.is_armour?
    @layers[this_armour.type?] = this_armour #.name # Equip here.
    calculate_bonus_from_armours # Calculate total attribute boosts.
  else
    warn 'Sorry, '+this_armour.name+' is not an armour.'
  end
end

#xp?Boolean Also known as: xp

#

xp?

#

Returns:

  • (Boolean)


585
586
587
# File 'lib/games_and_rpg_paradise/games/shakes_and_fidgets/character/character.rb', line 585

def xp?
  @xp
end