设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1953|回复: 2
打印 上一主题 下一主题

[已经过期] 关于怪物图鉴问题

[复制链接]

Lv1.梦旅人

梦石
0
星屑
168
在线时间
112 小时
注册时间
2014-2-4
帖子
50
跳转到指定楼层
1
发表于 2014-4-6 16:41:09 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
这是一个怪物图鉴脚本!可是用后出现了这种状况
#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================
#——————————————————————————————————————
#魔物图鉴+介绍
#
#战斗终了时自动添加敌人进入图鉴(class Scene_Battle start_phase5 追加。目前与各种战斗系统没有发现冲突)
#不想加入图鉴的怪物设置其“不加入图鉴”属性有效度为A即可
#图鉴完成度的表示功能追加
#SHOW_COMPLETE_TYPE 的数值可以设定
#当为1,显示现有个数/总数,当为2,显示完成百分比,当为3,全显示。
#使用方法:$scene = Scene_MonsterBook.new
#数据库中属性里面那些种族特效的位置,建议把默认的“对 不死”之类改成“不死”,不然显示会很奇怪
#由于雷达图的设计问题,只支持8项属性
#默认种族特效处理属性中编号9到编号16,如果你做了修改请自行改动380行左右的for i in 9..16这一句代码
#显示各种信息位于630行左右,想不显示的话只要删除相应语句
CHARA_INFO=[]#怪物的介绍,对应怪物id,空格为换行,同时也会自动换行,没有写介绍的怪物会自动显示“无详细信息”
CHARA_INFO[1] = "怪物介绍1"
CHARA_INFO[2] = "怪物介绍2"
CHARA_INFO[3] = "生活在潮湿的沼泽地区的变异生物,性情凶暴,经常会袭击各种路过的生物"
#没有信息测试,4号怪物
#=============
#雷达图相关处理部分
#=============
class Bitmap
def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
distance = (start_x - end_x).abs + (start_y - end_y).abs
if end_color == start_color
for i in 1..distance
x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
if width == 1
self.set_pixel(x, y, start_color)
else
self.fill_rect(x, y, width, width, start_color)
end
end
else
for i in 1..distance
x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
r = start_color.red * (distance-i)/distance + end_color.red * i/distance
g = start_color.green * (distance-i)/distance + end_color.green * i/distance
b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
if width == 1
self.set_pixel(x, y, Color.new(r, g, b, a))
else
self.fill_rect(x, y, width, width, Color.new(r, g, b, a))
end
end
end
end
end
#=============
# Graphic_Def_Elem
#=============
class Window_Base
FONT_SIZE = 18
WORD_ELEMENT_GUARD = "属性有效度"
NUMBER_OF_ELEMENTS = 8
ELEMENT_ORDER = [1,3,8,5,2,4,7,6]
GRAPH_SCALINE_COLOR = Color.new(255, 255, 255, 128)
GRAPH_SCALINE_COLOR_SHADOW = Color.new( 0, 0, 0, 192)
GRAPH_LINE_COLOR = Color.new(255, 255, 64, 255)
GRAPH_LINE_COLOR_MINUS = Color.new( 64, 255, 255, 255)
GRAPH_LINE_COLOR_PLUS = Color.new(255, 64, 64, 255)
end

#——————————————————————————————————————
module Enemy_Book_Config
DROP_ITEM_NEED_ANALYZE = true #显示物品
EVA_NAME = "回避修正"              #回避修正的名称(因为数据库中没有定义)
SHOW_COMPLETE_TYPE = 3         #图鉴完成率表示方法
end
class Data_MonsterBook
#--------------------------------------------------------------------------
# ● 图鉴用ID設定
#--------------------------------------------------------------------------
def enemy_book_id_set
   data = [0]
   data[1] = 2
   data[2] = 1
   data[3] = 15
   data[4] = 25
   data[5] = 18
   data[6] = 30
   return data
end
end
class Game_Temp
attr_accessor :enemy_book_data
alias temp_enemy_book_data_initialize initialize
def initialize
   temp_enemy_book_data_initialize
   @enemy_book_data = Data_MonsterBook.new
end
end

class Game_Party
#==============================================
#--------------------------------------------------------------------------
  # ● 公開インスタンス変数
  #--------------------------------------------------------------------------
  attr_reader   :actors                   # アクター
  attr_reader   :gold                     # ゴールド
  attr_reader   :steps                    # 歩数
  
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize
    # アクターの配列を作成
    @actors = []
    # ゴールドと歩数を初期化
    @gold = 0
    @steps = 0
    # アイテム、武器、防具の所持数ハッシュを作成
    @items = {}
    @weapons = {}
    @armors = {}
  end
#==============================================
attr_accessor :enemy_info               # 出会った敵情報(図鑑用)

#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias book_info_initialize initialize
def initialize
   book_info_initialize
   @enemy_info = {}
end

#--------------------------------------------------------------------------
# ● エネミー情報の追加(図鑑用)
#     type : 通常遭遇かアナライズか 0:通常 1:アナライズ -1:情報削除
#     0:無遭遇 1:遭遇済 2:アナライズ済
#--------------------------------------------------------------------------
def add_enemy_info(enemy_id, type = 0)
   case type
   when 0
     if @enemy_info[enemy_id] == 2
       return false
     end
     @enemy_info[enemy_id] = 1
   when 1
     @enemy_info[enemy_id] = 2
   when -1
     @enemy_info[enemy_id] = 0
   end
end
#--------------------------------------------------------------------------
# ● 魔物図鑑の最大登録数を取得
#--------------------------------------------------------------------------
def enemy_book_max
   return $game_temp.enemy_book_data.id_data.size - 1
end
#--------------------------------------------------------------------------
# ● 魔物図鑑の現在登録数を取得
#--------------------------------------------------------------------------
def enemy_book_now
   now_enemy_info = @enemy_info.keys
   # 登録無視の属性IDを取得
   no_add = $game_temp.enemy_book_data.no_add_element
   new_enemy_info = []
   for i in now_enemy_info
     enemy = $data_enemies
     next if enemy.name == ""
     if enemy.element_ranks[no_add] == 1
       next
     end
     new_enemy_info.push(enemy.id)
   end
   return new_enemy_info.size
end
#--------------------------------------------------------------------------
# ● 魔物図鑑の完成率を取得
#--------------------------------------------------------------------------
def enemy_book_complete_percentage
   e_max = enemy_book_max.to_f
   e_now = enemy_book_now.to_f
   comp = e_now / e_max * 100
   return comp.truncate
end
end

class Interpreter
def enemy_book_max
   return $game_party.enemy_book_max
end
def enemy_book_now
   return $game_party.enemy_book_now
end
def enemy_book_comp
   return $game_party.enemy_book_complete_percentage
end
end

class Scene_Battle
alias add_enemy_info_start_phase5 start_phase5
def start_phase5
   for enemy in $game_troop.enemies
     # エネミーが隠れ状態でない場合
     unless enemy.hidden
       # 敵遭遇情報追加
       $game_party.add_enemy_info(enemy.id, 0)
     end
   end
   add_enemy_info_start_phase5
end
end

class Window_Base < Window
#--------------------------------------------------------------------------
# ● エネミーの戦闘後獲得アイテムの描画
#--------------------------------------------------------------------------
def draw_enemy_drop_item(enemy, x, y)
   self.contents.font.color = normal_color
   treasures = []
   if enemy.item_id > 0
     treasures.push($data_items[enemy.item_id])
   end
   if enemy.weapon_id > 0
     treasures.push($data_weapons[enemy.weapon_id])
   end
   if enemy.armor_id > 0
     treasures.push($data_armors[enemy.armor_id])
   end
   # 現状ではとりあえず1つのみ描画
   if treasures.size > 0
     item = treasures[0]
     bitmap = RPG::Cache.icon(item.icon_name)
     opacity = 255
     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
     name = treasures[0].name
   else
     self.contents.font.color = disabled_color
     name = "无"
   end
   self.contents.draw_text(x+28, y, 212, 32, name)
