전투

전투후 경험치 분배와 레벨업시 HP/SP 전회복

by 백호 posted Feb 21, 2009
?

단축키

Prev이전 문서

Next다음 문서

ESC닫기

크게 작게 위로 아래로 댓글로 가기 인쇄
http://www.dubealex.com/asylum/index.php?showtopic=6512
  이 스크립트에서 전투후 주어지는 경험치는 (적 파티 경험치)/(파티의 캐릭터 수)입니다.  즉, 경험치가 20인 몬스터를 2명이서 잡으면 한 사람당 돌아오는 경험치는 10이 됩니다.


#=============================================================
# • After Battle Changes
#------------------------------------------------------------------------------
# Slipknot
# 1.1
# 15/02/06
#------------------------------------------------------------------------------
=begin
  Version 1.1
  - Fixed experience split.
  - In the result window, now appear the total experience.
=end
#=============================================================

module Battle_End_Options
  #--------------------------------------------------------------------------
  # • Split experience received?
  #--------------------------------------------------------------------------
  Split_Exp = false
  #--------------------------------------------------------------------------
  # • Full recover when actor increase level?
  #--------------------------------------------------------------------------
  Level_Up_Recover = true
  #--------------------------------------------------------------------------
  # • Phase 5 wait time
  #--------------------------------------------------------------------------
  End_Frames = 70
  #--------------------------------------------------------------------------
end

#------------------------------------------------------------------------------
# Begin Scene_Battle Edit
#------------------------------------------------------------------------------
class Scene_Battle
  #--------------------------------------------------------------------------
  include Battle_End_Options
  #--------------------------------------------------------------------------
  def start_phase5
    @phase = 5
    $game_system.me_play($game_system.battle_end_me)
    $game_system.bgm_play($game_temp.map_bgm)
    exp = gold = old_exp = 0
    treasures = []
    for enemy in $game_troop.enemies
      unless enemy.hidden
        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
    treasures = treasures[0..5]
    psize = $game_party.actors.size-1
    old_exp = exp
    if Split_Exp
      can_get = 0
      0.upto(psize) do |x|
        actor = $game_party.actors[x]
        next if actor.cant_get_exp?
        can_get += 1
      end
      exp = (old_exp / can_get).ceil if can_get > 0
    end
    for i in 0..psize
      actor = $game_party.actors[i]
      unless actor.cant_get_exp?
        last_level = actor.level
        actor.exp += exp
        if actor.level > last_level
          @status_window.level_up(i)
          if Level_Up_Recover
            actor.hp = actor.maxhp
            actor.sp = actor.maxsp
          end
        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(old_exp, gold, treasures)
    @phase5_wait_count = End_Frames
  end
end
#------------------------------------------------------------------------------
# End Scene_Battle Edit
#------------------------------------------------------------------------------

#------------------------------------------------------------------------------
# Begin Game_Actor Edit
#------------------------------------------------------------------------------
class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  def final_level?
    return @level >= $data_actors[@actor_id].final_level
  end
  #--------------------------------------------------------------------------
  def cant_get_exp?
    return true if final_level?
    super
  end
end
#------------------------------------------------------------------------------
# End Game_Actor Edit
#------------------------------------------------------------------------------