赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 0 |
经验 | 10490 |
最后登录 | 2018-9-14 |
在线时间 | 104 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 13
- 在线时间
- 104 小时
- 注册时间
- 2013-8-8
- 帖子
- 35
|
4楼
楼主 |
发表于 2013-9-7 01:47:36
|
只看该作者
本帖最后由 泡沫花茶 于 2013-9-7 02:02 编辑
第一个我先拆这个出来- Enemies_Switches=8 #8号开关决定是否显示怪物信息,主要以是否获得怪物手册为准
- Enemieskind_Variables=7#本层的怪物种类数
- Playerdate_magicdef=19#19号开关决定是否采用勇士魔防
- #==============================================================================
- # ■ Window_EnemyDate
- #------------------------------------------------------------------------------
- # 显示怪物的生命及造成的伤害等。
- #==============================================================================
- class Window_EnemyDate < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- super(160, 0, 480, 480)
- @column_max = 1
- refresh
- self.index = -1
- self.active = false
- end
- #--------------------------------------------------------------------------
- # ● 获取开头行
- #--------------------------------------------------------------------------
- def top_row
- # 将窗口内容的传送源 Y 坐标、1 行的高 32 等分
- return self.oy / 64
- end
- #--------------------------------------------------------------------------
- # ● 设置开头行
- # row : 显示开头的行
- #--------------------------------------------------------------------------
- def top_row=(row)
- # row 未满 0 的场合更正为 0
- if row < 0
- row = 0
- end
- # row 超过 row_max - 1 的情况下更正为 row_max - 1
- if row > row_max - 1
- row = row_max - 1
- end
- # row 1 行高的 32 倍、窗口内容的传送源 Y 坐标
- self.oy = row * 64
- end
- #--------------------------------------------------------------------------
- # ● 获取 1 页可以显示的行数
- #--------------------------------------------------------------------------
- def page_row_max
- # 窗口的高度,设置画面的高度减去 32 ,除以 1 行的高度 32
- return (self.height - 32) / 64
- end
- #--------------------------------------------------------------------------
- # ● 更新光标举行
- #--------------------------------------------------------------------------
- def update_cursor_rect
- # 光标位置不满 0 的情况下
- if [url=home.php?mod=space&uid=370741]@Index[/url] < 0
- self.cursor_rect.empty
- return
- end
- # 获取当前的行
- row = @index / @column_max
- # 当前行被显示开头行前面的情况下
- if row < self.top_row
- # 从当前行向开头行滚动
- self.top_row = row
- end
- # 当前行被显示末尾行之后的情况下
- if row > self.top_row + (self.page_row_max - 1)
- # 从当前行向末尾滚动
- self.top_row = row - (self.page_row_max - 1)
- end
- # 计算光标的宽
- cursor_width = self.width / @column_max - 32
- # 计算光标坐标
- x = @index % @column_max * (cursor_width + 32)
- y = @index / @column_max * 64 - self.oy
- # 更新国标矩形
- self.cursor_rect.set(x, y, cursor_width, 64)
- end
-
- #--------------------------------------------------------------------------
- # ● 获取怪物信息
- #--------------------------------------------------------------------------
- def einfo#skill
- return @data[self.index]
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- return if $game_switches[Enemies_Switches]==false
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- for i in 0...$game_variables[Enemieskind_Variables]#指定当前层的怪物种类数
- einfo = $data_enemies[$floorenemies[i]]
- #floorenemies为数组,指定当前层分别为哪些怪物类型
- if einfo != nil
- @data.push(einfo)
- end
- end
-
- # 如果项目数不是 0 就生成位图、重新描绘全部项目
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 64)
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 描绘项目
- # index : 项目编号
- #--------------------------------------------------------------------------
- def draw_item(index)
- einfo = @data[index]
- a =108
- x =120
- y = index * 64
- bitmap = RPG::Cache.battler(einfo.battler_name , einfo.battler_hue )
- src_rect = Rect.new(0, 0,bitmap.width, bitmap.height)
- self.contents.blt(0, y+16, bitmap, src_rect)
- e=Enemy_property.new(einfo.id)
- @p1=e.got_p1
- @p2=e.got_p2
- #获得怪物的两个属性值
- @name=0#初始化怪物“屏蔽”属性,默认不是“屏蔽”
- self.contents.font.color = text_color(0)#描绘怪物姓名
- self.contents.draw_text(35, y+4, 80, 32, einfo.name.split(':')[0].to_s ,1)
-
- xx=33
- pp=@p1
- for i in 0...2#分别显示两种属性
- case pp
- when 0
- self.contents.font.color = text_color(0)
- @pro="普 通"
- self.contents.draw_text(xx, y+28, 80, 32, @pro.to_s,1) if i==0
- when 1
- self.contents.font.color = text_color(3)
- if @p2!=0
- @pro="中毒"
- else
- @pro="中 毒"
- self.contents.draw_text(xx, y+28, 80, 32, @pro.to_s,1)
- end
- when 2
- self.contents.font.color = text_color(5)
- if @p2!=0
- @pro="衰弱"
- else
- @pro="衰 弱"
- self.contents.draw_text(xx, y+28, 80, 32, @pro.to_s,1)
- end
- when 4
- self.contents.font.color = text_color(2)
- if @p2!=0
- @pro="吸血"
- else
- @pro="吸 血"
- self.contents.draw_text(xx, y+28, 80, 32, @pro.to_s,1)
- end
- when 8
- self.contents.font.color = text_color(7)
- if @p2!=0
- @pro="坚固"
- else
- @pro="坚 固"
- self.contents.draw_text(xx, y+28, 80, 32, @pro.to_s,1)
- end
- when 16
- self.contents.font.color = text_color(11)
- if @p2!=0
- @pro="先攻"
- else
- @pro="先 攻"
- self.contents.draw_text(xx, y+28, 80, 32, @pro.to_s,1)
- end
- when 32
- self.contents.font.color = text_color(1)
- if @p2!=0
- @pro="迟缓"
- else
- @pro="迟 缓"
- self.contents.draw_text(xx, y+28, 80, 32, @pro.to_s,1)
- end
- when 64
- self.contents.font.color = text_color(12)
- if @p2!=0
- @pro="魔攻"
- else
- @pro="魔 攻"
- self.contents.draw_text(xx, y+28, 80, 32, @pro.to_s,1)
- end
- when 128
- self.contents.font.color = text_color(6)
- if @p2!=0
- @pro=einfo.eva.to_s+"连击"
- else
- @pro=einfo.eva.to_s+"连击"
- self.contents.draw_text(xx, y+28, 80, 32, @pro.to_s,1)
- end
- when 256
- self.contents.font.color = Color.new(255,50,200)
- if @p2!=0
- @pro="领域"
- else
- @pro="领 域"
- self.contents.draw_text(xx, y+28, 80, 32, @pro.to_s,1)
- end
- when 512
- self.contents.font.color = text_color(9)
- if @p2!=0
- @pro="爆击"
- else
- @pro="爆 击"
- self.contents.draw_text(xx, y+28, 80, 32, @pro.to_s,1)
- end
- when 1024
- self.contents.font.color = text_color(10)
- if @p2!=0
- @pro="潜伏"
- else
- @pro="潜 伏"
- self.contents.draw_text(xx, y+28, 80, 32, @pro.to_s,1)
- end
- when 2048
- self.contents.font.color = text_color(8)
- if @p2!=0
- @pro="无敌"
- else
- @pro="无 敌"
- self.contents.draw_text(xx, y+28, 80, 32, @pro.to_s,1)
- end
- when 4096
- self.contents.font.color = Color.new(200,100,200)
- if @p2!=0
- @pro="模仿"
- else
- @pro="模 仿"
- self.contents.draw_text(xx, y+28, 80, 32, @pro.to_s,1)
- end
- when 8192
- self.contents.font.color = Color.new(100,200,200)
- if @p2!=0
- @pro="诅咒"
- else
- @pro="诅 咒"
- self.contents.draw_text(xx, y+28, 80, 32, @pro.to_s,1)
- end
- when 9900
- self.contents.font.color = Color.new(200,100,100)
- if @p2!=0
- @pro="反击"
- else
- @pro="反 击"
- self.contents.draw_text(xx, y+28, 80, 32, @pro.to_s,1)
- end
- when 9910
- self.contents.font.color= Color.new(100,50,50)
- if @p2!=0
- @pro="重生"
- else
- @pro="重 生"
- self.contents.draw_text(xx, y+28, 80, 32, @pro.to_s,1)
- end
- when 9920
- self.contents.font.color = text_color(4)
- if @p2!=0
- @pro="净化"
- else
- @pro="净 化"
- self.contents.draw_text(xx, y+28, 80, 32, @pro.to_s,1)
- end
- when 9930
- self.contents.font.color = Color.new(100,255,200)
- if @p2!=0
- @pro="神偷"
- else
- @pro="神 偷"
- self.contents.draw_text(xx, y+28, 80, 32, @pro.to_s,1)
- end
- when 9940
- self.contents.font.color = Color.new(225,80,80,200)
- if @p2!=0
- @pro="自爆"
- else
- @pro="自 爆"
- self.contents.draw_text(xx, y+28, 80, 32, @pro.to_s,1)
- end
- when 9950
- self.contents.font.color = Color.new(150,200,200)
- if @p2!=0
- @pro="退化"
- else
- @pro="退 化"
- self.contents.draw_text(xx, y+28, 80, 32, @pro.to_s,1)
- end
- when 9960
- self.contents.font.color = Color.new(150,200,150)
- if @p2!=0
- @pro="仇恨"
- else
- @pro="仇 恨"
- self.contents.draw_text(xx, y+28, 80, 32, @pro.to_s,1)
- end
- when 9970
- self.contents.font.color = Color.new(30,30,30,90)
- if @p2!=0
- @pro="伪装"
- @name=1
- else
- @pro="伪 装"
- self.contents.draw_text(xx, y+28, 80, 32, @pro.to_s,1)
- @name=1
- end
-
- end#case到此结束
- if @p2!=0
- self.contents.draw_text(xx, y+28, 42, 32, @pro.to_s,1) if i==0
- self.contents.draw_text(xx+42, y+28, 42, 32, @pro.to_s,1) if i==1
- end
- pp=@p2#准备开始第二次属性判断
- end
-
- if index*1.0/2 == index/2#单双数颜色变化
- self.contents.font.color = text_color(3)
- else
- self.contents.font.color= text_color(4)
- end
- self.contents.draw_text(120, y, a, 32, "生命", 0)
- self.contents.draw_text(230, y,a, 32, "攻击",0)
- self.contents.draw_text(340, y, a, 32, "防御",0)
- self.contents.draw_text(230, y+32, a, 32, "经验", 0)
- self.contents.draw_text(120, y+32,a, 32, "金币", 0)
- self.contents.draw_text(340, y+32, a, 32, "伤害", 0)
- if @name==0
- self.contents.draw_text(145, y, a-8, 32, einfo.maxhp.to_s, 1)
- self.contents.draw_text(255, y, a-8, 32, e.got_ea.to_s, 1)
- self.contents.draw_text(365, y, a-8, 32, e.got_ed.to_s, 1)
- self.contents.draw_text(255, y+32, a-8, 32, einfo.exp.to_s, 1)
- self.contents.draw_text(145, y+32,a-8, 32, einfo.gold.to_s, 1)
- else
- self.contents.draw_text(145, y, a-8, 32, "×××", 1)
- self.contents.draw_text(255, y, a-8, 32, "×××", 1)
- self.contents.draw_text(365, y, a-8, 32, "×××", 1)
- self.contents.draw_text(255, y+32, a-8, 32, "×××", 1)
- self.contents.draw_text(145, y+32,a-8, 32, "×××", 1)
- end
- @edamage=e.got_damage
- self.contents.font.color = text_color(2)
- self.contents.font.color = text_color(0) if @edamage==0
- self.contents.font.color = text_color(7) if @edamage>=$game_actors[$game_variables[1]+1].hp
-
- if e.got_nowin==2
- @edamage="?????"#怪物是无敌属性
- self.contents.font.color = text_color(8)
- end
- if e.got_nowin==1
- @edamage="????" #勇士的攻击<怪物的防御
- self.contents.font.color = text_color(7)
- end
- self.contents.draw_text(365, y+32, a-8, 32, @edamage.to_s, 1)
- end
- #--------------------------------------------------------------------------
- # ● 刷新帮助文本
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_text(self.einfo == nil ? "" : self.einfo.description)
- end
- end
复制代码 我第二个拆这个- #==============================================================================
- # ■ Scene_Menu
- #------------------------------------------------------------------------------
- # 处理菜单画面的类。
- #==============================================================================
- class Scene_Menu
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # menu_index : 命令光标的初期位置
- #--------------------------------------------------------------------------
- def initialize(menu_index = 0)
- @menu_index = menu_index
- end
- #--------------------------------------------------------------------------
- # ● 主处理
- #--------------------------------------------------------------------------
- def main
- # 生成命令窗口
- # s1 = $data_system.words.item
- # s2 = $data_system.words.skill
- # s3 = $data_system.words.equip
- # s4 = "状态"
- s1 = "敌物资料"
- s2 = "物品与装备"
- s3 = "存档"
- s4 = "读档"
- if $record != nil and $record.mode == "录制"
- s5 = "退回主界面"
- else
- s5 = "重新开始"
- end
- s6 = "版权说明"
- @command_window = Window_Command.new(160, [s1, s2 ,s3 ,s4 ,s5,s6])#, s3, s4, s5, s6])
- @command_window.index = @menu_index
- # 同伴人数为 0 的情况下
- # if $game_party.actors.size == 0
- # 物品、特技、装备、状态无效化
- # @command_window.disable_item(0)
- # @command_window.disable_item(1)
- # @command_window.disable_item(2)
- # @command_window.disable_item(3)
- # end
- # 禁止存档的情况下
- if $game_system.save_disabled
- # 存档无效
- @command_window.disable_item(2)
- end
- # 生成游戏时间窗口
- @playtime_window = Window_PlayTime.new
- @playtime_window.x = 0
- @playtime_window.y = 224
- # 生成步数窗口
- @steps_window = Window_Steps.new
- @steps_window.x = 0
- @steps_window.y = 320
- # 生成版本窗口
- @gold_window = Window_Version.new
- @gold_window.x = 0
- @gold_window.y = 416
-
- # 生成怪物状态窗口
- @enemy_window = Window_EnemyDate.new
- @enemy_window.x = 160
- @enemy_window.y = 0
-
-
- # 生成状态窗口
- # @status_window = Window_MenuStatus.new
- # @status_window.x = 160
- # @status_window.y = 0
-
- # 执行过渡
- Graphics.transition
- # 主循环
- loop do
- # 刷新游戏画面
- Graphics.update
- # 刷新输入信息
- Input.update
- # 刷新画面
- update
- # 如果切换画面就中断循环
- if $scene != self
- break
- end
- end
- # 准备过渡
- Graphics.freeze
- # 释放窗口
- @command_window.dispose
- @playtime_window.dispose
- @steps_window.dispose
- @gold_window.dispose
- @enemy_window.dispose
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- # 刷新窗口
- @command_window.update
- @playtime_window.update
- @steps_window.update
- @gold_window.update
- @enemy_window.update
- # 命令窗口被激活的情况下: 调用 update_command
- if @command_window.active
- update_command
- return
- end
- # 状态窗口被激活的情况下: 调用 update_status
- if @enemy_window.active
- update_status
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面 (命令窗口被激活的情况下)
- #--------------------------------------------------------------------------
- def update_command
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- # 切换的地图画面
- $scene = Scene_Map.new
- return
- end
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- # 同伴人数为 0、存档、游戏结束以外的场合
- if $game_party.actors.size == 0 and @command_window.index < 4
- # 演奏冻结 SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 命令窗口的光标位置分支
- case @command_window.index
-
- when 0
- $game_system.se_play($data_system.decision_se)
- # 激活状态窗口
- @command_window.active = false
- # @status_window2.active = false
- # @status_window2.visible=false ##########
- @enemy_window.active = true
- @enemy_window.index = 0
- # @enemy_window.visible=true
-
- when 1 # 物品
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 切换到物品画面
- $scene = Scene_Item.new
-
- when 2 # 存档
- if $game_system.save_disabled
- # 演奏冻结 SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 切换到存档画面
- $scene = Scene_Save.new
-
- when 3 # 读档
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 切换到存档画面
- $scene = Scene_Load2.new
-
- when 4 #重新开始
- if $record != nil and $record.mode == "录制"
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 淡入淡出 BGM、BGS、ME
- Audio.bgm_fade(800)
- Audio.bgs_fade(800)
- Audio.me_fade(800)
- # 切换到标题画面
- $scene = Scene_Title.new
- else
-
- # 游戏重新开始
- # 载入数据库
- $data_mapname = load_data("Data/MapInfos.rxdata")
- $data_actors = load_data("Data/Actors.rxdata")
- $data_classes = load_data("Data/Classes.rxdata")
- $data_skills = load_data("Data/Skills.rxdata")
- $data_items = load_data("Data/Items.rxdata")
- $data_weapons = load_data("Data/Weapons.rxdata")
- $data_armors = load_data("Data/Armors.rxdata")
- $data_enemies = load_data("Data/Enemies.rxdata")
- $data_troops = load_data("Data/Troops.rxdata")
- $data_states = load_data("Data/States.rxdata")
- $data_animations = load_data("Data/Animations.rxdata")
- $data_tilesets = load_data("Data/Tilesets.rxdata")
- $data_common_events = load_data("Data/CommonEvents.rxdata")
- $data_system = load_data("Data/System.rxdata")
- # 生成系统对像
- $game_system = Game_System.new
-
- # 停止 BGM
- Audio.bgm_stop
- # 重置测量游戏时间用的画面计数器
- Graphics.frame_count = 0
- # 生成各种游戏对像
- $game_temp = Game_Temp.new
- $game_system = Game_System.new
- $game_switches = Game_Switches.new
- $game_variables = Game_Variables.new
- $game_self_switches = Game_SelfSwitches.new
- $game_screen = Game_Screen.new
- $game_actors = Game_Actors.new
- $game_party = Game_Party.new
- $game_troop = Game_Troop.new
- $game_map = Game_Map.new
- $game_player = Game_Player.new
- # 设置初期同伴位置
- $game_party.setup_starting_members
- # 设置初期位置的地图
- $game_map.setup($data_system.start_map_id)
- # 主角向初期位置移动
- $game_player.moveto($data_system.start_x, $data_system.start_y)
- # 刷新主角
- $game_player.refresh
- # 执行地图设置的 BGM 与 BGS 的自动切换
- $game_map.autoplay
- # 刷新地图 (执行并行事件)
- $game_map.update
- # 切换地图画面
- $scene = Scene_Map.new
- end
-
- when 5 # 版权说明
- $game_temp.common_event_id =19
- # 切换地图画面
- $scene = Scene_Map.new
- end
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面 (状态窗口被激活的情况下)
- #--------------------------------------------------------------------------
- def update_status
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- # 激活命令窗口
- @command_window.active = true
- @enemy_window.active = false
- @enemy_window.index = -1
- return
- end
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- # 命令窗口的光标位置分支
- case @command_window.index
- when 1 # 特技
- # 本角色的行动限制在 2 以上的情况下
- if $game_party.actors[@status_window.index].restriction >= 2
- # 演奏冻结 SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 切换到特技画面
- $scene = Scene_Skill.new(@status_window.index)
- when 2 # 装备
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 切换的装备画面
- $scene = Scene_Equip.new(@status_window.index)
- when 3 # 状态
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 切换到状态画面
- $scene = Scene_Status.new(@status_window.index)
- end
- return
- end
- end
- end
复制代码 菜单是有出现敌物資料
然後从他共通事件调用来看,有一个"怪物信息显示"开关
有需要使用到剧本吗?
剧本我有点不是很看的懂... |
|