end
#--------------------------------------------------------------------------
# ● エネミーの図鑑IDの描画
#--------------------------------------------------------------------------
def draw_enemy_book_id(enemy, x, y)
   self.contents.font.color = normal_color
   id = $game_temp.enemy_book_data.id_data.index(enemy.id)
   self.contents.draw_text(x, y, 32, 32, id.to_s)
end
#--------------------------------------------------------------------------
# ● 敌人简介描绘
#--------------------------------------------------------------------------
def draw_enemy_other(enemy, x, y)
   if CHARA_INFO[enemy.id]==nil
    CHARA_INFO[enemy.id] = "没有相关资料"
  end
   self.contents.font.size=16
   x+=self.contents.text_size("").width
   info = CHARA_INFO[enemy.id]
   s=info.scan(/./)
    #一行显示21个字
    for i in s
      sss = self.contents.text_size(i)
      
      if  i==" "
        y+=16
        x=0
      elsif (x+sss.width)>(width - 32-260)
        y+=16
        x=0
        self.contents.draw_text(x, y, sss.width, sss.height, i)
        x+=sss.width
      else
      self.contents.draw_text(x, y, sss.width, sss.height, i)
      x+=sss.width
      end
    end
  end
   #--------------------------------------------------------------------------
# ● 敌人特技描绘
#--------------------------------------------------------------------------
def draw_enemy_action(enemy, x, y)
   self.contents.font.size=16
   yy=y
   self.contents.font.color = system_color
   self.contents.draw_text(x, yy, 80, 18,"行动列表")
   self.contents.font.color = normal_color
   for action in enemy.actions
     yy+=18
     if action.kind==0
       case action.basic
        when 0
          ac="普通攻击"
        when 1
          ac="防御"
        when 2
          ac="逃跑"
        when 3
          ac="无"
        end
     self.contents.draw_text(x, yy, 160, 18, ac )
     end
     if action.kind==1
     self.contents.draw_text(x, yy, 160, 18, $data_skills[action.skill_id].name )
     end
   end
end
#雷达图描绘
  #=======================================================================================
  def draw_actor_element_radar_graph(actor, x, y)
    radius = 56
cx = x + radius + FONT_SIZE + 48
cy = y + radius + FONT_SIZE + 32
self.contents.font.color = system_color
self.contents.draw_text(x, y, 104, 32, WORD_ELEMENT_GUARD)
for loop_i in 0..NUMBER_OF_ELEMENTS
if loop_i == 0

else
@pre_x = @now_x
@pre_y = @now_y
@pre_ex = @now_ex
@pre_ey = @now_ey
@color1 = @color2
end
if loop_i == NUMBER_OF_ELEMENTS
eo = ELEMENT_ORDER[0]
else
eo = ELEMENT_ORDER[loop_i]
end
er = actor.element_rate(eo)
estr = $data_system.elements[eo]
@color2 = er < 0 ? GRAPH_LINE_COLOR_MINUS : er > 100 ? GRAPH_LINE_COLOR_PLUS : GRAPH_LINE_COLOR
if er <0
  then xsh=true
else xsh=false
end
er = er.abs
th = Math::PI * (0.5 - 2.0 * loop_i / NUMBER_OF_ELEMENTS)
@now_x = cx + (radius * Math.cos(th)).floor
@now_y = cy - (radius * Math.sin(th)).floor
@now_wx = cx + ((radius+FONT_SIZE*2/2) * Math.cos(th)).floor - FONT_SIZE
@now_wy = cy - ((radius+FONT_SIZE*1/2) * Math.sin(th)).floor - FONT_SIZE/2
@now_vx = cx + ((radius+FONT_SIZE*6/2) * Math.cos(th)).floor - FONT_SIZE
@now_vy = cy - ((radius+FONT_SIZE*3/2) * Math.sin(th)).floor - FONT_SIZE/2
@now_ex = cx + (er*radius/100 * Math.cos(th)).floor
@now_ey = cy - (er*radius/100 * Math.sin(th)).floor
if loop_i == 0
@pre_x = @now_x
@pre_y = @now_y
@pre_ex = @now_ex
@pre_ey = @now_ey
@color1 = @color2
else

end
next if loop_i == 0
self.contents.draw_line(cx+1,cy+1, @now_x+1,@now_y+1, GRAPH_SCALINE_COLOR_SHADOW)
self.contents.draw_line(@pre_x+1,@pre_y+1, @now_x+1,@now_y+1, GRAPH_SCALINE_COLOR_SHADOW)
self.contents.draw_line(cx,cy, @now_x,@now_y, GRAPH_SCALINE_COLOR)
self.contents.draw_line(@pre_x,@pre_y, @now_x,@now_y, GRAPH_SCALINE_COLOR)
self.contents.draw_line(@pre_ex,@pre_ey, @now_ex,@now_ey, @color1, 2, @color2)
self.contents.font.size = FONT_SIZE
if xsh == true
  then self.contents.font.color = Color.new(100,255,128,128)
  sdd="-"
else self.contents.font.color = system_color
  sdd=""
end
self.contents.draw_text(@now_wx,@now_wy, FONT_SIZE*2, FONT_SIZE, estr, 1)
self.contents.font.color = Color.new(255,255,255,128)
self.contents.draw_text(@now_vx,@now_vy, FONT_SIZE*2, FONT_SIZE, sdd+er.to_s + "%", 2)
end
end
#_----------------------------------------------
def draw_race(enemy,x,y)
      text="无"
      text2="无"
      for i in 9..16
        if enemy.element_rate(i) == 200
        text = $data_system.elements
        end
        if enemy.element_rate(i) == 150
        text2 =$data_system.elements
        end
      end
      self.contents.font.color = system_color
      self.contents.draw_text(x, y, 80, 32,"主要种族")
      self.contents.font.color = normal_color
      self.contents.draw_text(x+80, y, 76, 32,text,2)
      self.contents.font.color = system_color
      self.contents.draw_text(x+160, y, 80, 32,"次要种族")
      self.contents.font.color = normal_color
      self.contents.draw_text(x+80+160, y, 76, 32,text2,2)
end
  
#--------------------------------------------------------------------------
# ● エネミーの名前の描画
#     enemy : エネミー
#     x     : 描画先 X 座標
#     y     : 描画先 Y 座標
#--------------------------------------------------------------------------
def draw_enemy_name(enemy, x, y)
   self.contents.font.color = normal_color
   self.contents.draw_text(x, y, 152, 32, enemy.name)
end
#--------------------------------------------------------------------------
# ● エネミーグラフィックの描画(アナライズ)
#     enemy : エネミー
#     x     : 描画先 X 座標
#     y     : 描画先 Y 座標
#--------------------------------------------------------------------------
def draw_enemy_graphic(enemy, x, y, opacity = 255)

end
#--------------------------------------------------------------------------
# ● エネミーの獲得EXPの描画
#     enemy : エネミー
#     x     : 描画先 X 座標
#     y     : 描画先 Y 座標
#--------------------------------------------------------------------------
def draw_enemy_exp(enemy, x, y)
   self.contents.font.color = system_color
   self.contents.draw_text(x, y, 120, 32, "EXP")
   self.contents.font.color = normal_color
   self.contents.draw_text(x + 120, y, 36, 32, enemy.exp.to_s, 2)
end
#--------------------------------------------------------------------------
# ● エネミーの獲得GOLDの描画
#     enemy : エネミー
#     x     : 描画先 X 座標
#     y     : 描画先 Y 座標
#--------------------------------------------------------------------------
def draw_enemy_gold(enemy, x, y)
   self.contents.font.color = system_color
   self.contents.draw_text(x, y, 120, 32, "掉落金钱")
   self.contents.font.color = normal_color
   self.contents.draw_text(x + 120, y, 36, 32, enemy.gold.to_s, 2)
