#==============================================================================
# 「変化スキル」(ACE) ver1.0
# 製作者:奈々(なな)
# へぷたなすくろーる http://heptanas.mamagoto.com/
#
# ◇使用規約
# 使用される場合はスクリプト作成者として「奈々」を明記して下さい。
# このスクリプトを改変したり、改変したものを配布するなどは自由ですが
# その場合も元のスクリプトの作成者として名前は載せて下さい。
#
#------------------------------------------------------------------------------
#
# スキルのメモ欄で<スキル変化 ID>と記述します。(複数可能)
# このスキルを親スキル、指定したIDのスキルを子スキルと呼びます。
# スキル使用で親スキルを選択すると、子スキルの一覧が表示され
# その子スキルを選んで使用することになります。
#
# スキルの性能やコストなどは全て子スキルのものが使われ、親スキルは無関係です。
# 但し親スキルの使用条件を満たしていないと一覧が表示されないため
# 例えば親スキルがMP10消費であれば、MP10未満のときは子スキルを使用できません。
#
# 変化は一段階のみ有効ですので、子スキルから更に孫スキルに派生はしません。
# よって<スキル変化 ID>で親スキル自身のIDを登録することも可能です。
#
#==============================================================================
class RPG::Skill < RPG::UsableItem
#--------------------------------------------------------------------------
# ● 変化先スキルの定義(追加定義)
#--------------------------------------------------------------------------
def changetoskills
list = []
@note.scan(/<スキル変化\s?(\d*)>/) {|s|
list.push($data_skills[$1.to_i]) if $1
}
return list
end
end
#==============================================================================
# ■ Scene_Battle
#------------------------------------------------------------------------------
# バトル画面の処理を行うクラスです。
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ● 全ウィンドウの作成
#--------------------------------------------------------------------------
alias create_all_windows2 create_all_windows
def create_all_windows
create_all_windows2
create_changetoskill_window
end
#--------------------------------------------------------------------------
# ● 変化先スキルウィンドウの作成
#--------------------------------------------------------------------------
def create_changetoskill_window
@changetoskill_window = Window_BattleChangetoSkill.new(@help_window, @info_viewport)
@changetoskill_window.set_handler(:ok, method(:on_changetoskill_ok))
@changetoskill_window.set_handler(:cancel, method(:on_changetoskill_cancel))
end
#--------------------------------------------------------------------------
# ● スキル[決定]
#--------------------------------------------------------------------------
def on_skill_ok
@skill = @skill_window.item
if @skill.changetoskills != []
@skill_window.hide
@changetoskill_window.actor = BattleManager.actor
@changetoskill_window.changetoskills = @skill.changetoskills
@changetoskill_window.show.activate
return
end
BattleManager.actor.input.set_skill(@skill.id)
BattleManager.actor.last_skill.object = @skill
if !@skill.need_selection?
@skill_window.hide
next_command
elsif @skill.for_opponent?
select_enemy_selection
else
select_actor_selection
end
end
#--------------------------------------------------------------------------
# ● 変化先スキル[決定]
#--------------------------------------------------------------------------
def on_changetoskill_ok
@changetoskill = @changetoskill_window.item
BattleManager.actor.input.set_skill(@changetoskill.id)
BattleManager.actor.last_skill.object = @changetoskill
if !@changetoskill.need_selection?
@changetoskill_window.hide
next_command
elsif @changetoskill.for_opponent?
select_enemy_selection
else
select_actor_selection
end
end
#--------------------------------------------------------------------------
# ● 変化先スキル[キャンセル]
#--------------------------------------------------------------------------
def on_changetoskill_cancel
@changetoskill_window.hide
@skill_window.show.activate
end
#--------------------------------------------------------------------------
# ● アクター[決定]
#--------------------------------------------------------------------------
def on_actor_ok
BattleManager.actor.input.target_index = @actor_window.index
@actor_window.hide
@skill_window.hide
@changetoskill_window.hide
@item_window.hide
next_command
end
#--------------------------------------------------------------------------
# ● アクター[キャンセル]
#--------------------------------------------------------------------------
def on_actor_cancel
@actor_window.hide
case @actor_command_window.current_symbol
when :skill
@changetoskill_window.hide
@skill_window.show.activate
when :item
@item_window.activate
end
end
#--------------------------------------------------------------------------
# ● 敵キャラ[決定]
#--------------------------------------------------------------------------
def on_enemy_ok
BattleManager.actor.input.target_index = @enemy_window.enemy.index
@enemy_window.hide
@skill_window.hide
@changetoskill_window.hide
@item_window.hide
next_command
end
#--------------------------------------------------------------------------
# ● 敵キャラ[キャンセル]
#--------------------------------------------------------------------------
def on_enemy_cancel
@enemy_window.hide
case @actor_command_window.current_symbol
when :attack
@actor_command_window.activate
when :skill
@changetoskill_window.hide
@skill_window.show.activate
when :item
@item_window.activate
end
end
end
#==============================================================================
# ■ Window_Battlechangetoskill
#------------------------------------------------------------------------------
# バトル画面で、使用する変化先スキルを選択するウィンドウです。
#==============================================================================
class Window_BattleChangetoSkill < Window_SkillList
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# info_viewport : 情報表示用ビューポート
#--------------------------------------------------------------------------
def initialize(help_window, info_viewport)
y = help_window.height
super(0, y, Graphics.width, info_viewport.rect.y - y)
self.visible = false
@help_window = help_window
@info_viewport = info_viewport
@changetoskills = nil
end
#--------------------------------------------------------------------------
# ● 変化先スキルの設定
#--------------------------------------------------------------------------
def changetoskills=(changetoskills)
return if @changetoskills == changetoskills
@changetoskills = changetoskills
refresh
self.oy = 0
end
#--------------------------------------------------------------------------
# ● スキルリストの作成
#--------------------------------------------------------------------------
def make_item_list
@data = @changetoskills ? @changetoskills : []
end
#--------------------------------------------------------------------------
# ● ウィンドウの表示
#--------------------------------------------------------------------------
def show
select(0)
@help_window.show
super
end
#--------------------------------------------------------------------------
# ● ウィンドウの非表示
#--------------------------------------------------------------------------
def hide
@help_window.hide
super
end
end
#==============================================================================
# ■ Scene_Skill
#------------------------------------------------------------------------------
# スキル画面の処理を行うクラスです。処理共通化の便宜上、スキルも「アイテム」
# として扱っています。
#==============================================================================
class Scene_Skill < Scene_ItemBase
#--------------------------------------------------------------------------
# ● 開始処理
#--------------------------------------------------------------------------
alias start2 start
def start
start2
create_changetoitem_window
@change = false
end
#--------------------------------------------------------------------------
# ● 変化先アイテムウィンドウの作成
#--------------------------------------------------------------------------
def create_changetoitem_window
wx = 0
wy = @status_window.y + @status_window.height
ww = Graphics.width
wh = Graphics.height - wy
@changetoitem_window = Window_ChangetoSkillList.new(wx, wy, ww, wh)
@changetoitem_window.actor = @actor
@changetoitem_window.viewport = @viewport
@changetoitem_window.help_window = @help_window
@changetoitem_window.set_handler(:ok, method(:on_changetoitem_ok))
@changetoitem_window.set_handler(:cancel, method(:on_changetoitem_cancel))
@changetoitem_window.hide
end
#--------------------------------------------------------------------------
# ● 現在選択されているアイテムの取得
#--------------------------------------------------------------------------
def item
@change ? @changetoitem_window.item : @item_window.item
end
#--------------------------------------------------------------------------
# ● カーソルが左列にあるかの判定
#--------------------------------------------------------------------------
def cursor_left?
@change ? @changetoitem_window.index % 2 == 0 : @item_window.index % 2 == 0
end
#--------------------------------------------------------------------------
# ● アイテム[決定]
#--------------------------------------------------------------------------
def on_item_ok
@change = false
if item.changetoskills != []
@item_window.hide
@changetoitem_window.changetoskills = item.changetoskills
@changetoitem_window.select(0)
@change = true
@changetoitem_window.show.activate
return
end
@actor.last_skill.object = item
determine_item
end
#--------------------------------------------------------------------------
# ● 変化先アイテム[決定]
#--------------------------------------------------------------------------
def on_changetoitem_ok
@actor.last_skill.object = item
determine_item
end
#--------------------------------------------------------------------------
# ● 変化先アイテム[キャンセル]
#--------------------------------------------------------------------------
def on_changetoitem_cancel
@changetoitem_window.hide
@item_window.show.activate
end
#--------------------------------------------------------------------------
# ● アクター[キャンセル]
#--------------------------------------------------------------------------
def on_actor_cancel
hide_sub_window(@actor_window)
@changetoitem_window.hide
@item_window.show.activate
end
end
#==============================================================================
# ■ Window_ChangetoSkillList
#------------------------------------------------------------------------------
# スキル画面で、使用できるスキルの一覧を表示するウィンドウです。
#==============================================================================
class Window_ChangetoSkillList < Window_SkillList
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super
@actor = nil
@stype_id = 0
@data = []
@changetoskills = nil
end
#--------------------------------------------------------------------------
# ● 変化先スキルの設定
#--------------------------------------------------------------------------
def changetoskills=(changetoskills)
return if @changetoskills == changetoskills
@changetoskills = changetoskills
refresh
self.oy = 0
end
#--------------------------------------------------------------------------
# ● スキルリストの作成
#--------------------------------------------------------------------------
def make_item_list
@data = @changetoskills ? @changetoskills : []
end
end