GAME_SYSTEM*#==============================================================================
# ■ Game_System
#------------------------------------------------------------------------------
# システム周りのデータを扱うクラスです。BGM などの管理も行います。このクラス
# のインスタンスは $game_system で参照されます。
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :map_interpreter # マップイベント用インタプリタ
attr_reader :battle_interpreter # バトルイベント用インタプリタ
attr_accessor :timer # タイマー
attr_accessor :timer_working # タイマー作動中フラグ
attr_accessor :save_disabled # セーブ禁止
attr_accessor :menu_disabled # メニュー禁止
attr_accessor

ncounter_disabled # エンカウント禁止
attr_accessor :message_position # 文章オプション 表示位置
attr_accessor :message_frame # 文章オプション ウィンドウ枠
attr_accessor :save_count # セーブ回数
attr_accessor :magic_number # マジックナンバー
attr_accessor :animated_enemy # Are the enemies animated?
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
@map_interpreter = Interpreter.new(0, true)
@battle_interpreter = Interpreter.new(0, false)
@timer = 0
@timer_working = false
@save_disabled = false
@menu_disabled = false
@encounter_disabled = false
@message_position = 2
@message_frame = 0
@save_count = 0
@magic_number = 0
# By default, enemies aren't animated. Feel free to
# change it to true if your game supports animated
# enemies.
@animated_enemy = false
end
#--------------------------------------------------------------------------
# ● BGM の演奏
# bgm : 演奏する BGM
#--------------------------------------------------------------------------
def bgm_play(bgm)
@playing_bgm = bgm
if bgm != nil and bgm.name != ""
Audio.bgm_play("Audio/BGM/" + bgm.name, bgm.volume, bgm.pitch)
else
Audio.bgm_stop
end
Graphics.frame_reset
end
#--------------------------------------------------------------------------
# ● BGM の停止
#--------------------------------------------------------------------------
def bgm_stop
Audio.bgm_stop
end
#--------------------------------------------------------------------------
# ● BGM のフェードアウト
# time : フェードアウト時間 (秒)
#--------------------------------------------------------------------------
def bgm_fade(time)
@playing_bgm = nil
Audio.bgm_fade(time * 1000)
end
#--------------------------------------------------------------------------
# ● BGM の記憶
#--------------------------------------------------------------------------
def bgm_memorize
@memorized_bgm = @playing_bgm
end
#--------------------------------------------------------------------------
# ● BGM の復帰
#--------------------------------------------------------------------------
def bgm_restore
bgm_play(@memorized_bgm)
end
#--------------------------------------------------------------------------
# ● BGS の演奏
# bgs : 演奏する BGS
#--------------------------------------------------------------------------
def bgs_play(bgs)
@playing_bgs = bgs
if bgs != nil and bgs.name != ""
Audio.bgs_play("Audio/BGS/" + bgs.name, bgs.volume, bgs.pitch)
else
Audio.bgs_stop
end
Graphics.frame_reset
end
#--------------------------------------------------------------------------
# ● BGS のフェードアウト
# time : フェードアウト時間 (秒)
#--------------------------------------------------------------------------
def bgs_fade(time)
@playing_bgs = nil
Audio.bgs_fade(time * 1000)
end
#--------------------------------------------------------------------------
# ● BGS の記憶
#--------------------------------------------------------------------------
def bgs_memorize
@memorized_bgs = @playing_bgs
end
#--------------------------------------------------------------------------
# ● BGS の復帰
#--------------------------------------------------------------------------
def bgs_restore
bgs_play(@memorized_bgs)
end
#--------------------------------------------------------------------------
# ● ME の演奏
# me : 演奏する ME
#--------------------------------------------------------------------------
def me_play(me)
if me != nil and me.name != ""
Audio.me_play("Audio/ME/" + me.name, me.volume, me.pitch)
else
Audio.me_stop
end
Graphics.frame_reset
end
#--------------------------------------------------------------------------
# ● SE の演奏
# se : 演奏する SE
#--------------------------------------------------------------------------
def se_play(se)
if se != nil and se.name != ""
Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch)
end
end
#--------------------------------------------------------------------------
# ● SE の停止
#--------------------------------------------------------------------------
def se_stop
Audio.se_stop
end
#--------------------------------------------------------------------------
# ● 演奏中 BGM の取得
#--------------------------------------------------------------------------
def playing_bgm
return @playing_bgm
end
#--------------------------------------------------------------------------
# ● 演奏中 BGS の取得
#--------------------------------------------------------------------------
def playing_bgs
return @playing_bgs
end
#--------------------------------------------------------------------------
# ● ウィンドウスキン ファイル名の取得
#--------------------------------------------------------------------------
def windowskin_name
if @windowskin_name == nil
return $data_system.windowskin_name
else
return @windowskin_name
end
end
#--------------------------------------------------------------------------
# ● ウィンドウスキン ファイル名の設定
# windowskin_name : 新しいウィンドウスキン ファイル名
#--------------------------------------------------------------------------
def windowskin_name=(windowskin_name)
@windowskin_name = windowskin_name
end
#--------------------------------------------------------------------------
# ● バトル BGM の取得
#--------------------------------------------------------------------------
def battle_bgm
if @battle_bgm == nil
return $data_system.battle_bgm
else
return @battle_bgm
end
end
#--------------------------------------------------------------------------
# ● バトル BGM の設定
# battle_bgm : 新しいバトル BGM
#--------------------------------------------------------------------------
def battle_bgm=(battle_bgm)
@battle_bgm = battle_bgm
end
#--------------------------------------------------------------------------
# ● バトル終了 BGM の取得
#--------------------------------------------------------------------------
def battle_end_me
if @battle_end_me == nil
return $data_system.battle_end_me
else
return @battle_end_me
end
end
#--------------------------------------------------------------------------
# ● バトル終了 BGM の設定
# battle_end_me : 新しいバトル終了 BGM
#--------------------------------------------------------------------------
def battle_end_me=(battle_end_me)
@battle_end_me = battle_end_me
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
# タイマーを 1 減らす
if @timer_working and @timer > 0
@timer -= 1
end
end
end
GAME_ACTOR*
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
# アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors)
# の内部で使用され、Game_Party クラス ($game_party) からも参照されます。
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :name # 名前
attr_reader :character_name # キャラクター ファイル名
attr_reader :character_hue # キャラクター 色相
attr_reader :class_id # クラス ID
attr_reader :weapon_id # 武器 ID
attr_reader :armor1_id # 盾 ID
attr_reader :armor2_id # 頭防具 ID
attr_reader :armor3_id # 体防具 ID
attr_reader :armor4_id # 装飾品 ID
attr_reader :level # レベル
attr_reader

