Class: GamesAndRpgParadise::Mud::Arena
- Inherits:
-
Object
- Object
- GamesAndRpgParadise::Mud::Arena
show all
- Includes:
- Colours
- Defined in:
- lib/games_and_rpg_paradise/mud/arena/arena.rb
Overview
Constant Summary
collapse
- NAMESPACE =
inspect
Constants included
from Colours
Colours::WHITE
Class Method Summary
collapse
-
.[](i = ARGV) ⇒ Object
# === GamesAndRpgParadise::Mud::Arena[] ========================================================================= #.
Instance Method Summary
collapse
Methods included from Colours
#brown, #cfile, #convert_colour, convert_colour, #fancy, #normal, #pink, #red, #yel
Constructor Details
#initialize(commandline_arguments = nil, run_already = true) ⇒ Arena
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/games_and_rpg_paradise/mud/arena/arena.rb', line 30
def initialize(
commandline_arguments = nil,
run_already = true
)
reset
set_commandline_arguments(
commandline_arguments
)
@a = DSA4_Kombattant.new('joe', 57, 2, 17, 16, '2W+4')
@b = DSA4_Kombattant.new('medevin',30, 2, 14, 12, '2W+2')
run if run_already
end
|
Class Method Details
.[](i = ARGV) ⇒ Object
#
GamesAndRpgParadise::Mud::Arena[]
#
169
170
171
|
# File 'lib/games_and_rpg_paradise/mud/arena/arena.rb', line 169
def self.[](i = ARGV)
new(i)
end
|
Instance Method Details
#check_for_death ⇒ Object
76
77
78
79
80
81
82
83
84
85
86
|
# File 'lib/games_and_rpg_paradise/mud/arena/arena.rb', line 76
def check_for_death
if @current_attacker.le == 0
e "TOT is #{@current_attacker.name}"
exit
elsif @current_defender.le == 0
e "TOT is #{@current_defender.name}"
exit
else
end
end
|
#commandline_arguments? ⇒ Boolean
#
commandline_arguments?
#
134
135
136
|
# File 'lib/games_and_rpg_paradise/mud/arena/arena.rb', line 134
def commandline_arguments?
@commandline_arguments
end
|
#fight_until_one_is_dead ⇒ Object
#
fight_until_one_is_dead
Nur jeder 2. Runde zählt da man in DSA pro Kampfrunde eine Attacke und eine Parade macht.
#
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
# File 'lib/games_and_rpg_paradise/mud/arena/arena.rb', line 94
def fight_until_one_is_dead
e '*'*80
e "Round: #{@n_round/2} ... Fight!"
e '*'*80
@n_round += 1
e "Wir kämpfen solange, bis einer von uns tot ist."
if (@current_attacker.attack_success?{ true })
damage = @current_attacker.calc_my_damage
@current_defender.alter_le(damage, true)
end
check_for_death
arena_feedback
change_who_is_attacking_and_who_is_defending
fight_until_one_is_dead
end
|
#first_argument? ⇒ Boolean
Also known as:
first?
141
142
143
|
# File 'lib/games_and_rpg_paradise/mud/arena/arena.rb', line 141
def first_argument?
@commandline_arguments.first
end
|
#initialize_combat ⇒ Object
#
initialize_combat
This will initialize combat. For now the description is in german only.
#
67
68
69
70
71
|
# File 'lib/games_and_rpg_paradise/mud/arena/arena.rb', line 67
def initialize_combat
e "Der Kampf zwischen #{@a.name} und "+
"#{@b.name} startet nun!\n >> Runde1 <<\n\n"
e "#{@a.name} schlägt zuerst zu!"
end
|
#reset ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/games_and_rpg_paradise/mud/arena/arena.rb', line 46
def reset
super()
@namespace = NAMESPACE
@array_combat_objects = []
end
|
#run ⇒ Object
148
149
150
|
# File 'lib/games_and_rpg_paradise/mud/arena/arena.rb', line 148
def run
spawn_n_combatants(2)
end
|
#set_commandline_arguments(i = '') ⇒ Object
#
set_commandline_arguments
#
126
127
128
129
|
# File 'lib/games_and_rpg_paradise/mud/arena/arena.rb', line 126
def set_commandline_arguments(i = '')
i = [i].flatten.compact
@commandline_arguments = i
end
|
#spawn_n_combatants(n = 2) ⇒ Object
155
156
157
158
159
160
161
162
163
164
|
# File 'lib/games_and_rpg_paradise/mud/arena/arena.rb', line 155
def spawn_n_combatants(n = 2)
n_times.times {
@array_combat_objects << StdMudCombat.new('Tim',23)
}
e 'Debugging:'
e
pp @array_combat_objects
e
end
|
#test ⇒ Object
114
115
116
117
118
119
120
121
|
# File 'lib/games_and_rpg_paradise/mud/arena/arena.rb', line 114
def test
pick_random_combatant.calc_my_damage
pick_random_combatant.calc_my_damage
pick_random_combatant.calc_my_damage
pick_random_combatant.calc_my_damage
pick_random_combatant.calc_my_damage
pick_random_combatant.calc_my_damage
end
|