end
end

class Game_Enemy_Book < Game_Enemy
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(enemy_id)
   super(2, 1)#ダミー
   @enemy_id = enemy_id
   enemy = $data_enemies[@enemy_id]
   @battler_name = enemy.battler_name
   @battler_hue = enemy.battler_hue
   @hp = maxhp
   @sp = maxsp
end
end

class Data_MonsterBook
attr_reader :id_data
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
   @id_data = enemy_book_id_set
end
#--------------------------------------------------------------------------
# ● 図鑑用登録無視属性取得
#--------------------------------------------------------------------------
def no_add_element
   no_add = 0
   # 登録無視の属性IDを取得
   for i in 1...$data_system.elements.size
     if $data_system.elements =~ /不加入图鉴/
       no_add = i
       break
     end
   end
   return no_add
end
#--------------------------------------------------------------------------
# ● 図鑑用敵ID設定
#--------------------------------------------------------------------------
def enemy_book_id_set
   data = [0]
   no_add = no_add_element
   # 登録無視の属性IDを取得
   for i in 1...$data_enemies.size
     enemy = $data_enemies
     next if enemy.name == ""
     if enemy.element_ranks[no_add] == 1
       next
     end
     data.push(enemy.id)
   end
   return data
end
end


class Window_MonsterBook < Window_Selectable
attr_reader   :data
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(index=0)
   super(0, 64, 640, 416)
   @column_max = 2
   @book_data = $game_temp.enemy_book_data
   @data = @book_data.id_data.dup
   @data.shift
   #@data.sort!
   @item_max = @data.size
   self.index = 0
   refresh if @item_max > 0
end
#--------------------------------------------------------------------------
# ● 遭遇データを取得
#--------------------------------------------------------------------------
def data_set
   data = $game_party.enemy_info.keys
   data.sort!
   newdata = []
   for i in data
     next if $game_party.enemy_info == 0
     # 図鑑登録無視を考慮
     if book_id(i) != nil
       newdata.push(i)
     end
   end
   return newdata
end
#--------------------------------------------------------------------------
# ● 表示許可取得
#--------------------------------------------------------------------------
def show?(id)
   if $game_party.enemy_info[id] == 0 or $game_party.enemy_info[id] == nil
     return false
   else
     return true
   end
end
#--------------------------------------------------------------------------
# ● 図鑑用ID取得
#--------------------------------------------------------------------------
def book_id(id)
   return @book_data.index(id)
end
#--------------------------------------------------------------------------
# ● エネミー取得
#--------------------------------------------------------------------------
def item
   return @data[self.index]
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
   if self.contents != nil
     self.contents.dispose
     self.contents = nil
   end
   self.contents = Bitmap.new(width - 32, row_max * 32)
   #項目数が 0 でなければビットマップを作成し、全項目を描画
   if @item_max > 0
     for i in 0...@item_max
      draw_item(i)
     end
   end
end
#--------------------------------------------------------------------------
# ● 項目の描画
#     index : 項目番号
#--------------------------------------------------------------------------
def draw_item(index)
   enemy = $data_enemies[@data[index]]
   return if enemy == nil
   x = 4 + index % 2 * (288 + 32)
   y = index / 2 * 32
   rect = Rect.new(x, y, self.width / @column_max - 32, 32)
   self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
   self.contents.font.color = normal_color
   draw_enemy_book_id(enemy, x, y)
   if show?(enemy.id)
     self.contents.draw_text(x + 28+16, y, 212, 32, enemy.name, 0)
   else
     self.contents.draw_text(x + 28+16, y, 212, 32, "-----", 0)
     return
   end
   if analyze?(@data[index])
     self.contents.font.color = text_color(3)
     self.contents.draw_text(x + 256, y, 24, 32, "済", 2)
   end
end
#--------------------------------------------------------------------------
# ● アナライズ済かどうか
#--------------------------------------------------------------------------
def analyze?(enemy_id)
   if $game_party.enemy_info[enemy_id] == 2
     return true
   else
     return false
   end
end
end


class Window_MonsterBook_Info < Window_Base
include Enemy_Book_Config
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
   super(0, 0+64, 640, 480-64)
   self.back_opacity=255
   self.contents = Bitmap.new(width - 32, height - 32)
   
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh(enemy_id)
   self.contents.clear
   self.contents.font.size = 22
   enemy = Game_Enemy_Book.new(enemy_id)
   @gra = Sprite_Enemy_Graphic.new(nil,enemy)
   @gra.z = 120      #怪物图片
   draw_enemy_book_id(enemy, 4, 0)    #各种详细信息
   draw_enemy_name(enemy, 48, 0)
   draw_actor_hp(enemy, 288, 0)
   draw_actor_sp(enemy, 288+160, 0)
   self.contents.font.size=18
   draw_actor_parameter(enemy, 288    ,  25, 0)
   self.contents.font.color = system_color
   self.contents.draw_text(288+160, 25, 120, 32, EVA_NAME)
   self.contents.font.color = normal_color
   self.contents.draw_text(288+160 + 120, 25, 36, 32, enemy.eva.to_s, 2)
   draw_actor_parameter(enemy, 288    ,  50, 3)
   draw_actor_parameter(enemy, 288+160,  50, 4)
   draw_actor_parameter(enemy, 288    ,  75, 5)
   draw_actor_parameter(enemy, 288+160,  75, 6)
   draw_actor_parameter(enemy, 288    , 100, 1)
   draw_actor_parameter(enemy, 288+160, 100, 2)
   draw_enemy_exp(enemy, 288, 125)
   draw_enemy_gold(enemy, 288+160, 125)
   draw_race(enemy, 288, 150)
   #--------------------------------------------------------------------
   draw_enemy_other(enemy, 0, 280)  #简介文字
   draw_enemy_action(enemy,200, 30)  #显示敌人行动
   draw_actor_element_radar_graph(enemy, 360, 180)#雷达图
   #--------------------------------------------------------------------
   if DROP_ITEM_NEED_ANALYZE==true  #掉落物品
     self.contents.font.color = system_color
        self.contents.font.size=16
     self.contents.draw_text(0, 235, 96, 32, "掉落物品")
     draw_enemy_drop_item(enemy, 128, 235)
     self.contents.font.color = normal_color
        self.contents.font.size=18
      end      
    end
def cl
       @gra.dispose
end
#--------------------------------------------------------------------------
# ● アナライズ済かどうか
#--------------------------------------------------------------------------
def analyze?(enemy_id)
   if $game_party.enemy_info[enemy_id] == 2
     return true
   else
     return false
   end
end
end


class Scene_MonsterBook
include Enemy_Book_Config
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
def main
   $game_temp.enemy_book_data = Data_MonsterBook.new
   # ウィンドウを作成
   @title_window = Window_Base.new(0, 0, 640, 64)
   @title_window.contents = Bitmap.new(640 - 32, 64 - 32)
   @title_window.contents.draw_text(4, 0, 320, 32, "魔物图鉴", 0)
   if SHOW_COMPLETE_TYPE != 0
     case SHOW_COMPLETE_TYPE
     when 1
       e_now = $game_party.enemy_book_now
       e_max = $game_party.enemy_book_max
       text = e_now.to_s + "/" + e_max.to_s
     when 2
       comp = $game_party.enemy_book_complete_percentage
       text = comp.to_s + "%"
     when 3
       e_now = $game_party.enemy_book_now
       e_max = $game_party.enemy_book_max
       comp = $game_party.enemy_book_complete_percentage
       text = e_now.to_s + "/" + e_max.to_s + " " + comp.to_s + "%"
     end
     if text != nil
       @title_window.contents.draw_text(320, 0, 288, 32,  text, 2)
     end
   end
   @main_window = Window_MonsterBook.new
   @main_window.active = true
   # インフォウィンドウを作成 (不可視・非アクティブに設定)
   @info_window = Window_MonsterBook_Info.new
   @info_window.z = 110
   @info_window.visible = false
   @info_window.active = false
   @visible_index = 0
   # トランジション実行
   Graphics.transition
   # メインループ
   loop do
     # ゲーム画面を更新
     Graphics.update
     # 入力情報を更新
     Input.update
     # フレーム更新
     update
     # 画面が切り替わったらループを中断
     if $scene != self
       break
     end
   end
   # トランジション準備
   Graphics.freeze
   # ウィンドウを解放
   @main_window.dispose
   @info_window.dispose
   @title_window.dispose
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
   # ウィンドウを更新
   @main_window.update
   @info_window.update
