| 
本帖最后由 杂兵天下 于 2012-2-10 19:15 编辑
x
加入我们,或者,欢迎回来。您需要 登录 才可以下载或查看,没有帐号?注册会员  
 作者:tomoaky
 作者个人网站:(http://hikimoki.sakura.ne.jp/)
 
 #==============================================================================# ★ RGSS3_視界制限 Ver1.0#===============================================================================begin 作者:tomoaky作者个人网站:([url]http://hikimoki.sakura.ne.jp/[/url]) 可以设定烛光范围 状态、職業、武器(防具)、角色放入<视界补正 32>这类标签例)<视界补正 32>視界会增加32。必须有图像:  Graphics/System/sight_shadow.png  2012.01.20  Ver1.0  公開 =end module TMBLSIGHT  # 例)SIGHT[3] = 128  # 地图3的视界是128  SIGHT = {}  #SIGHT[4] = 256endclass RPG::BaseItem  def sight_power    unless @sight_power      @sight_power = /<视界补正\s*(\-*\d+)\s*>/ =~ @note ? $1.to_i : 0    end    @sight_power  endendclass Game_Actor  def sight_power    result = 0    p feature_objects    feature_objects.each {|object| result += object.sight_power}    result  endendclass Sprite_SightShadow < Sprite  def initialize(viewport = nil)    super(viewport)    self.z = 200    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    dq=TMBLSIGHT::SIGHT[$game_map.map_id]    $rfsh=0 if $rfsh.nil?    if $game_switches[8]==true      dq=512 unless dq    else      dq=0    end    if dq==0 or $rfsh!=0      self.visible = false    else      self.visible = true      self.bitmap.clear      w = dq      $game_party.battle_members.each{|actor| w = [w + actor.sight_power, 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)    end    $rfsh+=1    $rfsh=0 if $rfsh==5  endendclass Spriteset_Map  alias tmblsight_spriteset_map_initialize initialize  def initialize    @sight_shadow_sprite = Sprite_SightShadow.new    tmblsight_spriteset_map_initialize  end  alias tmblsight_spriteset_map_dispose dispose  def dispose    tmblsight_spriteset_map_dispose    @sight_shadow_sprite.dispose  end  alias tmblsight_spriteset_map_update update  def update    @sight_shadow_sprite.update    tmblsight_spriteset_map_update  endend
#============================================================================== 
# ★ RGSS3_視界制限 Ver1.0 
#============================================================================== 
=begin 
  
作者:tomoaky 
作者个人网站:([url]http://hikimoki.sakura.ne.jp/[/url]) 
  
可以设定烛光范围 
  
状态、職業、武器(防具)、角色放入<视界补正 32>这类标签 
例)<视界补正 32> 
視界会增加32。 
必须有图像: 
  Graphics/System/sight_shadow.png 
   
2012.01.20  Ver1.0 
  公開 
  
=end 
  
module TMBLSIGHT 
  # 例)SIGHT[3] = 128  # 地图3的视界是128 
  SIGHT = {} 
  #SIGHT[4] = 256 
end 
class RPG::BaseItem 
  def sight_power 
    unless @sight_power 
      @sight_power = /<视界补正\s*(\-*\d+)\s*>/ =~ @note ? $1.to_i : 0 
    end 
    @sight_power 
  end 
end 
class Game_Actor 
  def sight_power 
    result = 0 
    p feature_objects 
    feature_objects.each {|object| result += object.sight_power} 
    result 
  end 
end 
class Sprite_SightShadow < Sprite 
  def initialize(viewport = nil) 
    super(viewport) 
    self.z = 200 
    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 
    dq=TMBLSIGHT::SIGHT[$game_map.map_id] 
    $rfsh=0 if $rfsh.nil? 
    if $game_switches[8]==true 
      dq=512 unless dq 
    else 
      dq=0 
    end 
    if dq==0 or $rfsh!=0 
      self.visible = false 
    else 
      self.visible = true 
      self.bitmap.clear 
      w = dq 
      $game_party.battle_members.each{|actor| w = [w + actor.sight_power, 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) 
    end 
    $rfsh+=1 
    $rfsh=0 if $rfsh==5 
  end 
end 
class Spriteset_Map 
  alias tmblsight_spriteset_map_initialize initialize 
  def initialize 
    @sight_shadow_sprite = Sprite_SightShadow.new 
    tmblsight_spriteset_map_initialize 
  end 
  alias tmblsight_spriteset_map_dispose dispose 
  def dispose 
    tmblsight_spriteset_map_dispose 
    @sight_shadow_sprite.dispose 
  end 
  alias tmblsight_spriteset_map_update update 
  def update 
    @sight_shadow_sprite.update 
    tmblsight_spriteset_map_update 
  end 
end 
 |