#战斗时用箭头指定敌人
#==============================================================================
# +++ MOG - Battle Cursor (1.0) +++
#==============================================================================
# By Moghunter
# [url]http://www.atelier-rgss.com/[/url]
#==============================================================================
# Sistema de cursor animado de batalha nos sprites dos battlers.
#==============================================================================
# Arquivo necessário. (Graphics/System)
#
# Battle_Cursor.png
#
#==============================================================================
#==============================================================================
# ■ CURSOR SETTING
#==============================================================================
module MOG_BATTLE_CURSOR
#Definição da posição do cursor em relação ao alvo.
CURSOR_POSITION = [-20, -16]
#Definição da posição do nome do alvo.
CURSOR_NAME_POSITION = [-20, 35]
#Ativar efeito deslizar.
CURSOR_SLIDE_EFFECT = true
#Ativar animação de levitação.
CURSOR_FLOAT_EFFECT = true
#Definição da prioridade do cursor.
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