| 赞 | 1 |
| VIP | |
| 好人卡 | |
| 积分 | 1 |
| 经验 | |
| 最后登录 | 2016-1-18 |
| 在线时间 | 1269 小时 |
薄凉看客
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 1269 小时
- 注册时间
- 2010-6-20
- 回帖
- 1223
|
发表于 2014-12-31 17:50:39
|
显示全部楼层
本帖最后由 恐惧剑刃 于 2014-12-31 17:56 编辑
宠物系统 很多东西没有完成 不过大概思路就是这样
仅供参考
随便新建一个工程,去捕捉幽灵看看吧 呵呵
剩下的把对应角色加入队伍,删除角色等需要专用宠物界面 我没有完成。。。
babies 当前角色的所有宠物
canzhan 参战- module Battle
- end
- #==============================================================================
- # ■ Battle::Actor
- #------------------------------------------------------------------------------
- # 角色模块。
- #==============================================================================
- module Battle::Actor
-
- Commands = []
- # 一般指令
- Default_Commands = ["攻击", "特技", "防御", "物品"]
- # 特殊指令
- Commands[1] = ["捕捉", "攻击", "防御"]
- Commands[2] = ["攻击", "特技", "防御"]
- Commands[7] = ["魔法", "防御", "物品"]
- Commands[8] = ["魔法", "防御", "物品"]
-
- end
- #==============================================================================
- # ■ Game_Actor
- #------------------------------------------------------------------------------
- # 处理角色的类。本类在 Game_Actors 类 ($game_actors)
- # 的内部使用、Game_Party 类请参考 ($game_party) 。
- #==============================================================================
- class Game_Actor < Game_Battler
- attr_writer :babies # baby列表,角色当前所有的宠物
- attr_accessor :canzhan
- def babies
- @babies = [] if @babies.nil?
- return @babies
- end
- end
- #==============================================================================
- # ■ Battle::Enemy
- #------------------------------------------------------------------------------
- # 敌人模块。
- #==============================================================================
- module Battle::Enemy
-
- Babies = []
- # 可以捕捉的敌人设置
- Babies = [1]
-
- Acid = []
- # 对应角色id
- Acid[1] = 37
-
- Ani = []
- # [角色id] = [动画1, 动画2]
- Ani[1] = [19, 20]
-
- end
- #==============================================================================
- # ■ Window_BattleCommand
- #------------------------------------------------------------------------------
- # 角色指令窗口。
- #==============================================================================
- class Window_BattleCommand < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 160, 0)
- self.active = false
- self.index = -1
- self.visible = false
- end
- #--------------------------------------------------------------------------
- # ● 设置
- #--------------------------------------------------------------------------
- def setup(index)
- return if @actor_index == index
- @actor_index = index
- id = $game_party.actors[index].id
- if not (commands = Battle::Actor::Commands[id])
- commands = Battle::Actor::Default_Commands
- end
- @commands = commands
- @item_max = @commands.size
- self.height = (@item_max + 1) * 32
- self.y = 320 - self.height
- if self.contents
- self.contents.dispose
- self.contents = nil
- end
- self.contents = Bitmap.new(self.width - 32, @item_max * 32)
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 指令
- #--------------------------------------------------------------------------
- def command
- return @commands[self.index]
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- for i in 0...@item_max
- draw_item(i, normal_color)
- end
- self.visible = true
- end
- #--------------------------------------------------------------------------
- # ● 描绘项目
- # index : 项目编号
- # color : 文字色
- #--------------------------------------------------------------------------
- def draw_item(index, color)
- self.contents.font.color = color
- x = 4
- y = 32 * index
- sw = self.contents.width - 8
- sh = 32
- self.contents.draw_text(x, y, sw, sh, @commands[index])
- end
- end
- #==============================================================================
- # ■ Scene_Battle (分割定义 3)
- #------------------------------------------------------------------------------
- # 处理战斗画面的类。
- #==============================================================================
- class Scene_Battle
- include Battle::Actor
- #--------------------------------------------------------------------------
- # ● 设置角色指令窗口
- #--------------------------------------------------------------------------
- alias bljrwg phase3_setup_command_window
- def phase3_setup_command_window
- @actor_command_window.setup(@actor_index)
- bljrwg
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面 (角色命令回合 : 基本命令)
- #--------------------------------------------------------------------------
- alias ymxjrwg update_phase3_basic_command
- def update_phase3_basic_command
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- # 转向前一个角色的指令输入
- phase3_prior_actor
- return
- end
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- # 角色指令窗口光标位置分之
- case @actor_command_window.command
- when "攻击"
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 设置行动
- @active_battler.current_action.kind = 0
- @active_battler.current_action.basic = 0
- # 开始选择敌人
- start_enemy_select
- when "特技", "魔法"
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 设置行动
- @active_battler.current_action.kind = 1
- # 开始选择特技
- start_skill_select
- when "防御"
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 设置行动
- @active_battler.current_action.kind = 0
- @active_battler.current_action.basic = 1
- # 转向下一位角色的指令输入
- phase3_next_actor
- when "物品"
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 设置行动
- @active_battler.current_action.kind = 2
- # 开始选择物品
- start_item_select
- when "捕捉"
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 设置行动
- @active_battler.current_action.kind = 3
- # 开始选择敌人
- start_enemy_select
- end
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面 (主回合步骤 2 : 开始行动)
- #--------------------------------------------------------------------------
- alias mdhdjwg update_phase4_step2
- def update_phase4_step2
- # 如果不是强制行动
- unless @active_battler.current_action.forcing
- # 限制为 [敌人为普通攻击] 或 [我方为普通攻击] 的情况下
- if @active_battler.restriction == 2 or @active_battler.restriction == 3
- # 设置行动为攻击
- @active_battler.current_action.kind = 0
- @active_battler.current_action.basic = 0
- end
- # 限制为 [不能行动] 的情况下
- if @active_battler.restriction == 4
- # 清除行动强制对像的战斗者
- $game_temp.forcing_battler = nil
- # 移至步骤 1
- @phase4_step = 1
- return
- end
- end
- # 清除对像战斗者
- @target_battlers = []
- # 行动种类分支
- case @active_battler.current_action.kind
- when 0 # 基本
- make_basic_action_result
- when 1 # 特技
- make_skill_action_result
- when 2 # 物品
- make_item_action_result
- when 3 # 捕捉
- make_buzhuo_action_result
- end
- # 移至步骤 3
- if @phase4_step == 2
- @phase4_step = 3
- end
- end
- #--------------------------------------------------------------------------
- # ● 生成捕捉行动结果
- #--------------------------------------------------------------------------
- def make_buzhuo_action_result
- index = @active_battler.current_action.target_index
- target = $game_troop.smooth_target_enemy(index)
- @target_battlers = [target]
- if !Battle::Enemy::Babies.include?(target.id)
- @phase4_step = 1
- return
- end
- if 20 > rand(100)
- print "捕捉 #{target.name} 失败!"
- @phase4_step = 1
- return
- end
- print "成功捕捉 #{target.name} !"
- @animation1_id = Battle::Enemy::Ani[@active_battler.id][0]
- @animation2_id = Battle::Enemy::Ani[@active_battler.id][1]
- @help_window.set_text("捕捉", 1)
- @active_battler.babies << Battle::Enemy::Acid[target.id]
- end
- end
复制代码 |
|