Last active
October 11, 2015 07:57
-
-
Save rutan/3826958 to your computer and use it in GitHub Desktop.
[hzm]ターン消費無しスキル for RGSS3 ※このスクリプトは古いバージョンです
新しいのはこっち↓
https://gist.github.com/rutan/3840070
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」が必要です | |
#------------------------------------------------------------------------------- | |
# 2012/10/03 Ru/むっくRu | |
#------------------------------------------------------------------------------- | |
# 【注意】 | |
# このスクリプトは古いバージョンです。 | |
# 新しいバージョンは↓で公開しています。 | |
# | |
# [hzm]ターン消費無しスキルさん+ for RGSS3 | |
# https://gist.github.com/rutan/3840070/raw/readNote2_quickSkill.rb | |
#------------------------------------------------------------------------------- | |
# ターンを消費せずに,選択した瞬間に発動するスキルを設定します. | |
# | |
# 【使い方】 | |
# ・「データベース」の「スキル」または「アイテム」の | |
# 「メモ」に以下の内容を記述してください | |
# | |
# [hzm]即発動 | |
# | |
#------------------------------------------------------------------------------- | |
# 【注意】 | |
# 「[hzm]拡張スキルデータベース設定さん for RGSS3」を導入している場合は, | |
# 必ずそれより下に設置するようにしてください. | |
# | |
# また,エネミーにもターン消費無しスキルを設定する場合は, | |
# 「各行動ごとに行動順を設定さん for RGSS3」の導入が必要です. | |
#------------------------------------------------------------------------------- | |
# 【既知の不具合】 | |
# ステート付与と相性が悪いです. | |
# 能力値上昇程度のものであれば問題ありませんが, | |
# 行動不能系(戦闘不能など)を付与すると, | |
# 操作ができなくなったりすることがあります. | |
# | |
# 対応まで少し時間かかりそうです…… | |
#------------------------------------------------------------------------------- | |
# 【更新履歴】 | |
# 2012/10/03 行動回数の再計算(暫定)を追加 | |
# 2012/06/01 エネミー用設定を追加 | |
# 2012/04/21 複数回行動するアクターが正常に動作しない不具合を修正 | |
# 2012/04/01 味方の行動不能状態を回復した際に強制終了する不具合を修正 | |
# 2012/03/28 アイテムにも対応 | |
# 2012/01/28 コモンイベント内で「戦闘行動の強制」を使用した際に強制終了するのを修正 | |
# 2012/01/28 コモンイベントの呼び出しが正常に動作しないのを少し修正 | |
# 2012/01/03 ぶっぱ | |
#------------------------------------------------------------------------------- | |
#============================================================================== | |
# ● 設定項目 | |
#============================================================================== | |
module HZM_VXA | |
module QuickSkill | |
# ● エネミーにもターン消費無し行動を適用するか? | |
# true : する | |
# false : しない | |
# ※この機能を使用する場合は, | |
# 「各行動ごとに行動順を設定さん for RGSS3」が必要です | |
USE_ENEMY = true | |
# ● ターン消費無し行動後に行動回数を再計算する | |
# true : する | |
# false : しない | |
# ※注意:暫定機能です.また,プレイヤー側のみに適用されます. | |
CHECK_ACTION_TIMES = 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 QuickSkill | |
# メモ欄から読み込む要素名の候補を設定 | |
KEYS = ['即発動', 'QuickSkill'] | |
# 行動回数の限界値(無限ループ回避) | |
MAX_ACTIONS = 50 | |
#--------------------------------------------------------------------------- | |
# ● QuickSkill中か? | |
#--------------------------------------------------------------------------- | |
def self.quickSkill? | |
@quickSkill | |
end | |
#--------------------------------------------------------------------------- | |
# ● 即時行動開始 | |
#--------------------------------------------------------------------------- | |
def self.start | |
@quickSkill = true | |
end | |
#--------------------------------------------------------------------------- | |
# ● 即時行動終了 | |
#--------------------------------------------------------------------------- | |
def self.finish | |
@quickSkill = false | |
# 全てのbattlerのアクションを戻す | |
$game_party.hzm_vxa_quickSkill_force_action_reverse | |
$game_troop.hzm_vxa_quickSkill_force_action_reverse | |
end | |
end | |
end | |
class Game_Battler < Game_BattlerBase | |
#----------------------------------------------------------------------------- | |
# ● 戦闘行動の強制(エイリアス) | |
#----------------------------------------------------------------------------- | |
alias hzm_vxa_quickSkill_force_action force_action | |
def force_action(skill_id, target_index) | |
@hzm_vxa_quickSkill_actions = HZM_VXA::QuickSkill.quickSkill? ? @actions.clone : nil | |
hzm_vxa_quickSkill_force_action(skill_id, target_index) | |
end | |
#----------------------------------------------------------------------------- | |
# ● 戦闘行動の復元(独自) | |
#----------------------------------------------------------------------------- | |
def hzm_vxa_quickSkill_force_action_reverse | |
return unless @hzm_vxa_quickSkill_actions | |
@actions = @hzm_vxa_quickSkill_actions | |
@hzm_vxa_quickSkill_actions = nil | |
end | |
end | |
class Game_Actor < Game_Battler | |
#----------------------------------------------------------------------------- | |
# ● アクションを先頭に入れ替え | |
#----------------------------------------------------------------------------- | |
def hzm_vxa_quickSkill_swapAction | |
tmp = @actions[0] | |
@actions[0] = @actions[@action_input_index] | |
@actions[@action_input_index] = tmp | |
end | |
#----------------------------------------------------------------------------- | |
# ● 行動回数の再計算 | |
#----------------------------------------------------------------------------- | |
def hzm_vxa_quickSkill_re_action_times | |
action_cnt = make_action_times | |
@actions.push Game_Action.new(self) while @actions.size < action_cnt | |
@actions.pop while @actions.size > action_cnt | |
end | |
end | |
class Game_Unit | |
#----------------------------------------------------------------------------- | |
# ● 戦闘行動の復元(独自) | |
#----------------------------------------------------------------------------- | |
def hzm_vxa_quickSkill_force_action_reverse | |
members.each {|member| member.hzm_vxa_quickSkill_force_action_reverse } | |
end | |
end | |
class Scene_Battle < Scene_Base | |
#-------------------------------------------------------------------------- | |
# ● 情報表示ビューポートの更新 | |
#-------------------------------------------------------------------------- | |
alias hzm_vxa_quickSkill_update_info_viewport update_info_viewport | |
def update_info_viewport | |
hzm_vxa_quickSkill_update_info_viewport | |
move_info_viewport(64) if @hzm_vxa_quickSkill_active | |
end | |
#-------------------------------------------------------------------------- | |
# ● 次のコマンド入力へ(エイリアス) | |
#-------------------------------------------------------------------------- | |
alias hzm_vxa_quickSkill_next_command next_command | |
def next_command | |
if @hzm_vxa_quickSkill_skill and @hzm_vxa_quickSkill_skill.hzm_vxa_note_match(HZM_VXA::QuickSkill::KEYS) | |
@hzm_vxa_quickSkill_skill = nil | |
# 行動の開始 | |
HZM_VXA::QuickSkill::start | |
@actor_command_window.close if @actor_command_window | |
@hzm_vxa_quickSkill_active = true | |
# 行動アクター,行動内容の設定 | |
@subject = BattleManager.actor | |
@subject.hzm_vxa_quickSkill_swapAction # 選んだ行動を先頭に引きずり出す | |
# 行動 | |
execute_action | |
# イベント処理 | |
process_event | |
# おわり | |
@subject.hzm_vxa_quickSkill_swapAction # 元の位置に戻す | |
HZM_VXA::QuickSkill::finish | |
# ウィンドウを戻す | |
@hzm_vxa_quickSkill_active = false | |
@actor_command_window.open if @actor_command_window | |
@status_window.open if @status_window | |
# 行動回数が増えたりしてるかチェック(※ただし自分に限る) | |
@subject.hzm_vxa_quickSkill_re_action_times if HZM_VXA::QuickSkill::CHECK_ACTION_TIMES | |
# もう一度自分のターン | |
start_actor_command_selection | |
else | |
hzm_vxa_quickSkill_next_command | |
end | |
end | |
#-------------------------------------------------------------------------- | |
# ● スキル[決定](エイリアス) | |
#-------------------------------------------------------------------------- | |
alias hzm_vxa_quickSkill_on_skill_ok on_skill_ok | |
def on_skill_ok | |
@hzm_vxa_quickSkill_skill = @skill_window.item | |
hzm_vxa_quickSkill_on_skill_ok | |
end | |
#-------------------------------------------------------------------------- | |
# ● スキル[キャンセル](エイリアス) | |
#-------------------------------------------------------------------------- | |
alias hzm_vxa_quickSkill_on_skill_cancel on_skill_cancel | |
def on_skill_cancel | |
@hzm_vxa_quickSkill_skill = nil | |
hzm_vxa_quickSkill_on_skill_cancel | |
end | |
#-------------------------------------------------------------------------- | |
# ● アイテム[決定](エイリアス) | |
#-------------------------------------------------------------------------- | |
alias hzm_vxa_quickSkill_on_item_ok on_item_ok | |
def on_item_ok | |
@hzm_vxa_quickSkill_skill = @item_window.item | |
hzm_vxa_quickSkill_on_item_ok | |
end | |
#-------------------------------------------------------------------------- | |
# ● アイテム[キャンセル](エイリアス) | |
#-------------------------------------------------------------------------- | |
alias hzm_vxa_quickSkill_on_item_cancel on_item_cancel | |
def on_item_cancel | |
@hzm_vxa_quickSkill_skill = nil | |
hzm_vxa_quickSkill_on_item_cancel | |
end | |
#-------------------------------------------------------------------------- | |
# ● アクターコマンド選択の開始(エイリアス) | |
#-------------------------------------------------------------------------- | |
alias hzm_vxa_quickSkill_ostart_actor_command_selection start_actor_command_selection | |
def start_actor_command_selection | |
hzm_vxa_quickSkill_ostart_actor_command_selection | |
BattleManager.actor.make_actions unless BattleManager.actor.input | |
end | |
end | |
# エネミー用の処理 | |
if HZM_VXA::QuickSkill::USE_ENEMY | |
class Game_Action | |
#----------------------------------------------------------------------------- | |
# ● 行動速度の計算(エイリアス) | |
#----------------------------------------------------------------------------- | |
alias hzm_vxa_quickSkillEnemy_speed speed | |
def speed | |
# 速度補正拡張 | |
if item | |
data = item.hzm_vxa_note_match(HZM_VXA::QuickSkill::KEYS) | |
item.speed = 65535 if data | |
end | |
# 元の処理 | |
hzm_vxa_quickSkillEnemy_speed | |
end | |
end | |
class Game_Enemy < Game_Battler | |
#----------------------------------------------------------------------------- | |
# ● 戦闘行動をランダムに選択(エイリアス) | |
#----------------------------------------------------------------------------- | |
alias hzm_vxa_quickSkillEnemy_select_enemy_action select_enemy_action | |
def select_enemy_action(action_list, rating_zero) | |
action = hzm_vxa_quickSkillEnemy_select_enemy_action(action_list, rating_zero) | |
if action and $data_skills[action.skill_id].hzm_vxa_note_match(HZM_VXA::QuickSkill::KEYS) | |
@actions.push Game_Action.new(self) if @actions.size < HZM_VXA::QuickSkill::MAX_ACTIONS | |
end | |
action | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment