| 
 
| 赞 | 0 |  
| VIP | 0 |  
| 好人卡 | 0 |  
| 积分 | 1 |  
| 经验 | 0 |  
| 最后登录 | 2020-4-12 |  
| 在线时间 | 9 小时 |  
 Lv1.梦旅人 
	梦石0 星屑105 在线时间9 小时注册时间2020-3-2帖子7 | 
2楼
 
 
 楼主|
发表于 2020-3-3 07:37:56
|
只看该作者 
| 以下是出问题的代码,能直接告诉我代码怎么改也可以,十分感谢 
 复制代码=begin
说明
$vic 战斗胜利时自动开启
$ating 攻击/技能时自动开启
$tffing 回复时自动开启
$hpd 受伤时自动开启
$ging 防御时自动开启
为了方便修改,在关键地方标有注释
下面是关于问题的修复状态
1.请参考我修改过的数据库中对物品的设置
2.经过初步测试修复完毕
3.经过初步测试修复完毕
4.好像没注意到嘛...(还是我对这个问题的理解有问题0w0)
5.因为可无视所以无视了....当然需要的话可以修复一下啦
其余的问题:
战斗胜利后表情显示 √
结束消息移动到上方 √
=end
module BattleManager
  def self.process_victory#战斗胜利时的处理
    $vic = true
    $ating = false
    $tffing = false
    $hpd = false
    $gu = false
    $ging = false
    play_battle_end_me
    replay_bgm_and_bgs
    $game_message.position = 1#显示胜利信息的窗口的位置(0 上方,1 中间,2 下方)
    $game_message.add(sprintf(Vocab::Victory, $game_party.name))
    display_exp
    gain_gold
    gain_drop_items
    gain_exp
    SceneManager.return
    battle_end(0)
    return true
  end
  def self.process_escape#逃跑时的处理
    $ating = false
    $tffing = false
    $hpd = false
    $gu = false
    $ging = false
    $game_message.add(sprintf(Vocab::EscapeStart, $game_party.name))
    success = @preemptive ? true : (rand < @escape_ratio)
    Sound.play_escape
    if success
      process_abort
    else
      @escape_ratio += 0.1
      $game_message.add('\.' + Vocab::EscapeFailure)
      $game_party.clear_actions
    end
    wait_for_message
    return success
  end
  def self.process_abort#战斗中止时的处理
    $ating = false
    $tffing = false
    $hpd = false
    $gu = false
    $ging = false
    replay_bgm_and_bgs
    SceneManager.return
    battle_end(1)
    return true
  end
end
class Scene_Battle
  def start
    super
    $tffing = false
    $vic = false
    create_spriteset
    create_all_windows
    BattleManager.method_wait_for_message = method(:wait_for_message)
  end
  def use_item
    item = @subject.current_action.item
    @log_window.display_use_item(@subject, item)
    @subject.use_item(item)
    refresh_status
    targets = @subject.current_action.make_targets.compact
    show_animation(targets, item.animation_id)
    targets.each {|target| item.repeats.times { invoke_item(target, item)
    $tffing = false
    $hpd = false
    refresh_status
    } }
    
  end
  def command_guard
    $gu = true
    BattleManager.actor.input.set_guard
    next_command
  end
  def show_animation(targets, animation_id)
    #这一部分的思路是:(觉得不对可以修改,可能考虑的不周全)
    
    if @subject.is_a?(Game_Actor) #如果施法者是我方
      if @subject.current_action.targets_for_friends #如果目标是队友
        if $gu #如果施法者选择的是防御
        targets.each do |target|
          $ging = true #正在防御中
          $gid = target.id
        end
        else#如果不是的话(就是说不在防御中,那就是说在攻击或技能或物品)
        $ating = true
        $atid = @subject.id
        end
      else
        $ating = true
        $atid = @subject.id
        
      end
    end
    refresh_status
    if animation_id < 0
      show_attack_animation(targets)
    else
      show_normal_animation(targets, animation_id)
    end
    
    @log_window.wait
    wait_for_animation
    $ating = false
    $tffing = false
    $hpd = false
    refresh_status
  end
  def update
    super
    if BattleManager.in_turn?
      process_event
      process_action
    end
    BattleManager.judge_win_loss
  end
  def turn_end
    #由于防御是一整个回合都在执行,所以在回合结束才关闭
    $gu = false
    $ging = false
    
    all_battle_members.each do |battler|
      battler.on_turn_end
      refresh_status
      @log_window.display_auto_affected_status(battler)
      @log_window.wait_and_clear
    end
    BattleManager.turn_end
    process_event
    start_party_command_selection
  end
end
  
class Window_BattleStatus
  def draw_basic_area(rect, actor)
    draw_actor_name(actor, rect.x + 96, rect.y, 100)
    draw_actor_face(actor, rect.x, rect.y, !actor.dead?)
    draw_actor_icons(actor, rect.x, rect.y, rect.width+8)
  end
  def draw_actor_face(actor, x, y, enabled = true)
    #重点部分
    #上面的优先于下面的条件
    if if $vic && actor.hp != 0 #胜利时
      draw_face(actor.face_name, actor.face_index+7, x, y, enabled)
    elsif $ating && actor.id == $atid #除了正在防御外,行动者的头像更改
      draw_face(actor.face_name, actor.face_index+1, x, y, enabled)
    elsif $tffing && actor.id == $tffid #如果受到回复,被回复者的头像更改
      draw_face(actor.face_name, actor.face_index+4, x, y, enabled)
    elsif $hpd && actor.id == $hpdid # 如果受到伤害,受到伤害者头像更变
      draw_face(actor.face_name, actor.face_index+5, x, y, enabled)
    elsif $ging && actor.id == $gid #正在防御者的头像更改
      draw_face(actor.face_name, actor.face_index+6, x, y, enabled)
    else
    if (actor.hp.to_f/actor.mhp) >= 0.25 #血量比>=0.25
      draw_face(actor.face_name, actor.face_index, x, y, enabled)
    elsif (actor.hp.to_f/actor.mhp) < 0.25 && actor.hp != 0 #血量比<0.25并且没死
      draw_face(actor.face_name, actor.face_index+2, x, y, enabled)
    elsif actor.hp == 0#死了
      draw_face(actor.face_name, actor.face_index+3, x, y, enabled)
    end
    end
  end
end
class Game_Battler
  def execute_damage(user)
    on_damage(@result.hp_damage) if @result.hp_damage > 0
    self.hp -= @result.hp_damage
    self.mp -= @result.mp_damage
    user.hp += @result.hp_drain
    user.mp += @result.mp_drain
    if @result.hp_damage > 0
      if self.is_a?(Game_Actor)
        $hpd = true
        $hpdid = self.id
      end
    end
    if @result.hp_damage < 0 or @result.mp_damage < 0
      if self.is_a?(Game_Actor)
        $tffing = true
        $tffid = self.id
      end
    end
  end
end
end
 | 
 |