赞 | 0 |
VIP | 0 |
好人卡 | 3 |
积分 | 2 |
经验 | 37164 |
最后登录 | 2014-6-30 |
在线时间 | 566 小时 |
Lv1.梦旅人 彭格列I世
- 梦石
- 0
- 星屑
- 168
- 在线时间
- 566 小时
- 注册时间
- 2012-8-17
- 帖子
- 1614
|
- # -----------------------------------------------------------------------------
- # 技能升级系统(SLV)
- # ver:1.0VX
- # date:2011.10.11 by.Ultra
- # 【说明】
- # 呼出界面:$scene = Scene_SLV.new(队员ID)
- # 切换角色:L 或 R 键
- # -----------------------------------------------------------------------------
- module SLV
- # ·消耗的物品ID
- ITEMID = 1
- # ·升级技能关联
- # 技能ID => 升级后技能ID
- SLVUP = {
- }
- # ·设定消耗物品数量
- # 技能ID => 升级时消耗物品数量
- SCONSUM = {
- }
- # ·默认消耗物品数量
- ALLSCONSUM = 3
- end
- #==============================================================================
- # ■ Window_SLVindex
- #------------------------------------------------------------------------------
- # 显示升级特技目录的窗口。
- #==============================================================================
- class Window_SLVindex < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # x : 窗口 X 座标
- # y : 窗口 Y 座标
- # width : 窗口宽度
- # height : 窗口高度
- # actor : 角色
- #--------------------------------------------------------------------------
- def initialize(actor)
- super(0, 112, 272, 304)
- [url=home.php?mod=space&uid=95897]@actor[/url] = actor
- self.index = 0
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 获取技能
- #--------------------------------------------------------------------------
- def skill
- return @data[self.index]
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- @data = []
- for skill in @actor.skills
- @data.push(skill)
- if skill.id == @actor.last_skill_id
- self.index = @data.size - 1
- end
- end
- @item_max = @data.size
- create_contents
- for i in 0...@item_max
- draw_item(i)
- end
- end
- #--------------------------------------------------------------------------
- # ● 描绘项目
- # index : 项目编号
- #--------------------------------------------------------------------------
- def draw_item(index)
- rect = item_rect(index)
- self.contents.clear_rect(rect)
- skill = @data[index]
- if skill != nil
- rect.width -= 4
- enabled = @actor.skill_can_use?(skill)
- draw_item_name(skill, rect.x, rect.y, enabled)
- self.contents.draw_text(rect, @actor.calc_mp_cost(skill), 2)
- end
- end
- #--------------------------------------------------------------------------
- # ● 更新帮助窗口文字
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_text(skill == nil ? "" : skill.description)
- end
- end
- #==============================================================================
- # ■ Window_SkillStatus
- #------------------------------------------------------------------------------
- # 显示特技升级消耗品的窗口
- #==============================================================================
- class Window_SLVconsum < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化窗口
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 544, 56)
- self.contents = Bitmap.new(width - 32, height - 32)
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- item = $data_items[SLV::ITEMID]
- return if not item
- icon_index = item.icon_index
- number = $game_party.item_number(item)
- x,y = 0,0
- draw_icon(icon_index,x,y)
- self.contents.draw_text(x + 24, y, 320, WLH, item.name+":#{number.to_s}")
- end
- end
- #==============================================================================
- # ■ Window_Gold
- #------------------------------------------------------------------------------
- # 显示技能信息的窗口。
- #==============================================================================
- class Window_SLVinfo < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化窗口
- #--------------------------------------------------------------------------
- def initialize(skill)
- super(272, 112, 272, 304)
- self.contents = Bitmap.new(width - 32, height - 32)
- [url=home.php?mod=space&uid=260100]@skill[/url] = skill
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- self.contents.font.size = 18
- return if not @skill
- id = @skill.id
- up = SLV::SLVUP
- if up.include?(id)
- self.contents.font.color = normal_color
- draw(@skill,0,0)
- self.contents.font.color = text_color(3)
- draw($data_skills[up[id]],4,138)
- else
- self.contents.font.color = normal_color
- draw(@skill,0,0)
- self.contents.font.color = text_color(2)
- self.contents.draw_text(0, 138, 320, WLH, "技能已达极限")
- end
- end
- def draw(skill,x,y)
- yh = 22
- draw_icon(skill.icon_index,x,y)
- self.contents.draw_text(x + 24, y, 320, WLH, skill.name)
- scope = ["无","敌方单体","敌方全体","敌方单体连击","敌方单体随机目标",
- "敌方二体随机目标","敌方三体随机目标","我方单体","我方全体",
- "我方单个濒死者","我方所有濒死者","使用者自身"]
- self.contents.draw_text(x, y+yh, 320, WLH, "使用范围:"+scope[skill.scope])
- occasion = ["不限制使用场合","仅作战时使用","仅菜单中使用","不可用"]
- self.contents.draw_text(x, y+yh*2, 320, WLH, "使用场合:"+occasion[skill.occasion])
- self.contents.draw_text(x, y+yh*3, 320, WLH, "消耗SP:"+skill.mp_cost.to_s)
- self.contents.draw_text(x, y+yh*4, 320, WLH, "基本伤害值:"+skill.base_damage.to_s)
- self.contents.draw_text(x, y+yh*5, 320, WLH, "命中率:"+skill.hit.to_s)
- end
- def skill
- @skill
- end
- def skill=(val)
- @skill = val
- end
- end
- class Window_SLVchoice < Window_Selectable
- def initialize(skill)
- super(272, 112, 272, 152)
- @commands = ["确定","返回"]
- @item_max = 2
- @skill = skill
- refresh
- self.index = 0
- self.z = 1000
- end
- def refresh
- item = $data_items[SLV::ITEMID]
- number = $game_party.item_number(item)
- upnum = SLV::SCONSUM[@skill.id]
- upnum = SLV::ALLSCONSUM unless upnum
- self.contents.clear
- for i in 0...@item_max
- if number < upnum
- color1 = Color.new(255, 255, 255, 128)
- color2 = text_color(2)
- else
- color1 = normal_color
- color2 = normal_color
- end
- self.contents.font.color = color1
- self.contents.font.color = normal_color if i == 1
- draw_item(i)
- end
- self.contents.draw_text(0, 56, 320, WLH, "升级必要:")
- x,y = 0,82
- icon_index = item.icon_index
- draw_icon(icon_index,x,y)
- self.contents.font.color = color2
- self.contents.draw_text(x + 24, y, 320, WLH, item.name+" * #{upnum.to_s}")
- end
- def draw_item(index)
- self.contents.draw_text(0, 26 * index, self.contents.width-8, WLH, @commands[index], 1)
- end
- def skill
- @skill
- end
- def skill=(val)
- @skill = val
- end
- end
- #==============================================================================
- # ■ Scene_Skill
- #------------------------------------------------------------------------------
- # 处理特技升级画面的类。
- #==============================================================================
- class Scene_SLV
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # actor_index : 角色索引
- #--------------------------------------------------------------------------
- def initialize(actor_index = 0)
- @actor_index = actor_index
- end
- #--------------------------------------------------------------------------
- # ● 主处理
- #--------------------------------------------------------------------------
- def main
- # 获取角色
- @actor = $game_party.members[@actor_index]
- # 生成帮助窗口、状态窗口、特技窗口
- @help_window = Window_Help.new
- @help_window.y = 56
- @consum_window = Window_SLVconsum.new
- @skill_window = Window_SLVindex.new(@actor)
- @info_window = Window_SLVinfo.new(@skill_window.skill)
- @choice_window = Window_SLVchoice.new(@skill_window.skill)
- @choice_window.visible = false
- @choice_window.active = false
- # 关联帮助窗口
- @skill_window.help_window = @help_window
- # 执行过渡
- Graphics.transition
- # 主循环
- loop do
- # 刷新游戏画面
- Graphics.update
- # 刷新输入信息
- Input.update
- # 刷新画面
- update
- # 如果画面切换的话就中断循环
- if $scene != self
- break
- end
- end
- # 准备过渡
- Graphics.freeze
- # 释放窗口
- @help_window.dispose
- @consum_window.dispose
- @skill_window.dispose
- @info_window.dispose
- @choice_window.dispose
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- # 刷新窗口
- @help_window.update
- @consum_window.update
- @skill_window.update
- @info_window.update
- @choice_window.update
- if @info_window.skill != @skill_window.skill
- @info_window.skill = @skill_window.skill
- @choice_window.skill = @skill_window.skill
- @info_window.refresh
- @choice_window.refresh
- end
- # 技能窗口被激活的情况下
- if @skill_window.active
- skill_update
- return
- end
- # 选项窗口被激活的情况下
- if @choice_window.active
- choice_update
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面(选项)
- #--------------------------------------------------------------------------
- def choice_update
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- Sound.play_cancel
- @choice_window.index = 0
- @skill_window.active = true
- @choice_window.visible = false
- @choice_window.active = false
- return
- end
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- case @choice_window.index
- when 0
- item = $data_items[SLV::ITEMID]
- number = $game_party.item_number(item)
- upnum = SLV::SCONSUM[@skill.id]
- upnum = SLV::ALLSCONSUM unless upnum
- if number < upnum
- Sound.play_buzzer
- else
- Audio.se_play("Audio/SE/Up",100,100)
- $game_party.gain_item(item, -upnum)
- @actor.forget_skill(@skill.id)
- @actor.learn_skill(SLV::SLVUP[@skill.id])
- @consum_window.refresh
- @skill_window.refresh
- @skill_window.active = true
- @choice_window.visible = false
- @choice_window.active = false
- end
- when 1
- Sound.play_cancel
- @choice_window.index = 0
- @skill_window.active = true
- @choice_window.visible = false
- @choice_window.active = false
- end
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面(技能)
- #--------------------------------------------------------------------------
- def skill_update
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- Sound.play_cancel
- # 切换到菜单画面
- $scene = Scene_Menu.new(5)
- return
- end
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- Sound.play_decision
- # 获取特技窗口现在选择的特技的数据
- @skill = @skill_window.skill
- unless SLV::SLVUP.include?(@skill.id)
- Sound.play_buzzer
- return
- end
- @skill_window.active = false
- @choice_window.visible = true
- @choice_window.active = true
- return
- end
- # 按下 R 键的情况下
- if Input.trigger?(Input::R)
- # 演奏光标 SE
- Sound.play_cursor
- # 移至下一位角色
- @actor_index += 1
- @actor_index %= $game_party.members.size
- # 切换到别的特技画面
- $scene = Scene_SLV.new(@actor_index)
- return
- end
- # 按下 L 键的情况下
- if Input.trigger?(Input::L)
- # 演奏光标 SE
- Sound.play_cursor
- # 移至上一位角色
- @actor_index += $game_party.members.size - 1
- @actor_index %= $game_party.members.size
- # 切换到别的特技画面
- $scene = Scene_SLV.new(@actor_index)
- return
- end
- end
- end
复制代码 |
评分
-
查看全部评分
|