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
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
| #==============================================================================
# +++ MOG - Battle Cursor (1.0) +++
#==============================================================================
# By Moghunter
# http://www.atelier-rgss.com/
# traduit par Ryukko le 29-03-2013
#==============================================================================
# Sistema de cursor animado de batalha nos sprites dos battlers.
#==============================================================================
# Images nécessaires à placer dans Graphics/System dans les dossiers projets :
#
# Battle_Cursor.png
#==============================================================================
#==============================================================================
# ■ REGLAGES CURSEUR
#==============================================================================
module MOG_BATTLE_CURSOR
# Paramètre de la position du curseur par rapport à la cible
CURSOR_POSITION = [-45, -16]
# Paramètre la position du nom de la cible
CURSOR_NAME_POSITION = [-10, 35]
# Active l'effet de glisse
CURSOR_SLIDE_EFFECT = true
# Active l'effet de lévitation
CURSOR_FLOAT_EFFECT = true
# Priorité d'affichage du curseur
CURSOR_Z = 0
end
#==============================================================================
# ■ Game Temp
#==============================================================================
class Game_Temp
attr_accessor :battle_cursor
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_battle_cursor_initialize initialize
def initialize
@battle_cursor = [0,0,false,""]
mog_battle_cursor_initialize
end
end
#==============================================================================
# ■ Spriteset Battle Cursor
#==============================================================================
class Sprite_Battle_Cursor < Sprite
include MOG_BATTLE_CURSOR
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize(viewport = nil)
super(viewport)
$game_temp.battle_cursor = [0,0,false,""]
self.bitmap = Cache.system("Battle_Cursor")
self.visible = $game_temp.battle_cursor[2]
self.z = CURSOR_Z
self.z = 10 if $mog_rgss3_battle_hud != nil
@cursor_name = Sprite.new
@cursor_name.bitmap = Bitmap.new(120,32)
@cursor_name.z = self.z + 1
@cursor_name.bitmap.font.size = 16
@cursor_name_enemy = $game_temp.battle_cursor[3]
@cursor_name_position = [CURSOR_NAME_POSITION[0] ,CURSOR_NAME_POSITION[1]]
@cursor_float = [0,0]
refresh_cursor_name
end
#--------------------------------------------------------------------------
# ● Dispose Sprite
#--------------------------------------------------------------------------
def dispose
super
dispose_sprite_cursor
end
#--------------------------------------------------------------------------
# ● Dispose Sprite Cursor
#--------------------------------------------------------------------------
def dispose_sprite_cursor
if @cursor_name != nil
@cursor_name.bitmap.dispose
@cursor_name.dispose
end
self.bitmap.dispose
end
#--------------------------------------------------------------------------
# ● Refresh Cursor Name
#--------------------------------------------------------------------------
def refresh_cursor_name
@cursor_name_enemy = $game_temp.battle_cursor[3]
@cursor_name.bitmap.clear
@cursor_name.bitmap.draw_text(0,0,120,32,@cursor_name_enemy.to_s,1)
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
super
update_sprite_cursor
end
#--------------------------------------------------------------------------
# ● Update Sprite Cursor
#--------------------------------------------------------------------------
def update_sprite_cursor
update_visible
update_cursor_float_effect
execute_move(0,self.x,$game_temp.battle_cursor[0])
execute_move(1,self.y,$game_temp.battle_cursor[1] + @cursor_float[1])
update_sprite_name
end
#--------------------------------------------------------------------------
# ● Update Visible
#--------------------------------------------------------------------------
def update_visible
self.visible = $game_temp.battle_cursor[2]
if !self.visible
self.x = -64
self.y = -64
end
end
#--------------------------------------------------------------------------
# ● Update Sprite Name
#--------------------------------------------------------------------------
def update_sprite_name
return if @cursor_name == nil
refresh_cursor_name if @cursor_name_enemy != $game_temp.battle_cursor[3]
@cursor_name.x = self.x + @cursor_name_position[0]
@cursor_name.y = self.y + @cursor_name_position[1]
@cursor_name.opacity = self.opacity
@cursor_name.visible = self.visible
end
#--------------------------------------------------------------------------
# ● Update Cursor Float Effect
#--------------------------------------------------------------------------
def update_cursor_float_effect
return if !CURSOR_FLOAT_EFFECT
@cursor_float[0] += 1
case @cursor_float[0]
when 0..20
@cursor_float[1] += 1
when 21..40
@cursor_float[1] -= 1
else
@cursor_float[0] = 0
@cursor_float[1] = 0
end
end
#--------------------------------------------------------------------------
# ● Execute Move
#--------------------------------------------------------------------------
def execute_move(type,cp,np)
sp = 5 + ((cp - np).abs / 5)
if cp > np
cp -= sp
cp = np if cp < np
elsif cp < np
cp += sp
cp = np if cp > np
end
self.x = cp if type == 0
self.y = cp if type == 1
end
end
#==============================================================================
# ■ Spriteset Battle
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
alias mog_battle_cursor_initialize initialize
def initialize
mog_battle_cursor_initialize
create_cursor
end
#--------------------------------------------------------------------------
# ● Dispose
#--------------------------------------------------------------------------
alias mog_battle_cursor_dispose dispose
def dispose
mog_battle_cursor_dispose
dispose_cursor
end
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
alias mog_battle_cursor_update update
def update
mog_battle_cursor_update
update_battle_cursor
end
#--------------------------------------------------------------------------
# ● Create_Cursor
#--------------------------------------------------------------------------
def create_cursor
return if @battle_cursor != nil
@battle_cursor = Sprite_Battle_Cursor.new
end
#--------------------------------------------------------------------------
# ● Dispose Cursor
#--------------------------------------------------------------------------
def dispose_cursor
return if @battle_cursor == nil
@battle_cursor.dispose
end
#--------------------------------------------------------------------------
# ● Update Battle Cursor
#--------------------------------------------------------------------------
def update_battle_cursor
return if @battle_cursor == nil
@battle_cursor.update
end
end
#==============================================================================
# ■ Battle Cursor Index
#==============================================================================
module Battle_Cursor_index
include MOG_BATTLE_CURSOR
#--------------------------------------------------------------------------
# ● Check Index Limit
#--------------------------------------------------------------------------
def check_index_limit
self.index = 0 if self.index >= item_max
self.index = (item_max - 1) if self.index < 0
end
#--------------------------------------------------------------------------
# ● Set Cursor Position Enemy
#--------------------------------------------------------------------------
def set_cursor_position_enemy
return if !self.active
$game_temp.battle_cursor[0] = $game_troop.alive_members[self.index].screen_x + CURSOR_POSITION[0] rescue nil
$game_temp.battle_cursor[1] = $game_troop.alive_members[self.index].screen_y + CURSOR_POSITION[1] rescue nil
$game_temp.battle_cursor[3] = $game_troop.alive_members[self.index].name rescue nil
$game_temp.battle_cursor = [0,0,false,0] if $game_temp.battle_cursor[0] == nil
end
#--------------------------------------------------------------------------
# ● Set Cursor Position Actor
#--------------------------------------------------------------------------
def set_cursor_position_actor
return if !self.active
$game_temp.battle_cursor[0] = $game_party.members[self.index].screen_x + CURSOR_POSITION[0] rescue nil
$game_temp.battle_cursor[1] = $game_party.members[self.index].screen_y + CURSOR_POSITION[1] rescue nil
$game_temp.battle_cursor[3] = $game_party.members[self.index].name rescue nil
$game_temp.battle_cursor = [0,0,false,0] if $game_temp.battle_cursor[0] == nil
end
#--------------------------------------------------------------------------
# ● Process Cursor Move
#--------------------------------------------------------------------------
def process_cursor_move
return unless cursor_movable?
last_index = @index
cursor_move_index(+1) if Input.repeat?(:DOWN)
cursor_move_index(-1) if Input.repeat?(:UP)
cursor_move_index(+1) if Input.repeat?(:RIGHT)
cursor_move_index(-1) if Input.repeat?(:LEFT)
if @index != last_index
Sound.play_cursor
end
end
#--------------------------------------------------------------------------
# ● Process Cursor Move Index
#--------------------------------------------------------------------------
def cursor_move_index(value = 0)
self.index += value
check_index_limit
end
end
#==============================================================================
# ■ Window_BattleActor
#==============================================================================
class Window_BattleActor < Window_BattleStatus
include Battle_Cursor_index
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
super
set_cursor_position_actor
end
#--------------------------------------------------------------------------
# ● Show
#--------------------------------------------------------------------------
alias mog_battle_cursor_show show
def show
if @info_viewport
set_cursor_position_actor
$game_temp.battle_cursor[2] = true
end
mog_battle_cursor_show
end
#--------------------------------------------------------------------------
# ● Hide
#--------------------------------------------------------------------------
alias mog_battle_cursor_hide hide
def hide
if @info_viewport
$game_temp.battle_cursor[2] = false
end
mog_battle_cursor_hide
end
end
#==============================================================================
# ■ Window_BattleEnemy
#==============================================================================
class Window_BattleEnemy < Window_Selectable
include Battle_Cursor_index
#--------------------------------------------------------------------------
# ● Update
#--------------------------------------------------------------------------
def update
super
set_cursor_position_enemy
end
#--------------------------------------------------------------------------
# ● Show
#--------------------------------------------------------------------------
alias mog_battle_cursor_show show
def show
if @info_viewport
set_cursor_position_enemy
$game_temp.battle_cursor[2] = true
end
mog_battle_cursor_show
end
#--------------------------------------------------------------------------
# ● Hide
#--------------------------------------------------------------------------
alias mog_battle_cursor_hide hide
def hide
if @info_viewport
$game_temp.battle_cursor[2] = false
end
mog_battle_cursor_hide
end
end
$mog_rgss3_battle_cursor = true |