赞 | 0 |
VIP | 44 |
好人卡 | 2 |
积分 | 4 |
经验 | 6159 |
最后登录 | 2024-11-3 |
在线时间 | 190 小时 |
Lv2.观梦者
- 梦石
- 0
- 星屑
- 447
- 在线时间
- 190 小时
- 注册时间
- 2006-1-8
- 帖子
- 53
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
给每个角色有不同名字的攻击命令文字
具体设置在 Window_Command_Battle 里 get_command(battler)
- #==============================================================================
- # ■ Window_Command_Battle
- #------------------------------------------------------------------------------
- # 战斗命令选择行窗口。
- #==============================================================================
- class Window_Command_Battle < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # width : 窗口的宽
- # commands : 命令字符串序列
- #--------------------------------------------------------------------------
- def initialize(width, battler)
- commands = get_command(battler)
- # 由命令的个数计算出窗口的高
- super(0, 0, width, commands.size * 32 + 32)
- @item_max = commands.size
- @commands = commands
- self.contents = Bitmap.new(width - 32, @item_max * 32)
- self.z = 100
- refresh(battler)
- self.index = 0
- @old_id = 0
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh(battler)
- if battler.id != @old_id
- self.contents.clear
- for i in 0...get_command(battler).size
- draw_item(i, normal_color,get_command(battler)[i])
- end
- @old_id = battler.id
- end
- end
- #--------------------------------------------------------------------------
- # ● 描绘项目
- # index : 项目编号
- # color : 文字色
- #--------------------------------------------------------------------------
- def draw_item(index, color,name)
- self.contents.font.color = color
- rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- self.contents.draw_text(rect, name)
- end
- #--------------------------------------------------------------------------
- # ● 项目无效化
- # index : 项目编号
- #--------------------------------------------------------------------------
- def disable_item(index)
- draw_item(index, disabled_color)
- end
- #--------------------------------------------------------------------------
- # ● 获取命令
- #--------------------------------------------------------------------------
- def get_command(battler)
- # 根据名字来定义 或者 其它属性来定义
- if battler.name == "阿尔西斯"
- return ["攻击","剑技","防御","物品"]
- elsif battler.name == "帕吉尔"
- return ["攻击","枪技","防御","物品"]
- elsif battler.name == "克萝莉亚"
- return ["攻击","神术","防御","物品"]
- elsif battler.name == "西露达"
- return ["攻击","魔法","防御","物品"]
- else
- return ["攻击","特技","防御","物品"]
- end
- end
- end
- class Scene_Battle
- #--------------------------------------------------------------------------
- # ● 主处理
- #--------------------------------------------------------------------------
- def main
- # 初始化战斗用的各种暂时数据
- $game_temp.in_battle = true
- $game_temp.battle_turn = 0
- $game_temp.battle_event_flags.clear
- $game_temp.battle_abort = false
- $game_temp.battle_main_phase = false
- $game_temp.battleback_name = $game_map.battleback_name
- $game_temp.forcing_battler = nil
- # 初始化战斗用事件解释器
- $game_system.battle_interpreter.setup(nil, 0)
- # 准备队伍
- @troop_id = $game_temp.battle_troop_id
- $game_troop.setup(@troop_id)
- # 生成角色命令窗口
- s1 = $data_system.words.attack
- s2 = $data_system.words.skill
- s3 = $data_system.words.guard
- s4 = $data_system.words.item
- @actor_command_window = Window_Command_Battle.new(160,$game_party.actors[0])
- @actor_command_window.y = 160
- @actor_command_window.back_opacity = 160
- @actor_command_window.active = false
- @actor_command_window.visible = false
- # 生成其它窗口
- @party_command_window = Window_PartyCommand.new
- @help_window = Window_Help.new
- @help_window.back_opacity = 160
- @help_window.visible = false
- @status_window = Window_BattleStatus.new
- @message_window = Window_Message.new
- # 生成活动块
- @spriteset = Spriteset_Battle.new
- # 初始化等待计数
- @wait_count = 0
- # 执行过渡
- if $data_system.battle_transition == ""
- Graphics.transition(20)
- else
- Graphics.transition(40, "Graphics/Transitions/" +
- $data_system.battle_transition)
- end
- # 开始自由战斗回合
- start_phase1
- # 主循环
- loop do
- # 刷新游戏画面
- Graphics.update
- # 刷新输入信息
- Input.update
- # 刷新画面
- update
- # 如果画面切换的话就中断循环
- if $scene != self
- break
- end
- end
- # 刷新地图
- $game_map.refresh
- # 准备过渡
- Graphics.freeze
- # 释放窗口
- @actor_command_window.dispose
- @party_command_window.dispose
- @help_window.dispose
- @status_window.dispose
- @message_window.dispose
- if @skill_window != nil
- @skill_window.dispose
- end
- if @item_window != nil
- @item_window.dispose
- end
- if @result_window != nil
- @result_window.dispose
- end
- # 释放活动块
- @spriteset.dispose
- # 标题画面切换中的情况
- if $scene.is_a?(Scene_Title)
- # 淡入淡出画面
- Graphics.transition
- Graphics.freeze
- end
- # 战斗测试或者游戏结束以外的画面切换中的情况
- if $BTEST and not $scene.is_a?(Scene_Gameover)
- $scene = nil
- end
- end
- def phase3_setup_command_window
- @actor_command_window.refresh(@active_battler)
- # 同伴指令窗口无效化
- @party_command_window.active = false
- @party_command_window.visible = false
- # 角色指令窗口无效化
- @actor_command_window.active = true
- @actor_command_window.visible = true
- # 设置角色指令窗口的位置
- @actor_command_window.x = @actor_index * 160
- # 设置索引为 0
- @actor_command_window.index = 0
- end
- end
复制代码 |
|