#================================================================
# ■ Reflejo en el agua
# Basado en Sprite_Mirror, modificado por JmsPlDnl y reescrito por Rataime
# Traducción por: D.A.C.
#================================================================
# Activa la compatibilidad con el 'Caterpillar' (True = Sí / False = No)
CATERPILLAR_COMPATIBLE = true
class Game_Party
attr_reader :characters
end
class Sprite_Reflection < RPG::Sprite
attr_accessor :character
def initialize(viewport=nil, character=nil,self_angle = 180)
super(viewport)
[MENTION=31437]Char[/MENTION]acter = character
@self_angle=self_angle
self.opacity=0
@reflected=false
@former=false
@moving=false
if $game_map.terrain_tag [MENTION=31437]Char[/MENTION]acter.real_x/128 [MENTION=31437]Char[/MENTION]acter.real_y/128+1)==1
@reflected=true
@former=true
end
update
end
def update
super
if @tile_id != [MENTION=31437]Char[/MENTION]acter.tile_id or
[MENTION=31437]Char[/MENTION]acter_name != [MENTION=31437]Char[/MENTION]acter.character_name or
[MENTION=31437]Char[/MENTION]acter_hue != [MENTION=31437]Char[/MENTION]acter.character_hue
@tile_id = [MENTION=31437]Char[/MENTION]acter.tile_id
[MENTION=31437]Char[/MENTION]acter_name = [MENTION=31437]Char[/MENTION]acter.character_name
[MENTION=31437]Char[/MENTION]acter_hue = [MENTION=31437]Char[/MENTION]acter.character_hue
if @tile_id >= 384
self.bitmap = RPG::Cache.tile($game_map.tileset_name,
@tile_id, [MENTION=31437]Char[/MENTION]acter.character_hue)
self.src_rect.set(0, 0, 32, 32)
self.ox = 16
self.oy = 32
else
self.bitmap = RPG::Cache.character [MENTION=31437]Char[/MENTION]acter.character_name,
[MENTION=31437]Char[/MENTION]acter.character_hue)
@cw = bitmap.width / 4
@ch = bitmap.height / 4
self.ox = @cw / 2
self.oy = @ch
end
end
self.visible = (not [MENTION=31437]Char[/MENTION]acter.transparent)
if @tile_id == 0
sx = [MENTION=31437]Char[/MENTION]acter.pattern) * @cw
sy = [MENTION=31437]Char[/MENTION]acter.direction - 2) / 2 * @ch
if [MENTION=31437]Char[/MENTION]acter.direction== 6
sy = ( 4- 2) / 2 * @ch
end
if [MENTION=31437]Char[/MENTION]acter.direction== 4
sy = ( 6- 2) / 2 * @ch
end
if [MENTION=31437]Char[/MENTION]acter.direction != 4 and [MENTION=31437]Char[/MENTION]acter.direction != 6
sy = [MENTION=31437]Char[/MENTION]acter.direction - 2) / 2 * @ch
end
end
self.x = [MENTION=31437]Char[/MENTION]acter.screen_x
self.y = [MENTION=31437]Char[/MENTION]acter.screen_y-5
@moving=! [MENTION=31437]Char[/MENTION]acter.real_x%128==0 and [MENTION=31437]Char[/MENTION]acter.real_y%128==0)
@d [MENTION=31437]Char[/MENTION]acter.direction
@rect=[sx, sy, @cw, @ch]
if !(@moving)
if $game_map.terrain_tag [MENTION=31437]Char[/MENTION]acter.real_x/128 [MENTION=31437]Char[/MENTION]acter.real_y/128+1)==1
@reflected=true
@former=true
else
@reflected=false
@former=false
end
else
case @d
when 2
if $game_map.terrain_tag [MENTION=31437]Char[/MENTION]acter.real_x/128 [MENTION=31437]Char[/MENTION]acter.real_y/128+2)==1
@reflected=true
if @former==false
@offset = [MENTION=31437]Char[/MENTION]acter.screen_y%32)*@ch/32
@rect=[sx, sy, @cw, @offset]
self.y [MENTION=31437]Char[/MENTION]acter.screen_y-5
end
else
@reflected=false
end
when 4
if $game_map.terrain_tag [MENTION=31437]Char[/MENTION]acter.real_x/128 [MENTION=31437]Char[/MENTION]acter.real_y/128+1)!=1
@offset = ( [MENTION=31437]Char[/MENTION]acter.screen_x-@cw/2)%32)*@cw/32
@rect=[sx, sy, @offset, @ch]
self.x [MENTION=31437]Char[/MENTION]acter.screen_x
else
@reflected=true
if @former==false
@offset = ( [MENTION=31437]Char[/MENTION]acter.screen_x-@cw/2)%32)*@cw/32
@rect=[sx+@offset, sy, @cw-@offset, @ch]
self.x [MENTION=31437]Char[/MENTION]acter.screen_x-@offset
end
end
when 6
if $game_map.terrain_tag [MENTION=31437]Char[/MENTION]acter.real_x/128+1 [MENTION=31437]Char[/MENTION]acter.real_y/128+1)!=1
@offset = ( [MENTION=31437]Char[/MENTION]acter.screen_x-@cw/2)%32)*@cw/32
@rect=[sx+@offset, sy, @cw-@offset, @ch]
self.x [MENTION=31437]Char[/MENTION]acter.screen_x-@offset
else
@reflected=true
if @former==false
@offset = ( [MENTION=31437]Char[/MENTION]acter.screen_x-@cw/2)%32)*@cw/32
@rect=[sx, sy, @offset, @ch]
self.x [MENTION=31437]Char[/MENTION]acter.screen_x
end
end
when 8
if $game_map.terrain_tag [MENTION=31437]Char[/MENTION]acter.real_x/128 [MENTION=31437]Char[/MENTION]acter.real_y/128+2)==1
@reflected=true
if $game_map.terrain_tag [MENTION=31437]Char[/MENTION]acter.real_x/128 [MENTION=31437]Char[/MENTION]acter.real_y/128+1)!=1
@offset = [MENTION=31437]Char[/MENTION]acter.screen_y%32)*@ch/32
@rect=[sx, sy, @cw, @offset]
self.y [MENTION=31437]Char[/MENTION]acter.screen_y-5
end
else
@reflected=false
end
end
end
if @reflected
self.opacity=128
else
@rect=[sx, sy, @cw, @ch]
self.opacity=0
end
if $game_map.terrain_tag( [MENTION=31437]Char[/MENTION]acter.real_x+64)/128 [MENTION=31437]Char[/MENTION]acter.real_y/128+2)!=1
if $game_map.terrain_tag( [MENTION=31437]Char[/MENTION]acter.real_x+64)/128 [MENTION=31437]Char[/MENTION]acter.real_y/128+2)!=1
@rect[1]= @rect[1]+@ch/2
@rect[3]= @rect[3]/2
self.y = self.y - @ch/2
else
@reflected=false
end
end
self.src_rect.set(@rect[0],@rect[1],@rect[2],@rect[3])
[MENTION=31437]Char[/MENTION]acter.is_a?(Game_Player) ? self.z = 9 : self.z = 5
self.blend_type = [MENTION=31437]Char[/MENTION]acter.blend_type
self.bush_depth = [MENTION=31437]Char[/MENTION]acter.bush_depth
if [MENTION=31437]Char[/MENTION]acter.animation_id != 0
animation = $data_animations [MENTION=31437]Char[/MENTION]acter.animation_id]
animation(animation, true)
[MENTION=31437]Char[/MENTION]acter.animation_id = 0
end
self.angle = @self_angle
end
end
#================================================================
# ▼ CLASS Sprite_Character (edición)
#================================================================
class Sprite_Character < RPG::Sprite
alias reflect_initialize initialize
def initialize(viewport, character = nil)
[MENTION=31437]Char[/MENTION]acter = character
@reflection = []
super(viewport)
if (character.is_a?(Game_Event) and character.list!=nil and character.list[0].code == 108 and character.list[0].parameters == ["r"])
@reflection.push(Sprite_Reflection.new(viewport [MENTION=31437]Char[/MENTION]acter))
end
if (character.is_a?(Game_Event) and character.list!=nil and character.list[0].code == 108 and character.list[0].parameters == ["hero_r"])
@reflection.push(Sprite_Reflection.new(viewport,$game_player))
#================================================================
# ● Compatibilidad con el script 'Caterpillar' de Fukuyama
#================================================================
if CATERPILLAR_COMPATIBLE and $game_party.characters!=nil
for member in $game_party.characters
@reflection.push(Sprite_Reflection.new(viewport,member))
end
end
#================================================================
# ● Fin de compatibilidad
#================================================================
end
reflect_initialize(viewport, [MENTION=31437]Char[/MENTION]acter)
end
alias reflect_update update
def update
reflect_update
if @reflection!=nil
for reflect in @reflection
reflect.update
end
end
end
end