1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
| #Système de points de caractèristique au level up.
#Mack Avril 2012
# <gain_caract> [2,2,2,2,2,2,2,2]
# <cost_caract> [2,2,2,2,2,2,2,2]
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs the menu screen processing.
#==============================================================================
$pts = 4
class Scene_Level_Up < Scene_MenuBase
def msg
s = ["Augmente les HP Max de #{@actor.gain_caract(0)}
Coute : #{@actor.cost_caract(0)}",
"Augmente les MP Max de #{@actor.gain_caract(1)}
Coute : #{@actor.cost_caract(1)}",
"Augmente la Force de #{@actor.gain_caract(2)}
Coute : #{@actor.cost_caract(2)}",
"Augmente la Defense de #{@actor.gain_caract(3)}
Coute : #{@actor.cost_caract(3)}",
"Augmente la Magie de #{@actor.gain_caract(4)}
Coute : #{@actor.cost_caract(4)}",
"Augmente la Défense Magique de #{@actor.gain_caract(5)}
Coute : #{@actor.cost_caract(5)}",
"Augmente l'Agilité de #{@actor.gain_caract(6)}
Coute : #{@actor.cost_caract(6)}",
"Augmente la Chance de #{@actor.gain_caract(7)}
Coute : #{@actor.cost_caract(7)}"]
return s
end
#--------------------------------------------------------------------------
# * Start Processing
#--------------------------------------------------------------------------
def start
super
@actor = $game_temp.actor_level_up[0]
create_help_window
create_command_window
@help_window.set_text(msg[@command_window.index])
create_status_window
$game_temp.actor_level_up.delete_at(0)
end
#--------------------------------------------------------------------------
# * Create Command Window
#--------------------------------------------------------------------------
def create_command_window
@command_window = Window_Level_upCommand.new
@command_window.set_handler(:gain_param, method(:command_gain_param))
@command_window.set_handler(:retour, method(:command_return))
@command_window.y = @help_window.height
end
def command_return
if @actor.level_up_pts > 0
@help_window.set_text("Il vous reste des points à distribuer.")
wait(30)
@command_window.activate
else
return_scene
end
end
def create_status_window
@status_window = Window_Status_Level_up.new(@actor)
@status_window.x = @command_window.width
@status_window.y = @help_window.height
end
def command_gain_param
index = @command_window.index
@command_window.refresh
if @actor.level_up_pts >= @actor.cost_caract(index)
@actor.gain_lvl_pts(-@actor.cost_caract(index))
@actor.add_param(index,@actor.gain_caract(index))
@help_window.set_text("Caractéristique augmentée !")
else
@help_window.set_text("Vous n'avez pas assez de points.")
end
@status_window.refresh
@command_window.refresh
wait(30)
@command_window.activate
end
def wait(time)
t = 0
loop do
Graphics.update
if t == time
break
end
t += 1
end
end
def update
super
@help_window.set_text(msg[@command_window.index])
end
def on_actor_change
@status_window.actor = @actor
@status_window.refresh
@command_window.activate
end
end
class Scene_Map < Scene_Base
alias old_update update
def update
old_update
if $game_temp.actor_level_up[0]
SceneManager.call(Scene_Level_Up)
end
end
end
class Game_Actor < Game_Battler
attr_reader :level_up_pts
alias old_initialize initialize
def initialize(actor_id)
old_initialize(actor_id)
@level_up_pts = 0
end
def gain_caract(param)
tbl = [1,1,1,1,1,1,1,1]
note = $data_classes[@class_id].note
note.each_line do |line|
if line.include?("<gain_caract>")
line2 = line.gsub!("<gain_caract> ","")
tbl = eval(line2)
end
end
return tbl[param]
end
def cost_caract(param)
tbl = [1,1,1,1,1,1,1,1]
note = $data_classes[@class_id].note
note.each_line do |line|
if line.include?("<cost_caract>")
line2 = line.gsub!("<cost_caract> ","")
tbl = eval(line2)
end
end
return tbl[param]
end
def gain_lvl_pts(value)
@level_up_pts += value
if @level_up_pts < 0
@level_up_pts = 0
end
end
def param_base(param_id)
return self.class.params[param_id, 1]
end
def level_up
@level += 1
$game_temp.actor_level_up.push(self) unless $game_temp.actor_level_up.include?(self)
self.class.learnings.each do |learning|
learn_skill(learning.skill_id) if learning.level == @level
end
gain_lvl_pts($pts)
end
end
class Game_Temp
attr_accessor :actor_level_up
alias old_initialize initialize
def initialize
old_initialize
@actor_level_up = []
end
end
#==============================================================================
# ** Window_MenuCommand
#------------------------------------------------------------------------------
# This command window appears on the menu screen.
#==============================================================================
class Window_Level_upCommand < Window_Command
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
@actor = $game_temp.actor_level_up[0]
super(0, 0)
@@last_command_symbol = nil
select_last
end
#--------------------------------------------------------------------------
# * Get Window Width
#--------------------------------------------------------------------------
def window_width
return 160
end
#--------------------------------------------------------------------------
# * Get Number of Lines to Show
#--------------------------------------------------------------------------
def visible_line_number
item_max
end
#--------------------------------------------------------------------------
# * Create Command List
#--------------------------------------------------------------------------
def make_command_list
add_main_commands
end
#--------------------------------------------------------------------------
# * Add Main Commands to List
#--------------------------------------------------------------------------
def add_main_commands
add_command(Vocab::param(0), :gain_param, true)
add_command(Vocab::param(1), :gain_param, true)
add_command(Vocab::param(2), :gain_param, true)
add_command(Vocab::param(3), :gain_param, true)
add_command(Vocab::param(4), :gain_param, true)
add_command(Vocab::param(5), :gain_param, true)
add_command(Vocab::param(6), :gain_param, true)
add_command(Vocab::param(7), :gain_param, true)
add_command("Suivant" , :retour , @actor.level_up_pts <= 0)
end
#--------------------------------------------------------------------------
# * Processing When OK Button Is Pressed
#--------------------------------------------------------------------------
def process_ok
@@last_command_symbol = current_symbol
super
end
def select_last
select_symbol(@@last_command_symbol)
end
end
#==============================================================================
# ** Window_Status
#------------------------------------------------------------------------------
# This window displays full status specs on the status screen.
#==============================================================================
class Window_Status_Level_up < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 0, 384, 344)
@actor = actor
refresh
activate
end
#--------------------------------------------------------------------------
# * Set Actor
#--------------------------------------------------------------------------
def actor=(actor)
return if @actor == actor
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
contents.clear
draw_block1(line_height * 1)
draw_block2(line_height * 1)
draw_block3(line_height * 3)
draw_actor_name(@actor, 4, line_height * 0 )
end
def draw_block1(y)
draw_actor_face(@actor, 192+32, y)
#draw_actor_class(@actor, 128, y)
#draw_actor_nickname(@actor, 288, y)
end
#--------------------------------------------------------------------------
# * Draw Block 2
#--------------------------------------------------------------------------
def draw_block2(y)
draw_basic_info(32, y)
draw_exp_info(4, y+line_height * 8)
end
#--------------------------------------------------------------------------
# * Draw Block 3
#--------------------------------------------------------------------------
def draw_block3(y)
draw_parameters(32, y)
end
#--------------------------------------------------------------------------
# * Draw Horizontal Line
#--------------------------------------------------------------------------
def draw_horz_line(y)
line_y = y + line_height / 2 - 1
contents.fill_rect(0, line_y, contents_width, 2, line_color)
end
#--------------------------------------------------------------------------
# * Get Color of Horizontal Line
#--------------------------------------------------------------------------
def line_color
color = normal_color
color.alpha = 48
color
end
#--------------------------------------------------------------------------
# * Draw Experience Information
#--------------------------------------------------------------------------
def draw_exp_info(x, y)
s1 = @actor.max_level? ? "-------" : @actor.exp
s2 = @actor.max_level? ? "-------" : @actor.next_level_exp - @actor.exp
s_next = sprintf(Vocab::ExpNext, Vocab::level)
change_color(system_color)
draw_text(x, y + line_height * 0, 180, line_height, Vocab::ExpTotal)
draw_text(x, y + line_height * 2, 180, line_height, s_next)
change_color(normal_color)
draw_text(x, y + line_height * 1, 180, line_height, s1, 2)
draw_text(x, y + line_height * 3, 180, line_height, s2, 2)
end
#--------------------------------------------------------------------------
# * Draw Parameters
#--------------------------------------------------------------------------
def draw_parameters(x, y)
6.times {|i| draw_actor_param(@actor, x, y + line_height * i, i + 2) }
end
#--------------------------------------------------------------------------
# * Draw Basic Information
#--------------------------------------------------------------------------
def draw_basic_info(x, y)
draw_actor_level(@actor, x+200, y + line_height * 5)
draw_level_up_pts(x+200, y + line_height * 7)
#draw_actor_icons(@actor, x, y + line_height * 1)
draw_actor_hp(@actor, x, y + line_height * 0)
draw_actor_mp(@actor, x, y + line_height * 1)
end
def draw_level_up_pts(x,y)
draw_text(x,y,200,24,"Points : " + @actor.level_up_pts.to_s)
end
end |