Project1

标题: 关于怪物图鉴能否手动添加档案? [打印本页]

作者: Mullice_    时间: 2017-5-15 13:32
标题: 关于怪物图鉴能否手动添加档案?
本帖最后由 Mullice_ 于 2017-5-15 13:44 编辑

一般来说判定是战斗之后会自动添加敌人的档案进去,
那能不能利用事件里的脚本,把xx号敌人添加进怪物图鉴呢?
RUBY 代码复制
  1. #================================================================
  2. # 本脚本来自[url]http://www.66rpg.com/[/url],使用和转载请保留此信息
  3. #===================================================================
  4. #——————————————————————————————————————
  5. #魔物图鉴+介绍
  6. #
  7. #战斗终了时自动添加敌人进入图鉴(class Scene_Battle start_phase5 追加。
  8.  
  9. #目前与各种战斗系统没有发现冲突)
  10. #不想加入图鉴的怪物设置其“不加入图鉴”属性有效度为A即可
  11. #图鉴完成度的表示功能追加
  12. #SHOW_COMPLETE_TYPE 的数值可以设定
  13. #当为1,显示现有个数/总数,当为2,显示完成百分比,当为3,全显示。
  14. #使用方法:$scene = Scene_MonsterBook.new
  15. #数据库中属性里面那些种族特效的位置,建议把默认的“对 不死”之类改成“不死”,
  16.  
  17. #不然显示会很奇怪
  18. #由于雷达图的设计问题,只支持8项属性
  19. #默认种族特效处理属性中编号9到编号16,
  20.  
  21. #如果你做了修改请自行改动380行左右的for i in 9..16这一句代码
  22. #显示各种信息位于630行左右,想不显示的话只要删除相应语句
  23. CHARA_INFO=[]#怪物的介绍,对应怪物id,空格为换行,
  24.  
  25. #同时也会自动换行,没有写介绍的怪物会自动显示“无详细信息”
  26. CHARA_INFO[1] = ""
  27.  
  28. #没有信息测试,怪物
  29. #=============
  30. #雷达图相关处理部分
  31. #=============
  32. class Bitmap
  33. def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
  34. distance = (start_x - end_x).abs + (start_y - end_y).abs
  35. if end_color == start_color
  36. for i in 1..distance
  37. x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  38. y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  39. if width == 1
  40. self.set_pixel(x, y, start_color)
  41. else
  42. self.fill_rect(x, y, width, width, start_color)
  43. end
  44. end
  45. else
  46. for i in 1..distance
  47. x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  48. y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  49. r = start_color.red * (distance-i)/distance + end_color.red * i/distance
  50. g = start_color.green * (distance-i)/distance + end_color.green * i/distance
  51. b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
  52. a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
  53. if width == 1
  54. self.set_pixel(x, y, Color.new(r, g, b, a))
  55. else
  56. self.fill_rect(x, y, width, width, Color.new(r, g, b, a))
  57. end
  58. end
  59. end
  60. end
  61. end
  62. #=============
  63. # Graphic_Def_Elem
  64. #=============
  65. class Window_Base
  66. FONT_SIZE = 18
  67. WORD_ELEMENT_GUARD = "属性有效度"
  68. NUMBER_OF_ELEMENTS = 8
  69. ELEMENT_ORDER = [1,3,10,5,2,12,7,6]
  70. GRAPH_SCALINE_COLOR = Color.new(255, 255, 255, 128)
  71. GRAPH_SCALINE_COLOR_SHADOW = Color.new( 0, 0, 0, 192)
  72. GRAPH_LINE_COLOR = Color.new(255, 255, 64, 255)
  73. GRAPH_LINE_COLOR_MINUS = Color.new( 64, 255, 255, 255)
  74. GRAPH_LINE_COLOR_PLUS = Color.new(255, 64, 64, 255)
  75. end
  76.  
  77. #——————————————————————————————————————
  78. module Enemy_Book_Config
  79. DROP_ITEM_NEED_ANALYZE = true #显示物品
  80. # EVA_NAME = "回避修正"              #回避修正的名称(因为数据库中没有定义)
  81. SHOW_COMPLETE_TYPE = 3         #图鉴完成率表示方法
  82. end
  83. class Data_MonsterBook
  84. #--------------------------------------------------------------------------
  85. # ● 图鉴用ID設定
  86. #--------------------------------------------------------------------------
  87. def enemy_book_id_set
  88.    data = [0]
  89.    data[1] = 2
  90.    data[2] = 1
  91.    data[3] = 15
  92.    data[4] = 25
  93.    data[5] = 18
  94.    data[6] = 30
  95.    return data
  96. end
  97. end
  98. class Game_Temp
  99. attr_accessor :enemy_book_data
  100. alias temp_enemy_book_data_initialize initialize
  101. def initialize
  102.    temp_enemy_book_data_initialize
  103.    @enemy_book_data = Data_MonsterBook.new
  104. end
  105. end
  106.  
  107. class Game_Party
  108. #==============================================
  109. #--------------------------------------------------------------------------
  110.   # ● 公開インスタンス変数
  111.   #--------------------------------------------------------------------------
  112.   attr_reader   :actors                   # アクター
  113.   attr_reader   :gold                     # ゴールド
  114.   attr_reader   :steps                    # 歩数
  115.   attr_accessor :mission                  # 任务★★★★★★★★★★★★★
  116.   attr_accessor   :pr                  # 当前章节数★★★★★★★★★★★★★
  117.   attr_reader   :prname
  118.   #--------------------------------------------------------------------------
  119.   # ● オブジェクト初期化
  120.   #--------------------------------------------------------------------------
  121.   def initialize
  122.     # アクターの配列を作成
  123.     @actors = []
  124.     # ゴールドと歩数を初期化
  125.     @gold = 0
  126.     @steps = 0
  127.     # アイテム、武器、防具の所持数ハッシュを作成
  128.     @items = {}
  129.     @weapons = {}
  130.     @armors = {}
  131.   end
  132. #==============================================
  133. attr_accessor :enemy_info               # 出会った敵情報(図鑑用)
  134.  
  135. #--------------------------------------------------------------------------
  136. # ● オブジェクト初期化
  137. #--------------------------------------------------------------------------
  138. alias book_info_initialize initialize
  139. def initialize
  140.    book_info_initialize
  141.    @enemy_info = {}
  142. end
  143.  
  144. #--------------------------------------------------------------------------
  145. # ● エネミー情報の追加(図鑑用)
  146. #     type : 通常遭遇かアナライズか 0:通常 1:アナライズ -1:情報削除
  147. #     0:無遭遇 1:遭遇済 2:アナライズ済
  148. #--------------------------------------------------------------------------
  149. def add_enemy_info(enemy_id, type = 0)
  150.    case type
  151.    when 0
  152.      if @enemy_info[enemy_id] == 2
  153.        return false
  154.      end
  155.      @enemy_info[enemy_id] = 1
  156.    when 1
  157.      @enemy_info[enemy_id] = 2
  158.    when -1
  159.      @enemy_info[enemy_id] = 0
  160.    end
  161. end
  162. #--------------------------------------------------------------------------
  163. # ● 魔物図鑑の最大登録数を取得
  164. #--------------------------------------------------------------------------
  165. def enemy_book_max
  166.    return $game_temp.enemy_book_data.id_data.size - 1
  167. end
  168. #--------------------------------------------------------------------------
  169. # ● 魔物図鑑の現在登録数を取得
  170. #--------------------------------------------------------------------------
  171. def enemy_book_now
  172.    now_enemy_info = @enemy_info.keys
  173.    # 登録無視の属性IDを取得
  174.    no_add = $game_temp.enemy_book_data.no_add_element
  175.    new_enemy_info = []
  176.    for i in now_enemy_info
  177.      enemy = $data_enemies[i]
  178.      next if enemy.name == ""
  179.      if enemy.element_ranks[no_add] == 1
  180.        next
  181.      end
  182.      new_enemy_info.push(enemy.id)
  183.    end
  184.    return new_enemy_info.size
  185. end
  186. #--------------------------------------------------------------------------
  187. # ● 魔物図鑑の完成率を取得
  188. #--------------------------------------------------------------------------
  189. def enemy_book_complete_percentage
  190.    e_max = enemy_book_max.to_f
  191.    e_now = enemy_book_now.to_f
  192.    comp = e_now / e_max * 100
  193.    return comp.truncate
  194. end
  195. end
  196.  
  197. class Interpreter
  198. def enemy_book_max
  199.    return $game_party.enemy_book_max
  200. end
  201. def enemy_book_now
  202.    return $game_party.enemy_book_now
  203. end
  204. def enemy_book_comp
  205.    return $game_party.enemy_book_complete_percentage
  206. end
  207. end
  208.  
  209. class Scene_Battle
  210. alias add_enemy_info_start_phase5 start_phase5
  211. def start_phase5
  212.    for enemy in $game_troop.enemies
  213.      # エネミーが隠れ状態でない場合
  214.      unless enemy.hidden
  215.        # 敵遭遇情報追加
  216.        $game_party.add_enemy_info(enemy.id, 0)
  217.      end
  218.    end
  219.    add_enemy_info_start_phase5
  220. end
  221. end
  222.  
  223. class Window_Base < Window
  224. #--------------------------------------------------------------------------
  225. # ● エネミーの戦闘後獲得アイテムの描画
  226. #--------------------------------------------------------------------------
  227. def draw_enemy_drop_item(enemy, x, y)
  228.    self.contents.font.color = normal_color
  229.    treasures = []
  230.    if enemy.item_id > 0
  231.      treasures.push($data_items[enemy.item_id])
  232.    end
  233.    if enemy.weapon_id > 0
  234.      treasures.push($data_weapons[enemy.weapon_id])
  235.    end
  236.    if enemy.armor_id > 0
  237.      treasures.push($data_armors[enemy.armor_id])
  238.    end
  239.    # 現状ではとりあえず1つのみ描画
  240.    if treasures.size > 0
  241.      item = treasures[0]
  242.      bitmap = RPG::Cache.icon(item.icon_name)
  243.      opacity = 255
  244.      self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  245.      name = treasures[0].name
  246.    else
  247.      self.contents.font.color = disabled_color
  248.      name = "无"
  249.    end
  250.    self.contents.draw_text(x+28, y, 212, 32, name)
  251. end
  252. #--------------------------------------------------------------------------
  253. # ● エネミーの図鑑IDの描画
  254. #--------------------------------------------------------------------------
  255. def draw_enemy_book_id(enemy, x, y)
  256.    self.contents.font.color = normal_color
  257.    id = $game_temp.enemy_book_data.id_data.index(enemy.id)
  258.    self.contents.draw_text(x, y, 32, 32, id.to_s)
  259. end
  260. #--------------------------------------------------------------------------
  261. # ● 敌人简介描绘
  262. #--------------------------------------------------------------------------
  263. def draw_enemy_other(enemy, x, y)
  264.    if CHARA_INFO[enemy.id]==nil
  265.     CHARA_INFO[enemy.id] = "没有相关资料"
  266.   end
  267.    self.contents.font.size=16
  268.    x+=self.contents.text_size("").width
  269.    info = CHARA_INFO[enemy.id]
  270.    s=info.scan(/./)
  271.     #一行显示21个字
  272.     for i in s
  273.       sss = self.contents.text_size(i)
  274.  
  275.       if  i==" "
  276.         y+=16
  277.         x=0
  278.       elsif (x+sss.width)>(width - 32-260)
  279.         y+=16
  280.         x=0
  281.         self.contents.draw_text(x, y, sss.width, sss.height, i)
  282.         x+=sss.width
  283.       else
  284.       self.contents.draw_text(x, y, sss.width, sss.height, i)
  285.       x+=sss.width
  286.       end
  287.     end
  288.   end
  289.    #--------------------------------------------------------------------------
  290. # ● 敌人特技描绘
  291. #--------------------------------------------------------------------------
  292. def draw_enemy_action(enemy, x, y)
  293.    self.contents.font.size=18
  294.    x = 360
  295.    y = 150
  296.    yy=y
  297.    self.contents.font.color = system_color
  298.    self.contents.draw_text(x, yy, 100, 24,"行动列表")
  299.    self.contents.font.color = normal_color
  300.    for action in enemy.actions
  301.      yy+=24
  302.      if action.kind==0
  303.        case action.basic
  304.         when 0
  305.           ac="攻击"
  306.         when 1
  307.           ac="防御"
  308.         when 2
  309.           ac="逃跑"
  310.         when 3
  311.           ac="不行动"
  312.         end
  313.      self.contents.draw_text(x, yy, 160, 24, ac )
  314.      end
  315.      if action.kind==1
  316.      self.contents.draw_text(x, yy, 160, 24, $data_skills[action.skill_id].name )
  317.      end
  318.    end
  319. end
  320. #雷达图描绘
  321.   #===================================================================
  322. #  def draw_actor_element_radar_graph(actor, x, y)
  323. #    radius = 56
  324. #cx = x + radius + FONT_SIZE + 48
  325. #cy = y + radius + FONT_SIZE + 32
  326. #self.contents.font.color = system_color
  327. #self.contents.draw_text(x, y, 104, 32, WORD_ELEMENT_GUARD)
  328. #for loop_i in 0..NUMBER_OF_ELEMENTS
  329. #if loop_i == 0
  330.  
  331. #else
  332. #@pre_x = @now_x
  333. #@pre_y = @now_y
  334. #@pre_ex = @now_ex
  335. #@pre_ey = @now_ey
  336. #@color1 = @color2
  337. #end
  338. #if loop_i == NUMBER_OF_ELEMENTS
  339. #eo = ELEMENT_ORDER[0]
  340. #else
  341. #eo = ELEMENT_ORDER[loop_i]
  342. #end
  343. #er = actor.element_rate(eo)
  344. #estr = $data_system.elements[eo]
  345. #@color2 = er < 0 ? GRAPH_LINE_COLOR_MINUS : er > 100 ? GRAPH_LINE_COLOR_PLUS : GRAPH_LINE_COLOR
  346. #if er <0
  347. #  then xsh=true
  348. #else xsh=false
  349. #end
  350. #er = er.abs
  351. #th = Math::PI * (0.5 - 2.0 * loop_i / NUMBER_OF_ELEMENTS)
  352. #@now_x = cx + (radius * Math.cos(th)).floor
  353. #@now_y = cy - (radius * Math.sin(th)).floor
  354. #@now_wx = cx + ((radius+FONT_SIZE*2/2) * Math.cos(th)).floor - FONT_SIZE
  355. #@now_wy = cy - ((radius+FONT_SIZE*1/2) * Math.sin(th)).floor - FONT_SIZE/2
  356. #@now_vx = cx + ((radius+FONT_SIZE*6/2) * Math.cos(th)).floor - FONT_SIZE
  357. #@now_vy = cy - ((radius+FONT_SIZE*3/2) * Math.sin(th)).floor - FONT_SIZE/2
  358. #@now_ex = cx + (er*radius/100 * Math.cos(th)).floor
  359. #@now_ey = cy - (er*radius/100 * Math.sin(th)).floor
  360. #if loop_i == 0
  361. #@pre_x = @now_x
  362. #@pre_y = @now_y
  363. #@pre_ex = @now_ex
  364. #@pre_ey = @now_ey
  365. #@color1 = @color2
  366. #else
  367.  
  368. #end
  369. #next if loop_i == 0
  370. #self.contents.draw_line(cx+1,cy+1, @now_x+1,@now_y+1, GRAPH_SCALINE_COLOR_SHADOW)
  371. #self.contents.draw_line(@pre_x+1,@pre_y+1, @now_x+1,@now_y+1, GRAPH_SCALINE_COLOR_SHADOW)
  372. #self.contents.draw_line(cx,cy, @now_x,@now_y, GRAPH_SCALINE_COLOR)
  373. #self.contents.draw_line(@pre_x,@pre_y, @now_x,@now_y, GRAPH_SCALINE_COLOR)
  374. #self.contents.draw_line(@pre_ex,@pre_ey, @now_ex,@now_ey, @color1, 2, @color2)
  375. #self.contents.font.size = FONT_SIZE
  376. #if xsh == true
  377. #  then self.contents.font.color = Color.new(100,255,128,128)
  378. #  sdd="-"
  379. #else self.contents.font.color = system_color
  380. #  sdd=""
  381. #end
  382. #self.contents.draw_text(@now_wx,@now_wy, FONT_SIZE*2, FONT_SIZE, estr, 1)
  383. #self.contents.font.color = Color.new(255,255,255,128)
  384. #self.contents.draw_text(@now_vx,@now_vy, FONT_SIZE*2, FONT_SIZE, sdd+er.to_s + "%", 2)
  385. #end
  386. #end
  387. #_----------------------------------------------
  388. #def draw_race(enemy,x,y)
  389. #      text="无"
  390. #      text2="无"
  391. #      for i in 9..16
  392. #        if enemy.element_rate(i) == 200
  393. #        text = $data_system.elements[i]
  394. #       end
  395. #        if enemy.element_rate(i) == 150
  396. #        text2 =$data_system.elements[i]
  397. #        end
  398. #      end
  399. #      self.contents.font.color = system_color
  400. #      self.contents.draw_text(x, y, 80, 32,"主要种族")
  401. #      self.contents.font.color = normal_color
  402. #      self.contents.draw_text(x+80, y, 76, 32,text,2)
  403. #      self.contents.font.color = system_color
  404. #      self.contents.draw_text(x+160, y, 80, 32,"次要种族")
  405. #      self.contents.font.color = normal_color
  406. #      self.contents.draw_text(x+80+160, y, 76, 32,text2,2)
  407. #end
  408.  
  409. #--------------------------------------------------------------------------
  410. # ● エネミーの名前の描画
  411. #     enemy : エネミー
  412. #     x     : 描画先 X 座標
  413. #     y     : 描画先 Y 座標
  414. #--------------------------------------------------------------------------
  415. def draw_enemy_name(enemy, x, y)
  416.    self.contents.font.color = normal_color
  417.    self.contents.draw_text(x, y, 152, 32, enemy.name)
  418. end
  419. #--------------------------------------------------------------------------
  420. # ● エネミーグラフィックの描画(アナライズ)
  421. #     enemy : エネミー
  422. #     x     : 描画先 X 座標
  423. #     y     : 描画先 Y 座標
  424. #--------------------------------------------------------------------------
  425. def draw_enemy_graphic(enemy, x, y, opacity = 255)
  426.  
  427. end
  428. #--------------------------------------------------------------------------
  429. # ● エネミーの獲得EXPの描画
  430. #     enemy : エネミー
  431. #     x     : 描画先 X 座標
  432. #     y     : 描画先 Y 座標
  433. #--------------------------------------------------------------------------
  434. def draw_enemy_exp(enemy, x, y)
  435.    self.contents.font.color = system_color
  436.    self.contents.draw_text(x, y, 120, 32, "经验")
  437.    self.contents.font.color = normal_color
  438.    self.contents.draw_text(x + 120, y, 36, 32, enemy.exp.to_s, 2)
  439. end
  440. #--------------------------------------------------------------------------
  441. # ● エネミーの獲得GOLDの描画
  442. #     enemy : エネミー
  443. #     x     : 描画先 X 座標
  444. #     y     : 描画先 Y 座標
  445. #--------------------------------------------------------------------------
  446. def draw_enemy_gold(enemy, x, y)
  447.    self.contents.font.color = system_color
  448.    self.contents.draw_text(x, y, 120, 32, "掉落金钱")
  449.    self.contents.font.color = normal_color
  450.    self.contents.draw_text(x + 120, y, 36, 32, enemy.gold.to_s, 2)
  451. end
  452. end
  453.  
  454. class Game_Enemy_Book < Game_Enemy
  455. #--------------------------------------------------------------------------
  456. # ● オブジェクト初期化
  457. #--------------------------------------------------------------------------
  458. def initialize(enemy_id)
  459.    super(2, 1)#ダミー
  460.    @enemy_id = enemy_id
  461.    enemy = $data_enemies[@enemy_id]
  462.    @battler_name = enemy.battler_name
  463.    @battler_hue = enemy.battler_hue
  464.    @hp = maxhp
  465.    @sp = maxsp
  466. end
  467.   #--------------------------------------------------------------------------
  468.   # ● 获取名称
  469.   #--------------------------------------------------------------------------
  470.   def name
  471.     return $data_enemies[@enemy_id].name
  472.   end
  473. end
  474.  
  475. class Data_MonsterBook
  476. attr_reader :id_data
  477. #--------------------------------------------------------------------------
  478. # ● オブジェクト初期化
  479. #--------------------------------------------------------------------------
  480. def initialize
  481.    @id_data = enemy_book_id_set
  482. end
  483. #--------------------------------------------------------------------------
  484. # ● 図鑑用登録無視属性取得
  485. #--------------------------------------------------------------------------
  486. def no_add_element
  487.    no_add = 0
  488.    # 登録無視の属性IDを取得
  489.    for i in 1...$data_system.elements.size
  490.      if $data_system.elements[i] =~ /不加入图鉴/
  491.        no_add = i
  492.        break
  493.      end
  494.    end
  495.    return no_add
  496. end
  497. #--------------------------------------------------------------------------
  498. # ● 図鑑用敵ID設定
  499. #--------------------------------------------------------------------------
  500. def enemy_book_id_set
  501.    data = [0]
  502.    no_add = no_add_element
  503.    # 登録無視の属性IDを取得
  504.    for i in 1...$data_enemies.size
  505.      enemy = $data_enemies[i]
  506.      next if enemy.name == ""
  507.      if enemy.element_ranks[no_add] == 1
  508.        next
  509.      end
  510.      data.push(enemy.id)
  511.    end
  512.    return data
  513. end
  514. end
  515.  
  516.  
  517. class Window_MonsterBook < Window_Selectable
  518. attr_reader   :data
  519. #--------------------------------------------------------------------------
  520. # ● オブジェクト初期化
  521. #--------------------------------------------------------------------------
  522. def initialize(index=0)
  523.    super(0, 64, 640, 416)
  524.    @column_max = 2
  525.    @book_data = $game_temp.enemy_book_data
  526.    @data = @book_data.id_data.dup
  527.    @data.shift
  528.    #@data.sort!
  529.    @item_max = @data.size
  530.    self.index = 0
  531.    refresh if @item_max > 0
  532. end
  533. #--------------------------------------------------------------------------
  534. # ● 遭遇データを取得
  535. #--------------------------------------------------------------------------
  536. def data_set
  537.    data = $game_party.enemy_info.keys
  538.    data.sort!
  539.    newdata = []
  540.    for i in data
  541.      next if $game_party.enemy_info[i] == 0
  542.      # 図鑑登録無視を考慮
  543.      if book_id(i) != nil
  544.        newdata.push(i)
  545.      end
  546.    end
  547.    return newdata
  548. end
  549. #--------------------------------------------------------------------------
  550. # ● 表示許可取得
  551. #--------------------------------------------------------------------------
  552. def show?(id)
  553.    if $game_party.enemy_info[id] == 0 or $game_party.enemy_info[id] == nil
  554.      return false
  555.    else
  556.      return true
  557.    end
  558. end
  559. #--------------------------------------------------------------------------
  560. # ● 図鑑用ID取得
  561. #--------------------------------------------------------------------------
  562. def book_id(id)
  563.    return @book_data.index(id)
  564. end
  565. #--------------------------------------------------------------------------
  566. # ● エネミー取得
  567. #--------------------------------------------------------------------------
  568. def item
  569.    return @data[self.index]
  570. end
  571. #--------------------------------------------------------------------------
  572. # ● リフレッシュ
  573. #--------------------------------------------------------------------------
  574. def refresh
  575.    if self.contents != nil
  576.      self.contents.dispose
  577.      self.contents = nil
  578.    end
  579.    self.contents = Bitmap.new(width - 32, row_max * 32)
  580.    #項目数が 0 でなければビットマップを作成し、全項目を描画
  581.    if @item_max > 0
  582.      for i in 0...@item_max
  583.       draw_item(i)
  584.      end
  585.    end
  586. end
  587. #--------------------------------------------------------------------------
  588. # ● 項目の描画
  589. #     index : 項目番号
  590. #--------------------------------------------------------------------------
  591. def draw_item(index)
  592.    enemy = $data_enemies[@data[index]]
  593.    return if enemy == nil
  594.    x = 4 + index % 2 * (288 + 32)
  595.    y = index / 2 * 32
  596.    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  597.    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  598.    self.contents.font.color = normal_color
  599.    draw_enemy_book_id(enemy, x, y)
  600.    if show?(enemy.id)
  601.      self.contents.draw_text(x + 28+16, y, 212, 32, enemy.name, 0)
  602.    else
  603.      self.contents.draw_text(x + 28+16, y, 212, 32, "-----", 0)
  604.      return
  605.    end
  606.    if analyze?(@data[index])
  607.      self.contents.font.color = text_color(3)
  608.      self.contents.draw_text(x + 256, y, 24, 32, "済", 2)
  609.    end
  610. end
  611. #--------------------------------------------------------------------------
  612. # ● アナライズ済かどうか
  613. #--------------------------------------------------------------------------
  614. def analyze?(enemy_id)
  615.    if $game_party.enemy_info[enemy_id] == 2
  616.      return true
  617.    else
  618.      return false
  619.    end
  620. end
  621. end
  622.  
  623.  
  624. class Window_MonsterBook_Info < Window_Base
  625. include Enemy_Book_Config
  626. #--------------------------------------------------------------------------
  627. # ● オブジェクト初期化
  628. #--------------------------------------------------------------------------
  629. def initialize
  630.    super(0, 0+64, 640, 480-64)
  631.    self.back_opacity=255
  632.    self.contents = Bitmap.new(width - 32, height - 32)
  633.  
  634. end
  635. #--------------------------------------------------------------------------
  636. # ● リフレッシュ
  637. #--------------------------------------------------------------------------
  638. def refresh(enemy_id)
  639.    self.contents.clear
  640.    self.contents.font.size = 22
  641.    enemy = Game_Enemy_Book.new(enemy_id)
  642.    @gra = Sprite_Enemy_Graphic.new(nil,enemy)
  643.    @gra.z = 120      #怪物图片
  644.    draw_enemy_book_id(enemy, 4, 0)    #各种详细信息
  645.    draw_enemy_name(enemy, 48, 0)
  646.    draw_actor_hp(enemy, 288, 0)
  647.    draw_actor_sp(enemy, 288+160, 0)
  648.    self.contents.font.size=18
  649. #   draw_actor_parameter(enemy, 288    ,  25, 0)
  650.    self.contents.font.color = system_color
  651. #   self.contents.draw_text(288+160, 25, 120, 32, EVA_NAME)
  652.    self.contents.font.color = normal_color
  653. #   self.contents.draw_text(288+160 + 120, 25, 36, 32, enemy.eva.to_s, 2)
  654.    draw_actor_parameter(enemy, 288    ,  40, 3)
  655.    draw_actor_parameter(enemy, 288+160,  40, 4)
  656.    draw_actor_parameter(enemy, 288    ,  65, 5)
  657.    draw_actor_parameter(enemy, 288+160,  65, 6)
  658. #   draw_actor_parameter(enemy, 288    , 100, 1)
  659.    draw_actor_parameter(enemy, 288, 90, 2)
  660.    draw_enemy_exp(enemy, 288, 115)
  661.    draw_enemy_gold(enemy, 288+160, 115)
  662. #   draw_race(enemy, 288, 150)
  663.    #--------------------------------------------------------------------
  664.    draw_enemy_other(enemy, 0, 280)  #简介文字
  665.    draw_enemy_action(enemy,200, 30)  #显示敌人行动
  666. #   draw_actor_element_radar_graph(enemy, 360, 180)#雷达图
  667.    #--------------------------------------------------------------------
  668.    if DROP_ITEM_NEED_ANALYZE==true  #掉落物品
  669.      self.contents.font.color = system_color
  670.         self.contents.font.size=16
  671.      self.contents.draw_text(0, 235, 96, 32, "掉落物品")
  672.      draw_enemy_drop_item(enemy, 128, 235)
  673.      self.contents.font.color = normal_color
  674.         self.contents.font.size=18
  675.       end      
  676.     end
  677. def cl
  678.        @gra.dispose
  679. end
  680. #--------------------------------------------------------------------------
  681. # ● アナライズ済かどうか
  682. #--------------------------------------------------------------------------
  683. def analyze?(enemy_id)
  684.    if $game_party.enemy_info[enemy_id] == 2
  685.      return true
  686.    else
  687.      return false
  688.    end
  689. end
  690. end
  691.  
  692.  
  693. class Scene_MonsterBook
  694. include Enemy_Book_Config
  695. #--------------------------------------------------------------------------
  696. # ● メイン処理
  697. #--------------------------------------------------------------------------
  698. def main
  699.    $game_temp.enemy_book_data = Data_MonsterBook.new
  700.    # ウィンドウを作成
  701.    @title_window = Window_Base.new(0, 0, 640, 64)
  702.    @title_window.contents = Bitmap.new(640 - 32, 64 - 32)
  703.    @title_window.contents.draw_text(4, 0, 320, 32, "降妖谱", 0)
  704.    if SHOW_COMPLETE_TYPE != 0
  705.      case SHOW_COMPLETE_TYPE
  706.      when 1
  707.        e_now = $game_party.enemy_book_now
  708.        e_max = $game_party.enemy_book_max
  709.        text = e_now.to_s + "/" + e_max.to_s
  710.      when 2
  711.        comp = $game_party.enemy_book_complete_percentage
  712.        text = comp.to_s + "%"
  713.      when 3
  714.        e_now = $game_party.enemy_book_now
  715.        e_max = $game_party.enemy_book_max
  716.        comp = $game_party.enemy_book_complete_percentage
  717.        text = e_now.to_s + "/" + e_max.to_s + " " + comp.to_s + "%"
  718.      end
  719.      if text != nil
  720.        @title_window.contents.draw_text(320, 0, 288, 32,  text, 2)
  721.      end
  722.    end
  723.    @main_window = Window_MonsterBook.new
  724.    @main_window.active = true
  725.    # インフォウィンドウを作成 (不可視・非アクティブに設定)
  726.    @info_window = Window_MonsterBook_Info.new
  727.    @info_window.z = 110
  728.    @info_window.visible = false
  729.    @info_window.active = false
  730.    @visible_index = 0
  731.    # トランジション実行
  732.    Graphics.transition
  733.    # メインループ
  734.    loop do
  735.      # ゲーム画面を更新
  736.      Graphics.update
  737.      # 入力情報を更新
  738.      Input.update
  739.      # フレーム更新
  740.      update
  741.      # 画面が切り替わったらループを中断
  742.      if $scene != self
  743.        break
  744.      end
  745.    end
  746.    # トランジション準備
  747.    Graphics.freeze
  748.    # ウィンドウを解放
  749.    @main_window.dispose
  750.    @info_window.dispose
  751.    @title_window.dispose
  752. end
  753. #--------------------------------------------------------------------------
  754. # ● フレーム更新
  755. #--------------------------------------------------------------------------
  756. def update
  757.    # ウィンドウを更新
  758.    @main_window.update
  759.    @info_window.update
  760. #   gra.update
  761.    if @info_window.active
  762.      update_info
  763.      return
  764.    end
  765.    # メインウィンドウがアクティブの場合: update_target を呼ぶ
  766.    if @main_window.active
  767.      update_main
  768.      return
  769.    end
  770. end
  771. #--------------------------------------------------------------------------
  772. # ● フレーム更新 (メインウィンドウがアクティブの場合)
  773. #--------------------------------------------------------------------------
  774. def update_main
  775.    # B ボタンが押された場合
  776.    if Input.trigger?(Input::B)
  777.      # キャンセル SE を演奏
  778.      $game_system.se_play($data_system.cancel_se)
  779.      $scene = Scene_Menu.new(4)
  780.      return
  781.    end
  782.    # C ボタンが押された場合
  783.    if Input.trigger?(Input::C)
  784.      if @main_window.item == nil or @main_window.show?(@main_window.item) == false
  785.        # ブザー SE を演奏
  786.        $game_system.se_play($data_system.buzzer_se)
  787.        return
  788.      end
  789.      # 決定 SE を演奏
  790.      $game_system.se_play($data_system.decision_se)
  791.      @main_window.active = false
  792.      @info_window.active = true
  793.      @info_window.visible = true
  794.      @visible_index = @main_window.index
  795.      @info_window.refresh(@main_window.item)
  796.      return
  797.    end
  798. end
  799. #--------------------------------------------------------------------------
  800. # ● フレーム更新 (インフォウィンドウがアクティブの場合)
  801. #--------------------------------------------------------------------------
  802. def update_info
  803.    # B ボタンが押された場合
  804.    if Input.trigger?(Input::B)
  805.      # キャンセル SE を演奏
  806.      $game_system.se_play($data_system.cancel_se)
  807.      @main_window.active = true
  808.      @info_window.active = false
  809.      @info_window.visible = false
  810.      @info_window.cl
  811.      return
  812.    end
  813.    # C ボタンが押された場合
  814.    if Input.trigger?(Input::C)
  815.      # 決定 SE を演奏
  816.      #$game_system.se_play($data_system.decision_se)
  817.      return
  818.    end
  819.    if Input.trigger?(Input::L)
  820.      # 決定 SE を演奏
  821.      $game_system.se_play($data_system.decision_se)
  822.      loop_end = false
  823.      while loop_end == false
  824.        if @visible_index != 0
  825.          @visible_index -= 1
  826.        else
  827.          @visible_index = @main_window.data.size - 1
  828.        end
  829.        loop_end = true if @main_window.show?(@main_window.data[@visible_index])
  830.      end
  831.      id = @main_window.data[@visible_index]
  832.      @info_window.refresh(id)
  833.      return
  834.    end
  835.    if Input.trigger?(Input::R)
  836.      # 決定 SE を演奏
  837.      $game_system.se_play($data_system.decision_se)
  838.      loop_end = false
  839.      while loop_end == false
  840.        if @visible_index != @main_window.data.size - 1
  841.          @visible_index += 1
  842.        else
  843.          @visible_index = 0
  844.        end
  845.        loop_end = true if @main_window.show?(@main_window.data[@visible_index])
  846.      end
  847.      id = @main_window.data[@visible_index]
  848.      @info_window.refresh(id)
  849.      return
  850.    end
  851. end
  852. end
  853. #==================================================================
  854. # 本脚本来自[url]http://www.66rpg.com/[/url],使用和转载请保留此信息
  855. #==================================================================
  856. class Sprite_Enemy_Graphic< Sprite
  857.   attr_accessor :enemy
  858.   #--------------------------------------------------------------------------
  859.   # ● オブジェクト初期化
  860.   #--------------------------------------------------------------------------
  861. def initialize(viewport,enemy)
  862.     super(viewport)
  863.     if @enemy != enemy
  864.       self.bitmap = RPG::Cache.battler(enemy.battler_name + "_2", enemy.battler_hue)
  865.       cw = self.bitmap.width
  866.       ch = self.bitmap.height
  867.     if cw>ch
  868.      self.zoom_x=1
  869.      self.zoom_y=1
  870.    else
  871.      self.zoom_x=1
  872.      self.zoom_y=1     
  873.    end
  874.      self.x=150-cw/2
  875.      self.y=210-ch/2
  876.       @enemy=enemy
  877.     end
  878.   end
  879.  
  880.   #--------------------------------------------------------------------------
  881.   # ● 解放
  882.   #--------------------------------------------------------------------------
  883.   def dispose
  884.     if self.bitmap != nil
  885.       self.bitmap.dispose
  886.     end
  887.     super
  888.   end
  889.   #--------------------------------------------------------------------------
  890.   # ● フレーム更新
  891.   #--------------------------------------------------------------------------
  892.   def refresh(enemy)
  893.   end
  894. end

作者: fux2    时间: 2017-5-15 17:30
216行可以看到的。
$game_party.add_enemy_info(敌人编号, 0)




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1