#   gra.update
   if @info_window.active
     update_info
     return
   end
   # メインウィンドウがアクティブの場合: update_target を呼ぶ
   if @main_window.active
     update_main
     return
   end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_main
   # B ボタンが押された場合
   if Input.trigger?(Input::B)
     # キャンセル SE を演奏
     $game_system.se_play($data_system.cancel_se)
     $scene = Scene_Menu.new(7)
     return
   end
   # C ボタンが押された場合
   if Input.trigger?(Input::C)
     if @main_window.item == nil or @main_window.show?(@main_window.item) == false
       # ブザー SE を演奏
       $game_system.se_play($data_system.buzzer_se)
       return
     end
     # 決定 SE を演奏
     $game_system.se_play($data_system.decision_se)
     @main_window.active = false
     @info_window.active = true
     @info_window.visible = true
     @visible_index = @main_window.index
     @info_window.refresh(@main_window.item)
     return
   end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (インフォウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_info
   # B ボタンが押された場合
   if Input.trigger?(Input::B)
     # キャンセル SE を演奏
     $game_system.se_play($data_system.cancel_se)
     @main_window.active = true
     @info_window.active = false
     @info_window.visible = false
     @info_window.cl
     return
   end
   # C ボタンが押された場合
   if Input.trigger?(Input::C)
     # 決定 SE を演奏
     #$game_system.se_play($data_system.decision_se)
     return
   end
   if Input.trigger?(Input::L)
     # 決定 SE を演奏
     $game_system.se_play($data_system.decision_se)
     loop_end = false
     while loop_end == false
       if @visible_index != 0
         @visible_index -= 1
       else
         @visible_index = @main_window.data.size - 1
       end
       loop_end = true if @main_window.show?(@main_window.data[@visible_index])
     end
     @info_window.cl
     id = @main_window.data[@visible_index]
     @info_window.refresh(id)
     return
   end
   if Input.trigger?(Input::R)
     # 決定 SE を演奏
     $game_system.se_play($data_system.decision_se)
     loop_end = false
     while loop_end == false
       if @visible_index != @main_window.data.size - 1
         @visible_index += 1
       else
         @visible_index = 0
       end
       loop_end = true if @main_window.show?(@main_window.data[@visible_index])
     end
     @info_window.cl
     id = @main_window.data[@visible_index]
     @info_window.refresh(id)
     return
   end
end
end
#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================
class Sprite_Enemy_Graphic< Sprite
  attr_accessor :enemy
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  def initialize(viewport,enemy)
    super(viewport)
    if @enemy != enemy
      self.bitmap = RPG::Cache.battler(enemy.battler_name, enemy.battler_hue)
      cw = self.bitmap.width
      ch = self.bitmap.height
    if cw>ch
     self.zoom_x=200.0/cw
     self.zoom_y=200.0/cw
   else
     self.zoom_x=200.0/ch
     self.zoom_y=200.0/ch     
   end
     self.x=10
     self.y=110
      @enemy=enemy
    end
  end
  #--------------------------------------------------------------------------
  # ● 解放
  #--------------------------------------------------------------------------
  def dispose
    if self.bitmap != nil
      self.bitmap.dispose
    end
    super
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def refresh(enemy)
  end
end

long56.png (10.69 KB, 下载次数: 7)

long56.png

Lv1.梦旅人

梦石
0
星屑
168
在线时间
112 小时
注册时间
2014-2-4
帖子
50
2
 楼主| 发表于 2014-4-6 17:05:32 | 只看该作者
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================
  4. #——————————————————————————————————————
  5. #魔物图鉴+介绍
  6. #
  7. #战斗终了时自动添加敌人进入图鉴(class Scene_Battle start_phase5 追加。目前与各种战斗系统没有发现冲突)
  8. #不想加入图鉴的怪物设置其“不加入图鉴”属性有效度为A即可
  9. #图鉴完成度的表示功能追加
  10. #SHOW_COMPLETE_TYPE 的数值可以设定
  11. #当为1,显示现有个数/总数,当为2,显示完成百分比,当为3,全显示。
  12. #使用方法:$scene = Scene_MonsterBook.new
  13. #数据库中属性里面那些种族特效的位置,建议把默认的“对 不死”之类改成“不死”,不然显示会很奇怪
  14. #由于雷达图的设计问题,只支持8项属性
  15. #默认种族特效处理属性中编号9到编号16,如果你做了修改请自行改动380行左右的for i in 9..16这一句代码
  16. #显示各种信息位于630行左右,想不显示的话只要删除相应语句
  17. CHARA_INFO=[]#怪物的介绍,对应怪物id,空格为换行,同时也会自动换行,没有写介绍的怪物会自动显示“无详细信息”
  18. CHARA_INFO[1] = "怪物介绍1"
  19. CHARA_INFO[2] = "怪物介绍2"
  20. CHARA_INFO[3] = "生活在潮湿的沼泽地区的变异生物,性情凶暴,经常会袭击各种路过的生物"
  21. #没有信息测试,4号怪物
  22. #=============
  23. #雷达图相关处理部分
  24. #=============
  25. class Bitmap
  26. def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
  27. distance = (start_x - end_x).abs + (start_y - end_y).abs
  28. if end_color == start_color
  29. for i in 1..distance
  30. x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  31. y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  32. if width == 1
  33. self.set_pixel(x, y, start_color)
  34. else
  35. self.fill_rect(x, y, width, width, start_color)
  36. end
  37. end
  38. else
  39. for i in 1..distance
  40. x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  41. y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  42. r = start_color.red * (distance-i)/distance + end_color.red * i/distance
  43. g = start_color.green * (distance-i)/distance + end_color.green * i/distance
  44. b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
  45. a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
  46. if width == 1
  47. self.set_pixel(x, y, Color.new(r, g, b, a))
  48. else
  49. self.fill_rect(x, y, width, width, Color.new(r, g, b, a))
  50. end
  51. end
  52. end
  53. end
  54. end
  55. #=============
  56. # Graphic_Def_Elem
  57. #=============
  58. class Window_Base
  59. FONT_SIZE = 18
  60. WORD_ELEMENT_GUARD = "属性有效度"
  61. NUMBER_OF_ELEMENTS = 8
  62. ELEMENT_ORDER = [1,3,8,5,2,4,7,6]
  63. GRAPH_SCALINE_COLOR = Color.new(255, 255, 255, 128)
  64. GRAPH_SCALINE_COLOR_SHADOW = Color.new( 0, 0, 0, 192)
  65. GRAPH_LINE_COLOR = Color.new(255, 255, 64, 255)
  66. GRAPH_LINE_COLOR_MINUS = Color.new( 64, 255, 255, 255)
  67. GRAPH_LINE_COLOR_PLUS = Color.new(255, 64, 64, 255)
  68. end

  69. #——————————————————————————————————————
  70. module Enemy_Book_Config
  71. DROP_ITEM_NEED_ANALYZE = true #显示物品
  72. EVA_NAME = "回避修正"              #回避修正的名称(因为数据库中没有定义)
  73. SHOW_COMPLETE_TYPE = 3         #图鉴完成率表示方法
  74. end
  75. class Data_MonsterBook
  76. #--------------------------------------------------------------------------
  77. # ● 图鉴用ID設定
  78. #--------------------------------------------------------------------------
  79. def enemy_book_id_set
  80.    data = [0]
  81.    data[1] = 2
  82.    data[2] = 1
  83.    data[3] = 15
  84.    data[4] = 25
  85.    data[5] = 18
  86.    data[6] = 30
  87.    return data
  88. end
  89. end
  90. class Game_Temp
  91. attr_accessor :enemy_book_data
  92. alias temp_enemy_book_data_initialize initialize
  93. def initialize
  94.    temp_enemy_book_data_initialize
  95.    @enemy_book_data = Data_MonsterBook.new
  96. end
  97. end

  98. class Game_Party
  99. #==============================================
  100. #--------------------------------------------------------------------------
  101.   # ● 公開インスタンス変数
  102.   #--------------------------------------------------------------------------
  103.   attr_reader   :actors                   # アクター
  104.   attr_reader   :gold                     # ゴールド
  105.   attr_reader   :steps                    # 歩数
  106.   
  107.   #--------------------------------------------------------------------------
  108.   # ● オブジェクト初期化
  109.   #--------------------------------------------------------------------------
  110.   def initialize
  111.     # アクターの配列を作成
  112.     @actors = []
  113.     # ゴールドと歩数を初期化
  114.     [url=home.php?mod=space&uid=236945]@gold[/url] = 0
  115.     @steps = 0
  116.     # アイテム、武器、防具の所持数ハッシュを作成
  117.     @items = {}
  118.     @weapons = {}
  119.     @armors = {}
  120.   end
  121. #==============================================
  122. attr_accessor :enemy_info               # 出会った敵情報(図鑑用)

  123. #--------------------------------------------------------------------------
  124. # ● オブジェクト初期化
  125. #--------------------------------------------------------------------------
  126. alias book_info_initialize initialize
  127. def initialize
  128.    book_info_initialize
  129.    @enemy_info = {}
  130. end

  131. #--------------------------------------------------------------------------
  132. # ● エネミー情報の追加(図鑑用)
  133. #     type : 通常遭遇かアナライズか 0:通常 1:アナライズ -1:情報削除
  134. #     0:無遭遇 1:遭遇済 2:アナライズ済
  135. #--------------------------------------------------------------------------
  136. def add_enemy_info(enemy_id, type = 0)
  137.    case type
  138.    when 0
  139.      if @enemy_info[enemy_id] == 2
  140.        return false
  141.      end
  142.      @enemy_info[enemy_id] = 1
  143.    when 1
  144.      @enemy_info[enemy_id] = 2
  145.    when -1
  146.      @enemy_info[enemy_id] = 0
  147.    end
  148. end
  149. #--------------------------------------------------------------------------
  150. # ● 魔物図鑑の最大登録数を取得
  151. #--------------------------------------------------------------------------
  152. def enemy_book_max
  153.    return $game_temp.enemy_book_data.id_data.size - 1
  154. end
  155. #--------------------------------------------------------------------------
  156. # ● 魔物図鑑の現在登録数を取得
  157. #--------------------------------------------------------------------------
  158. def enemy_book_now
  159.    now_enemy_info = @enemy_info.keys
  160.    # 登録無視の属性IDを取得
  161.    no_add = $game_temp.enemy_book_data.no_add_element
  162.    new_enemy_info = []
  163.    for i in now_enemy_info
  164.      enemy = $data_enemies[i]
  165.      next if enemy.name == ""
  166.      if enemy.element_ranks[no_add] == 1
  167.        next
  168.      end
  169.      new_enemy_info.push(enemy.id)
  170.    end
  171.    return new_enemy_info.size
  172. end
  173. #--------------------------------------------------------------------------
  174. # ● 魔物図鑑の完成率を取得
  175. #--------------------------------------------------------------------------
  176. def enemy_book_complete_percentage
  177.    e_max = enemy_book_max.to_f
  178.    e_now = enemy_book_now.to_f
  179.    comp = e_now / e_max * 100
  180.    return comp.truncate
  181. end
  182. end

  183. class Interpreter
  184. def enemy_book_max
  185.    return $game_party.enemy_book_max
  186. end
  187. def enemy_book_now
  188.    return $game_party.enemy_book_now
  189. end
  190. def enemy_book_comp
  191.    return $game_party.enemy_book_complete_percentage
  192. end
  193. end

  194. class Scene_Battle
  195. alias add_enemy_info_start_phase5 start_phase5
  196. def start_phase5
  197.    for enemy in $game_troop.enemies
  198.      # エネミーが隠れ状態でない場合
  199.      unless enemy.hidden
  200.        # 敵遭遇情報追加
  201.        $game_party.add_enemy_info(enemy.id, 0)
  202.      end
  203.    end
  204.    add_enemy_info_start_phase5
  205. end
  206. end

  207. class Window_Base < Window
  208. #--------------------------------------------------------------------------
  209. # ● エネミーの戦闘後獲得アイテムの描画
  210. #--------------------------------------------------------------------------
  211. def draw_enemy_drop_item(enemy, x, y)
  212.    self.contents.font.color = normal_color
  213.    treasures = []
  214.    if enemy.item_id > 0
  215.      treasures.push($data_items[enemy.item_id])
  216.    end
  217.    if enemy.weapon_id > 0
  218.      treasures.push($data_weapons[enemy.weapon_id])
  219.    end
  220.    if enemy.armor_id > 0
  221.      treasures.push($data_armors[enemy.armor_id])
  222.    end
  223.    # 現状ではとりあえず1つのみ描画
  224.    if treasures.size > 0
  225.      item = treasures[0]
  226.      bitmap = RPG::Cache.icon(item.icon_name)
  227.      opacity = 255
  228.      self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  229.      name = treasures[0].name
  230.    else
  231.      self.contents.font.color = disabled_color
  232.      name = "无"
  233.    end
  234.    self.contents.draw_text(x+28, y, 212, 32, name)
  235. end
  236. #--------------------------------------------------------------------------
  237. # ● エネミーの図鑑IDの描画
  238. #--------------------------------------------------------------------------
  239. def draw_enemy_book_id(enemy, x, y)
  240.    self.contents.font.color = normal_color
  241.    id = $game_temp.enemy_book_data.id_data.index(enemy.id)
  242.    self.contents.draw_text(x, y, 32, 32, id.to_s)
  243. end
  244. #--------------------------------------------------------------------------
  245. # ● 敌人简介描绘
  246. #--------------------------------------------------------------------------
  247. def draw_enemy_other(enemy, x, y)
  248.    if CHARA_INFO[enemy.id]==nil
  249.     CHARA_INFO[enemy.id] = "没有相关资料"
  250.   end
  251.    self.contents.font.size=16
  252.    x+=self.contents.text_size("").width
  253.    info = CHARA_INFO[enemy.id]
  254.    s=info.scan(/./)
  255.     #一行显示21个字
  256.     for i in s
  257.       sss = self.contents.text_size(i)
  258.       
  259.       if  i==" "
  260.         y+=16
  261.         x=0
  262.       elsif (x+sss.width)>(width - 32-260)
  263.         y+=16
  264.         x=0
  265.         self.contents.draw_text(x, y, sss.width, sss.height, i)
  266.         x+=sss.width
  267.       else
  268.       self.contents.draw_text(x, y, sss.width, sss.height, i)
  269.       x+=sss.width
  270.       end
  271.     end
  272.   end
  273.    #--------------------------------------------------------------------------
  274. # ● 敌人特技描绘
  275. #--------------------------------------------------------------------------
  276. def draw_enemy_action(enemy, x, y)
  277.    self.contents.font.size=16
  278.    yy=y
  279.    self.contents.font.color = system_color
  280.    self.contents.draw_text(x, yy, 80, 18,"行动列表")
  281.    self.contents.font.color = normal_color
  282.    for action in enemy.actions
  283.      yy+=18
  284.      if action.kind==0
  285.        case action.basic
  286.         when 0
  287.           ac="普通攻击"
  288.         when 1
  289.           ac="防御"
  290.         when 2
  291.           ac="逃跑"
  292.         when 3
  293.           ac="无"
  294.         end
  295.      self.contents.draw_text(x, yy, 160, 18, ac )
  296.      end
  297.      if action.kind==1
  298.      self.contents.draw_text(x, yy, 160, 18, $data_skills[action.skill_id].name )
  299.      end
  300.    end
  301. end
  302. #雷达图描绘
  303.   #=======================================================================================
  304.   def draw_actor_element_radar_graph(actor, x, y)
  305.     radius = 56
  306. cx = x + radius + FONT_SIZE + 48
  307. cy = y + radius + FONT_SIZE + 32
  308. self.contents.font.color = system_color
  309. self.contents.draw_text(x, y, 104, 32, WORD_ELEMENT_GUARD)
  310. for loop_i in 0..NUMBER_OF_ELEMENTS
  311. if loop_i == 0

  312. else
  313. @pre_x = @now_x
  314. @pre_y = @now_y
  315. @pre_ex = @now_ex
  316. @pre_ey = @now_ey
  317. @color1 = @color2
  318. end
  319. if loop_i == NUMBER_OF_ELEMENTS
  320. eo = ELEMENT_ORDER[0]
  321. else
  322. eo = ELEMENT_ORDER[loop_i]
  323. end
  324. er = actor.element_rate(eo)
  325. estr = $data_system.elements[eo]
  326. @color2 = er < 0 ? GRAPH_LINE_COLOR_MINUS : er > 100 ? GRAPH_LINE_COLOR_PLUS : GRAPH_LINE_COLOR
  327. if er <0
  328.   then xsh=true
  329. else xsh=false
  330. end
  331. er = er.abs
  332. th = Math::PI * (0.5 - 2.0 * loop_i / NUMBER_OF_ELEMENTS)
  333. @now_x = cx + (radius * Math.cos(th)).floor
  334. @now_y = cy - (radius * Math.sin(th)).floor
  335. @now_wx = cx + ((radius+FONT_SIZE*2/2) * Math.cos(th)).floor - FONT_SIZE
  336. @now_wy = cy - ((radius+FONT_SIZE*1/2) * Math.sin(th)).floor - FONT_SIZE/2
  337. @now_vx = cx + ((radius+FONT_SIZE*6/2) * Math.cos(th)).floor - FONT_SIZE
  338. @now_vy = cy - ((radius+FONT_SIZE*3/2) * Math.sin(th)).floor - FONT_SIZE/2
  339. @now_ex = cx + (er*radius/100 * Math.cos(th)).floor
  340. @now_ey = cy - (er*radius/100 * Math.sin(th)).floor
  341. if loop_i == 0
  342. @pre_x = @now_x
  343. @pre_y = @now_y
  344. @pre_ex = @now_ex
  345. @pre_ey = @now_ey
  346. @color1 = @color2
  347. else

  348. end
  349. next if loop_i == 0
  350. self.contents.draw_line(cx+1,cy+1, @now_x+1,@now_y+1, GRAPH_SCALINE_COLOR_SHADOW)
  351. self.contents.draw_line(@pre_x+1,@pre_y+1, @now_x+1,@now_y+1, GRAPH_SCALINE_COLOR_SHADOW)
  352. self.contents.draw_line(cx,cy, @now_x,@now_y, GRAPH_SCALINE_COLOR)
  353. self.contents.draw_line(@pre_x,@pre_y, @now_x,@now_y, GRAPH_SCALINE_COLOR)
  354. self.contents.draw_line(@pre_ex,@pre_ey, @now_ex,@now_ey, @color1, 2, @color2)
  355. self.contents.font.size = FONT_SIZE
  356. if xsh == true
  357.   then self.contents.font.color = Color.new(100,255,128,128)
  358.   sdd="-"
  359. else self.contents.font.color = system_color
  360.   sdd=""
  361. end
  362. self.contents.draw_text(@now_wx,@now_wy, FONT_SIZE*2, FONT_SIZE, estr, 1)
  363. self.contents.font.color = Color.new(255,255,255,128)
  364. self.contents.draw_text(@now_vx,@now_vy, FONT_SIZE*2, FONT_SIZE, sdd+er.to_s + "%", 2)
  365. end
  366. end
  367. #_----------------------------------------------
  368. def draw_race(enemy,x,y)
  369.       text="无"
  370.       text2="无"
  371.       for i in 9..16
  372.         if enemy.element_rate(i) == 200
  373.         text = $data_system.elements[i]
  374.         end
  375.         if enemy.element_rate(i) == 150
  376.         text2 =$data_system.elements[i]
  377.         end
  378.       end
  379.       self.contents.font.color = system_color
  380.       self.contents.draw_text(x, y, 80, 32,"主要种族")
  381.       self.contents.font.color = normal_color
  382.       self.contents.draw_text(x+80, y, 76, 32,text,2)
  383.       self.contents.font.color = system_color
  384.       self.contents.draw_text(x+160, y, 80, 32,"次要种族")
  385.       self.contents.font.color = normal_color
  386.       self.contents.draw_text(x+80+160, y, 76, 32,text2,2)
  387. end
  388.   
  389. #--------------------------------------------------------------------------
  390. # ● エネミーの名前の描画
  391. #     enemy : エネミー
  392. #     x     : 描画先 X 座標
  393. #     y     : 描画先 Y 座標
  394. #--------------------------------------------------------------------------
  395. def draw_enemy_name(enemy, x, y)
  396.    self.contents.font.color = normal_color
  397.    self.contents.draw_text(x, y, 152, 32, enemy.name)
  398. end
  399. #--------------------------------------------------------------------------
  400. # ● エネミーグラフィックの描画(アナライズ)
  401. #     enemy : エネミー
  402. #     x     : 描画先 X 座標
  403. #     y     : 描画先 Y 座標
  404. #--------------------------------------------------------------------------
  405. def draw_enemy_graphic(enemy, x, y, opacity = 255)

  406. end
  407. #--------------------------------------------------------------------------
  408. # ● エネミーの獲得EXPの描画
  409. #     enemy : エネミー
  410. #     x     : 描画先 X 座標
  411. #     y     : 描画先 Y 座標
  412. #--------------------------------------------------------------------------
  413. def draw_enemy_exp(enemy, x, y)
  414.    self.contents.font.color = system_color
  415.    self.contents.draw_text(x, y, 120, 32, "EXP")
  416.    self.contents.font.color = normal_color
  417.    self.contents.draw_text(x + 120, y, 36, 32, enemy.exp.to_s, 2)
  418. end
  419. #--------------------------------------------------------------------------
  420. # ● エネミーの獲得GOLDの描画
  421. #     enemy : エネミー
  422. #     x     : 描画先 X 座標
  423. #     y     : 描画先 Y 座標
  424. #--------------------------------------------------------------------------
  425. def draw_enemy_gold(enemy, x, y)
  426.    self.contents.font.color = system_color
  427.    self.contents.draw_text(x, y, 120, 32, "掉落金钱")
  428.    self.contents.font.color = normal_color
  429.    self.contents.draw_text(x + 120, y, 36, 32, enemy.gold.to_s, 2)
  430. end
  431. end

  432. class Game_Enemy_Book < Game_Enemy
  433. #--------------------------------------------------------------------------
  434. # ● オブジェクト初期化
  435. #--------------------------------------------------------------------------
  436. def initialize(enemy_id)
  437.    super(2, 1)#ダミー
  438.    @enemy_id = enemy_id
  439.    enemy = $data_enemies[@enemy_id]
  440.    @battler_name = enemy.battler_name
  441.    @battler_hue = enemy.battler_hue
  442.    @hp = maxhp
  443.    @sp = maxsp
  444. end
  445. end

  446. class Data_MonsterBook
  447. attr_reader :id_data
  448. #--------------------------------------------------------------------------
  449. # ● オブジェクト初期化
  450. #--------------------------------------------------------------------------
  451. def initialize
  452.    @id_data = enemy_book_id_set
  453. end
  454. #--------------------------------------------------------------------------
  455. # ● 図鑑用登録無視属性取得
  456. #--------------------------------------------------------------------------
  457. def no_add_element
  458.    no_add = 0
  459.    # 登録無視の属性IDを取得
  460.    for i in 1...$data_system.elements.size
  461.      if $data_system.elements[i] =~ /不加入图鉴/
  462.        no_add = i
  463.        break
  464.      end
  465.    end
  466.    return no_add
  467. end
  468. #--------------------------------------------------------------------------
  469. # ● 図鑑用敵ID設定
  470. #--------------------------------------------------------------------------
  471. def enemy_book_id_set
  472.    data = [0]
  473.    no_add = no_add_element
  474.    # 登録無視の属性IDを取得
  475.    for i in 1...$data_enemies.size
  476.      enemy = $data_enemies[i]
  477.      next if enemy.name == ""
  478.      if enemy.element_ranks[no_add] == 1
  479.        next
  480.      end
  481.      data.push(enemy.id)
  482.    end
  483.    return data
  484. end
  485. end


  486. class Window_MonsterBook < Window_Selectable
  487. attr_reader   :data
  488. #--------------------------------------------------------------------------
  489. # ● オブジェクト初期化
  490. #--------------------------------------------------------------------------
  491. def initialize(index=0)
  492.    super(0, 64, 640, 416)
  493.    @column_max = 2
  494.    @book_data = $game_temp.enemy_book_data
  495.    @data = @book_data.id_data.dup
  496.    @data.shift
  497.    #@data.sort!
  498.    @item_max = @data.size
  499.    self.index = 0
  500.    refresh if @item_max > 0
  501. end
  502. #--------------------------------------------------------------------------
  503. # ● 遭遇データを取得
  504. #--------------------------------------------------------------------------
  505. def data_set
  506.    data = $game_party.enemy_info.keys
  507.    data.sort!
  508.    newdata = []
  509.    for i in data
  510.      next if $game_party.enemy_info[i] == 0
  511.      # 図鑑登録無視を考慮
  512.      if book_id(i) != nil
  513.        newdata.push(i)
  514.      end
  515.    end
  516.    return newdata
  517. end
  518. #--------------------------------------------------------------------------
  519. # ● 表示許可取得
  520. #--------------------------------------------------------------------------
  521. def show?(id)
  522.    if $game_party.enemy_info[id] == 0 or $game_party.enemy_info[id] == nil
  523.      return false
  524.    else
  525.      return true
  526.    end
  527. end
  528. #--------------------------------------------------------------------------
  529. # ● 図鑑用ID取得
  530. #--------------------------------------------------------------------------
  531. def book_id(id)
  532.    return @book_data.index(id)
  533. end
  534. #--------------------------------------------------------------------------
  535. # ● エネミー取得
  536. #--------------------------------------------------------------------------
  537. def item
  538.    return @data[self.index]
  539. end
  540. #--------------------------------------------------------------------------
  541. # ● リフレッシュ
  542. #--------------------------------------------------------------------------
  543. def refresh
  544.    if self.contents != nil
  545.      self.contents.dispose
  546.      self.contents = nil
  547.    end
  548.    self.contents = Bitmap.new(width - 32, row_max * 32)
  549.    #項目数が 0 でなければビットマップを作成し、全項目を描画
  550.    if @item_max > 0
  551.      for i in 0...@item_max
  552.       draw_item(i)
  553.      end
  554.    end
  555. end
  556. #--------------------------------------------------------------------------
  557. # ● 項目の描画
  558. #     index : 項目番号
  559. #--------------------------------------------------------------------------
  560. def draw_item(index)
  561.    enemy = $data_enemies[@data[index]]
  562.    return if enemy == nil
  563.    x = 4 + index % 2 * (288 + 32)
  564.    y = index / 2 * 32
  565.    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  566.    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  567.    self.contents.font.color = normal_color
  568.    draw_enemy_book_id(enemy, x, y)
  569.    if show?(enemy.id)
  570.      self.contents.draw_text(x + 28+16, y, 212, 32, enemy.name, 0)
  571.    else
  572.      self.contents.draw_text(x + 28+16, y, 212, 32, "-----", 0)
  573.      return
  574.    end
  575.    if analyze?(@data[index])
  576.      self.contents.font.color = text_color(3)
  577.      self.contents.draw_text(x + 256, y, 24, 32, "済", 2)
  578.    end
  579. end
  580. #--------------------------------------------------------------------------
  581. # ● アナライズ済かどうか
  582. #--------------------------------------------------------------------------
  583. def analyze?(enemy_id)
  584.    if $game_party.enemy_info[enemy_id] == 2
  585.      return true
  586.    else
  587.      return false
  588.    end
  589. end
  590. end


  591. class Window_MonsterBook_Info < Window_Base
  592. include Enemy_Book_Config
  593. #--------------------------------------------------------------------------
  594. # ● オブジェクト初期化
  595. #--------------------------------------------------------------------------
  596. def initialize
  597.    super(0, 0+64, 640, 480-64)
  598.    self.back_opacity=255
  599.    self.contents = Bitmap.new(width - 32, height - 32)
  600.    
  601. end
  602. #--------------------------------------------------------------------------
  603. # ● リフレッシュ
  604. #--------------------------------------------------------------------------
  605. def refresh(enemy_id)
  606.    self.contents.clear
  607.    self.contents.font.size = 22
  608.    enemy = Game_Enemy_Book.new(enemy_id)
  609.    @gra = Sprite_Enemy_Graphic.new(nil,enemy)
  610.    @gra.z = 120      #怪物图片
  611.    draw_enemy_book_id(enemy, 4, 0)    #各种详细信息
  612.    draw_enemy_name(enemy, 48, 0)
  613.    draw_actor_hp(enemy, 288, 0)
  614.    draw_actor_sp(enemy, 288+160, 0)
  615.    self.contents.font.size=18
  616.    draw_actor_parameter(enemy, 288    ,  25, 0)
  617.    self.contents.font.color = system_color
  618.    self.contents.draw_text(288+160, 25, 120, 32, EVA_NAME)
  619.    self.contents.font.color = normal_color
  620.    self.contents.draw_text(288+160 + 120, 25, 36, 32, enemy.eva.to_s, 2)
  621.    draw_actor_parameter(enemy, 288    ,  50, 3)
  622.    draw_actor_parameter(enemy, 288+160,  50, 4)
  623.    draw_actor_parameter(enemy, 288    ,  75, 5)
  624.    draw_actor_parameter(enemy, 288+160,  75, 6)
  625.    draw_actor_parameter(enemy, 288    , 100, 1)
  626.    draw_actor_parameter(enemy, 288+160, 100, 2)
  627.    draw_enemy_exp(enemy, 288, 125)
  628.    draw_enemy_gold(enemy, 288+160, 125)
  629.    draw_race(enemy, 288, 150)
  630.    #--------------------------------------------------------------------
  631.    draw_enemy_other(enemy, 0, 280)  #简介文字
  632.    draw_enemy_action(enemy,200, 30)  #显示敌人行动
  633.    draw_actor_element_radar_graph(enemy, 360, 180)#雷达图
  634.    #--------------------------------------------------------------------
  635.    if DROP_ITEM_NEED_ANALYZE==true  #掉落物品
  636.      self.contents.font.color = system_color
  637.         self.contents.font.size=16
  638.      self.contents.draw_text(0, 235, 96, 32, "掉落物品")
  639.      draw_enemy_drop_item(enemy, 128, 235)
  640.      self.contents.font.color = normal_color
  641.         self.contents.font.size=18
  642.       end      
  643.     end
  644. def cl
  645.        @gra.dispose
  646. end
  647. #--------------------------------------------------------------------------
  648. # ● アナライズ済かどうか
  649. #--------------------------------------------------------------------------
  650. def analyze?(enemy_id)
  651.    if $game_party.enemy_info[enemy_id] == 2
  652.      return true
  653.    else
  654.      return false
  655.    end
  656. end
  657. end


  658. class Scene_MonsterBook
  659. include Enemy_Book_Config
  660. #--------------------------------------------------------------------------
  661. # ● メイン処理
  662. #--------------------------------------------------------------------------
  663. def main
  664.    $game_temp.enemy_book_data = Data_MonsterBook.new
  665.    # ウィンドウを作成
  666.    @title_window = Window_Base.new(0, 0, 640, 64)
  667.    @title_window.contents = Bitmap.new(640 - 32, 64 - 32)
  668.    @title_window.contents.draw_text(4, 0, 320, 32, "魔物图鉴", 0)
  669.    if SHOW_COMPLETE_TYPE != 0
  670.      case SHOW_COMPLETE_TYPE
  671.      when 1
  672.        e_now = $game_party.enemy_book_now
  673.        e_max = $game_party.enemy_book_max
  674.        text = e_now.to_s + "/" + e_max.to_s
  675.      when 2
  676.        comp = $game_party.enemy_book_complete_percentage
  677.        text = comp.to_s + "%"
  678.      when 3
  679.        e_now = $game_party.enemy_book_now
  680.        e_max = $game_party.enemy_book_max
  681.        comp = $game_party.enemy_book_complete_percentage
  682.        text = e_now.to_s + "/" + e_max.to_s + " " + comp.to_s + "%"
  683.      end
  684.      if text != nil
  685.        @title_window.contents.draw_text(320, 0, 288, 32,  text, 2)
  686.      end
  687.    end
  688.    @main_window = Window_MonsterBook.new
  689.    @main_window.active = true
  690.    # インフォウィンドウを作成 (不可視・非アクティブに設定)
  691.    @info_window = Window_MonsterBook_Info.new
  692.    @info_window.z = 110
  693.    @info_window.visible = false
  694.    @info_window.active = false
  695.    @visible_index = 0
  696.    # トランジション実行
  697.    Graphics.transition
  698.    # メインループ
  699.    loop do
  700.      # ゲーム画面を更新
  701.      Graphics.update
  702.      # 入力情報を更新
  703.      Input.update
  704.      # フレーム更新
  705.      update
  706.      # 画面が切り替わったらループを中断
  707.      if $scene != self
  708.        break
  709.      end
  710.    end
  711.    # トランジション準備
  712.    Graphics.freeze
  713.    # ウィンドウを解放
  714.    @main_window.dispose
  715.    @info_window.dispose
  716.    @title_window.dispose
  717. end
  718. #--------------------------------------------------------------------------
  719. # ● フレーム更新
  720. #--------------------------------------------------------------------------
  721. def update
  722.    # ウィンドウを更新
  723.    @main_window.update
  724.    @info_window.update
  725. #   gra.update
  726.    if @info_window.active
  727.      update_info
  728.      return
  729.    end
  730.    # メインウィンドウがアクティブの場合: update_target を呼ぶ
  731.    if @main_window.active
  732.      update_main
  733.      return
  734.    end
  735. end
  736. #--------------------------------------------------------------------------
  737. # ● フレーム更新 (メインウィンドウがアクティブの場合)
  738. #--------------------------------------------------------------------------
  739. def update_main
  740.    # B ボタンが押された場合
  741.    if Input.trigger?(Input::B)
  742.      # キャンセル SE を演奏
  743.      $game_system.se_play($data_system.cancel_se)
  744.      $scene = Scene_Menu.new(7)
  745.      return
  746.    end
  747.    # C ボタンが押された場合
  748.    if Input.trigger?(Input::C)
  749.      if @main_window.item == nil or @main_window.show?(@main_window.item) == false
  750.        # ブザー SE を演奏
  751.        $game_system.se_play($data_system.buzzer_se)
  752.        return
  753.      end
  754.      # 決定 SE を演奏
  755.      $game_system.se_play($data_system.decision_se)
  756.      @main_window.active = false
  757.      @info_window.active = true
  758.      @info_window.visible = true
  759.      @visible_index = @main_window.index
  760.      @info_window.refresh(@main_window.item)
  761.      return
  762.    end
  763. end
  764. #--------------------------------------------------------------------------
  765. # ● フレーム更新 (インフォウィンドウがアクティブの場合)
  766. #--------------------------------------------------------------------------
  767. def update_info
  768.    # B ボタンが押された場合
  769.    if Input.trigger?(Input::B)
  770.      # キャンセル SE を演奏
  771.      $game_system.se_play($data_system.cancel_se)
  772.      @main_window.active = true
  773.      @info_window.active = false
  774.      @info_window.visible = false
  775.      @info_window.cl
  776.      return
  777.    end
  778.    # C ボタンが押された場合
  779.    if Input.trigger?(Input::C)
  780.      # 決定 SE を演奏
  781.      #$game_system.se_play($data_system.decision_se)
  782.      return
  783.    end
  784.    if Input.trigger?(Input::L)
  785.      # 決定 SE を演奏
  786.      $game_system.se_play($data_system.decision_se)
  787.      loop_end = false
  788.      while loop_end == false
  789.        if @visible_index != 0
  790.          @visible_index -= 1
  791.        else
  792.          @visible_index = @main_window.data.size - 1
  793.        end
  794.        loop_end = true if @main_window.show?(@main_window.data[@visible_index])
  795.      end
  796.      @info_window.cl
  797.      id = @main_window.data[@visible_index]
  798.      @info_window.refresh(id)
  799.      return
  800.    end
  801.    if Input.trigger?(Input::R)
  802.      # 決定 SE を演奏
  803.      $game_system.se_play($data_system.decision_se)
  804.      loop_end = false
  805.      while loop_end == false
  806.        if @visible_index != @main_window.data.size - 1
  807.          @visible_index += 1
  808.        else
  809.          @visible_index = 0
  810.        end
  811.        loop_end = true if @main_window.show?(@main_window.data[@visible_index])
  812.      end
  813.      @info_window.cl
  814.      id = @main_window.data[@visible_index]
  815.      @info_window.refresh(id)
  816.      return
  817.    end
  818. end
  819. end
  820. #==============================================================================
  821. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  822. #==============================================================================
  823. class Sprite_Enemy_Graphic< Sprite
  824.   attr_accessor :enemy
  825.   #--------------------------------------------------------------------------
  826.   # ● オブジェクト初期化
  827.   #--------------------------------------------------------------------------
  828.   def initialize(viewport,enemy)
  829.     super(viewport)
  830.     if @enemy != enemy
  831.       self.bitmap = RPG::Cache.battler(enemy.battler_name, enemy.battler_hue)
  832.       cw = self.bitmap.width
  833.       ch = self.bitmap.height
  834.     if cw>ch
  835.      self.zoom_x=200.0/cw
  836.      self.zoom_y=200.0/cw
  837.    else
  838.      self.zoom_x=200.0/ch
  839.      self.zoom_y=200.0/ch     
  840.    end
  841.      self.x=10
  842.      self.y=110
  843.       @enemy=enemy
  844.     end
  845.   end
  846.   #--------------------------------------------------------------------------
  847.   # ● 解放
  848.   #--------------------------------------------------------------------------
  849.   def dispose
  850.     if self.bitmap != nil
  851.       self.bitmap.dispose
  852.     end
  853.     super
  854.   end
  855.   #--------------------------------------------------------------------------
  856.   # ● フレーム更新
  857.   #--------------------------------------------------------------------------
  858.   def refresh(enemy)
  859.   end
  860. end
复制代码
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
29 小时
注册时间
2013-7-26
帖子
12
3
发表于 2014-4-6 19:03:22 | 只看该作者
这也是我想做的功能……!脚本先码着!等我把大部分系统搞定了再来琢磨!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-30 19:42

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表