Avangs

  • 게임 정보
    • 게임 소개
    • 게임 리뷰
    • 게임 실황
    • 게임 공략
    • 모바일 테스트
  • 게임 작품new
    • 완성작 게임new
    • 체험판 게임
    • 한글판 게임
    • 온라인 게임
    • 추천작 제작자 저장소
  • 투표선정 작품
    • 아방스 추천작
    • 완성 기대작
    • 투표 신청
    • 투표소
    • 투표 결과
  • 강좌new
    • 아방스 칼럼
    • 비주얼노벨 강좌
    • 알만툴 강좌
      • MZ 강좌
      • MV 강좌
      • VX Ace 강좌
      • VX 강좌
      • XP 강좌
      • 2003 강좌
      • 2000 강좌
    • 게임메이커 강좌
    • 울프툴 강좌
    • 3D 게임제작 강좌
    • 2D 게임제작 강좌
    • 그래픽 제작 강좌
    • 기타 강좌
  • 질문과 답변new
    • 자주 묻는 질문new
    • 질문과 답변new
    • 제작의뢰
  • 커뮤니티new
    • 구인·구직·외주
    • 테스트 요청
    • 자유게시판new
    • 게임계 소식
    • 유머&정보
    • 사이트링크
    • 이벤트&대회
  • 창작
    • 게임 기획
    • 맵배치
    • 글쓰기
    • 그리기
    • 음악
  • 자료실
    • 게임제작툴
    • 예제 및 샘플
    • 그래픽 소재
      • 오리지널 소재
      • 이차창작 소재
      • 수정·개조 소재
      • 외부 소재
    • 사운드 소재
    • 확장·플러그인·스크립트
      • MZ 플러그인
      • MV 플러그인
      • Ace 스크립트
      • VX 스크립트
      • XP 스크립트
      • 2k3 플러그인
      • VN 플러그인·확장
    • 외부 소재사이트
    • 기타 자료
      • 한글화툴
      • 무료 폰트
      • 유틸리티
    • 디자인 참고자료
  • 고객센터new
    • 공지사항new
    • 건의 및 신고
    • 핫 이슈
로그인 회원가입
Avangs
  • 게임 정보
    • 게임 소개
    • 게임 리뷰
    • 게임 실황
    • 게임 공략
    • 모바일 테스트
  • 게임 작품new
    • 완성작 게임new
    • 체험판 게임
    • 한글판 게임
    • 온라인 게임
    • 추천작 제작자 저장소
  • 투표선정 작품
    • 아방스 추천작
    • 완성 기대작
    • 투표 신청
    • 투표소
    • 투표 결과
  • 강좌new
    • 아방스 칼럼
    • 비주얼노벨 강좌
    • 알만툴 강좌
      • MZ 강좌
      • MV 강좌
      • VX Ace 강좌
      • VX 강좌
      • XP 강좌
      • 2003 강좌
      • 2000 강좌
    • 게임메이커 강좌
    • 울프툴 강좌
    • 3D 게임제작 강좌
    • 2D 게임제작 강좌
    • 그래픽 제작 강좌
    • 기타 강좌
  • 질문과 답변new
    • 자주 묻는 질문new
    • 질문과 답변new
    • 제작의뢰
  • 커뮤니티new
    • 구인·구직·외주
    • 테스트 요청
    • 자유게시판new
    • 게임계 소식
    • 유머&정보
    • 사이트링크
    • 이벤트&대회
  • 창작
    • 게임 기획
    • 맵배치
    • 글쓰기
    • 그리기
    • 음악
  • 자료실
    • 게임제작툴
    • 예제 및 샘플
    • 그래픽 소재
      • 오리지널 소재
      • 이차창작 소재
      • 수정·개조 소재
      • 외부 소재
    • 사운드 소재
    • 확장·플러그인·스크립트
      • MZ 플러그인
      • MV 플러그인
      • Ace 스크립트
      • VX 스크립트
      • XP 스크립트
      • 2k3 플러그인
      • VN 플러그인·확장
    • 외부 소재사이트
    • 기타 자료
      • 한글화툴
      • 무료 폰트
      • 유틸리티
    • 디자인 참고자료
  • 고객센터new
    • 공지사항new
    • 건의 및 신고
    • 핫 이슈
로그인 회원가입

NOTICE

공지사항
더보기
  • 홈페이지 개편 및 시스템 정비 작업 안내 04.13

Recently Added Games

최근 등록 게임
  • 어드벤쳐 [1치킨 수상작] 로봇 관리자 newfile 04.13
  • 퍼즐/보드 알파벳 용사 2 file 04.08
  • 롤플레잉 스틱 파이터 섬 1 체험판 file 03.31
  • 어드벤쳐 9th Existence file 03.26
  • 어드벤쳐 악역스타 훈발이 file 03.13
2010.02.26 17:51

KGC 스탯올리기 스크립트 (능력치 분배 스크립트)

카이어덱터
조회 수 2343 추천 수 0 댓글 13
크게 작게 위로 아래로 댓글로 가기 인쇄
크게 작게 위로 아래로 댓글로 가기 인쇄

