I have two battle scripts and I want the View and everything from the first one with the FFX bar on the side. Can someone help?
here is the first
And here is the second
here is the first
Code:
#==============================================================================
class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
# * Initialize
#--------------------------------------------------------------------------
alias cbs_initialize initialize
def initialize(viewport, battler = nil)
# Configuration
@speed = 7 # Framerate speed of the battlers
@frames = 4 # Number of frames in each pose
@poses = 11 # Number of poses (stances) in the template
@mirror_enemies = true # Enemy battlers use reversed image
@stationary_enemies = false # If the enemies don't move while attacking
@stationary_actors = false # If the actors don't move while attacking
@calculate_speed = true # System calculates a mean/average speed
@phasing = true # Characters fade in/out while attacking
@default_collapse = false # Restores the old 'red fade' effect to enemies
# Array that holds the id # of weapons that forces the hero to be stationary
@stationary_weapons = [17,18,19,20,21,22,23,24] # (examples are bows & guns)
# DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU'RE DOING
@frame, @pose = 0, 0
@last_time = 0
@last_move_time = 0
cbs_initialize(viewport, battler)
self.mirror = !!battler and @mirror_enemies
viewport.z = 99
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
alias cbs_update update
def update
return unless @battler
# Regular Update
cbs_update
# Start Routine
unless @started
@pose = state
@width = @width / @frames
@height = @height / @poses
@display_x = @battler.screen_x
@display_y = @battler.screen_y
@destination_x = @display_x
@destination_y = @display_y
@started = true
end
# Cut Out Frame
self.src_rect.set(@width * @frame, @height * @pose, @width, @height)
# Position Sprite
self.x = @display_x
self.y = @display_y
self.z = @display_y
self.ox = @width / 2
self.oy = @height
# Setup Animation
time = Graphics.frame_count / (Graphics.frame_rate / @speed)
if @last_time < time
@frame = (@frame + 1) % @frames
if @frame == 0
if @freeze
@frame = @frames - 1
return
end
@pose = state
end
end
@last_time = time
# Move It
move if moving
end
#--------------------------------------------------------------------------
# * Current State
#--------------------------------------------------------------------------
def state
# Damage State
if [nil,{}].include?(@battler.damage)
# Battler Fine
@state = 0
# Battler Wounded
@state = 2 if @battler.hp < @battler.maxhp / 4
if @default_collapse
# Battler Dead (Red-Out Collapse)
if @battler.dead? and @battler.is_a?(Game_Actor)
@state = 10
# Fix Opacity
self.opacity = 255
end
else
# Battler Dead (Pose-Type Collapse)
if @battler.dead?
@state = 10
# Fix Opacity
self.opacity = 255
end
end
end
# Guarding State
@state = 3 if @battler.guarding?
# Moving State
if moving
# If enemy battler moving
if @battler.is_a?(Game_Enemy)
# Battler Moving Left
@state = 5 if moving.eql?(0)
# Battler Moving Right
@state = 4 if moving.eql?(1)
# Else actor battler moving
else
# Battler Moving Left
@state = 4 if moving.eql?(0)
# Battler Moving Right
@state = 5 if moving.eql?(1)
end
end
# Return State
return @state
end
#--------------------------------------------------------------------------
# * Move
#--------------------------------------------------------------------------
def move
time = Graphics.frame_count / (Graphics.frame_rate.to_f / (@speed * 5))
if @last_move_time < time
# Pause for Animation
return if @pose != state
# Phasing
if @phasing
d1 = (@display_x - @original_x).abs
d2 = (@display_y - @original_y).abs
d3 = (@display_x - @destination_x).abs
d4 = (@display_y - @destination_y).abs
self.opacity = [255 - ([d1 + d2, d3 + d4].min * 1.75).to_i, 0].max
end
# Calculate Difference
difference_x = (@display_x - @destination_x).abs
difference_y = (@display_y - @destination_y).abs
# Done? Reset, Stop
if [difference_x, difference_y].max.between?(0, 8)
@display_x = @destination_x
@display_y = @destination_y
@pose = state
return
end
# Calculate Movement Increments
increment_x = increment_y = 1
if difference_x < difference_y
increment_x = 1.0 / (difference_y.to_f / difference_x)
elsif difference_y < difference_x
increment_y = 1.0 / (difference_x.to_f / difference_y)
end
# Calculate Movement Speed
if @calculate_speed
total = 0; $game_party.actors.each{ |actor| total += actor.agi }
speed = @battler.agi.to_f / (total / $game_party.actors.size)
increment_x *= speed
increment_y *= speed
end
# Multiply and Move
multiplier_x = (@destination_x - @display_x > 0 ? 8 : -8)
multiplier_y = (@destination_y - @display_y > 0 ? 8 : -8)
@display_x += (increment_x * multiplier_x).to_i
@display_y += (increment_y * multiplier_y).to_i
end
@last_move_time = time
end
#--------------------------------------------------------------------------
# * Set Movement
#--------------------------------------------------------------------------
def setmove(destination_x, destination_y)
unless (@battler.is_a?(Game_Enemy) and @stationary_enemies) or
(@battler.is_a?(Game_Actor) and @stationary_actors)
unless @stationary_weapons.include?(@battler.weapon_id)
@original_x = @display_x
@original_y = @display_y
@destination_x = destination_x
@destination_y = destination_y
end
end
end
#--------------------------------------------------------------------------
# * Movement Check
#--------------------------------------------------------------------------
def moving
if (@display_x != @destination_x and @display_y != @destination_y and !@battler.dead?)
return (@display_x > @destination_x ? 0 : 1)
end
end
#--------------------------------------------------------------------------
# * Set Pose
#--------------------------------------------------------------------------
def pose=(pose)
@pose = pose
@frame = 0
end
#--------------------------------------------------------------------------
# * Freeze
#--------------------------------------------------------------------------
def freeze
@freeze = true
end
#--------------------------------------------------------------------------
# * Fallen Pose
#--------------------------------------------------------------------------
alias cbs_collapse collapse
def collapse
if @default_collapse
cbs_collapse if @battler.is_a?(Game_Enemy)
end
end
end
#==============================================================================
# ** Game_Actor
#==============================================================================
class Game_Actor
#--------------------------------------------------------------------------
# * Actor X Coordinate
#--------------------------------------------------------------------------
def screen_x
if self.index != nil
return self.index * 45 + 450
else
return 0
end
end
#--------------------------------------------------------------------------
# * Actor Y Coordinate
#--------------------------------------------------------------------------
def screen_y
return self.index * 35 + 200
end
#--------------------------------------------------------------------------
# * Actor Z Coordinate
#--------------------------------------------------------------------------
def screen_z
return screen_y
end
end
#==============================================================================
# ** Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Action Animation, Movement
#--------------------------------------------------------------------------
alias cbs_update_phase4_step3 update_phase4_step3
def update_phase4_step3(battler = @active_battler)
@rtab = !@target_battlers
target = (@rtab ? battler.target : @target_battlers)[0]
@moved = {} unless @moved
return if @spriteset.battler(battler).moving
case battler.current_action.kind
when 0 # Attack
if not (@moved[battler] or battler.guarding?)
offset = (battler.is_a?(Game_Actor) ? 40 : -40)
@spriteset.battler(battler).setmove(target.screen_x + offset, target.screen_y)
@moved[battler] = true
return
elsif not battler.guarding?
@spriteset.battler(battler).pose = 6 + rand(2)
@spriteset.battler(battler).setmove(battler.screen_x, battler.screen_y)
end
when 1 # Skill
@spriteset.battler(battler).pose = 8
when 2 # Item
@spriteset.battler(battler).pose = 8
end
@moved[battler] = false
@rtab ? cbs_update_phase4_step3(battler) : cbs_update_phase4_step3
end
#--------------------------------------------------------------------------
# * Hit Animation
#--------------------------------------------------------------------------
alias cbs_update_phase4_step4 update_phase4_step4
def update_phase4_step4(battler = @active_battler)
for target in (@rtab ? battler.target : @target_battlers)
damage = (@rtab ? target.damage[battler] : target.damage)
if damage.is_a?(Numeric) and damage > 0
@spriteset.battler(target).pose = 1
end
end
@rtab ? cbs_update_phase4_step4(battler) : cbs_update_phase4_step4
end
#--------------------------------------------------------------------------
# * Victory Animation
#--------------------------------------------------------------------------
alias cbs_start_phase5 start_phase5
def start_phase5
for actor in $game_party.actors
return if @spriteset.battler(actor).moving
end
for actor in $game_party.actors
unless actor.dead?
@spriteset.battler(actor).pose = 9
@spriteset.battler(actor).freeze
end
end
cbs_start_phase5
end
#--------------------------------------------------------------------------
# * Change Arrow Viewport
#--------------------------------------------------------------------------
alias cbs_start_enemy_select start_enemy_select
def start_enemy_select
cbs_start_enemy_select
@enemy_arrow.dispose
@enemy_arrow = Arrow_Enemy.new(@spriteset.viewport2)
@enemy_arrow.help_window = @help_window
end
end
#==============================================================================
# ** Spriteset_Battle
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# * Change Enemy Viewport
#--------------------------------------------------------------------------
alias cbs_initialize initialize
def initialize
cbs_initialize
@enemy_sprites = []
for enemy in $game_troop.enemies.reverse
@enemy_sprites.push(Sprite_Battler.new(@viewport2, enemy))
end
end
#--------------------------------------------------------------------------
# * Find Sprite From Battler Handle
#--------------------------------------------------------------------------
def battler(handle)
for sprite in @actor_sprites + @enemy_sprites
return sprite if sprite.battler == handle
end
end
end
#==============================================================================
# ** Arrow_Base
#==============================================================================
class Arrow_Base < Sprite
#--------------------------------------------------------------------------
# * Reposition Arrows
#--------------------------------------------------------------------------
alias cbs_initialize initialize
def initialize(viewport)
cbs_initialize(viewport)
self.ox = 14
self.oy = 10
end
end
And here is the second
Code:
#########################################################################
# FF10ã«ã‚ã£ãŸã€ã‚«ã‚¦ãƒ³ãƒˆã‚¿ã‚¤ãƒ ãƒãƒˆãƒ«çš„ãªãƒ¢ãƒŽã§ã™ã€‚
#
# ☆良ãã‚ã‚‹ATB(ゲージãŒãŸã¾ã‚‹ã¨è¡Œå‹•å¯èƒ½ã«ãªã‚‹ã‚„ã¤ã)ã¨ã®é•ã„
# ãƒ»è¡Œå‹•é †ã‚’å‰²ã‚Šå‡ºã™è¨ˆç®—å¼ãŒå¤‰ã‚ã£ã¦ã„ã¾ã™ã€‚
# ATBã§ã¯æ¯Žãƒ•ãƒ¬ãƒ¼ãƒ ã™ã°ã‚„ã•ã«å¿œã˜ãŸå€¤ãŒè¶³ã•ã‚Œã¦ã„ãã€
# 行動を終了ã—ãŸã‚‰è¦å®šã®å€¤(ã»ã¨ã‚“ã©ã®æ–¹ãŒ0ã ã¨æ€ã„ã¾ã™ãŒ)ã«ãªã‚Šã¾ã™ã€‚
# ãã‚Œã«å¯¾ã—ã¦ã€ã“ã®ä¼¼éžCTBシステム(以下CTB)ã§ã¯ã€
# 全員ã®ã‚²ãƒ¼ã‚¸ãŒåŒã˜ã‚¹ãƒ”ードã§ä¸Šæ˜‡ã—ã€
# 行動を終了ã—ãŸã‚ã¨ã€ç´ æ—©ã•ã«å¿œã˜ãŸå€¤ã‚’減算ã—ã¾ã™ã€‚
# ã“ã®ãŸã‚ã€è¡Œå‹•é †ãŒATBã¨å¾®å¦™ã«å¤‰åŒ–ã™ã‚‹ã‹ã¨æ€ã‚ã‚Œã¾ã™ã€‚
#
# ãƒ»è¡Œå‹•é †ã®è¡¨ç¤ºãŒåå‰ã®ç¾…列ã«ãªã£ã¦ã¾ã™ã€‚
# ã“ã®åå‰ã¯ã€ã‚²ãƒ¼ã‚¸ã®ã‚ˆã†ã«å‹•ãã“ã¨ã¯ãªãã€
# ç¾åœ¨ã®è¡Œå‹•è€…å«ã‚ã¦äº”人先ã®äººã¾ã§ã‚’åå‰ã§è¡¨ç¤ºã—ã¦ã„ã¾ã™ã€‚
# ãªãŠã€è¡Œå‹•å…ˆèªã¿ã«ã¯ã€Œå…¨ã¦ã®è¡Œå‹•ãŒç‰©ç†æ”»æ’ƒã ã£ãŸæ™‚ã€ã‚’å‰æã«ã—ã¦ã¾ã™ã€‚
# ãã®ãŸã‚ã€ã‚¹ã‚ルやアイテムãªã©ã‚’使ã£ã¦ã—ã¾ã†ã¨ã€ãã®åˆ†å¾®å¦™ã«ã‚ºãƒ¬ã¾ã™ã€‚
#
# ☆制約
# ・パーティーãŒä¸‰äºº
# è¡Œå‹•é †ã‚’è¡¨ç¤ºã™ã‚‹éƒ¨åˆ†ã©ã“ã«ã‚ã£ã¦ã‚‚邪é”ãªã®ã§ã€
# çµå±€ãƒ‘ーティー表示部分ã®å·¦ç«¯ã‚’削りã¾ã—ãŸã€‚
#
# ・「何もã—ãªã„ã€ã®å‹•ä½œãŒä¸å¯©
# 何ã®å‰è§¦ã‚Œã‚‚ãªãスã‚ップã—ã¦ã—ã¾ã†ã‚ˆã†ã«è¨å®šã—ã¦ã„ã¾ã™ã®ã§ã€
# 見ã‹ã‘上ã¯ç„¡è¦–ã•ã‚ŒãŸã‚ˆã†ã«è¦‹ãˆã¦ã—ã¾ã„ã¾ã™ã€‚
#
# ☆特殊æ“作
# ・パーティーコマンド呼ã³å‡ºã—
# アクターã®ã‚³ãƒžãƒ³ãƒ‰ãŒè¡¨ç¤ºã•ã‚Œã¦ã„る時ã«Xボタンを押ã—ã¦ãã ã•ã„。
# パーティーコマンドãŒå‘¼ã³å‡ºã•ã‚Œã¾ã™ã€‚
# 戦闘å†é–‹ã¯ãã®ã¾ã¾ã€æˆ¦é—˜å†é–‹ã€‚
# è¡Œå‹•é †è¡¨ç¤ºã¯ã€50人先ã¾ã§è¡Œå‹•é †ã‚’表示ã—ã¾ã™ã€‚
# ã‚ã¾ã‚Šä½¿ãˆãªã„ã‹ã‚‚ã—ã‚Œã¾ã›ã‚“ãŒã€‚
# 一応ã€Lã€Rã«ã‚ˆã‚‹ãƒšãƒ¼ã‚¸é€ã‚Šæ©Ÿèƒ½ãªã©ã‚‚ã¤ã‘ã¦ã¾ã™ã€‚
# 逃走ã¯ã€ã€Œå…¨å“¡ã®CPを一定値減算ã—ãŸã®ã¡ã€é€ƒèµ°ã™ã‚‹ã€ã¨ã„ã†å½¢å¼ã«ã—ã¦ã¾ã™ã€‚
#
# ☆スã‚ルã«ã¤ã„ã¦
# 「スã‚ルå,ディレイ値,è© å”±æ™‚é–“ã€ã¨ã‚¹ã‚ルåを書ãæ›ãˆã¦ãã ã•ã„。
# ディレイ値ã¯ã€Œãã®è¡Œå‹•ãŒçµ‚了ã—ãŸå¾Œã«æ¸›ç®—ã™ã‚‹CPã®åŸºæº–ã¨ãªã‚‹å€¤ã€ã§ã™ã€‚
# ãŸã¨ãˆã°é€šå¸¸æ”»æ’ƒã¯ã“ã‚ŒãŒCP_COST_ATTACKã§å®šç¾©ã•ã‚Œã¦ã„ã¾ã™ã€‚
# 何も書ã„ã¦ã„ãªã„å ´åˆã®å€¤ã‚‚定義å¯èƒ½ã§ã™ã€‚
# è© å”±æ™‚é–“ã¯ã€Œãã®ã‚¹ã‚ルãŒç™ºå‹•ã™ã‚‹ã¾ã§ã®æ™‚é–“ã€ã§ã™ã€‚
# è© å”±ä¸ã¯ã‚¹ãƒ†ãƒ¼ãƒˆã€Œè© å”±ã€ãŒä»˜åŠ ã•ã‚Œã¾ã™ã€‚
# 攻撃ã®å ´åˆã¯ã‚‚ã¡ã‚ã‚“ã“ã®è© 唱時間ã¯0ã§ã™ã。
# ãªã®ã§ã€ã“ã‚“ãªæ„Ÿã˜ã§â†“
# 「クイックカット,120,0ã€
# ã“ã‚Œã§CP_COST_ATTACKã‚’120以上ã«ã—ã¦ãŠã‘ã°ã€
# 通常攻撃よりも早ã次ã®å‡ºç•ªãŒãã¾ã™ã。
# 「パワフルスイング,100,120ã€
# ã“ã‚Œã ã¨ã‚¹ã‚ルをé¸æŠžã—ã¦ã‹ã‚‰ç™ºå‹•ã™ã‚‹ã¾ã§ã®ã‚¿ã‚¤ãƒ ラグãŒ120ã‚ã‚Šã¾ã™ã。
#########################################################################
#==============================================================================
# â– åˆæœŸå®šç¾©
#==============================================================================
module RPG
class Skill
CP_COST_DELAY = 300 # スã‚ルã§å€¤ã‚’何も書ã„ã¦ã„ãªã„å ´åˆã®ãƒ‡ã‚£ãƒ¬ã‚¤å€¤
CP_COST_SPELL = 300 # スã‚ルã§å€¤ã‚’何も書ã„ã¦ã„ãªã„å ´åˆã®è© 唱時間
end
end
module CTB_Define
# è© å”±ã‚¹ãƒ†ãƒ¼ãƒˆã®ID
SPELL_STATE_ID = 300
# 消費CP
# 消費CPã®ç®—出方法ã¯ã€Œæ¶ˆè²»CP(ã“ã“ã§å®šç¾©)?ã™ã°ã‚„ã•å¹³å‡?ã™ã°ã‚„ã•ã€ã§ã™ã€‚
CP_COST_ITEM = 200 # アイテムを使用ã—ãŸã¨ãã®æ¸›ç®—値
CP_COST_ATTACK = 300 # 攻撃ã—ãŸã¨ãã®æ¸›ç®—値
CP_COST_GUARD = 200 # 防御ã—ãŸã¨ãã®æ¸›ç®—値
CP_COST_NOTHING = 100 # ãªã«ã‚‚ã—ãªã„ã¨ãã®æ¸›ç®—値
CP_COST_ESCAPE = 100 # 「逃ã’ã‚‹ã€æ™‚*全員ã®*ã®æ¸›ç®—値
CP_COST_SKILL = [0,300,300,400,300,300,300,300,400,300,300,400,300,300,400,300,300,400,300,300,400,300,300,400,300,300,400,300,300,400,400,550,250,350,250,350,250,350,250,350,250,350,250,350,250,350,250,350,250,350,250,350,400,400,400,400,200,300,400,500,200,300,400,500,200,300,400,500,200,300,400,500,200,300,400,500,200,300,400,500,900]
end
#==============================================================================
# â– RPG::Skill
#==============================================================================
module RPG
class Skill
def name
name = @name.split(/,/)[0]
return name != nil ? name : ''
end
def delay
name = @name.split(/,/)[1].to_i
return name != nil ? name : CP_COST_DELAY
end
def spell
name = @name.split(/,/)[2].to_i
return name != nil ? name : CP_COST_SPELL
end
end
end
#==============================================================================
# â– Window_CTB
#------------------------------------------------------------------------------
# ã‚ャラã®è¡Œå‹•é †ã‚’表示ã™ã‚‹ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã§ã™ã€‚
#==============================================================================
class Window_CTB < Window_Base
# è© å”±ã‚¹ãƒ†ãƒ¼ãƒˆã®IDèªã¿è¾¼ã¿
include CTB_Define
#--------------------------------------------------------------------------
# ◠オブジェクトåˆæœŸåŒ–
#--------------------------------------------------------------------------
def initialize(avg)
super(0, 320, 160, 160)
self.contents = Bitmap.new(self.width - 32, self.height - 32)
# å¹³å‡AGI算出
@agi_avg = avg
# ã‚ャラå列
@names = []
end
#--------------------------------------------------------------------------
# ◠リフレッシュ
#--------------------------------------------------------------------------
def refresh
# å†æ画開始
self.contents.clear
self.contents.font.name = "Tahoma"
self.contents.font.size = 20
self.contents.font.color = system_color
self.contents.font.size = 16
self.contents.draw_text(0, 0, 100, 17, "Turn Ratio")
# ã‚ャラå列
@names = []
# 攻撃コマンド後ã®å…¨å“¡ã®CPã‚’å…ˆèªã¿
get_cps
# cpã®å€¤ã§ã‚½ãƒ¼ãƒˆ
@names.sort!{|a,b| b[0] <=> a[0] }
h = 0
self.contents.font.size = 17
for i in 0...6
@nam = @names[i]
if @nam == nil
break
end
x = 4
y = 18 * h + 17
if @nam[0] >= 500 # 500より大ãã‘ã‚Œã°ç™½æ–‡å—。
if @nam[2] == true
self.contents.font.color = Color.new(230, 255, 255, 255)
else
self.contents.font.name = "Tahoma"
self.contents.font.size = 12
self.contents.font.color = normal_color
end
else
if @nam[2] == true
self.contents.font.color = Color.new(190, 225, 225, 255)
else
self.contents.font.color = disabled_color
end
end
self.contents.draw_text(x, y, 128, 18, @nam[1])
h += 1
end
end
#--------------------------------------------------------------------------
# ◠行動後ã®CPã®å–å¾—
#--------------------------------------------------------------------------
def get_cps
# メンãƒãƒ¼å…¨å“¡ã®è¡Œå‹•å¾Œã®CPã¨åå‰ã‚’@namesã«æ ¼ç´
i = 0
while @names.size < 15
for member in $game_party.actors + $game_troop.enemies
next if member.dead? or !member.exist?
cp = CP_COST_ATTACK * @agi_avg / member.agi # 攻撃時ã«æ¸›ç®—ã™ã‚‹CPå…ˆèªã¿
if i == 1 and member.current_action.kind == 1
skill = $data_skills[member.current_action.skill_id]
cp = CP_COST_SKILL[skill.id] * @agi_avg / member.agi
end
cp = member.cp - (cp * i)
if i == 0
spell = member.state?(SPELL_STATE_ID)
else
spell = false
end
@names.push([cp, member.name, spell])
end
i += 1
end
end
#--------------------------------------------------------------------------
# â— CTBウィンドウã®ä¸èº«ãŒç©ºã‹ã©ã†ã‹ã‚’確èªã™ã‚‹
#--------------------------------------------------------------------------
def names_empty
if @names == []
return true
else
return false
end
end
end
#==============================================================================
# â– Window_CTB_All
#------------------------------------------------------------------------------
# ã‚ャラã®è¡Œå‹•é †ã‚’表示ã™ã‚‹ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã®æ‹¡å¤§ç‰ˆã§ã™ã€‚
#==============================================================================
class Window_CTB_All < Window_Base
# è© å”±ã‚¹ãƒ†ãƒ¼ãƒˆã®IDèªã¿è¾¼ã¿
include CTB_Define
#--------------------------------------------------------------------------
# ◠オブジェクトåˆæœŸåŒ–
#--------------------------------------------------------------------------
def initialize(avg)
super(0, 0, 160, 480)
self.contents = Bitmap.new(self.width - 32, self.height - 32)
self.contents.font.name = "Tahoma"
self.contents.font.size = 12
# å¹³å‡AGI算出
@agi_avg = avg
# ã‚ャラå列
@names = []
# 攻撃コマンド後ã®å…¨å“¡ã®CPã‚’å…ˆèªã¿
get_init_cps
# cpã®å€¤ã§ã‚½ãƒ¼ãƒˆ
@names.sort!{|a,b| b[0] <=> a[0] }
end
#--------------------------------------------------------------------------
# ◠リフレッシュ
#--------------------------------------------------------------------------
def refresh(id)
# å†æ画開始
self.contents.clear
self.contents.font.name = "Tahoma"
self.contents.font.size = 20
self.contents.font.color = system_color
self.contents.font.size = 18
self.contents.draw_text(0, 0, 100, 20, "Turn Ratio")
h = 0
self.contents.font.size = 19
for i in id-1...[id+18,50].min
@nam = @names[i]
if @nam == nil
break
end
x = 4
y = 22 * h + 20
if @nam[0] >= 500 # 500より大ãã‘ã‚Œã°ç™½æ–‡å—。
if @nam[2] == true
self.contents.font.color = Color.new(230, 255, 255, 255)
else
self.contents.font.color = normal_color
end
else
if @nam[2] == true
self.contents.font.color = Color.new(190, 225, 225, 255)
else
self.contents.font.color = disabled_color
end
end
self.contents.font.name = "Tahoma"
self.contents.font.size = $fontsize
self.contents.draw_text(x, y, 32, 22, (i+1).to_s)
self.contents.draw_text(x+32, y, 128, 22, @nam[1])
h += 1
end
end
#--------------------------------------------------------------------------
# ◠行動後ã®CPã®å–å¾—
#--------------------------------------------------------------------------
def get_init_cps
# メンãƒãƒ¼å…¨å“¡ã®è¡Œå‹•å¾Œã®CPã¨åå‰ã‚’@namesã«æ ¼ç´
i = 0
while @names.size < 75
for member in $game_party.actors + $game_troop.enemies
next if member.dead? or !member.exist?
cp = CP_COST_ATTACK * @agi_avg / member.agi # 攻撃時ã«æ¸›ç®—ã™ã‚‹CPå…ˆèªã¿
if i == 1 and member.current_action.kind == 1
@skill = $data_skills[@active_battler.current_action.skill_id]
skill = $data_skills[member.current_action.skill_id]
cp = CP_COST_SKILL[skill.id] * @agi_avg / member.agi
end
cp = member.cp - (cp * i)
if i == 0
spell = member.state?(SPELL_STATE_ID)
else
spell = false
end
@names.push([cp, member.name, spell])
end
i += 1
end
end
#--------------------------------------------------------------------------
# â— CTBウィンドウã®ä¸èº«ãŒç©ºã‹ã©ã†ã‹ã‚’確èªã™ã‚‹
#--------------------------------------------------------------------------
def names_full(id)
if @names[id] == nil
return false
end
return true
end
end
#==============================================================================
# â– 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 = ["Battle", "Special", "Escape"]
@item_max = 3
@column_max = 3
draw_item(0, normal_color)
draw_item(1, normal_color)
draw_item(2, $game_temp.battle_can_escape ? normal_color : disabled_color)
self.active = false
self.visible = false
self.index = 0
end
#--------------------------------------------------------------------------
# â— é …ç›®ã®æç”»(å†å®šç¾©)
# index : é …ç›®ç•ªå·
# color : æ–‡å—色
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
rect = Rect.new(80 + 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(80 + index * 160, 0, 128, 32)
end
end
#==============================================================================
# â– Window_BattleStatus
#==============================================================================
class Window_BattleStatus < Window_Base
#--------------------------------------------------------------------------
# ◠オブジェクトåˆæœŸåŒ–(å†å®šç¾©)(微妙ã«åº§æ¨™èª¿æ•´)
#--------------------------------------------------------------------------
def initialize
super(160, 320, 480, 160)
self.contents = Bitmap.new(width - 32, height - 32)
@level_up_flags = [false, false, false, false]
refresh
end
#--------------------------------------------------------------------------
# ◠リフレッシュ(å†å®šç¾©)(微妙ã«åº§æ¨™èª¿æ•´)
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.name = "Tahoma"
self.contents.font.size = 19
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
actor_x = i * 115 + 9
draw_actor_name(actor, actor_x, 0)
draw_actor_hp(actor, actor_x, 31, 90)
draw_actor_sp(actor, actor_x, 65, 90)
if @level_up_flags[i]
self.contents.font.color = normal_color
self.contents.draw_text(actor_x, 99, 120, 32, "Level Up!")
else
draw_actor_state(actor, actor_x, 99)
end
end
end
end
#==============================================================================
# â– Game_Battler
#==============================================================================
class Game_Battler
# è© å”±ã‚¹ãƒ†ãƒ¼ãƒˆã®IDèªã¿è¾¼ã¿
include CTB_Define
attr_accessor :now_guarding # ç¾åœ¨é˜²å¾¡ä¸ãƒ•ãƒ©ã‚°
attr_accessor :cp # ç¾åœ¨CP
#--------------------------------------------------------------------------
# ◠コマンド入力å¯èƒ½åˆ¤å®š
#--------------------------------------------------------------------------
alias ctb_sys_inputable? inputable?
def inputable?
bool = ctb_sys_inputable?
return false if state?(SPELL_STATE_ID)
return false if bool == false
return false if @cp < 500
return true
end
end
#==============================================================================
# â– Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ◠セットアップ
#--------------------------------------------------------------------------
alias ctb_sys_setup setup
def setup(actor_id)
ctb_sys_setup(actor_id)
@cp = 0
@now_guarding = false
end
#--------------------------------------------------------------------------
# â— ãƒãƒˆãƒ«ç”»é¢ X 座標ã®å–å¾—(å†å®šç¾©)
#--------------------------------------------------------------------------
def screen_x
# パーティ内ã®ä¸¦ã³é †ã‹ã‚‰ X 座標を計算ã—ã¦è¿”ã™
if self.index != nil
return self.index * 115 + 215
else
return 0
end
end
end
#==============================================================================
# â– Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# ◠オブジェクトåˆæœŸåŒ–
#--------------------------------------------------------------------------
alias ctb_sys_initialize initialize
def initialize(troop_id, member_index)
ctb_sys_initialize(troop_id, member_index)
@cp = 0
@now_guarding = false
end
end
#==============================================================================
# â– Game_BattleAction
#==============================================================================
class Game_BattleAction
#--------------------------------------------------------------------------
# ◠公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :spell # è© å”±ä¸ã‹å¦ã‹
#--------------------------------------------------------------------------
# ◠オブジェクトåˆæœŸåŒ–
#--------------------------------------------------------------------------
alias ctb_sys_initialize initialize
def initialize
@spell = false # spellã‚’falseã«ã™ã‚‹
ctb_sys_initialize
end
#--------------------------------------------------------------------------
# ◠クリア
#--------------------------------------------------------------------------
alias ctb_sys_clear clear
def clear
# spell ãŒtrueãªã‚‰ã°å®Ÿè¡Œã—ãªã„
return if @spell
ctb_sys_clear
end
end
#==============================================================================
# â– Scene_Battle
#==============================================================================
class Scene_Battle
# è© å”±ã‚¹ãƒ†ãƒ¼ãƒˆã®IDèªã¿è¾¼ã¿
include CTB_Define
#--------------------------------------------------------------------------
# â— ãƒ¡ã‚¤ãƒ³å‡¦ç† (å†å®šç¾©)
#--------------------------------------------------------------------------
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(115, [s1, s2, s3, s4])
@actor_command_window.y = 160
@actor_command_window.back_opacity = 0
@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 = 0
@help_window.visible = false
@status_window = Window_BattleStatus.new
@message_window = Window_Message.new
### ココã‹ã‚‰è¿½åŠ 部分
# 全員ã®ã™ã°ã‚„ã•ã®å¹³å‡ã‚’割り出ã™
@avg = read_avg
# CTB用Windowを作æˆ
@ctb_window = Window_CTB.new(@avg)
# 全員ã®åˆæœŸCPを代入
first_cp
### ココã¾ã§è¿½åŠ 部分
# スプライトセットを作æˆ
@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
### ココã‹ã‚‰è¿½åŠ 部分
@ctb_window.dispose
if @skill_window != nil
@skill_window.dispose
end
### ココã¾ã§è¿½åŠ 部分
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 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
# ココã‹ã‚‰è¿½åŠ
# CPæ›´æ–°
if @phase != 4
cp_countup
end
@ctb_window.update
# CTB ウィンドウã«åå‰ãŒè¡¨ç¤ºã•ã‚Œã¦ã„ãªã„å ´åˆ(戦闘開始時)ã¯refresh
@ctb_window.refresh if @ctb_window.names_empty
# ココã¾ã§è¿½åŠ
# ウィンドウを更新
@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
# アクションを強制ã•ã‚Œã¦ã„ã‚‹ãƒãƒˆãƒ©ãƒ¼ãŒå˜åœ¨ã›ãšã€
# ã‹ã¤ãƒãƒˆãƒ«ã‚¤ãƒ™ãƒ³ãƒˆãŒå®Ÿè¡Œä¸ã®å ´åˆ
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
# ココã‹ã‚‰è¿½åŠ
when 6 # å…¨è¡Œå‹•é †ç¢ºèªãƒ•ã‚§ãƒ¼ã‚º(è¿½åŠ éƒ¨åˆ†)
update_ctb_all
end
end
#--------------------------------------------------------------------------
# ◠パーティコマンドフェーズ開始(å†å®šç¾©)
#--------------------------------------------------------------------------
def start_phase2
# フェーズ 2 ã«ç§»è¡Œ
@phase = 2
# アクターをéžé¸æŠžçŠ¶æ…‹ã«è¨å®š
@actor_index = -1
@active_battler = nil
# ココã‹ã‚‰å¤‰æ›´
# アクターコマンドウィンドウを無効化
@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
# ココã‹ã‚‰å¤‰æ›´
# パーティーコマンドãŒã‚¢ã‚¯ãƒ†ã‚£ãƒ–ãªã‚‰ã°ãƒ‘ーティーコマンドフェーズã¸
if @party_command_window.active != true
start_phase3
else
update_phase2
end
# ココã¾ã§å¤‰æ›´
end
#--------------------------------------------------------------------------
# ◠フレーム更新 (パーティコマンドフェーズ)(å†å®šç¾©)
#--------------------------------------------------------------------------
def update_phase2
# 全部変更ã—ã¦ã¾ã™
# C ボタンãŒæŠ¼ã•ã‚ŒãŸå ´åˆ
if Input.trigger?(Input::C)
# パーティコマンドウィンドウã®ã‚«ãƒ¼ã‚½ãƒ«ä½ç½®ã§åˆ†å²
case @party_command_window.index
when 0 # 戦ã†
# 決定 SE ã‚’æ¼”å¥
$game_system.se_play($data_system.decision_se)
# アクターコマンドフェーズ開始
start_phase3
when 1 # CTBWindow2
# 決定 SE ã‚’æ¼”å¥
$game_system.se_play($data_system.decision_se)
# CTB表示開始
start_phase2_CTB
when 2 # 逃ã’ã‚‹
# 逃走å¯èƒ½ã§ã¯ãªã„å ´åˆ
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
elsif Input.trigger?(Input::B)
# 決定 SE ã‚’æ¼”å¥
$game_system.se_play($data_system.cancel_se)
# アクターコマンドフェーズ開始
start_phase3
end
end
#--------------------------------------------------------------------------
# ◠フレーム更新 (パーティコマンドフェーズ : 逃ã’ã‚‹)
#--------------------------------------------------------------------------
alias ctb_sys_update_phase2_escape update_phase2_escape
def update_phase2_escape
# CP消費 (全員)
for actor in $game_party.actors
if actor.exist?
actor.cp -= CP_COST_ESCAPE * @avg / actor.agi
end
end
ctb_sys_update_phase2_escape
end
#--------------------------------------------------------------------------
# ◠アクターコマンドウィンドウã®ã‚»ãƒƒãƒˆã‚¢ãƒƒãƒ—
#--------------------------------------------------------------------------
alias ctb_sys_phase3_setup_command_window phase3_setup_command_window
def phase3_setup_command_window
ctb_sys_phase3_setup_command_window
# ガードフラグをfalseã«ã™ã‚‹
@active_battler.now_guarding = false
# アクターコマンドウィンドウã®ä½ç½®ã‚’å†è¨å®š(å³ã¸160移動)
@actor_command_window.x = @actor_index * 105 + 160
end
#--------------------------------------------------------------------------
# ◠フレーム更新 (アクターコマンドフェーズ : 基本コマンド)
#--------------------------------------------------------------------------
alias ctb_sys_update_phase3_basic_command update_phase3_basic_command
def update_phase3_basic_command
# X ボタンãŒæŠ¼ã•ã‚ŒãŸå ´åˆ
if Input.trigger?(Input::X)
# 決定 SE ã‚’æ¼”å¥
$game_system.se_play($data_system.decision_se)
# パーティーコマンド呼ã³å‡ºã—
@party_command_window.active = true
@party_command_window.visible = true
start_phase2
else
ctb_sys_update_phase3_basic_command
end
end
#--------------------------------------------------------------------------
# â— è¡Œå‹•é †åºä½œæˆ (å†å®šç¾©)
#--------------------------------------------------------------------------
def make_action_orders
# CP500以上ã®ãƒãƒˆãƒ©ãƒ¼ã¯pushã—ãªã„よã†ã«ã—ãŸã€‚
# é…列 @action_battlers ã‚’åˆæœŸåŒ–
@action_battlers = []
# CP500以上ã®ã‚¨ãƒãƒŸãƒ¼ã‚’é…列 @action_battlers ã«è¿½åŠ
for enemy in $game_troop.enemies
if enemy.cp >= 500
@action_battlers.push(enemy)
end
end
# CP500以上ã®ã‚¢ã‚¯ã‚¿ãƒ¼ã‚’é…列 @action_battlers ã«è¿½åŠ
for actor in $game_party.actors
if actor.cp >= 500
@action_battlers.push(actor)
end
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
#--------------------------------------------------------------------------
# ◠フレーム更新 (メインフェーズ ステップ 1 : アクション準備)
#--------------------------------------------------------------------------
alias ctb_sys_update_phase4_step1 update_phase4_step1
def update_phase4_step1
# CTBリフレッシュ
@ctb_window.refresh
ctb_sys_update_phase4_step1
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
if @active_battler.cp >= 500
# ステート自然解除
@active_battler.remove_states_auto
# CP消費 (行動ã§ããªã„å ´åˆã¯ä½•ã‚‚ã—ãªã„å ´åˆã¨åŒã˜) ココ追åŠ
@active_battler.cp -= CP_COST_NOTHING * @avg / @active_battler.agi
# cpをカウントアップ
cp_countup
end
# ステップ 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
#--------------------------------------------------------------------------
# ◠基本アクション çµæžœä½œæˆ
#--------------------------------------------------------------------------
alias ctb_sys_make_basic_action_result make_basic_action_result
def make_basic_action_result
# 攻撃ã®å ´åˆ
if @active_battler.current_action.basic == 0
@active_battler.cp -= CP_COST_ATTACK * @avg / @active_battler.agi
end
# 防御ã®å ´åˆ
if @active_battler.current_action.basic == 1
# CP消費
@active_battler.cp -= CP_COST_GUARD * @avg / @active_battler.agi
end
# 敵ã®é€ƒã’ã‚‹ã®å ´åˆ
if @active_battler.is_a?(Game_Enemy) and
@active_battler.current_action.basic == 2
# CP消費
@active_battler.cp -= CP_COST_ESCAPE * @avg / @active_battler.agi
end
# 何もã—ãªã„ã®å ´åˆ
if @active_battler.current_action.basic == 3
# CP消費
@active_battler.cp -= CP_COST_NOTHING * @avg / @active_battler.agi
# アクション強制対象ã®ãƒãƒˆãƒ©ãƒ¼ã‚’クリア
$game_temp.forcing_battler = nil
# cpをカウントアップ
cp_countup
# ステップ 1 ã«ç§»è¡Œ
@phase4_step = 1
return
end
# 呼ã³æˆ»ã—
ctb_sys_make_basic_action_result
end
#--------------------------------------------------------------------------
# ◠スã‚ルアクション çµæžœä½œæˆ(å†å®šç¾©)
#--------------------------------------------------------------------------
def make_skill_action_result
# スã‚ルをå–å¾—
@skill = $data_skills[@active_battler.current_action.skill_id]
skill = $data_skills[@active_battler.current_action.skill_id]
# ステータスウィンドウをリフレッシュ
@status_window.refresh
@ctb_window.refresh
# ヘルプウィンドウã«ã‚¹ã‚ルåを表示
@help_window.set_text(@skill.name, 1)
# è© å”±ä¸ã®å ´åˆ
if @active_battler.state?(SPELL_STATE_ID)
# ã‚¹ãƒ†ãƒ¼ãƒˆã€Œè© å”±ã€ã‚’削除
@active_battler.remove_state(SPELL_STATE_ID)
@active_battler.current_action.spell = false
else
# SP 消費
@active_battler.sp -= @skill.sp_cost
# Skillã®Spell値ãŒ1以上ã®å ´åˆ
if @skill.spell > 0
# CP 消費 skill.spellã®æ¸›ç®—
@active_battler.cp -= CP_COST_SKILL[skill.id] * @avg / @active_battler.agi
# ã‚¹ãƒ†ãƒ¼ãƒˆã€Œè© å”±ã€ã‚’付
@active_battler.add_state(SPELL_STATE_ID)
@active_battler.current_action.spell = true
end
end
# ã‚¹ãƒ†ãƒ¼ãƒˆã€Œè© å”±ã€ãŒãªã‘ã‚Œã°åŠ¹æžœå®Ÿè¡Œ
unless @active_battler.state?(SPELL_STATE_ID)
# SP 消費を戻ã™ã€‚
@active_battler.sp += @skill.sp_cost
# 強制アクションã§ãªã‘ã‚Œã°
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
# CP 消費 skill.delayã®æ¸›ç®—
@active_battler.cp -= CP_COST_SKILL[skill.id] * @avg / @active_battler.agi
# アニメーション ID ã‚’è¨å®š
@animation1_id = @skill.animation1_id
@animation2_id = @skill.animation2_id
# コモンイベント ID ã‚’è¨å®š
@common_event_id = @skill.common_event_id
# 対象å´ãƒãƒˆãƒ©ãƒ¼ã‚’è¨å®š
set_target_battlers(@skill.scope)
# スã‚ルã®åŠ¹æžœã‚’é©ç”¨
for target in @target_battlers
target.skill_effect(@active_battler, @skill)
end
end
end
#--------------------------------------------------------------------------
# ◠アイテムアクション çµæžœä½œæˆ
#--------------------------------------------------------------------------
def make_item_action_result
alias ctb_sys_make_item_action_result make_item_action_result
ctb_sys_make_item_action_result
# CP 消費
@active_battler.cp -= CP_COST_ITEM * @avg / @active_battler.agi
end
#--------------------------------------------------------------------------
# ◠フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
#--------------------------------------------------------------------------
alias ctb_sys_update_phase4_step6 update_phase4_step6
def update_phase4_step6
ctb_sys_update_phase4_step6
# cpをカウントアップ
cp_countup
end
#--------------------------------------------------------------------------
# â— ã™ã°ã‚„ã•å¹³å‡å‰²ã‚Šå‡ºã—
#--------------------------------------------------------------------------
def read_avg
temp = 0
for member in $game_party.actors + $game_troop.enemies
temp += member.agi
end
temp /= $game_troop.enemies.size + $game_party.actors.size
return temp
end
#--------------------------------------------------------------------------
# ◠全員ã®åˆæœŸCPを決ऩ