# ▽△▽ XRXSv9. BaST-VX.AB5. サイドビューバトラーモーション! ▽△▽ # # publish 2010/ 4/16 # update - 11/ 1/11a # #============================================================================== # カスタマイズポイント #============================================================================== module XRXSV9 # # アクターの立ち位置[X,Y] (戦闘参加最大人数まで設定してください) # ABPositions = [ [384, 232], [400, 284], [432, 256], [448, 304], [480, 284] ] # # 影画像(Graphics/System) # Shadow = "Shadow" # # 逃走演出(移動速度、時間) # ABEscapeSpeed = 8 ABEscapeDuration = 24 # # ジャンプ/前進 境目距離単位 # (2にすると「一歩前へ」の時も跳ぶ。 # 数値を高くすると長い距離もジャンプせず走る。) # JumpLength = 3 # # 遠距離武器とするアイコンインデックス # LongRangeWeaponIconIndexes = [16,17,22,23,24,25] # # 使用する画像グラフィックsprintf文字列 # ABGSPF = "$%s-%s-%s" # # 戦闘開始時ジャンプ登場する時のX距離 # BattleJumpIn_X = 144 end class Game_Battler # # 遠距離攻撃?の判定式 #    装備武器のアイコンが以下の配列に含まれる場合、遠距離武器として、 #  (・通常攻撃なら、武器に準ずる #  ・スキルなら、「物理攻撃」がオフなら武器関係なく遠距離、 #                 オンなら武器に準ずる #   ・それ以外(アイテム)なら遠距離                  ) # def long_range_attack? weapon = self.weapons[0] long_range_weapon = (weapon != nil and XRXSV9::LongRangeWeaponIconIndexes.include?(weapon.icon_index)) if self.action.attack? return long_range_weapon elsif self.action.skill? return (!$data_skills[self.action.skill_id].physical_attack or long_range_weapon) end return true end end #============================================================================== # バトラー向き機能 #============================================================================== class Sprite_Battler < Sprite_Base alias xrxsv9ab_update_battler_bitmap update_battler_bitmap def update_battler_bitmap xrxsv9ab_update_battler_bitmap self.mirror = ($game_temp.xcam.reverse? ^ @battler.direction_reverse) end end #============================================================================== # アクターバトラーグラフィック #============================================================================== class Game_Battler attr_accessor :battlemotion_pattern attr_accessor :jumped_x_offset attr_accessor :jumped_y_offset end class Game_Actor < Game_Battler def screen_x return 0 if self.index.nil? return XRXSV9::ABPositions[self.index][0] + self.jumped_x_offset.to_i end def screen_y return 0 if self.index.nil? return XRXSV9::ABPositions[self.index][1] + self.jumped_y_offset.to_i end def in_floor? return true end end #============================================================================== # バトル中のカメラ挙動指定 #============================================================================== class Scene_Battle < Scene_Base def xcam_animation_start(targets) $game_temp.xcam.set_horize(@active_battler, targets) wait(8) end def xcam_preanimation $game_temp.xcam.watch(@active_battler, []) end def xcam_animation(targets) $game_temp.xcam.watch(@active_battler, targets) end def xcam_win $game_temp.xcam.go_reset $game_temp.xcam.watch(nil, $game_party.members) end end #============================================================================== # アクターバトラースプライト #============================================================================== class Sprite_ActorBattler < Sprite_Battler #-------------------------------------------------------------------------- # ▼ 転送元ビットマップの更新 #-------------------------------------------------------------------------- def update_battler_bitmap update_bitmap update_src_rect update_damageshake update_battler_xcam update_jumping self.mirror = ($game_temp.xcam.reverse? ^ @battler.direction_reverse) end #-------------------------------------------------------------------------- # 転送元ビットマップの更新 #-------------------------------------------------------------------------- def update_bitmap index_s = (@battler.character_index + 1).to_s pattern_s = (@battler.battlemotion_pattern/4 + 1).to_s name = sprintf(XRXSV9::ABGSPF, @battler.character_name, index_s, pattern_s) if @battler_name != name @battler_name = name self.bitmap = Cache.character(name) @cw = bitmap.width / 3 @ch = bitmap.height / 4 self.ox = @cw / 2 self.oy = @ch @battlemotion_last_pattern = nil end if @battlemotion_last_pattern != @battler.battlemotion_pattern @battlemotion_last_pattern = @battler.battlemotion_pattern @step_pattern = -1 @step_wait_count = 1 update_src_rect end end #-------------------------------------------------------------------------- # 転送元矩形の更新 #-------------------------------------------------------------------------- def update_src_rect @step_wait_count -= 1 if @step_wait_count == 0 @step_wait_count = 8 case @battler.battlemotion_pattern when 0,2,3,11 @step_pattern = (@step_pattern + 1) % 4 pattern = [1,0,1,2][@step_pattern] when 8 @step_pattern += 1 if @step_pattern <= 1 pattern = [2,1,0][@step_pattern] else @step_pattern += 1 if @step_pattern <= 1 pattern = @step_pattern end sx = pattern * @cw sy = (@battler.battlemotion_pattern % 4) * @ch self.src_rect.set(sx, sy, @cw, @ch) end end #-------------------------------------------------------------------------- # ▼ 崩壊エフェクトの更新 → コラプス無効化 #-------------------------------------------------------------------------- def update_collapse @effect_duration = 0 @battler_visible = true end end #============================================================================== # バトルジャンプ・バトラーモーション設定 - バトラー側 #============================================================================== class Game_Battler def battlermotion_reset if self.dead? # 戦闘不能時 self.battlemotion_pattern = 7 elsif not self.movable? # 行動不能時 self.battlemotion_pattern = 2 elsif self.action.magic_skill? # コマンド済み - 魔法詠唱 self.battlemotion_pattern = 11 self.direction_reverse = false elsif self.commanded # コマンド済み - その他 self.battlemotion_pattern = 8 self.direction_reverse = false else # 通常時 self.battlemotion_pattern = 0 end end end class Game_Battler attr_accessor :direction_reverse attr_accessor :battlejump_go attr_accessor :battlejump_go_back attr_accessor :battlejump_go_escape attr_accessor :battlejumping attr_accessor :battlejump_x attr_accessor :battlejump_y end class Game_Actor < Game_Battler def battler_initialize super self.battlermotion_reset self.direction_reverse = $game_troop.surprise if self.movable? and not $game_troop.surprise self.jumped_x_offset = XRXSV9::BattleJumpIn_X self.battlejump_back end end end #============================================================================== # バトルジャンプ・バトラーモーション設定 - バトルシステム側 #============================================================================== class Scene_Battle < Scene_Base def actor_battler_initialize for actor in $game_party.members actor.battler_initialize end for enemy in $game_troop.members enemy.direction_reverse = $game_troop.preemptive end end def wait_for_jump(battlers = self.members) loop do jumping = false for battler in battlers jumping |= battler.battlejumping end break unless jumping update_basic end end def battlejump_back wait_for_jump for battler in self.members battler.battlejump_back end wait_for_jump end def battlejump_for_targets(targets) wait_for_jump unless @quick_mode for battler in self.members - targets - [@active_battler] battler.battlejump_back end end @active_battler.battlejump_to_targets(targets) wait_for_jump end def battlejump_escape battlejump_back for actor in $game_party.members actor.battlejump_escape end wait_for_jump end def battlejump_action_end wait_for_jump([@active_battler]) if @active_actions[0] and @active_actions[0].battler == @active_battler return end @active_battler.battlejump_backstep end def battlermotion_action if @active_battler.action.magic_skill? or @active_battler.action.item? # スキルまたはアイテム発動 @active_battler.battlemotion_pattern = 10 else # 攻撃・その他の発動 @active_battler.battlemotion_pattern = 9 end @active_battler.direction_reverse = false end alias xrxsv9ab5_display_hp_damage display_hp_damage def display_hp_damage(target, obj = nil) if not target.absorbed and target.hp_damage >= 1 target.battlemotion_pattern = 1 target.direction_reverse = false end xrxsv9ab5_display_hp_damage(target, obj) end alias xrxsv9ab5_display_miss display_miss def display_miss(target, obj = nil) wait_for_jump([target]) if obj == nil or obj.physical_attack target.battlejump_backstep end xrxsv9ab5_display_miss(target, obj) end def battlermotion_reset for battler in self.members battler.battlermotion_reset end end def battlermotion_victory for actor in $game_party.members actor.battlemotion_pattern = 4 if actor.movable? end end end #============================================================================== # バトルジャンプ機能 #============================================================================== class Sprite_ActorBattler < Sprite_Battler def update_jumping @jumped_x_offset = @battler.jumped_x_offset.to_i unless @jumped_x_offset @jumped_y_offset = @battler.jumped_y_offset.to_i unless @jumped_y_offset if @jump_duration == nil and @battler.battlejumping @jump_x_speed = 0 @jump_y_speed = 0 if @battler.battlejump_go @jump_x_speed = @battler.battlejump_x / 16 @jump_y_speed = @battler.battlejump_y / 16 @battler.battlejump_go = false end if @battler.battlejump_go_back @jump_x_speed = -1 * @jumped_x_offset / 16 @jump_y_speed = -1 * @jumped_y_offset / 16 @battler.battlejump_go_back = false end if (@jump_x_speed == 0 and @jump_y_speed == 0) and not @battler.battlejump_go_escape @jump_duration = nil @battler.battlejumping = false else if @battler.battlejump_go_escape @jump_x_speed = XRXSV9::ABEscapeSpeed @battler.battlejump_go_escape = false @jump_duration = XRXSV9::ABEscapeDuration jump_mode = false @battler.direction_reverse = true else jump_mode = (@jump_y_speed != 0) jump_mode |= (@jump_x_speed.to_i.abs >= XRXSV9::JumpLength) @jump_duration = 16 end @battler.battlemotion_pattern = (jump_mode ? 5 : 3) if jump_mode @jump_shadow_sprite = Sprite_Base.new(self.viewport) @jump_shadow_sprite.bitmap = Cache.system(XRXSV9::Shadow) @jump_shadow_sprite.ox = @jump_shadow_sprite.bitmap.width / 2 @jump_shadow_sprite.oy = @jump_shadow_sprite.bitmap.height @jump_shadow_sprite.z = self.z - 1 end end end if @battler.battlejumping @jumped_x_offset += @jump_x_speed @jumped_y_offset += @jump_y_speed @jump_duration -= 1 if @jump_duration <= 0 @jump_duration = nil @battler.battlejumping = false @battler.battlermotion_reset @jump_shadow_sprite.dispose if @jump_shadow_sprite @jump_shadow_sprite = nil end end @battler.jumped_x_offset = @jumped_x_offset @battler.jumped_y_offset = @jumped_y_offset #self.x += @jumped_x_offset #self.y += @jumped_y_offset if @jump_shadow_sprite @jump_shadow_sprite.x = self.x @jump_shadow_sprite.y = self.y self.y += ((@jump_duration - 8).abs - 8) * 2 if @jump_duration end end end #============================================================================== # バトルジャンプの実行 #============================================================================== class Game_Battler def battlejump_back end def battlejump_backstep end def battlejump_to_targets(targets) end end class Game_Actor < Game_Battler def battlejjump_at_post? return (self.jumped_x_offset == 0 and self.jumped_y_offset == 0) end def battlejump_back return unless self.movable? unless self.battlejjump_at_post? self.battlejump_go_back = true self.battlejumping = true end end def battlejump_escape return unless self.movable? self.battlejump_go_escape = true self.battlejumping = true end def battlejump_backstep return unless self.movable? if self.jumped_x_offset <= -48 battlejump_to(48, 0) elsif self.jumped_x_offset == -32 battlejump_to(32, 0) end end def battlejump_to_targets(targets) return unless self.movable? if self.action.for_friend? or self.long_range_attack? jump_x = -32 jump_y = 0 if self.jumped_x_offset <= -32 jump_x = 0 end else jump_x = nil for target in targets if target.is_a?(Game_Enemy) sx = target.screen_x if jump_x == nil or jump_x < sx jump_x = sx jump_y = target.screen_y end end end if jump_x == nil jump_x = -32 jump_y = 0 else jump_x -= self.screen_x - 64 jump_y -= self.screen_y end end battlejump_to(jump_x, jump_y) for actor in $game_party.members - [self] if (self.screen_x + self.battlejump_x - actor.screen_x).abs <= 32 and (self.screen_y + self.battlejump_y - actor.screen_y).abs <= 24 and actor.movable? actor.battlejump_to(48, 0) end end end def battlejump_infront(target) jump_x = target.screen_x - self.screen_x - 64 jump_y = target.screen_y - self.screen_y battlejump_to(jump_x, jump_y) end def battlejump_to(jump_x, jump_y) self.battlejump_x = jump_x self.battlejump_y = jump_y self.battlejump_go = true self.battlejumping = true end end