赞 | 13 |
VIP | 642 |
好人卡 | 62 |
积分 | 27 |
经验 | 117527 |
最后登录 | 2024-10-4 |
在线时间 | 2630 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 2749
- 在线时间
- 2630 小时
- 注册时间
- 2013-1-16
- 帖子
- 5657
|
做好了
截图如下
代码如下- class Window_Base < Window
- #--------------------------------------------------------------------------
- # ● 描绘能力值
- # actor : 角色
- # x : 描画目标 X 坐标
- # y : 描画目标 Y 坐标
- # type : 能力值种类 (0~6)
- #--------------------------------------------------------------------------
- def draw_actor_parameter(actor, x, y, type, distance = 120)
- case type
- when 0
- parameter_name = $data_system.words.atk
- parameter_value = actor.atk
- when 1
- parameter_name = $data_system.words.pdef
- parameter_value = actor.pdef
- when 2
- parameter_name = $data_system.words.mdef
- parameter_value = actor.mdef
- when 3
- parameter_name = $data_system.words.str
- parameter_value = actor.str
- when 4
- parameter_name = $data_system.words.dex
- parameter_value = actor.dex
- when 5
- parameter_name = $data_system.words.agi
- parameter_value = actor.agi
- when 6
- parameter_name = $data_system.words.int
- parameter_value = actor.int
- end
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, 120, 32, parameter_name)
- self.contents.font.color = normal_color
- self.contents.draw_text(x + distance, y, 36, 32, parameter_value.to_s, 2)
- end
- #--------------------------------------------------------------------------
- # ● 描绘 HP
- # actor : 角色
- # x : 描画目标 X 坐标
- # y : 描画目标 Y 坐标
- # width : 描画目标的宽
- #--------------------------------------------------------------------------
- def draw_actor_hp(actor, x, y, width = 144, normal = true)
- # 描绘字符串 "HP"
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
- # 计算描绘 MaxHP 所需的空间
- if normal
- if width - 32 >= 108
- hp_x = x + width - 108
- flag = true
- elsif width - 32 >= 48
- hp_x = x + width - 48
- flag = false
- end
- else
- hp_x = x + 24
- flag = true
- end
- # 描绘 HP
- self.contents.font.color = actor.hp == 0 ? knockout_color :
- actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
- self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
- # 描绘 MaxHP
- if flag
- self.contents.font.color = normal_color
- self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1)
- self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
- end
- end
- #--------------------------------------------------------------------------
- # ● 描绘 SP
- # actor : 角色
- # x : 描画目标 X 坐标
- # y : 描画目标 Y 坐标
- # width : 描画目标的宽
- #--------------------------------------------------------------------------
- def draw_actor_sp(actor, x, y, width = 144, normal = true)
- # 描绘字符串 "SP"
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
- # 计算描绘 MaxSP 所需的空间
- if normal
- if width - 32 >= 108
- sp_x = x + width - 108
- flag = true
- elsif width - 32 >= 48
- sp_x = x + width - 48
- flag = false
- end
- else
- sp_x = x + 24
- flag = true
- end
- # 描绘 SP
- self.contents.font.color = actor.sp == 0 ? knockout_color :
- actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
- self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
- # 描绘 MaxSP
- if flag
- self.contents.font.color = normal_color
- self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
- self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
- end
- end
- end
- class Window_Target < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 120, 480)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.z += 10
- @item_max = $game_party.actors.size
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- for i in 0...$game_party.actors.size
- x = 0
- y = i * 116
- actor = $game_party.actors[i]
- draw_actor_name(actor, x, y)
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新光标矩形
- #--------------------------------------------------------------------------
- def update_cursor_rect
- # 光标位置 -1 为全选、-2 以下为单独选择 (使用者自身)
- if [url=home.php?mod=space&uid=370741]@Index[/url] <= -2
- self.cursor_rect.set(0, (@index + 10) * 116, self.width - 32, 96)
- elsif @index == -1
- self.cursor_rect.set(0, 0, self.width - 32, @item_max * 116 - 20)
- else
- self.cursor_rect.set(0, @index * 116, self.width - 32, 96)
- end
- end
- end
- #============================================================================
- #============================================================================
- #============================================================================
- class Window_Controduction < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # actor : 角色
- #--------------------------------------------------------------------------
- def initialize(actor)
- super(0, 0, 200, 480)
- self.contents = Bitmap.new(width - 32, height - 32)
- [url=home.php?mod=space&uid=95897]@actor[/url] = actor
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- self.contents.font.size = 14
- draw_actor_graphic(@actor, 32, 112)
- draw_actor_name(@actor, 0, 0)
- draw_actor_class(@actor, 0 + 80, 0)
- draw_actor_level(@actor, 0, 14)
- draw_actor_state(@actor, 0, 28)
- draw_actor_hp(@actor, 0, 112, 172, false)
- draw_actor_sp(@actor, 0, 144, 172, false)
- draw_actor_parameter(@actor, 0, 192, 0, 48)
- draw_actor_parameter(@actor, 0, 224, 1, 48)
- draw_actor_parameter(@actor, 0, 256, 2, 48)
- draw_actor_parameter(@actor, 0, 304, 3, 48)
- draw_actor_parameter(@actor, 0, 336, 4, 48)
- draw_actor_parameter(@actor, 0, 368, 5, 48)
- draw_actor_parameter(@actor, 0, 400, 6, 48)
- self.contents.font.color = system_color
- self.contents.draw_text(80, 48, 80, 32, "EXP")
- self.contents.draw_text(80, 80, 80, 32, "NEXT")
- self.contents.font.color = normal_color
- self.contents.draw_text(80, 48, 84, 32, @actor.exp_s, 2)
- self.contents.draw_text(80, 80, 84, 32, @actor.next_rest_exp_s, 2)
- self.contents.font.color = system_color
- self.contents.draw_text(96 + 16, 160, 96, 32, "装备")
- draw_item_name($data_weapons[@actor.weapon_id], 96 + 16, 208)
- draw_item_name($data_armors[@actor.armor1_id], 96 + 16, 256)
- draw_item_name($data_armors[@actor.armor2_id], 96 + 16, 304)
- draw_item_name($data_armors[@actor.armor3_id], 96 + 16, 352)
- draw_item_name($data_armors[@actor.armor4_id], 96 + 16, 400)
- self.contents.font.size = 22
- end
- def dummy
- self.contents.font.color = system_color
- self.contents.draw_text(320, 112, 96, 32, $data_system.words.weapon)
- self.contents.draw_text(320, 176, 96, 32, $data_system.words.armor1)
- self.contents.draw_text(320, 240, 96, 32, $data_system.words.armor2)
- self.contents.draw_text(320, 304, 96, 32, $data_system.words.armor3)
- self.contents.draw_text(320, 368, 96, 32, $data_system.words.armor4)
- draw_item_name($data_weapons[@actor.weapon_id], 320 + 24, 144)
- draw_item_name($data_armors[@actor.armor1_id], 320 + 24, 208)
- draw_item_name($data_armors[@actor.armor2_id], 320 + 24, 272)
- draw_item_name($data_armors[@actor.armor3_id], 320 + 24, 336)
- draw_item_name($data_armors[@actor.armor4_id], 320 + 24, 400)
- end
- end
- #============================================================================
- #============================================================================
- #============================================================================
- class Scene_Item
- #--------------------------------------------------------------------------
- # ● 刷新画面 (物品窗口被激活的情况下)
- #--------------------------------------------------------------------------
- def update_item
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- # 切换到菜单画面
- $scene = Scene_Menu.new(0)
- return
- end
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- # 获取物品窗口当前选中的物品数据
- @item = @item_window.item
- # 不使用物品的情况下
- unless @item.is_a?(RPG::Item)
- # 演奏冻结 SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 不能使用的情况下
- unless $game_party.item_can_use?(@item.id)
- # 演奏冻结 SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 效果范围是我方的情况下
- if @item.scope >= 3
- # 激活目标窗口
- @item_window.active = false
-
- @controduction = Window_Controduction.new($game_party.actors[0])
- @controduction.z = 200
-
- if (@item_window.index + 1) % 2 == 0
- @target_window.x = 200
-
- @controduction.x = 0
-
- elsif (@item_window.index + 1) % 2 == 1
- @target_window.x = 320
-
- @controduction.x = 440
-
- end
- @target_window.visible = true
- @target_window.active = true
-
- @controduction.visible = true
-
- # 设置效果范围 (单体/全体) 的对应光标位置
- if @item.scope == 4 || @item.scope == 6
- @target_window.index = -1
- else
- @target_window.index = 0
- end
- # 效果在我方以外的情况下
- else
- # 公共事件 ID 有效的情况下
- if @item.common_event_id > 0
- # 预约调用公共事件
- $game_temp.common_event_id = @item.common_event_id
- # 演奏物品使用时的 SE
- $game_system.se_play(@item.menu_se)
- # 消耗品的情况下
- if @item.consumable
- # 使用的物品数减 1
- $game_party.lose_item(@item.id, 1)
- # 再描绘物品窗口的项目
- @item_window.draw_item(@item_window.index)
- end
- # 切换到地图画面
- $scene = Scene_Map.new
- return
- end
- end
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面 (目标窗口被激活的情况下)
- #--------------------------------------------------------------------------
- def update_target
-
- @controduction.dispose
- @controduction = Window_Controduction.new($game_party.actors[@target_window.index])
- @controduction.z = 200
- @controduction.update
-
- if (@item_window.index + 1) % 2 == 0
- @target_window.x = 200
-
- @controduction.x = 0
-
- elsif (@item_window.index + 1) % 2 == 1
- @target_window.x = 320
-
- @controduction.x = 440
-
- end
-
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- # 由于物品用完而不能使用的场合
- unless $game_party.item_can_use?(@item.id)
- # 再次生成物品窗口的内容
- @item_window.refresh
- end
- # 删除目标窗口
- @item_window.active = true
- @target_window.visible = false
- @target_window.active = false
-
- @controduction.visible = false
-
- return
- end
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- # 如果物品用完的情况下
- if $game_party.item_number(@item.id) == 0
- # 演奏冻结 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.item_effect(@item)
- end
- end
- # 目标是单体的情况下
- if @target_window.index >= 0
- # 对目标角色应用物品的使用效果
- target = $game_party.actors[@target_window.index]
- used = target.item_effect(@item)
- end
- # 使用物品的情况下
- if used
- # 演奏物品使用时的 SE
- $game_system.se_play(@item.menu_se)
- # 消耗品的情况下
- if @item.consumable
- # 使用的物品数减 1
- $game_party.lose_item(@item.id, 1)
- # 再描绘物品窗口的项目
- @item_window.draw_item(@item_window.index)
- end
- # 再生成目标窗口的内容
- @target_window.refresh
- # 全灭的情况下
- if $game_party.all_dead?
- # 切换到游戏结束画面
- $scene = Scene_Gameover.new
- return
- end
- # 公共事件 ID 有效的情况下
- if @item.common_event_id > 0
- # 预约调用公共事件
- $game_temp.common_event_id = @item.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
- #==============================================================================
- # ■ Scene_Skill
- #------------------------------------------------------------------------------
- # 处理特技画面的类。
- #==============================================================================
- class Scene_Skill
- #--------------------------------------------------------------------------
- # ● 刷新画面 (特技窗口被激活的情况下)
- #--------------------------------------------------------------------------
- def update_skill
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- # 切换到菜单画面
- $scene = Scene_Menu.new(1)
- return
- end
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- # 获取特技窗口现在选择的特技的数据
- [url=home.php?mod=space&uid=260100]@skill[/url] = @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
-
- @controduction = Window_Controduction.new($game_party.actors[0])
- @controduction.z = 200
-
- if (@skill_window.index + 1) % 2 == 0
- @target_window.x = 200
-
- @controduction.x = 0
-
- elsif (@skill_window.index + 1) % 2 == 1
- @target_window.x = 320
-
- @controduction.x = 440
-
- end
- @target_window.visible = true
- @target_window.active = true
-
- @controduction.visible = 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
- # 按下 R 键的情况下
- if Input.trigger?(Input::R)
- # 演奏光标 SE
- $game_system.se_play($data_system.cursor_se)
- # 移至下一位角色
- @actor_index += 1
- @actor_index %= $game_party.actors.size
- # 切换到别的特技画面
- $scene = Scene_Skill.new(@actor_index)
- return
- end
- # 按下 L 键的情况下
- if Input.trigger?(Input::L)
- # 演奏光标 SE
- $game_system.se_play($data_system.cursor_se)
- # 移至上一位角色
- @actor_index += $game_party.actors.size - 1
- @actor_index %= $game_party.actors.size
- # 切换到别的特技画面
- $scene = Scene_Skill.new(@actor_index)
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面 (目标窗口被激活的情况下)
- #--------------------------------------------------------------------------
- def update_target
-
- @controduction.dispose
- @controduction = Window_Controduction.new($game_party.actors[@target_window.index])
- @controduction.z = 200
- @controduction.update
-
- if (@skill_window.index + 1) % 2 == 0
- @target_window.x = 200
-
- @controduction.x = 0
-
- elsif (@skill_window.index + 1) % 2 == 1
- @target_window.x = 320
-
- @controduction.x = 440
-
- end
-
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- # 删除目标窗口
- @skill_window.active = true
- @target_window.visible = false
- @target_window.active = false
-
- @controduction.visible = false
-
- 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
复制代码 但是有缺陷:如果物品或特技的使用范围是全体,那么会显示最后一个角色的资料。
附上工程
Project1.rar
(189.89 KB, 下载次数: 30)
|
|