赞 | 8 |
VIP | 14 |
好人卡 | 35 |
积分 | 32 |
经验 | 46931 |
最后登录 | 2024-8-10 |
在线时间 | 1442 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 3176
- 在线时间
- 1442 小时
- 注册时间
- 2009-7-27
- 帖子
- 1454
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 爆焰 于 2015-6-4 13:40 编辑
技能分类,我想不同的角色实现不同的技能分类,可是老是出错。
case @commands
when 0
s1 = "特技"
s2 = "钢拳"
s3 = "怒技"
@commands = [s1, s2, s3]
when 1
s1 = "特技"
s2 = "替身"
s3 = "怒技"
@commands = [s1, s2, s3]
…………
这样写错了吗?- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- #==============================================================================
- # ■ Liuliu_Window_SkillCommand
- #==============================================================================
- class Liuliu_Window_SkillCommand < Window_Selectable
- attr_accessor :commands
- #--------------------------------------------------------------------------
- # ● 初始化,生成commands窗口
- #--------------------------------------------------------------------------
- def initialize(actor)
- super(0, 0, 160, 288)
- case @commands
- when 0
- s1 = "特技"
- s2 = "钢拳"
- s3 = "怒技"
- @commands = [s1, s2, s3]
- when 1
- s1 = "特技"
- s2 = "替身"
- s3 = "怒技"
- @commands = [s1, s2, s3]
- end
- #————————生成commands窗口
- for i in 0...actor.skills.size
- skill = $data_skills[actor.skills[i]]
- if skill != nil
- push = true
- for com in @commands
- if com == skill.desc
- push = false
- end
- end
- if push == true
- @commands.push(skill.desc)
- end
- end
- end
- if @commands == []
- @commands.push("普通技能")
- end
- @item_max = @commands.size
- self.contents = Bitmap.new(width - 32, @item_max*32)
- refresh
- self.index = 0
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- for i in 0...@item_max
- draw_item(i, normal_color)
- end
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def draw_item(index, color)
- self.contents.font.color = color
- y = index * 32
- self.contents.draw_text(4, y, 128, 32, @commands[index])
- end
- #--------------------------------------------------------------------------
- # 只描绘原文字
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_text(@commands[self.index])
- end
- end
- #==============================================================================
- # ■ Window_Skill
- #==============================================================================
- class Liuliu_Window_SkillList < Window_Selectable
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def initialize(actor)
- super(160, 0, 480, 416)
- @actor = actor
- refresh
- self.index = 0
- # 战斗中的情况下将窗口移至中央并将其半透明化
- if $game_temp.in_battle
- self.y = 64
- self.height = 256
- self.back_opacity = 160
- end
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def skill
- return @data[self.index]
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def set_item(command)
- refresh
- for i in [email protected]
- skill = $data_skills[@actor.skills[i]]
- if skill != nil and skill.desc == command
- @data.push(skill)
- end
- end
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 32)
- self.contents.clear
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- #-----------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def draw_item(index)
- skill = @data[index]
- if @actor.skill_can_use?(skill.id)
- self.contents.font.color = normal_color
- else
- self.contents.font.color = disabled_color
- end
- x = 4
- y = index * 32
- rect = Rect.new(x, y, self.width / @column_max - 32, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon(skill.icon_name)
- opacity = self.contents.font.color == normal_color ? 255 : 128
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
- self.contents.draw_text(x + 390, y, 16, 32, ":", 1)
- self.contents.draw_text(x + 400, y, 40, 32, skill.sp_cost.to_s, 2)
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_text(self.skill == nil ? "" : self.skill.description)
- end
- end
- #==============================================================================
- # ■ Liuliu_Scene_Skill
- #==============================================================================
- class Scene_Skill
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # actor_index : 角色索引
- #--------------------------------------------------------------------------
- def initialize(actor_index = 0)
- @actor_index = actor_index
- @actor = $game_party.actors[@actor_index]
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def main
- @status_window = Window_SkillStatus.new(@actor)
- @itemcommand_window = Liuliu_Window_SkillCommand.new($game_party.actors[@actor_index])
- @command_index = @itemcommand_window.index
- @skill_window = Liuliu_Window_SkillList.new($game_party.actors[@actor_index])
- @skill_window.active = false
- @help_window = Window_Help.new
- @help_window.x = 0
- @help_window.y = 416
- @itemcommand_window.help_window = @help_window
- @skill_window.help_window = @help_window
- @target_window = Window_Target.new
- @target_window.visible = false
- @target_window.active = false
- @skill_window.set_item(@itemcommand_window.commands[@command_index])
- Graphics.transition
- loop do
- Graphics.update
- Input.update
- update
- if $scene != self
- break
- end
- end
- Graphics.freeze
- @itemcommand_window.dispose
- @skill_window.dispose
- @status_window.dispose
- @help_window.dispose
- @target_window.dispose
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def update
- @itemcommand_window.update
- @skill_window.update
- @help_window.update
- @target_window.update
- if @command_index != @itemcommand_window.index
- @command_index = @itemcommand_window.index
- @skill_window.set_item(@itemcommand_window.commands[@command_index])
- end
- if @itemcommand_window.active
- update_itemcommand
- return
- end
- if @skill_window.active
- update_itemlist
- return
- end
- if @target_window.active
- update_target
- return
- end
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def update_itemcommand
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- $scene = Scene_Menu.new(0)
- return
- end
- if Input.trigger?(Input::C)
- $game_system.se_play($data_system.decision_se)
- @itemcommand_window.active = false
- @skill_window.active = true
- @skill_window.index = 0
- return
- end
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def update_itemlist
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @itemcommand_window.active = true
- @skill_window.active = false
- @skill_window.index = 0
- @itemcommand_window.index = @command_index
- return
- end
- if Input.trigger?(Input::C)
- # 获取特技窗口现在选择的特技的数据
- @skill = @skill_window.skill
- # 不能使用的情况下
- if @skill == nil or not @actor.skill_can_use?(@skill.id)
- # 演奏冻结 SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 效果范围是我方的情况下
- if @skill.scope >= 3
- # 激活目标窗口
- @skill_window.active = false
- @target_window.x = (@skill_window.index + 1) % 2 * 304
- @target_window.visible = true
- @target_window.active = true
- # 设置效果范围 (单体/全体) 的对应光标位置
- if @skill.scope == 4 || @skill.scope == 6
- @target_window.index = -1
- elsif @skill.scope == 7
- @target_window.index = @actor_index - 10
- else
- @target_window.index = 0
- end
- # 效果在我方以外的情况下
- else
- # 公共事件 ID 有效的情况下
- if @skill.common_event_id > 0
- # 预约调用公共事件
- $game_temp.common_event_id = @skill.common_event_id
- # 演奏特技使用时的 SE
- $game_system.se_play(@skill.menu_se)
- # 消耗 SP
- @actor.sp -= @skill.sp_cost
- # 再生成各窗口的内容
- @status_window.refresh
- @skill_window.refresh
- @target_window.refresh
- # 切换到地图画面
- $scene = Scene_Map.new
- return
- end
- end
- return
- end
- end
- #--------------------------------------------------------------------------
- #--------------------------------------------------------------------------
- def update_target
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @skill_window.refresh
- @skill_window.active = true
- @target_window.visible = false
- @target_window.active = false
- @skill_window.set_item(@itemcommand_window.commands[@command_index])
- return
- end
-
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- # 因为 SP 不足而无法使用的情况下
- unless @actor.skill_can_use?(@skill.id)
- # 演奏冻结 SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 目标是全体的情况下
- if @target_window.index == -1
- # 对同伴全体应用特技使用效果
- used = false
- for i in $game_party.actors
- used |= i.skill_effect(@actor, @skill)
- end
- end
- # 目标是使用者的情况下
- if @target_window.index <= -2
- # 对目标角色应用特技的使用效果
- target = $game_party.actors[@target_window.index + 10]
- used = target.skill_effect(@actor, @skill)
- end
- # 目标是单体的情况下
- if @target_window.index >= 0
- # 对目标角色应用特技的使用效果
- target = $game_party.actors[@target_window.index]
- used = target.skill_effect(@actor, @skill)
- end
- # 使用特技的情况下
- if used
- # 演奏特技使用时的 SE
- $game_system.se_play(@skill.menu_se)
- # 消耗 SP
- @actor.sp -= @skill.sp_cost
- # 再生成各窗口内容
- @status_window.refresh
- #@skill_window.refresh
- @target_window.refresh
- # 全灭的情况下
- if $game_party.all_dead?
- # 切换到游戏结束画面
- $scene = Scene_Gameover.new
- return
- end
- # 公共事件 ID 有效的情况下
- if @skill.common_event_id > 0
- # 预约调用公共事件
- $game_temp.common_event_id = @skill.common_event_id
- # 切换到地图画面
- $scene = Scene_Map.new
- return
- end
- end
- # 无法使用特技的情况下
- unless used
- # 演奏冻结 SE
- $game_system.se_play($data_system.buzzer_se)
- end
- return
- end
- end
- end
- #==============================================================================
- # ■ Window_SkillStatus
- #------------------------------------------------------------------------------
- # 显示特技画面、特技使用者的窗口。
- #==============================================================================
- class Window_SkillStatus < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # actor : 角色
- #--------------------------------------------------------------------------
- def initialize(actor)
- super(0, 288, 160, 128)
- self.contents = Bitmap.new(width - 32, height - 32)
- @actor = actor
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- draw_actor_name(@actor, 4, 0)
- draw_actor_hp(@actor, 4, 32, 120)
- draw_actor_sp(@actor, 4, 64, 120)
- end
- end
- #==============================================================================
- # ■ RPG追加定义,使用@符号分类
- #==============================================================================
- module RPG
- class Skill
- def description
- description = @description.split(/@/)[0]
- return description != nil ? description : ''
- end
- def desc
- desc = @description.split(/@/)[1]
- return desc != nil ? desc : "普通技能"
- end
- end
- end
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- class Scene_Battle
- #--------------------------------------------------------------------------
- # ● 刷新画面 (角色命令回合 : 选择特技) ★★★★★★★★★★★★★★★★★
- #--------------------------------------------------------------------------
- def update_phase3_skill_select
- # 设置特技窗口为可视状态
- @skill_window.visible = true
- @itemcommand_window.visible = true
- @itemcommand_window.update
- if @command_index != @itemcommand_window.index
- @command_index = @itemcommand_window.index
- @skill_window.set_item(@itemcommand_window.commands[@command_index])
- @skill_window.index = 0
- end
- @skill_window.update
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- if @itemcommand_window.active==false
- @itemcommand_window.active = true
- @skill_window.active = false
- return
- end
- # 结束特技选择
- end_skill_select
- return
- end
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- if @itemcommand_window.active
- @itemcommand_window.active = false
- @skill_window.active = true
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- return
- end
- # 获取特技选择窗口现在选择的特技的数据
- @skill = @skill_window.skill
- # 无法使用的情况下
- if @skill == nil or not @active_battler.skill_can_use?(@skill.id)
- # 演奏冻结 SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 设置行动
- @active_battler.current_action.skill_id = @skill.id
- # 设置特技窗口为不可见状态
- @skill_window.visible = false
- @itemcommand_window.visible = false
- # 效果范围是敌单体的情况下
- if @skill.scope == 1
- # 开始选择敌人
- start_enemy_select
- # 效果范围是我方单体的情况下
- elsif @skill.scope == 3 or @skill.scope == 5
- # 开始选择角色
- start_actor_select
- # 效果范围不是单体的情况下
- else
- # 选择特技结束
- end_skill_select
- # 转到下一位角色的指令输入
- phase3_next_actor
- end
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● 开始选择特技 ★★★★★★★★★★★★★★★★★★★★★★★★★★★★
- #--------------------------------------------------------------------------
- def start_skill_select
- @skill_window = Liuliu_Window_SkillList.new(@active_battler)
- @skill_window.help_window = @help_window
- @itemcommand_window = Liuliu_Window_SkillCommand.new(@active_battler)
- @itemcommand_window.opacity = 160
- @itemcommand_window.y = 64
- @itemcommand_window.height -= 32
- @itemcommand_window.active = true
- @itemcommand_window.help_window = @help_window
- @skill_window.active = false
- @command_index = @itemcommand_window.index
- @skill_window.set_item(@itemcommand_window.commands[@command_index])
- @actor_command_window.active = false
- @actor_command_window.visible = false
- end
- #--------------------------------------------------------------------------
- # ● 选择特技结束 ★★★★★★★★★★★★★★★★★★★★★★★★★★★★
- #--------------------------------------------------------------------------
- def end_skill_select
- # 释放特技窗口
- @itemcommand_window.dispose
- @itemcommand_window = nil
- @skill_window.dispose
- @skill_window = nil
- # 隐藏帮助窗口
- @help_window.visible = false
- # 有效化角色指令窗口
- @actor_command_window.active = true
- @actor_command_window.visible = true
- end
- end
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
复制代码 |
|