赞 | 0 |
VIP | 13 |
好人卡 | 0 |
积分 | 1 |
经验 | 4760 |
最后登录 | 2016-1-1 |
在线时间 | 112 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 112 小时
- 注册时间
- 2010-6-16
- 帖子
- 89
|
本帖最后由 jy02347315 于 2012-2-6 22:22 编辑
不知道从好久开始...图鉴中的h = [height - 32, $game_system.mbook.size * WLH].max这句话出错了.
这是脚本:- ******************************************************************************
- #
- # * モンスター図鑑 #2
- #
- # --------------------------------------------------------------------------
- # バージョン : 1.0.2
- # 対 応 : RPGツクールVX : RGSS2
- # 制 作 者 : CACAO
- # 配 布 元 : [url]http://cacaosoft.web.fc2.com/[/url]
- # 連 絡 先 : [email][email protected][/email]
- # --------------------------------------------------------------------------
- # == 概要 ==
- #
- # : モンスター図鑑の機能を追加します。
- #
- # --------------------------------------------------------------------------
- # == 注意事項 ==
- #
- # ※ 別途、コメントを定義する必要があります。サイトの説明をご覧ください。
- # ※ このスクリプトの使用には、基本的なRGSS2の知識が必要となります。
- #
- # --------------------------------------------------------------------------
- # == 使用方法 ==
- #
- # ★ 図鑑の起動
- # $game_temp.next_scene = "mbook"
- #
- # ★ メニューからの起動
- # start_mbook
- #
- # ★ 閲覧可能範囲の変更
- # $game_system.mbook[n].entry = value
- # n = エネミーのID
- # value = 0:閲覧不可, 1:遭遇, 2:勝利, 3:解析
- #
- # ★ 閲覧の可否の変更
- # $game_system.mbook[n].hidden = value
- # n = エネミーのID
- # value = true:閲覧不可, false:閲覧可能
- #
- # ★ 初期登録
- # エネミーのメモ欄に <MB:初期登録○> と記述
- # ○ = 初期登録時の閲覧可能範囲。半角数字で記述
- #
- # ★ 初期閲覧不可
- # エネミーのメモ欄に <MB:閲覧禁止> と記述
- #
- # ★ 完全非表示
- # エネミーのメモ欄に <MB:図鑑除外> と記述
- #
- # --------------------------------------------------------------------------
- # == 画像規格 ==
- #
- # ★ 有効度の詳細画像
- # 属性・ステートアイコンの上に表示します。有効度を見分けるための画像です。
- # 144 x 48 の画像(WeakIcon)を "Graphics/System" にご用意ください。
- #
- # ★ 図鑑背景画像
- # 図鑑全体の画像です。
- # 544 x 416 の画像(BackMBook)を "Graphics/System" にご用意ください。
- # ※ ステータス背景を使用する場合は、ステータス部分を透過してください。
- #
- # ★ ステータス背景画像
- # ステータス部分の背景です。
- # 左からコメント、ステータス、属性・ステート画面となっています。
- # 896 x 272 の画像(BackMBookS)を "Graphics/System" にご用意ください。
- #
- # ※ 詳細はサイトの説明をご覧ください。
- # また、画像を使用しない設定の場合は、必要ありません。
- # ユーザー設定で個別に設定できます。
- #
- #
- #******************************************************************************
- #==============================================================================
- # ◆ ユーザー設定
- #==============================================================================
- module CAO
- module MB
- #--------------------------------------------------------------------------
- # ◇ 閲覧可能にする情報(閲覧可能範囲、閲覧レベル)
- # (:name, :graphics, :params1, :drop, :params2, :weak, :come)
- #--------------------------------------------------------------------------
- ACCESS_PERMIT = [ [3], # <= 消さないように注意!
- # 遭遇 Lv 1
- [:name, :graphics],
- # 勝利 Lv 2
- [:name, :graphics, :params1, :drop],
- # 解析 Lv 3
- [:name, :graphics, :params1, :drop, :params2, :weak, :come]
- ]
- #--------------------------------------------------------------------------
- # ◇ 図鑑完成率の算出方法(閲覧レベルで指定)
- #--------------------------------------------------------------------------
- COMPLETE_NUMBER = nil
- #--------------------------------------------------------------------------
- # ◇ 図鑑完成率の色変え(100%時)
- #--------------------------------------------------------------------------
- COMPLETE_COLOR = true
- #--------------------------------------------------------------------------
- # ◇ 自動登録する
- #--------------------------------------------------------------------------
- AUTO_ENTRY = true
- #--------------------------------------------------------------------------
- # ◇ 敗北しても登録する
- # true : 戦闘で負けても、倒した敵の加算と図鑑登録を行います。
- # false : 戦闘に負けた場合は、何も行いません。
- #--------------------------------------------------------------------------
- AUTO_ENTRY_LOSE = false
- #--------------------------------------------------------------------------
- # ◇ 倒した敵のみ自動登録する
- # true : 敵を倒すと閲覧レベル1
- # false : 遭遇でレベル1、倒すとレベル2
- #--------------------------------------------------------------------------
- AUTO_ENTRY_DEFEATED = false
- #--------------------------------------------------------------------------
- # ◇ 表示するステート
- #--------------------------------------------------------------------------
- ACTIVE_STATE = [2, 3, 4, 5, 6, 7, 8]
- #--------------------------------------------------------------------------
- # ◇ 表示する属性
- #--------------------------------------------------------------------------
- ACTIVE_ELEMENT = [7, 8, 9, 10, 11, 12, 13, 14]
- #--------------------------------------------------------------------------
- # ◇ 属性を1文字で表示する
- # true : 属性の最初の1文字のみを表示する。
- # false : 指定されたアイコンで表示する。
- #--------------------------------------------------------------------------
- ONE_NAME_ELEMENT = false
- #--------------------------------------------------------------------------
- # ◇ 属性のアイコン
- #--------------------------------------------------------------------------
- ICON_ELEMENT = [104, 105, 106, 107, 108, 109, 110, 111]
- #--------------------------------------------------------------------------
- # ◇ 耐性表示の色分けをする
- # true : 有効度の画像を使用します。
- # false : アイコンのみを表示します。
- #--------------------------------------------------------------------------
- WEAK_PONIT_COLOR = false
- #--------------------------------------------------------------------------
- # ◇ ウィンドウを消す
- #--------------------------------------------------------------------------
- NO_WINDOW_GRAPHICS = false
- #--------------------------------------------------------------------------
- # ◇ システム文字を非表示にする
- #--------------------------------------------------------------------------
- NO_SYSTEM_FONT = false
- #--------------------------------------------------------------------------
- # ◇ パラメータの項目
- # HP, MP, ATK, DEF, SPI, AGI, HIT, EVA, EXP, GOLD, DROPITEM
- #--------------------------------------------------------------------------
- TEXT_STATUS = ["H P", "M P", "攻击力", "防御力", "精神力", "敏捷力",
- "命中率", "回避率", "经验值", "游戏币", "掉落物品"]
- #--------------------------------------------------------------------------
- # ◇ 耐性の項目
- # 有効属性、有効ステート、耐性属性、耐性ステート
- #--------------------------------------------------------------------------
- TEXT_WEAK_POINT = ["弱点属性", "弱点状态", "耐性属性", "耐性状态"]
- end
- end
- #/////////////////////////////////////////////////////////////////////////////#
- # #
- # 下記のスクリプトを変更する必要はありません。 #
- # #
- #/////////////////////////////////////////////////////////////////////////////#
- module CAO
- class MonsterBook
- attr_accessor :entry
- attr_accessor :hidden
- attr_accessor :unread
- attr_accessor :defeat
- attr_accessor :encounter
- attr_reader :id
- def initialize(id)
- @id = id
- @entry = 0
- @hidden = false
- @unread = true
- @defeat = 0
- @encounter = false
- end
- def data
- return $data_enemies[@id]
- end
- end
- end
- class Game_System
- attr_accessor :mbook
- end
- class Scene_Title < Scene_Base
- alias :_cao_command_new_game_mbook :command_new_game
- def command_new_game
- _cao_command_new_game_mbook
- CAO::MB::Commands.reset_mbook
- end
- end
- class Scene_Map < Scene_Base
- alias :_cao_update_scene_change_mbook :update_scene_change
- def update_scene_change
- return if $game_player.moving?
- if $game_temp.next_scene == "mbook"
- $game_temp.next_scene = nil
- $scene = Scene_MonsterBook.new
- end
- _cao_update_scene_change_mbook
- end
- end
- class Scene_Menu < Scene_Base
- def start_mbook
- $scene = Scene_MonsterBook.new(@command_window.index)
- end
- end
- module CAO::MB::Commands
- module_function
- def unrestraint_array
- return $game_system.mbook.compact
- end
- def unrestraint_number
- return unrestraint_array.size
- end
- def unrestraint_enemy(data_id)
- for enemy in unrestraint_array
- return enemy if enemy.id == data_id
- end
- end
- def reset_mbook
- $game_system.mbook = []
- for i in 1...$data_enemies.size
- unless /^<MB:圖鑑除外>/ =~ $data_enemies[i].note
- $game_system.mbook[i] = CAO::MonsterBook.new($data_enemies[i].id)
- end
- end
- reset_entry
- reset_hidden
- reset_unread
- reset_defeat
- end
- def reset_entry
- for i in 1...$data_enemies.size
- next if $game_system.mbook[i] == nil
- if /^<MB:初期登錄(\d)>/ =~ $data_enemies[i].note
- $game_system.mbook[i].entry = $1.to_i
- else
- $game_system.mbook[i].entry = 0
- end
- end
- end
- def reset_hidden
- for i in 1...$data_enemies.size
- next if $game_system.mbook[i] == nil
- if /^<MB:閱讀禁止>/ =~ $data_enemies[i].note
- $game_system.mbook[i].hidden = true
- else
- $game_system.mbook[i].hidden = false
- end
- end
- end
- def reset_unread
- for i in 1...$data_enemies.size
- next if $game_system.mbook[i] == nil
- $game_system.mbook[i].unread = true
- end
- end
- def reset_defeat
- for i in 1...$data_enemies.size
- next if $game_system.mbook[i] == nil
- $game_system.mbook[i].unread = 0
- end
- end
- def change_entry(id, val)
- $game_system.mbook[id].entry = val
- end
- def get_encounter_number
- count = 0
- for enemy in unrestraint_array
- count += 1 if enemy.encounter
- end
- return count
- end
- def get_encounter_percent
- return cget_encounter_number * 100 / unrestraint_number
- end
- def get_entry_number(entry_type = nil)
- count = 0
- if entry_type
- for enemy in unrestraint_array
- count += 1 if enemy.entry >= entry_type
- end
- else
- for enemy in unrestraint_array
- count += enemy.entry
- end
- count /= 3
- end
- return count
- end
- def get_entry_percent(entry_type = nil)
- return get_entry_number(entry_type) * 100 / unrestraint_number
- end
- def complete_entry(entry_type)
- for enemy in unrestraint_array
- enemy.entry = entry_type
- end
- end
- def clear_entry
- for enemy in unrestraint_array
- enemy.entry = 0
- end
- end
- end
- class Window_MbookCommand < Window_Selectable
- def initialize
- super(8, 72, 200, 272)
- self.opacity = CAO::MB::NO_WINDOW_GRAPHICS ? 0 : 255
- @enemy = CAO::MB::Commands.unrestraint_array
- @item_max = CAO::MB::Commands.unrestraint_number
- refresh
- self.index = 0
- end
- def create_contents
- self.contents.dispose
- h = [height - 32, $game_system.mbook.size * WLH].max
- self.contents = Bitmap.new(width - 32, h)
- end
- def refresh
- self.contents.clear
- for i in 0...@item_max
- draw_item(i)
- end
- end
- def draw_item(index)
- rect = item_rect(index)
- rect.x += 4
- rect.width -= 8
- self.contents.clear_rect(rect)
- self.contents.font.color = normal_color
- self.contents.draw_text(rect, sprintf("%03d", index + 1))
- if @enemy[index].hidden || @enemy[index].entry == 0
- self.contents.draw_text(rect, "????????????", 2)
- else
- rect.x = 32
- rect.width -= 28
- self.contents.font.color = Color.new(102,204,64) if @enemy[index].unread
- self.contents.draw_text(rect, @enemy[index].data.name, 2)
- end
- end
- end
- class Window_MbookStatus < Window_Base
- SLIDE_SPEED = 36
- def initialize
- super(216, 72, 320, 272)
- @enemy = CAO::MB::Commands.unrestraint_array[0]
- self.opacity = CAO::MB::NO_WINDOW_GRAPHICS ? 0 : 255
- self.ox = 288
- @page = 1
- @slide_left = false
- @slide_right = false
- refresh
- end
- def create_contents
- self.contents.dispose
- self.contents = Bitmap.new((width - 32) * 3, height - 32)
- if CAO::MB::NO_SYSTEM_FONT
- @back_sprite = Sprite.new
- @back_sprite.bitmap = Cache.system("BackMBookS")
- @back_sprite.x = 216
- @back_sprite.y = 72
- @back_sprite.z = 0
- @back_sprite.ox = 288
- end
- end
- def refresh
- @enemy.unread = false if @enemy.entry > 0
- self.contents.clear_rect(288 * @page, 0, 288, 240)
- case @page
- when 0
- draw_comments
- when 1
- x = 288
- self.contents.font.color = normal_color
- if CAO::MB::ACCESS_PERMIT[@enemy.entry].include?(:name)
- self.contents.draw_text(x + 4, 0, 280, WLH, @enemy.data.name)
- else
- self.contents.draw_text(x + 4, 0, 280, WLH, "????????")
- end
- draw_enemy_parameter(x, 33)
- unless CAO::MB::NO_SYSTEM_FONT
- self.contents.font.color = system_color
- self.contents.draw_text(x, 168, 160, WLH, CAO::MB::TEXT_STATUS[10])
- end
- draw_drop_item(@enemy.data.drop_item1, x + 24, 192)
- draw_drop_item(@enemy.data.drop_item2, x + 24, 216)
- when 2
- draw_weak_point(576)
- end
- end
- def draw_comments
- return unless CAO::MB::ACCESS_PERMIT[@enemy.entry].include?(:come)
- if CAO::MB::COMMENT.has_key?(@enemy.data.id)
- self.contents.font.color = normal_color
- come = CAO::MB::COMMENT[@enemy.data.id]
- for i in 0...come.size
- update_message(come[i].clone, WLH * i)
- end
- end
- end
- def update_message(text, y)
- text.gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
- text.gsub!(/\\N\[([0-9]+)\]/i) { $game_actors[$1.to_i].name }
- text.gsub!(/\\C\[([0-9]+)\]/i) { "\x01[#{$1}]" }
- text.gsub!(/\\\\/) { "\\" }
- x = 0
- loop do
- c = text.slice!(/./m)
- case c
- when nil
- break
- when "\x01"
- text.sub!(/\[([0-9]+)\]/, "")
- contents.font.color = text_color($1.to_i)
- next
- else
- contents.draw_text(x, y, 40, WLH, c)
- x += contents.text_size(c).width
- end
- end
- end
- def draw_enemy_parameter(x, y)
- params = [ @enemy.data.maxhp, @enemy.data.maxmp,
- @enemy.data.atk,@enemy.data.def, @enemy.data.spi,
- @enemy.data.agi, @enemy.data.hit, @enemy.data.eva, ]
- for i in 0...8
- xx = x + i % 2 * 152
- yy = y + i / 2 * WLH
- unless CAO::MB::NO_SYSTEM_FONT
- self.contents.font.color = system_color
- self.contents.draw_text(xx, yy, 60, WLH, CAO::MB::TEXT_STATUS[i])
- end
- self.contents.font.color = normal_color
- if CAO::MB::ACCESS_PERMIT[@enemy.entry].include?(:params1)
- self.contents.draw_text(xx + 60, yy, 72, WLH, params[i], 2)
- else
- self.contents.draw_text(xx + 60, yy, 72, WLH, "???", 2)
- end
- end
- unless CAO::MB::NO_SYSTEM_FONT
- self.contents.font.color = system_color
- self.contents.draw_text(x, 135, 60, WLH, CAO::MB::TEXT_STATUS[8])
- self.contents.draw_text(x + 152, 135, 60, WLH, CAO::MB::TEXT_STATUS[9])
- end
- self.contents.font.color = normal_color
- if CAO::MB::ACCESS_PERMIT[@enemy.entry].include?(:params2)
- self.contents.draw_text(x + 60, 135, 72, WLH, @enemy.data.exp, 2)
- self.contents.draw_text(x + 212, 135, 72, WLH, @enemy.data.gold, 2)
- else
- self.contents.draw_text(x + 60, 135, 72, WLH, "??????", 2)
- self.contents.draw_text(x + 212, 135, 72, WLH, "??????", 2)
- end
- end
- def draw_drop_item(drop_item, x, y)
- case drop_item.kind
- when 0
- item = nil
- when 1
- item = $data_items[drop_item.item_id]
- when 2
- item = $data_weapons[drop_item.weapon_id]
- when 3
- item = $data_armors[drop_item.armor_id]
- end
- self.contents.font.color = normal_color
- if CAO::MB::ACCESS_PERMIT[@enemy.entry].include?(:drop)
- if item == nil
- self.contents.draw_text(x + 2, y, 230, WLH, "× --------------")
- else
- draw_icon(item.icon_index, x, y)
- self.contents.draw_text(x + 26, y, 230, WLH, item.name)
- end
- else
- self.contents.draw_text(x, y, 230, WLH, "? --------------")
- end
- end
- def draw_weak_point(x)
- unless CAO::MB::NO_SYSTEM_FONT
- self.contents.font.color = system_color
- for i in 0...4
- self.contents.draw_text(x+4, 60*i, 280, WLH, CAO::MB::TEXT_WEAK_POINT[i])
- end
- end
- if CAO::MB::ACCESS_PERMIT[@enemy.entry].include?(:weak)
- draw_element_icon(x + 28, 24)
- draw_state_icon(x + 28, 84)
- else
- self.contents.font.color = normal_color
- for i in 0...4
- self.contents.draw_text(x+36, 60*i+24, 240, WLH, "? ? ? ? ? ? ?")
- end
- end
- end
- def draw_element_icon(x, y)
- count = 0
- for i in 0...CAO::MB::ACTIVE_ELEMENT.size
- if @enemy.data.element_ranks[CAO::MB::ACTIVE_ELEMENT[i]] < 3
- if CAO::MB::ONE_NAME_ELEMENT
- rank = @enemy.data.element_ranks[CAO::MB::ACTIVE_ELEMENT[i]]
- text = $data_system.elements[CAO::MB::ACTIVE_ELEMENT[i]][/./]
- draw_weak_icon(text, x + 26 * count, y, rank)
- else
- icon_index = CAO::MB::ICON_ELEMENT[i]
- rank = @enemy.data.element_ranks[CAO::MB::ACTIVE_ELEMENT[i]]
- draw_weak_icon(icon_index, x + 26 * count, y, rank)
- end
- count += 1
- end
- end
- count = 0
- for i in 0...CAO::MB::ACTIVE_ELEMENT.size
- if @enemy.data.element_ranks[CAO::MB::ACTIVE_ELEMENT[i]] > 3
- if CAO::MB::ONE_NAME_ELEMENT
- rank = @enemy.data.element_ranks[CAO::MB::ACTIVE_ELEMENT[i]]
- text = $data_system.elements[CAO::MB::ACTIVE_ELEMENT[i]][/./]
- draw_weak_icon(text, x + 26 * count, y + 120, rank)
- else
- icon_index = CAO::MB::ICON_ELEMENT[i]
- rank = @enemy.data.element_ranks[CAO::MB::ACTIVE_ELEMENT[i]]
- draw_weak_icon(icon_index, x + 26 * count, y + 120, rank)
- end
- count += 1
- end
- end
- end
- def draw_state_icon(x, y)
- weak_ranks = []
- strong_ranks = []
- for en in CAO::MB::ACTIVE_STATE
- if @enemy.data.state_ranks[en] < 3
- weak_ranks << en
- elsif @enemy.data.state_ranks[en] > 3
- strong_ranks << en
- end
- end
- self.contents.font.color = normal_color
- for i in 0...weak_ranks.size
- icon_index = $data_states[weak_ranks[i]].icon_index
- rank = @enemy.data.state_ranks[weak_ranks[i]] + 6
- draw_weak_icon(icon_index, x + 26 * i, y, rank)
- end
- for i in 0...strong_ranks.size
- icon_index = $data_states[strong_ranks[i]].icon_index
- rank = @enemy.data.state_ranks[strong_ranks[i]] + 6
- draw_weak_icon(icon_index, x + 26 * i, y + 120, rank)
- end
- end
- def draw_weak_icon(icon_index, x, y, rank = 0)
- if icon_index.class == String
- case rank
- when 1
- self.contents.font.color = Color.new(240, 32, 8)
- when 5
- self.contents.font.color = Color.new(48, 128, 248)
- when 6
- self.contents.font.color = Color.new(200, 64, 200)
- else
- self.contents.font.color = normal_color
- end
- self.contents.draw_text(x, y, 24, WLH, icon_index, 1)
- else
- bitmap = Cache.system("Iconset")
- rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
- self.contents.blt(x, y, bitmap, rect)
- if CAO::MB::WEAK_PONIT_COLOR
- rect.set((rank - 1) % 6 * 24, (rank - 1) / 6 * 24, 24, 24)
- self.contents.blt(x, y, Cache.system("WeakIcon"), rect)
- end
- end
- end
- def enemy=(enemy_id)
- @enemy = CAO::MB::Commands.unrestraint_array[enemy_id]
- refresh
- end
- def terminate
- super
- @back_sprite.dispose if CAO::MB::NO_SYSTEM_FONT
- end
- def update
- super
- unless @slide_left && @slide_right
- last_index = @page
- if Input.trigger?(Input::RIGHT)
- @page = [@page + 1, 2].min
- @slide_right = @page != last_index
- end
- if Input.trigger?(Input::LEFT)
- @page = [@page - 1, 0].max
- @slide_left = @page != last_index
- end
- if @page != last_index
- Sound.play_cursor
- refresh
- end
- end
- update_page
- end
- def update_page
- if @slide_left
- self.ox -= SLIDE_SPEED
- @back_sprite.ox -= SLIDE_SPEED if CAO::MB::NO_SYSTEM_FONT
- @slide_left = !(self.ox == (288 * @page))
- end
- if @slide_right
- self.ox += SLIDE_SPEED
- @back_sprite.ox += SLIDE_SPEED if CAO::MB::NO_SYSTEM_FONT
- @slide_right = !(self.ox == (288 * @page))
- end
- end
- end
- class Window_MBookHelp < Window_Base
- include CAO::MB::Commands
- def initialize
- super(8, 352, 528, 56)
- self.opacity = CAO::MB::NO_WINDOW_GRAPHICS ? 0 : 255
- @enemy = unrestraint_array
- @item_max = unrestraint_number
- refresh
- end
- def refresh
- self.contents.clear
- unless CAO::MB::NO_SYSTEM_FONT
- self.contents.font.color = system_color
- self.contents.draw_text(7, 0, 100, WLH, "击败数")
- self.contents.draw_text(147, 0, 30, WLH, "次", 2)
- self.contents.draw_text(193, 0, 70, WLH, "遭遇率")
- self.contents.draw_text(303, 0, 30, WLH, "%", 2)
- self.contents.draw_text(349, 0, 70, WLH, "完成率")
- self.contents.draw_text(459, 0, 30, WLH, "%", 2)
- end
- self.contents.font.color = normal_color
- draw_defeated_number(107, 0, 40, WLH, 1)
- self.contents.draw_text(263, 0, 40, WLH, get_encounter_number, 2)
- text = get_entry_percent(CAO::MB::COMPLETE_NUMBER)
- if text == 100 && CAO::MB::COMPLETE_COLOR
- self.contents.font.color.set(240, 36, 12)
- end
- self.contents.draw_text(419, 0, 40, WLH, text, 2)
- end
- def draw_defeated_number(x, y, w, h, enemy_id)
- self.contents.clear_rect(x, y, w, h)
- self.contents.font.color = normal_color
- self.contents.draw_text(x, y, w, h, @enemy[enemy_id].defeat, 2)
- end
- end
- class Scene_MonsterBook < Scene_Base
- def initialize(menu_index = -1)
- @menu_index = menu_index
- end
- def start
- super
- create_menu_background
- create_title_window
- create_command_window
- create_graphic_sprite
- @status_window = Window_MbookStatus.new
- @help_window = Window_MBookHelp.new
- end
- def terminate
- super
- dispose_menu_background
- @command_window.dispose
- @title_window.dispose
- @status_window.dispose
- @help_window.dispose
- @graphic_sprite.dispose
- end
- def update
- super
- if Input.trigger?(Input::C)
- Sound.play_decision
- draw_enemy_graphics
- @graphic_sprite.visible ^= true
- @command_window.active ^= true
- end
- return unless @command_window.active
- current_id = @command_window.index
- @command_window.update
- @status_window.update
- if Input.trigger?(Input::B)
- Sound.play_cancel
- $scene = @menu_index < 0 ? Scene_Map.new : Scene_Menu.new(@menu_index)
- end
- if @command_window.index != current_id
- @status_window.enemy = @command_window.index
- @help_window.draw_defeated_number(107, 0, 40, 24, @command_window.index)
- end
- end
- if CAO::MB::NO_WINDOW_GRAPHICS
- def create_menu_background
- @menuback_sprite = Sprite.new
- @menuback_sprite.bitmap = Cache.system("BackMBook")
- @menuback_sprite.z = 1
- update_menu_background
- end
- end
- def create_title_window
- @title_window = Window_Base.new(0, 8, 180, 56)
- @title_window.opacity = CAO::MB::NO_WINDOW_GRAPHICS ? 0 : 255
- unless CAO::MB::NO_SYSTEM_FONT
- @title_window.contents.font.color = @title_window.normal_color
- @title_window.contents.draw_text(0, 0, 148, 24, "怪物图鉴", 1)
- end
- end
- def create_command_window
- @command_window = Window_MbookCommand.new
- @command_window.index = 0
- end
- def create_graphic_sprite
- @graphic_sprite = Sprite.new
- @graphic_sprite.visible = false
- @graphic_sprite.bitmap = Bitmap.new(512, 384)
- @graphic_sprite.x = 16
- @graphic_sprite.y = 16
- @graphic_sprite.z = 200
- end
- def draw_enemy_graphics
- enemy = CAO::MB::Commands.unrestraint_array[@command_window.index]
- @graphic_sprite.bitmap.clear
- @graphic_sprite.bitmap.fill_rect(0, 0, 512, 384, Color.new(0, 0, 0, 128))
- bitmap = Cache.battler(enemy.data.battler_name, 0)
- if CAO::MB::ACCESS_PERMIT[enemy.entry].include?(:graphics)
- @graphic_sprite.color = Color.new(0, 0, 0, 0)
- else
- @graphic_sprite.color = Color.new(0, 0, 0)
- end
- x = (512 - bitmap.width) / 2
- y = (384 - bitmap.height) / 2
- @graphic_sprite.bitmap.blt( x, y, bitmap, bitmap.rect)
- end
- end
- class Scene_Battle < Scene_Base
- alias :_cao_battle_end_mbook :battle_end
- def battle_end(result)
- if result != 2 || CAO::MB::AUTO_ENTRY_LOSE
- for en in $game_troop.members
- enemy = CAO::MB::Commands.unrestraint_enemy(en.enemy_id)
- enemy.defeat += 1 if en.dead?
- if CAO::MB::AUTO_ENTRY && enemy.entry < 2
- if CAO::MB::AUTO_ENTRY_DEFEATED
- enemy.entry = 1 if en.dead?
- else
- enemy.entry = en.dead? ? 2 : 1
- end
- end
- end
- end
- _cao_battle_end_mbook(result)
- end
- alias :_cao_display_action_effects_mbook :display_action_effects
- def display_action_effects(target, obj = nil)
- if obj && /^<MB:解析>/ =~ obj.note
- unless target.skipped
- line_number = @message_window.line_number
- wait(5)
- display_critical(target, obj)
- display_damage(target, obj)
- display_state_changes(target, obj)
- if line_number == @message_window.line_number
- $game_system.mbook[target.enemy_id].entry = 3
- @message_window.add_instant_text("#{target.name}を解析した。")
- end
- if line_number != @message_window.line_number
- wait(30)
- end
- @message_window.back_to(line_number)
- end
- else
- _cao_display_action_effects_mbook(target, obj)
- end
- end
- end
复制代码 |
|