#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/    ◆ パラメータ振り分け - KGC_DistributeParameter ◆ XP ◆
#_/    ◇ Last update : 2008/12/21 ◇
#_/----------------------------------------------------------------------------
#_/  パラメータ振り分け機能を作成します。
#_/============================================================================
#_/  ≪入手経験値&金増加[ExpGoldIncrease]≫より下
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

#==============================================================================
# ★ カスタマイズ項目 - Customize ★
#==============================================================================

module KGC
module DistributeParameter
  # ◆ パラメータ増加量
  #  振り分け時の増加量を
  #   :パラメータ => [消費 RP, 上昇量, 回数上限, 消費 RP 補正, 上昇量補正],
  #  という書式で指定。
  #  「回数上限」以外は小数でもOK。
  #  「消費 RP 補正」と「上昇量補正」は省略可。省略時は 0。
  #  振り分け禁止パラメータには nil を指定。
  GAIN_PARAMETER = {
    :maxhp => [1,  2, 30, 1, 0],  # MaxHP
    :maxsp => [1,  1, 30, 1, 0],  # MaxSP
    :atk   => [1,  1, 30, 1, 0],  # 攻撃力
    :pdef  => [1,  1, 30, 1, 0],  # 物理防御
    :mdef  => [1,  1, 30, 1, 0],  # 魔法防御
    :str   => [1,  1, 30, 1, 0],  # 腕力
    :dex   => [1,  1, 30, 1, 0],  # 器用さ
    :agi   => [1,  1, 30, 1, 0],  # 素早さ
    :int   => [1,  1, 30, 1, 0],  # 魔力
    :hit   => [1,  1, 20, 1],       # 命中率
    :eva   => [1,  1, 20, 1],       # 回避率
  }  # ← この } は消さないこと!

  # ◆ アクター固有のパラメータ増加量
  PERSONAL_GAIN_PARAMETER = []
  #  ここから下に、アクターごとの振り分け時の増加量を
  #   PERSONAL_GAIN_PARAMETER[アクター ID] = { 増加量 }
  #  という書式で指定。
  #  「増加量」は GAIN_PARAMETER と同様の書式。
  #  指定しなかったパラメータ/アクターは GAIN_PARAMETER を使用。
  #
  # <例> アクター1の MaxHP, ATK を個別に指定。
#  PERSONAL_GAIN_PARAMETER[1] = {
#    :maxhp => [1, 50, 30, 0.4,   3],
#    :atk   => [1,  6, 30, 0.4, 0.6],
#  }

  # ◆ 職業固有のパラメータ増加量
  CLASS_GAIN_PARAMETER = []
  #  ここから下に、職業ごとの振り分け時の増加量を
  #   CLASS_GAIN_PARAMETER[職業 ID] = { 増加量 }
  #  という書式で指定。
  #  その他はアクター固有の設定と同様。
  #  (優先度は  職業 > アクター > デフォルト)

  # ◆ RP (Reinforce Point) の名称
  VOCAB_RP   = "S P "
  # ◆ RP の名称 (略)
  VOCAB_RP_A = "S P"

  # ◆ MaxRP 計算式
  #   level .. レベル
  #  結果が小数になってもOK(自動で整数に変換)。
  MAXRP_EXP = "(level ** 0.25 + 2.0) * level"

  # ◆ パラメータ名
  #  ≪拡張装備画面≫ と併用した場合、下に導入した方を優先。
  VOCAB_PARAM = {
    :hit => "명중률",        # 命中率
    :eva => "회피율",        # 回避率
  }  # ← この } は消さないこと!
  # ◆ パラメータ振り分け画面上部のテキスト
  DISTRIBUTE_SCENE_CAPTION = "스탯"
  # ◆ パラメータ振り分け画面背景透過
  DISTRIBUTE_SCENE_BACK_TRANSPARENT = true

  # ◆ 振り分け解除を許可
  #  true  : ← or A ボタンでパラメータを下げ、RP を取り戻せる。
  #  false : 一度振り分けたら変更できない。振り分けは C ボタンのみ。
  ENABLE_REVERSE_DISTRIBUTE = false
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

$imported = {} if $imported == nil
$imported["DistributeParameter"] = true

module KGC::DistributeParameter
  # 振り分け対象パラメータ
  PARAMS = [
    :maxhp, :maxsp, :atk, :pdef, :mdef,
    :str, :dex, :agi, :int, :hit, :eva
  ]
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# □ KGC::Vocab
#==============================================================================

module KGC
module Vocab
  # 命中率
  def self.hit
    return KGC::DistributeParameter::VOCAB_PARAM[:hit]
  end

  # 回避率
  def self.eva
    return KGC::DistributeParameter::VOCAB_PARAM[:eva]
  end

  # RP
  def self.rp
    return KGC::DistributeParameter::VOCAB_RP
  end

  # RP (略)
  def self.rp_a
    return KGC::DistributeParameter::VOCAB_RP_A
  end
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# □ KGC::Commands
#==============================================================================

