赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 497 |
最后登录 | 2012-4-29 |
在线时间 | 10 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 10 小时
- 注册时间
- 2012-1-18
- 帖子
- 8
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 以战止战 于 2012-1-18 21:08 编辑
- #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
- #_/ ◆ 怪物图鉴 - KGC_EnemyGuide ◆ VX ◆
- #_/ 汉化 by 约束
- #_/ ◇ Last update : 2008/08/28 ◇
- #_/----------------------------------------------------------------------------
- #_/ 作成怪物图鉴。
- #_/============================================================================
- #_/ 【基本機能】请在≪物品掉落扩张≫ 之上添加。
- #_/
- #_/ 使用方法:1.# ◆怪物的说明文,请在怪物的备注栏中添加<图鉴说明>要添加的说明,
- #_/ 例如对怪物的简要介绍</图鉴说明>,PS:尽量不要太长
- #_/ 2.# ◆图鉴的操作方法,图鉴画面是左侧的目录是怪物的名称排列,有关
- #_/ 他的情报在右方显示。在这个状况时按下右方向键,就会显示关于
- #_/ 这个敌人的说明文了。返回前一步请按左方向键。如果按下C键就
- #_/ 可以放大敌人图片了。
- #_/ 3.# ◆ 图鉴背景用图片表示 USE_BACKGROUND_IMAGE = true
- #_/ # ◆ 背景图片文件名 BACKGROUND_FILENAME = "EnemyGuideBack"
- #_/ 图片背景请按照给出的形式。
- #_/ 如果不使用背景图片的时候,会按照普通窗口处理。
- #_/ 4.# ◆表示完成度的参数 INFO_INTERVAL = 90
- #_/ 设定画面左上完成度与变换之间的时间(1秒等于60)
- #_/ 默认的是90,也就是每1.5秒改换一次
- #_/ 5.# ◆调出属性耐性的范围
- #_/ 在图鉴中设定排列耐性表现的属性ID,对象范围为(1..16 等)
- #_/ 的整数都可以用。
- #_/ 6.# ◆ 属性的ICON
- #_/ ELEMENT_ICON = [nil, # ID:0 是不体现
- #_/ 50, 1, 4, 14, 24, 12, 189, 136, # 格斗 ~ 吸收
- #_/ 104, 105, 106, 107, 108, 109, 110, 111, # 炎 ~ 黑暗
- #_/ ] # ← 这里不要消除!
- #_/ 各属性的ICON请在ICON图片中的编号,从第一行左端开始1,2,3
- #_/ 依次类推,一排是15个。
- #_/ 7.# ◆剧情用指令
- #_/ set_enemy_encountered(enemy_id[, enabled])
- #_/ 敌 IDenemy_id的遭遇状态设定为enabled。
- #_/ 设定enabled是true或者false。
- #_/ 省略enabled情况视为true。
- #_/ 例如:
- #_/ # 敌 ID:10 变为遭遇过
- #_/ set_enemy_encountered(10)
- #_/ # 敌 ID:20 变为未遭遇过
- #_/ set_enemy_encountered(20, false)
- #_/
- #_/ set_enemy_defeated(enemy_id[, enabled])
- #_/ 敌 IDenemy_id击败过状态设定为enabled。
- #_/ enabled的设定方法与set_enemy_encountered同样。
- #_/ 例如:
- #_/ # 敌 ID:10 变为击破过
- #_/ set_enemy_defeated(10)
- #_/ # 敌 ID:20 变为未击破过
- #_/ set_enemy_defeated(20, false)
- #_/ set_enemy_item_dropped(enemy_id, item_index[, enabled])
- #_/ 敌 IDenemy_id的item_index编号的物品掉落状态设定为enabled。
- #_/ item_index、第一个物品时用O。
- #_/ 如果添加了≪物品掉落扩张≫ 就用2以上的数值。具体参照你自己
- #_/ 设定过的情况。
- #_/ enabled的设定方法是与set_enemy_encountered等同样的。
- #_/ 例如:
- #_/ # 敌 ID:10 的第一个物品变为掉落过
- #_/ set_enemy_item_dropped(10, 0)
- #_/
- #_/ 8.# ◆ reset_enemy_guide
- #_/ 初始化图鉴。
- #_/ 9.# ◆ complete_enemy_guide
- #_/ 完成图鉴。
- #_/
- #_/ 10.# ◆ get_enemy_guide_completion[(variable_id)]
- #_/ 图鉴的完成度(% 为单位)从variable_id号的变量中取得。
- #_/ 取得后、变量中取得的数值作为返还应用值。
- #_/ 将variable_id省略时、就不能代入变量。
- #_/
- #_/ 例如
- #_/ # 图鉴的完成度在变量10号中取得
- #_/ get_enemy_guide_completion(10)
- #_/
- #_/ # 完成度 50% 以上后会怎样?
- #_/ if get_enemy_guide_completion >= 50
- #_/ p "IYH!"
- #_/ end
- #_/
- #_/ 11.# ◆ call_enemy_guide
- #_/ 呼出怪物图鉴。
- #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
- #==============================================================================
- # ★ カスタマイズ項目 - 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 = {
- :weak_element => "弱点属性",
- :resist_element => "耐性属性",
- :weak_state => "弱点状态",
- :resist_state => "无效状态",
- :exp => "经验值",
- :treasure => "物品",
- :drop_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, # 炎 ~ 黑暗
- ] # ← 这里不能消除!
- # ◆ 从图鉴中隐藏敌人
- # 排列想要从图鉴中隐藏的敌人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 = false
- # ◆ 菜单画面的「怪物图鉴」指令名称
- VOCAB_MENU_ENEMY_GUIDE = "怪物图鉴"
- end
- end
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- $imported = {} if $imported == nil
- $imported["EnemyGuide"] = true
- module KGC::EnemyGuide
- # 正规表现
- module Regexp
- # 敌人
- module Enemy
- # 图鉴说明开始
- BEGIN_GUIDE_DESCRIPTION = /<(?:GUIDE_DESCRIPTION|图鉴说明)>/i
- # 图鉴说明终了
- END_GUIDE_DESCRIPTION = /<\/(?:GUIDE_DESCRIPTION|图鉴说明)>/i
- end
- end
- #--------------------------------------------------------------------------
- # ○ Range と Integer 的排列按照 Integer 的排列 (排除重复的情况)
- #--------------------------------------------------------------------------
- def self.convert_integer_array(array)
- result = []
- array.each { |i|
- if i.is_a?(Range)
- result |= i.to_a
- elsif e.is_a?(Integer)
- result |= [i]
- end
- }
- return result
- end
- # 非表示的怪物资料
- HIDDEN_ENEMY_LIST = convert_integer_array(HIDDEN_ENEMIES)
- # 确认属性资料
- 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
- # enabled : true..遭遇过 false..未遭遇
- #--------------------------------------------------------------------------
- def set_enemy_encountered(enemy_id, enabled = true)
- $game_system.enemy_encountered[enemy_id] = enabled
- end
- #--------------------------------------------------------------------------
- # ○ 设定击败状态
- # enemy_id : 敌 ID
- # enabled : true..击败过 false..未击败
- #--------------------------------------------------------------------------
- def set_enemy_defeated(enemy_id, enabled = true)
- $game_system.enemy_defeated[enemy_id] = enabled
- 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
- #--------------------------------------------------------------------------
- # ○ 清空图鉴
- #--------------------------------------------------------------------------
- def reset_enemy_guide
- $game_system.enemy_encountered = []
- $game_system.enemy_defeated = []
- $game_system.enemy_item_dropped = []
- 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) }
- }
- end
- #--------------------------------------------------------------------------
- # ○ 已经获得图鉴?
- # enemy_id : 敌 ID
- #--------------------------------------------------------------------------
- def enemy_guide_include?(enemy_id)
- return false if KGC::EnemyGuide::HIDDEN_ENEMIES.include?(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.split(/[\r\n]+/).each { |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}\r\n"
- 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 # 物品掉落过的标志
- #--------------------------------------------------------------------------
- # ○ 取得遭遇过的标志
- #--------------------------------------------------------------------------
- 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
- 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
- if !last_collapsed && @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_KGC_EnemyGuide= hidden= unless $@
- def hidden=(value)
- hidden_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_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 == nil
- # ID顺序
- (1...$data_enemies.size).each { |i|
- @data << $data_enemies[i] if include?(i)
- }
- else
- # 指定顺序
- KGC::EnemyGuide::ENEMY_ORDER.each { |i|
- case i
- when Range # 制定范围
- i.each { |j|
- @data << $data_enemies[i] if include?(j)
- }
- when Integer # 指定ID
- @data << $data_enemies[i] if include?(i)
- end
- }
- end
- @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
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
- #==============================================================================
- # □ Window_EnemyGuideStatus
- #------------------------------------------------------------------------------
- # 在怪物图件上、表示简介的窗口。
- #==============================================================================
- class Window_EnemyGuideStatus < Window_Base
- #--------------------------------------------------------------------------
- # ○ 定数
- #--------------------------------------------------------------------------
- TYPE_PARAMETERS = 0 # 表现形式 : 属性
- TYPE_DESCRIPTION = 1 # 表现形式 : 说明
- #--------------------------------------------------------------------------
- # ● 公开即时变量
- #--------------------------------------------------------------------------
- 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 enemy=(enemy)
- @enemy = enemy
- refresh
- end
- #--------------------------------------------------------------------------
- # ○ 表示情报设定
- # type : 表示形式 (TYPE_PARAMETERS, TYPE_DESCRIPTION)
- #--------------------------------------------------------------------------
- def set_info_type(type)
- case type
- when TYPE_PARAMETERS
- self.ox = 0
- when TYPE_DESCRIPTION
- self.ox = self.width - 32
- end
- 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 * 2 - 32
- create_contents
- self.width = original_width
- 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)
- return
- end
- draw_status
- end
- #--------------------------------------------------------------------------
- # ○ 简介的描绘
- #--------------------------------------------------------------------------
- def draw_status
- draw_graphic
- draw_parameter
- draw_element
- draw_state
- draw_prize
- draw_description
- end
- #--------------------------------------------------------------------------
- # ○ 图解的描绘
- #--------------------------------------------------------------------------
- def draw_graphic
- bitmap = Cache.battler(enemy.battler_name, enemy.battler_hue)
- rect = Rect.new(0, 0, bitmap.width / 3, bitmap.height / 3)
- rect.x = (104 - rect.width) / 2
- rect.y = (96 - rect.height) / 2
- self.contents.stretch_blt(rect, bitmap, bitmap.rect)
- @enemy_sprite.bitmap.fill_rect(@enemy_sprite.bitmap.rect,
- Color.new(0, 0, 0, 160))
- rect.x = (Graphics.width - bitmap.width) / 2
- rect.y = (Graphics.height - bitmap.height) / 2
- @enemy_sprite.bitmap.blt(rect.x, rect.y, bitmap, bitmap.rect)
- end
- #--------------------------------------------------------------------------
- # ○ 参数的描画
- #--------------------------------------------------------------------------
- def draw_parameter
- param = {}
- if KGC::Commands.enemy_defeated?(enemy.id)
- param[:maxhp] = enemy.maxhp
- param[:maxmp] = enemy.maxmp
- param[:atk] = enemy.atk
- param[:def] = enemy.def
- param[:spi] = enemy.spi
- param[:agi] = enemy.agi
- else
- param[:maxhp] = param[:maxmp] = param[:atk] = param[:def] =
- param[:spi] = param[:agi] = KGC::EnemyGuide::UNDEFEATED_PARAMETER
- end
- # 名字, HP, MP
- dx = 112
- dy = 0
- self.contents.font.color = normal_color
- self.contents.draw_text(dx, dy, width - (32 + dx), 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)
- 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)
- # ATK ~ AGI
- dx = 0
- dy = 96
- 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)
- end
- #--------------------------------------------------------------------------
- # ○ 属性的描画
- #--------------------------------------------------------------------------
- def draw_element
- dx = 0
- dy = 96 + WLH * 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, 80, WLH,
- KGC::EnemyGuide::PARAMETER_NAME[:resist_element])
- return unless KGC::Commands.enemy_defeated?(enemy.id)
- # 弱点属性
- draw_icon_list(dx + 80, dy,
- 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,
- KGC::EnemyGuide::CHECK_ELEMENT_LIST,
- Proc.new { |i| enemy.element_ranks[i] > 3 },
- Proc.new { |i| KGC::EnemyGuide::ELEMENT_ICON[i] })
- end
- #--------------------------------------------------------------------------
- # ○ ICON目录的描画
- # dx, dy : 描画处 X, Y
- # item_list : 描画对象的目录
- # condition_proc : 描画条件 Proc
- # icon_index_proc : ICON index 取得用 Proc
- #--------------------------------------------------------------------------
- def draw_icon_list(dx, dy, item_list, condition_proc, icon_index_proc)
- ix = 0
- item_list.each { |item|
- next if item == nil
- if condition_proc.call(item)
- icon_index = icon_index_proc.call(item)
- if icon_index != nil && icon_index > 0
- draw_icon(icon_index, dx + ix, dy)
- ix += 24
- end
- end
- }
- end
- #--------------------------------------------------------------------------
- # ○ 状态的描画
- #--------------------------------------------------------------------------
- def draw_state
- dx = 0
- dy = 96 + WLH * 4
- 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, 80, WLH,
- KGC::EnemyGuide::PARAMETER_NAME[:resist_state])
- return unless KGC::Commands.enemy_defeated?(enemy.id)
- # 弱点状态
- draw_icon_list(dx + 80, dy,
- $data_states,
- Proc.new { |i| enemy.state_ranks[i.id] < 3 },
- Proc.new { |i| i.icon_index })
- # 无效状态
- draw_icon_list(dx + 80, dy + WLH,
- $data_states,
- Proc.new { |i| enemy.state_ranks[i.id] == 6 },
- Proc.new { |i| i.icon_index })
- end
- #--------------------------------------------------------------------------
- # ○ 战利品的描画
- #--------------------------------------------------------------------------
- def draw_prize
- param = {}
- if KGC::Commands.enemy_defeated?(enemy.id)
- param[:exp] = enemy.exp
- param[:gold] = enemy.gold
- else
- param[:exp] = param[:gold] = KGC::EnemyGuide::UNDEFEATED_PARAMETER
- end
- dx = 0
- dy = 96 + WLH * 6
- 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)
- self.contents.draw_text(dx, dy + WLH, 128, WLH,
- KGC::EnemyGuide::PARAMETER_NAME[:treasure], 1)
- self.contents.draw_text(dx + dw, dy + WLH, 128, WLH,
- KGC::EnemyGuide::PARAMETER_NAME[:drop_prob], 2)
- # EXP, Golds
- 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)
- return 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
- drop_items.delete_if { |i| i.kind == 0 }
- dx = 0
- dy += WLH * 2
- 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
- }
- 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
- text = KGC::EnemyGuide::UNDROPPED_ITEM_NAME
- if text.scan(/./).size == 1
- text = text * item.name.scan(/./).size
- end
- self.contents.draw_text(x + 24, y, 172, WLH, text)
- end
- #--------------------------------------------------------------------------
- # ○ 说明文的描画
- #--------------------------------------------------------------------------
- def draw_description
- dx = self.width - 32
- dy = 96
- self.contents.clear_rect(dx, dy, self.width - 32, self.height - 128)
- rect = Rect.new(0, 0, self.width - 32, 96)
- self.contents.blt(dx, 0, self.contents, rect)
- return unless KGC::Commands.enemy_defeated?(enemy.id)
- dx += 4
- enemy.enemy_guide_description.split(/[\r\n]+/).each { |line|
- self.contents.draw_text(dx, dy, self.width - 32, WLH, line)
- 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? # PLAYER的移动中?
- 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.set_info_type(Window_EnemyGuideStatus::TYPE_PARAMETERS)
- elsif Input.trigger?(Input::RIGHT)
- # 说明表示
- Sound.play_cursor
- @status_window.set_info_type(Window_EnemyGuideStatus::TYPE_DESCRIPTION)
- end
- end
- end
复制代码 |
|