Class: GamesAndRpgParadise::Lpc::Controller

Inherits:
Object
  • Object
show all
Includes:
Colours
Defined in:
lib/games_and_rpg_paradise/lpc/controller/controller.rb

Constant Summary collapse

MAY_WE_USE_COLOURS =
#

MAY_WE_USE_COLOURS

#
true

Constants included from Colours

Colours::WHITE

Instance Method Summary collapse

Methods included from Colours

#brown, #cfile, #convert_colour, convert_colour, #fancy, #normal, #pink, #red, #yel

Constructor Details

#initialize(action, what, run_already = true) ⇒ Controller

#

initialize

#


29
30
31
32
33
34
# File 'lib/games_and_rpg_paradise/lpc/controller/controller.rb', line 29

def initialize(action, what, run_already = true)
  reset
  set_action(action)
  set_what(what)
  run if run_already
end

Instance Method Details

#_(i) ⇒ Object

#

_

#


247
248
249
# File 'lib/games_and_rpg_paradise/lpc/controller/controller.rb', line 247

def _(i) # append to the @_ string.
  @_ << i << N
end

#check_actionObject

#

check_action

#


67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/games_and_rpg_paradise/lpc/controller/controller.rb', line 67

def check_action # case tag
  case @action
  # ======================================================================= #
  # === create
  # ======================================================================= #
  when 'create' # create tag. (lpcc create monster)
    display_to_terminal 'Creating something next.'
    case @what
    when 'monster'
      create_monster
    end
  # ======================================================================= #
  # === generate
  # ======================================================================= #
  when 'generate','adverbs','adv'
    display_to_terminal 'Generating Adverbs now.'
    GenerateAdverbs.new
  end
end

#create_monsterObject

#

create_monster

#


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
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
# File 'lib/games_and_rpg_paradise/lpc/controller/controller.rb', line 105

def create_monster
  display_to_terminal '  => Creating a LPC skeleton for a monster next.'
  _ 'inherit "/std/living";'
  _ 'inherit "/std/act/attack";'
  _ 'inherit "/std/act/add_things";'
  _ 'inherit "/std/act/supporting";'
  _ 'inherit "/std/act/seqaction";'+N
  _ '/*inherit STD_LILITH_RACES "/d/Arborea/monster/humanoid/std_lilith_races";*/'
  _ '#include <macros.h>'
  _ '#include <money.h>'
  _ '#include <stdproperties.h>'
  _ '#include <ss_types.h>'
  _ '#include <wa_types.h>'
  _ '#include <notify.h>'
  _ '#include <ansi_color.h>'
  _ '#include <formulas.h>'+N
  _ 'create_monster()'
  _ '{'
  _ '    int rand;'+N

  _ '    set_name("gnoll");'
  _ '    set_adj(({"hairy","stinking"}));'
  _ '    set_race_name("gnoll");'
  _ '    set_gender(G_MALE);'
  _ '    set_long(BS("Wiry yet strong, this goblinoids body is painted "+'
  _ '        "with many black stripes. His head is covered in matted fur "+'
  _ '        "and a long dog-like snout sniffs the air carefully. A tuft "+'
  _ '        "of brown fur juts out from the top of his scalp at an angle.\n"));'+N
  
  _ '    add_cchat("I will feast upon your flesh!");'
  _ '    add_cchat("Our cubs will be happy with your carrion!");'
  _ '    add_cchat("You have made your last mistake!!");'
  _ '    add_cchat("The goblins are more dangerous, really!");'
  _ '    add_cchat("The goblins are more dangerous!");'
  _ '    set_cchat_time(random(75) + 110);'
  _ '    /*set_chat_time(random(75)  + 140);*/'+N

  _ '    if (!IS_CLONE) return;'
  _ '    set_skill(SS_BLIND_COMBAT, 30);'
  _ '    set_skill(SS_DEFENCE,      45);'
  _ '    set_skill(SS_FIRST_AID,    20);'
  _ '    set_skill(SS_PARRY,        45);'
  _ '    set_skill(SS_2H_COMBAT,    45);'
  _ '    set_skill(SS_TEAMING,      40);'
  _ '    set_skill(SS_UNARM_COMBAT, 45);'
  _ '       /* The three basic hit types */'
  _ '    set_skill(SS_SMASH, random(4)+32);'
  _ '    set_skill(SS_SWING, random(4)+32);'
  _ '    set_skill(SS_THRUST,random(4)+32);'+N
  
  _ '    set_karma(-500);'
  _ '    set_stats(({ 110,90,100,115,95,100,80 }));'+N

  _ '    MONEY_ADD(this_object(),random(10)+30);'
  _ '    add_prop(LIVE_I_HUMANOID,1);'
  _ '    add_prop(LIVE_I_SEE_DARK,1);'
  _ '    add_prop(CONT_I_WEIGHT, 60000+random(10000));'
  _ '    add_prop(CONT_I_VOLUME, 25000);'
  _ '    add_prop(LIVE_I_NEVER_ILL,1);'
  _ '    add_prop(CONT_I_HEIGHT, 180+random(20));'
  _ '    set_appearance(40+random(20));'
  _ '    set_aggressive(1);'
  _ '    set_hair_length(40);'
  _ '    set_beard_length(40);'
  _ '    set_eye_color("red");'
  _ '    set_hair_color("brown");'
  _ '    set_supporting(({"gnoll","hyena","hyenadon","troll"}));'
  _ '    set_team_races(1,({"gnoll","hyena","half-gnoll"}));   +N '

  _ '    add_armour("/d/System/armours/leather/jacket"); '
  _ '    add_armour("/d/System/armours/helmet/battle_helmet");'

  _ '    rand = random(3);'+N
  _ '    if (rand == 0) {'
  _ '        set_skill(SS_WEP_AXE, 35);'
  _ '        add_weapon("/d/System/weapons/axe/orc_axe","both hands");'
  _ '    } else if (rand == 1) {'
  _ '        set_skill(SS_WEP_SWORD, 35);'
  _ '        add_weapon("/d/System/weapons/sword/gnoll_shsword");'
  _ '        add_weapon("/d/System/weapons/sword/gnoll_shsword");'
  _ '    }'
  _ '    else'
  _ '    {'
  _ '       set_skill(SS_WEP_POLEARM, 35);'
  _ '       add_weapon("/d/System/weapons/pole/gobbo_halberd","both hands");'
  _ '    }'+N
  _ '    add_prop(LIVE_I_USE_LANGUAGE,SS_LANG_ORC);'
  _ '    set_skill(SS_LANG_ORC,90);'
  _ '    set_wimpy(10);'
  _ '}'+N
  _ 'void'
  _ 'notify_move_living(int type, object* livs)'
  _ '{'
  _ '     if ((type ==  NOTIFY_MOVE_IN) || (type == NOTIFY_LIV_MOVE_IN))'
  _ '     {'
  _ '          init_tactics(livs);'
  _ '     }'
  _ '    ::notify_move_living(type, livs);'
  _ '}'+N
  _ 'int'
  _ 'combat_round(object ao)'
  _ '{'
  _ '     return do_tactics(ao);'
  _ '}'+N
  _ 'void'
  _ 'combat_end()'
  _ '{'
  _ '     end_tactics();'
  _ '}'