module KGC::Commands
  module_function
  #--------------------------------------------------------------------------
  # ○ パラメータ振り分けに関する値をチェック
  #--------------------------------------------------------------------------
  def check_distribution_values
    (1...$data_actors.size).each { |i|
      actor = $game_actors[i]
      actor.check_distribution_values
      actor.restore_distribution_values
    }
  end
  #--------------------------------------------------------------------------
  # ○ RP の増減
  #     actor_id : アクター ID
  #     value    : 増減量
  #--------------------------------------------------------------------------
  def gain_rp(actor_id, value)
    actor = $game_actors[actor_id]
    return if actor == nil
    actor.gain_rp(value)
  end
  #--------------------------------------------------------------------------
  # ○ 振り分け回数をリセット
  #     actor_id : アクター ID
  #--------------------------------------------------------------------------
  def reset_distributed_count(actor_id)
    actor = $game_actors[actor_id]
    return if actor == nil
    actor.clear_distribution_values
    actor.restore_distribution_values
  end
  #--------------------------------------------------------------------------
  # ○ パラメータ振り分け画面の呼び出し
  #     actor_index : アクター index
  #--------------------------------------------------------------------------
  def call_distribute_parameter(actor_index = 0)
    $game_player.straighten
    $scene = Scene_DistributeParameter.new(
      actor_index,
      0,
      Scene_DistributeParameter::HOST_MAP)
  end
end

class Interpreter
  include KGC::Commands
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Game_Battler (分割定義 1)
#==============================================================================

