赞 | 87 |
VIP | 0 |
好人卡 | 1 |
积分 | 41 |
经验 | 18135 |
最后登录 | 2019-4-2 |
在线时间 | 1690 小时 |
Lv3.寻梦者 灌水局大小姐
- 梦石
- 0
- 星屑
- 4135
- 在线时间
- 1690 小时
- 注册时间
- 2012-3-10
- 帖子
- 2469
|
战斗中加入队友提示 第164行出错!
“if (@cp_battler[battler].disposed? or @cp_battler[battler].opacity == 0) and battler.dead?”
这是怎么回事?求助- #=============================================================================
- #★Zhong RMVX 半即时战斗系统默认1.01版★
- #-----------------------------------------------------------------------------
- #★Scene_CP核心部分参考自 : 神思 《战斗真位移》战斗系统
- #★作者: Zhong_zw
- #★联系方式: 66rpg.com论坛短信 或 [email protected]
- #★游戏中如若引用本脚本,请保留以上信息,并作相关说明.
- #☆如若转载本脚本请联系本人☆
- #=============================================================================
- #=============================================================================
- #★附赠功能:
- #角色cp素材与原版相同,亦可省略,默认自动应用角色相应行走图
- #=============================================================================
- #★1.01版更新内容
- #1、血条不刷新问题
- #2、敌人队伍事件不判断问题
- #★1.02版更新内容
- #1、连续伤害出错问题
- #2、cp条超出问题
- #=============================================================================
- #================================================
- #★战斗者类
- #================================================
- class Game_Battler
- attr_accessor :cp
- attr_accessor :cp_total
- attr_accessor :cp_turn #角色能不行动时,计算角色实际cp爆满次数,用以代替回合,计算状态解除时机
-
- attr_accessor :slip_damage
- attr_accessor :auto_damage
-
-
- alias oldinitialize initialize
- def initialize
- @cp = 0
- @cp_total = false
- @cp_turn = 0
- @act_status = 0
- @slip_damage = 0
- @auto_damage = 0
-
- oldinitialize
- end
- def maxcp
- return 100
- end
- #--------------------------------------------------------------------------
- # ● 应用连续伤害效果
- #--------------------------------------------------------------------------
- def slip_damage_effect
- if slip_damage? and @hp > 0
- @hp_damage = apply_variance(maxhp / 10, 10)
- @hp_damage = @hp - 1 if @hp_damage >= @hp
- @slip_damage = @hp_damage
- self.hp -= @hp_damage
- end
- end
- end #class
- #============================================================================
- #===============================================
- #★角色队伍类
- #===============================================
- class Game_Party < Game_Unit
- attr_accessor :actor_battler
- alias oldinitialize initialize
- def initialize
- oldinitialize
- @actor_battler = []
- end
- end #class
- #================================================
- #★敌人队伍类
- #================================================
- class Game_Troop < Game_Unit
- attr_accessor :enemy_battler
- alias oldinitialize initialize
- def initialize
- oldinitialize
- @enemy_battler = []
- end
-
- end#class
- #================================================
- #★cp条处理类
- #================================================
-
- class Scene_CP
- attr_accessor :stop
- attr_accessor :in_battler
- attr_accessor :cp_battler
- BATTLE_SPEED = 0.8
- def initialize
- @stop = false
- @all_agi = 0
- @v = Viewport.new(0, 0, 544, 90)
- @count = 0
- @cpline = Sprite.new(@v)
- @cpline.bitmap = Bitmap.new(544,416)
- bitmap = Bitmap.new("Graphics/system/cp条")
- @cpline.bitmap.blt(105,8,bitmap,bitmap.rect)
- @cp_battler = {}
- for battler in $game_party.members + $game_troop.members
- @all_agi += battler.agi
- @cp_battler[battler] = Sprite_cpbattler.new
- if battler.is_a?(Game_Actor)
- name = battler.id.to_s + "_cp"
- if FileTest.exist?("Graphics/system/#{name}.jpg") or FileTest.exist?("Graphics/system/#{name}.png") or FileTest.exist?("Graphics/system/#{name}.bmp")
- bitmap = Bitmap.new("Graphics/system/#{name}")
- rect = bitmap.rect
- @cp_battler[battler].bitmap = bitmap
- else
-
-
- bitmap = Bitmap.new("Graphics/Characters/#{battler.character_name}")
- sign = battler.character_name[/^[\!\$]./]
- if sign != nil and sign.include?(')
- cw = bitmap.width / 3
- ch = bitmap.height / 4
-
- else
- cw = bitmap.width / 12
- ch = bitmap.height / 8
-
- end
- n = battler.character_index
- rect = Rect.new((n%4*3+1)*cw, (n/4*4+2)*ch, cw, ch)
-
- @cp_battler[battler].bitmap = Bitmap.new(cw,ch)
- end
-
-
- @cp_battler[battler].bitmap.blt(0, 0,bitmap,rect)
-
- else
- name = battler.original_name + "_敌人cp"
- if FileTest.exist?("Graphics/system/#{name}.jpg") or FileTest.exist?("Graphics/system/#{name}.png") or FileTest.exist?("Graphics/system/#{name}.bmp")
- @cp_battler[battler].bitmap = Bitmap.new("Graphics/system/#{name}")
- else
- @cp_battler[battler].bitmap = Bitmap.new("Graphics/system/敌人cp")
- end
- @cp_battler[battler].bitmap.blt(80,60, @cp_battler[battler].bitmap, @cp_battler[battler].bitmap.rect)
- end
- @cp_battler[battler].z = 101
- @cp_battler[battler].visible = false
-
- end
- end
-
- #===========================================
-
-
-
-
- #===========================================
-
-
- def update
-
- return if @stop
-
-
- for battler in $game_party.members + $game_troop.members
- if (@cp_battler[battler].disposed? or @cp_battler[battler].opacity == 0) and battler.dead?
- @cp_battler.delete(@cp_battler[battler])
- next
- end
- if battler.dead?
- if @cp_battler.include?(battler)
- @cp_battler[battler].collapse = true
-
- end
- battler.cp = 0
- next
- end
- battler.cp = [[battler.cp + BATTLE_SPEED*10*battler.agi / @all_agi,0].max,battler.maxcp].min if battler.movable?
- battler.cp_turn = [[battler.cp_turn+BATTLE_SPEED*10*battler.agi / @all_agi, 0].max,battler.maxcp].min
- if battler.cp == battler.maxcp
- if battler.is_a?(Game_Actor)
- name = battler.id.to_s + "_a_cp"
- if FileTest.exist?("Graphics/system/#{name}.jpg") or FileTest.exist?("Graphics/system/#{name}.png") or FileTest.exist?("Graphics/system/#{name}.bmp")
- bitmap = Bitmap.new("Graphics/system/#{name}")
- rect = bitmap.rect
- @cp_battler[battler].bitmap = bitmap
- else
-
- bitmap = Bitmap.new("Graphics/Characters/#{battler.character_name}")
- sign = battler.character_name[/^[\!\$]./]
- if sign != nil and sign.include?(')
- cw = bitmap.width / 3
- ch = bitmap.height / 4
- else
- cw = bitmap.width / 12
- ch = bitmap.height / 8
- end
- n = battler.character_index
-
- rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
-
- @cp_battler[battler].bitmap = Bitmap.new(cw,ch)
-
- end
-
- @cp_battler[battler].bitmap.blt(0,0,bitmap,rect)
-
- else
- name = battler.original_name + "_a_cp"
- if FileTest.exist?("Graphics/system/#{name}.jpg") or FileTest.exist?("Graphics/system/#{name}.png") or FileTest.exist?("Graphics/system/#{name}.bmp")
- @cp_battler[battler].bitmap = Bitmap.new("Graphics/system/#{name}")
- else
- @cp_battler[battler].bitmap = Bitmap.new("Graphics/system/a_敌人cp")
- end
- @cp_battler[battler].bitmap.blt(80,60, @cp_battler[battler].bitmap, @cp_battler[battler].bitmap.rect)
- end
- @cp_battler[battler].z = 101
- battler.cp_total = true
- elsif battler.cp_total == true
- if battler.is_a?(Game_Actor)
- name = battler.id.to_s + "_cp"
- if FileTest.exist?("Graphics/system/#{name}.jpg") or FileTest.exist?("Graphics/system/#{name}.png") or FileTest.exist?("Graphics/system/#{name}.bmp")
- bitmap = Bitmap.new("Graphics/system/#{name}")
- rect = bitmap.rect
- @cp_battler[battler].bitmap = bitmap
- else
-
- bitmap = Bitmap.new("Graphics/Characters/#{battler.character_name}")
- sign = battler.character_name[/^[\!\$]./]
- if sign != nil and sign.include?(')
- cw = bitmap.width / 3
- ch = bitmap.height / 4
- else
- cw = bitmap.width / 12
- ch = bitmap.height / 8
- end
- n = battler.character_index
- rect = Rect.new((n%4*3+1)*cw, (n/4*4+2)*ch, cw, ch)
-
- @cp_battler[battler].bitmap = Bitmap.new(cw,ch)
-
-
- end
-
- @cp_battler[battler].bitmap.blt(0,0,bitmap,rect)
-
- else
- name = battler.original_name + "_敌人cp"
- if FileTest.exist?("Graphics/system/#{name}.jpg") or FileTest.exist?("Graphics/system/#{name}.png") or FileTest.exist?("Graphics/system/#{name}.bmp")
- @cp_battler[battler].bitmap = Bitmap.new("Graphics/system/#{name}")
-
- else
- @cp_battler[battler].bitmap = Bitmap.new("Graphics/system/敌人cp")
-
- end
-
- @cp_battler[battler].bitmap.blt(80,60, @cp_battler[battler].bitmap, @cp_battler[battler].bitmap.rect)
- end
- battler.cp_total = false
- @cp_battler[battler].z = 105
-
- end
-
- @cp_battler[battler].visible = true if @cp_battler[battler].visible == false
- @cp_battler[battler].opacity = 255
- @cp_battler[battler].y = 30
- @cp_battler[battler].x = 95+300*battler.cp/battler.maxcp
- if battler.cp_turn == battler.maxcp
- #=================================
- last_st = battler.states
- #=================================
- battler.remove_states_auto unless battler.movable?
- battler.slip_damage_effect
- battler.do_auto_recovery if battler.is_a?(Game_Actor)
- #====================================
- if battler.states != last_st
- $scene.display_state_changes(battler)
-
- end
- #====================================
-
- battler.cp_turn = 0
- end
- if battler.cp == battler.maxcp
- if battler.is_a?(Game_Actor)
- $game_party.actor_battler.push(battler)
- else
- battler.make_action
- $game_troop.enemy_battler.push(battler)
- battler.make_action
- end
- else
- next
- end
-
-
-
- end
- end
-
- def dispose
- for j in 0..25
- @cpline.opacity -= 10
- for i in @cp_battler.values
- unless i.disposed?
- i.opacity -= 10
- end
- end
- Graphics.update
- end
- @v.dispose
- @cpline.dispose
- for i in @cp_battler.values
- i.dispose
- end
- end
- end
-
-
-
-
-
-
-
-
- class Sprite_cpbattler < Sprite
- attr_accessor :collapse
-
- def initialize (viewport = nil)
- super (viewport)
-
- @effect_duration = 0
- @collapse = false
- end
- def update
- super
-
- if self.collapse == true and self.opacity != 0
-
- @effect_type = 5
- @effect_duration = 48
- self.color.set(255, 128, 128, 128)
- for i in 0..48
- self.opacity = 256 - (48 - @effect_duration) * 6
- if self.opacity == 0
-
- break
- end
- Graphics.update
- @effect_duration -= 1
- end
-
- self.collapse = false
- self.color.set(255,255,255,5)
- end
-
- end
-
- def dispose
- if self.bitmap != nil
- self.bitmap.dispose
- end
-
- super
- end
-
- end
- #==========================================================================
- #
- #==========================================================================
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # ● 开始处理
- #--------------------------------------------------------------------------
- def start
- super
- $game_temp.in_battle = true
- @spriteset = Spriteset_Battle.new
- @message_window = Window_BattleMessage.new
- @action_battlers = []
- @cp_battle = Scene_CP.new
- @cp_battle.stop = false
- create_info_viewport
- end
- #--------------------------------------------------------------------------
- # ● 更新画面
- #--------------------------------------------------------------------------
- def update
- super
- update_basic(true)
- update_info_viewport # 更新显示信息的视区
- if $game_message.visible
- @info_viewport.visible = false
- @message_window.visible = true
- end
- unless $game_message.visible # 在显示消息以外的情况
- return if judge_win_loss # 判断胜败
- update_scene_change
- if @target_enemy_window != nil
- update_target_enemy_selection # 选择敌方对象
- elsif @target_actor_window != nil
- update_target_actor_selection # 选择对象角色
- elsif @skill_window != nil
- update_skill_selection # 选择特技
- elsif @item_window != nil
- update_item_selection # 选择物品
- elsif @party_command_window.active
- update_party_command_selection # 选择同伴指令
- elsif @actor_command_window.active
- update_actor_command_selection # 选择角色指令
- #=================================
- elsif @cp_battle.stop == false
- active_battler_update
- #=================================
-
- else
- process_battle_event # 战斗处理
- process_action # 战斗行动
- process_battle_event # 处理战斗事件
- end
- end
- end
-
- #=============================================
- #★角色回合的处理函数
- #=============================================
-
-
- def next_actor
-
-
- @info_viewport.visible = true
-
- @message_window.visible = true
- @status_window.update
-
- loop do
-
- if @actor_index == @actor_battler.size - 1
-
- start_main
- return
-
- end
-
- @actor_index += 1
-
- index = 0
- for battler in $game_party.members
- if battler == @actor_battler[@actor_index]
- break
- else
- index += 1
- end
- end
- @status_window.index = index
-
-
- @active_battler = @actor_battler[@actor_index]
-
-
-
-
- if @active_battler.auto_battle
- @active_battler.make_action
- next
- end
- break if @active_battler.inputable?
- end
-
- start_party_command
- end
-
- #====================================================
- #★开始角色战斗与逃跑选择
- #====================================================
- def start_party_command
- @status_window.refresh
- @party_command_window.active = true
- @party_command_window.index = 0
- @actor_command_window.active = false
- @message_window.visible = false
-
-
- end
- #=====================================================
- #--------------------------------------------------------------------------
- # ● 更新同伴战斗指令
- #--------------------------------------------------------------------------
- def update_party_command_selection
- if Input.trigger?(Input::C)
- case @party_command_window.index
- when 0 # 战斗
- Sound.play_decision
-
- start_actor_command_selection
- when 1 # 逃跑
- if $game_troop.can_escape == false
- Sound.play_buzzer
- return
- end
- Sound.play_decision
- process_escape
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 开始选择角色指令
- #--------------------------------------------------------------------------
- def start_actor_command_selection
- @party_command_window.active = false
- @actor_command_window.setup(@active_battler)
- @actor_command_window.active = true
- @actor_command_window.index = 0
-
- end
- #==============================================
- #★指令窗口刷新
- #==============================================
- def update_actor_command_selection
-
- if Input.trigger?(Input::B)
- Sound.play_cancel
- start_party_command
- elsif Input.trigger?(Input::C)
- case @actor_command_window.index
- when 0 # 攻击
- Sound.play_decision
- @active_battler.action.set_attack
- start_target_enemy_selection
- when 1 # 特技
- Sound.play_decision
- start_skill_selection
- when 2 # 防御
- Sound.play_decision
- @active_battler.action.set_guard
-
- @active_battler.cp = 0
- next_actor
- when 3 # 物品
- Sound.play_decision
- start_item_selection
-
- when 4 #逃跑
- if $game_troop.can_escape == false
- Sound.play_buzzer
- return
- end
- Sound.play_decision
- process_escape
- end
- end
- end
- #========================================================
- #--------------------------------------------------------------------------
- # ● 更新选择对象敌方角色
- #--------------------------------------------------------------------------
- def update_target_enemy_selection
- @target_enemy_window.update
- if Input.trigger?(Input::B)
- Sound.play_cancel
- end_target_enemy_selection
- elsif Input.trigger?(Input::C)
- Sound.play_decision
- @active_battler.action.target_index = @target_enemy_window.enemy.index
- end_target_enemy_selection
- end_skill_selection
- end_item_selection
-
- #============================
- @active_battler.cp = 0
- #============================
- next_actor
- end
- end
- #--------------------------------------------------------------------------
- # ● 更新对象角色选择
- #--------------------------------------------------------------------------
- def update_target_actor_selection
- @target_actor_window.update
- if Input.trigger?(Input::B)
- Sound.play_cancel
- end_target_actor_selection
- elsif Input.trigger?(Input::C)
- Sound.play_decision
- @active_battler.action.target_index = @target_actor_window.index
- end_target_actor_selection
- end_skill_selection
- end_item_selection
-
- #=========================
- @active_battler.cp = 0
- #=========================
- next_actor
- end
- end
- #--------------------------------------------------------------------------
- # ● 确定特技
- #--------------------------------------------------------------------------
- def determine_skill
- @active_battler.action.set_skill(@skill.id)
- @skill_window.active = false
- if @skill.need_selection?
- if @skill.for_opponent?
- start_target_enemy_selection
- else
- start_target_actor_selection
- end
- else
- end_skill_selection
-
- #=========================
- @active_battler.cp = 0
- #=========================
- @party_command_window.active = false
- next_actor
- end
- end
- #=========================================
- #★物品使用决定 处理
- #=========================================
-
-
- def determine_item
- @active_battler.action.set_item(@item.id)
- @item_window.active = false
- if @item.need_selection?
- if @item.for_opponent?
- start_target_enemy_selection
- else
- start_target_actor_selection
- end
- else
- end_item_selection
-
- @active_battler.cp = 0
- next_actor
- end
- end
- #--------------------------------------------------------------------------
- # ● 开始处理战斗
- #--------------------------------------------------------------------------
- def process_battle_start
- @message_window.clear
- wait(10)
- for name in $game_troop.enemy_names
- text = sprintf(Vocab::Emerge, name)
- $game_message.texts.push(text)
- end
- if $game_troop.preemptive
- text = sprintf(Vocab::Preemptive, $game_party.name)
- $game_message.texts.push(text)
- for battler in $game_party.members
- battler.cp = battler.maxcp
- end
- $game_troop.preemptive = false
- elsif $game_troop.surprise
- text = sprintf(Vocab::Surprise, $game_party.name)
- $game_message.texts.push(text)
- for battler in $game_troop.members
- battler.cp = battler.maxcp
- end
- $game_troop.surprise = false
- end
- wait_for_message
- @message_window.clear
- @message_window.visible = false
- make_escape_ratio
- process_battle_event
-
- #=====================
-
- @status_window.index = @actor_index = -1
- @cp_battle.stop = false
- #=====================
- end
- #--------------------------------------------------------------------------
- # ● 处理逃跑
- #--------------------------------------------------------------------------
- def process_escape
- @info_viewport.visible = false
- @party_command_window.active = false
- @message_window.visible = true
- text = sprintf(Vocab::EscapeStart, $game_party.name)
- $game_message.texts.push(text)
- if $game_troop.preemptive
- success = true
- else
- success = (rand(100) < @escape_ratio)
- end
- Sound.play_escape
- if success
- #=============================
- @cp_battle.dispose
- #=============================
- for battler in $game_party.members
- battler.cp = 0
- end
- wait_for_message
- battle_end(1)
- else
- @escape_ratio += 10
- @active_battler.cp = 0
- $game_message.texts.push('\.' + Vocab::EscapeFailure)
- wait_for_message
- @active_battler.action.clear
- @message_window.visible = false
- next_actor
- end
- end
- #--------------------------------------------------------------------------
- # ● 处理胜利
- #--------------------------------------------------------------------------
- def process_victory
- @info_viewport.visible = false
- @message_window.visible = true
- RPG::BGM.stop
- $game_system.battle_end_me.play
- for battler in $game_troop.members
- if battler.dead?
- if @cp_battle.cp_battler.include?(battler)
- @cp_battle.cp_battler[battler].collapse = true
-
- next
- end
- end
- end
- @cp_battle.cp_battler.each{|key,value|
- if value.disposed?
- @cp_battler.delete(key)
- next
- end
- value.update}
- #=============================
- @cp_battle.dispose
- #=============================
- for battler in $game_party.members
- battler.cp = 0
- end
-
-
- unless $BTEST
- $game_temp.map_bgm.play
- $game_temp.map_bgs.play
- end
- display_exp_and_gold
- display_drop_items
- display_level_up
- battle_end(0)
- end
- #--------------------------------------------------------------------------
- # ● 失败处理
- #--------------------------------------------------------------------------
- def process_defeat
- @info_viewport.visible = false
- @message_window.visible = true
- @cp_battle.dispose
- for battler in $game_party.members + $game_troop.members
- battler.cp = 0
- end
- text = sprintf(Vocab::Defeat, $game_party.name)
- $game_message.texts.push(text)
- wait_for_message
- battle_end(2)
- end
- #=============================================================================
- #★CP战斗的主要刷新★
- #=============================================================================
-
- def active_battler_update
-
- #===================================
- @actor_battler = []
- @enemy_battler = []
- $game_party.actor_battler = []
- $game_troop.enemy_battler = []
- #===================================
- @cp_battle.update
- @actor_battler = $game_party.actor_battler
- @enemy_battler = $game_troop.enemy_battler
-
- if @actor_battler.size != 0
- @cp_battle.stop = true
- next_actor
- Audio.se_play("Audio/SE/Jump2",100,100)
- elsif @enemy_battler.size != 0
-
- #================
- @cp_battle.stop = true
- start_main
- #================
-
-
-
- end
-
- end
- #--------------------------------------------------------------------------
- # ● 开始执行战斗处理
- #--------------------------------------------------------------------------
- def start_main
-
- @info_viewport.visible = false
- @info_viewport.ox = 0
- @message_window.visible = true
-
- @actor_command_window.active = false
- @status_window.index = @actor_index = -1
- @active_battler = nil
- @message_window.clear
- $game_troop.make_actions
- make_action_orders
- wait(20)
- #=============================
-
- while @action_battlers.size != 0 and judge_win_loss == false
-
- process_action
- process_battle_event
- end
- @cp_battle.stop = false
- #=============================
-
-
- end
- #=====================================
- #★行动顺序生成
- #=====================================
-
-
- def make_action_orders
- @action_battlers = []
-
- unless $game_troop.surprise
- @action_battlers += @actor_battler if @actor_battler.size != 0
- end
-
-
- unless $game_troop.preemptive
- @action_battlers += @enemy_battler if @enemy_battler.size != 0
- end
- for battler in @action_battlers
- battler.action.make_speed
- end
- @action_battlers.sort! do |a,b|
- b.action.speed - a.action.speed
- end
- end
- #--------------------------------------------------------------------------
- # ● 处理战斗行动
- #--------------------------------------------------------------------------
- def process_action
- return if judge_win_loss
- return if $game_temp.next_scene != nil
- set_next_active_battler
- return if @active_battler == nil
- return if @active_battler.dead?
- @message_window.clear
- wait(5)
- @active_battler.white_flash = true
- unless @active_battler.action.forcing
- @active_battler.action.prepare
- end
- if @active_battler.action.valid?
- execute_action
- end
- unless @active_battler.action.forcing
- @message_window.clear
- remove_states_auto
- display_current_state
- end
- @active_battler.white_flash = false
- @message_window.clear
- end
- #--------------------------------------------------------------------------
- # ● 执行战斗行动: 攻击
- #--------------------------------------------------------------------------
- def execute_action_attack
- text = sprintf(Vocab::DoAttack, @active_battler.name)
- @message_window.add_instant_text(text)
- targets = @active_battler.action.make_targets
- display_attack_animation(targets)
- wait(20)
- for target in targets
- target.attack_effect(@active_battler)
- display_action_effects(target)
- end
- #=====================
- @active_battler.cp = 0
- #=====================
-
- end
- #--------------------------------------------------------------------------
- # ● 执行战斗行动 : 防御
- #--------------------------------------------------------------------------
- def execute_action_guard
- text = sprintf(Vocab::DoGuard, @active_battler.name)
- @message_window.add_instant_text(text)
- wait(45)
- #=====================
- @active_battler.cp = 0
- #=====================
- end
- #--------------------------------------------------------------------------
- # ● 执行战斗行动 : 逃走
- #--------------------------------------------------------------------------
- def execute_action_escape
- text = sprintf(Vocab::DoEscape, @active_battler.name)
- @message_window.add_instant_text(text)
- @active_battler.escape
- Sound.play_escape
- wait(45)
- #=====================
- @active_battler.cp = 0
- #=====================
-
- end
- #--------------------------------------------------------------------------
- # ● 执行战斗行动 : 待机
- #--------------------------------------------------------------------------
- def execute_action_wait
- text = sprintf(Vocab::DoWait, @active_battler.name)
- @message_window.add_instant_text(text)
- wait(45)
- #=====================
- @active_battler.cp = 0
- #=====================
- end
- #--------------------------------------------------------------------------
- # ● 执行战斗行动 : 特技
- #--------------------------------------------------------------------------
- def execute_action_skill
- skill = @active_battler.action.skill
- text = @active_battler.name + skill.message1
- @message_window.add_instant_text(text)
- unless skill.message2.empty?
- wait(10)
- @message_window.add_instant_text(skill.message2)
- end
- targets = @active_battler.action.make_targets
- display_animation(targets, skill.animation_id)
- @active_battler.mp -= @active_battler.calc_mp_cost(skill)
- $game_temp.common_event_id = skill.common_event_id
- for target in targets
- target.skill_effect(@active_battler, skill)
- display_action_effects(target, skill)
- end
- #=====================
- @active_battler.cp = 0
- #=====================
-
- end
- #--------------------------------------------------------------------------
- # ● 执行战斗行动 : 物品
- #--------------------------------------------------------------------------
- def execute_action_item
- item = @active_battler.action.item
- text = sprintf(Vocab::UseItem, @active_battler.name, item.name)
- @message_window.add_instant_text(text)
- targets = @active_battler.action.make_targets
- display_animation(targets, item.animation_id)
- $game_party.consume_item(item)
- $game_temp.common_event_id = item.common_event_id
- for target in targets
- target.item_effect(@active_battler, item)
- display_action_effects(target, item)
- end
- #=====================
- @active_battler.cp = 0
- #=====================
-
-
- end
- #--------------------------------------------------------------------------
- # ● 显示 HP 伤害
- # target : 对象者
- # obj : 特技或者物品
- #--------------------------------------------------------------------------
- def display_hp_damage(target, obj = nil)
- if target.hp_damage == 0 # 空伤害
- return if obj != nil and obj.damage_to_mp
- return if obj != nil and obj.base_damage == 0
- fmt = target.actor? ? Vocab::ActorNoDamage : Vocab::EnemyNoDamage
- text = sprintf(fmt, target.name)
- elsif target.absorbed # 吸收
- fmt = target.actor? ? Vocab::ActorDrain : Vocab::EnemyDrain
- text = sprintf(fmt, target.name, Vocab::hp, target.hp_damage)
- target.cp -= target.hp_damage/100
- target.cp = [target.cp,0].max
- @cp_battle.cp_battler[target].x = 95+300*target.cp/target.maxcp
- if target.dead?
- @cp_battle.cp_battler[target].collapse = true
- target.cp = 0
- @cp_battle.cp_battler[target].update
- end
-
- elsif target.hp_damage > 0 # 伤害
- if target.actor?
- text = sprintf(Vocab::ActorDamage, target.name, target.hp_damage)
- Sound.play_actor_damage
- $game_troop.screen.start_shake(5, 5, 10)
- else
- text = sprintf(Vocab::EnemyDamage, target.name, target.hp_damage)
- Sound.play_enemy_damage
- target.blink = true
- end
- target.cp -= target.hp_damage/100
- target.cp = [target.cp,0].max
- @cp_battle.cp_battler[target].x = 95+300*target.cp/target.maxcp
- if target.dead?
- @cp_battle.cp_battler[target].collapse = true
- target.cp = 0
- @cp_battle.cp_battler[target].update
- end
-
- else # 回复
- fmt = target.actor? ? Vocab::ActorRecovery : Vocab::EnemyRecovery
- text = sprintf(fmt, target.name, Vocab::hp, -target.hp_damage)
- Sound.play_recovery
- end
- @message_window.add_instant_text(text)
- wait(30)
- end
- #--------------------------------------------------------------------------
- # ● 显示 MP 伤害
- # target : 对象者
- # obj : 特技或者物品
- #--------------------------------------------------------------------------
- def display_mp_damage(target, obj = nil)
- return if target.dead?
- return if target.mp_damage == 0
- if target.absorbed # 吸收
- fmt = target.actor? ? Vocab::ActorDrain : Vocab::EnemyDrain
- text = sprintf(fmt, target.name, Vocab::mp, target.mp_damage)
- target.cp -= target.mp_damage/100
- target.cp = [target.cp,0].max
- @cp_battle.cp_battler[target].x = 95+300*target.cp/target.maxcp
- elsif target.mp_damage > 0 # 伤害
- fmt = target.actor? ? Vocab::ActorLoss : Vocab::EnemyLoss
- text = sprintf(fmt, target.name, Vocab::mp, target.mp_damage)
- target.cp -= target.mp_damage/100
- target.cp = [target.cp,0].max
- @cp_battle.cp_battler[target].x = 95+300*target.cp/target.maxcp
-
- else # 回复
- fmt = target.actor? ? Vocab::ActorRecovery : Vocab::EnemyRecovery
- text = sprintf(fmt, target.name, Vocab::mp, -target.mp_damage)
- Sound.play_recovery
- end
- @message_window.add_instant_text(text)
- wait(30)
- end
-
-
- end #class
- #======================================================
- #★角色处理类
- #======================================================
- class Game_Actor < Game_Battler
- #--------------------------------------------------------------------------
- # ● 执行自动回复 (回合结束时调用)
- #--------------------------------------------------------------------------
- def do_auto_recovery
- if auto_hp_recover and not dead?
- self.hp += maxhp / 20
- @auto_damage = maxhp / 20
- end
- end
-
- end #class
复制代码 |
评分
-
查看全部评分
|