$VIPArcherScript ||= {};$VIPArcherScript[:reflect] = 20140917
module VIPArcher end
module VIPArcher::Reflect
Z = -1
REG_SY = {
1 => 30,
2 => 48,
3 => 54
};REG_SY.default = 0
end
class Game_CharacterBase ; attr_accessor :reflect_index , :reflect_name end
class Sprite_Reflect < Sprite_Character
include VIPArcher::Reflect
def initialize(viewport, character = nil)
character.reflect_name ||= character.character_name
character.reflect_index ||= character.character_index
super(viewport, character)
end
def update_position
self.mirror , self.x , self.z = true , @character.screen_x , Z
self.y = @character.screen_y - REG_SY[@character.region_id]
end
def update_other
self.opacity = @character.opacity - 40
self.blend_type = @character.blend_type
self.bush_depth = @character.bush_depth
self.visible = region_id? && !name_hide? && !note_hide?
self.visible = !@character.transparent if self.visible
end
def note_hide?
return unless @character.is_a?(Game_Event)
return if @character.list.nil?
@character.list.each do |command|
if command.code == 108 or command.code == 408
command.parameters.each do |line|
return true if line.include?("(reflecthide)")
end
end
end ; false
end
def name_hide? ; @character.character_name.include?("(reflecthide)") end
def region_id? ; REG_SY.has_key?(@character.region_id) end
def update_bitmap
return unless graphic_changed?
@character_name = @character.reflect_name
@character_index = @character.reflect_index
set_character_bitmap
end
def graphic_changed?
@character_name != @character.reflect_name ||
@character_index != @character.reflect_index
end
def update_src_rect
index = @character.reflect_index
pattern = @character.pattern < 3 ? @character.pattern : 1
sx = (index % 4 * 3 + pattern) * @cw
sy = (index / 4 * 4 + (8 - @character.direction) / 2) * @ch
self.src_rect.set(sx, sy, @cw, @ch)
end
def setup_new_effect ; end
end
class Spriteset_Map
alias reflect_create_characters create_characters
def create_characters
reflect_create_characters
@character_reflect_sprites = []
$game_map.events.values.each do |event|
@character_reflect_sprites.push(Sprite_Reflect.new(@viewport1, event))
end
$game_player.followers.reverse_each do |follower|
@character_reflect_sprites.push(Sprite_Reflect.new(@viewport1,follower))
end
@character_reflect_sprites.push(Sprite_Reflect.new(@viewport1,$game_player))
end
alias reflect_dispose_characters dispose_characters
def dispose_characters
reflect_dispose_characters
@character_reflect_sprites.each {|sprite| sprite.dispose }
end
alias reflect_update_characters update_characters
def update_characters
reflect_update_characters
@character_reflect_sprites.each {|sprite| sprite.update }
end
end