class Game_Battler
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  alias initialize_KGC_DistributeParameter_Game_Battler initialize
  def initialize
    initialize_KGC_DistributeParameter_Game_Battler

    clear_distribution_values
    calc_distribution_values
  end
  #--------------------------------------------------------------------------
  # ○ パラメータ振り分けに関する値をクリア
  #--------------------------------------------------------------------------
  def clear_distribution_values
    @distributed_count = {}
    KGC::DistributeParameter::PARAMS.each { |param|
      @distributed_count[param] = 0
    }
  end
  #--------------------------------------------------------------------------
  # ○ パラメータ振り分けに関する値をチェック
  #--------------------------------------------------------------------------
  def check_distribution_values
    last_distributed_count = @distributed_count

    clear_distribution_values

    @distributed_count = last_distributed_count if last_distributed_count != nil
  end
  #--------------------------------------------------------------------------
  # ○ 各種修正値を計算
  #--------------------------------------------------------------------------
  def calc_distribution_values
    # 継承先で定義
  end
  #--------------------------------------------------------------------------
  # ○ 振り分けによる上昇値を取得
  #     param : パラメータの Symbol
  #--------------------------------------------------------------------------
  def distributed_param(param)
    return 0
  end
  #--------------------------------------------------------------------------
  # ● 命中率の取得
  #--------------------------------------------------------------------------
  alias hit_KGC_DistributeParameter hit
  def hit
    n = hit_KGC_DistributeParameter + distributed_param(:hit)
    return n
  end
  #--------------------------------------------------------------------------
  # ● 回避率の取得
  #--------------------------------------------------------------------------
  alias eva_KGC_DistributeParameter eva
  def eva
    n = eva_KGC_DistributeParameter + distributed_param(:eva)
    return n
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Game_Actor
#==============================================================================

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #     actor_id : アクター ID
  #--------------------------------------------------------------------------
  alias initialize_KGC_DistributeParameter initialize
  def initialize(actor_id)
    @actor_id = actor_id
    @class_id = $data_actors[actor_id].class_id
    @maxrp_plus = 0

    initialize_KGC_DistributeParameter(actor_id)
  end
  #--------------------------------------------------------------------------
  # ○ パラメータ増加量を取得
  #--------------------------------------------------------------------------
  def gain_parameter_list
    result = KGC::DistributeParameter::GAIN_PARAMETER
    # アクター固有
    list = KGC::DistributeParameter::PERSONAL_GAIN_PARAMETER[self.id]
    result = result.merge(list) if list != nil
    # クラス固有
    list = KGC::DistributeParameter::CLASS_GAIN_PARAMETER[self.class_id]
    result = result.merge(list) if list != nil

    return result
  end
  #--------------------------------------------------------------------------
  # ○ 各種修正値を計算
  #--------------------------------------------------------------------------
  def calc_distribution_values
    @rp_cost = 0
    @distributed_param = {}
    gain_parameter_list.each { |k, v|
      next if v == nil
      cost = 0
      param = 0
      distributed_count(k).times { |i|
        cost_plus   = v[0]
        cost_plus  += v[3] * i if v[3] != nil
        param_plus  = v[1]
        param_plus += v[4] * i if v[4] != nil
        cost  += Integer(cost_plus)
        param += Integer(param_plus)
      }
      @rp_cost += [cost, 0].max
      @distributed_param[k] = param
    }
  end
  #--------------------------------------------------------------------------
  # ○ 各種修正値を修復
  #--------------------------------------------------------------------------
  def restore_distribution_values
    calc_distribution_values
    self.hp = self.hp
    self.sp = self.sp
  end
  #--------------------------------------------------------------------------
  # ○ 振り分けによる上昇値を取得
  #     param : パラメータの Symbol
  #--------------------------------------------------------------------------
  def distributed_param(param)
    return 0 if @distributed_param == nil
    return 0 if @distributed_param[param] == nil
    return @distributed_param[param]
  end
  #--------------------------------------------------------------------------
  # ● 基本 MaxHP の取得
  #--------------------------------------------------------------------------
  alias base_maxhp_KGC_DistributeParameter base_maxhp
  def base_maxhp
    n = base_maxhp_KGC_DistributeParameter + distributed_param(:maxhp)
    return n
  end
  #--------------------------------------------------------------------------
  # ● 基本 MaxSP の取得
  #--------------------------------------------------------------------------
  alias base_maxsp_KGC_DistributeParameter base_maxsp
  def base_maxsp
    n = base_maxsp_KGC_DistributeParameter + distributed_param(:maxsp)
    return n
  end
  #--------------------------------------------------------------------------
  # ● 基本攻撃力の取得
  #--------------------------------------------------------------------------
  alias base_atk_KGC_DistributeParameter base_atk
  def base_atk
    n = base_atk_KGC_DistributeParameter + distributed_param(:atk)
    return n
  end
  #--------------------------------------------------------------------------
  # ● 基本物理防御の取得
  #--------------------------------------------------------------------------
  alias base_pdef_KGC_DistributeParameter base_pdef
  def base_pdef
    n = base_pdef_KGC_DistributeParameter + distributed_param(:pdef)
    return n
  end
  #--------------------------------------------------------------------------
  # ● 基本魔法防御の取得
  #--------------------------------------------------------------------------
  alias base_mdef_KGC_DistributeParameter base_mdef
  def base_mdef
    n = base_mdef_KGC_DistributeParameter + distributed_param(:mdef)
    return n
  end
  #--------------------------------------------------------------------------
  # ● 基本腕力の取得
  #--------------------------------------------------------------------------
  alias base_str_KGC_DistributeParameter base_str
  def base_str
    n = base_str_KGC_DistributeParameter + distributed_param(:str)
    return n
  end
  #--------------------------------------------------------------------------
  # ● 基本器用さの取得
  #--------------------------------------------------------------------------
  alias base_dex_KGC_DistributeParameter base_dex
  def base_dex
    n = base_dex_KGC_DistributeParameter + distributed_param(:dex)
    return n
  end
  #--------------------------------------------------------------------------
  # ● 基本素早さの取得
  #--------------------------------------------------------------------------
  alias base_agi_KGC_DistributeParameter base_agi
  def base_agi
    n = base_agi_KGC_DistributeParameter + distributed_param(:agi)
    return n
  end
  #--------------------------------------------------------------------------
  # ● 基本魔力の取得
  #--------------------------------------------------------------------------
  alias base_int_KGC_DistributeParameter base_int
  def base_int
    n = base_int_KGC_DistributeParameter + distributed_param(:int)
    return n
  end
  #--------------------------------------------------------------------------
  # ○ MaxRP の取得
  #--------------------------------------------------------------------------
  def maxrp
    n = Integer(eval(KGC::DistributeParameter::MAXRP_EXP))
    return [n + maxrp_plus, 0].max
  end
  #--------------------------------------------------------------------------
  # ○ MaxRP 補正値の取得
  #--------------------------------------------------------------------------
  def maxrp_plus
    @maxrp_plus = 0 if @maxrp_plus == nil
    return @maxrp_plus
  end
  #--------------------------------------------------------------------------
  # ○ RP の取得
  #--------------------------------------------------------------------------
  def rp
    return [maxrp - @rp_cost, 0].max
  end
  #--------------------------------------------------------------------------
  # ○ 振り分け回数の取得
  #     param : 振り分け先パラメータ (Symbol)
  #--------------------------------------------------------------------------
  def distributed_count(param)
    clear_distribution_values if @distributed_count == nil
    @distributed_count[param] = 0 if @distributed_count[param] == nil
    return @distributed_count[param]
  end
  #--------------------------------------------------------------------------
  # ○ RP の増減
  #     value : 増減量
  #--------------------------------------------------------------------------
  def gain_rp(value)
    @maxrp_plus = maxrp_plus + value
  end
  #--------------------------------------------------------------------------
  # ○ 振り分け回数の増減
  #     param : 振り分け先パラメータ (Symbol)
  #     value : 増減量
  #--------------------------------------------------------------------------
  def gain_distributed_count(param, value = 1)
    n = distributed_count(param)
    @distributed_count[param] += value if n.is_a?(Integer)
  end
  #--------------------------------------------------------------------------
  # ○ RP 振り分けによる成長効果適用
  #     param   : 振り分け先パラメータ (Symbol)
  #     reverse : 逆加算のときは true
  #--------------------------------------------------------------------------
  def rp_growth_effect(param, reverse = false)
    gain = gain_parameter_list[param]
    return if gain == nil  # 無効なパラメータ

    if reverse
      return if distributed_count(param) == 0  # 逆加算不可
    else
      return unless can_distribute?(param)
    end

    gain_distributed_count(param, reverse ? -1 : 1)
    restore_distribution_values
  end
  #--------------------------------------------------------------------------
  # ○ パラメータ振り分け可否判定
  #     param : 振り分け先パラメータ (Symbol)
  #--------------------------------------------------------------------------
  def can_distribute?(param)
    gain = gain_parameter_list[param]
    return false if gain == nil                          # 無効なパラメータ
    return false if self.rp < distribute_cost(param)     # RP 不足
    return false if gain[2] <= distributed_count(param)  # 回数上限

    return true
  end
  #--------------------------------------------------------------------------
  # ○ パラメータ振り分けコスト計算
  #     param : 振り分け先パラメータ (Symbol)
  #--------------------------------------------------------------------------
  def distribute_cost(param)
    gain = gain_parameter_list[param]
    return 0 if gain == nil  # 無効なパラメータ

    n = gain[0]
    n += gain[3] * distributed_count(param) if gain[3] != nil
    return [Integer(n), 0].max
  end
  #--------------------------------------------------------------------------
  # ○ パラメータ振り分け時の増加量計算
  #     param : 振り分け先パラメータ (Symbol)
  #--------------------------------------------------------------------------
  def distribute_gain(param)
    gain = gain_parameter_list[param]
    return 0 if gain == nil  # 無効なパラメータ

    n = gain[1]
    n += gain[4] * distributed_count(param) if gain[4] != nil
    return Integer(n)
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Window_Base
#==============================================================================

