赞 | 0 |
VIP | 0 |
好人卡 | 1 |
积分 | 4 |
经验 | 868 |
最后登录 | 2014-6-14 |
在线时间 | 628 小时 |
Lv2.观梦者
- 梦石
- 0
- 星屑
- 448
- 在线时间
- 628 小时
- 注册时间
- 2011-9-27
- 帖子
- 3996
|
本帖最后由 小白玩家 于 2011-12-22 16:30 编辑
XP能用怪物图鉴,如果你已经有了,当我打酱油路过~
因为,有错误,从新贴一下脚本
来源地址也贴一下
http://rpg.blue/forum.php?mod=vi ... E9%89%B4&page=1- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- #——————————————————————————————————————
- #魔物图鉴+介绍
- #
- #战斗终了时自动添加敌人进入图鉴(class Scene_Battle start_phase5 追加。目前与各种战斗系统没有发现冲突)
- #不想加入图鉴的怪物设置其“不加入图鉴”属性有效度为A即可
- #图鉴完成度的表示功能追加
- #SHOW_COMPLETE_TYPE 的数值可以设定
- #当为1,显示现有个数/总数,当为2,显示完成百分比,当为3,全显示。
- #使用方法:$scene = Scene_MonsterBook.new
- #数据库中属性里面那些种族特效的位置,建议把默认的“对 不死”之类改成“不死”,不然显示会很奇怪
- #由于雷达图的设计问题,只支持8项属性
- #默认种族特效处理属性中编号9到编号16,如果你做了修改请自行改动380行左右的for i in 9..16这一句代码
- #显示各种信息位于630行左右,想不显示的话只要删除相应语句
- CHARA_INFO=[]#怪物的介绍,对应怪物id,空格为换行,同时也会自动换行,没有写介绍的怪物会自动显示“无详细信息”
- CHARA_INFO[1] = "怪物介绍1"
- CHARA_INFO[2] = "怪物介绍2"
- CHARA_INFO[3] = "生活在潮湿的沼泽地区的变异生物,性情凶暴,经常会袭击各种路过的生物"
- #没有信息测试,4号怪物
- #=============
- #雷达图相关处理部分
- #=============
- class Bitmap
- def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
- distance = (start_x - end_x).abs + (start_y - end_y).abs
- if end_color == start_color
- for i in 1..distance
- x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
- y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
- if width == 1
- self.set_pixel(x, y, start_color)
- else
- self.fill_rect(x, y, width, width, start_color)
- end
- end
- else
- for i in 1..distance
- x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
- y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
- r = start_color.red * (distance-i)/distance + end_color.red * i/distance
- g = start_color.green * (distance-i)/distance + end_color.green * i/distance
- b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
- a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
- if width == 1
- self.set_pixel(x, y, Color.new(r, g, b, a))
- else
- self.fill_rect(x, y, width, width, Color.new(r, g, b, a))
- end
- end
- end
- end
- end
- #=============
- # Graphic_Def_Elem
- #=============
- class Window_Base
- FONT_SIZE = 18
- WORD_ELEMENT_GUARD = "属性有效度"
- NUMBER_OF_ELEMENTS = 8
- ELEMENT_ORDER = [1,3,8,5,2,4,7,6]
- GRAPH_SCALINE_COLOR = Color.new(255, 255, 255, 128)
- GRAPH_SCALINE_COLOR_SHADOW = Color.new( 0, 0, 0, 192)
- GRAPH_LINE_COLOR = Color.new(255, 255, 64, 255)
- GRAPH_LINE_COLOR_MINUS = Color.new( 64, 255, 255, 255)
- GRAPH_LINE_COLOR_PLUS = Color.new(255, 64, 64, 255)
- end
- #——————————————————————————————————————
- module Enemy_Book_Config
- DROP_ITEM_NEED_ANALYZE = true #显示物品
- EVA_NAME = "回避修正" #回避修正的名称(因为数据库中没有定义)
- SHOW_COMPLETE_TYPE = 3 #图鉴完成率表示方法
- end
- class Data_MonsterBook
- #--------------------------------------------------------------------------
- # ● 图鉴用ID設定
- #--------------------------------------------------------------------------
- def enemy_book_id_set
- data = [0]
- data[1] = 2
- data[2] = 1
- data[3] = 15
- data[4] = 25
- data[5] = 18
- data[6] = 30
- return data
- end
- end
- class Game_Temp
- attr_accessor :enemy_book_data
- alias temp_enemy_book_data_initialize initialize
- def initialize
- temp_enemy_book_data_initialize
- @enemy_book_data = Data_MonsterBook.new
- end
- end
- class Game_Party
- #==============================================
- #--------------------------------------------------------------------------
- # ● 公開インスタンス変数
- #--------------------------------------------------------------------------
- attr_reader :actors # アクター
- attr_reader :gold # ゴールド
- attr_reader :steps # 歩数
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- # アクターの配列を作成
- @actors = []
- # ゴールドと歩数を初期化
- @gold = 0
- @steps = 0
- # アイテム、武器、防具の所持数ハッシュを作成
- @items = {}
- @weapons = {}
- @armors = {}
- end
- #==============================================
- attr_accessor :enemy_info # 出会った敵情報(図鑑用)
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- alias book_info_initialize initialize
- def initialize
- book_info_initialize
- @enemy_info = {}
- end
- #--------------------------------------------------------------------------
- # ● エネミー情報の追加(図鑑用)
- # type : 通常遭遇かアナライズか 0:通常 1:アナライズ -1:情報削除
- # 0:無遭遇 1:遭遇済 2:アナライズ済
- #--------------------------------------------------------------------------
- def add_enemy_info(enemy_id, type = 0)
- case type
- when 0
- if @enemy_info[enemy_id] == 2
- return false
- end
- @enemy_info[enemy_id] = 1
- when 1
- @enemy_info[enemy_id] = 2
- when -1
- @enemy_info[enemy_id] = 0
- end
- end
- #--------------------------------------------------------------------------
- # ● 魔物図鑑の最大登録数を取得
- #--------------------------------------------------------------------------
- def enemy_book_max
- return $game_temp.enemy_book_data.id_data.size - 1
- end
- #--------------------------------------------------------------------------
- # ● 魔物図鑑の現在登録数を取得
- #--------------------------------------------------------------------------
- def enemy_book_now
- now_enemy_info = @enemy_info.keys
- # 登録無視の属性IDを取得
- no_add = $game_temp.enemy_book_data.no_add_element
- new_enemy_info = []
- for i in now_enemy_info
- enemy = $data_enemies[i]
- next if enemy.name == ""
- if enemy.element_ranks[no_add] == 1
- next
- end
- new_enemy_info.push(enemy.id)
- end
- return new_enemy_info.size
- end
- #--------------------------------------------------------------------------
- # ● 魔物図鑑の完成率を取得
- #--------------------------------------------------------------------------
- def enemy_book_complete_percentage
- e_max = enemy_book_max.to_f
- e_now = enemy_book_now.to_f
- comp = e_now / e_max * 100
- return comp.truncate
- end
- end
- class Interpreter
- def enemy_book_max
- return $game_party.enemy_book_max
- end
- def enemy_book_now
- return $game_party.enemy_book_now
- end
- def enemy_book_comp
- return $game_party.enemy_book_complete_percentage
- end
- end
- class Scene_Battle
- alias add_enemy_info_start_phase5 start_phase5
- def start_phase5
- for enemy in $game_troop.enemies
- # エネミーが隠れ状態でない場合
- unless enemy.hidden
- # 敵遭遇情報追加
- $game_party.add_enemy_info(enemy.id, 0)
- end
- end
- add_enemy_info_start_phase5
- end
- end
- class Window_Base < Window
- #--------------------------------------------------------------------------
- # ● エネミーの戦闘後獲得アイテムの描画
- #--------------------------------------------------------------------------
- def draw_enemy_drop_item(enemy, x, y)
- self.contents.font.color = normal_color
- treasures = []
- if enemy.item_id > 0
- treasures.push($data_items[enemy.item_id])
- end
- if enemy.weapon_id > 0
- treasures.push($data_weapons[enemy.weapon_id])
- end
- if enemy.armor_id > 0
- treasures.push($data_armors[enemy.armor_id])
- end
- # 現状ではとりあえず1つのみ描画
- if treasures.size > 0
- item = treasures[0]
- bitmap = RPG::Cache.icon(item.icon_name)
- opacity = 255
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- name = treasures[0].name
- else
- self.contents.font.color = disabled_color
- name = "无"
- end
- self.contents.draw_text(x+28, y, 212, 32, name)
- end
- #--------------------------------------------------------------------------
- # ● エネミーの図鑑IDの描画
- #--------------------------------------------------------------------------
- def draw_enemy_book_id(enemy, x, y)
- self.contents.font.color = normal_color
- id = $game_temp.enemy_book_data.id_data.index(enemy.id)
- self.contents.draw_text(x, y, 32, 32, id.to_s)
- end
- #--------------------------------------------------------------------------
- # ● 敌人简介描绘
- #--------------------------------------------------------------------------
- def draw_enemy_other(enemy, x, y)
- if CHARA_INFO[enemy.id]==nil
- CHARA_INFO[enemy.id] = "没有相关资料"
- end
- self.contents.font.size=16
- x+=self.contents.text_size("").width
- info = CHARA_INFO[enemy.id]
- s=info.scan(/./)
- #一行显示21个字
- for i in s
- sss = self.contents.text_size(i)
- if i==" "
- y+=16
- x=0
- elsif (x+sss.width)>(width - 32-260)
- y+=16
- x=0
- self.contents.draw_text(x, y, sss.width, sss.height, i)
- x+=sss.width
- else
- self.contents.draw_text(x, y, sss.width, sss.height, i)
- x+=sss.width
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 敌人特技描绘
- #--------------------------------------------------------------------------
- def draw_enemy_action(enemy, x, y)
- self.contents.font.size=16
- yy=y
- self.contents.font.color = system_color
- self.contents.draw_text(x, yy, 80, 18,"行动列表")
- self.contents.font.color = normal_color
- for action in enemy.actions
- yy+=18
- if action.kind==0
- case action.basic
- when 0
- ac="普通攻击"
- when 1
- ac="防御"
- when 2
- ac="逃跑"
- when 3
- ac="无"
- end
- self.contents.draw_text(x, yy, 160, 18, ac )
- end
- if action.kind==1
- self.contents.draw_text(x, yy, 160, 18, $data_skills[action.skill_id].name )
- end
- end
- end
- #雷达图描绘
- #=======================================================================================
- def draw_actor_element_radar_graph(actor, x, y)
- radius = 56
- cx = x + radius + FONT_SIZE + 48
- cy = y + radius + FONT_SIZE + 32
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, 104, 32, WORD_ELEMENT_GUARD)
- for loop_i in 0..NUMBER_OF_ELEMENTS
- if loop_i == 0
- else
- @pre_x = @now_x
- @pre_y = @now_y
- @pre_ex = @now_ex
- @pre_ey = @now_ey
- @color1 = @color2
- end
- if loop_i == NUMBER_OF_ELEMENTS
- eo = ELEMENT_ORDER[0]
- else
- eo = ELEMENT_ORDER[loop_i]
- end
- er = actor.element_rate(eo)
- estr = $data_system.elements[eo]
- @color2 = er < 0 ? GRAPH_LINE_COLOR_MINUS : er > 100 ? GRAPH_LINE_COLOR_PLUS : GRAPH_LINE_COLOR
- if er <0
- then xsh=true
- else xsh=false
- end
- er = er.abs
- th = Math::PI * (0.5 - 2.0 * loop_i / NUMBER_OF_ELEMENTS)
- @now_x = cx + (radius * Math.cos(th)).floor
- @now_y = cy - (radius * Math.sin(th)).floor
- @now_wx = cx + ((radius+FONT_SIZE*2/2) * Math.cos(th)).floor - FONT_SIZE
- @now_wy = cy - ((radius+FONT_SIZE*1/2) * Math.sin(th)).floor - FONT_SIZE/2
- @now_vx = cx + ((radius+FONT_SIZE*6/2) * Math.cos(th)).floor - FONT_SIZE
- @now_vy = cy - ((radius+FONT_SIZE*3/2) * Math.sin(th)).floor - FONT_SIZE/2
- @now_ex = cx + (er*radius/100 * Math.cos(th)).floor
- @now_ey = cy - (er*radius/100 * Math.sin(th)).floor
- if loop_i == 0
- @pre_x = @now_x
- @pre_y = @now_y
- @pre_ex = @now_ex
- @pre_ey = @now_ey
- @color1 = @color2
- else
- end
- next if loop_i == 0
- self.contents.draw_line(cx+1,cy+1, @now_x+1,@now_y+1, GRAPH_SCALINE_COLOR_SHADOW)
- self.contents.draw_line(@pre_x+1,@pre_y+1, @now_x+1,@now_y+1, GRAPH_SCALINE_COLOR_SHADOW)
- self.contents.draw_line(cx,cy, @now_x,@now_y, GRAPH_SCALINE_COLOR)
- self.contents.draw_line(@pre_x,@pre_y, @now_x,@now_y, GRAPH_SCALINE_COLOR)
- self.contents.draw_line(@pre_ex,@pre_ey, @now_ex,@now_ey, @color1, 2, @color2)
- self.contents.font.size = FONT_SIZE
- if xsh == true
- then self.contents.font.color = Color.new(100,255,128,128)
- sdd="-"
- else self.contents.font.color = system_color
- sdd=""
- end
- self.contents.draw_text(@now_wx,@now_wy, FONT_SIZE*2, FONT_SIZE, estr, 1)
- self.contents.font.color = Color.new(255,255,255,128)
- self.contents.draw_text(@now_vx,@now_vy, FONT_SIZE*2, FONT_SIZE, sdd+er.to_s + "%", 2)
- end
- end
- #_----------------------------------------------
- def draw_race(enemy,x,y)
- text="无"
- text2="无"
- for i in 9..16
- if enemy.element_rate(i) == 200
- text = $data_system.elements[i]
- end
- if enemy.element_rate(i) == 150
- text2 =$data_system.elements[i]
- end
- end
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, 80, 32,"主要种族")
- self.contents.font.color = normal_color
- self.contents.draw_text(x+80, y, 76, 32,text,2)
- self.contents.font.color = system_color
- self.contents.draw_text(x+160, y, 80, 32,"次要种族")
- self.contents.font.color = normal_color
- self.contents.draw_text(x+80+160, y, 76, 32,text2,2)
- end
- #--------------------------------------------------------------------------
- # ● エネミーの名前の描画
- # enemy : エネミー
- # x : 描画先 X 座標
- # y : 描画先 Y 座標
- #--------------------------------------------------------------------------
- def draw_enemy_name(enemy, x, y)
- self.contents.font.color = normal_color
- self.contents.draw_text(x, y, 152, 32, enemy.name)
- end
- #--------------------------------------------------------------------------
- # ● エネミーグラフィックの描画(アナライズ)
- # enemy : エネミー
- # x : 描画先 X 座標
- # y : 描画先 Y 座標
- #--------------------------------------------------------------------------
- def draw_enemy_graphic(enemy, x, y, opacity = 255)
- end
- #--------------------------------------------------------------------------
- # ● エネミーの獲得EXPの描画
- # enemy : エネミー
- # x : 描画先 X 座標
- # y : 描画先 Y 座標
- #--------------------------------------------------------------------------
- def draw_enemy_exp(enemy, x, y)
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, 120, 32, "EXP")
- self.contents.font.color = normal_color
- self.contents.draw_text(x + 120, y, 36, 32, enemy.exp.to_s, 2)
- end
- #--------------------------------------------------------------------------
- # ● エネミーの獲得GOLDの描画
- # enemy : エネミー
- # x : 描画先 X 座標
- # y : 描画先 Y 座標
- #--------------------------------------------------------------------------
- def draw_enemy_gold(enemy, x, y)
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, 120, 32, "掉落金钱")
- self.contents.font.color = normal_color
- self.contents.draw_text(x + 120, y, 36, 32, enemy.gold.to_s, 2)
- end
- end
- class Game_Enemy_Book < Game_Enemy
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize(enemy_id)
- super(2, 1)#ダミー
- @enemy_id = enemy_id
- enemy = $data_enemies[@enemy_id]
- @battler_name = enemy.battler_name
- @battler_hue = enemy.battler_hue
- @hp = maxhp
- @sp = maxsp
- end
- end
- class Data_MonsterBook
- attr_reader :id_data
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- @id_data = enemy_book_id_set
- end
- #--------------------------------------------------------------------------
- # ● 図鑑用登録無視属性取得
- #--------------------------------------------------------------------------
- def no_add_element
- no_add = 0
- # 登録無視の属性IDを取得
- for i in 1...$data_system.elements.size
- if $data_system.elements[i] =~ /不加入图鉴/
- no_add = i
- break
- end
- end
- return no_add
- end
- #--------------------------------------------------------------------------
- # ● 図鑑用敵ID設定
- #--------------------------------------------------------------------------
- def enemy_book_id_set
- data = [0]
- no_add = no_add_element
- # 登録無視の属性IDを取得
- for i in 1...$data_enemies.size
- enemy = $data_enemies[i]
- next if enemy.name == ""
- if enemy.element_ranks[no_add] == 1
- next
- end
- data.push(enemy.id)
- end
- return data
- end
- end
- class Window_MonsterBook < Window_Selectable
- attr_reader :data
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize(index=0)
- super(0, 64, 640, 416)
- @column_max = 2
- @book_data = $game_temp.enemy_book_data
- @data = @book_data.id_data.dup
- @data.shift
- #@data.sort!
- @item_max = @data.size
- self.index = 0
- refresh if @item_max > 0
- end
- #--------------------------------------------------------------------------
- # ● 遭遇データを取得
- #--------------------------------------------------------------------------
- def data_set
- data = $game_party.enemy_info.keys
- data.sort!
- newdata = []
- for i in data
- next if $game_party.enemy_info[i] == 0
- # 図鑑登録無視を考慮
- if book_id(i) != nil
- newdata.push(i)
- end
- end
- return newdata
- end
- #--------------------------------------------------------------------------
- # ● 表示許可取得
- #--------------------------------------------------------------------------
- def show?(id)
- if $game_party.enemy_info[id] == 0 or $game_party.enemy_info[id] == nil
- return false
- else
- return true
- end
- end
- #--------------------------------------------------------------------------
- # ● 図鑑用ID取得
- #--------------------------------------------------------------------------
- def book_id(id)
- return @book_data.index(id)
- end
- #--------------------------------------------------------------------------
- # ● エネミー取得
- #--------------------------------------------------------------------------
- def item
- return @data[self.index]
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- self.contents = Bitmap.new(width - 32, row_max * 32)
- #項目数が 0 でなければビットマップを作成し、全項目を描画
- if @item_max > 0
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 項目の描画
- # index : 項目番号
- #--------------------------------------------------------------------------
- def draw_item(index)
- enemy = $data_enemies[@data[index]]
- return if enemy == nil
- x = 4 + index % 2 * (288 + 32)
- y = index / 2 * 32
- rect = Rect.new(x, y, self.width / @column_max - 32, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- self.contents.font.color = normal_color
- draw_enemy_book_id(enemy, x, y)
- if show?(enemy.id)
- self.contents.draw_text(x + 28+16, y, 212, 32, enemy.name, 0)
- else
- self.contents.draw_text(x + 28+16, y, 212, 32, "-----", 0)
- return
- end
- if analyze?(@data[index])
- self.contents.font.color = text_color(3)
- self.contents.draw_text(x + 256, y, 24, 32, "済", 2)
- end
- end
- #--------------------------------------------------------------------------
- # ● アナライズ済かどうか
- #--------------------------------------------------------------------------
- def analyze?(enemy_id)
- if $game_party.enemy_info[enemy_id] == 2
- return true
- else
- return false
- end
- end
- end
- class Window_MonsterBook_Info < Window_Base
- include Enemy_Book_Config
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0+64, 640, 480-64)
- self.back_opacity=255
- self.contents = Bitmap.new(width - 32, height - 32)
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh(enemy_id)
- self.contents.clear
- self.contents.font.size = 22
- enemy = Game_Enemy_Book.new(enemy_id)
- @gra = Sprite_Enemy_Graphic.new(nil,enemy)
- @gra.z = 120 #怪物图片
- draw_enemy_book_id(enemy, 4, 0) #各种详细信息
- draw_enemy_name(enemy, 48, 0)
- draw_actor_hp(enemy, 288, 0)
- draw_actor_sp(enemy, 288+160, 0)
- self.contents.font.size=18
- draw_actor_parameter(enemy, 288 , 25, 0)
- self.contents.font.color = system_color
- self.contents.draw_text(288+160, 25, 120, 32, EVA_NAME)
- self.contents.font.color = normal_color
- self.contents.draw_text(288+160 + 120, 25, 36, 32, enemy.eva.to_s, 2)
- draw_actor_parameter(enemy, 288 , 50, 3)
- draw_actor_parameter(enemy, 288+160, 50, 4)
- draw_actor_parameter(enemy, 288 , 75, 5)
- draw_actor_parameter(enemy, 288+160, 75, 6)
- draw_actor_parameter(enemy, 288 , 100, 1)
- draw_actor_parameter(enemy, 288+160, 100, 2)
- draw_enemy_exp(enemy, 288, 125)
- draw_enemy_gold(enemy, 288+160, 125)
- draw_race(enemy, 288, 150)
- #--------------------------------------------------------------------
- draw_enemy_other(enemy, 0, 280) #简介文字
- draw_enemy_action(enemy,200, 30) #显示敌人行动
- draw_actor_element_radar_graph(enemy, 360, 180)#雷达图
- #--------------------------------------------------------------------
- if DROP_ITEM_NEED_ANALYZE==true #掉落物品
- self.contents.font.color = system_color
- self.contents.font.size=16
- self.contents.draw_text(0, 235, 96, 32, "掉落物品")
- draw_enemy_drop_item(enemy, 128, 235)
- self.contents.font.color = normal_color
- self.contents.font.size=18
- end
- end
- def cl
- @gra.dispose
- end
- #--------------------------------------------------------------------------
- # ● アナライズ済かどうか
- #--------------------------------------------------------------------------
- def analyze?(enemy_id)
- if $game_party.enemy_info[enemy_id] == 2
- return true
- else
- return false
- end
- end
- end
- class Scene_MonsterBook
- include Enemy_Book_Config
- #--------------------------------------------------------------------------
- # ● メイン処理
- #--------------------------------------------------------------------------
- def main
- $game_temp.enemy_book_data = Data_MonsterBook.new
- # ウィンドウを作成
- @title_window = Window_Base.new(0, 0, 640, 64)
- @title_window.contents = Bitmap.new(640 - 32, 64 - 32)
- @title_window.contents.draw_text(4, 0, 320, 32, "魔物图鉴", 0)
- if SHOW_COMPLETE_TYPE != 0
- case SHOW_COMPLETE_TYPE
- when 1
- e_now = $game_party.enemy_book_now
- e_max = $game_party.enemy_book_max
- text = e_now.to_s + "/" + e_max.to_s
- when 2
- comp = $game_party.enemy_book_complete_percentage
- text = comp.to_s + "%"
- when 3
- e_now = $game_party.enemy_book_now
- e_max = $game_party.enemy_book_max
- comp = $game_party.enemy_book_complete_percentage
- text = e_now.to_s + "/" + e_max.to_s + " " + comp.to_s + "%"
- end
- if text != nil
- @title_window.contents.draw_text(320, 0, 288, 32, text, 2)
- end
- end
- @main_window = Window_MonsterBook.new
- @main_window.active = true
- # インフォウィンドウを作成 (不可視・非アクティブに設定)
- @info_window = Window_MonsterBook_Info.new
- @info_window.z = 110
- @info_window.visible = false
- @info_window.active = false
- @visible_index = 0
- # トランジション実行
- Graphics.transition
- # メインループ
- loop do
- # ゲーム画面を更新
- Graphics.update
- # 入力情報を更新
- Input.update
- # フレーム更新
- update
- # 画面が切り替わったらループを中断
- if $scene != self
- break
- end
- end
- # トランジション準備
- Graphics.freeze
- # ウィンドウを解放
- @main_window.dispose
- @info_window.dispose
- @title_window.dispose
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新
- #--------------------------------------------------------------------------
- def update
- # ウィンドウを更新
- @main_window.update
- @info_window.update
- # gra.update
- if @info_window.active
- update_info
- return
- end
- # メインウィンドウがアクティブの場合: update_target を呼ぶ
- if @main_window.active
- update_main
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新 (メインウィンドウがアクティブの場合)
- #--------------------------------------------------------------------------
- def update_main
- # B ボタンが押された場合
- if Input.trigger?(Input::B)
- # キャンセル SE を演奏
- $game_system.se_play($data_system.cancel_se)
- $scene = Scene_Menu.new(7)
- return
- end
- # C ボタンが押された場合
- if Input.trigger?(Input::C)
- if @main_window.item == nil or @main_window.show?(@main_window.item) == false
- # ブザー SE を演奏
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 決定 SE を演奏
- $game_system.se_play($data_system.decision_se)
- @main_window.active = false
- @info_window.active = true
- @info_window.visible = true
- @visible_index = @main_window.index
- @info_window.refresh(@main_window.item)
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新 (インフォウィンドウがアクティブの場合)
- #--------------------------------------------------------------------------
- def update_info
- # B ボタンが押された場合
- if Input.trigger?(Input::B)
- # キャンセル SE を演奏
- $game_system.se_play($data_system.cancel_se)
- @main_window.active = true
- @info_window.active = false
- @info_window.visible = false
- @info_window.cl
- return
- end
- # C ボタンが押された場合
- if Input.trigger?(Input::C)
- # 決定 SE を演奏
- #$game_system.se_play($data_system.decision_se)
- return
- end
- if Input.trigger?(Input::L)
- # 決定 SE を演奏
- $game_system.se_play($data_system.decision_se)
- loop_end = false
- while loop_end == false
- if @visible_index != 0
- @visible_index -= 1
- else
- @visible_index = @main_window.data.size - 1
- end
- loop_end = true if @main_window.show?(@main_window.data[@visible_index])
- end
- @info_window.cl
- id = @main_window.data[@visible_index]
- @info_window.refresh(id)
- return
- end
- if Input.trigger?(Input::R)
- # 決定 SE を演奏
- $game_system.se_play($data_system.decision_se)
- loop_end = false
- while loop_end == false
- if @visible_index != @main_window.data.size - 1
- @visible_index += 1
- else
- @visible_index = 0
- end
- loop_end = true if @main_window.show?(@main_window.data[@visible_index])
- end
- @info_window.cl
- id = @main_window.data[@visible_index]
- @info_window.refresh(id)
- return
- end
- end
- end
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- class Sprite_Enemy_Graphic< Sprite
- attr_accessor :enemy
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize(viewport,enemy)
- super(viewport)
- if @enemy != enemy
- self.bitmap = RPG::Cache.battler(enemy.battler_name, enemy.battler_hue)
- cw = self.bitmap.width
- ch = self.bitmap.height
- if cw>ch
- self.zoom_x=200.0/cw
- self.zoom_y=200.0/cw
- else
- self.zoom_x=200.0/ch
- self.zoom_y=200.0/ch
- end
- self.x=10
- self.y=110
- @enemy=enemy
- end
- end
- #--------------------------------------------------------------------------
- # ● 解放
- #--------------------------------------------------------------------------
- def dispose
- if self.bitmap != nil
- self.bitmap.dispose
- end
- super
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新
- #--------------------------------------------------------------------------
- def refresh(enemy)
- end
- end
复制代码 |
|