king-exit/Scripts/_.19.rb
2024-08-31 14:17:23 -05:00

79 lines
3 KiB
Ruby
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#==============================================================================
# ★ RGSS3_オートステート Ver1.0
#==============================================================================
=begin
作者tomoaky
webサイトひきも記 (http://hikimoki.sakura.ne.jp/)
戦闘開始時に自動的に付加されるステートをアクターやエネミーに設定できます、
メモ欄に <オートステート 2, 3> と書けば2番と3番のステートが付加されます。
対応しているのはアクター、職業、武器、防具、エネミーの5つです。
=== 注意点 ===
・付加状態を維持する機能は付いていません、
あくまでも戦闘開始時に付加判定を発生させるだけです
2011.12.15 Ver1.0
公開
=end
#==============================================================================
# ■ RPG::BaseItem
#==============================================================================
class RPG::BaseItem
#--------------------------------------------------------------------------
# ○ オートステートIDの配列を返す
#--------------------------------------------------------------------------
def auto_states
result = []
if /<オートステート\s+(\d+(?:\s*\,\s*\d+)*)\s*>/ =~ @note
$1.scan(/\d+/).each do |id|
result.push(id.to_i)
end
end
result
end
end
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ● 戦闘開始処理
#--------------------------------------------------------------------------
alias tmatst_game_battler_on_battle_start on_battle_start
def on_battle_start
tmatst_game_battler_on_battle_start
add_auto_states
end
end
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor
#--------------------------------------------------------------------------
# ○ オートステートの付加
#--------------------------------------------------------------------------
def add_auto_states
states = self.actor.auto_states + self.class.auto_states
self.equips.compact.each {|item| states += item.auto_states }
states.uniq.each {|id| self.add_state(id) }
end
end
#==============================================================================
# ■ Game_Enemy
#==============================================================================
class Game_Enemy
#--------------------------------------------------------------------------
# ○ オートステートの付加
#--------------------------------------------------------------------------
def add_auto_states
self.enemy.auto_states.each {|id| self.add_state(id) }
end
end