Module: GamesAndRpgParadise::Mud::Talk
- Includes:
- Adverbs
- Defined in:
- lib/games_and_rpg_paradise/mud/can_talk/can_talk.rb
Overview
include Talk
Constant Summary
Constants included from Adverbs
Adverbs::ADVERBS_ABBREVIATED, Adverbs::ARRAY_ADVERBS
Class Method Summary collapse
-
.included(i) ⇒ Object
# === GamesAndRpgParadise::Mud::Talk.included.
Instance Method Summary collapse
-
#can_speak? ⇒ Boolean
# === can_speak? ========================================================================= #.
-
#say(what = '') ⇒ Object
(also: #speak)
# === say.
-
#set_how(i) ⇒ Object
(also: #set_speak_how)
# === set_how.
Methods included from Adverbs
all?, file?, find_adverb_for, keys, n_adverbs?, original_adverbs
Class Method Details
.included(i) ⇒ Object
#
GamesAndRpgParadise::Mud::Talk.included
We can add a chained-method here whenever this module is included.
#
28 29 30 |
# File 'lib/games_and_rpg_paradise/mud/can_talk/can_talk.rb', line 28 def self.included(i) # puts "DEBUGGING: I WAS INCLUDED" end |
Instance Method Details
#can_speak? ⇒ Boolean
#
can_speak?
#
35 36 37 |
# File 'lib/games_and_rpg_paradise/mud/can_talk/can_talk.rb', line 35 def can_speak? true end |
#say(what = '') ⇒ Object Also known as: speak
#
say
Use this method for an actor / speak-capable object to say something.
#
58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/games_and_rpg_paradise/mud/can_talk/can_talk.rb', line 58 def say( what = '' ) what = what.to_s.dup _ = ''.dup _ << ' '+@adverb.to_s if @adverb case what[-1, 1] when '.','!','?',',' else what << '.' end what << N e "You #{_}say: #{what}" end |
#set_how(i) ⇒ Object Also known as: set_speak_how
#
set_how
Use this method when trying to determine how a character talks,
-
“softly” or “angrily”.
-
#
45 46 47 48 49 50 51 |
# File 'lib/games_and_rpg_paradise/mud/can_talk/can_talk.rb', line 45 def set_how(i) if Adverbs.all?.include? i @adverb = i # How to speak. else e 'This adverb is not included: '+i end end |