Home > Tutorial

 

防禦SP回復

防禦單是傷害減半好像沒什麼用,
這次就將防禦時增加回復SP3%吧!

Class Battle_Scenemethod make_basic_result加上一句。

 

 #--------------------------------------------------------------------------
  # 生成基本行動結果
  #--------------------------------------------------------------------------
  def make_basic_action_result
    # 攻擊的情況下
    if @active_battler.current_action.basic == 0
      # 設置攻擊 ID
      @animation1_id = @active_battler.animation1_id
      @animation2_id = @active_battler.animation2_id
      # 行動方的戰鬥者是敵人的情況下
      if @active_battler.is_a?(Game_Enemy)
        if @active_battler.restriction == 3
          target = $game_troop.random_target_enemy
        elsif @active_battler.restriction == 2
          target = $game_party.random_target_actor
        else
          index = @active_battler.current_action.target_index
          target = $game_party.smooth_target_actor(index)
        end
      end
      # 行動方的戰鬥者是角色的情況下
      if @active_battler.is_a?(Game_Actor)
        if @active_battler.restriction == 3
          target = $game_party.random_target_actor
        elsif @active_battler.restriction == 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
      return
    end
    # 防禦的情況下
    if @active_battler.current_action.basic == 1
      # 幫助窗口顯示"防禦"
      @help_window.set_text($data_system.words.guard, 1)
      @active_battler.sp  += (@active_battler.maxsp *3/100 ).to_i    #計算回復SP
      @active_battler.sp = [@active_battler.sp , @active_battler.maxsp].min
      return
    end
    # 逃跑的情況下
    if @active_battler.is_a?(Game_Enemy) and
       @active_battler.current_action.basic == 2
      #  幫助窗口顯示"逃跑"
      @help_window.set_text("逃跑", 1)
      # 逃跑
      @active_battler.escape
      return
    end
    # 什麼也不做的情況下
    if @active_battler.current_action.basic == 3
      # 清除強製行動對像的戰鬥者
      $game_temp.forcing_battler = nil
      # 移至步驟 1
      @phase4_step = 1
      return
    end
  end

 

只要改一改算式就可以更改回復SP的量。

回復HP也是差不多,自己試試吧!

回前頁

Hosted by www.Geocities.ws

1