回答編集履歴
3
Remove debugging code
test
CHANGED
@@ -22,8 +22,6 @@
|
|
22
22
|
|
23
23
|
@players = [pokemon_a, pokemon_b]
|
24
24
|
|
25
|
-
@players.map(&:name)
|
26
|
-
|
27
25
|
end
|
28
26
|
|
29
27
|
|
@@ -62,8 +60,6 @@
|
|
62
60
|
|
63
61
|
@players.reverse! if @players.size.modulo(@turn_count).even?
|
64
62
|
|
65
|
-
@players.map(&:name)
|
66
|
-
|
67
63
|
end
|
68
64
|
|
69
65
|
|
2
refactor
test
CHANGED
@@ -74,7 +74,7 @@
|
|
74
74
|
|
75
75
|
attacker, defender = @players # 攻撃側と防御側を取り出す
|
76
76
|
|
77
|
-
defender.damage!(attacker.attack_power)
|
77
|
+
defender.taken_damage!(attacker.attack_power)
|
78
78
|
|
79
79
|
end
|
80
80
|
|
@@ -156,7 +156,7 @@
|
|
156
156
|
|
157
157
|
|
158
158
|
|
159
|
-
def damage!(attack_power)
|
159
|
+
def taken_damage!(attack_power)
|
160
160
|
|
161
161
|
@vitality -= attack_power
|
162
162
|
|
1
Fix a bug
test
CHANGED
@@ -22,6 +22,8 @@
|
|
22
22
|
|
23
23
|
@players = [pokemon_a, pokemon_b]
|
24
24
|
|
25
|
+
@players.map(&:name)
|
26
|
+
|
25
27
|
end
|
26
28
|
|
27
29
|
|
@@ -54,9 +56,13 @@
|
|
54
56
|
|
55
57
|
def turn_phaze!
|
56
58
|
|
59
|
+
@turn_count += 1
|
60
|
+
|
61
|
+
|
62
|
+
|
57
|
-
@players.reverse! if @
|
63
|
+
@players.reverse! if @players.size.modulo(@turn_count).even?
|
58
|
-
|
64
|
+
|
59
|
-
@players
|
65
|
+
@players.map(&:name)
|
60
66
|
|
61
67
|
end
|
62
68
|
|
@@ -70,10 +76,6 @@
|
|
70
76
|
|
71
77
|
defender.damage!(attacker.attack_power)
|
72
78
|
|
73
|
-
|
74
|
-
|
75
|
-
@turn_count += 1
|
76
|
-
|
77
79
|
end
|
78
80
|
|
79
81
|
|
@@ -186,19 +188,13 @@
|
|
186
188
|
|
187
189
|
# ピッピは30のダメージをうけた!
|
188
190
|
|
189
|
-
#
|
191
|
+
#
|
190
192
|
|
191
193
|
# ピッピのこうげき
|
192
194
|
|
193
195
|
# ポッポは20のダメージをうけた!
|
194
196
|
|
195
|
-
#
|
197
|
+
#
|
196
|
-
|
197
|
-
# ピッピのこうげき
|
198
|
-
|
199
|
-
# ポッポは20のダメージをうけた!
|
200
|
-
|
201
|
-
#
|
202
198
|
|
203
199
|
# ポッポのこうげき
|
204
200
|
|