end

#debugObject

#

debug

#


97
98
99
100
# File 'lib/games_and_rpg_paradise/lpc/controller/controller.rb', line 97

def debug
  pp @action
  pp @what
end

#disable_coloursObject

#

disable_colours

#


229
230
231
# File 'lib/games_and_rpg_paradise/lpc/controller/controller.rb', line 229

def disable_colours
  @use_colours = false
end

#display_to_terminal(i) ⇒ Object

#

display_to_terminal

#


219
220
221
222
223
224
# File 'lib/games_and_rpg_paradise/lpc/controller/controller.rb', line 219

def display_to_terminal(i)
  if @use_colours
    e i
  else
  end
end

#e(i) ⇒ Object

#

e

#


236
237
238
239
240
241
242
# File 'lib/games_and_rpg_paradise/lpc/controller/controller.rb', line 236

def e(i) # e tag.
  if @use_colours
    Colours.e i
  else
    puts i
  end
end

#reportObject

#

report

#


90
91
92
# File 'lib/games_and_rpg_paradise/lpc/controller/controller.rb', line 90

def report # give back @_
  e @_ unless @_.empty?
end

#resetObject

#

reset

#


39
40
41
42
43
44
45
46
47
48
# File 'lib/games_and_rpg_paradise/lpc/controller/controller.rb', line 39

def reset # reset important variables.
  # ======================================================================= #
  # === @_
  # ======================================================================= #
  @_ = ''
  # ======================================================================= #
  # === @use_colours
  # ======================================================================= #
  @use_colours = MAY_WE_USE_COLOURS
end

#runObject

#

run (run tag)

#


254
255
256
257
# File 'lib/games_and_rpg_paradise/lpc/controller/controller.rb', line 254

def run
  check_action
  report
end

#set_action(i) ⇒ Object

#

set_action

#


53
54
55
# File 'lib/games_and_rpg_paradise/lpc/controller/controller.rb', line 53

def set_action(i) # simply set @action.
  @action = i
end

#set_what(i) ⇒ Object

#

set_what

#


60
61
62
# File 'lib/games_and_rpg_paradise/lpc/controller/controller.rb', line 60

def set_what(i) # set @what.
  @what = i
end