Last active
January 17, 2016 12:08
-
-
Save rutan/5280513 to your computer and use it in GitHub Desktop.
【RGSS3】[hzm]拡張スキルデータベース設定さん for RGSS3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
#=============================================================================== | |
# ■ [hzm]拡張スキルデータベース設定さん for RGSS3 | |
# ※ このスクリプトには「[hzm]メモ欄拡張共通部分 for RGSS3」が必要です | |
#------------------------------------------------------------------------------- | |
# 2016/01/17 Ru/むっくRu | |
#------------------------------------------------------------------------------- | |
# ※ このスクリプトは以下のスクリプトの後継スクリプトです | |
# ・[hzm]通常攻撃コスト設定 for RGSS3 | |
# ・[hzm]クリティカル率設定スキル for RGSS3 | |
# ・[hzm]連続回数拡張スキル for RGSS3 | |
# これらのスクリプトの機能をすべて内包しているので, | |
# このスクリプトを使用する場合は,同じプロジェクト内に | |
# 上記3つのスクリプトを入れないようにしてください | |
#------------------------------------------------------------------------------- | |
# スキル・武器のデータベースのいくつかの項目をメモ欄で設定できるようにします. | |
# また,消費HPの設定など,一部データベースに存在しない項目の設定もできます. | |
#------------------------------------------------------------------------------- | |
# 【使い方:スキル編】 | |
# 「データベース」の「スキル」の「メモ」欄に以下の記述を行うことで | |
# 通常のデータベース設定では設定できない値を設定できます. | |
# | |
# [hzm]項目名:値 | |
# | |
# 項目名の部分には,設定するデータの項目を入力します. | |
# 値の部分には,設定するデータの値を入力します. | |
# なお,値の部分には数値のほかに,計算式を入力することもできます. | |
# 計算式の記述方法はダメージ計算式のものに準拠しています. | |
# ただし,相手の情報(b)は使用することができません. | |
# | |
# 例)スキルに消費HP(100消費)を設定する場合 | |
# [hzm]消費HP:100 | |
# 例)スキルに消費MP(使用者最大MPの半分)を設定する場合 | |
# [hzm]消費MP:a.mmp/2 | |
# 例)スキルに連続回数(1~3回のランダム)を設定する場合 | |
# [hzm]連続回数:1+rand(3) | |
# | |
# 項目は以下の項目があります | |
# [hzm]消費HP:値 | |
# スキル使用時の消費HPを設定します. | |
# 使用者が戦闘不能になる場合は,そのスキルは使用できません. | |
# [hzm]消費MP:値 | |
# スキル使用時の消費MPを設定します. | |
# データベースの「消費MP」欄と同じです.メモ欄のものが優先されます. | |
# [hzm]消費TP:値 | |
# スキル使用時の消費TPを設定します. | |
# データベースの「消費TP」欄と同じです.メモ欄のものが優先されます. | |
# [hzm]速度補正:値 | |
# スキル使用時の速度補正を設定します. | |
# データベースの「速度補正」欄と同じです.メモ欄のものが優先されます. | |
# [hzm]成功率:値 | |
# スキル使用時の成功率を設定します. | |
# データベースの「成功率」欄と同じです.メモ欄のものが優先されます. | |
# [hzm]連続回数:値 | |
# スキル使用時の連続回数を設定します. | |
# データベースの「連続回数」欄と同じです.メモ欄のものが優先されます. | |
# [hzm]得HP:値 | |
# スキル使用時に回復するHP量を設定します. | |
# [hzm]得MP:値 | |
# スキル使用時に回復するMP量を設定します. | |
# [hzm]得TP:値 | |
# スキル使用時に回復するTP量を設定します. | |
# データベースの「得TP」欄と同じです.メモ欄のものが優先されます. | |
# [hzm]アニメーション:値 | |
# スキル使用時に表示するアニメーションのIDを設定します. | |
# データベースの「アニメーション」欄と同じです.メモ欄のものが優先されます. | |
# [hzm]クリティカル率:値 | |
# スキルの会心率を設定します. | |
# [hzm]必要ステート:値 | |
# 使用者が指定ステート状態でないとスキルを使用できないようにします. | |
# 値の欄に「,」区切りで複数のIDを設定できます. | |
# [hzm]禁止ステート:値 | |
# 使用者が指定ステート状態び場合スキルを使用できないようにします. | |
# 値の欄に「,」区切りで複数のIDを設定できます. | |
# | |
#------------------------------------------------------------------------------- | |
# 【使い方:武器編】 | |
# 「データベース」の「武器」の「メモ」欄に以下の記述を行うことで | |
# 通常のデータベース設定では設定できない値を設定できます. | |
# | |
# [hzm]項目名:値 | |
# | |
# 基本的な記述方法はスキルのものと一緒です. | |
# 以下の項目名が使用できます. | |
# | |
# [hzm]消費HP:値 | |
# 通常攻撃時の消費HPを設定します. | |
# 使用者が戦闘不能になる場合は,通常攻撃を使用できません. | |
# なお,二刀流時は2つの武器の合計分消費します. | |
# [hzm]消費MP:値 | |
# 通常攻撃時の消費MPを設定します. | |
# 使用者のMPが足りない場合は,通常攻撃を使用できません. | |
# なお,二刀流時は2つの武器の合計分消費します. | |
# [hzm]消費TP:値 | |
# 通常攻撃時の消費TPを設定します. | |
# 使用者のTPが足りない場合は,通常攻撃を使用できません. | |
# なお,二刀流時は2つの武器の合計分消費します. | |
# | |
#------------------------------------------------------------------------------- | |
# 【使い方:アイテム編】 | |
# 「データベース」の「アイテム」の「メモ」欄に以下の記述を行うことで | |
# 通常のデータベース設定では設定できない値を設定できます. | |
# | |
# [hzm]項目名:値 | |
# | |
# 基本的な記述方法はスキルのものと一緒です. | |
# 以下の項目名が使用できます. | |
# | |
# [hzm]消費HP:値 | |
# アイテム使用時の消費HPを設定します. | |
# 使用者が戦闘不能になる場合は,アイテムを使用できません. | |
# なお,マップで使用する場合はHPを消費しません. | |
# [hzm]消費MP:値 | |
# アイテム使用時の消費MPを設定します. | |
# 使用者のMPが足りない場合は,アイテムを使用できません. | |
# なお,マップで使用する場合はMPを消費しません. | |
# [hzm]消費TP:値 | |
# アイテム使用時の消費TPを設定します. | |
# 使用者のTPが足りない場合は,アイテムを使用できません. | |
# なお,マップで使用する場合はTPを消費しません. | |
# | |
#------------------------------------------------------------------------------- | |
# 【更新履歴】 | |
# 2016/01/17 不死身時に技が使えなくなるのを修正 | |
# 2012/06/04 禁止ステート設定を追加 | |
# 2012/04/01 アイテム消費コスト位置設定追加 | |
# 2012/03/31 消費HPを表示するよう変更.アイテム消費コスト表示(暫定) | |
# 2012/03/28 一部設定をアイテムにも適用できるよう変更(※まだ未完成です!) | |
# 2012/03/19 クリティカル率に計算式が使用できない不具合を修正 | |
# 2012/02/27 必要ステートの説明追加.ステート付与/解除をデフォルトで無効に. | |
# 2012/02/27 敵が「逃げる」を使用した際,強制終了する不具合を修正 | |
# 2012/02/12 ステート付与・解除メッセージが重複するのを仮対策 | |
# 2012/02/06 ステート付与・解除のタイミングをスキル終了後に変更 | |
# 2012/02/06 スキルにステート付与・ステート解除・必要ステートの項目を追加 | |
# 2012/02/04 ぶっぱ | |
#------------------------------------------------------------------------------- | |
#=============================================================================== | |
# ● 設定項目 | |
#=============================================================================== | |
module HZM_VXA | |
module ExItemSetting | |
#--------------------------------------------------------------------------- | |
# ● アイテムの拡張機能を使用するか? | |
#--------------------------------------------------------------------------- | |
USE_ITEM_FUNCTION = true | |
#--------------------------------------------------------------------------- | |
# ● アイテムの消費コストを個数の右に表示する | |
#--------------------------------------------------------------------------- | |
COST_RIGHT = false | |
end | |
end | |
#============================================================================== | |
# ↓ 以下、スクリプト部 ↓ | |
#============================================================================== | |
raise "[hzm] メモ欄取得スクリプトが必要です" unless defined?(HZM_VXA::Note) | |
raise "[hzm] メモ欄取得スクリプトのバージョンが異なります" unless HZM_VXA::Note::VERSION.to_f >= 2.00 and HZM_VXA::Note::VERSION.to_f < 3.0 | |
module HZM_VXA | |
module ExSkillSetting | |
#--------------------------------------------------------------------------- | |
# ● ステート付与,ステート解除の機能を使用するか? ※廃止予定 | |
# true …… 使用する | |
# false …… 使用しない | |
#--------------------------------------------------------------------------- | |
USE_ADD_STATE_FUNCTION = false | |
end | |
module ExSkillSetting | |
# メモ欄から読み込む要素名の候補を設定 | |
COST_HP_KEYS = ['消費HP', 'CostHP'] | |
COST_MP_KEYS = ['消費MP', 'CostMP'] | |
COST_TP_KEYS = ['消費TP', 'CostTP'] | |
SPEED_KEYS = ['速度補正', 'Speed'] | |
SUCCESS_KEYS = ['成功率', 'Success'] | |
REPEAT_KEYS = ['連続回数', 'Repeat'] | |
GET_HP_KEYS = ['得HP', 'GetHP'] | |
GET_MP_KEYS = ['得MP', 'GetMP'] | |
GET_TP_KEYS = ['得TP', 'GetTP'] | |
ANIMATION_KEYS = ['アニメーション', 'Animation'] | |
CRITICAL_KEYS = ['クリティカル率', 'クリティカル', 'Critical'] | |
REQUIRE_STATE_KEYS = ['必要ステート', 'RequireState'] | |
NO_REQUIRE_STATE_KEYS = ['禁止ステート', 'NoRequireState'] | |
# 非推奨機能 | |
if USE_ADD_STATE_FUNCTION | |
ADD_STATE_KEYS = ['ステート付与', 'AddState'] | |
REMOVE_STATE_KEYS = ['ステート解除', 'RemoveState'] | |
end | |
end | |
end | |
class RPG::UsableItem < RPG::BaseItem | |
attr_accessor :hp_gain | |
attr_accessor :mp_gain | |
def hp_gain | |
@hp_gain ||= 0 | |
end | |
def mp_gain | |
@mp_gain ||= 0 | |
end | |
end | |
# 共通処理 | |
class Game_BattlerBase | |
#-------------------------------------------------------------------------- | |
# ● 計算処理(独自) | |
#-------------------------------------------------------------------------- | |
def hzm_exskill_eval(str, a = nil, b = nil) | |
a = self unless a | |
b = self unless b | |
return eval(str.to_s).to_i | |
end | |
end | |
# 拡張スキル設定 | |
class Game_BattlerBase | |
#-------------------------------------------------------------------------- | |
# ● スキルが通常攻撃であるか?(独自) | |
#-------------------------------------------------------------------------- | |
def hzm_exskill_attack_skill?(skill) | |
skill == $data_skills[attack_skill_id] | |
end | |
#-------------------------------------------------------------------------- | |
# ● スキル使用コストの支払い(エイリアス) | |
#-------------------------------------------------------------------------- | |
alias hzm_exskill_pay_skill_cost pay_skill_cost | |
def pay_skill_cost(skill) | |
self.hp -= skill_hp_cost(skill) | |
hzm_exskill_pay_skill_cost(skill) | |
end | |
#-------------------------------------------------------------------------- | |
# ● スキル使用コストの支払い可能判定(エイリアス) | |
#-------------------------------------------------------------------------- | |
alias hzm_exskill_skill_cost_payable? skill_cost_payable? | |
def skill_cost_payable?(skill) | |
# 元の処理 | |
return false unless hzm_exskill_skill_cost_payable?(skill) | |
# 消費HP拡張 | |
comparison_operator = state_resist?(death_state_id) ? :>= : :> | |
return false unless hp.public_send(comparison_operator, hzm_vxa_note_ex_skill_setting_skill_hp_cost(skill)) | |
# 必要ステート拡張 | |
data = skill.hzm_vxa_note_match(HZM_VXA::ExSkillSetting::REQUIRE_STATE_KEYS) | |
data.each {|state_id| return false unless state?(state_id)} if data | |
# 禁止ステート拡張 | |
data = skill.hzm_vxa_note_match(HZM_VXA::ExSkillSetting::NO_REQUIRE_STATE_KEYS) | |
data.each {|state_id| return false if state?(state_id)} if data | |
true | |
end | |
#-------------------------------------------------------------------------- | |
# ● スキルの消費 HP 計算(独自) | |
#-------------------------------------------------------------------------- | |
def hzm_vxa_note_ex_skill_setting_skill_hp_cost(skill) | |
data = skill.hzm_vxa_note_match(HZM_VXA::ExSkillSetting::COST_HP_KEYS) | |
return hzm_exskill_eval(data.join(',')) if data | |
0 | |
end | |
alias skill_hp_cost hzm_vxa_note_ex_skill_setting_skill_hp_cost | |
#-------------------------------------------------------------------------- | |
# ● スキルの消費 MP 計算(エイリアス) | |
#-------------------------------------------------------------------------- | |
alias hzm_vxa_note_ex_skill_setting_skill_mp_cost skill_mp_cost | |
def skill_mp_cost(skill) | |
# 消費MP拡張 | |
data = skill.hzm_vxa_note_match(HZM_VXA::ExSkillSetting::COST_MP_KEYS) | |
return (hzm_exskill_eval(data.join(',')) * mcr).to_i if data | |
# 元の処理 | |
hzm_vxa_note_ex_skill_setting_skill_mp_cost(skill) | |
end | |
#-------------------------------------------------------------------------- | |
# ● スキルの消費 TP 計算(エイリアス) | |
#-------------------------------------------------------------------------- | |
alias hzm_vxa_note_ex_skill_setting_skill_tp_cost skill_tp_cost | |
def skill_tp_cost(skill) | |
# 消費MP拡張 | |
data = skill.hzm_vxa_note_match(HZM_VXA::ExSkillSetting::COST_TP_KEYS) | |
return hzm_exskill_eval(data.join(',')) if data | |
# 元の処理 | |
hzm_vxa_note_ex_skill_setting_skill_tp_cost(skill) | |
end | |
end | |
class Game_Battler < Game_BattlerBase | |
#-------------------------------------------------------------------------- | |
# ● スキル/アイテムの使用(エイリアス) | |
#-------------------------------------------------------------------------- | |
alias hzm_vxa_ex_skill_setting_use_item use_item | |
def use_item(item) | |
# 連続回数拡張 | |
data = item.hzm_vxa_note_match(HZM_VXA::ExSkillSetting::REPEAT_KEYS) | |
item.repeats = [hzm_exskill_eval(data.join(',')), 1].max if data | |
# アニメーション拡張 | |
data = item.hzm_vxa_note_match(HZM_VXA::ExSkillSetting::ANIMATION_KEYS) | |
item.animation_id = [hzm_exskill_eval(data.join(',')), 1].max if data | |
# 元の処理 | |
hzm_vxa_ex_skill_setting_use_item(item) | |
end | |
#-------------------------------------------------------------------------- | |
# ● スキル/アイテムの使用者側への効果(エイリアス) | |
#-------------------------------------------------------------------------- | |
alias hzm_vxa_ex_skill_setting_item_user_effect item_user_effect | |
def item_user_effect(user, item) | |
# 得HP,得MP,得TP拡張 | |
data = item.hzm_vxa_note_match(HZM_VXA::ExSkillSetting::GET_HP_KEYS) | |
item.hp_gain = hzm_exskill_eval(data.join(','), user, self) if data | |
data = item.hzm_vxa_note_match(HZM_VXA::ExSkillSetting::GET_MP_KEYS) | |
item.mp_gain = hzm_exskill_eval(data.join(','), user, self) if data | |
data = item.hzm_vxa_note_match(HZM_VXA::ExSkillSetting::GET_TP_KEYS) | |
item.tp_gain = hzm_exskill_eval(data.join(','), user, self) if data | |
user.hp += item.hp_gain | |
user.mp += item.mp_gain | |
# 元の処理 | |
hzm_vxa_ex_skill_setting_item_user_effect(user, item) | |
end | |
#-------------------------------------------------------------------------- | |
# ● スキル/アイテムの会心率計算(エイリアス) | |
#-------------------------------------------------------------------------- | |
alias hzm_vxa_ex_skill_setting_item_cri item_cri | |
def item_cri(user, item) | |
# クリティカル率拡張 | |
data = item.hzm_vxa_note_match(HZM_VXA::ExSkillSetting::CRITICAL_KEYS) | |
return hzm_exskill_eval(data.join(','), user, self) / 100.0 if data | |
# 元の処理 | |
hzm_vxa_ex_skill_setting_item_cri(user, item) | |
end | |
#-------------------------------------------------------------------------- | |
# ● スキル/アイテムの命中率計算(エイリアス) | |
#-------------------------------------------------------------------------- | |
alias hzm_vxa_ex_skill_setting_item_hit item_hit | |
def item_hit(user, item) | |
# 成功率拡張 | |
data = item.hzm_vxa_note_match(HZM_VXA::ExSkillSetting::SUCCESS_KEYS) | |
item.success_rate = [hzm_exskill_eval(data.join(',')), 0].max if data | |
# 元の処理 | |
hzm_vxa_ex_skill_setting_item_hit(user, item) | |
end | |
end | |
class Game_Actor < Game_Battler | |
#-------------------------------------------------------------------------- | |
# ● スキルの消費 HP 計算 | |
#-------------------------------------------------------------------------- | |
def hzm_vxa_note_ex_skill_setting_skill_hp_cost(skill) | |
hzm_exskill_attack_skill?(skill) ? hzm_vxa_note_ex_skill_setting_weapon_hp_cost : super | |
end | |
#-------------------------------------------------------------------------- | |
# ● スキルの消費 MP 計算 | |
#-------------------------------------------------------------------------- | |
def skill_mp_cost(skill) | |
hzm_exskill_attack_skill?(skill) ? hzm_vxa_note_ex_skill_setting_weapon_mp_cost : super | |
end | |
#-------------------------------------------------------------------------- | |
# ● スキルの消費 TP 計算 | |
#-------------------------------------------------------------------------- | |
def skill_tp_cost(skill) | |
hzm_exskill_attack_skill?(skill) ? hzm_vxa_note_ex_skill_setting_weapon_tp_cost : super | |
end | |
#-------------------------------------------------------------------------- | |
# ● 装備による通常攻撃の消費 HP 計算(独自) | |
#-------------------------------------------------------------------------- | |
def hzm_vxa_note_ex_skill_setting_weapon_hp_cost | |
cost = 0 | |
weapons.each do |weapon| | |
data = weapon.hzm_vxa_note_match(HZM_VXA::ExSkillSetting::COST_HP_KEYS) | |
cost += hzm_exskill_eval(data.join(',')) if data | |
end | |
cost | |
end | |
#-------------------------------------------------------------------------- | |
# ● 装備による通常攻撃の消費 MP 計算(独自) | |
#-------------------------------------------------------------------------- | |
def hzm_vxa_note_ex_skill_setting_weapon_mp_cost | |
cost = 0 | |
weapons.each do |weapon| | |
data = weapon.hzm_vxa_note_match(HZM_VXA::ExSkillSetting::COST_MP_KEYS) | |
cost += hzm_exskill_eval(data.join(',')) if data | |
end | |
cost | |
end | |
#-------------------------------------------------------------------------- | |
# ● 装備による通常攻撃の消費 TP 計算(独自) | |
#-------------------------------------------------------------------------- | |
def hzm_vxa_note_ex_skill_setting_weapon_tp_cost | |
cost = 0 | |
weapons.each do |weapon| | |
data = weapon.hzm_vxa_note_match(HZM_VXA::ExSkillSetting::COST_TP_KEYS) | |
cost += hzm_exskill_eval(data.join(',')) if data | |
end | |
cost | |
end | |
end | |
class Game_Action | |
#-------------------------------------------------------------------------- | |
# ● 行動速度の計算(エイリアス) | |
#-------------------------------------------------------------------------- | |
alias hzm_vxa_ex_skill_setting_speed speed | |
def speed | |
# 速度補正拡張 | |
if item | |
data = item.hzm_vxa_note_match(HZM_VXA::ExSkillSetting::SPEED_KEYS) | |
item.speed = @subject.hzm_exskill_eval(data.join(',')) if data | |
end | |
# 元の処理 | |
hzm_vxa_ex_skill_setting_speed | |
end | |
end | |
# スキル:消費HP表示 | |
class Window_Base < Window | |
unless defined?(hp_cost_color) | |
def hp_cost_color; text_color(20); end; | |
end | |
end | |
class Window_SkillList < Window_Selectable | |
#-------------------------------------------------------------------------- | |
# ● スキルの使用コストを描画(再定義) | |
#-------------------------------------------------------------------------- | |
def draw_skill_cost(rect, skill) | |
if @actor.skill_tp_cost(skill) > 0 | |
change_color(tp_cost_color, enable?(skill)) | |
draw_text(rect, @actor.skill_tp_cost(skill), 2) | |
elsif @actor.skill_mp_cost(skill) > 0 | |
change_color(mp_cost_color, enable?(skill)) | |
draw_text(rect, @actor.skill_mp_cost(skill), 2) | |
elsif @actor.skill_hp_cost(skill) > 0 | |
change_color(hp_cost_color, enable?(skill)) | |
draw_text(rect, @actor.skill_hp_cost(skill), 2) | |
end | |
end | |
end | |
# アイテム | |
if HZM_VXA::ExItemSetting::USE_ITEM_FUNCTION | |
class Game_Party < Game_Unit | |
#-------------------------------------------------------------------------- | |
# ● スキル/アイテムの使用可能判定(独自) | |
# ※アイテム欄に黒字表示するためにコスト計算無し版を用意 | |
#-------------------------------------------------------------------------- | |
def hzm_vxa_exSkillSettingItem_usable?(item) | |
members.any? {|actor| actor.hzm_vxa_exSkillSettingItem_usable?(item) } | |
end | |
end | |
class Game_BattlerBase | |
#-------------------------------------------------------------------------- | |
# ● スキル/アイテムの使用可能判定(独自) | |
# ※アイテム欄に黒字表示するためにコスト計算無し版を用意 | |
#-------------------------------------------------------------------------- | |
def hzm_vxa_exSkillSettingItem_usable?(item) | |
return skill_conditions_met?(item) if item.is_a?(RPG::Skill) | |
return hzm_vxa_ex_skill_setting_item_conditions_met?(item) if item.is_a?(RPG::Item) | |
return false | |
end | |
#--------------------------------------------------------------------------- | |
# ● アイテムの使用可能条件チェック(エイリアス) | |
#--------------------------------------------------------------------------- | |
alias hzm_vxa_ex_skill_setting_item_conditions_met? item_conditions_met? | |
def item_conditions_met?(item) | |
hzm_vxa_ex_skill_setting_item_conditions_met?(item) and | |
hzm_vxa_ex_skill_setting_item_cost_payable?(item) | |
end | |
#--------------------------------------------------------------------------- | |
# ● アイテムの消費 HP 計算(独自) | |
#--------------------------------------------------------------------------- | |
def hzm_vxa_ex_skill_setting_item_hp_cost(item) | |
return 0 unless $game_party.in_battle | |
data = item.hzm_vxa_note_match(HZM_VXA::ExSkillSetting::COST_HP_KEYS) | |
return hzm_exskill_eval(data.join(',')) if data | |
0 | |
end | |
#--------------------------------------------------------------------------- | |
# ● アイテムの消費 MP 計算(独自) | |
#--------------------------------------------------------------------------- | |
def hzm_vxa_ex_skill_setting_item_mp_cost(item) | |
return 0 unless $game_party.in_battle | |
data = item.hzm_vxa_note_match(HZM_VXA::ExSkillSetting::COST_MP_KEYS) | |
return hzm_exskill_eval(data.join(',')) if data | |
0 | |
end | |
#--------------------------------------------------------------------------- | |
# ● アイテムの消費 TP 計算(独自) | |
#--------------------------------------------------------------------------- | |
def hzm_vxa_ex_skill_setting_item_tp_cost(item) | |
return 0 unless $game_party.in_battle | |
data = item.hzm_vxa_note_match(HZM_VXA::ExSkillSetting::COST_TP_KEYS) | |
return hzm_exskill_eval(data.join(',')) if data | |
0 | |
end | |
#-------------------------------------------------------------------------- | |
# ● アイテム使用コストの支払い可能判定(独自) | |
#-------------------------------------------------------------------------- | |
def hzm_vxa_ex_skill_setting_item_cost_payable?(item) | |
self.hp > hzm_vxa_ex_skill_setting_item_hp_cost(item) and | |
self.mp >= hzm_vxa_ex_skill_setting_item_mp_cost(item) and | |
self.tp >= hzm_vxa_ex_skill_setting_item_tp_cost(item) | |
end | |
#--------------------------------------------------------------------------- | |
# ● アイテム使用コストの支払い(独自) | |
#--------------------------------------------------------------------------- | |
def hzm_vxa_ex_skill_setting_pay_item_cost(item) | |
self.hp -= hzm_vxa_ex_skill_setting_item_hp_cost(item) | |
self.mp -= hzm_vxa_ex_skill_setting_item_mp_cost(item) | |
self.tp -= hzm_vxa_ex_skill_setting_item_tp_cost(item) | |
end | |
end | |
class Game_Battler < Game_BattlerBase | |
#--------------------------------------------------------------------------- | |
# ● スキル/アイテムの使用(エイリアス) | |
#--------------------------------------------------------------------------- | |
alias hzm_vxa_exSkillSettingItem_use_item use_item | |
def use_item(item) | |
hzm_vxa_ex_skill_setting_pay_item_cost(item) if item.is_a?(RPG::Item) and $game_party.in_battle | |
hzm_vxa_exSkillSettingItem_use_item(item) | |
end | |
end | |
class Window_BattleItem < Window_ItemList | |
#--------------------------------------------------------------------------- | |
# ● アイテムを許可状態で表示するかどうか(再定義) | |
#--------------------------------------------------------------------------- | |
alias hzm_vxa_ex_skill_setting_enable? enable? | |
def enable?(item) | |
BattleManager.actor.usable?(item) | |
end | |
#--------------------------------------------------------------------------- | |
# ● アイテムをリストに含めるかどうか(再定義) | |
#--------------------------------------------------------------------------- | |
def include?(item) | |
$game_party.hzm_vxa_exSkillSettingItem_usable?(item) | |
end | |
#--------------------------------------------------------------------------- | |
# ● 項目の描画(再定義) | |
#--------------------------------------------------------------------------- | |
if HZM_VXA::ExItemSetting::COST_RIGHT | |
# コストを右に表示 | |
def draw_item(index) | |
item = @data[index] | |
if item | |
rect = item_rect(index) | |
rect.width -= 4 | |
draw_item_name(item, rect.x, rect.y, enable?(item), rect.width - 84) | |
rect.width -= 4 + 32 | |
draw_item_number(rect, item) | |
rect.width += 4 + 32 | |
hzm_vxa_ex_skill_setting_draw_item_cost(rect, item) | |
end | |
end | |
else | |
# コストを左に表示 | |
def draw_item(index) | |
super | |
item = @data[index] | |
if item | |
rect = item_rect(index) | |
rect.width -= 4 + 32 | |
hzm_vxa_ex_skill_setting_draw_item_cost(rect, item) | |
end | |
end | |
end | |
#--------------------------------------------------------------------------- | |
# ● アイテムの使用コストを描画(独自) | |
#--------------------------------------------------------------------------- | |
def hzm_vxa_ex_skill_setting_draw_item_cost(rect, item) | |
actor = BattleManager.actor | |
if actor.hzm_vxa_ex_skill_setting_item_tp_cost(item) > 0 | |
change_color(tp_cost_color, enable?(item)) | |
draw_text(rect, actor.hzm_vxa_ex_skill_setting_item_tp_cost(item), 2) | |
elsif actor.hzm_vxa_ex_skill_setting_item_mp_cost(item) > 0 | |
change_color(mp_cost_color, enable?(item)) | |
draw_text(rect, actor.hzm_vxa_ex_skill_setting_item_mp_cost(item), 2) | |
elsif actor.hzm_vxa_ex_skill_setting_item_hp_cost(item) > 0 | |
change_color(hp_cost_color, enable?(item)) | |
draw_text(rect, actor.hzm_vxa_ex_skill_setting_item_hp_cost(item), 2) | |
end | |
end | |
end | |
end | |
# 非推奨機能:ステート(別スクリプトにするかも) | |
if HZM_VXA::ExSkillSetting::USE_ADD_STATE_FUNCTION | |
class Scene_Battle < Scene_Base | |
#-------------------------------------------------------------------------- | |
# ● スキル/アイテムの使用(エイリアス) | |
#-------------------------------------------------------------------------- | |
alias hzm_vxa_ex_skill_setting_use_item use_item | |
def use_item | |
# 元の処理 | |
hzm_vxa_ex_skill_setting_use_item | |
return unless @subject.current_action | |
# ステート付与・解除拡張 | |
@subject.result.clear_status_effects | |
item = @subject.current_action.item | |
data = item.hzm_vxa_note_match(HZM_VXA::ExSkillSetting::ADD_STATE_KEYS) | |
if data | |
data.each do |state_id| | |
@subject.add_state(state_id) | |
end | |
end | |
data = item.hzm_vxa_note_match(HZM_VXA::ExSkillSetting::REMOVE_STATE_KEYS) | |
if data | |
data.each do |state_id| | |
@subject.remove_state(state_id) | |
end | |
end | |
# 変化ステート表示 | |
@log_window.display_changed_states(@subject) if @log_window | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment