#==============================================================================
# □ RPG::BaseItem
#==============================================================================
class RPG::BaseItem
#--------------------------------------------------------------------------
# ○ 视界制限补正値
#--------------------------------------------------------------------------
def sight_power
unless @sight_power
@sight_power = /<视界补正\s*(\-*\d+)\s*>/ =~ @note ? $1.to_i : 0
end
@sight_power
end
end
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor
#--------------------------------------------------------------------------
# ○ 视界制限补正値
#--------------------------------------------------------------------------
def sight_power
result = 0
feature_objects.each {|object| result += object.sight_power}
result
end
end
#==============================================================================
# □ Sprite_SightShadow
#==============================================================================
class Sprite_SightShadow < Sprite
#--------------------------------------------------------------------------
# ● 物件初期化
#--------------------------------------------------------------------------
def initialize(viewport = nil)
super(viewport)
self.z = 199
self.bitmap = Bitmap.new(Graphics.width, Graphics.height)
@bitmap_shadow = Bitmap.new("Graphics/System/sight_shadow")
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
def dispose
self.bitmap.dispose
@bitmap_shadow.dispose
super
end
#--------------------------------------------------------------------------
# ● 帧更新
#--------------------------------------------------------------------------
def update
super
if TMBLSIGHT::SIGHT[$game_map.map_id]
self.visible = true
self.bitmap.clear
w = TMBLSIGHT::SIGHT[$game_map.map_id]
$game_party.battle_members.each{|actor| w = [w + actor.sight_power, 48].max}
w = [w + $game_variables[TMBLSIGHT::VN_SIGHT], 48].max
x = $game_player.screen_x - w / 2
y = $game_player.screen_y - w / 2 - 16
rect = Rect.new(x, y, w, w)
self.bitmap.stretch_blt(rect, @bitmap_shadow, @bitmap_shadow.rect)
color = Color.new(0, 0, 0)
self.bitmap.fill_rect(0, 0, Graphics.width, y, color)
self.bitmap.fill_rect(0, y + w, Graphics.width, Graphics.height - y - w,
color)
self.bitmap.fill_rect(0, y, x, w, color)
self.bitmap.fill_rect(x + w, y, Graphics.width - x - w, w, color)
else
self.visible = false
end
end
end
#==============================================================================
# ■ Spriteset_Map
#==============================================================================
class Spriteset_Map
#--------------------------------------------------------------------------
# ● 物件初期化
#--------------------------------------------------------------------------
alias tmblsight_spriteset_map_initialize initialize
def initialize
tmblsight_spriteset_map_initialize
create_sight_shadow
end
#--------------------------------------------------------------------------
# ○ 作成视界制限Sprite
#--------------------------------------------------------------------------
def create_sight_shadow
@sight_shadow_sprite = Sprite_SightShadow.new(@viewport2)
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
alias tmblsight_spriteset_map_dispose dispose
def dispose
tmblsight_spriteset_map_dispose
dispose_sight_shadow
end
#--------------------------------------------------------------------------
# ○ 解放视界制限Sprites
#--------------------------------------------------------------------------
def dispose_sight_shadow
@sight_shadow_sprite.dispose
end
#--------------------------------------------------------------------------
# ● 帧更新
#--------------------------------------------------------------------------
alias tmblsight_spriteset_map_update update
def update
update_sight_shadow
tmblsight_spriteset_map_update
end
#--------------------------------------------------------------------------
# ○ 更新视界制限Sprites
#--------------------------------------------------------------------------
def update_sight_shadow
@sight_shadow_sprite.update if @sight_shadow_sprite
end
end