#==============================================================================
# □ 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 = 50#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
#--------------------------------------------------------------------------
# ○ 視界制限スプライトの作成
#--------------------------------------------------------------------------
def create_sight_shadow
@sight_shadow_sprite = Sprite_SightShadow.new(@viewport2)
update_sight_shadow
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
alias tmblsight_spriteset_map_dispose dispose
def dispose
tmblsight_spriteset_map_dispose
dispose_sight_shadow
end
#--------------------------------------------------------------------------
# ○ 視界制限スプライトの解放
#--------------------------------------------------------------------------
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
#--------------------------------------------------------------------------
# ○ 視界制限スプライトの更新
#--------------------------------------------------------------------------
def update_sight_shadow
@sight_shadow_sprite.update if @sight_shadow_sprite
end
end