class Window_Base < Window
  #--------------------------------------------------------------------------
  # ○ RP の文字色を取得
  #     actor : アクター
  #--------------------------------------------------------------------------
  def rp_color(actor)
    return (actor.rp == 0 ? knockout_color : normal_color)
  end
  #--------------------------------------------------------------------------
  # ○ RP の描画
  #     actor : アクター
  #     x     : 描画先 X 座標
  #     y     : 描画先 Y 座標
  #     width : 幅
  #--------------------------------------------------------------------------
  def draw_actor_rp(actor, x, y, width = 120)
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 40, 32, KGC::Vocab::rp)
    self.contents.font.color = rp_color(actor)
    xr = x + width
    self.contents.draw_text(xr - 40, y, 40, 32, actor.rp.to_s, 2)
    self.contents.font.color = normal_color
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# □ Window_DistributeParameterActor
#------------------------------------------------------------------------------
#   振り分け画面で、アクターの情報を表示するウィンドウです。
#==============================================================================

class Window_DistributeParameterActor < Window_Base
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #     x     : ウィンドウの X 座標
  #     y     : ウィンドウの Y 座標
  #     actor : アクター
  #--------------------------------------------------------------------------
  def initialize(x, y, actor)
    super(x, y, 640, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    @actor = actor
    refresh
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    draw_actor_name(@actor, 4, 0)
    draw_actor_level(@actor, 160, 0)
    draw_actor_rp(@actor, 280, 0, 80)
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# □ Window_DistributeParameterList
#------------------------------------------------------------------------------
#   振り分け画面で、成長させるパラメータを選択するウィンドウです。
#==============================================================================

class Window_DistributeParameterList < Window_Selectable
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #     actor : アクター
  #--------------------------------------------------------------------------
  def initialize(actor)
    super(0, 128, 400, 352)
    @actor = actor
    refresh
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # ○ 選択中のパラメータの Symbol を取得
  #--------------------------------------------------------------------------
  def parameter_symbol
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    @data = []
    gain_params = KGC::DistributeParameter::GAIN_PARAMETER
    KGC::DistributeParameter::PARAMS.each { |param|
      next if gain_params[param] == nil
      @data << param
    }
    @item_max = @data.size

    self.contents.dispose if self.contents != nil
    self.contents = Bitmap.new(width - 32, @item_max * 32)
    @item_max.times { |i| draw_item(i, @actor.can_distribute?(@data[i])) }
  end
  #--------------------------------------------------------------------------
  # ● 項目を描画する矩形の取得
  #     index : 項目番号
  #--------------------------------------------------------------------------
  def item_rect(index)
    rect = Rect.new(0, index * 32, width - 32, 32)
    return rect
  end
  #--------------------------------------------------------------------------
  # ● フレーム更新
  #--------------------------------------------------------------------------
  def update
    return if Input.repeat?(Input::L) || Input.repeat?(Input::R)
    super
  end
  #--------------------------------------------------------------------------
  # ○ 項目の描画
  #     index   : 項目番号
  #     enabled : 有効フラグ
  #--------------------------------------------------------------------------
  def draw_item(index, enabled = true)
    rect = item_rect(index)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    item = @data[index]
    if item != nil
      draw_parameter(rect.x, rect.y, @data[index], enabled)
    end
  end
  #--------------------------------------------------------------------------
  # ○ 能力値の描画
  #     x       : 描画先 X 座標
  #     y       : 描画先 Y 座標
  #     type    : 能力値の種類
  #     enabled : 有効フラグ
  #--------------------------------------------------------------------------
  def draw_parameter(x, y, type, enabled)
    case type
    when :maxhp
      name  = $data_system.words.hp
    when :maxsp
      name  = $data_system.words.sp
    when :atk
      name  = $data_system.words.atk
    when :pdef
      name  = $data_system.words.pdef
    when :mdef
      name  = $data_system.words.mdef
    when :str
      name  = $data_system.words.str
    when :dex
      name  = $data_system.words.dex
    when :agi
      name  = $data_system.words.agi
    when :int
      name  = $data_system.words.int
    when :hit
      name  = KGC::Vocab.hit
    when :eva
      name  = KGC::Vocab.eva
    else
      return
    end

    alpha = enabled ? 255 : 128
    self.contents.font.color = system_color
    self.contents.font.color.alpha = alpha
    self.contents.draw_text(x +   4, y, 120, 32, name)
    self.contents.draw_text(x + 128, y,  40, 32, KGC::Vocab::rp_a, 2)

    self.contents.font.color = normal_color
    self.contents.font.color.alpha = alpha
    gain = @actor.gain_parameter_list[type]
    value = @actor.distribute_cost(type)
    self.contents.draw_text(x + 168, y, 32, 32, value.to_s, 2)
    value = sprintf("%+d", @actor.distribute_gain(type))
    self.contents.draw_text(x + 208, y, 56, 32, value, 2)
    value = sprintf("%3d/%3d", @actor.distributed_count(type), gain[2])
    self.contents.draw_text(x + 268, y, 96, 32, value, 2)
    self.contents.font.color = normal_color
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# □ Window_DistributeParameterStatus
#------------------------------------------------------------------------------
#   振り分け画面で、アクターのステータスを表示するウィンドウです。
#==============================================================================

class Window_DistributeParameterStatus < Window_Base
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #     actor : アクター
  #--------------------------------------------------------------------------
  def initialize(actor)
    super(400, 128, 240, 352)
    self.contents = Bitmap.new(width - 32, height - 32)
    @actor = actor
    refresh
  end
  #--------------------------------------------------------------------------
  # ● リフレッシュ
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    dy = 0
    gain_params = KGC::DistributeParameter::GAIN_PARAMETER
    KGC::DistributeParameter::PARAMS.each { |param|
      next if gain_params[param] == nil
      draw_parameter(0, dy, param)
      dy += 28
    }
  end
  #--------------------------------------------------------------------------
  # ○ 能力値の描画
  #     x    : 描画先 X 座標
  #     y    : 描画先 Y 座標
  #     type : 能力値の種類
  #--------------------------------------------------------------------------
  def draw_parameter(x, y, type)
    case type
    when :maxhp
      name  = $data_system.words.hp
      value = @actor.maxhp
    when :maxsp
      name  = $data_system.words.sp
      value = @actor.maxsp
    when :atk
      name  = $data_system.words.atk
      value = @actor.atk
    when :pdef
      name  = $data_system.words.pdef
      value = @actor.pdef
    when :mdef
      name  = $data_system.words.mdef
      value = @actor.mdef
    when :str
      name  = $data_system.words.str
      value = @actor.str
    when :dex
      name  = $data_system.words.dex
      value = @actor.dex
    when :agi
      name  = $data_system.words.agi
      value = @actor.agi
    when :int
      name  = $data_system.words.int
      value = @actor.int
    when :hit
      name  = KGC::Vocab.hit
      value = @actor.hit
    when :eva
      name  = KGC::Vocab.eva
      value = @actor.eva
    else
      return
    end

    self.contents.font.color = system_color
    self.contents.draw_text(x + 4, y, 96, 24, name)
    self.contents.font.color = normal_color
    self.contents.draw_text(x + 106, y, 64, 24, Integer(value).to_s, 2)
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# □ Scene_DistributeParameter
#------------------------------------------------------------------------------
#   パラメータ振り分け画面の処理を行うクラスです。
#==============================================================================

class Scene_DistributeParameter
  #--------------------------------------------------------------------------
  # ○ 定数
  #--------------------------------------------------------------------------
  HOST_MENU   = 0  # 呼び出し元 : メニュー
  HOST_MAP    = 1  # 呼び出し元 : マップ
  #--------------------------------------------------------------------------
  # ○ オブジェクト初期化
  #     actor_index : アクターインデックス
  #     menu_index  : コマンドのカーソル初期位置
  #     host_scene  : 呼び出し元 (0..メニュー  1..マップ)
  #--------------------------------------------------------------------------
  def initialize(actor_index = 0, menu_index = 0, host_scene = HOST_MENU)
    @actor_index = actor_index
    @menu_index = menu_index
    @host_scene = host_scene
  end
  #--------------------------------------------------------------------------
  # ○ メイン処理
  #--------------------------------------------------------------------------
  def main
    start
    # トランジション実行
    Graphics.transition
    # メインループ
    loop {
      Graphics.update
      Input.update
      update
      break if $scene != self
    }
    # トランジション準備
    Graphics.freeze
    terminate
  end
  #--------------------------------------------------------------------------
  # ○ 開始処理
  #--------------------------------------------------------------------------
  def start
    @actor = $game_party.actors[@actor_index]
    if KGC::DistributeParameter::DISTRIBUTE_SCENE_BACK_TRANSPARENT
      @spriteset = Spriteset_Map.new
    end
    create_windows
  end
  #--------------------------------------------------------------------------
  # ○ ウィンドウ作成
  #--------------------------------------------------------------------------
  def create_windows
    @help_window = Window_Help.new
    @help_window.set_text(KGC::DistributeParameter::DISTRIBUTE_SCENE_CAPTION)
    dy = @help_window.height
    @actor_window = Window_DistributeParameterActor.new(0, dy, @actor)
    @parameter_window = Window_DistributeParameterList.new(@actor)
    @status_window = Window_DistributeParameterStatus.new(@actor)
    if KGC::DistributeParameter::DISTRIBUTE_SCENE_BACK_TRANSPARENT
      @help_window.back_opacity = 160
      @actor_window.back_opacity = 160
      @parameter_window.back_opacity = 160
      @status_window.back_opacity = 160
    end
  end
  #--------------------------------------------------------------------------
  # ○ 終了処理
  #--------------------------------------------------------------------------
  def terminate
    @help_window.dispose
    @actor_window.dispose
    @parameter_window.dispose
    @status_window.dispose
    @spriteset.dispose if @spriteset != nil
  end
  #--------------------------------------------------------------------------
  # ○ 元の画面へ戻る
  #--------------------------------------------------------------------------
  def return_scene
    case @host_scene
    when HOST_MENU
      $scene = Scene_Menu.new(@menu_index)
    when HOST_MAP
      $scene = Scene_Map.new
    end
  end
  #--------------------------------------------------------------------------
  # ○ フレーム更新
  #--------------------------------------------------------------------------
  def update
    update_window
    if @parameter_window.active
      update_parameter_list
    end
  end
  #--------------------------------------------------------------------------
  # ○ ウィンドウ更新
  #--------------------------------------------------------------------------
  def update_window
    @help_window.update
    @actor_window.update
    @parameter_window.update
    @status_window.update
  end
  #--------------------------------------------------------------------------
  # ○ ウィンドウ再描画
  #--------------------------------------------------------------------------
  def refresh_window
    @actor_window.refresh
    @parameter_window.refresh
    @status_window.refresh
    Graphics.frame_reset
  end
  #--------------------------------------------------------------------------
  # ○ 次のアクターの画面に切り替え
  #--------------------------------------------------------------------------
  def next_actor
    @actor_index += 1
    @actor_index %= $game_party.actors.size
    $scene = Scene_DistributeParameter.new(@actor_index,
      @menu_index, @host_scene)
  end
  #--------------------------------------------------------------------------
  # ○ 前のアクターの画面に切り替え
  #--------------------------------------------------------------------------
  def prev_actor
    @actor_index += $game_party.actors.size - 1
    @actor_index %= $game_party.actors.size
    $scene = Scene_DistributeParameter.new(@actor_index,
      @menu_index, @host_scene)
  end
  #--------------------------------------------------------------------------
  # ○ フレーム更新 (パラメータウィンドウがアクティブの場合)
  #--------------------------------------------------------------------------
  def update_parameter_list
    if Input.trigger?(Input::B)
        $game_system.se_play($data_system.cancel_se)
      #return_scene
      $scene = Scene_Menu.new(4)
    elsif input_growth?
      # 加算
      param = @parameter_window.parameter_symbol
      unless @actor.can_distribute?(param)
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      if Input.repeat?(Input::C)
        $game_system.se_play($data_system.decision_se)
      else
        $game_system.se_play($data_system.cursor_se)
      end
      @actor.rp_growth_effect(param)
      refresh_window
    elsif input_reverse_growth?
      # 減算
      param = @parameter_window.parameter_symbol
      if @actor.distributed_count(param) == 0
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      if Input.repeat?(Input::C)
        $game_system.se_play($data_system.decision_se)
      else
        $game_system.se_play($data_system.cursor_se)
      end
      @actor.rp_growth_effect(param, true)
      refresh_window
    elsif Input.trigger?(Input::R)
      $game_system.se_play($data_system.cursor_se)
      next_actor
    elsif Input.trigger?(Input::L)
      $game_system.se_play($data_system.cursor_se)
      prev_actor
    end
  end
  #--------------------------------------------------------------------------
  # ○ 加算入力
  #--------------------------------------------------------------------------
  def input_growth?
    if KGC::DistributeParameter::ENABLE_REVERSE_DISTRIBUTE
      return Input.repeat?(Input::C) || Input.repeat?(Input::RIGHT)
    else
      return Input.trigger?(Input::C)
    end
  end
  #--------------------------------------------------------------------------
  # ○ 減算入力
  #--------------------------------------------------------------------------
  def input_reverse_growth?
    if KGC::DistributeParameter::ENABLE_REVERSE_DISTRIBUTE
      return Input.repeat?(Input::A) || Input.repeat?(Input::LEFT)
    else
      return false
    end
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Scene_Load
#==============================================================================

class Scene_Load < Scene_File
  #--------------------------------------------------------------------------
  # ● セーブデータの読み込み
  #     file : 読み込み用ファイルオブジェクト (オープン済み)
  #--------------------------------------------------------------------------
  alias read_save_data_KGC_DistributeParameter read_save_data
  def read_save_data(file)
    read_save_data_KGC_DistributeParameter(file)

    KGC::Commands.check_distribution_values
    Graphics.frame_reset
  end
end

 

:maxhp => [1,  2, 30, 1, 0], 

첫번째 숫자 - 초기 SP 소모량

두번째 숫자 - 초기 능력치 증가량

 

세번째 숫자 - 올릴 수 있는 스탯 횟수

 

네번째 숫자 - 스탯 1 올릴 시마다 늘어나는 SP 소모량

 

다섯번째 숫자 - 스탯 1 올릴 시마다 늘어나는 능력치 증가량

 


$scene = Scene_DistributeParameter.new

--- 화면 호출

TAG •
  • 스탯,
0 추천 0 비추천
Facebook Twitter Google Pinterest KakaoStory Band
위로 아래로 댓글로 가기 인쇄
에디터 선택하기
✔ 텍스트 모드 ✔ 에디터 모드
?
댓글 쓰기 권한이 없습니다. 로그인 하시겠습니까?
Comment '13'
  • ?
    rgnrk001 2010.02.26 18:52

    감사합니다.

    댓글
  • ?
    킴고돌 2010.02.27 12:37

    헐;

    댓글
  • ?
    킴고돌 2010.02.27 12:38

    잘쓰겟습니다 ^^

    댓글
  • ?
    불씨 2010.02.27 13:42

    감사합니다

    댓글
  • ?
    까칠한규진군 2010.02.27 17:45

    엥? 안되는데여??

    댓글
  • ?
    KOREA♬♪ 2010.03.07 11:47

    왜 않되는걸까요 ㅠㅠ

     

    댓글
  • ?
    내로미 2010.03.08 20:10

    오~ 되네요~ 감사합니다~

    드디어 저의 메뉴도 메탈페이블처럼 7개의 버튼이 생겼네요. ㅎㅎ

    나중에는 9개로 만들어야지~

    수정 삭제 댓글
  • ?
    케니타인 2010.06.05 18:27

    ㄳ

    댓글
  • ?
    요꼬당 2010.08.07 04:20

    ㄷㄷ

    댓글
  • ?
    키히힝힠 2010.10.10 10:52

    저도

    댓글
  • ?
    TheLoki 2011.05.16 23:13

    감사합니다.

    댓글
  • ?
    캉쿤 2011.08.18 16:54

    이거 메인에 넣는거 맞죠?

    댓글
  • ?
    Amaster 2011.12.29 14:07

    감사합니다. 잘 되내요.

    스탯포인트는 좀 개조해서 써야겟네요 ㅋㅋ

    댓글

Category
  • 그래픽(16)
  • 맵/타일(15)
  • 메뉴(88)
  • 메시지(26)
  • 미니맵(9)
  • 버그픽스(0)
  • 변수/스위치(10)
  • 상점(14)
  • 상태/속성(8)
  • 스킬(49)
  • 아이템(34)
  • 액터(4)
  • 원경(0)
  • 영상(7)
  • 오디오(8)
  • 온라인(23)
  • 이동 및 탈것(62)
  • 이름입력(10)
  • 장비(34)
  • 저장(34)
  • 전투(174)
  • 제작도구(1)
  • 직업(2)
  • 퀘스트(3)
  • 키입력(18)
  • 타이틀/게임오버(24)
  • 파티(11)
  • HUD(34)
  • 기타(254)
List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 9750
1021 제작도구 [XP/VX/VXA] Doodad's Editor by newold Alkaid 2020.07.12 597
1020 메시지 Taylor's Simple Message System 2000 Alkaid 2020.07.05 426
1019 이름입력 한글조합입력기(영어가능) file 조규진1 2019.11.10 731
1018 맵/타일 맵연결 스크립트 (데모첨부) file 게임애호가 2018.06.15 900
1017 전투 전투중에 장비들 교체하기 file 레이스89 2017.08.19 930
1016 온라인 인터넷 웹 상에서의 시간을 취득하는 스크립트 1 이우 2016.05.24 1084
1015 장비 착용한 장비에 따라 모습이 달라지는 스크립트 예제 5 file 게임애호가 2015.02.14 2244
1014 기타 [All RGSS] File-Ex file Cheapmunk 2014.12.29 1097
1013 기타 [All RGSS] FileTest (Unicode) file Cheapmunk 2014.12.29 745
1012 기타 [RGSS XP] 게임 해상도 조절 스크립트 (*2) 11 file Cheapmunk 2014.10.03 2825
1011 그래픽 Drago - Custom Resolution II 1 Alkaid 2014.09.10 1242
1010 기타 레벨업스크립트(xp) 2 게임을만들자! 2014.08.05 1928
1009 메뉴 MOG - Scroll Bar for XP file 습작 2014.07.06 1714
1008 기타 [All RGSS] 윈도우 메세지박스 스크립트 (Completed ver) 5 file Cheapmunk 2014.06.22 2374
1007 기타 [All RGSS] 게임 다중 실행 방지 스크립트 1 file Cheapmunk 2014.05.24 1544
1006 기타 RM2kXP file 습작 2014.03.17 1696
1005 기타 [All RGSS] 윈도우 커서 숨기기/보이기 1 file Cheapmunk 2014.03.02 2140
1004 기타 Drago - Custom Resolution by LiTTleDRAgo Alkaid 2014.02.13 1301
1003 그래픽 [XP/VX/VXA] Drago - Transition Pack Alkaid 2014.02.13 1365
1002 기타 [XP/VX/VXA] Map Screenshot by LiTTleDRAgo 1 Alkaid 2014.02.13 1019
쓰기
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ... 52 Next
/ 52
AVANGS

게임 제작, 창작, 자료, 강좌를 연결하는 커뮤니티

  • 개인정보 취급방침

Copyright © 2026 Avangs