xp # EXP
attr_reader :skills # スキル
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# actor_id : アクター ID
#--------------------------------------------------------------------------
def initialize(actor_id)
super()
setup(actor_id)
end
#--------------------------------------------------------------------------
# ● セットアップ
# actor_id : アクター ID
#--------------------------------------------------------------------------
def setup(actor_id)
actor = $data_actors[actor_id]
@actor_id = actor_id
@name = actor.name
@character_name = actor.character_name
@character_hue = actor.character_hue
@battler_name = actor.battler_name
@battler_hue = actor.battler_hue
@class_id = actor.class_id
@weapon_id = actor.weapon_id
@armor1_id = actor.armor1_id
@armor2_id = actor.armor2_id
@armor3_id = actor.armor3_id
@armor4_id = actor.armor4_id
@level = actor.initial_level
@exp_list = Array.new(101)
make_exp_list
@exp = @exp_list[@level]
@skills = []
@hp = maxhp
@sp = maxsp
@states = []
@states_turn = {}
@maxhp_plus = 0
@maxsp_plus = 0
@str_plus = 0
@dex_plus = 0
@agi_plus = 0
@int_plus = 0
# スキル習得
for i in 1..@level
for j in $data_classes[@class_id].learnings
if j.level == i
learn_skill(j.skill_id)
end
end
end
# オートステートを更新
update_auto_state(nil, $data_armors[@armor1_id])
update_auto_state(nil, $data_armors[@armor2_id])
update_auto_state(nil, $data_armors[@armor3_id])
update_auto_state(nil, $data_armors[@armor4_id])
end
#--------------------------------------------------------------------------
# ● アクター ID 取得
#--------------------------------------------------------------------------
def id
return @actor_id
end
#--------------------------------------------------------------------------
# ● インデックス取得
#--------------------------------------------------------------------------
def index
return $game_party.actors.index(self)
end
#--------------------------------------------------------------------------
# ● EXP 計算
#--------------------------------------------------------------------------
def make_exp_list
actor = $data_actors[@actor_id]
@exp_list[1] = 0
pow_i = 2.4 + actor.exp_inflation / 100.0
for i in 2..100
if i > actor.final_level
@exp_list[i] = 0
else
n = actor.exp_basis * ((i + 3) ** pow_i) / (5 ** pow_i)
@exp_list[i] = @exp_list[i-1] + Integer(n)
end
end
end
#--------------------------------------------------------------------------
# ● 属性補正値の取得
# element_id : 属性 ID
#--------------------------------------------------------------------------
def element_rate(element_id)
# 属性有効度に対応する数値を取得
table = [0,200,150,100,50,0,-100]
result = table[$data_classes[@class_id].element_ranks[element_id]]
# 防具でこの属性が防御されている場合は半減
for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
armor = $data_armors[i]
if armor != nil and armor.guard_element_set.include?(element_id)
result /= 2
end
end
# ステートでこの属性が防御されている場合は半減
for i in @states
if $data_states[i].guard_element_set.include?(element_id)
result /= 2
end
end
# メソッド終了
return result
end
#--------------------------------------------------------------------------
# ● ステート有効度の取得
#--------------------------------------------------------------------------
def state_ranks
return $data_classes[@class_id].state_ranks
end
#--------------------------------------------------------------------------
# ● ステート防御判定
# state_id : ステート ID
#--------------------------------------------------------------------------
def state_guard?(state_id)
for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id]
armor = $data_armors[i]
if armor != nil
if armor.guard_state_set.include?(state_id)
return true
end
end
end
return false
end
#--------------------------------------------------------------------------
# ● 通常攻撃の属性取得
#--------------------------------------------------------------------------
def element_set
weapon = $data_weapons[@weapon_id]
return weapon != nil ? weapon.element_set : []
end
#--------------------------------------------------------------------------
# ● 通常攻撃のステート変化 (+) 取得
#--------------------------------------------------------------------------
def plus_state_set
weapon = $data_weapons[@weapon_id]
return weapon != nil ? weapon.plus_state_set : []
end
#--------------------------------------------------------------------------
# ● 通常攻撃のステート変化 (-) 取得
#--------------------------------------------------------------------------
def minus_state_set
weapon = $data_weapons[@weapon_id]
return weapon != nil ? weapon.minus_state_set : []
end
#--------------------------------------------------------------------------
# ● MaxHP の取得
#--------------------------------------------------------------------------
def maxhp
n = [[base_maxhp + @maxhp_plus, 1].max, 9999].min
for i in @states
n *= $data_states[i].maxhp_rate / 100.0
end
n = [[Integer(n), 1].max, 9999].min
return n
end
#--------------------------------------------------------------------------
# ● 基本 MaxHP の取得
#--------------------------------------------------------------------------
def base_maxhp
return $data_actors[@actor_id].parameters[0, @level]
end
#--------------------------------------------------------------------------
# ● 基本 MaxSP の取得
#--------------------------------------------------------------------------
def base_maxsp
return $data_actors[@actor_id].parameters[1, @level]
end
#--------------------------------------------------------------------------
# ● 基本腕力の取得
#--------------------------------------------------------------------------
def base_str
n = $data_actors[@actor_id].parameters[2, @level]
weapon = $data_weapons[@weapon_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
n += weapon != nil ? weapon.str_plus : 0
n += armor1 != nil ? armor1.str_plus : 0
n += armor2 != nil ? armor2.str_plus : 0
n += armor3 != nil ? armor3.str_plus : 0
n += armor4 != nil ? armor4.str_plus : 0
return [[n, 1].max, 999].min
end
#--------------------------------------------------------------------------
# ● 基本器用さの取得
#--------------------------------------------------------------------------
def base_dex
n = $data_actors[@actor_id].parameters[3, @level]
weapon = $data_weapons[@weapon_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
n += weapon != nil ? weapon.dex_plus : 0
n += armor1 != nil ? armor1.dex_plus : 0
n += armor2 != nil ? armor2.dex_plus : 0
n += armor3 != nil ? armor3.dex_plus : 0
n += armor4 != nil ? armor4.dex_plus : 0
return [[n, 1].max, 999].min
end
#--------------------------------------------------------------------------
# ● 基本素早さの取得
#--------------------------------------------------------------------------
def base_agi
n = $data_actors[@actor_id].parameters[4, @level]
weapon = $data_weapons[@weapon_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
n += weapon != nil ? weapon.agi_plus : 0
n += armor1 != nil ? armor1.agi_plus : 0
n += armor2 != nil ? armor2.agi_plus : 0
n += armor3 != nil ? armor3.agi_plus : 0
n += armor4 != nil ? armor4.agi_plus : 0
return [[n, 1].max, 999].min
end
#--------------------------------------------------------------------------
# ● 基本魔力の取得
#--------------------------------------------------------------------------
def base_int
n = $data_actors[@actor_id].parameters[5, @level]
weapon = $data_weapons[@weapon_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
n += weapon != nil ? weapon.int_plus : 0
n += armor1 != nil ? armor1.int_plus : 0
n += armor2 != nil ? armor2.int_plus : 0
n += armor3 != nil ? armor3.int_plus : 0
n += armor4 != nil ? armor4.int_plus : 0
return [[n, 1].max, 999].min
end
#--------------------------------------------------------------------------
# ● 基本攻撃力の取得
#--------------------------------------------------------------------------
def base_atk
weapon = $data_weapons[@weapon_id]
return weapon != nil ? weapon.atk : 0
end
#--------------------------------------------------------------------------
# ● 基本物理防御の取得
#--------------------------------------------------------------------------
def base_pdef
weapon = $data_weapons[@weapon_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
pdef1 = weapon != nil ? weapon.pdef : 0
pdef2 = armor1 != nil ? armor1.pdef : 0
pdef3 = armor2 != nil ? armor2.pdef : 0
pdef4 = armor3 != nil ? armor3.pdef : 0
pdef5 = armor4 != nil ? armor4.pdef : 0
return pdef1 + pdef2 + pdef3 + pdef4 + pdef5
end
#--------------------------------------------------------------------------
# ● 基本魔法防御の取得
#--------------------------------------------------------------------------
def base_mdef
weapon = $data_weapons[@weapon_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
mdef1 = weapon != nil ? weapon.mdef : 0
mdef2 = armor1 != nil ? armor1.mdef : 0
mdef3 = armor2 != nil ? armor2.mdef : 0
mdef4 = armor3 != nil ? armor3.mdef : 0
mdef5 = armor4 != nil ? armor4.mdef : 0
return mdef1 + mdef2 + mdef3 + mdef4 + mdef5
end
#--------------------------------------------------------------------------
# ● 基本回避修正の取得
#--------------------------------------------------------------------------
def base_eva
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
eva1 = armor1 != nil ? armor1.eva : 0
eva2 = armor2 != nil ? armor2.eva : 0
eva3 = armor3 != nil ? armor3.eva : 0
eva4 = armor4 != nil ? armor4.eva : 0
return eva1 + eva2 + eva3 + eva4
end
#--------------------------------------------------------------------------
# ● 通常攻撃 攻撃側アニメーション ID の取得
#--------------------------------------------------------------------------
def animation1_id
weapon = $data_weapons[@weapon_id]
return weapon != nil ? weapon.animation1_id : 0
end
#--------------------------------------------------------------------------
# ● 通常攻撃 対象側アニメーション ID の取得
#--------------------------------------------------------------------------
def animation2_id
weapon = $data_weapons[@weapon_id]
return weapon != nil ? weapon.animation2_id : 0
end
#--------------------------------------------------------------------------
# ● クラス名の取得
#--------------------------------------------------------------------------
def class_name
return $data_classes[@class_id].name
end
#--------------------------------------------------------------------------
# ● EXP の文字列取得
#--------------------------------------------------------------------------
def exp_s
return @exp_list[@level+1] > 0 ? @exp.to_s : "-------"
end
#--------------------------------------------------------------------------
# ● 次のレベルの EXP の文字列取得
#--------------------------------------------------------------------------
def next_exp_s
return @exp_list[@level+1] > 0 ? @exp_list[@level+1].to_s : "-------"
end
#--------------------------------------------------------------------------
# ● 次のレベルまでの EXP の文字列取得
#--------------------------------------------------------------------------
def next_rest_exp_s
return @exp_list[@level+1] > 0 ?
(@exp_list[@level+1] - @exp).to_s : "-------"
end
#--------------------------------------------------------------------------
# ● オートステートの更新
# old_armor : 外した防具
# new_armor : 装備した防具
#--------------------------------------------------------------------------
def update_auto_state(old_armor, new_armor)
# 外した防具のオートステートを強制解除
if old_armor != nil and old_armor.auto_state_id != 0
remove_state(old_armor.auto_state_id, true)
end
# 装備した防具のオートステートを強制付加
if new_armor != nil and new_armor.auto_state_id != 0
add_state(new_armor.auto_state_id, true)
end
end
#--------------------------------------------------------------------------
# ● 装備固定判定
# equip_type : 装備タイプ
#--------------------------------------------------------------------------
def equip_fix?(equip_type)
case equip_type
when 0 # 武器
return $data_actors[@actor_id].weapon_fix
when 1 # 盾
return $data_actors[@actor_id].armor1_fix
when 2 # 頭
return $data_actors[@actor_id].armor2_fix
when 3 # 身体
return $data_actors[@actor_id].armor3_fix
when 4 # 装飾品
return $data_actors[@actor_id].armor4_fix
end
return false
end
#--------------------------------------------------------------------------
# ● 装備の変更
# equip_type : 装備タイプ
# id : 武器 or 防具 ID (0 なら装備解除)
#--------------------------------------------------------------------------
def equip(equip_type, id)
case equip_type
when 0 # 武器
if id == 0 or $game_party.weapon_number(id) > 0
$game_party.gain_weapon(@weapon_id, 1)
@weapon_id = id
$game_party.lose_weapon(id, 1)
end
when 1 # 盾
if id == 0 or $game_party.armor_number(id) > 0
update_auto_state($data_armors[@armor1_id], $data_armors[id])
$game_party.gain_armor(@armor1_id, 1)
@armor1_id = id
$game_party.lose_armor(id, 1)
end
when 2 # 頭
if id == 0 or $game_party.armor_number(id) > 0
update_auto_state($data_armors[@armor2_id], $data_armors[id])
$game_party.gain_armor(@armor2_id, 1)
@armor2_id = id
$game_party.lose_armor(id, 1)
end
when 3 # 身体
if id == 0 or $game_party.armor_number(id) > 0
update_auto_state($data_armors[@armor3_id], $data_armors[id])
$game_party.gain_armor(@armor3_id, 1)
@armor3_id = id
$game_party.lose_armor(id, 1)
end
when 4 # 装飾品
if id == 0 or $game_party.armor_number(id) > 0
update_auto_state($data_armors[@armor4_id], $data_armors[id])
$game_party.gain_armor(@armor4_id, 1)
@armor4_id = id
$game_party.lose_armor(id, 1)
end
end
end
#--------------------------------------------------------------------------
# ● 装備可能判定
# item : アイテム
#--------------------------------------------------------------------------
def equippable?(item)
# 武器の場合
if item.is_a?(RPG::Weapon)
# 現在のクラスの装備可能な武器に含まれている場合
if $data_classes[@class_id].weapon_set.include?(item.id)
return true
end
end
# 防具の場合
if item.is_a?(RPG:

rmor)
# 現在のクラスの装備可能な防具に含まれている場合
if $data_classes[@class_id].armor_set.include?(item.id)
return true
end
end
return false
end
#--------------------------------------------------------------------------
# ● EXP の変更
# exp : 新しい EXP
#--------------------------------------------------------------------------
def exp=(exp)
@exp = [[exp, 9999999].min, 0].max
# レベルアップ
while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
@level += 1
# スキル習得
for j in $data_classes[@class_id].learnings
if j.level == @level
learn_skill(j.skill_id)
end
end
end
# レベルダウン
while @exp < @exp_list[@level]
@level -= 1
end
# 現在の HP と SP が最大値を超えていたら修正
@hp = [@hp, self.maxhp].min
@sp = [@sp, self.maxsp].min
end
#--------------------------------------------------------------------------
# ● レベルの変更
# level : 新しいレベル
#--------------------------------------------------------------------------
def level=(level)
# 上下限チェック
level = [[level, $data_actors[@actor_id].final_level].min, 1].max
# EXP を変更
self.exp = @exp_list[level]
end
#--------------------------------------------------------------------------
# ● スキルを覚える
# skill_id : スキル ID
#--------------------------------------------------------------------------
def learn_skill(skill_id)
if skill_id > 0 and not skill_learn?(skill_id)
@skills.push(skill_id)
@skills.sort!
end
end
#--------------------------------------------------------------------------
# ● スキルを忘れる
# skill_id : スキル ID
#--------------------------------------------------------------------------
def forget_skill(skill_id)
@skills.delete(skill_id)
end
#--------------------------------------------------------------------------
# ● スキルの習得済み判定
# skill_id : スキル ID
#--------------------------------------------------------------------------
def skill_learn?(skill_id)
return @skills.include?(skill_id)
end
#--------------------------------------------------------------------------
# ● スキルの使用可能判定
# skill_id : スキル ID
#--------------------------------------------------------------------------
def skill_can_use?(skill_id)
if not skill_learn?(skill_id)
return false
end
return super
end
#--------------------------------------------------------------------------
# ● 名前の変更
# name : 新しい名前
#--------------------------------------------------------------------------
def name=(name)
@name = name
end
#--------------------------------------------------------------------------
# ● クラス ID の変更
# class_id : 新しいクラス ID
#--------------------------------------------------------------------------
def class_id=(class_id)
if $data_classes[class_id] != nil
@class_id = class_id
# 装備できなくなったアイテムを外す
unless equippable?($data_weapons[@weapon_id])
equip(0, 0)
end
unless equippable?($data_armors[@armor1_id])
equip(1, 0)
end
unless equippable?($data_armors[@armor2_id])
equip(2, 0)
end
unless equippable?($data_armors[@armor3_id])
equip(3, 0)
end
unless equippable?($data_armors[@armor4_id])
equip(4, 0)
end
end
end
#--------------------------------------------------------------------------
# ● グラフィックの変更
# character_name : 新しいキャラクター ファイル名
# character_hue : 新しいキャラクター 色相
# battler_name : 新しいバトラー ファイル名
# battler_hue : 新しいバトラー 色相
#--------------------------------------------------------------------------
def set_graphic(character_name, character_hue, battler_name, battler_hue)
@character_name = character_name
@character_hue = character_hue
@battler_name = battler_name
@battler_hue = battler_hue
end
#--------------------------------------------------------------------------
# ● バトル画面 X 座標の取得
#--------------------------------------------------------------------------
def screen_x
# パーティ内の並び順から X 座標を計算して返す
if self.index != nil
# Change this to control the placement of actors in battle
return self.index * 48 + 400
else
return 400
end
end
#--------------------------------------------------------------------------
# ● バトル画面 Y 座標の取得
#--------------------------------------------------------------------------
def screen_y
if self.index != nil
# Change this to control the placement of actors in battle
return self.index * 48 + 160
else
return 0
end
end
#--------------------------------------------------------------------------
# ● バトル画面 Z 座標の取得
#--------------------------------------------------------------------------
def screen_z
# パーティ内の並び順から Z 座標を計算して返す
# This controls the 'priority' of actor sprites
if self.index != nil
return self.index
else
return 0
end
end
end
Animated_Sprite***
#==============================================================================
# * Animated_Sprite Scripted by: RPG
#------------------------------------------------------------------------------
# A class for animated sprites.
#==============================================================================
class Animated_Sprite < RPG::Sprite
#--------------------------------------------------------------------------
# - Accessible instance variables.
#--------------------------------------------------------------------------
attr_accessor :frames # Number of animation frames
attr_accessor :delay # Delay time between frames (speed)
attr_accessor :frame_width # Width of each frame
attr_accessor :frame_height # Height of each frame
attr_accessor

ffset_x # X coordinate of the 1st frame
attr_accessor

ffset_y # Y coordinate of all frames
attr_accessor :current_frame # Current animation frame
attr_accessor :moving # Is the sprite moving?
#--------------------------------------------------------------------------
# - Initialize an animated sprite
# viewport : Sprite viewport
#--------------------------------------------------------------------------
def initialize(viewport = nil)
super(viewport)
@frame_width, @frame_height = 0, 0
change # A basic change to set initial variables
@old = Graphics.frame_count # For the delay method
@rm2k_mode = true # Controls animation pattern, first-mid-last-mid if true
@goingup = true # Increasing animation? (if @rm2k_mode is true)
@once = false # Is the animation only played once?
@animated = true # Used to stop animation when @once is true
end
#--------------------------------------------------------------------------
# - Change the source rect (change the animation)
# frames : Number of animation frames
# delay : Frame delay, controls animation speed
# offx : X coordinate of the 1st frame
# offy : Y coordinate of all frames
# startf : Starting frame for animation
# once : Is the animation only played once?
# rm2k_mode : Animation pattern: 1-2-3-2 if true, 1-2-3-1 if false
#--------------------------------------------------------------------------
def change(frames = 0, delay = 0, offx = 0, offy = 0,
startf = 0, once = false, rm2k_mode = true)
@frames = frames
@delay = delay
@offset_x, @offset_y = offx, offy
@current_frame = startf
@once = once
@rm2k_mode = rm2k_mode
x = @current_frame * @frame_width + @offset_x
# src_rect is the clipped rectangle from the bitmap.
# Since we don't want the entire battler bitmap, but
# rather one frame, we change it
self.src_rect = Rect.new(x, @offset_y, @frame_width, @frame_height)
@goingup = true
@animated = true
end
#--------------------------------------------------------------------------
# - Update animation and movement
#--------------------------------------------------------------------------
def update
super
# If the bitmap isn't disposed, the delay time has passed and
# the sprite is animated then update stuff
if self.bitmap != nil and delay(@delay) and @animated
x = @current_frame * @frame_width + @offset_x
self.src_rect = Rect.new(x, @offset_y, @frame_width, @frame_height)
# Advance animation depending on the pattern (rm2k or rmxp)
if @rm2k_mode
# Increase if going up, decrease if not
if @goingup
@current_frame = (@current_frame + 1) unless @frames == 0
else
@current_frame = (@current_frame - 1) unless @frames == 0
end
# When the current frame is 0, we'd start increasing it (up)
if @current_frame == 0
@goingup = true
# When the current frame is last frame, decrease it (down)
elsif @current_frame == @frames - 1 and !@once
@goingup = false
# If animation is only to be played once, turn animation off
elsif @current_frame == @frames and @once
@animated = false
end
else
# If we're not using rm2k mode, it's much simpler:
# We always increase
@current_frame = (@current_frame + 1) unless @frames == 0
# And stop animation if animation should be played once
@animated = false if @current_frame == @frames and @once
# Modulus (remainder) is my favorite operator!
# After modulus % is applied, current_frame will never
# go over the total number of frames, if it does then it'd
# go back to 0 (so 1-2-3-...total-0-1-...)
@current_frame %= @frames
end
end
end
#--------------------------------------------------------------------------
# - Setup sprite movement (the actuall movement happens in update)
# x : X coordinate of the destination point
# y : Y coordinate of the destination point
# speed : Speed of movement (0 = delayed, 1+ = faster)
# delay : Movement delay if speed is at 0
#--------------------------------------------------------------------------
def move(x, y, speed = 1, delay = 0)
@destx = x
@desty = y
@move_speed = speed
@move_delay = delay
@move_old = Graphics.frame_count
@moving = true
end
#--------------------------------------------------------------------------
# - Move sprite to destx and desty
#--------------------------------------------------------------------------
def update_move
return unless @moving
# If move_speed is > 0 then increase coordinates
# by move_speed, otherwise increase by 1.
movinc = @move_speed == 0 ? 1 : @move_speed
# And if move_speed = 0, we need to delay movement a bit
if Graphics.frame_count - @move_old > @move_delay or @move_speed != 0
self.x += movinc if self.x < @destx
self.x -= movinc if self.x > @destx
self.y += movinc if self.y < @desty
self.y -= movinc if self.y > @desty
@move_old = Graphics.frame_count
end
if @move_speed > 1 # Check if sprite can't reach that point
self.x = @destx if (@destx - self.x).abs % @move_speed != 0 and
(@destx - self.x).abs <= @move_speed
self.y = @desty if (@desty - self.y).abs % @move_speed != 0 and
(@desty - self.y).abs <= @move_speed
end
if self.x == @destx and self.y == @desty
@moving = false
self.mirror = false
end
end
#--------------------------------------------------------------------------
# - Pause animation, but still updates movement
# frames : Number of frames
#--------------------------------------------------------------------------
def delay(frames)
update_move
# This method was modified a bit from the original
# animated sprite class to make it run more like
# a 'parallel process' rather than freezing everything.
if (Graphics.frame_count - @old >= frames)
@old = Graphics.frame_count
return true
end
return false
end
end
Sprite_Battler**
#==============================================================================
# ■ Sprite_Battler
#------------------------------------------------------------------------------
# バトラー表示用のスプライトです。Game_Battler クラスのインスタンスを監視し、
# スプライトの状態を自動的に変化させます。
#==============================================================================
class Sprite_Battler < Animated_Sprite
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :battler # バトラー Baturaaa~
attr_accessor :frame_width # Width of animation frame
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# viewport : ビューポート
# battler : バトラー (Game_Battler)
#--------------------------------------------------------------------------
def initialize(viewport, battler = nil)
super(viewport)
@battler = battler
@battler_visible = false
# Is the battler dead?
@dead = false
# Defines the width and height of each animation frame (cell),
# feel free to change the numbers (96) to any size that fits
# your game.
@frame_width, @frame_height = 96, 96
# Number of frames in each actor pose
@frames = 3
# Number of frames in each enemy pose
@enemy_frames = 3
# Number of enemy poses in the enemy bitmap,
# this is used to find the frame size of the enemy
# bitmap by dividing the height of the bitmap by
# the number of enemy poses.
@enemy_poses = 4
# Controls the animation speed, represents delay (in ms)
# between each animation frame.
@delay = 10
# Setup the 'base pose' depending on type of enemy
@battler.is_a?(Game_Enemy) ? enemy_pose(0) : pose(0)
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
def dispose
if self.bitmap != nil
self.bitmap.dispose
end
super
end
#--------------------------------------------------------------------------
# - Change the battle pose for an actor (hero)
# number : pose' number
#--------------------------------------------------------------------------
def pose(number)
# Check the Animated Spritre class to know more about
# the change method. Add your own poses by adding a
# 'when', and fixing the parameters of the change
# method to suit the position of the pose in the battler
# bitmap. The FAQ section in readme.txt can provide you
# with more information
case number
when 0 # Normal stance, loops
change(@frames, @delay, 0, 0, 0)
when 1 # Attack, no loop
change(@frames, @delay, 0, @frame_height, 0, true)
when 2 # Skill, loops
change(@frames, @delay, 0, @frame_height * 2)
when 3 # Hurt, loops
change(@frames, @delay, 0, @frame_height * 3)
when 4 # Defend, loops
change(@frames, @delay, 0, @frame_height * 4)
when 5 # Death, loops
change(@frames, @delay, 0, @frame_height * 5)
when 6 # Victory, loops
change(@frames, @delay, 0, @frame_height * 6)
when 7 # Walk, loops
change(@frames, @delay, 0, @frame_height * 7)
when 8 # Item, no loop
change(@frames, @delay, 0, @frame_height * 8, 0, true)
when 9 # Injured
change(@frames, @delay, 0, @frame_height * 9)
when 10 # Sick
change(@frames, @delay, 0, @frame_height * 10)
#when 11
# change(@frames, @delay, 0, @frame_height * 11)
# ...etc.
else
change(@frames, @delay, 0, 0, 0)
end
end
#--------------------------------------------------------------------------
# - Change the battle pose for an enemy
# number : pose' number
#--------------------------------------------------------------------------
def enemy_pose(number)
return unless $game_system.animated_enemy
# Pretty much like the normal pose method.
case number
when 0 # Normal stance, loops
change(@enemy_frames, @delay, 0, 0, 0)
when 1 # Attack, no loop
change(@enemy_frames, @delay, 0, @frame_height, 0, true)
when 2 # Skill, loops
change(@enemy_frames, @delay, 0, @frame_height * 2)
when 3 # Hurt, loops
change(@enemy_frames, @delay, 0, @frame_height * 3)
#when 4
# change(@enemy_frames, @delay, 0, @frame_height * 4)
# ...etc.
else
change(@enemy_frames, @delay, 0, 0, 0)
end
end
#--------------------------------------------------------------------------
# - Defines the default pose for an actor
#--------------------------------------------------------------------------
def default_pose
# The idea behind default pose is that the main pose
# (when not taking any actions) isn't static. For example,
# the battler could be hurt or poisoned. We need to
# check for various things to get the default pose and
# this method is where we do the checking. Then we make
# calls to the pose we want. After each turn in battle, this
# method is called for all actors. Sickness takes
# priority over injury (and injury over normal).
# First, call the normal pose
pose(0)
# If HP is too low (- 25%)
if (@battler.hp * 100) /@battler.maxhp < 25
# Change pose to injured
pose(9)
end
# If the battler is inflicted with a status effect
if @battler.states.size > 0
# Change pose to sick
pose(10)
end
# Idea 1:
# To have more than one pose for injury
# (for example at HP 75%, 50%, 25%) just
# copy and paste the if statement for HP
# and change the number like:
# if (@battler.hp * 100) /@battler.maxhp < 75
# pose(#)
# end
# Where # is the percent that the HP is below.
# Note that in order for this to work you should
# start with the smallest number at the first if
# and the largest at last. Or you could use an elsif.
# Idea 2:
# If you want to have different poses for different
# states (like closed eyes for sleeping). After creating
# the poses (refer to readme.txt) add something like:
# for state in @battler.states
# if state.name = "sleep"
# pose(#)
# elsif state.name = "poison"
# pose(##)
# end
# end
# You can use a case statement instead.
# # and ## would be the numbers of your status effect,
# you can change sleep and poison depending on your effect
# name, you can add stuff the same way. Note that a
# character might have several status effect and in this
# case 'sleep' would take priority.
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
# バトラーが nil の場合
if @battler == nil
self.bitmap = nil
loop_animation(nil)
return
end
# ファイル名か色相が現在のものと異なる場合
if @battler.battler_name != @battler_name or
@battler.battler_hue != @battler_hue
# ビットマップを取得、設定
@battler_name = @battler.battler_name
@battler_hue = @battler.battler_hue
self.bitmap = RPG:

ache.battler(@battler_name, @battler_hue)
@width = bitmap.width
@height = bitmap.height
self.ox = @frame_width / 2
self.oy = @frame_height
if @battler.is_a?(Game_Enemy) and $game_system.animated_enemy
# The frame (cell) size of enemy animation is calculated
@frame_width = self.bitmap.width / @enemy_frames
@frame_height = self.bitmap.height / @enemy_poses
self.ox = @frame_width / 2
self.oy = @frame_height
enemy_pose(0)
elsif @battler.is_a?(Game_Enemy)
# If the enemy isn't animated, there is only one frame...
@frame_width, @frame_height = bitmap.width, bitmap.height
change
self.ox = @width / 2
self.oy = @height
end
# 戦闘不能または隠れ状態なら不透明度を 0 にする
if @battler.dead? or @battler.hidden
self.opacity = 0
end
# The coordinates are only set once, this gives us
# more control on the position of the sprite.
self.x = @battler.screen_x
self.y = @battler.screen_y
self.z = @battler.screen_z
end
# アニメーション ID が現在のものと異なる場合
if @battler.damage == nil and
@battler.state_animation_id != @state_animation_id
@state_animation_id = @battler.state_animation_id
loop_animation($data_animations[@state_animation_id])
end
# 表示されるべきアクターの場合
if @battler.is_a?(Game_Actor) and @battler_visible
# メインフェーズでないときは不透明度をやや下げる
if $game_temp.battle_main_phase
self.opacity += 3 if self.opacity < 255
else
self.opacity -= 3 if self.opacity > 207
end
end
# 明滅
if @battler.blink
blink_on
else
blink_off
end
# 不可視の場合
unless @battler_visible
# 出現
if not @battler.hidden and not @battler.dead? and
(@battler.damage == nil or @battler.damage_pop)
appear
@battler_visible = true
end
# Even if the actor is dead, s/he'd still appear
# in their "dead" pose.
if not @battler.hidden and
(@battler.damage == nil or @battler.damage_pop) and
@battler.is_a?(Game_Actor)
appear
@battler_visible = true
end
end
# 可視の場合
if @battler_visible
# 逃走
if @battler.hidden
$game_system.se_play($data_system.escape_se)
escape
@battler_visible = false
end
# 白フラッシュ
if @battler.white_flash
whiten
@battler.white_flash = false
end
# アニメーション
if @battler.animation_id != 0
animation = $data_animations[@battler.animation_id]
animation(animation, @battler.animation_hit)
@battler.animation_id = 0
end
# ダメージ
if @battler.damage_pop
damage(@battler.damage, @battler.critical)
@battler.damage = nil
@battler.critical = false
@battler.damage_pop = false
end
# コラプス
if @battler.damage == nil and @battler.dead?
if @battler.is_a?(Game_Enemy)
$game_system.se_play($data_system.enemy_collapse_se)
collapse
@battler_visible = false
else
# You don't want it to play the collapse SE forever.
$game_system.se_play($data_system.actor_collapse_se) unless @dead
@dead = true
# Death pose.
pose(5)
end
else
@dead = false
end
end
# スプライトの座標を設定
end
end
Spriteset_Battle*
#==============================================================================
# ■ Spriteset_Battle
#------------------------------------------------------------------------------
# バトル画面のスプライトをまとめたクラスです。このクラスは Scene_Battle クラ
# スの内部で使用されます。
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :viewport0 # Enemy viewport
attr_reader :viewport1 # エネミー側のビューポート
attr_reader :viewport2 # アクター側のビューポート
# We need to access sprites within the battle system to
# move them or change their poses. For that reason
# we allow access to both actor sprites and enemy
# sprite arrays, this'd allow us to access the sprites
# of actors like:
# @spriteset.actor_sprites[index].pose(number)
attr_accessor :actor_sprites # An array holding actor sprites
attr_accessor

nemy_sprites # An array holding enemy sprites
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
# ビューポートを作成
# Added a new viewport (viewport0) to hold enemies
@viewport0 = Viewport.new(0, 0, 640, 480)
@viewport1 = Viewport.new(0, 0, 640, 320)
@viewport2 = Viewport.new(0, 0, 640, 480)
@viewport3 = Viewport.new(0, 0, 640, 480)
@viewport4 = Viewport.new(0, 0, 640, 480)
# Having a separate viewport for enemy = control
# over their z (priority)
@viewport0.z = 100
@viewport2.z = 101
@viewport3.z = 200
@viewport4.z = 5000
# バトルバックスプライトを作成
@battleback_sprite = Sprite.new(@viewport1)
# エネミースプライトを作成
@enemy_sprites = []
for enemy in $game_troop.enemies
# Add enemies to viewport0
@enemy_sprites.push(Sprite_Battler.new(@viewport0, enemy))
end
# アクタースプライトを作成
@actor_sprites = []
@actor_sprites.push(Sprite_Battler.new(@viewport2))
@actor_sprites.push(Sprite_Battler.new(@viewport2))
@actor_sprites.push(Sprite_Battler.new(@viewport2))
@actor_sprites.push(Sprite_Battler.new(@viewport2))
# 天候を作成
@weather = RPG::Weather.new(@viewport1)
# ピクチャスプライトを作成
@picture_sprites = []
for i in 51..100
@picture_sprites.push(Sprite_Picture.new(@viewport3,
$game_screen.pictures[i]))
end
# タイマースプライトを作成
@timer_sprite = Sprite_Timer.new
# フレーム更新
update
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
def dispose
# バトルバックビットマップが存在していたら解放
if @battleback_sprite.bitmap != nil
@battleback_sprite.bitmap.dispose
end
# バトルバックスプライトを解放
@battleback_sprite.dispose
# エネミースプライト、アクタースプライトを解放
for sprite in @enemy_sprites + @actor_sprites
sprite.dispose
end
# 天候を解放
@weather.dispose
# ピクチャスプライトを解放
for sprite in @picture_sprites
sprite.dispose
end
# タイマースプライトを解放
@timer_sprite.dispose
# ビューポートを解放
# Dispose of the new viewport
@viewport0.dispose
@viewport1.dispose
@viewport2.dispose
@viewport3.dispose
@viewport4.dispose
end
#--------------------------------------------------------------------------
# ● エフェクト表示中判定
#--------------------------------------------------------------------------
def effect?
# エフェクトが一つでも表示中なら true を返す
for sprite in @enemy_sprites + @actor_sprites
return true if sprite.effect?
end
return false
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
# アクタースプライトの内容を更新 (アクターの入れ替えに対応)
@actor_sprites[0].battler = $game_party.actors[0]
@actor_sprites[1].battler = $game_party.actors[1]
@actor_sprites[2].battler = $game_party.actors[2]
@actor_sprites[3].battler = $game_party.actors[3]
# バトルバックのファイル名が現在のものと違う場合
if @battleback_name != $game_temp.battleback_name
@battleback_name = $game_temp.battleback_name
if @battleback_sprite.bitmap != nil
@battleback_sprite.bitmap.dispose
end
@battleback_sprite.bitmap = RPG:

ache.battleback(@battleback_name)
@battleback_sprite.src_rect.set(0, 0, 640, 320)
end
# バトラースプライトを更新
for sprite in @enemy_sprites + @actor_sprites
sprite.update
end
# 天候グラフィックを更新
@weather.type = $game_screen.weather_type
@weather.max = $game_screen.weather_max
@weather.update
# ピクチャスプライトを更新
for sprite in @picture_sprites
sprite.update
end
# タイマースプライトを更新
@timer_sprite.update
# 画面の色調とシェイク位置を設定
@viewport1.tone = $game_screen.tone
@viewport1.ox = $game_screen.shake
# 画面のフラッシュ色を設定
@viewport4.color = $game_screen.flash_color
# ビューポートを更新
# Update viewport0
@viewport0.update
@viewport1.update
@viewport2.update
@viewport4.update
end
end
Window_Help*
#==============================================================================
# ■ Window_Help
#------------------------------------------------------------------------------
# スキルやアイテムの説明、アクターのステータスなどを表示するウィンドウです。
#==============================================================================
class Window_Help < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
# Just fixed the z coordinates so that the window
# isn't drawn under the battlers.
self.z = 102
end
#--------------------------------------------------------------------------
# ● テキスト設定
# text : ウィンドウに表示する文字列
# align : アラインメント (0..左揃え、1..中央揃え、2..右揃え)
#--------------------------------------------------------------------------
def set_text(text, align = 0)
# テキストとアラインメントの少なくとも一方が前回と違っている場合
if text != @text or align != @align
# テキストを再描画
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
@text = text
@align = align
@actor = nil
end
self.visible = true
end
#--------------------------------------------------------------------------
# ● アクター設定
# actor : ステータスを表示するアクター
#--------------------------------------------------------------------------
def set_actor(actor)
if actor != @actor
self.contents.clear
draw_actor_name(actor, 4, 0)
draw_actor_state(actor, 140, 0)
draw_actor_hp(actor, 284, 0)
draw_actor_sp(actor, 460, 0)
@actor = actor
@text = nil
self.visible = true
end
end
#--------------------------------------------------------------------------
# ● エネミー設定
# enemy : 名前とステートを表示するエネミー
#--------------------------------------------------------------------------
def set_enemy(enemy)
text = enemy.name
state_text = make_battler_state_text(enemy, 112, false)
if state_text != ""
text += " " + state_text
end
set_text(text, 1)
end
end
Window_Item*
#==============================================================================
# ■ Window_Item
#------------------------------------------------------------------------------
# アイテム画面、バトル画面で、所持アイテムの一覧を表示するウィンドウです。
#==============================================================================
class Window_Item < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 64, 640, 416)
@column_max = 2
refresh
self.index = 0
# 戦闘中の場合はウィンドウを画面中央へ移動し、半透明にする
if $game_temp.in_battle
self.y = 64
# Just fixed the z coordinates so that the window
# isn't drawn under the battlers.
self.z = 102
self.height = 256
self.back_opacity = 160
end
end
#--------------------------------------------------------------------------
# ● アイテムの取得
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# アイテムを追加
for i in 1...$data_items.size
if $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
# 戦闘中以外なら武器と防具も追加
unless $game_temp.in_battle
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
@data.push($data_weapons[i])
end
end
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
end
# 項目数が 0 でなければビットマップを作成し、全項目を描画
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# ● 項目の描画
# index : 項目番号
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
case item
when RPG::Item
number = $game_party.item_number(item.id)
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG:

rmor
number = $game_party.armor_number(item.id)
end
if item.is_a?(RPG::Item) and
$game_party.item_can_use?(item.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG:

ache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
Window_Skill*
#==============================================================================
# ■ Window_Skill
#------------------------------------------------------------------------------
# スキル画面、バトル画面で、使用できるスキルの一覧を表示するウィンドウです。
#==============================================================================
class Window_Skill < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# actor : アクター
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 128, 640, 352)
@actor = actor
@column_max = 2
refresh
self.index = 0
# 戦闘中の場合はウィンドウを画面中央へ移動し、半透明にする
if $game_temp.in_battle
self.y = 64
# Just fixed the z coordinates so that the window
# isn't drawn under the battlers.
self.z = 102
self.height = 256
self.back_opacity = 160
end
end
#--------------------------------------------------------------------------
# ● スキルの取得
#--------------------------------------------------------------------------
def skill
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 0...@actor.skills.size
skill = $data_skills[@actor.skills[i]]
if skill != nil
@data.push(skill)
end
end
# 項目数が 0 でなければビットマップを作成し、全項目を描画
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# ● 項目の描画
# index : 項目番号
#--------------------------------------------------------------------------
def draw_item(index)
skill = @data[index]
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG:

ache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.skill == nil ? "" : self.skill.description)
end
end
Window_PartyCommand*
#==============================================================================
# ■ Window_PartyCommand
#------------------------------------------------------------------------------
# バトル画面で、戦うか逃げるかを選択するウィンドウです。
#==============================================================================
class Window_PartyCommand < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 160
@commands = ["Kämpfen", "Fliehen"]
@item_max = 2
@column_max = 2
draw_item(0, normal_color)
draw_item(1, $game_temp.battle_can_escape ? normal_color : disabled_color)
self.active = false
self.visible = false
# Just fixed the z coordinates so that the window
# isn't drawn under the battlers.
self.z = 102
self.index = 0
end
#--------------------------------------------------------------------------
# ● 項目の描画
# index : 項目番号
# color : 文字色
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
rect = Rect.new(160 + index * 160 + 4, 0, 128 - 10, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index], 1)
end
#--------------------------------------------------------------------------
# ● カーソルの矩形更新
#--------------------------------------------------------------------------
def update_cursor_rect
self.cursor_rect.set(160 + index * 160, 0, 128, 32)
end
end
Window_BattleResult*
#==============================================================================
# ■ Window_BattleResult
#------------------------------------------------------------------------------
# バトル終了時に、獲得した EXP やゴールドなどを表示するウィンドウです。
#==============================================================================
class Window_BattleResult < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# exp : EXP
# gold : ゴールド
# treasures : トレジャー
#--------------------------------------------------------------------------
def initialize(exp, gold, treasures)
@exp = exp
@gold = gold
@treasures = treasures
super(160, 0, 320, @treasures.size * 32 + 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.y = 160 - height / 2
self.back_opacity = 160
# Just fixed the z coordinates so that the window
# isn't drawn under the battlers.
self.z = 102
self.visible = false
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
x = 4
self.contents.font.color = normal_color
cx = contents.text_size(@exp.to_s).width
self.contents.draw_text(x, 0, cx, 32, @exp.to_s)
x += cx + 4
self.contents.font.color = system_color
cx = contents.text_size("Erfahrung").width
self.contents.draw_text(x, 0, 64, 32, "Erfahrung")
x += cx + 16
self.contents.font.color = normal_color
cx = contents.text_size(@gold.to_s).width
self.contents.draw_text(x, 0, cx, 32, @gold.to_s)
x += cx + 4
self.contents.font.color = system_color
self.contents.draw_text(x, 0, 128, 32, $data_system.words.gold)
y = 32
for item in @treasures
draw_item_name(item, 4, y)
y += 32
end
end
end
Scene_Battle 1*
#==============================================================================
# ■ Scene_Battle (分割定義 1)
#------------------------------------------------------------------------------
# バトル画面の処理を行うクラスです。
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
def main
# 戦闘用の各種一時データを初期化
$game_temp.in_battle = true
$game_temp.battle_turn = 0
$game_temp.battle_event_flags.clear
$game_temp.battle_abort = false
$game_temp.battle_main_phase = false
$game_temp.battleback_name = $game_map.battleback_name
$game_temp.forcing_battler = nil
# バトルイベント用インタプリタを初期化
$game_system.battle_interpreter.setup(nil, 0)
# トループを準備
@troop_id = $game_temp.battle_troop_id
$game_troop.setup(@troop_id)
# アクターコマンドウィンドウを作成
s1 = $data_system.words.attack
s2 = $data_system.words.skill
s3 = $data_system.words.guard
s4 = $data_system.words.item
@actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
@actor_command_window.y = 160
# Fixed the z coordinates so that the window
# isn't drawn under the battlers.
@actor_command_window.z = 102
@actor_command_window.back_opacity = 160
@actor_command_window.active = false
@actor_command_window.visible = false
# その他のウィンドウを作成
@party_command_window = Window_PartyCommand.new
@help_window = Window_Help.new
@help_window.back_opacity = 160
@help_window.visible = false
@status_window = Window_BattleStatus.new
@message_window = Window_Message.new
# スプライトセットを作成
@spriteset = Spriteset_Battle.new
# ウェイトカウントを初期化
@wait_count = 0
# トランジション実行
if $data_system.battle_transition == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$data_system.battle_transition)
end
# プレバトルフェーズ開始
start_phase1
# メインループ
loop do
# ゲーム画面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if $scene != self
break
end
end
# マップをリフレッシュ
$game_map.refresh
# トランジション準備
Graphics.freeze
# ウィンドウを解放
@actor_command_window.dispose
@party_command_window.dispose
@help_window.dispose
@status_window.dispose
@message_window.dispose
if @skill_window != nil
@skill_window.dispose
end
if @item_window != nil
@item_window.dispose
end
if @result_window != nil
@result_window.dispose
end
# スプライトセットを解放
@spriteset.dispose
# タイトル画面に切り替え中の場合
if $scene.is_a?(Scene_Title)
# 画面をフェードアウト
Graphics.transition
Graphics.freeze
end
# 戦闘テストからゲームオーバー画面以外に切り替え中の場合
if $BTEST and not $scene.is_a?(Scene_Gameover)
$scene = nil
end
end
#--------------------------------------------------------------------------
# ● 勝敗判定
#--------------------------------------------------------------------------
def judge
# 全滅判定が真、またはパーティ人数が 0 人の場合
if $game_party.all_dead? or $game_party.actors.size == 0
# 敗北可能の場合
if $game_temp.battle_can_lose
# バトル開始前の BGM に戻す
$game_system.bgm_play($game_temp.map_bgm)
# バトル終了
battle_end(2)
# true を返す
return true
end
# ゲームオーバーフラグをセット
$game_temp.gameover = true
# true を返す
return true
end
# エネミーが 1 体でも存在すれば false を返す
for enemy in $game_troop.enemies
if enemy.exist?
return false
end
end
# アフターバトルフェーズ開始 (勝利)
start_phase5
# true を返す
return true
end
#--------------------------------------------------------------------------
# ● バトル終了
# result : 結果 (0:勝利 1:敗北 2:逃走)
#--------------------------------------------------------------------------
def battle_end(result)
# 戦闘中フラグをクリア
$game_temp.in_battle = false
# パーティ全員のアクションをクリア
$game_party.clear_actions
# バトル用ステートを解除
for actor in $game_party.actors
actor.remove_states_battle
end
# エネミーをクリア
$game_troop.enemies.clear
# バトル コールバックを呼ぶ
if $game_temp.battle_proc != nil
$game_temp.battle_proc.call(result)
$game_temp.battle_proc = nil
end
# マップ画面に切り替え
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# ● バトルイベントのセットアップ
#--------------------------------------------------------------------------
def setup_battle_event
# バトルイベント実行中の場合
if $game_system.battle_interpreter.running?
return
end
# バトルイベントの全ページを検索
for index in 0...$data_troops[@troop_id].pages.size
# イベントページを取得
page = $data_troops[@troop_id].pages[index]
# イベント条件を c で参照可能に
c = page.condition
# 何も条件が指定されていない場合は次のページへ
unless c.turn_valid or c.enemy_valid or
c.actor_valid or c.switch_valid
next
end
# 実行済みの場合は次のページへ
if $game_temp.battle_event_flags[index]
next
end
# ターン 条件確認
if c.turn_valid
n = $game_temp.battle_turn
a = c.turn_a
b = c.turn_b
if (b == 0 and n != a) or
# Hello confusion! Oh, nevermind, it's not my script

(b > 0 and (n < 1 or n < a or n % b != a % b))
next
end
end
# エネミー 条件確認
if c.enemy_valid
enemy = $game_troop.enemies[c.enemy_index]
if enemy == nil or enemy.hp * 100.0 / enemy.maxhp > c.enemy_hp
next
end
end
# アクター 条件確認
if c.actor_valid
actor = $game_actors[c.actor_id]
if actor == nil or actor.hp * 100.0 / actor.maxhp > c.actor_hp
next
end
end
# スイッチ 条件確認
if c.switch_valid
if $game_switches[c.switch_id] == false
next
end
end
# イベントをセットアップ
$game_system.battle_interpreter.setup(page.list, 0)
# このページのスパンが [バトル] か [ターン] の場合
if page.span <= 1
# 実行済みフラグをセット
$game_temp.battle_event_flags[index] = true
end
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
# バトルイベント実行中の場合
if $game_system.battle_interpreter.running?
# インタプリタを更新
$game_system.battle_interpreter.update
# アクションを強制されているバトラーが存在しない場合
if $game_temp.forcing_battler == nil
# バトルイベントの実行が終わった場合
unless $game_system.battle_interpreter.running?
# 戦闘継続の場合、バトルイベントのセットアップを再実行
unless judge
setup_battle_event
end
end
# アフターバトルフェーズでなければ
if @phase != 5
# ステータスウィンドウをリフレッシュ
@status_window.refresh
end
end
end
# システム (タイマー)、画面を更新
$game_system.update
$game_screen.update
# タイマーが 0 になった場合
if $game_system.timer_working and $game_system.timer == 0
# バトル中断
$game_temp.battle_abort = true
end
# ウィンドウを更新
@help_window.update
@party_command_window.update
@actor_command_window.update
@status_window.update
@message_window.update
# スプライトセットを更新
@spriteset.update
# トランジション処理中の場合
if $game_temp.transition_processing
# トランジション処理中フラグをクリア
$game_temp.transition_processing = false
# トランジション実行
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
# メッセージウィンドウ表示中の場合
if $game_temp.message_window_showing
return
end
# エフェクト表示中の場合
if @spriteset.effect?
return
end
# ゲームオーバーの場合
if $game_temp.gameover
# ゲームオーバー画面に切り替え
$scene = Scene_Gameover.new
return
end
# タイトル画面に戻す場合
if $game_temp.to_title
# タイトル画面に切り替え
$scene = Scene_Title.new
return
end
# バトル中断の場合
if $game_temp.battle_abort
# バトル開始前の BGM に戻す
$game_system.bgm_play($game_temp.map_bgm)
# バトル終了
battle_end(1)
return
end
# ウェイト中の場合
if @wait_count > 0
# ウェイトカウントを減らす
@wait_count -= 1
return
end
# The following two for loops check if an
# actor or enemy are moving and halts the
# battle until they reach their destination
for actor in @spriteset.actor_sprites
if actor.moving
return
end
end
for enemy in @spriteset.enemy_sprites
if enemy.moving and $game_system.animated_enemy
return
end
end
# アクションを強制されているバトラーが存在せず、
# かつバトルイベントが実行中の場合
if $game_temp.forcing_battler == nil and
$game_system.battle_interpreter.running?
return
end
# フェーズによって分岐
case @phase
when 1 # プレバトルフェーズ
update_phase1
when 2 # パーティコマンドフェーズ
update_phase2
when 3 # アクターコマンドフェーズ
update_phase3
when 4 # メインフェーズ
update_phase4
when 5 # アフターバトルフェーズ
update_phase5
end
end
end
Scene_Battle 2*
#==============================================================================
# ■ Scene_Battle (分割定義 2)
#------------------------------------------------------------------------------
# バトル画面の処理を行うクラスです。
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● プレバトルフェーズ開始
#--------------------------------------------------------------------------
def start_phase1
# フェーズ 1 に移行
@phase = 1
# パーティ全員のアクションをクリア
$game_party.clear_actions
# バトルイベントをセットアップ
setup_battle_event
end
#--------------------------------------------------------------------------
# ● フレーム更新 (プレバトルフェーズ)
#--------------------------------------------------------------------------
def update_phase1
# 勝敗判定
if judge
# 勝利または敗北の場合 : メソッド終了
return
end
# パーティコマンドフェーズ開始
start_phase2
end
#--------------------------------------------------------------------------
# ● パーティコマンドフェーズ開始
#--------------------------------------------------------------------------
def start_phase2
# フェーズ 2 に移行
@phase = 2
# アクターを非選択状態に設定
@actor_index = -1
@active_battler = nil
# パーティコマンドウィンドウを有効化
@party_command_window.active = true
@party_command_window.visible = true
# アクターコマンドウィンドウを無効化
@actor_command_window.active = false
@actor_command_window.visible = false
# メインフェーズフラグをクリア
$game_temp.battle_main_phase = false
# パーティ全員のアクションをクリア
$game_party.clear_actions
# コマンド入力不可能な場合
unless $game_party.inputable?
# メインフェーズ開始
start_phase4
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (パーティコマンドフェーズ)
#--------------------------------------------------------------------------
def update_phase2
# C ボタンが押された場合
if Input.trigger?(Input:

)
# パーティコマンドウィンドウのカーソル位置で分岐
case @party_command_window.index
when 0 # 戦う
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# アクターコマンドフェーズ開始
start_phase3
when 1 # 逃げる
# 逃走可能ではない場合
if $game_temp.battle_can_escape == false
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# 逃走処理
update_phase2_escape
end
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (パーティコマンドフェーズ : 逃げる)
#--------------------------------------------------------------------------
def update_phase2_escape
# エネミーの素早さ平均値を計算
enemies_agi = 0
enemies_number = 0
for enemy in $game_troop.enemies
if enemy.exist?
enemies_agi += enemy.agi
enemies_number += 1
end
end
if enemies_number > 0
enemies_agi /= enemies_number
end
# アクターの素早さ平均値を計算
actors_agi = 0
actors_number = 0
for actor in $game_party.actors
if actor.exist?
actors_agi += actor.agi
actors_number += 1
end
end
if actors_number > 0
actors_agi /= actors_number
end
# 逃走成功判定
success = rand(100) < 50 * actors_agi / enemies_agi
# 逃走成功の場合
if success
# 逃走 SE を演奏
$game_system.se_play($data_system.escape_se)
# バトル開始前の BGM に戻す
$game_system.bgm_play($game_temp.map_bgm)
# バトル終了
battle_end(1)
# 逃走失敗の場合
else
# パーティ全員のアクションをクリア
$game_party.clear_actions
# メインフェーズ開始
start_phase4
end
end
#--------------------------------------------------------------------------
# ● アフターバトルフェーズ開始
#--------------------------------------------------------------------------
def start_phase5
# フェーズ 5 に移行
@phase = 5
# バトル終了 ME を演奏
$game_system.me_play($game_system.battle_end_me)
# バトル開始前の BGM に戻す
$game_system.bgm_play($game_temp.map_bgm)
# EXP、ゴールド、トレジャーを初期化
exp = 0
gold = 0
treasures = []
# ループ
for enemy in $game_troop.enemies
# エネミーが隠れ状態でない場合
unless enemy.hidden
# 獲得 EXP、ゴールドを追加
exp += enemy.exp
gold += enemy.gold
# トレジャー出現判定
if rand(100) < enemy.treasure_prob
if enemy.item_id > 0
treasures.push($data_items[enemy.item_id])
end
if enemy.weapon_id > 0
treasures.push($data_weapons[enemy.weapon_id])
end
if enemy.armor_id > 0
treasures.push($data_armors[enemy.armor_id])
end
end
end
end
# トレジャーの数を 6 個までに限定
treasures = treasures[0..5]
# EXP 獲得
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
# Change each actor's pose to victory (6) unless dead
@spriteset.actor_sprites[i].pose(6) unless actor.dead?
if actor.cant_get_exp? == false
last_level = actor.level
actor.exp += exp
if actor.level > last_level
@status_window.level_up(i)
end
end
end
# ゴールド獲得
$game_party.gain_gold(gold)
# トレジャー獲得
for item in treasures
case item
when RPG::Item
$game_party.gain_item(item.id, 1)
when RPG::Weapon
$game_party.gain_weapon(item.id, 1)
when RPG:

rmor
$game_party.gain_armor(item.id, 1)
end
end
# バトルリザルトウィンドウを作成
@result_window = Window_BattleResult.new(exp, gold, treasures)
# ウェイトカウントを設定
@phase5_wait_count = 100
end
#--------------------------------------------------------------------------
# ● フレーム更新 (アフターバトルフェーズ)
#--------------------------------------------------------------------------
def update_phase5
# ウェイトカウントが 0 より大きい場合
if @phase5_wait_count > 0
# ウェイトカウントを減らす
@phase5_wait_count -= 1
# ウェイトカウントが 0 になった場合
if @phase5_wait_count == 0
# リザルトウィンドウを表示
@result_window.visible = true
# メインフェーズフラグをクリア
$game_temp.battle_main_phase = false
# ステータスウィンドウをリフレッシュ
@status_window.refresh
end
return
end
# C ボタンが押された場合
if Input.trigger?(Input:

)
# バトル終了
battle_end(0)
end
end
end
Scene_Battle 3*
#==============================================================================
# ■ Scene_Battle (分割定義 3)
#------------------------------------------------------------------------------
# バトル画面の処理を行うクラスです。
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● アクターコマンドフェーズ開始
#--------------------------------------------------------------------------
def start_phase3
# フェーズ 3 に移行
@phase = 3
# アクターを非選択状態に設定
@actor_index = -1
@active_battler = nil
# 次のアクターのコマンド入力へ
phase3_next_actor
end
#--------------------------------------------------------------------------
# ● 次のアクターのコマンド入力へ
#--------------------------------------------------------------------------
def phase3_next_actor
# ループ
begin
# アクターの明滅エフェクト OFF
if @active_battler != nil
@active_battler.blink = false
end
# 最後のアクターの場合
if @actor_index == $game_party.actors.size-1
# メインフェーズ開始
start_phase4
return
end
# アクターのインデックスを進める
@actor_index += 1
@active_battler = $game_party.actors[@actor_index]
@active_battler.blink = true
# アクターがコマンド入力を受け付けない状態ならもう一度
end until @active_battler.inputable?
# アクターコマンドウィンドウをセットアップ
phase3_setup_command_window
end
#--------------------------------------------------------------------------
# ● 前のアクターのコマンド入力へ
#--------------------------------------------------------------------------
def phase3_prior_actor
# ループ
begin
# アクターの明滅エフェクト OFF
if @active_battler != nil
@active_battler.blink = false
end
# 最初のアクターの場合
if @actor_index == 0
# パーティコマンドフェーズ開始
start_phase2
return
end
# アクターのインデックスを戻す
@actor_index -= 1
@active_battler = $game_party.actors[@actor_index]
@active_battler.blink = true
# アクターがコマンド入力を受け付けない状態ならもう一度
end until @active_battler.inputable?
# アクターコマンドウィンドウをセットアップ
phase3_setup_command_window
end
#--------------------------------------------------------------------------
# ● アクターコマンドウィンドウのセットアップ
#--------------------------------------------------------------------------
def phase3_setup_command_window
# パーティコマンドウィンドウを無効化
@party_command_window.active = false
@party_command_window.visible = false
# アクターコマンドウィンドウを有効化
@actor_command_window.active = true
@actor_command_window.visible = true
# アクターコマンドウィンドウの位置を設定
@actor_command_window.x = @actor_index * 160
# インデックスを 0 に設定
@actor_command_window.index = 0
end
#--------------------------------------------------------------------------
# ● フレーム更新 (アクターコマンドフェーズ)
#--------------------------------------------------------------------------
def update_phase3
# エネミーアローが有効の場合
if @enemy_arrow != nil
update_phase3_enemy_select
# アクターアローが有効の場合
elsif @actor_arrow != nil
update_phase3_actor_select
# スキルウィンドウが有効の場合
elsif @skill_window != nil
update_phase3_skill_select
# アイテムウィンドウが有効の場合
elsif @item_window != nil
update_phase3_item_select
# アクターコマンドウィンドウが有効の場合
elsif @actor_command_window.active
update_phase3_basic_command
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (アクターコマンドフェーズ : 基本コマンド)
#--------------------------------------------------------------------------
def update_phase3_basic_command
# B ボタンが押された場合
if Input.trigger?(Input:

)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# 前のアクターのコマンド入力へ
phase3_prior_actor
return
end
# C ボタンが押された場合
if Input.trigger?(Input:

)
# アクターコマンドウィンドウのカーソル位置で分岐
case @actor_command_window.index
when 0 # 攻撃
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# アクションを設定
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 0
# エネミーの選択を開始
start_enemy_select
when 1 # スキル
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# アクションを設定
@active_battler.current_action.kind = 1
# スキルの選択を開始
start_skill_select
when 2 # 防御
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# アクションを設定
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 1
# 次のアクターのコマンド入力へ
phase3_next_actor
when 3 # アイテム
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# アクションを設定
@active_battler.current_action.kind = 2
# アイテムの選択を開始
start_item_select
end
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (アクターコマンドフェーズ : スキル選択)
#--------------------------------------------------------------------------
def update_phase3_skill_select
# スキルウィンドウを可視状態にする
@skill_window.visible = true
# スキルウィンドウを更新
@skill_window.update
# B ボタンが押された場合
if Input.trigger?(Input:

)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# スキルの選択を終了
end_skill_select
return
end
# C ボタンが押された場合
if Input.trigger?(Input:

)
# スキルウィンドウで現在選択されているデータを取得
@skill = @skill_window.skill
# 使用できない場合
if @skill == nil or not @active_battler.skill_can_use?(@skill.id)
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# アクションを設定
@active_battler.current_action.skill_id = @skill.id
# スキルウィンドウを不可視状態にする
@skill_window.visible = false
# 効果範囲が敵単体の場合
if @skill.scope == 1
# エネミーの選択を開始
start_enemy_select
# 効果範囲が味方単体の場合
elsif @skill.scope == 3 or @skill.scope == 5
# アクターの選択を開始
start_actor_select
# 効果範囲が単体ではない場合
else
# スキルの選択を終了
end_skill_select
# 次のアクターのコマンド入力へ
phase3_next_actor
end
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (アクターコマンドフェーズ : アイテム選択)
#--------------------------------------------------------------------------
def update_phase3_item_select
# アイテムウィンドウを可視状態にする
@item_window.visible = true
# アイテムウィンドウを更新
@item_window.update
# B ボタンが押された場合
if Input.trigger?(Input:

)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# アイテムの選択を終了
end_item_select
return
end
# C ボタンが押された場合
if Input.trigger?(Input:

)
# アイテムウィンドウで現在選択されているデータを取得
@item = @item_window.item
# 使用できない場合
unless $game_party.item_can_use?(@item.id)
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# アクションを設定
@active_battler.current_action.item_id = @item.id
# アイテムウィンドウを不可視状態にする
@item_window.visible = false
# 効果範囲が敵単体の場合
if @item.scope == 1
# エネミーの選択を開始
start_enemy_select
# 効果範囲が味方単体の場合
elsif @item.scope == 3 or @item.scope == 5
# アクターの選択を開始
start_actor_select
# 効果範囲が単体ではない場合
else
# アイテムの選択を終了
end_item_select
# 次のアクターのコマンド入力へ
phase3_next_actor
end
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (アクターコマンドフェーズ : エネミー選択)
#--------------------------------------------------------------------------
def update_phase3_enemy_select
# エネミーアローを更新
@enemy_arrow.update
# B ボタンが押された場合
if Input.trigger?(Input:

)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# エネミーの選択を終了
end_enemy_select
return
end
# C ボタンが押された場合
if Input.trigger?(Input:

)
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# アクションを設定
@active_battler.current_action.target_index = @enemy_arrow.index
# エネミーの選択を終了
end_enemy_select
# スキルウィンドウ表示中の場合
if @skill_window != nil
# スキルの選択を終了
end_skill_select
end
# アイテムウィンドウ表示中の場合
if @item_window != nil
# アイテムの選択を終了
end_item_select
end
# 次のアクターのコマンド入力へ
phase3_next_actor
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (アクターコマンドフェーズ : アクター選択)
#--------------------------------------------------------------------------
def update_phase3_actor_select
# アクターアローを更新
@actor_arrow.update
# B ボタンが押された場合
if Input.trigger?(Input:

)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# アクターの選択を終了
end_actor_select
return
end
# C ボタンが押された場合
if Input.trigger?(Input:

)
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# アクションを設定
@active_battler.current_action.target_index = @actor_arrow.index
# アクターの選択を終了
end_actor_select
# スキルウィンドウ表示中の場合
if @skill_window != nil
# スキルの選択を終了
end_skill_select
end
# アイテムウィンドウ表示中の場合
if @item_window != nil
# アイテムの選択を終了
end_item_select
end
# 次のアクターのコマンド入力へ
phase3_next_actor
end
end
#--------------------------------------------------------------------------
# ● エネミー選択開始
#--------------------------------------------------------------------------
def start_enemy_select
# エネミーアローを作成
# The arrows' viewport should be 0 (enemies)
@enemy_arrow = Arrow_Enemy.new(@spriteset.viewport0)
# ヘルプウィンドウを関連付け
@enemy_arrow.help_window = @help_window
# アクターコマンドウィンドウを無効化
@actor_command_window.active = false
@actor_command_window.visible = false
end
#--------------------------------------------------------------------------
# ● エネミー選択終了
#--------------------------------------------------------------------------
def end_enemy_select
# エネミーアローを解放
@enemy_arrow.dispose
@enemy_arrow = nil
# コマンドが [戦う] の場合
if @actor_command_window.index == 0
# アクターコマンドウィンドウを有効化
@actor_command_window.active = true
@actor_command_window.visible = true
# ヘルプウィンドウを隠す
@help_window.visible = false
end
end
#--------------------------------------------------------------------------
# ● アクター選択開始
#--------------------------------------------------------------------------
def start_actor_select
# アクターアローを作成
@actor_arrow = Arrow_Actor.new(@spriteset.viewport2)
@actor_arrow.index = @actor_index
# ヘルプウィンドウを関連付け
@actor_arrow.help_window = @help_window
# アクターコマンドウィンドウを無効化
@actor_command_window.active = false
@actor_command_window.visible = false
end
#--------------------------------------------------------------------------
# ● アクター選択終了
#--------------------------------------------------------------------------
def end_actor_select
# アクターアローを解放
@actor_arrow.dispose
@actor_arrow = nil
end
#--------------------------------------------------------------------------
# ● スキル選択開始
#--------------------------------------------------------------------------
def start_skill_select
# スキルウィンドウを作成
@skill_window = Window_Skill.new(@active_battler)
# ヘルプウィンドウを関連付け
@skill_window.help_window = @help_window
# アクターコマンドウィンドウを無効化
@actor_command_window.active = false
@actor_command_window.visible = false
end
#--------------------------------------------------------------------------
# ● スキル選択終了
#--------------------------------------------------------------------------
def end_skill_select
# スキルウィンドウを解放
@skill_window.dispose
@skill_window = nil
# ヘルプウィンドウを隠す
@help_window.visible = false
# アクターコマンドウィンドウを有効化
@actor_command_window.active = true
@actor_command_window.visible = true
end
#--------------------------------------------------------------------------
# ● アイテム選択開始
#--------------------------------------------------------------------------
def start_item_select
# アイテムウィンドウを作成
@item_window = Window_Item.new
# ヘルプウィンドウを関連付け
@item_window.help_window = @help_window
# アクターコマンドウィンドウを無効化
@actor_command_window.active = false
@actor_command_window.visible = false
end
#--------------------------------------------------------------------------
# ● アイテム選択終了
#--------------------------------------------------------------------------
def end_item_select
# アイテムウィンドウを解放
@item_window.dispose
@item_window = nil
# ヘルプウィンドウを隠す
@help_window.visible = false
# アクターコマンドウィンドウを有効化
@actor_command_window.active = true
@actor_command_window.visible = true
end
end
Scene_Battle 4**
#==============================================================================
# ■ Scene_Battle (分割定義 4)
#------------------------------------------------------------------------------
# バトル画面の処理を行うクラスです。
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● メインフェーズ開始
#--------------------------------------------------------------------------
def start_phase4
# フェーズ 4 に移行
@phase = 4
# ターン数カウント
$game_temp.battle_turn += 1
# バトルイベントの全ページを検索
for index in 0...$data_troops[@troop_id].pages.size
# イベントページを取得
page = $data_troops[@troop_id].pages[index]
# このページのスパンが [ターン] の場合
if page.span == 1
# 実行済みフラグをクリア
$game_temp.battle_event_flags[index] = false
end
end
# アクターを非選択状態に設定
@actor_index = -1
@active_battler = nil
# パーティコマンドウィンドウを有効化
@party_command_window.active = false
@party_command_window.visible = false
# アクターコマンドウィンドウを無効化
@actor_command_window.active = false
@actor_command_window.visible = false
# メインフェーズフラグをセット
$game_temp.battle_main_phase = true
# エネミーアクション作成
for enemy in $game_troop.enemies
enemy.make_action
end
# 行動順序作成
make_action_orders
# ステップ 1 に移行
@phase4_step = 1
end
#--------------------------------------------------------------------------
# ● 行動順序作成
#--------------------------------------------------------------------------
def make_action_orders
# 配列 @action_battlers を初期化
@action_battlers = []
# エネミーを配列 @action_battlers に追加
for enemy in $game_troop.enemies
@action_battlers.push(enemy)
end
# アクターを配列 @action_battlers に追加
for actor in $game_party.actors
@action_battlers.push(actor)
end
# 全員のアクションスピードを決定
for battler in @action_battlers
battler.make_action_speed
end
# アクションスピードの大きい順に並び替え
@action_battlers.sort! {|a,b|
b.current_action.speed - a.current_action.speed }
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ)
#--------------------------------------------------------------------------
def update_phase4
case @phase4_step
when 1
update_phase4_step1
when 2
update_phase4_step2
when 3
update_phase4_step3
when 4
update_phase4_step4
when 5
update_phase4_step5
when 6
update_phase4_step6
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 1 : アクション準備)
#--------------------------------------------------------------------------
def update_phase4_step1
# Change all actor poses to default
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
@spriteset.actor_sprites[i].default_pose unless actor.dead?
end
# ヘルプウィンドウを隠す
@help_window.visible = false
# 勝敗判定
if judge
# 勝利または敗北の場合 : メソッド終了
return
end
# アクションを強制されているバトラーが存在しない場合
if $game_temp.forcing_battler == nil
# バトルイベントをセットアップ
setup_battle_event
# バトルイベント実行中の場合
if $game_system.battle_interpreter.running?
return
end
end
# アクションを強制されているバトラーが存在する場合
if $game_temp.forcing_battler != nil
# 先頭に追加または移動
@action_battlers.delete($game_temp.forcing_battler)
@action_battlers.unshift($game_temp.forcing_battler)
end
# 未行動バトラーが存在しない場合 (全員行動した)
if @action_battlers.size == 0
# パーティコマンドフェーズ開始
start_phase2
return
end
# アニメーション ID およびコモンイベント ID を初期化
@animation1_id = 0
@animation2_id = 0
@common_event_id = 0
# 未行動バトラー配列の先頭からシフト
@active_battler = @action_battlers.shift
# すでに戦闘から外されている場合
if @active_battler.index == nil
return
end
if @active_battler.is_a?(Game_Enemy)
@spriteset.viewport2.z = 99
else
@spriteset.viewport2.z = 101
end
# スリップダメージ
if @active_battler.hp > 0 and @active_battler.slip_damage?
@active_battler.slip_damage_effect
@active_battler.damage_pop = true
end
# ステート自然解除
@active_battler.remove_states_auto
# ステータスウィンドウをリフレッシュ
@status_window.refresh
# ステップ 2 に移行
@phase4_step = 2
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
#--------------------------------------------------------------------------
def update_phase4_step2
# 強制アクションでなければ
unless @active_battler.current_action.forcing
# 制約が [敵を通常攻撃する] か [味方を通常攻撃する] の場合
if @active_battler.restriction == 2 or @active_battler.restriction == 3
# アクションに攻撃を設定
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 0
end
# 制約が [行動できない] の場合
if @active_battler.restriction == 4
# アクション強制対象のバトラーをクリア
$game_temp.forcing_battler = nil
# ステップ 1 に移行
@phase4_step = 1
return
end
end
# 対象バトラーをクリア
@target_battlers = []
# アクションの種別で分岐
case @active_battler.current_action.kind
when 0 # 基本
make_basic_action_result
when 1 # スキル
make_skill_action_result
when 2 # アイテム
make_item_action_result
end
# ステップ 3 に移行
if @phase4_step == 2
@phase4_step = 3
end
end
#--------------------------------------------------------------------------
# ● 基本アクション 結果作成
#--------------------------------------------------------------------------
def make_basic_action_result
# 攻撃の場合
if @active_battler.current_action.basic == 0
# アニメーション ID を設定
@animation1_id = @active_battler.animation1_id
@animation2_id = @active_battler.animation2_id
# 行動側バトラーがエネミーの場合
if @active_battler.is_a?(Game_Enemy)
if @active_battler.restriction == 3
target = $game_troop.random_target_enemy
elsif @active_battler.restriction == 2
target = $game_party.random_target_actor
else
index = @active_battler.current_action.target_index
target = $game_party.smooth_target_actor(index)
end
if $game_system.animated_enemy
# If the enemies are animated and the enemy
# is to attack, we set the x and y variables
# relative to the position of the target (actor)
# and call the move method. The move method
# takes the x and y coordinates as well as the speed
# of movement as parameters. To change the movement
# speed just change the '20' in the move method call
x = target.screen_x - 32
x-= @spriteset.actor_sprites[target.index].frame_width / 2
@spriteset.enemy_sprites[@active_battler.index]\
.move(x, target.screen_y, 20)
end
end
# 行動側バトラーがアクターの場合
if @active_battler.is_a?(Game_Actor)
if @active_battler.restriction == 3
target = $game_party.random_target_actor
elsif @active_battler.restriction == 2
target = $game_troop.random_target_enemy
else
index = @active_battler.current_action.target_index
target = $game_troop.smooth_target_enemy(index)
end
x = target.screen_x + 32
unless $game_system.animated_enemy
x += RPG:

ache.battler(target.battler_name, 0).width / 2
else
x += @spriteset.enemy_sprites[target.index].frame_width / 2
end
# If a hero is to attack, we set the x and y variables
# relative to the position of the target (enemy)
# and call the move method. The move method
# takes the x and y coordinates as well as the speed
# of movement as parameters. We also set the pose to
# moving before doing that. To change the movement
# speed just change the '20' in the move method call
@spriteset.actor_sprites[@active_battler.index].pose(7)
@spriteset.actor_sprites[@active_battler.index]\
.move(x, target.screen_y, 20)
end
# 対象側バトラーの配列を設定
@target_battlers = [target]
# 通常攻撃の効果を適用
for target in @target_battlers
target.attack_effect(@active_battler)
end
return
end
# 防御の場合
if @active_battler.current_action.basic == 1
# ヘルプウィンドウに "防御" を表示
if @active_battler.is_a?(Game_Actor)
# Change pose to defending
@spriteset.actor_sprites[@active_battler.index].pose(4)
end
@help_window.set_text($data_system.words.guard, 1)
return
end
# 逃げるの場合
if @active_battler.is_a?(Game_Enemy) and
@active_battler.current_action.basic == 2
# ヘルプウィンドウに "逃げる" を表示
@help_window.set_text("Gegner geflohen!", 1)
# 逃げる
@active_battler.escape
return
end
# 何もしないの場合
if @active_battler.current_action.basic == 3
# アクション強制対象のバトラーをクリア
$game_temp.forcing_battler = nil
# ステップ 1 に移行
@phase4_step = 1
return
end
end
#--------------------------------------------------------------------------
# ● スキルまたはアイテムの対象側バトラー設定
# scope : スキルまたはアイテムの効果範囲
#--------------------------------------------------------------------------
def set_target_battlers(scope)
# 行動側バトラーがエネミーの場合
if @active_battler.is_a?(Game_Enemy)
# 効果範囲で分岐
case scope
when 1 # 敵単体
index = @active_battler.current_action.target_index
@target_battlers.push($game_party.smooth_target_actor(index))
when 2 # 敵全体
for actor in $game_party.actors
if actor.exist?
@target_battlers.push(actor)
end
end
when 3 # 味方単体
index = @active_battler.current_action.target_index
@target_battlers.push($game_troop.smooth_target_enemy(index))
when 4 # 味方全体
for enemy in $game_troop.enemies
if enemy.exist?
@target_battlers.push(enemy)
end
end
when 5 # 味方単体 (HP 0)
index = @active_battler.current_action.target_index
enemy = $game_troop.enemies[index]
if enemy != nil and enemy.hp0?
@target_battlers.push(enemy)
end
when 6 # 味方全体 (HP 0)
for enemy in $game_troop.enemies
if enemy != nil and enemy.hp0?
@target_battlers.push(enemy)
end
end
when 7 # 使用者
@target_battlers.push(@active_battler)
end
end
# 行動側バトラーがアクターの場合
if @active_battler.is_a?(Game_Actor)
# 効果範囲で分岐
case scope
when 1 # 敵単体
index = @active_battler.current_action.target_index
@target_battlers.push($game_troop.smooth_target_enemy(index))
when 2 # 敵全体
for enemy in $game_troop.enemies
if enemy.exist?
@target_battlers.push(enemy)
end
end
when 3 # 味方単体
index = @active_battler.current_action.target_index
@target_battlers.push($game_party.smooth_target_actor(index))
when 4 # 味方全体
for actor in $game_party.actors
if actor.exist?
@target_battlers.push(actor)
end
end
when 5 # 味方単体 (HP 0)
index = @active_battler.current_action.target_index
actor = $game_party.actors[index]
if actor != nil and actor.hp0?
@target_battlers.push(actor)
end
when 6 # 味方全体 (HP 0)
for actor in $game_party.actors
if actor != nil and actor.hp0?
@target_battlers.push(actor)
end
end
when 7 # 使用者
@target_battlers.push(@active_battler)
end
end
end
#--------------------------------------------------------------------------
# ● スキルアクション 結果作成
#--------------------------------------------------------------------------
def make_skill_action_result
# スキルを取得
@skill = $data_skills[@active_battler.current_action.skill_id]
# 強制アクションでなければ
unless @active_battler.current_action.forcing
# SP 切れなどで使用できなくなった場合
unless @active_battler.skill_can_use?(@skill.id)
# アクション強制対象のバトラーをクリア
$game_temp.forcing_battler = nil
# ステップ 1 に移行
@phase4_step = 1
return
end
end
# SP 消費
@active_battler.sp -= @skill.sp_cost
# ステータスウィンドウをリフレッシュ
@status_window.refresh
# ヘルプウィンドウにスキル名を表示
@help_window.set_text(@skill.name, 1)
# アニメーション ID を設定
@animation1_id = @skill.animation1_id
@animation2_id = @skill.animation2_id
# コモンイベント ID を設定
@common_event_id = @skill.common_event_id
# 対象側バトラーを設定
set_target_battlers(@skill.scope)
# スキルの効果を適用
x = 0
for target in @target_battlers
target.skill_effect(@active_battler, @skill)
# Calculate enemy x position
x = target.screen_x + 32
unless $game_system.animated_enemy
x += RPG:

ache.battler(target.battler_name, 0).width / 2
else
x += @spriteset.enemy_sprites[target.index].frame_width / 2
end
end
# If the target is an actor or an enemy, change their poses
# to skill using. We need to check if it's a physical skill
# first. A physical skill is one with the attribute (element)
# named "physical" checked, the hero would move near the enemy
# to use that skill and would also use his/her normal attack
# animation.
if @active_battler.is_a?(Game_Actor)
if @skill.element_set.include?($data_system.elements.index("physical"))
# It's a physical skill
@physical = true
# We call the move method. The move method
# takes the x and y coordinates as well as the speed
# of movement as parameters. We also set the pose to
# moving before doing that. To change the movement
# speed just change the '20' in the move method call
@spriteset.actor_sprites[@active_battler.index].pose(7)
@spriteset.actor_sprites[@active_battler.index]\
.move(x, target.screen_y, 20)
else
# Normal (magic) skill
@physical = false
@spriteset.actor_sprites[@active_battler.index].pose(2)
end
else
# Enemy skill, at the time of writing enemies don't
# have physical skills. It's easy to add so expect
# to see it in future versions.
@spriteset.enemy_sprites[@active_battler.index].enemy_pose(2)
end
end
#--------------------------------------------------------------------------
# ● アイテムアクション 結果作成
#--------------------------------------------------------------------------
def make_item_action_result
if @active_battler.is_a?(Game_Actor)
# Change the pose to item using
@spriteset.actor_sprites[@active_battler.index].pose(8)
end
# アイテムを取得
@item = $data_items[@active_battler.current_action.item_id]
# アイテム切れなどで使用できなくなった場合
unless $game_party.item_can_use?(@item.id)
# ステップ 1 に移行
@phase4_step = 1
return
end
# 消耗品の場合
if @item.consumable
# 使用したアイテムを 1 減らす
$game_party.lose_item(@item.id, 1)
end
# ヘルプウィンドウにアイテム名を表示
@help_window.set_text(@item.name, 1)
# アニメーション ID を設定
@animation1_id = @item.animation1_id
@animation2_id = @item.animation2_id
# コモンイベント ID を設定
@common_event_id = @item.common_event_id
# 対象を決定
index = @active_battler.current_action.target_index
target = $game_party.smooth_target_actor(index)
# 対象側バトラーを設定
set_target_battlers(@item.scope)
# アイテムの効果を適用
for target in @target_battlers
target.item_effect(@item)
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション)
#--------------------------------------------------------------------------
def update_phase4_step3
if (@active_battler.current_action.kind == 0 and \
@active_battler.current_action.basic == 0) or
@physical == true
# In this method the attacking animation is played
# and we set the pose to 1 (attacking before that)
if @active_battler.is_a?(Game_Actor)
@spriteset.actor_sprites[@active_battler.index].pose(1)
else
@spriteset.enemy_sprites[@active_battler.index].enemy_pose(1)
end
end
# 行動側アニメーション (ID が 0 の場合は白フラッシュ)
if @animation1_id == 0
@active_battler.white_flash = true
else
@active_battler.animation_id = @animation1_id
@active_battler.animation_hit = true
end
# ステップ 4 に移行
@phase4_step = 4
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 4 : 対象側アニメーション)
#--------------------------------------------------------------------------
def update_phase4_step4
# 対象側アニメーション
# Change all the 'targets' poses to 3 (being hit)
for target in @target_battlers
if target.is_a?(Game_Actor) and !@active_battler.is_a?(Game_Actor)
@spriteset.actor_sprites[target.index].pose(3)
elsif target.is_a?(Game_Enemy) and !@active_battler.is_a?(Game_Enemy)
@spriteset.enemy_sprites[target.index].enemy_pose(3)
end
target.animation_id = @animation2_id
target.animation_hit = (target.damage != "Miss")
end
# アニメーションの長さにかかわらず、最低 8 フレーム待つ
@wait_count = 8
# ステップ 5 に移行
@phase4_step = 5
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
#--------------------------------------------------------------------------
def update_phase4_step5
# ヘルプウィンドウを隠す
@help_window.visible = false
# ステータスウィンドウをリフレッシュ
@status_window.refresh
# ダメージ表示
for target in @target_battlers
if target.damage != nil
target.damage_pop = true
end
end
# ステップ 6 に移行
@phase4_step = 6
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
#--------------------------------------------------------------------------
def update_phase4_step6
# アクション強制対象のバトラーをクリア
# End of turn, move the battler back to their position.
# Mirror flips the battler sprite
if @active_battler.is_a?(Game_Actor) and !@active_battler.dead? and
((@active_battler.current_action.kind == 0 and \
@active_battler.current_action.basic == 0) or
@physical == true)
@phyiscal = false if @physical
@spriteset.actor_sprites[@active_battler.index].mirror = true
@spriteset.actor_sprites[@active_battler.index].pose(7)
@spriteset.actor_sprites[@active_battler.index]\
.move(@active_battler.screen_x, @active_battler.screen_y, 20)
elsif @active_battler.is_a?(Game_Enemy) and
!@active_battler.dead? and $game_system.animated_enemy
@spriteset.enemy_sprites[@active_battler.index].mirror = true
@spriteset.enemy_sprites[@active_battler.index]\
.move(@active_battler.screen_x, @active_battler.screen_y, 20)
@spriteset.enemy_sprites[@active_battler.index].enemy_pose(0)
end
# And change target poses to default
for target in @target_battlers
if target.is_a?(Game_Actor) and !target.dead?
@spriteset.actor_sprites[target.index].default_pose
elsif !target.dead?
@spriteset.enemy_sprites[target.index].enemy_pose(0)
end
end
$game_temp.forcing_battler = nil
# コモンイベント ID が有効の場合
if @common_event_id > 0
# イベントをセットアップ
common_event = $data_common_events[@common_event_id]
$game_system.battle_interpreter.setup(common_event.list, 0)
end
# ステップ 1 に移行
@phase4_step = 1
end
end