赞 | 0 |
VIP | 8 |
好人卡 | 27 |
积分 | 58 |
经验 | 41413 |
最后登录 | 2012-10-21 |
在线时间 | 833 小时 |
Lv4.逐梦者 弓箭手?剑兰
- 梦石
- 0
- 星屑
- 5769
- 在线时间
- 833 小时
- 注册时间
- 2010-11-17
- 帖子
- 1140
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 一箭烂YiJL 于 2011-4-25 11:09 编辑
0.序
由于我和其他之前的人因为横战和图鉴功能不兼容,导致图鉴无效。
我在翻译的过程中大概明白里面的原理了,
于是就提供一个办法解决。(也不知道有没有人已经解决了呢?)
1.解决原理
原理是由于横战把Game_Enemy的perform_collapse改为非常古怪的方法。
于是我的方法是把怪物图鉴里Game_Enemy的perform_collapse改为:- alias perform_collapse_KGC_EnemyGuide perform_collapse
- def perform_collapse
- last_collapsed = @collapse
- perform_collapse_KGC_EnemyGuide
- @collapse = true if $game_temp.in_battle and dead?
- if !last_collapsed and @collapse
- # 开启击败过标志
- KGC::Commands.set_enemy_defeated(enemy_id)
- # 变身前的敌人也按照击败过来处理
- if KGC::EnemyGuide::ORIGINAL_DEFEAT
- @original_ids.compact.each { |i|
- KGC::Commands.set_enemy_defeated(i)
- }
- end
- end
- end
复制代码 这样就可以兼容了横战(+CP)。
2.效果图
必须把这幅图放在"Graphics\System\"下:
那么如果是不懂修改的话,我给这个最新的翻译版(约束的旧版+我其他的翻译)
3.脚本重发-Part1: - #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
- #_/ ◆ 怪物图鉴 - KGC_EnemyGuide ◆ VX ◆
- #_/ 翻译 约束的旧版 + 一箭烂
- #_/ ◇ Last update : 2008/11/16 ◇
- #_/----------------------------------------------------------------------------
- #_/ 作成怪物图鉴。
- #_/============================================================================
- #_/ 【基本機能】请在≪物品掉落扩张≫ 之上添加。
- #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
- #==============================================================================
- # ★ 定制項目 - Customize ★
- #==============================================================================
- module KGC
- module EnemyGuide
- # ◆ 图鉴用背景图片表示
- # true : 用背景图片代替原本窗口。
- # false : 使用平常窗口。
- USE_BACKGROUND_IMAGE = true
- # ◆ 背景图片的文件夹名
- # "Graphics/System/" 内载入。
- BACKGROUND_FILENAME = "EnemyGuideBack"
- # ◆ 完成度表示的间隔 [框架]
- INFO_INTERVAL = 90
- # ◆ 名字前面编号
- # true : 001: 史莱姆
- # false : 史莱姆
- SHOW_SERIAL_NUMBER = true
- # ◆ 标号按照目录排序
- # true : 无视ID的排列编号 。
- # false : 按照目录的排列顺序编号。
- SERIAL_NUM_FOLLOW = true
- # ◆ 编号的格式化字符串
- # 参照帮助的 sprintf 格式。
- SERIAL_NUM_FORMAT = "%03d: "
- # ◆ 未遭遇的敌人名字
- # 只写入一个文字的时候,会自动扩张成怪物名字的字数。
- UNKNOWN_ENEMY_NAME = "?"
- # ◆ 未遭遇敌人的资料表示
- UNENCOUNTERED_DATA = "- No Data -"
- # ◆ 图鉴的属性名
- PARAMETER_NAME = {
- :defeat_count => "打败次数",
- :weak_element => "弱点属性",
- :resist_element => "耐性属性",
- :weak_state => "弱点状态",
- :resist_state => "无效状态",
- :exp => "经验值",
- :treasure => "物品",
- :drop_prob => "掉落率",
- :steal_obj => "偷盗物品",
- :steal_prob => "成功率",
- } # ← 这里不能消除!
- # ◆ 未击破敌人的变数表示
- UNDEFEATED_PARAMETER = "???"
- # ◆ 未掉落物品的名字表示
- # 只写入一个文字的时候,会自动扩张成掉落物品名字的字数。
- UNDROPPED_ITEM_NAME = "?"
- # ◆ 调查耐性属性的范围
- # 容纳排列调查耐性属性的 ID 。
- # 使用.. 或 ... 范围指定都是可以的。
- ELEMENT_RANGE = [1..16]
- # ◆ 属性的ICON
- # 指定各属性的ICON编号。
- # 对应排列的添加字的属性ID。
- ELEMENT_ICON = [nil, # ID:0 是没有的
- 50, 1, 4, 14, 24, 12, 189, 136, # 格斗 ~ 吸收
- 104, 105, 106, 107, 108, 109, 110, 111, # 炎 ~ 黑暗
- ] # ← 这里不能消除!
- # ◆ 物品掉落是否显示
- # true : 显示
- # false : 不显示
- SHOW_DROP_ITEM = true
- # ◆ 是否显示偷盗
- # ≪偷盗≫ 有用的时候。
- SHOW_STEAL_OBJ = true
- # ◆ 从图鉴中隐藏敌人
- # 排列想要从图鉴中隐藏的敌人ID。
- # ID 和范围 (1..10 等), 哪种都可以。
- # <例> HIDDEN_ENEMIES = [2, 4, 8, 16..32]
- HIDDEN_ENEMIES = []
- # ◆ 敌人的排列顺序
- # 表示的敌人ID、排列成想要的顺序。
- # 使用.. 或 ... 范围指定都是可以的。
- # 没有被指定的敌人、或者 HIDDEN_ENEMIES 中指定过的敌人不表示。
- # (不适用这个机能的时候是 nil)
- ENEMY_ORDER = nil
- # ENEMY_ORDER = [1..5, 8..13, 6, 7, 14, 15]
- # ↑使用例子
- # ◆ 变身前的敌人也击破
- # true : 变身前的敌人也被看作是击败过。
- # false : 变身前的敌人不被看作是击败过(只是遭遇过)。
- ORIGINAL_DEFEAT = true
- # ◆ 菜单画面中「怪物图鉴」指令的追加
- # 追加的地点是、菜单画面指令列的最下方。
- # 如果想要在其他地方放置指令时请使用≪特制菜单指令排列≫ 脚本。
- USE_MENU_ENEMY_GUIDE_COMMAND = true
- # ◆ 菜单画面的「怪物图鉴」指令名称
- VOCAB_MENU_ENEMY_GUIDE = "怪物图鉴"
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- $imported = {} if $imported == nil
- $imported["EnemyGuide"] = true
- module KGC
- module_function
- #--------------------------------------------------------------------------
- # ○ 字符串屏蔽
- # str : 字符串被屏蔽
- # mask : 屏蔽字符串
- #--------------------------------------------------------------------------
- def mask_string(str, mask)
- text = mask
- if mask.scan(/./).size == 1
- text = mask * str.scan(/./).size
- end
- return text
- end
- end
- module KGC::EnemyGuide
- # 正则表达式
- module Regexp
- # 敌人
- module Enemy
- # 图鉴说明开始
- BEGIN_GUIDE_DESCRIPTION = /<(?:GUIDE_DESCRIPTION|图鉴说明)>/i
- # 图鉴说明结束
- END_GUIDE_DESCRIPTION = /<\/(?:GUIDE_DESCRIPTION|图鉴说明)>/i
- end
- end
- module_function
- #--------------------------------------------------------------------------
- # ○ Range | Integer 的排列按照 Integer 的排列 (排除重复的情况)
- #--------------------------------------------------------------------------
- def convert_integer_array(array)
- result = []
- array.each { |i|
- case i
- when Range
- result |= i.to_a
- when Integer
- result |= [i]
- end
- }
- return result
- end
- #--------------------------------------------------------------------------
- # ○ 看见敌人?
- #--------------------------------------------------------------------------
- def enemy_show?(enemy_id)
- return false if HIDDEN_ENEMY_LIST.include?(enemy_id)
- if ENEMY_ORDER_ID != nil
- return false unless ENEMY_ORDER_ID.include?(enemy_id)
- end
- return true
- end
- # 非表示的怪物资料
- HIDDEN_ENEMY_LIST = convert_integer_array(HIDDEN_ENEMIES)
- # 排序敌人 ID
- ENEMY_ORDER_ID = (ENEMY_ORDER == nil ? nil :
- convert_integer_array(ENEMY_ORDER))
- # 确认属性资料
- CHECK_ELEMENT_LIST = convert_integer_array(ELEMENT_RANGE)
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # □ KGC::Commands
- #==============================================================================
- module KGC
- module Commands
- module_function
- #--------------------------------------------------------------------------
- # ○ 取得遭遇状态
- # enemy_id : 敌 ID
- #--------------------------------------------------------------------------
- def enemy_encountered?(enemy_id)
- return $game_system.enemy_encountered[enemy_id]
- end
- #--------------------------------------------------------------------------
- # ○ 取得击破状态
- # enemy_id : 敵 ID
- #--------------------------------------------------------------------------
- def enemy_defeated?(enemy_id)
- return $game_system.enemy_defeated[enemy_id]
- end
- #--------------------------------------------------------------------------
- # ○ 取得掉落物品状态
- # enemy_id : 敌 ID
- # item_index : 掉落物品的号码
- #--------------------------------------------------------------------------
- def enemy_item_dropped?(enemy_id, item_index)
- if $game_system.enemy_item_dropped[enemy_id] == nil
- return false
- end
- result = $game_system.enemy_item_dropped[enemy_id] & (1 << item_index)
- return (result != 0)
- end
- #--------------------------------------------------------------------------
- # ○ 取得偷盗成功率
- # enemy_id : 敌 ID
- # item_index : 掉落物品的号码
- #--------------------------------------------------------------------------
- def enemy_object_stolen?(enemy_id, obj_index)
- if $game_system.enemy_object_stolen[enemy_id] == nil
- return false
- end
- result = $game_system.enemy_object_stolen[enemy_id] & (1 << obj_index)
- return (result != 0)
- end
- #--------------------------------------------------------------------------
- # ○ 设定遭遇状态
- # enemy_id : 敌 ID
- # enabled : true..遭遇过 false..未遭遇
- #--------------------------------------------------------------------------
- def set_enemy_encountered(enemy_id, enabled = true)
- $game_system.enemy_encountered[enemy_id] = enabled
- unless enabled
- # 未遭遇等于未击破
- set_enemy_defeated(enemy_id, false)
- end
- end
- #--------------------------------------------------------------------------
- # ○ 设定击败状态
- # enemy_id : 敌 ID
- # enabled : true..击败过 false..未击败
- #--------------------------------------------------------------------------
- def set_enemy_defeated(enemy_id, enabled = true)
- $game_system.enemy_defeated[enemy_id] = enabled
- if enabled
- # 被击败等于被遭遇
- set_enemy_encountered(enemy_id)
- end
- end
- #--------------------------------------------------------------------------
- # ○ 设定掉落物品的状态
- # enemy_id : 敌 ID
- # item_index : 掉落物品的编号
- # enabled : true..掉落过 false..未掉落
- #--------------------------------------------------------------------------
- def set_enemy_item_dropped(enemy_id, item_index, enabled = true)
- if $game_system.enemy_item_dropped[enemy_id] == nil
- $game_system.enemy_item_dropped[enemy_id] = 0
- end
- if enabled
- $game_system.enemy_item_dropped[enemy_id] |= (1 << item_index)
- else
- $game_system.enemy_item_dropped[enemy_id] &= ~(1 << item_index)
- end
- end
- #--------------------------------------------------------------------------
- # ○ 设定偷盗成功状态
- # enemy_id : 敌 ID
- # ojb_index : 掉落物品的编号
- # enabled : true..掉落过 false..未掉落
- #--------------------------------------------------------------------------
- def set_enemy_object_stolen(enemy_id, obj_index, enabled = true)
- if $game_system.enemy_object_stolen[enemy_id] == nil
- $game_system.enemy_object_stolen[enemy_id] = 0
- end
- if enabled
- $game_system.enemy_object_stolen[enemy_id] |= (1 << obj_index)
- else
- $game_system.enemy_object_stolen[enemy_id] &= ~(1 << obj_index)
- end
- end
- #--------------------------------------------------------------------------
- # ○ 清空图鉴
- #--------------------------------------------------------------------------
- def reset_enemy_guide
- $game_system.enemy_encountered = []
- $game_system.enemy_defeated = []
- $game_system.enemy_item_dropped = []
- $game_system.enemy_object_stolen = []
- end
- #--------------------------------------------------------------------------
- # ○ 图鉴完成
- #--------------------------------------------------------------------------
- def complete_enemy_guide
- (1...$data_enemies.size).each { |i|
- set_enemy_encountered(i)
- set_enemy_defeated(i)
- enemy = $data_enemies[i]
- items = [enemy.drop_item1, enemy.drop_item2]
- if $imported["ExtraDropItem"]
- items += enemy.extra_drop_items
- end
- items.each_index { |j| set_enemy_item_dropped(i, j) }
- if $imported["Steal"]
- objs = enemy.steal_objects
- objs.each_index { |j| set_enemy_object_stolen(i, j) }
- end
- }
- end
- #--------------------------------------------------------------------------
- # ○ 已经获得图鉴?
- # enemy_id : 敌 ID
- #--------------------------------------------------------------------------
- def enemy_guide_include?(enemy_id)
- return false unless KGC::EnemyGuide.enemy_show?(enemy_id)
- enemy = $data_enemies[enemy_id]
- return (enemy != nil && enemy.name != "")
- end
- #--------------------------------------------------------------------------
- # ○ 取得存在敌人的种类数
- # variable_id : 代入取得后的值的变量ID
- #--------------------------------------------------------------------------
- def get_all_enemies_number(variable_id = 0)
- n = 0
- (1...$data_enemies.size).each { |i|
- n += 1 if enemy_guide_include?(i)
- }
- $game_variables[variable_id] = n if variable_id > 0
- return n
- end
- #--------------------------------------------------------------------------
- # ○ 取得遭遇过敌人的种类数
- # variable_id : 代入取得后的值的变量ID
- #--------------------------------------------------------------------------
- def get_encountered_enemies_number(variable_id = 0)
- n = 0
- (1...$data_enemies.size).each { |i|
- if enemy_guide_include?(i) && $game_system.enemy_encountered[i]
- n += 1
- end
- }
- $game_variables[variable_id] = n if variable_id > 0
- return n
- end
- #--------------------------------------------------------------------------
- # ○ 取得击败过的敌人的种类数
- # variable_id : 代入取得后的值的变量ID
- #--------------------------------------------------------------------------
- def get_defeated_enemies_number(variable_id = 0)
- n = 0
- (1...$data_enemies.size).each { |i|
- if enemy_guide_include?(i) && $game_system.enemy_encountered[i] &&
- $game_system.enemy_defeated[i]
- n += 1
- end
- }
- $game_variables[variable_id] = n if variable_id > 0
- return n
- end
- #--------------------------------------------------------------------------
- # ○ 怪物图鉴完成度的取得
- # variable_id : 代入取得后的值的变量ID
- #--------------------------------------------------------------------------
- def get_enemy_guide_completion(variable_id = 0)
- num = get_all_enemies_number
- value = (num > 0 ? (get_defeated_enemies_number * 100 / num) : 0)
- $game_variables[variable_id] = value if variable_id > 0
- return value
- end
- #--------------------------------------------------------------------------
- # ○ 呼出怪物图鉴
- #--------------------------------------------------------------------------
- def call_enemy_guide
- return if $game_temp.in_battle
- $game_temp.next_scene = :enemy_guide
- end
- end
- end
- class Game_Interpreter
- include KGC::Commands
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Vocab
- #==============================================================================
- module Vocab
- # 怪物图鉴
- def self.enemy_guide
- return KGC::EnemyGuide::VOCAB_MENU_ENEMY_GUIDE
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ RPG::Enemy
- #==============================================================================
- class RPG::Enemy
- #--------------------------------------------------------------------------
- # ○ 怪物图鉴的存放处生成
- #--------------------------------------------------------------------------
- def create_enemy_guide_cache
- @__enemy_guide_description = ""
- description_flag = false
- self.note.each_line { |line|
- case line
- when KGC::EnemyGuide::Regexp::Enemy::BEGIN_GUIDE_DESCRIPTION
- # 说明文开始
- description_flag = true
- when KGC::EnemyGuide::Regexp::Enemy::END_GUIDE_DESCRIPTION
- # 说明文结束
- description_flag = false
- else
- if description_flag
- @__enemy_guide_description += line
- end
- end
- }
- end
- #--------------------------------------------------------------------------
- # ○ 图鉴说明文字
- #--------------------------------------------------------------------------
- def enemy_guide_description
- create_enemy_guide_cache if @__enemy_guide_description == nil
- return @__enemy_guide_description
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Game_System
- #==============================================================================
- class Game_System
- #--------------------------------------------------------------------------
- # ● 公开实例变量
- #--------------------------------------------------------------------------
- attr_writer :enemy_encountered # 遭遇过的标注
- attr_writer :enemy_defeated # 击败过的标志
- attr_writer :enemy_item_dropped # 物品掉落过的标志
- attr_writer :enemy_object_stolen # 偷盗成功的标志
- #--------------------------------------------------------------------------
- # ○ 取得遭遇过的标志
- #--------------------------------------------------------------------------
- def enemy_encountered
- @enemy_encountered = [] if @enemy_encountered == nil
- return @enemy_encountered
- end
- #--------------------------------------------------------------------------
- # ○ 取得击败过的标志
- #--------------------------------------------------------------------------
- def enemy_defeated
- @enemy_defeated = [] if @enemy_defeated == nil
- return @enemy_defeated
- end
- #--------------------------------------------------------------------------
- # ○ 物品掉落过的标志
- #--------------------------------------------------------------------------
- def enemy_item_dropped
- @enemy_item_dropped = [] if @enemy_item_dropped == nil
- return @enemy_item_dropped
- end
- #--------------------------------------------------------------------------
- # ○ 偷盗成功的标志
- #--------------------------------------------------------------------------
- def enemy_object_stolen
- @enemy_object_stolen = [] if @enemy_object_stolen == nil
- return @enemy_object_stolen
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Game_Enemy
- #==============================================================================
- class Game_Enemy < Game_Battler
- #--------------------------------------------------------------------------
- # ● 对象初始化
- # index : 敌人队伍中的目录
- # enemy_id : 敌人造型 ID
- #--------------------------------------------------------------------------
- alias initialize_KGC_EnemyGuide initialize
- def initialize(index, enemy_id)
- initialize_KGC_EnemyGuide(index, enemy_id)
- @original_ids = [] # 变身前的 ID
- # 开启遭遇过标志
- KGC::Commands.set_enemy_encountered(enemy_id) unless hidden
- end
- #--------------------------------------------------------------------------
- # ● 破坏
- #--------------------------------------------------------------------------
- alias perform_collapse_KGC_EnemyGuide perform_collapse
- def perform_collapse
- last_collapsed = @collapse
- perform_collapse_KGC_EnemyGuide
- @collapse = true if $game_temp.in_battle and dead?
- if !last_collapsed and @collapse
- # 开启击败过标志
- KGC::Commands.set_enemy_defeated(enemy_id)
- # 变身前的敌人也按照击败过来处理
- if KGC::EnemyGuide::ORIGINAL_DEFEAT
- @original_ids.compact.each { |i|
- KGC::Commands.set_enemy_defeated(i)
- }
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 变身
- # enemy_id : 变身前敌人造型 ID
- #--------------------------------------------------------------------------
- alias transform_KGC_EnemyGuide transform
- def transform(enemy_id)
- # 保存变身前的敌人ID
- @original_ids << @enemy_id
- transform_KGC_EnemyGuide(enemy_id)
- # 变身后的敌人也按照遭遇过来处理
- KGC::Commands.set_enemy_encountered(enemy_id)
- end
- #--------------------------------------------------------------------------
- # ● 隐藏状态的设定
- #--------------------------------------------------------------------------
- alias hidden_equal_KGC_EnemyGuide hidden= unless $@
- def hidden=(value)
- hidden_equal_KGC_EnemyGuide(value)
- # 出现过的场合为开启遭遇过的标志
- KGC::Commands.set_enemy_encountered(enemy_id) unless value
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Game_Troop
- #==============================================================================
- class Game_Troop < Game_Unit
- #--------------------------------------------------------------------------
- # ● 作成排列掉落物品
- #--------------------------------------------------------------------------
- def make_drop_items
- drop_items = []
- dead_members.each { |enemy|
- [enemy.drop_item1, enemy.drop_item2].each_with_index { |di, i|
- next if di.kind == 0
- next if rand(di.denominator) != 0
- if di.kind == 1
- drop_items.push($data_items[di.item_id])
- elsif di.kind == 2
- drop_items.push($data_weapons[di.weapon_id])
- elsif di.kind == 3
- drop_items.push($data_armors[di.armor_id])
- end
- # 调整掉落过标志
- KGC::Commands.set_enemy_item_dropped(enemy.enemy.id, i)
- }
- }
- return drop_items
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Window_Command
- #==============================================================================
- class Window_Command < Window_Selectable
- unless method_defined?(:add_command)
- #--------------------------------------------------------------------------
- # ○ 添加指令
- # 返回添加位置
- #--------------------------------------------------------------------------
- def add_command(command)
- @commands << command
- @item_max = @commands.size
- item_index = @item_max - 1
- refresh_command
- draw_item(item_index)
- return item_index
- end
- #--------------------------------------------------------------------------
- # ○ 刷新指令
- #--------------------------------------------------------------------------
- def refresh_command
- buf = self.contents.clone
- self.height = [self.height, row_max * WLH + 32].max
- create_contents
- self.contents.blt(0, 0, buf, buf.rect)
- buf.dispose
- end
- #--------------------------------------------------------------------------
- # ○ 插入指令
- #--------------------------------------------------------------------------
- def insert_command(index, command)
- @commands.insert(index, command)
- @item_max = @commands.size
- refresh_command
- refresh
- end
- #--------------------------------------------------------------------------
- # ○ 删除指令
- #--------------------------------------------------------------------------
- def remove_command(command)
- @commands.delete(command)
- @item_max = @commands.size
- refresh
- end
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # □ Window_EnemyGuideTop
- #------------------------------------------------------------------------------
- # 在怪物图鉴上显示完成度。
- #==============================================================================
- class Window_EnemyGuideTop < Window_Base
- #--------------------------------------------------------------------------
- # ● 对象初始化
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 240, WLH * 4 + 32)
- self.height = WLH + 32
- @duration = 0
- @interval = KGC::EnemyGuide::INFO_INTERVAL
- refresh
- if KGC::EnemyGuide::USE_BACKGROUND_IMAGE
- self.opacity = 0
- end
- if self.windowskin != nil
- bitmap = Bitmap.new(windowskin.width, windowskin.height)
- bitmap.blt(0, 0, windowskin, windowskin.rect)
- bitmap.clear_rect(80, 16, 32, 32)
- self.windowskin = bitmap
- end
- end
- #--------------------------------------------------------------------------
- # ● 释放
- #--------------------------------------------------------------------------
- def dispose
- self.windowskin.dispose
- super
- end
- #--------------------------------------------------------------------------
- # ● 更新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- total = KGC::Commands.get_all_enemies_number
- encountered = KGC::Commands.get_encountered_enemies_number
- defeated = KGC::Commands.get_defeated_enemies_number
- text = sprintf("遭遇数: %3d/%3d ",encountered, total)
- self.contents.draw_text(0, 0, width - 32, WLH, text, 1)
- self.contents.draw_text(0, WLH * 3, width - 32, WLH, text, 1)
- text = sprintf("击破数: %3d/%3d", defeated, total)
- self.contents.draw_text(0, WLH, width - 32, WLH, text, 1)
- text = sprintf("完成度: %3d%%", defeated * 100 / total)
- self.contents.draw_text(0, WLH * 2, width - 32, WLH, text, 1)
- end
- #--------------------------------------------------------------------------
- # ● 帧更新
- #--------------------------------------------------------------------------
- def update
- @duration += 1
- case @duration
- when @interval...(@interval + WLH)
- self.oy += 1
- when (@interval + WLH)
- @duration = 0
- if self.oy >= WLH * 3
- self.oy = 0
- end
- end
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # □ Window_EnemyGuideList
- #------------------------------------------------------------------------------
- # 怪物图件上表示怪物一栏的窗口。
- #==============================================================================
- class Window_EnemyGuideList < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 对象初始化
- #--------------------------------------------------------------------------
- def initialize
- super(0, WLH + 32, 240, Graphics.height - (WLH + 32))
- self.index = 0
- refresh
- if KGC::EnemyGuide::USE_BACKGROUND_IMAGE
- self.opacity = 0
- self.height -= (self.height - 32) % WLH
- end
- end
- #--------------------------------------------------------------------------
- # ○ 取得选择的怪物
- #--------------------------------------------------------------------------
- def item
- return @data[self.index]
- end
- #--------------------------------------------------------------------------
- # ○ 敌人的目录是否已获得
- # enemy_id : 敌 ID
- #--------------------------------------------------------------------------
- def include?(enemy_id)
- return KGC::Commands.enemy_guide_include?(enemy_id)
- end
- #--------------------------------------------------------------------------
- # ● 更新
- #--------------------------------------------------------------------------
- def refresh
- @data = []
- if KGC::EnemyGuide::ENEMY_ORDER_ID == nil
- # ID顺序
- enemy_list = 1...$data_enemies.size
- else
- # 指定顺序
- enemy_list = KGC::EnemyGuide::ENEMY_ORDER_ID
- end
- enemy_list.each { |i|
- @data << $data_enemies[i] if include?(i)
- }
- @item_max = @data.size
- create_contents
- for i in 0...@item_max
- draw_item(i)
- end
- end
- #--------------------------------------------------------------------------
- # ● 项目的描绘
- # index : 项目编号
- #--------------------------------------------------------------------------
- def draw_item(index)
- enemy = @data[index]
- self.contents.font.color = normal_color
- unless KGC::Commands.enemy_defeated?(enemy.id)
- self.contents.font.color.alpha = 128
- end
- rect = item_rect(index)
- self.contents.clear_rect(rect)
- if KGC::EnemyGuide::SHOW_SERIAL_NUMBER
- s_num = sprintf(KGC::EnemyGuide::SERIAL_NUM_FORMAT,
- KGC::EnemyGuide::SERIAL_NUM_FOLLOW ? (index + 1) : enemy.id)
- end
- text = (KGC::EnemyGuide::SHOW_SERIAL_NUMBER ? s_num : "")
- if KGC::Commands.enemy_encountered?(enemy.id)
- # 遭遇过
- text += enemy.name
- else
- # 未遭遇
- mask = KGC::EnemyGuide::UNKNOWN_ENEMY_NAME
- if mask.scan(/./).size == 1
- mask = mask * enemy.name.scan(/./).size
- end
- text += mask
- end
- self.contents.draw_text(rect, text)
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
复制代码 Part2:- #==============================================================================
- # □ Window_EnemyGuideStatus
- #------------------------------------------------------------------------------
- # 在怪物图件上、表示简介的窗口。
- #==============================================================================
- class Window_EnemyGuideStatus < Window_Base
- #--------------------------------------------------------------------------
- # ● 公开实例变量
- #--------------------------------------------------------------------------
- attr_reader :enemy # 表示敌人
- #--------------------------------------------------------------------------
- # ● 对象初始化
- #--------------------------------------------------------------------------
- def initialize
- super(240, 0, Graphics.width - 240, Graphics.height)
- self.enemy = nil
- self.z = 100
- if KGC::EnemyGuide::USE_BACKGROUND_IMAGE
- self.opacity = 0
- end
- @show_sprite = false
- @enemy_sprite = Sprite.new
- @enemy_sprite.bitmap = Bitmap.new(Graphics.width, Graphics.height)
- @enemy_sprite.x = 0
- @enemy_sprite.y = 0
- @enemy_sprite.z = self.z + 100
- @enemy_sprite.visible = false
- end
- #--------------------------------------------------------------------------
- # ● 释放
- #--------------------------------------------------------------------------
- def dispose
- super
- @enemy_sprite.bitmap.dispose
- @enemy_sprite.dispose
- end
- #--------------------------------------------------------------------------
- # ○ 物件页是否显示
- #--------------------------------------------------------------------------
- def item_page_show?
- return true if KGC::EnemyGuide::SHOW_DROP_ITEM
- return true if $imported["Steal"] && KGC::EnemyGuide::SHOW_STEAL_OBJ
- return false
- end
- #--------------------------------------------------------------------------
- # ○ 取得页数
- #--------------------------------------------------------------------------
- def pages
- return (item_page_show? ? 3 : 2)
- end
- #--------------------------------------------------------------------------
- # ○ 表示敌人设定
- #--------------------------------------------------------------------------
- def enemy=(enemy)
- @enemy = enemy
- refresh
- end
- #--------------------------------------------------------------------------
- # ○ 更改显示的信息
- # shamt : 移动页
- #--------------------------------------------------------------------------
- def shift_info_type(shamt)
- n = self.ox + (width - 32) * shamt
- self.ox = [[n, 0].max, (width - 32) * (pages - 1)].min
- end
- #--------------------------------------------------------------------------
- # ○ sprite的表示切换
- #--------------------------------------------------------------------------
- def switch_sprite
- @show_sprite = !@show_sprite
- @enemy_sprite.visible = @show_sprite
- end
- #--------------------------------------------------------------------------
- # ● 更新
- #--------------------------------------------------------------------------
- def refresh
- original_width = self.width
- self.width = original_width * pages - (32 * (pages - 1))
- create_contents
- self.width = original_width
- draw_enemy_sprite
- return if enemy == nil
- self.contents.font.color = normal_color
- # 没有遭遇
- unless KGC::Commands.enemy_encountered?(enemy.id)
- self.contents.font.color.alpha = 128
- dy = (height - 32) / 2
- dy -= dy % WLH
- self.contents.draw_text(0, dy, width - 32, WLH,
- KGC::EnemyGuide::UNENCOUNTERED_DATA, 1)
- self.contents.blt(width - 32, 0, self.contents, self.contents.rect)
- return
- end
- draw_status
- end
- #--------------------------------------------------------------------------
- # ○ 简介的描绘
- #--------------------------------------------------------------------------
- def draw_status
- # Page 1
- dy = draw_basic_info(0, 0)
- dy = draw_parameter2(0, dy)
- dy = draw_element(0, dy, 2)
- dy = draw_state(0, dy, 2)
- draw_prize(0, dy)
- # Page 2 (如果你只看到相关的项目)
- if item_page_show?
- dx = width - 32
- dy = draw_basic_info(dx, 0)
- max_rows = (self.height - dy - 32) / WLH
- rows = (max_rows + 1) / (pages - 1)
- dy = draw_drop_item(dx, dy, rows)
- draw_steal_object(dx, dy, max_rows - rows)
- end
- # Page 3
- dx = (width - 32) * (pages - 1)
- dy = draw_basic_info(dx, 0)
- draw_description(dx, dy)
- end
- #--------------------------------------------------------------------------
- # ○ 基本请报页
- # dx, dy : 描画先 X, Y
- #--------------------------------------------------------------------------
- def draw_basic_info(dx, dy)
- draw_graphic(dx, dy)
- draw_parameter1(dx + 112, dy)
- return dy + 96
- end
- #--------------------------------------------------------------------------
- # ○ 图解的描绘
- # dx, dy : 描画先 X, Y
- #--------------------------------------------------------------------------
- def draw_graphic(dx, dy)
- buf = Bitmap.new(108, 96)
- bitmap = Cache.battler(enemy.battler_name, enemy.battler_hue)
- rect = Rect.new(0, 0, bitmap.width / 3, bitmap.height / 3)
- rect.x = (108 - rect.width) / 2
- rect.y = (96 - rect.height) / 2
- buf.stretch_blt(rect, bitmap, bitmap.rect)
- self.contents.blt(dx, dy, buf, buf.rect)
- buf.dispose
- end
- #--------------------------------------------------------------------------
- # ○ 敌人精灵的描画
- #--------------------------------------------------------------------------
- def draw_enemy_sprite
- return if @enemy_sprite == nil
- @enemy_sprite.bitmap.fill_rect(@enemy_sprite.bitmap.rect,
- Color.new(0, 0, 0, 160))
- return if enemy == nil || !KGC::Commands.enemy_encountered?(enemy.id)
- bitmap = Cache.battler(enemy.battler_name, enemy.battler_hue)
- dx = (Graphics.width - bitmap.width) / 2
- dy = (Graphics.height - bitmap.height) / 2
- @enemy_sprite.bitmap.blt(dx, dy, bitmap, bitmap.rect)
- end
- #--------------------------------------------------------------------------
- # ○ 参数的描画 - 1
- # dx, dy : 描画先 X, Y
- #--------------------------------------------------------------------------
- def draw_parameter1(dx, dy)
- # 名前, HP, MP
- param = {}
- if KGC::Commands.enemy_defeated?(enemy.id)
- param[:maxhp] = enemy.maxhp
- param[:maxmp] = enemy.maxmp
- if $imported["BattleCount"]
- param[:defeat_count] = KGC::Commands.get_defeat_count(enemy.id)
- end
- else
- param[:maxhp] = param[:maxmp] = KGC::EnemyGuide::UNDEFEATED_PARAMETER
- param[:defeat_count] = 0
- end
- self.contents.font.color = normal_color
- self.contents.draw_text(dx, dy, width - 144, WLH, enemy.name)
- self.contents.font.color = system_color
- self.contents.draw_text(dx, dy + WLH, 80, WLH, Vocab.hp)
- self.contents.draw_text(dx, dy + WLH * 2, 80, WLH, Vocab.mp)
- if $imported["BattleCount"]
- self.contents.draw_text(dx, dy + WLH * 3, 80, WLH,
- KGC::EnemyGuide::PARAMETER_NAME[:defeat_count])
- end
- self.contents.font.color = normal_color
- self.contents.draw_text(dx + 88, dy + WLH, 64, WLH, param[:maxhp], 2)
- self.contents.draw_text(dx + 88, dy + WLH * 2, 64, WLH, param[:maxmp], 2)
- if $imported["BattleCount"]
- self.contents.draw_text(dx + 88, dy + WLH * 3, 64, WLH,
- param[:defeat_count], 2)
- end
- end
- #--------------------------------------------------------------------------
- # ○ 参数的描画 - 2
- # dx, dy : 描画先 X, Y
- #--------------------------------------------------------------------------
- def draw_parameter2(dx, dy)
- # ATK ~ AGI
- param = {}
- if KGC::Commands.enemy_defeated?(enemy.id)
- param[:atk] = enemy.atk
- param[:def] = enemy.def
- param[:spi] = enemy.spi
- param[:agi] = enemy.agi
- else
- param[:atk] = param[:def] = param[:spi] = param[:agi] =
- KGC::EnemyGuide::UNDEFEATED_PARAMETER
- end
- dw = (width - 32) / 2
- self.contents.font.color = system_color
- self.contents.draw_text(dx, dy, 80, WLH, Vocab.atk)
- self.contents.draw_text(dx + dw, dy, 80, WLH, Vocab.def)
- self.contents.draw_text(dx, dy + WLH, 80, WLH, Vocab.spi)
- self.contents.draw_text(dx + dw, dy + WLH, 80, WLH, Vocab.agi)
- dx += 80
- self.contents.font.color = normal_color
- self.contents.draw_text(dx, dy, 48, WLH, param[:atk], 2)
- self.contents.draw_text(dx + dw, dy, 48, WLH, param[:def], 2)
- self.contents.draw_text(dx , dy + WLH, 48, WLH, param[:spi], 2)
- self.contents.draw_text(dx + dw, dy + WLH, 48, WLH, param[:agi], 2)
- return dy + WLH * 2
- end
- #--------------------------------------------------------------------------
- # ○ 属性的描画
- # dx, dy : 描画先 X, Y
- # rows : 行数
- #--------------------------------------------------------------------------
- def draw_element(dx, dy, rows = 1)
- new_dy = dy + WLH * (rows * 2)
- self.contents.font.color = system_color
- self.contents.draw_text(dx, dy, 80, WLH,
- KGC::EnemyGuide::PARAMETER_NAME[:weak_element])
- self.contents.draw_text(dx, dy + WLH * rows, 80, WLH,
- KGC::EnemyGuide::PARAMETER_NAME[:resist_element])
- return new_dy unless KGC::Commands.enemy_defeated?(enemy.id)
- cols = (width - 112) / 24
- # 弱点属性
- draw_icon_list(dx + 80, dy, rows, cols,
- KGC::EnemyGuide::CHECK_ELEMENT_LIST,
- Proc.new { |i| enemy.element_ranks[i] < 3 },
- Proc.new { |i| KGC::EnemyGuide::ELEMENT_ICON[i] })
- # 耐性属性
- draw_icon_list(dx + 80, dy + WLH * rows, rows, cols,
- KGC::EnemyGuide::CHECK_ELEMENT_LIST,
- Proc.new { |i| enemy.element_ranks[i] > 3 },
- Proc.new { |i| KGC::EnemyGuide::ELEMENT_ICON[i] })
- return new_dy
- end
- #--------------------------------------------------------------------------
- # ○ ICON目录的描画
- # dx, dy : 描画处 X, Y
- # rows, cols : 行列数
- # item_list : 描画对象的目录
- # cond_proc : 描画条件 Proc
- # index_proc : ICON index 取得用 Proc
- #--------------------------------------------------------------------------
- def draw_icon_list(dx, dy, rows, cols, item_list, cond_proc, index_proc)
- nc = 0 # 现在的列数
- nr = 0 # 先在的行数
- item_list.each { |item|
- next if item == nil
- next unless cond_proc.call(item)
- icon_index = index_proc.call(item)
- next if icon_index == nil || icon_index == 0
- draw_icon(icon_index, dx + nc * 24, dy + nr * 24)
- nc += 1
- if nc == cols
- # 次の行へ
- nc = 0
- nr += 1
- break if nr == rows # 行制限オーバー
- end
- }
- end
- #--------------------------------------------------------------------------
- # ○ 状态的描画
- # dx, dy : 描画先 X, Y
- # rows : 行数
- #--------------------------------------------------------------------------
- def draw_state(dx, dy, rows = 1)
- new_dy = dy + WLH * (rows * 2)
- self.contents.font.color = system_color
- self.contents.draw_text(dx, dy, 80, WLH,
- KGC::EnemyGuide::PARAMETER_NAME[:weak_state])
- self.contents.draw_text(dx, dy + WLH * rows, 80, WLH,
- KGC::EnemyGuide::PARAMETER_NAME[:resist_state])
- return new_dy unless KGC::Commands.enemy_defeated?(enemy.id)
- cols = (width - 112) / 24
- # 弱点状态
- draw_icon_list(dx + 80, dy, rows, cols,
- $data_states,
- Proc.new { |i| enemy.state_ranks[i.id] < 3 },
- Proc.new { |i| i.icon_index })
- # 无效状态
- draw_icon_list(dx + 80, dy + WLH * rows, rows, cols,
- $data_states,
- Proc.new { |i| enemy.state_ranks[i.id] == 6 },
- Proc.new { |i| i.icon_index })
- return new_dy
- end
- #--------------------------------------------------------------------------
- # ○ EXP, Gold 描画
- # dx, dy : 描画先 X, Y
- #--------------------------------------------------------------------------
- def draw_prize(dx, dy)
- param = {}
- if KGC::Commands.enemy_defeated?(enemy.id)
- param[:exp] = enemy.exp
- param[:gold] = enemy.gold
- param[:ap] = enemy.ap if $imported["EquipLearnSkill"]
- else
- param[:exp] = param[:gold] = param[:ap] =
- KGC::EnemyGuide::UNDEFEATED_PARAMETER
- end
- dw = (width - 32) / 2
- self.contents.font.color = system_color
- self.contents.draw_text(dx, dy, 80, WLH,
- KGC::EnemyGuide::PARAMETER_NAME[:exp])
- self.contents.draw_text(dx + dw, dy, 80, WLH, Vocab.gold)
- if $imported["EquipLearnSkill"]
- self.contents.draw_text(dx, dy + WLH, 80, WLH, Vocab.ap)
- end
- # EXP, Gold
- dx += 76
- self.contents.font.color = normal_color
- self.contents.draw_text(dx, dy, 52, WLH, param[:exp], 2)
- self.contents.draw_text(dx + dw, dy, 52, WLH, param[:gold], 2)
- if $imported["EquipLearnSkill"]
- self.contents.draw_text(dx, dy + WLH, 52, WLH, param[:ap], 2)
- end
- return dy + WLH * 2
- end
- #--------------------------------------------------------------------------
- # ○ 战利品的描画
- # dx, dy : 描画先 X, Y
- # rows : 行数
- #--------------------------------------------------------------------------
- def draw_drop_item(dx, dy, rows)
- return dy unless KGC::EnemyGuide::SHOW_DROP_ITEM
- new_dy = dy + WLH * rows
- dw = (width - 32) / 2
- self.contents.font.color = system_color
- self.contents.draw_text(dx, dy, 128, WLH,
- KGC::EnemyGuide::PARAMETER_NAME[:treasure], 1)
- self.contents.draw_text(dx + dw, dy, 128, WLH,
- KGC::EnemyGuide::PARAMETER_NAME[:drop_prob], 2)
- return new_dy unless KGC::Commands.enemy_defeated?(enemy.id)
- # 列表
- drop_items = [enemy.drop_item1, enemy.drop_item2]
- if $imported["ExtraDropItem"]
- drop_items += enemy.extra_drop_items
- end
- dy += WLH
- count = 0
- drop_items.each_with_index { |item, i|
- # 物品名
- case item.kind
- when 0
- next
- when 1
- drop_item = $data_items[item.item_id]
- when 2
- drop_item = $data_weapons[item.weapon_id]
- when 3
- drop_item = $data_armors[item.armor_id]
- end
- if KGC::Commands.enemy_item_dropped?(enemy.id, i)
- draw_item_name(drop_item, dx, dy)
- else
- draw_masked_item_name(drop_item, dx, dy)
- end
- # 掉落率
- if $imported["ExtraDropItem"] && item.drop_prob > 0
- text = sprintf("%d%%", item.drop_prob)
- else
- text = "1/#{item.denominator}"
- end
- self.contents.draw_text(dx + dw, dy, 128, WLH, text, 2)
- dy += WLH
- count += 1
- break if count == rows
- }
- return new_dy
- end
- #--------------------------------------------------------------------------
- # ○ 物品名为遮挡的描画
- # item : 物品 (机能、武器、防具都可以)
- # x : 描画处 X 坐标
- # y : 描画出 Y 坐标
- # enabled : 有効标志。false 的时候半透明的描画
- #--------------------------------------------------------------------------
- def draw_masked_item_name(item, x, y, enabled = true)
- return if item == nil
- draw_icon(item.icon_index, x, y, enabled)
- self.contents.font.color = normal_color
- self.contents.font.color.alpha = enabled ? 255 : 128
- mask = KGC::EnemyGuide::UNDROPPED_ITEM_NAME
- text = KGC.mask_string(item.name, mask)
- self.contents.draw_text(x + 24, y, 172, WLH, text)
- end
- #--------------------------------------------------------------------------
- # ○ 偷盗名为遮挡的描画
- # dx, dy : 描画先 X, Y
- # rows : 行数
- #--------------------------------------------------------------------------
- def draw_steal_object(dx, dy, rows)
- return dy unless $imported["Steal"] && KGC::EnemyGuide::SHOW_STEAL_OBJ
- new_dy = dy + WLH * rows
- dw = (width - 32) / 2
- self.contents.font.color = system_color
- self.contents.draw_text(dx, dy, 128, WLH,
- KGC::EnemyGuide::PARAMETER_NAME[:steal_obj], 1)
- self.contents.draw_text(dx + dw, dy, 128, WLH,
- KGC::EnemyGuide::PARAMETER_NAME[:steal_prob], 2)
- return new_dy unless KGC::Commands.enemy_defeated?(enemy.id)
- # 列表
- steal_objects = enemy.steal_objects.clone
- if steal_objects.size >= rows
- steal_objects = steal_objects[0...(rows - 1)]
- end
- dy += WLH
- steal_objects.each_with_index { |obj, i|
- if obj.kind == 4
- # Gold
- if KGC::Commands.enemy_object_stolen?(enemy.id, i)
- text = sprintf("%d%s", obj.gold, Vocab.gold)
- else
- mask = KGC::EnemyGuide::UNDROPPED_ITEM_NAME
- text = KGC.mask_string("aaa", mask)
- end
- self.contents.draw_text(dx + 24, dy, dw, WLH, text)
- else
- # Item
- case obj.kind
- when 1
- item = $data_items[obj.item_id]
- when 2
- item = $data_weapons[obj.weapon_id]
- when 3
- item = $data_armors[obj.armor_id]
- end
- if KGC::Commands.enemy_object_stolen?(enemy.id, i)
- draw_item_name(item, dx, dy)
- else
- draw_masked_item_name(item, dx, dy)
- end
- end
- # 成功率
- if obj.success_prob > 0
- text = sprintf("%d%%", obj.success_prob)
- else
- text = "1/#{obj.denominator}"
- end
- self.contents.draw_text(dx + dw, dy, 128, WLH, text, 2)
- dy += WLH
- }
- return new_dy
- end
- #--------------------------------------------------------------------------
- # ○ 说明文字描画
- # dx, dy : 描画先 X, Y
- #--------------------------------------------------------------------------
- def draw_description(dx, dy)
- return unless KGC::Commands.enemy_defeated?(enemy.id)
- dx += 4
- enemy.enemy_guide_description.each_line { |line|
- self.contents.draw_text(dx, dy, width - 32, WLH, line.chomp)
- dy += WLH
- }
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Scene_Map
- #==============================================================================
- class Scene_Map < Scene_Base
- #--------------------------------------------------------------------------
- # ● 实行画面的切换
- #--------------------------------------------------------------------------
- alias update_scene_change_KGC_EnemyGuide update_scene_change
- def update_scene_change
- return if $game_player.moving? # 玩家的移动中?
- if $game_temp.next_scene == :enemy_guide
- call_enemy_guide
- return
- end
- update_scene_change_KGC_EnemyGuide
- end
- #--------------------------------------------------------------------------
- # ○ 切换到怪物图鉴
- #--------------------------------------------------------------------------
- def call_enemy_guide
- $game_temp.next_scene = nil
- $scene = Scene_EnemyGuide.new(0, Scene_EnemyGuide::HOST_MAP)
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # ■ Scene_Menu
- #==============================================================================
- class Scene_Menu < Scene_Base
- if KGC::EnemyGuide::USE_MENU_ENEMY_GUIDE_COMMAND
- #--------------------------------------------------------------------------
- # ● 作成指令窗口
- #--------------------------------------------------------------------------
- alias create_command_window_KGC_EnemyGuide create_command_window
- def create_command_window
- create_command_window_KGC_EnemyGuide
- return if $imported["CustomMenuCommand"]
- @__command_enemy_guide_index =
- @command_window.add_command(Vocab.enemy_guide)
- if @command_window.oy > 0
- @command_window.oy -= Window_Base::WLH
- end
- @command_window.index = @menu_index
- end
- end
- #--------------------------------------------------------------------------
- # ● 指令选择的更新
- #--------------------------------------------------------------------------
- alias update_command_selection_KGC_EnemyGuide update_command_selection
- def update_command_selection
- current_menu_index = @__command_enemy_guide_index
- call_enemy_guide_flag = false
- if Input.trigger?(Input::C)
- case @command_window.index
- when @__command_enemy_guide_index # 怪物图鉴
- call_enemy_guide_flag = true
- end
- end
- # 移动到怪物图鉴
- if call_enemy_guide_flag
- Sound.play_decision
- $scene = Scene_EnemyGuide.new(@__command_enemy_guide_index,
- Scene_EnemyGuide::HOST_MENU)
- return
- end
- update_command_selection_KGC_EnemyGuide
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # □ Scene_EnemyGuide
- #------------------------------------------------------------------------------
- # 进行怪物图鉴画面的处理的目录。
- #==============================================================================
- class Scene_EnemyGuide < Scene_Base
- HOST_MENU = 0
- HOST_MAP = 1
- #--------------------------------------------------------------------------
- # ● 对象初始化
- # menu_index : 指令光标初期位置
- # host_scene : 呼出原处 (0..菜单 1..地图)
- #--------------------------------------------------------------------------
- def initialize(menu_index = 0, host_scene = HOST_MENU)
- @menu_index = menu_index
- @host_scene = host_scene
- end
- #--------------------------------------------------------------------------
- # ● 开始的处理
- #--------------------------------------------------------------------------
- def start
- super
- create_menu_background
- if KGC::EnemyGuide::USE_BACKGROUND_IMAGE
- @back_sprite = Sprite.new
- begin
- @back_sprite.bitmap = Cache.system(KGC::EnemyGuide::BACKGROUND_FILENAME)
- rescue
- @back_sprite.bitmap = Bitmap.new(32, 32)
- end
- end
- @top_window = Window_EnemyGuideTop.new
- @enemy_window = Window_EnemyGuideList.new
- @status_window = Window_EnemyGuideStatus.new
- @status_window.enemy = @enemy_window.item
- end
- #--------------------------------------------------------------------------
- # ● 退出场景
- #--------------------------------------------------------------------------
- def terminate
- super
- dispose_menu_background
- if @back_sprite != nil
- @back_sprite.bitmap.dispose
- @back_sprite.dispose
- end
- @top_window.dispose
- @enemy_window.dispose
- @status_window.dispose
- end
- #--------------------------------------------------------------------------
- # ○ 返回原菜单画面
- #--------------------------------------------------------------------------
- def return_scene
- case @host_scene
- when HOST_MENU
- $scene = Scene_Menu.new(@menu_index)
- when HOST_MAP
- $scene = Scene_Map.new
- end
- end
- #--------------------------------------------------------------------------
- # ● 帧更新
- #--------------------------------------------------------------------------
- def update
- super
- update_menu_background
- @top_window.update
- @enemy_window.update
- @status_window.update
- if @enemy_window.active
- update_enemy_selection
- end
- end
- #--------------------------------------------------------------------------
- # ○ 敌人选择的更新
- #--------------------------------------------------------------------------
- def update_enemy_selection
- if @last_index != @enemy_window.index
- @status_window.enemy = @enemy_window.item
- @last_index = @enemy_window.index
- end
- if Input.trigger?(Input::B)
- Sound.play_cancel
- return_scene
- elsif Input.trigger?(Input::A) || Input.trigger?(Input::C)
- # sprte的表示切换
- Sound.play_decision
- @status_window.switch_sprite
- elsif Input.trigger?(Input::LEFT)
- # 参数表示
- Sound.play_cursor
- @status_window.shift_info_type(-1)
- elsif Input.trigger?(Input::RIGHT)
- # 说明表示
- Sound.play_cursor
- @status_window.shift_info_type(1)
- end
- end
- end
复制代码 |
评分
-
查看全部评分
|