# ▼▲▼ No111. バトラーモーションXC. ver.3β ▼▲▼
#
# update 2006/10/22
#
#==============================================================================
# □ カスタマイズポイント
#==============================================================================
module NO111
#
# 「自動アニメ」頻度(低いほうが頻繁)
#
AUTO_FREQUENCY = 4
#
# 「自動アニメ」:自動的に下一桁を加算するモーションの配列
#
AUTO_UPDATES = [1,31,41,51,101,221,231,801,811,951]
#
# アニメを繰り返すモーションの配列
# (下一桁は1、1,2,3,4...8 の次に1, と繰り返します)
#
AUTO_LOOP = [1,41,51,101,221,231,801,811]
#
# 自動的に10加算して続行するモーション配列
# (951,952,953...と続き、958の次に961に移ります。)
#
AUTO_NEXT = [951]
#
# 初期モーションランダム
# ( 下一桁の1~8ランダム復帰を有効にします )
#
RANDOM_STARTUP = false
#--------------------------------------------------------------------------
# 基本フォーム
#--------------------------------------------------------------------------
#BASIC = 1 # (固定)待機:基本
#DOWN = 91 # (固定)戦闘不能
STEP3_ATTACK = 111 # 通常攻撃 :行動側アニメ時
STEP4_ATTACK = 121 # 通常攻撃 :対象側アニメ時
STEP3_GUARD = 61 # 防御選択 :行動側アニメ時
STEP4_GUARD = 61 # 防御選択 :対象側アニメ時
STEP3_ITEM = 241 # アイテム使用:行動側アニメ時
STEP4_ITEM = 251 # アイテム使用:対象側アニメ時
STEP4_DAMAGE = 71 # ダメージ受け
STEP4_GUARD = 61 # 攻撃を防御時
STEP4_AVOID = 51 # 回避時
STEP4_HEALED = 151 # 回復受け時
STEPS_ESCAPE = 901 # 逃げる
WIN_ACTION = 951 # 戦闘勝利時
#--------------------------------------------------------------------------
# スキル
#--------------------------------------------------------------------------
# スキル個別フォーム ハッシュ(優先)
STEP3_SKILL_FORMS = {56=>221}
STEP4_SKILL_FORMS = {56=>231}
#
STEP3_SKILL = 201 # スキル(非魔法):行動側アニメ時
STEP4_SKILL = 211 # スキル(非魔法):対象側アニメ時
STEP3_MAGIC = 221 # スキル( 魔法 ):行動側アニメ時
STEP4_MAGIC = 231 # スキル( 魔法 ):対象側アニメ時
STEP3_HEAL = 261 # スキル( 回復 ):行動側アニメ時
STEP4_HEAL = 271 # スキル( 回復 ):対象側アニメ時
#
# 「回避」だと判断するダメージ表示文字列配列
#
AVOID_TEXT = ["Miss", "Guard!"]
#
# "回復スキル"であると判断するスキルのID 配列
#
HEAL_SKILL_IDS = [102,103]
#--------------------------------------------------------------------------
# ステート
#--------------------------------------------------------------------------
# マイナスステート 基本フォームID値
MINUS_STATE_DEFAULT_FORM_ID = 81
# 指定ステート個別フォームID ハッシュ(優先)
STATE_FORMS = {2=>82, 3=>83, 4=>84, 5=>85, 6=>86, 7=>87, 8=>88}
# マイナスステートであると判断するステートID配列
MINUS_STATE_IDS = [1, 2, 3, 4, 5, 6, 7, 8]
# モーション変更禁止ステート (石化など)
FORM_FIX_STATES = [2, 7]
end
#==============================================================================
# RPG::Skill # 魔法スキルがどうか?
#==============================================================================
module RPG
class Skill
def is_a_magic?
return (self.str_f < self.int_f)
end
end
end
#==============================================================================
# □ RPG_FileTest # バトラーグラフィックの有無
#==============================================================================
module RPG_FileTest
def RPG_FileTest.battler_exist?(filename)
return RPG::Cache.battler(filename, 0) rescue return false
end
end
#==============================================================================
# --- フォーム 機構 ---
#==============================================================================
module XRXS_Forms
def battler_name
return @battler_motion_name == nil ? super : @battler_motion_name
end
attr_reader :form_id
def form_id=(id)
@form_id = id
# フォーム ID の変化に対応
case @form_id
when nil, 0, 1
filename = nil
exist = true
else
filename = @battler_name + "_" + sprintf("%03d", self.form_id)
exist = RPG_FileTest.battler_exist?(filename)
end
@battler_motion_name = filename if exist
end
end
class Game_Actor < Game_Battler
include XRXS_Forms
end
class Game_Enemy < Game_Battler
include XRXS_Forms
end
#==============================================================================
# --- 0番 非表示化 ---
#==============================================================================
class Game_Battler
def visible
return (self.form_id != 0)
end
end
module XRXS_ZeroForm_Enhide
def update
super
if [url=home.php?mod=space&uid=133701]@battler[/url] != nil
self.visible = @battler.visible
end
end
end
class Sprite_Battler < RPG::Sprite
include XRXS_ZeroForm_Enhide
end
#==============================================================================
# --- ランダムスタートアップ機能 ---
#==============================================================================
class Game_Temp
def shift_random_start_id
if @no111_randoms.nil? or @no111_randoms.empty?
@no111_randoms = [1,2,3,4,5,6,7,8]
end
index = rand(@no111_randoms.size)
return @no111_randoms.delete_at(index)
end
end
#==============================================================================
# --- 基本待機フォームへのバトラーグラフィックの変更 ---
#==============================================================================
module XRXS_Forms
attr_accessor :form_id_basic
end
class Game_Battler
def transgraphic_basic_form
# 基本を取得
id = self.form_id_basic
id = 1 if id == nil
# 「自動アニメ」ならばランタムスタートアップ
if NO111::RANDOM_STARTUP and NO111::AUTO_UPDATES.include?(form_id)
id += $game_temp.shift_random_start_id - 1
end
# 戦闘不能時強制フォーム
id = 91 if self.dead?
# 設定
self.form_id = id
end
end
#==============================================================================
# --- マイナスステートによる基本フォームの変化 ---
#==============================================================================
module XRXS_Forms_MinusStates
def add_state(state_id, force = false)
super
form_id_basic_refresh
end
def remove_state(state_id, force = false)
super
form_id_basic_refresh
end
def form_id_basic_refresh
form_id = 1
# ステート検索
now_rate = 0
for state_id in @states
state_form_id = nil
# レーティングを比較
next if now_rate >= $data_states[state_id].rating
# 優先指定フォーム
id = NO111::STATE_FORMS[state_id]
if id != nil
state_form_id = id
end
# マイナスステート基本フォーム
if id == nil and NO111::MINUS_STATE_IDS.include?(state_id)
state_form_id = NO111::MINUS_STATE_DEFAULT_FORM_ID
end
# マイナスステートフォーム用ファイルが存在するかどうか判別
if state_form_id != nil
filename = @battler_name + "_" + sprintf("%03d", state_form_id)
exist = RPG_FileTest.battler_exist?(filename)
if exist
# ファイルが存在する場合のみ基本フォームに設定
form_id = state_form_id
now_rate = $data_states[state_id].rating
end
end
end
self.form_id_basic = form_id
end
end
class Game_Actor < Game_Battler
include XRXS_Forms_MinusStates
end
class Game_Enemy < Game_Battler
include XRXS_Forms_MinusStates
end
#==============================================================================
# --- ステート自然解除 にモーション連動 ---
#==============================================================================
class Game_Battler
alias no111_remove_states_auto remove_states_auto
def remove_states_auto
no111_remove_states_auto
self.transgraphic_basic_form
end
end
#==============================================================================
# --- フォーム ID のフレーム更新 ---
#==============================================================================
module XRXS_TransForms
def update_transform
# 例外補正
self.form_id = 1 if self.form_id == nil
# ステップ更新
if self.form_id != 0 and
NO111::AUTO_UPDATES.include?(self.form_id/10 * 10 + 1)
if self.form_id%10 == 8
if NO111::AUTO_NEXT.include?(self.form_id - 7)
self.form_id += 3
elsif NO111::AUTO_LOOP.include?(self.form_id - 7)
self.form_id -= 7
end
else
self.form_id += 1
end
end
end
end
class Game_Battler
include XRXS_TransForms
end
#==============================================================================
# --- 91番 コラプス制御 ---
#==============================================================================
class Game_Battler
def down_battler_graphic?
# ファイル名の作成
filename = @battler_name + "_" + sprintf("%03d", 91)
# 有無チェック
return RPG_FileTest.battler_exist?(filename)
end
end
module NO111_CollapseBan
def collapse
super unless @battler.down_battler_graphic?
end
end
class Sprite_Battler < RPG::Sprite
include NO111_CollapseBan
alias no111_update update
def update
no111_update
return if @battler == nil
if @battler.dead? and @battler.down_battler_graphic?
self.opacity = 255
end
end
end
#==============================================================================
# --- ステート変化保持機構 ---
#==============================================================================
class Game_Battler
attr_accessor :damage_states
#--------------------------------------------------------------------------
# ● 通常攻撃の効果適用
#--------------------------------------------------------------------------
alias attack_effect_damage_state attack_effect
def attack_effect(attacker)
last_states = self.states.dup
attack_effect_damage_state(attacker)
self.damage_states = self.states - last_states
end
#--------------------------------------------------------------------------
# ● スキルの効果適用
#--------------------------------------------------------------------------
alias skill_effect_damage_state skill_effect
def skill_effect(user, skill)
last_states = self.states.dup
skill_effect_damage_state(user, skill)
self.damage_states = self.states - last_states
end
#--------------------------------------------------------------------------
# ● アイテムの効果適用
#--------------------------------------------------------------------------
alias item_effect_damage_state item_effect
def item_effect(item)
last_states = self.states.dup
item_effect_damage_state(item)
self.damage_states = self.states - last_states
end
end
#==============================================================================
# --- フォーム固定 ---
#==============================================================================
class Game_Battler
def form_fixed?
fixed = false
for state_id in self.states
fixed |= NO111::FORM_FIX_STATES.include?(state_id)
end
return fixed
end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
alias no111_main main
def main
# カウント初期化
@wait_count_motion = 0
# 呼び戻す
no111_main
# モーションを基本に戻す
$game_party.actors.each{|actor| actor.form_id = nil }
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias no111_update update
def update
# 呼び戻す
no111_update
# ウェイトカウント待機
if @wait_count_motion > 0
@wait_count_motion -= 1
return
end
# バトラーグラフィック表示更新
for battler in $game_party.actors + $game_troop.enemies
battler.update_transform
end
@wait_count_motion = NO111::AUTO_FREQUENCY
end
#--------------------------------------------------------------------------
# ● プレバトルフェーズ開始
#--------------------------------------------------------------------------
alias no111_start_phase1 start_phase1
def start_phase1
no111_start_phase1
# モーションをリセット
actors_motion_reset
end
#--------------------------------------------------------------------------
# ○ アクター達のモーションをリセット
#--------------------------------------------------------------------------
def actors_motion_reset
for actor in $game_party.actors
actor.transgraphic_basic_form
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (パーティコマンドフェーズ : 逃げる)
#--------------------------------------------------------------------------
alias no111_update_phase2_escape update_phase2_escape
def update_phase2_escape
# 呼び戻す
no111_update_phase2_escape
# 逃走成功
unless $scene.is_a?(Scene_Battle)
# 逃走モーション
for actor in $game_party.actors
if actor.movable?
actor.form_id = NO111::STEPS_ESCAPE
end
end
# 強制更新
@spriteset.update
Graphics.update
end
end
#--------------------------------------------------------------------------
# ● 勝敗判定
#--------------------------------------------------------------------------
alias no111_judge judge
def judge
bool = no111_judge
if bool
for battler in $game_party.actors
if battler.dead? == false
battler.form_id = NO111::WIN_ACTION
end
end
end
return bool
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション)
#--------------------------------------------------------------------------
alias no111_update_phase4_step3 update_phase4_step3
def update_phase4_step3
# モーション:行動側のモーション
# アクションの種別で分岐
case @active_battler.current_action.kind
when 0 # 基本
# 攻撃の場合
if @active_battler.current_action.basic == 0
@active_battler.form_id = NO111::STEP3_ATTACK
end
# 防御の場合
if @active_battler.current_action.basic == 1
@active_battler.form_id = NO111::STEP3_GUARD
end
# 逃げるの場合
if @active_battler.is_a?(Game_Enemy) and @active_battler.current_action.basic == 2
@active_battler.form_id = NO111::STEPS_ESCAPE
end
when 1 # スキル時、魔法判別
form_id = NO111::STEP3_SKILL_FORMS[@skill.id]
if form_id != nil
@active_battler.form_id = form_id
elsif NO111::HEAL_SKILL_IDS.include?(@skill.id)
@active_battler.form_id = NO111::STEP3_HEAL
elsif @skill != nil and @skill.is_a_magic?
@active_battler.form_id = NO111::STEP3_MAGIC
else
@active_battler.form_id = NO111::STEP3_SKILL
end
when 2 # アイテム
@active_battler.form_id = NO111::STEP3_ITEM
end
# 戻す
no111_update_phase4_step3
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 4 : 対象側アニメーション)
#--------------------------------------------------------------------------
alias no111_update_phase4_step4 update_phase4_step4
def update_phase4_step4
# モーション:対象側のダメージ
for target in @target_battlers
# フォーム固定ステート
next if target.form_fixed?
#
# 対象の反応
#
if NO111::AVOID_TEXT.include?(target.damage)
# 回避表示がなされる場合
target.form_id = NO111::STEP4_AVOID
elsif (target.damage.is_a?(Numeric) and target.damage >= 0)
#
if target.guarding? or target.damage == 0
# ガード
target.form_id = NO111::STEP4_GUARD
else
# 通常ダメージ
target.form_id = NO111::STEP4_DAMAGE
end
else
# マイナスステートを検索
minus_state = false
if target.damage_states != nil
for state_id in target.damage_states
minus_state |= NO111::MINUS_STATE_IDS.include?(state_id)
end
target.damage_states.clear
end
if minus_state
# マイナスステート
target.form_id = NO111::STEP4_DAMAGE
else
# 回復受け
target.form_id = NO111::STEP4_HEALED
end
end
end
# 自分自身のダメージ時は強制離脱
if @active_battler.form_id == NO111::STEP4_DAMAGE
return no111_update_phase4_step4
end
# モーション:行動側のモーション
# アクションの種別で分岐
case @active_battler.current_action.kind
when 0 # 基本
# 攻撃の場合
if @active_battler.current_action.basic == 0
@active_battler.form_id = NO111::STEP4_ATTACK
end
# 防御の場合
if @active_battler.current_action.basic == 1
@active_battler.form_id = NO111::STEP4_GUARD
end
# 逃げるの場合
if @active_battler.is_a?(Game_Enemy) and @active_battler.current_action.basic == 2
@active_battler.form_id = NO111::STEPS_ESCAPE
end
when 1 # スキル時、魔法判別
form_id = NO111::STEP4_SKILL_FORMS[@skill.id]
if form_id != nil
@active_battler.form_id = form_id
elsif NO111::HEAL_SKILL_IDS.include?(@skill.id)
@active_battler.form_id = NO111::STEP4_HEAL
elsif @skill != nil and @skill.is_a_magic?
@active_battler.form_id = NO111::STEP4_MAGIC
else
@active_battler.form_id = NO111::STEP4_SKILL
end
when 2 # アイテム
@active_battler.form_id = NO111::STEP4_ITEM
end
# 戻す
no111_update_phase4_step4
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
#--------------------------------------------------------------------------
alias no111_update_phase4_step6 update_phase4_step6
def update_phase4_step6
# 行動者のモーションのリセット
@active_battler.transgraphic_basic_form
# 対象のモーションリセット
if @target_battlers != nil
for target in @target_battlers
target.transgraphic_basic_form
end
end
# 呼び戻す
no111_update_phase4_step6
end
end