赞 | 3 |
VIP | 3 |
好人卡 | 0 |
积分 | 1 |
经验 | 48466 |
最后登录 | 2022-9-20 |
在线时间 | 70 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 142
- 在线时间
- 70 小时
- 注册时间
- 2006-5-14
- 帖子
- 882
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 悠哈悠哈 于 2009-10-8 19:00 编辑
66上有个成熟的CP式战斗脚本,我从绯月心二开始就一直使用这种脚本.但他有个问题,那就是速度对战斗的影响太大.因为他是1:1式的,即如果你的速度是怪的两倍就可二次行动,三倍的话就可三次行动......这就造成一个后果:只要HP多到不会被怪秒就行,剩下的就是速度王道了.......(这对有分配能力点的系统来说非常头痛,平衡性非常难调整).
所以我想到一种算法:随着双方速度差的放大,速度对CP的影响不断减少.简单的说就是,当双方速度值一样时CP增长一样,双方行动速度一样.但当一方的速度是另一方的两倍时(例一个是100,一个是200)这时实际CP增长只有50%,也就是说只是比对方多了0.5次行动,想要达到二次行动速度要达到对方的4倍,也就是说对方速度值是100,我方是400,这样才能实现现两次行动.(这样做的目的我想大家也明白吧,当然有更好的算法的话,你说话)
我是脚本盲,当年我问禾西时,禾西说这个理论上是可行的,可是在脚本上和如何描述他就不知道了.全二中我虽然减少了速度的其他性能,但还是太强,所以不得想决心改变CP的算法.请各位脚本高手帮一下我.谢谢.
附上我用的CP脚本:- if Control[:CPS]
- class Scene_Battle_CP
- Speed = 1.0
- Initial_Percent = 0
- end
- class Scene_Battle
- CPcost = {}
- # 滿CP時響起的音效,可以自己添加
- CP_SE = ""
- CPcost[:basic] = 0 # 基础共同
- CPcost[:skill] = 65535 # 技能
- CPcost[:item] = 65535 # 物品
- CPcost[:throw] = 65535 # 投掷
- CPcost[:attack] = 65535 # 攻撃
- CPcost[:guard] = 65535 # 防御
- CPcost[:nothing]= 65535 # 不做任何事情
- CPcost[:escpe] = 65535 # 逃跑
- end
- #==============================================================================
- # ■ Scene_Battle (main)
- #------------------------------------------------------------------------------
- # CPS系統
- #==============================================================================
- class Scene_Battle
- attr_accessor :battle_sprite
- #--------------------------------------------------------------------------
- # ● 接口
- #--------------------------------------------------------------------------
- Import_01 = []
- Import_02 = []
- #--------------------------------------------------------------------------
- # ● 主处理
- #--------------------------------------------------------------------------
- def main
- prepare
- # 执行过渡
- if $data_system.battle_transition == ""
- Graphics.transition(20)
- else
- Graphics.transition(40, "Graphics/Transitions/" +
- $data_system.battle_transition)
- end
- setup_phase1
- # 主循环
- loop do
- # 刷新游戏画面
- Graphics.update
- # 刷新输入信息
- Input.update
- # 刷新画面
- update
- # 如果画面切换的话就中断循环
- break if $scene != self
- end
- # 刷新地图
- $game_map.refresh
- # 准备过渡
- Graphics.freeze
- terminate
- # 标题画面切换中的情况
- 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 prepare
- #-----------------------------------
- # 初始化战斗用的各种暂时数据
- #-----------------------------------
- $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)
- #-----------------------------------
- # 基本战斗显示活动块(含地图、天气、战斗人员)
- #-----------------------------------
- @battle_sprite = Spriteset_Battle.new
-
- #-----------------------------------
- # 帮助窗口
- #-----------------------------------
- @help_window = Window_Help.new
- @help_window.back_opacity = 160
- @help_window.visible = false
- #-----------------------------------
- # 信息栏窗口
- #-----------------------------------
- @message_window = Window_Message.new
- #-----------------------------------
- # 初始化等待计数
- #-----------------------------------
- @wait_count = 0
-
-
- #-----------------------------------
- # CP值加算建立
- #-----------------------------------
- @cp_thread = Scene_Battle_CP.new
- #-----------------------------------
- # 动作选择窗口
- #-----------------------------------
- @actor_command = Scene_Battle_Select.new(@battle_sprite.viewport1,@battle_sprite.viewport2)
- #-----------------------------------
- # ["战斗", "逃跑"]
- #-----------------------------------
- @party_command_window = Window_PartyCommand.new
- #-----------------------------------
- # 人物状态栏窗口
- #-----------------------------------
- @status_window = Window_BattleStatus.new
- end
- #--------------------------------------------------------------------------
- # ● 终止
- #--------------------------------------------------------------------------
- def terminate
- @result_window.dispose if @result_window != nil
- @status_window.dispose
- @actor_command.dispose
- @party_command_window.dispose
- @message_window.dispose
- @help_window.dispose
- @battle_sprite.dispose
- RPG::Sprite.clear
- end
-
- #--------------------------------------------------------------------------
- # ● 開始
- #--------------------------------------------------------------------------
- def setup_phase1
- # 回合数计数
- $game_temp.battle_turn += 1
- # 转移到回合 1
- @phase = 1
- # 清除全体同伴的行动
- $game_party.clear_actions
- # 设置战斗事件
- setup_battle_event
- @cp_thread.stop = false
- ($game_party.actors + $game_troop.enemies).each do |b|
- # 死亡後CP歸〇
- if b.dead?
- b.cp = 0
- end
- end
- @status_window.refresh
- end
- def phase1
- # 胜利或者失败的情况下 : 过程结束
- return if judge
- # 否則
- # 開始更新 CP 計算
- @cp_thread.update
- # 移動 CP 條
- @status_window.refresh_cp
- # 畫面刷新
- Graphics.frame_reset
- # 尋找CP滿值的戰斗者
- for index in 0...$game_party.actors.size
- battler = $game_party.actors[index]
- # 當前者不是就繼續尋找
- next unless battler.cp >= 65535
- # 找到就停止 CP 計算
- @cp_thread.stop = true
- # 効果音の再生
- Audio.se_play(CP_SE) if CP_SE != ""
- @active_battler = battler
- @actor_index = index
- setup_phase2
- return
- end
-
- for index in 0...$game_troop.enemies.size
- battler = $game_troop.enemies[index]
- next unless battler.cp >= 65535
- @cp_thread.stop = true
- @active_battler = battler
- @active_battler.make_action
- setup_phase3
- return
- end
- end
- def setup_phase2
- if @active_battler.inputable?
- @phase = 2
- @active_battler.blink = true
- #......................................................................
- Audio.se_play("Audio/SE/005-System05")#, se.volume, se.pitch)
- #......................................................................
- # 设置角色的命令窗口
- @actor_command.show(@actor_index)
- else
- setup_phase3
- end
- end
- def phase2
- # 移動 CP 條
- @status_window.refresh_cp
- # 畫面刷新
- Graphics.frame_reset
- if @actor_command.update == false
- @active_battler.blink = false
- setup_phase3
- end
- end
- def setup_phase3
- @phase = 3
-
- # 搜索全页的战斗事件
- for index in 0...$data_troops[@troop_id].pages.size
- # 获取事件页
- page = $data_troops[@troop_id].pages[index]
- # 本页的范围是 [回合] 的情况下
- if page.span == 1
- # 设置已经执行标志
- $game_temp.battle_event_flags[index] = false
- end
- end
- # 初始化动画 ID 和公共事件 ID
- @animation1_id = 0
- @animation2_id = 0
- @common_event_id = 0
-
- # 如果已经在战斗之外的情况下
- if @active_battler.index == nil
- return
- end
- #自动状态
- auto_effect
- # 自然解除状态
- @active_battler.remove_states_auto
- # 刷新状态窗口
- @status_window.refresh
- if @phase4_step != 2
- # 刷新
- @status_window.refresh
- # 軽量化
- Graphics.frame_reset
- end
- end
- def phase3
- # 清除對像戰鬥者
- @target_battlers = []
- # 行動種類分支
- case @active_battler.current_action.kind
- when 0 # 基本
- @active_battler.cp -= CPcost[:basic]
- case @active_battler.current_action.basic
- when 0 #攻撃的場合
- @active_battler.cp -= CPcost[:attack]
- make_attack_result
- when 1 #防禦的場合
- @active_battler.cp -= CPcost[:guard]
- make_guard_result
- when 2 #逃跑的場合
- @active_battler.cp -= CPcost[:escape]
- make_escape_result
- when 3 #甚麼也不做的場合
- @active_battler.cp -= CPcost[:nothing]
- make_nothing_result
- end
- when 1 # 特技
- @target_back = Dxxxx[0][@active_battler.current_action.skill_id]
- @close_up = Bxxxx[0][@active_battler.current_action.skill_id]
- @close_up_2 = Fxxxx[@active_battler.current_action.skill_id]
- @active_battler.cp -= CPcost[:skill]
- make_skill_result
- when 2 # 物品
- @target_back = Dxxxx[1][@active_battler.current_action.item_id]
- @close_up = Bxxxx[1][@active_battler.current_action.item_id]
- @active_battler.cp -= CPcost[:item]
- make_item_result
- end
- setup_phase4
- end
- def setup_phase4
- (close_up(@close_up) ;@close_up = nil) if @close_up != nil
- (close_up_2(@close_up_2);@close_up_2 = nil) if @close_up_2 != nil
- #-----------------------
- # 原 update_phase4_step3
- #-----------------------
- # 行动方动画 (ID 为 0 的情况下是白色闪烁)
- if @animation1_id == 0
- @active_battler.white_flash = true
- else
- @active_battler.animation_id = @animation1_id
- @active_battler.animation_hit = true
- end
- @phase = 4
- @step = 4
- end
- def phase4
- case @step
- when 4;phase4_step4
- when 5;phase4_step5
- when 6;phase4_step6
- end
- end
- def phase4_step4
- #-----------------------
- # 战斗背景図替换 p.1
- #-----------------------
- background_setting(1)
- #-----------------------
- # 原 update_phase4_step4
- #-----------------------
- # 对像方动画
- for target in @target_battlers
- target.animation_id = @animation2_id
- target.animation_hit = (target.damage != "Miss")
- end
- # 限制动画长度、最低 8 帧
- @wait_count = 8
- @step = 5
- end
- def phase4_step5
- #-----------------------
- # 原 update_phase4_step5
- #-----------------------
- # 隐藏帮助窗口
- @help_window.visible = false
- # 刷新状态窗口
- @status_window.refresh
- for target in @target_battlers
- if target.damage != nil
- target.damage = nil
- end
- end
- @step = 6
- end
- def phase4_step6
- #-----------------------
- # 战斗背景図替换 p.2
- #-----------------------
- background_setting(2)
- #-----------------------
- # 原 update_phase4_step6
- #-----------------------
- # 清除强制行动对像的战斗者
- $game_temp.forcing_battler = nil
- # 公共事件 ID 有效的情况下
- if @common_event_id > 0
- # 设置事件
- common_event = $data_common_events[@common_event_id]
- $game_system.battle_interpreter.setup(common_event.list, 0)
- end
- setup_phase1
- end
- def setup_phase5
- # 转移到回合 5
- @phase = 5
- # 演奏战斗结束 ME
- $game_system.me_play($game_system.battle_end_me)
- # 还原为战斗开始前的 BGM
- $game_system.bgm_play($game_temp.map_bgm)
- # 初始化 EXP、金钱、宝物
- exp = 0
- gold = 0
- treasures = []
- # 循环
- for enemy in $game_troop.enemies
- # 敌人不是隐藏状态的情况下
- unless enemy.hidden
- # 获得 EXP、增加金钱
- exp += enemy.exp
- gold += enemy.gold
- # 出现宝物判定
- if rand(100) < enemy.treasure_prob
- if enemy.item_id > 0
- treasures.push($data_items[enemy.item_id])
- end
- if enemy.weapon_id > 0
- treasures.push($data_weapons[enemy.weapon_id])
- end
- if enemy.armor_id > 0
- treasures.push($data_armors[enemy.armor_id])
- end
- end
- end
- end
- # 限制宝物数为 6 个
- treasures = treasures[0..5]
- # 获得 EXP
- for i in 0...$game_party.actors.size
- actor = $game_party.actors[i]
- if actor.cant_get_exp? == false
- last_level = actor.level
- actor.exp += exp
- if actor.level > last_level
- @status_window.level_up(i)
- end
- end
- end
- # 获得金钱
- $game_party.gain_gold(gold)
- # 获得宝物
- for item in treasures
- case item
- when RPG::Item
- $game_party.gain_item(item.id, 1)
- when RPG::Weapon
- $game_party.gain_weapon(item.id, 1)
- when RPG::Armor
- $game_party.gain_armor(item.id, 1)
- end
- end
- # 生成战斗结果窗口
- @result_window = Window_BattleResult.new(exp, gold, treasures)
- # 设置等待计数
- @phase5_wait_count = 100
- end
- def phase5
- # 等待计数大于 0 的情况下
- if @phase5_wait_count > 0
- # 减少等待计数
- @phase5_wait_count -= 1
- # 等待计数为 0 的情况下
- if @phase5_wait_count == 0
- # 显示结果窗口
- @result_window.visible = true
- # 清除主回合标志
- $game_temp.battle_main_phase = false
- # 刷新状态窗口
- @status_window.refresh
- end
- return
- end
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- # 战斗结束
- battle_end(0)
- end
- end
-
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def update
- # 执行战斗事件中的情况下
- if $game_system.battle_interpreter.running?
- # 刷新解释器
- $game_system.battle_interpreter.update
- # 强制行动的战斗者不存在的情况下
- if $game_temp.forcing_battler == nil
- # 执行战斗事件结束的情况下
- unless $game_system.battle_interpreter.running?
- # 继续战斗的情况下、再执行战斗事件的设置
- unless judge
- setup_battle_event
- end
- end
- # 如果不是结束战斗回合的情况下
- if @phase != 5
- # 刷新状态窗口
- @status_window.refresh
- end
- end
- end
- # 系统 (计时器)、刷新画面
- $game_system.update
- $game_screen.update
- # 计时器为 0 的情况下
- if $game_system.timer_working and $game_system.timer == 0
- # 中断战斗
- $game_temp.battle_abort = true
- end
- @status_window.update
- @battle_sprite.update
- # 处理过渡中的情况下
- if $game_temp.transition_processing
- # 清除处理过渡中标志
- $game_temp.transition_processing = false
- # 执行过渡
- if $game_temp.transition_name == ""
- Graphics.transition(20)
- else
- Graphics.transition(40, "Graphics/Transitions/" +
- $game_temp.transition_name)
- end
- end
- return if need_to_stop
- case @phase
- when 1;phase1
- when 2;phase2
- when 3;phase3
- when 4;phase4
- when 5;phase5
- when 6
- when 7
- end
- end
- def need_to_stop
- # 显示信息窗口中的情况下
- if $game_temp.message_window_showing
- return true
- end
- # 显示效果中的情况下
- if @battle_sprite.effect?
- return true
- end
- # 游戏结束的情况下
- if $game_temp.gameover
- # 切换到游戏结束画面
- $scene = Scene_Gameover.new
- return true
- end
- # 返回标题画面的情况下
- if $game_temp.to_title
- # 切换到标题画面
- $scene = Scene_Title.new
- return true
- end
- # 中断战斗的情况下
- if $game_temp.battle_abort
- # 还原为战斗前的 BGM
- $game_system.bgm_play($game_temp.map_bgm)
- # 战斗结束
- battle_end(1)
- return true
- end
- # 等待中的情况下
- if @wait_count > 0
- # 减少等待计数
- @wait_count -= 1
- return true
- end
- # 强制行动的角色存在、
- # 并且战斗事件正在执行的情况下
- if $game_temp.forcing_battler == nil and
- $game_system.battle_interpreter.running?
- return true
- end
- return false
- end
- #--------------------------------------------------------------------------
- # ● 设置战斗事件
- #--------------------------------------------------------------------------
- def setup_battle_event
- # 正在执行战斗事件的情况下
- return if $game_system.battle_interpreter.running?
- # 搜索全部页的战斗事件
- for index in 0...$data_troops[@troop_id].pages.size
- # 获取事件页
- page = $data_troops[@troop_id].pages[index]
- # 事件条件可以参考 c
- c = page.condition
- # 没有指定任何条件的情况下转到下一页
- next unless c.turn_valid or c.enemy_valid or
- c.actor_valid or c.switch_valid
- # 执行完毕的情况下转到下一页
- next if $game_temp.battle_event_flags[index]
- # 确认回合条件
- if c.turn_valid
- n = $game_temp.battle_turn
- a = c.turn_a
- b = c.turn_b
- next if (b == 0 and n != a)
- next if (b > 0 and (n < 1 or n < a or n % b != a % b))
- end
- # 确认敌人条件
- if c.enemy_valid
- enemy = $game_troop.enemies[c.enemy_index]
- next if enemy == nil
- next if enemy.hp * 100.0 / enemy.maxhp > c.enemy_hp
- end
- # 确认角色条件
- if c.actor_valid
- actor = $game_actors[c.actor_id]
- next if actor == nil
- next if (actor.hp * 100.0 / actor.maxhp > c.actor_hp)
- end
- # 确认开关条件
- if c.switch_valid
- next if $game_switches[c.switch_id] == false
- end
- # 设置事件
- $game_system.battle_interpreter.setup(page.list, 0)
- # 本页的范围是 [战斗] 或 [回合] 的情况下
- if page.span <= 1
- # 设置执行结束标志
- $game_temp.battle_event_flags[index] = true
- end
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● 胜负判定
- #--------------------------------------------------------------------------
- def judge
- # 全灭判定是真、并且同伴人数为 0 的情况下
- if $game_party.all_dead? or $game_party.actors.size == 0
- # 允许失败的情况下
- if $game_temp.battle_can_lose
- # 还原为战斗开始前的 BGM
- $game_system.bgm_play($game_temp.map_bgm)
- # 战斗结束
- battle_end(2)
- else
- # 设置游戏结束标志
- $game_temp.gameover = true
- end
- # 返回 true
- return true
- end
- # 如果存在任意 1 个敌人就返回 false
- for enemy in $game_troop.enemies
- if enemy.exist?
- return false
- end
- end
- # 开始结束战斗回合 (胜利)
- setup_phase5
- # 返回 true
- return true
- end
- #--------------------------------------------------------------------------
- # ● 战斗结束
- # result : 結果 (0:胜利 1:失败 2:逃跑)
- #--------------------------------------------------------------------------
- def battle_end(result)
- # CP加算終止
- @cp_thread.stop
- # 清除战斗中标志
- $game_temp.in_battle = false
- # 清除全体同伴的行动
- $game_party.clear_actions
- # 解除战斗用状态
- $game_party.actors.each do |actor| actor.remove_states_battle end
- # 清除敌人
- $game_troop.enemies.clear
- # 调用战斗返回调用
- if $game_temp.battle_proc != nil
- $game_temp.battle_proc.call(result)
- $game_temp.battle_proc = nil
- end
- # 切换到地图画面
- $scene = Scene_Map.new
- end
- #--------------------------------------------------------------------------
- # ● make_result
- #--------------------------------------------------------------------------
- def make_attack_result
- # 设置攻击 ID
- @animation1_id = @active_battler.animation1_id
- @animation2_id = @active_battler.animation2_id
- # 行动方的战斗者是敌人的情况下
- case @active_battler
- when (Game_Enemy)
- case @active_battler.restriction
- when 3
- target = $game_troop.random_target_enemy
- when 2
- target = $game_party.random_target_actor
- else
- index = @active_battler.current_action.target_index
- target = $game_party.smooth_target_actor(index)
- end
- # 行动方的战斗者是角色的情况下
- when (Game_Actor)
- case @active_battler.restriction
- when 3
- target = $game_party.random_target_actor
- when 2
- target = $game_troop.random_target_enemy
- else
- index = @active_battler.current_action.target_index
- target = $game_troop.smooth_target_enemy(index)
- end
- end
- @target_battlers = [target]
- # 应用通常攻击效果
- for target in @target_battlers
- target.attack_effect(@active_battler)
- end
- end
- def make_guard_result
- @help_window.set_text($data_system.words.guard, 1)
- end
- def make_escape_result
- if @active_battler.is_a?(Game_Enemy)
- # 帮助窗口显示"逃跑"
- @help_window.set_text("逃跑", 1)
- # 逃跑
- @active_battler.escape
- return
- end
- end
- def make_nothing_result
- # 清除强制行动对像的战斗者
- $game_temp.forcing_battler = nil
- # 移至步骤 1
- setup_phase1
- end
- #--------------------------------------------------------------------------
- # ● 生成特技行动结果
- #--------------------------------------------------------------------------
- def make_skill_result
- # 获取特技
- @skill = $data_skills[@active_battler.current_action.skill_id]
- # 如果不是强制行动
- unless @active_battler.current_action.forcing
- # 因为 SP 耗尽而无法使用的情况下
- unless @active_battler.skill_can_use?(@skill.id)
- # 清除强制行动对像的战斗者
- $game_temp.forcing_battler = nil
- # 移至步骤 1
- setup_phase1
- return
- end
- end
- # 消耗 SP
- @active_battler.sp -= @skill.sp_cost
- # 刷新状态窗口
- @status_window.refresh
- # 在帮助窗口显示特技名
- @help_window.set_text(@skill.name, 1)
- # 设置动画 ID
- @animation1_id = @skill.animation1_id
- @animation2_id = @skill.animation2_id
- # 设置公共事件 ID
- @common_event_id = @skill.common_event_id
- # 设置对像侧战斗者
- set_target_battlers(@skill.scope)
- # 应用特技效果
- for target in @target_battlers
- target.skill_effect(@active_battler, @skill)
- end
- end
- #--------------------------------------------------------------------------
- # ● 生成物品行动结果
- #--------------------------------------------------------------------------
- def make_item_result
- # 获取物品
- @item = $data_items[@active_battler.current_action.item_id]
- # 因为物品耗尽而无法使用的情况下
- unless $game_party.item_can_use?(@item.id)
- # 移至步骤 1
- setup_phase1
- return
- end
- # 消耗品的情况下
- if @item.consumable
- # 使用的物品减 1
- $game_party.lose_item(@item.id, 1)
- end
- # 在帮助窗口显示物品名
- @help_window.set_text(@item.name, 1)
- # 设置动画 ID
- @animation1_id = @item.animation1_id
- @animation2_id = @item.animation2_id
- # 设置公共事件 ID
- @common_event_id = @item.common_event_id
- # 确定对像
- index = @active_battler.current_action.target_index
- target = $game_party.smooth_target_actor(index)
- # 设置对像侧战斗者
- set_target_battlers(@item.scope)
- # 应用物品效果
- for target in @target_battlers
- target.item_effect(@item)
- end
- end
- #--------------------------------------------------------------------------
- # ● 设置物品或特技对像方的战斗者
- # scope : 特技或者是物品的范围
- #--------------------------------------------------------------------------
- def set_target_battlers(scope)
- # 行动方的战斗者是敌人的情况下
- case @active_battler
- when (Game_Enemy)
- # 效果范围分支
- case scope
- when 1 # 敌单体
- index = @active_battler.current_action.target_index
- @target_battlers.push($game_party.smooth_target_actor(index))
- when 3 # 我方单体
- index = @active_battler.current_action.target_index
- @target_battlers.push($game_troop.smooth_target_enemy(index))
- when 2 # 敌全体
- $game_party.actors.each{|actor|
- if actor.exist?
- @target_battlers.push(actor)
- end
- }
- when 4 # 我方全体
- $game_troop.enemies.each{|enemy|
- if enemy.exist?
- @target_battlers.push(enemy)
- end
- }
- when 5 # 我方单体 (HP 0)
- index = @active_battler.current_action.target_index
- enemy = $game_troop.enemies[index]
- if enemy != nil and enemy.hp0?
- @target_battlers.push(enemy)
- end
- when 6 # 我方全体 (HP 0)
- for enemy in $game_troop.enemies
- if enemy != nil and enemy.hp0?
- @target_battlers.push(enemy)
- end
- end
- when 7 # 使用者
- @target_battlers.push(@active_battler)
- end
- # 行动方的战斗者是角色的情况下
- when (Game_Actor)
- # 效果范围分支
- case scope
- when 1 # 敌单体
- index = @active_battler.current_action.target_index
- @target_battlers.push($game_troop.smooth_target_enemy(index))
- when 3 # 我方单体
- index = @active_battler.current_action.target_index
- @target_battlers.push($game_party.smooth_target_actor(index))
- when 2 # 敌全体
- $game_troop.enemies.each{|enemy|
- if enemy.exist?
- @target_battlers.push(enemy)
- end
- }
- when 4 # 我方全体
- $game_party.actors.each{|actor|
- if actor.exist?
- @target_battlers.push(actor)
- end
- }
- when 5 # 我方单体 (HP 0)
- index = @active_battler.current_action.target_index
- actor = $game_party.actors[index]
- if actor != nil and actor.hp0?
- @target_battlers.push(actor)
- end
- when 6 # 我方全体 (HP 0)
- for actor in $game_party.actors
- if actor != nil and actor.hp0?
- @target_battlers.push(actor)
- end
- end
- when 7 # 使用者
- @target_battlers.push(@active_battler)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 背景轉換預留接口 p.1 & 2
- #--------------------------------------------------------------------------
- def background_setting(part)
- end
- end
- class Scene_Battle_CP
- attr_accessor :stop #CP加算停止開關
-
- #----------------------------------------------------------------------------
- # ○ 初期化
- #----------------------------------------------------------------------------
- def initialize
- @stop = false
- @total_agi = 0
- count_battlers = ($game_troop.enemies + $game_party.actors)
- count_battlers.each do |b| @total_agi += b.agi end
- count_battlers.each do |b|
- #CP值初期化
- b.cp =65535 * Initial_Percent * (rand(15) + 85) * 4 * (b.agi/1.5) / @total_agi / 10000
- if b.cp < 0 then b.cp = 0 end
- if b.cp > 65535 then b.cp = 65535 end
- end
- end
- #----------------------------------------------------------------------------
- # ○ 加算
- #----------------------------------------------------------------------------
- def update
- return if @stop
- ($game_troop.enemies + $game_party.actors).each do |b|
- #已亡者無視
- next if b.dead?
- b.cp +=Speed * 4096 * b.agi/1.5 / @total_agi
- if b.cp < 0 then b.cp = 0 end
- if b.cp > 65535 then b.cp = 65535 end
- end
- end
- end
- #==============================================================================
- # ■ Game_Battler
- #==============================================================================
- class Game_Battler
- attr_accessor :now_guarding # 現在防御中判定
- attr_accessor :cp # 現在CP
- #--------------------------------------------------------------------------
- # ○ CP 変更
- #--------------------------------------------------------------------------
- def cp=(cp)
- if cp < 0 then cp = 0 end
- if cp > 65535 then cp = 65535 end
- @cp = cp
- end
- #--------------------------------------------------------------------------
- # ● 防御中判定 [ 再定義 ]
- #--------------------------------------------------------------------------
- def guarding?
- return @now_guarding
- end
- #--------------------------------------------------------------------------
- # ● 入力可能判定
- #--------------------------------------------------------------------------
- alias CPS_inputable? inputable?
- def inputable?
- bool = CPS_inputable?
- return (bool and (@cp >= 65535))
- end
- end
- #==============================================================================
- # ■ Game_Actor
- #==============================================================================
- class Game_Actor < Game_Battler
- #--------------------------------------------------------------------------
- # ● 初期化
- #--------------------------------------------------------------------------
- alias CPS_setup setup
- def setup(actor_id)
- CPS_setup(actor_id)
- @cp = 0
- @now_guarding = false
- end
- end
- #==============================================================================
- # ■ Game_Enemy
- #==============================================================================
- class Game_Enemy < Game_Battler
- #--------------------------------------------------------------------------
- # ● 初期化
- #--------------------------------------------------------------------------
- alias CPS_initialize initialize
- def initialize(troop_id, member_index)
- CPS_initialize(troop_id, member_index)
- @cp = 0
- @now_guarding = false
- end
- end
- end
复制代码 |
|