473 lines
18 KiB
Ruby
473 lines
18 KiB
Ruby
class RPG::Class < RPG::BaseItem
|
||
def params_tp
|
||
@params_tp ||= tp_init
|
||
end
|
||
def tp_init
|
||
sp = Hash.new
|
||
sp_rule = FAKEREAL.deep_copy(SpiritSystem::BASE_SP[self.id])#.dup
|
||
base = sp_rule[0]
|
||
final = sp_rule[1]
|
||
plus = (final - base) / 98
|
||
plus_array = FAKEREAL.deep_copy(SpiritSystem::PLUS_SP[self.id])#.dup
|
||
(1..99).each do |i|
|
||
base += plus + plus_array[i / plus_array.size] unless i == 1
|
||
sp[i] = i == 99 ? final : [base, final].min
|
||
end
|
||
=begin
|
||
type_plus = SpiritSystem::UP_SP[type].dup
|
||
plus_array = SpiritSystem::PLUS_SP[id].dup
|
||
(1..99).each do |i|
|
||
plus = plus_array[i / plus_array.size] unless i == 1
|
||
base += [plus + type_plus[i % type_plus.size], 1].max unless i == 1
|
||
sp[i] = base
|
||
end
|
||
=end
|
||
sp
|
||
end
|
||
end
|
||
|
||
class RPG::Enemy < RPG::BaseItem
|
||
def mtp
|
||
@mtp ||= mtp_set
|
||
end
|
||
def mtp_set
|
||
return $1.to_i if self.note =~ /\<魂魄力:(\d+)\>/
|
||
return 10
|
||
end
|
||
end
|
||
|
||
#==============================================================================
|
||
# ■ SpiritSystem
|
||
#------------------------------------------------------------------------------
|
||
# #魂魄力システムのモジュール。
|
||
#
|
||
#==============================================================================
|
||
|
||
module SpiritSystem
|
||
|
||
BASE_SP = Hash[
|
||
1 => [28, 677],#宮廷魔術師
|
||
2 => [50, 1217],#人妻戦士
|
||
3 => [49, 1035],#巫女
|
||
4 => [10, 111],
|
||
5 => [36, 871],#スノーレディ
|
||
6 => [25, 581],#剣士
|
||
7 => [23, 512],#守護騎士
|
||
8 => [20, 494],#治癒術師
|
||
9 => [20, 501],#元素魔術師
|
||
10 => [24, 477],#盗賊
|
||
11 => [20, 481],#学者
|
||
12 => [40, 727],#炎の精霊
|
||
13 => [45, 920],#氷の魔狼
|
||
14 => [40, 804],#雷の物ノ怪
|
||
15 => [20, 480],#光の聖獣
|
||
16 => [20, 480],#闇の淫獣
|
||
17 => [48, 980],#零の黒龍
|
||
18 => [10, 677],
|
||
19 => [10, 677],
|
||
220 => [50, 1100],#シャーリー
|
||
221 => [28, 610],#エスティア
|
||
222 => [36, 778],#マリアナ
|
||
223 => [35, 770],#ミレイ
|
||
224 => [30, 650],#ディアナ
|
||
]
|
||
|
||
PLUS_SP = Hash[#Lv1桁台,10台 20 30 40 50 60 70 80 90台
|
||
1 => [1, 2, 2, 1, 0, 1, 1, 0, -1, -1],#宮廷魔術師
|
||
2 => [2, 3, 4, 5, 3, 2, 1, -2, -1, -1],#人妻戦士
|
||
3 => [-1, 2, 3, 2, 2, -1, 1, 0, -1, -1],#巫女
|
||
4 => [7, 7, 7, 7, 7, 7, 7, 7, 7, 7],
|
||
5 => [1, -1, 3, 2, 3, 4, -1, 0, -2, -1],#スノーレディ
|
||
6 => [3, 2, 1, 1, 0, 1, 0, 1, -1, 0],#剣士
|
||
7 => [2, 2, 2, 1, 1, 1, 0, 1, 1, 0],#守護騎士
|
||
8 => [2, 1, 2, 3, 0, 0, 0, 1, -1, 1],#治癒術師
|
||
9 => [2, 1, 3, 2, 1, 0, 1, 1, -1, 0],#元素魔術師
|
||
10 => [3, 2, 1, 1, 1, 0, 1, -1, -1, 0],#盗賊
|
||
11 => [2, 2, 3, 1, 1, 0, 1, -1, -1, 0],#学者
|
||
12 => [1, 1, 0, 0, -2, -2, 3, 2, 1, 0],#炎の精霊
|
||
13 => [0, 0, 1, 2, 3, 4, 1, -2, -2, -1],#氷の魔狼
|
||
14 => [1, 0, 0, -1, -1, 2, 2, 3, 2, 1],#雷の物ノ怪
|
||
15 => [0, 0, 1, 2, 1, 1, 0, 1, 1, 0],#光の聖獣
|
||
16 => [0, 0, 1, 2, 1, 1, 0, 1, 1, 0],#闇の淫獣
|
||
17 => [1, 2, 3, 0, 0, 1, 0, 0, -1, -1],#零の黒龍
|
||
18 => [7, 7, 7, 7, 7, 7, 7, 7, 7, 7],
|
||
19 => [7, 7, 7, 7, 7, 7, 7, 7, 7, 7],
|
||
220 => [2, 3, 5, 2, 1, -1, -1, -1, -1, -2],
|
||
221 => [-1, 0, 2, 1, 1, 3, 2, 1, -1, 1],
|
||
222 => [-1, -1, 1, 0, 2, 2, 1, 1, 1, -1],
|
||
223 => [-1, -2, -1, 1, 1, 1, 2, 1, 1, 2],
|
||
224 => [-1, 0, 0, -1, 0, 1, 0, -1, 2, 3],
|
||
]
|
||
=begin
|
||
# レベルアップ時の上昇タイプ
|
||
UP_SP = Hash[
|
||
"a" => [2, 0, 1, 1, 2], # 平均タイプ Lv÷5の余りの配列にある数値分上昇
|
||
"b" => [3, 2, 4, 1, 2, -1], # 強タイプ
|
||
"c" => [1, 0, 1, -1, 2, 0] # 弱タイプ
|
||
]
|
||
|
||
=end
|
||
|
||
end
|
||
|
||
|
||
#==============================================================================
|
||
# ■ Game_BattlerBase
|
||
#------------------------------------------------------------------------------
|
||
#==============================================================================
|
||
|
||
class Game_BattlerBase
|
||
#--------------------------------------------------------------------------
|
||
# ○ TP の消費率
|
||
#--------------------------------------------------------------------------
|
||
def tucr; 1.0; end # TPコスト率 Tp Use Cost Rate
|
||
def dwcr; 1.0; end # 二刀流TPコスト率 Dual Wield Cost Rate
|
||
#--------------------------------------------------------------------------
|
||
# ● TP の割合を取得 ※再定義
|
||
#--------------------------------------------------------------------------
|
||
def tp_rate
|
||
@tp.to_f / max_tp
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ○ バトル用TP の割合を取得
|
||
#--------------------------------------------------------------------------
|
||
def b_tp_rate
|
||
@last_tp.to_f / max_tp
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● スキルの消費 MP 計算 ※エイリアス
|
||
#--------------------------------------------------------------------------
|
||
alias konpaku_mp_skill_mp_cost skill_mp_cost
|
||
def skill_mp_cost(skill)
|
||
default = konpaku_mp_skill_mp_cost(skill)
|
||
if skill.note.include?("<全MP消費>")
|
||
return @mp > default ? @mp : default
|
||
elsif skill.note.include?("<最大MP消費>")
|
||
return mmp
|
||
else
|
||
return default
|
||
end
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● スキルの消費 TP 計算 ※エイリアス
|
||
#--------------------------------------------------------------------------
|
||
alias konpaku_sp_skill_tp_cost skill_tp_cost
|
||
def skill_tp_cost(skill)
|
||
cost = konpaku_sp_skill_tp_cost(skill)
|
||
cost += $1.to_i if skill.note =~ /\<消費追加:(\d+)\>/
|
||
cost = (cost * dwcr) if !skill.dual_omit
|
||
cost = (cost * tucr).to_i
|
||
if skill.note.include?("<全TP消費>")
|
||
return @tp > cost ? @tp : cost
|
||
elsif skill.note.include?("<最大TP消費>")
|
||
return max_tp
|
||
else
|
||
return cost
|
||
end
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ○ スキル使用前TPの取得 ※追加
|
||
#--------------------------------------------------------------------------
|
||
def last_tp
|
||
@last_tp
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ○ スキル使用前MPの取得 ※追加
|
||
#--------------------------------------------------------------------------
|
||
def last_mp
|
||
@last_mp
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● TP の変更 ※再定義
|
||
#--------------------------------------------------------------------------
|
||
def tp=(tp)
|
||
@tp = tp.to_i
|
||
refresh
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● リフレッシュ ※エイリアス TPをHPMPと同じように処理
|
||
#--------------------------------------------------------------------------
|
||
alias konpaku_refresh refresh
|
||
def refresh
|
||
konpaku_refresh
|
||
@tp = [[@tp, max_tp].min, 0].max
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ○ 宿屋処理
|
||
#--------------------------------------------------------------------------
|
||
def inn
|
||
recover_all
|
||
#clear_states
|
||
#@hp = mhp
|
||
#@mp = mmp
|
||
#@tp += (max_tp * 0.05).to_i #(@tp * 0.5).to_i
|
||
refresh
|
||
end
|
||
end
|
||
|
||
#==============================================================================
|
||
# ■ Game_Battler
|
||
#------------------------------------------------------------------------------
|
||
#==============================================================================
|
||
|
||
class Game_Battler < Game_BattlerBase
|
||
#--------------------------------------------------------------------------
|
||
# ● オブジェクト初期化 ※再定義
|
||
#--------------------------------------------------------------------------
|
||
alias konpaku_initialize initialize
|
||
def initialize
|
||
@last_tp = 0
|
||
@last_mp = 0
|
||
konpaku_initialize
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● TP の初期化 ※再定義
|
||
#--------------------------------------------------------------------------
|
||
def init_tp
|
||
self.tp = 0
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● スキル/アイテムの使用 ※エイリアス 現在のTPを行動前に@last_tpに格納
|
||
# 行動側に対して呼び出され、使用対象以外に対する効果を適用する。
|
||
#--------------------------------------------------------------------------
|
||
alias last_tp_use_item use_item
|
||
def use_item(item)
|
||
@last_tp = self.tp
|
||
@last_mp = self.mp
|
||
last_tp_use_item(item)
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● 戦闘開始処理 ※エイリアス @last_tp初期化追加
|
||
#--------------------------------------------------------------------------
|
||
alias last_tp_on_battle_start on_battle_start
|
||
def on_battle_start
|
||
last_tp_on_battle_start
|
||
@last_tp = 0
|
||
@last_mp = 0
|
||
end
|
||
=begin
|
||
#--------------------------------------------------------------------------
|
||
# ● 戦闘行動終了時の処理 ※エイリアス @last_tp初期化追加
|
||
#--------------------------------------------------------------------------
|
||
alias last_tp_on_action_end on_action_end
|
||
def on_action_end
|
||
last_tp_on_action_end
|
||
@last_tp = 0
|
||
end
|
||
=end
|
||
#--------------------------------------------------------------------------
|
||
# ● ターン終了処理 ※エイリアス @last_tp初期化追加
|
||
#--------------------------------------------------------------------------
|
||
alias last_tp_on_turn_end on_turn_end
|
||
def on_turn_end
|
||
last_tp_on_turn_end
|
||
@last_tp = 0
|
||
@last_mp = 0
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● 戦闘終了処理 ※エイリアス @last_tp初期化追加
|
||
#--------------------------------------------------------------------------
|
||
alias last_tp_on_battle_end on_battle_end
|
||
def on_battle_end
|
||
@last_tp = 0
|
||
@last_mp = 0
|
||
last_tp_on_battle_end
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● 被ダメージによる TP チャージ ※再定義
|
||
#--------------------------------------------------------------------------
|
||
def charge_tp_by_damage(damage_rate)
|
||
self.tp += 1 * tcr
|
||
end
|
||
end
|
||
|
||
#==============================================================================
|
||
# ■ Game_Actor
|
||
#------------------------------------------------------------------------------
|
||
#==============================================================================
|
||
|
||
class Game_Actor < Game_Battler
|
||
#attr_reader :max_tp
|
||
#--------------------------------------------------------------------------
|
||
# ● 全回復 ※オーバーライド
|
||
#--------------------------------------------------------------------------
|
||
def recover_all
|
||
super
|
||
@tp = max_tp
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● オブジェクト初期化
|
||
#--------------------------------------------------------------------------
|
||
#alias konpaku_act_initialize initialize
|
||
#def initialize(actor_id)
|
||
#@lv_tp = Spirit_Power.new(actor_id)
|
||
#konpaku_act_initialize(actor_id)
|
||
#end
|
||
#--------------------------------------------------------------------------
|
||
# ● TP の最大値を取得 ※追加
|
||
#--------------------------------------------------------------------------
|
||
def max_tp
|
||
return ((self.class.params_tp[@level] + soul_equip) * soul_equip_rate).to_i #@lv_tp.sp[@level] + soul_equip
|
||
#return SpiritSystem::LVSP[@level]
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ○ TP の装備品及び装備スキルの加算値を取得 ※追加
|
||
#--------------------------------------------------------------------------
|
||
def soul_equip
|
||
full_equip.inject(0) {|r, full_e| r += full_e.soul_plus }
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ○ TP の装備品及び装備スキルの加算倍率を取得 ※追加
|
||
#--------------------------------------------------------------------------
|
||
def soul_equip_rate
|
||
full_equip.inject(1.0) {|r, full_e| r *= full_e.soul_rate }
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ○
|
||
#--------------------------------------------------------------------------
|
||
def tucr
|
||
full_equip_plus_states.inject(super) {|r, full_e| r *= full_e.tp_cost_rate }
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ○
|
||
#--------------------------------------------------------------------------
|
||
def dwcr
|
||
full_equip.inject(super) {|r, full_e| r *= full_e.dual_cost_rate }
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# 〇 TP 確認
|
||
#--------------------------------------------------------------------------
|
||
def tp_check(lv = 10)
|
||
p "#{name} LV#{lv} TP:#{self.class.params_tp[lv]}"
|
||
end
|
||
end
|
||
|
||
#==============================================================================
|
||
# ■ Game_Party
|
||
#------------------------------------------------------------------------------
|
||
# パーティを扱うクラスです。所持金やアイテムなどの情報が含まれます。このクラ
|
||
# スのインスタンスは $game_party で参照されます。
|
||
#==============================================================================
|
||
|
||
class Game_Party < Game_Unit
|
||
#--------------------------------------------------------------------------
|
||
# ○ メンバーの宿屋処理
|
||
#--------------------------------------------------------------------------
|
||
def inn
|
||
all_members.each {|actor| actor.inn }
|
||
end
|
||
end
|
||
|
||
#==============================================================================
|
||
# ■ Game_Interpreter
|
||
#------------------------------------------------------------------------------
|
||
# イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、
|
||
# Game_Troop クラス、Game_Event クラスの内部で使用されます。
|
||
#==============================================================================
|
||
|
||
class Game_Interpreter
|
||
#--------------------------------------------------------------------------
|
||
# ○ 宿屋処理
|
||
#--------------------------------------------------------------------------
|
||
def inn
|
||
$game_party.inn
|
||
end
|
||
end
|
||
|
||
#==============================================================================
|
||
# ■ Game_Enemy
|
||
#------------------------------------------------------------------------------
|
||
#==============================================================================
|
||
|
||
class Game_Enemy < Game_Battler
|
||
#--------------------------------------------------------------------------
|
||
# ● TP の初期化 ※オーバーライド
|
||
#--------------------------------------------------------------------------
|
||
def init_tp
|
||
if enemy.note =~ /\<初期魂魄:(\d+)\>/
|
||
self.tp = $1.to_i
|
||
else
|
||
self.tp = max_tp
|
||
end
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● 通常能力値の基本値取得
|
||
#--------------------------------------------------------------------------
|
||
alias tp_param_base param_base
|
||
def param_base(param_id)
|
||
param_id == 8 ? enemy.mtp : tp_param_base(param_id) #tp_set : tp_param_base(param_id)
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● TP の最大値を取得 ※追加
|
||
#--------------------------------------------------------------------------
|
||
def max_tp
|
||
param_base(8)#tp_set
|
||
end
|
||
#--------------------------------------------------------------------------
|
||
# ● TP の最大値を取得 ※追加
|
||
#--------------------------------------------------------------------------
|
||
#def tp_set
|
||
#return $1.to_i if enemy.note =~ /\<魂魄力:(\d+)\>/
|
||
#return 10
|
||
#end
|
||
end
|
||
|
||
#==============================================================================
|
||
# ■ Window_SkillList
|
||
#------------------------------------------------------------------------------
|
||
# スキル画面で、使用できるスキルの一覧を表示するウィンドウです。
|
||
#==============================================================================
|
||
|
||
class Window_SkillList < Window_Selectable
|
||
#--------------------------------------------------------------------------
|
||
# ● スキルの使用コストを描画 ※再定義
|
||
#--------------------------------------------------------------------------
|
||
def draw_skill_cost(rect, skill)
|
||
x_plus = 0
|
||
unless @actor.skill_mp_cost(skill) == 0
|
||
change_color(mp_cost_color, enable?(skill))
|
||
draw_text(rect.x + rect.width - 26, rect.y, 30, 24, @actor.skill_mp_cost(skill), 2)
|
||
x_plus += 28
|
||
end
|
||
return if @actor.skill_tp_cost(skill) == 0
|
||
change_color(tp_cost_color, enable?(skill))
|
||
draw_text(rect.x + rect.width - 26 - x_plus, rect.y, 30, 24, @actor.skill_tp_cost(skill), 2)
|
||
end
|
||
end
|
||
|
||
class RPG::BaseItem
|
||
def soul_plus
|
||
@soul_plus ||= soul_plus_set
|
||
end
|
||
def soul_plus_set
|
||
self.note =~ /\<魂魄プラス:(\-?\+?\d+)\>/ ? $1.to_i : 0
|
||
end
|
||
def soul_rate
|
||
@soul_rate ||= soul_rate_set
|
||
end
|
||
def soul_rate_set
|
||
self.note =~ /\<魂魄上昇率:(\d+?\.?\d*?)\>/ ? $1.to_f : 1.0
|
||
end
|
||
def tp_cost_rate
|
||
@tp_cost_rate ||= tp_cost_rate_set
|
||
end
|
||
def tp_cost_rate_set
|
||
self.note =~ /\<TP消費率:(\d+?\.?\d*?)\>/ ? $1.to_f : 1.0
|
||
end
|
||
def dual_cost_rate
|
||
@duak_cost_rate ||= dual_cost_rate_set
|
||
end
|
||
def dual_cost_rate_set
|
||
self.note =~ /\<二刀流消費率:(\d+?\.?\d*?)\>/ ? $1.to_f : 1.0
|
||
end
|
||
end
|
||
|
||
class RPG::Skill < RPG::UsableItem
|
||
def dual_omit
|
||
@duak_omit ||= dual_omit_set
|
||
end
|
||
def dual_omit_set
|
||
self.note =~ /\<二刀流消費除外\>/
|
||
end
|
||
end
|
||
|