Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Need help with cogwheel rtab ver. 1.16 skill targeting

I am using rmxp with cogwheels ratb and several other scripts. I have just recently come across a major problem with my skills. When selecting my scope for a skill the system only works if selecting; one ally, one enemy, one ally (hp0), one enemy (hp0). If I attempt to assign all enemies, all allies, or the user, the skill shows absolutely no animation or effect or anything at all, it just restarts the atb gauge. (I am not using any animated battlers or the connected attacking.)
 
Yes I can,

Here is the Scripts I am using with RATB

# Real time active battle (RTAB) Ver 1.16
# Distribution original support URL
# http://members.jcom.home.ne.jp/cogwheel/

class Scene_Battle
#--------------------------------------------------------------------------
# * Open instance variable
#--------------------------------------------------------------------------
attr_reader :status_window # Status Window
attr_reader :spriteset # Battle sprite
attr_reader :scroll_time # Screen portable basic time
attr_reader :zoom_rate # Enemy battler basic position
attr_reader :drive # Camera drive
attr_accessor :force # Degree of action forcing
attr_accessor :camera # Present camera possession person
#--------------------------------------------------------------------------
# * ATB fundamental setup
#--------------------------------------------------------------------------
def atb_setup
# ATB initialization
#
# speed : Battle speed decision. The lower the value, the faster the system
#
# @active : Degree of active setting
# 3 : Always active state
# 2 : ATB pauses when selecting skill/item
# 1 : Same as 2, but pauses during target selection
# 0 : Same as 1, but pauses during command window selection.
#
# @action : Others while acting is the fact that by their causes conduct permitted?
# 3 : If by his is not incapacitation, limited to you permit
# 2 : If by his has not received the damage, you permit
# 1 : In addition to the state of 2, if the target has not acted, you permit
# 0 : Conduct is not permitted. Until it finishes to act in order, it waits
#
# @anime_wait : When it makes true, during battle animation damage indicating wait catches
# @damage_wait : Damage indicatory waiting (as for unit frame)
#
# @after_wait : At the time of ally enemy total loss, until moves to next processing, waiting
# [a, b] a) At the time of party total loss, b) At time of enemy total loss (unit frame)
#
# @enemy_speed : Thought speed of enemy. If 1 immediately conduct.
# In every frame, conduct is caused with the probability of 1/@enemy_speed
#
# @force : With forced action forced condition at time of skill use
# 2: As for skill everything not to reside permanently, by all means immediately execution
# 1: As for independent skill to reside permanently, only cooperation skill immediately execution
# 0: All the skill permanent residence just are done
#
# ($scene.force = Usually by making x, from the script of the event modification possibility)
#
# CAMERA DRIVE SYSTEM: This system moves the Camera POV to the currently moving battler
# @drive : Camera drive system ON/OFF. When true, drive ON, when false drive OFF
# @scroll_time : Time it takes to scroll/move the camera POV during battle
#
# @zoom_rate = [i, j] : Zoom ratio of enemy
# i) When arranging in the picture first section, enlargement ratio
# j) When arranging in the picture lowest section, enlargement ratio
# 1 When liking to make time, 1.0 be sure to set with decimal
speed = 200 # IN FRAMES / FOR ATB SYSTEM
@active = 2 # Active Setting (Range of 0 - 3)
@action = 0 # Action Setting (Range of 0 - 3)
@anime_wait = false #
@damage_wait = 10 #
@after_wait = [80, 0] #
@enemy_speed = 140 #
@force = 2 #
@drive = true # Turns camera system on/off
@scroll_time = 15 # Speed of camera system
@zoom_rate = [0.2, 2.0] # Controls perspective of battlers on screen
@help_time = 40 #
@escape == false #
@camera = nil # Used by system: Determines camera
@max = 0 #
@turn_cnt = 0 # Turns
@help_wait = 0 #
@action_battlers = [] # Used by system to hold battlers
@synthe = [] # Used by system: For Cooperative Skills & such
@spell_p = {} #
@spell_e = {} #
@command_a = false #
@command = [] #
@party = false #
for battler in $game_party.actors + $game_troop.enemies
spell_reset(battler)
battler.at = battler.agi * rand(speed / 2)
battler.damage_pop = {}
battler.damage = {}
battler.damage_sp = {}
battler.critical = {}
battler.recover_hp = {}
battler.recover_sp = {}
battler.state_p = {}
battler.state_m = {}
battler.animation = []
if battler.is_a?(Game_Actor)
@max += battler.agi
end
end
@max *= speed
@max /= $game_party.actors.size

for battler in $game_party.actors + $game_troop.enemies
battler.atp = 100 * battler.at / @max
end
end

#--------------------------------------------------------------------------
# * Full AT Gauge SE
#--------------------------------------------------------------------------
def fullat_se
Audio.se_play("Audio/SE/033-switch02", 80, 100)
end

#--------------------------------------------------------------------------
# * Leveling Up SE
#--------------------------------------------------------------------------
def levelup_se
Audio.se_play("Audio/SE/056-Right02", 80, 100)
end

#--------------------------------------------------------------------------
# * Skill Acquisition SE
#--------------------------------------------------------------------------
def skill_se
Audio.se_play("Audio/SE/056-Right02", 80, 150)
end
end

class Window_Base < Window
#--------------------------------------------------------------------------
# * Draw Actor ATG
# actor : Actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : draw spot width
#--------------------------------------------------------------------------
def draw_actor_atg(actor, x, y, width = 144)
if @at_gauge == nil
# plus_x: revised x-coordinate
# rate_x: revised X-coordinate as (%)
# plus_y: revised y-coordinate
# plus_width: revised width
# rate_width: revised width as (%)
# height: Vertical width
# align1: Type 1 ( 0: left justify 1: center justify 2: right justify )
# align2: Type 2 ( 0: Upper stuffing 1: Central arranging 2:Lower stuffing )
# align3: Gauge type 0:Left justify 1: Right justify
@plus_x = 0
@rate_x = 0
@plus_y = 16
@plus_width = 0
@rate_width = 100
@width = @plus_width + width * @rate_width / 100
@height = 16
@align1 = 0
@align2 = 1
@align3 = 0
# Gradation settings: grade1: Empty gauge grade2:Actual gauge
# (0:On side gradation 1:Vertically gradation 2: Slantedly gradation)
grade1 = 1
grade2 = 0
# Color setting. color1: Outermost framework, color2: Medium framework
# color3: Empty framework dark color, color4: Empty framework light/write color
color1 = Color.new(0, 0, 0)
color2 = Color.new(255, 255, 192)
color3 = Color.new(0, 0, 0, 192)
color4 = Color.new(0, 0, 64, 192)
# Color setting of gauge
# Usually color setting of the time
color5 = Color.new(0, 64, 80)
color6 = Color.new(0, 128, 160)
# When gauge is MAX, color setting
color7 = Color.new(80, 0, 0)
color8 = Color.new(240, 0, 0)
# Color setting at time of cooperation skill use
color9 = Color.new(80, 64, 32)
color10 = Color.new(240, 192, 96)
# Color setting at time of skill permanent residence
color11 = Color.new(80, 0, 64)
color12 = Color.new(240, 0, 192)
# Drawing of gauge
gauge_rect_at(@width, @height, @align3, color1, color2,
color3, color4, color5, color6, color7, color8,
color9, color10, color11, color12, grade1, grade2)
end
# Variable at substituting the width of the gauge which is drawn
if actor.rtp == 0
at = (width + @plus_width) * actor.atp * @rate_width / 10000
else
at = (width + @plus_width) * actor.rt * @rate_width / actor.rtp / 100
end
if at > width
at = width
end
# Revision such as the left stuffing central posture of gauge
case @align1
when 1
x += (@rect_width - width) / 2
when 2
x += @rect_width - width
end
case @align2
when 1
y -= @height / 2
when 2
y -= @height
end
self.contents.blt(x + @plus_x + width * @rate_x / 100, y + @plus_y,
@at_gauge, Rect.new(0, 0, @width, @height))
if @align3 == 0
rect_x = 0
else
x += @width - at - 1
rect_x = @width - at - 1
end
# Color setting of gauge
if at == width
# Gauge drawing at the time of MAX
self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
@at_gauge, Rect.new(rect_x, @height * 2, at, @height))
else
if actor.rtp == 0
# Usually gauge drawing of the time
self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
@at_gauge, Rect.new(rect_x, @height, at, @height))
else
if actor.spell == true
#Gauge drawing at time of cooperation skill use
self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
@at_gauge, Rect.new(rect_x, @height * 3, at, @height))
else
# Gauge drawing at time of skill permanent residence
self.contents.blt(x + @plus_x + @width * @rate_x / 100, y + @plus_y,
@at_gauge, Rect.new(rect_x, @height * 4, at, @height))
end
end
end
end
end

#==============================================================================
# ** Scene_Battle (part 1)
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================

class Scene_Battle
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Initialize each kind of temporary battle data
$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
# Initialize battle event interpreter
$game_system.battle_interpreter.setup(nil, 0)
# Prepare troop
@troop_id = $game_temp.battle_troop_id
$game_troop.setup(@troop_id)
atb_setup
# Make actor command window
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
@actor_command_window.back_opacity = 160
@actor_command_window.active = false
@actor_command_window.visible = false
# Make other windows
@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
# Make sprite set
@spriteset = Spriteset_Battle.new
# Initialize wait count
@wait_count = 0
# Execute transition
if $data_system.battle_transition == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$data_system.battle_transition)
end
# Start pre-battle phase
start_phase1
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Refresh map
$game_map.refresh
# Prepare for transition
Graphics.freeze
# Dispose of windows
@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
# Dispose of spriteset
@spriteset.dispose
# If switching to title screen
if $scene.is_a?(Scene_Title)
# Fade out screen
Graphics.transition
Graphics.freeze
end
# If switching from battle test to any screen other than game over screen
if $BTEST and not $scene.is_a?(Scene_Gameover)
$scene = nil
end
end
#--------------------------------------------------------------------------
# * Determine Battle Win/Loss Results
#--------------------------------------------------------------------------
def judge
# If all dead determinant is true, or number of members in party is 0
if $game_party.all_dead? or $game_party.actors.size == 0
# If possible to lose
if $game_temp.battle_can_lose
# Return to BGM before battle starts
$game_system.bgm_play($game_temp.map_bgm)
# Battle end
battle_end(2)
# Return true
return true
end
# Setting the game over flag
$game_temp.gameover = true
# Return true
return true
end
# Return false if even 1 enemy exists
for enemy in $game_troop.enemies
if enemy.exist?
return false
end
end
# Start after battle phase (win)
start_phase5
# Return true
return true
end
#--------------------------------------------------------------------------
# * Frame renewal
#--------------------------------------------------------------------------
def update
# If battle event is running
if $game_system.battle_interpreter.running?
if @command.size > 0
@command_a = false
@command = []
command_delete
end
@status_window.at_refresh
# Update interpreter
$game_system.battle_interpreter.update
# If a battler which is forcing actions doesn't exist
if $game_temp.forcing_battler == nil
# If battle event has finished running
unless $game_system.battle_interpreter.running?
# Refresh status window
@status_window.refresh
setup_battle_event
end
end
end
# Update system (timer) and screen
$game_system.update
$game_screen.update
# If timer has reached 0
if $game_system.timer_working and $game_system.timer == 0
# Abort battle
$game_temp.battle_abort = true
end
# Update windows
@help_window.update
@party_command_window.update
@actor_command_window.update
@status_window.update
@message_window.update
# Update sprite set
@spriteset.update
# If transition is processing
if $game_temp.transition_processing
# Clear transition processing flag
$game_temp.transition_processing = false
# Execute transition
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
# If message window is showing
if $game_temp.message_window_showing
return
end
# If game over
if $game_temp.gameover
# Switch to game over screen
$scene = Scene_Gameover.new
return
end
# If returning to title screen
if $game_temp.to_title
# Switch to title screen
$scene = Scene_Title.new
return
end
# If battle is aborted
if $game_temp.battle_abort
# Return to BGM used before battle started
$game_system.bgm_play($game_temp.map_bgm)
# Battle ends
battle_end(1)
return
end
# If help window is waiting
if @help_wait > 0
@help_wait -= 1
if @help_wait == 0
# Hide help window
@help_window.visible = false
end
end
# When the battler forced into action doesn't exist
# while the battle event is in the midst of executing
if $game_temp.forcing_battler == nil and
$game_system.battle_interpreter.running?
return
end
# Branch according to phase
case @phase
when 0 # AT gauge renewal phase
if anime_wait_return
update_phase0
end
when 1 # pre-battle phase
update_phase1
return
when 2 # party command phase
update_phase2
return
when 5 # after battle phase
update_phase5
return
end
if $scene != self
return
end
if @phase == 0
if @command.size != 0 # Actor command phase
if @command_a == false
start_phase3
end
update_phase3
end
# If waiting
if @wait_count > 0
# Decrease wait count
@wait_count -= 1
return
end
update_phase4
end
end

#==============================================================================
# ** Scene_Battle (part 2)
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================

#--------------------------------------------------------------------------
# * Frame renewal (AT gauge renewal phase)
#--------------------------------------------------------------------------
def update_phase0
if $game_temp.battle_turn == 0
$game_temp.battle_turn = 1
end
# If B button was pressed
if @command_a == false and @party == false
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
@party = true
end
end
if @party == true and
((@action > 0 and @action_battlers.empty?) or (@action == 0 and
(@action_battlers.empty? or @action_battlers[0].phase == 1)))
# Start party command phase
start_phase2
return
end
# AT gauge increase processing
cnt = 0
for battler in $game_party.actors + $game_troop.enemies
active?(battler)
if battler.rtp == 0
if battler.at >= @max
if battler.is_a?(Game_Actor)
if battler.inputable?
unless @action_battlers.include?(battler) or
@command.include?(battler) or @escape == true
if battler.current_action.forcing
fullat_se
force_action(battler)
action_start(battler)
else
fullat_se
@command.push(battler)
end
end
else
unless @action_battlers.include?(battler) or
battler == @command[0]
battler.current_action.clear
if @command.include?(battler)
@command.delete(battler)
else
if battler.movable?
fullat_se
end
end
action_start(battler)
end
end
else
unless @action_battlers.include?(battler)
if battler.current_action.forcing
force_action(battler)
action_start(battler)
else
if @enemy_speed != 0
if rand(@enemy_speed) == 0
number = cnt - $game_party.actors.size
enemy_action(number)
end
else
number = cnt - $game_party.actors.size
enemy_action(number)
end
end
end
end
else
battler.at += battler.agi
if battler.guarding?
battler.at += battler.agi
end
if battler.movable?
battler.atp = 100 * battler.at / @max
end
end
else
if battler.rt >= battler.rtp
speller = synthe?(battler)
if speller != nil
battler = speller[0]
end
unless @action_battlers.include?(battler)
if battler.is_a?(Game_Actor)
fullat_se
end
battler.rt = battler.rtp
action_start(battler)
end
else
battler.rt += battler.agi
speller = synthe?(battler)
if speller != nil
for spell in speller
if spell != battler
spell.rt += battler.agi
end
end
end
end
end
cnt += 1
end
# Refresh AT gauge
@status_window.at_refresh
# Escape processing
if @escape == true and
((@action > 0 and @action_battlers.empty?) or (@action == 0 and
(@action_battlers.empty? or @action_battlers[0].phase == 1)))
temp = false
for battler in $game_party.actors
if battler.inputable?
temp = true
end
end
if temp == true
for battler in $game_party.actors
if battler.at < @max and battler.inputable?
temp = false
break
end
end
if temp == true
@escape = false
for battler in $game_party.actors
battler.at %= @max
end
$game_temp.battle_main_phase = false
update_phase2_escape
end
end
end
end
#--------------------------------------------------------------------------
# * Start Party Command Phase
#--------------------------------------------------------------------------
def start_phase2
# Shift to phase 2
@phase = 2
@party = false
# Enable party command window
@party_command_window.active = true
@party_command_window.visible = true
# Set actor to non-selecting
@actor_index = -1
# Disable actor command window
@actor_command_window.active = false
@actor_command_window.visible = false
if @command.size != 0
# Actor blink effect OFF
if @active_actor != nil
@active_actor.blink = false
end
end
# Camera set
@camera == "party"
@spriteset.screen_target(0, 0, 1)
# Clear main phase flag
$game_temp.battle_main_phase = false
end
#--------------------------------------------------------------------------
# * Frame renewal (party command phase)
#--------------------------------------------------------------------------
def update_phase2
# When C button is pushed
if Input.trigger?(Input::C)
# It diverges at cursor position of the party command window
case @party_command_window.index
when 0 # It fights
# Nullifying the party command window
@party_command_window.active = false
@party_command_window.visible = false
# Performing decision SE
$game_system.se_play($data_system.decision_se)
@escape = false
@phase = 0
if $game_temp.battle_turn == 0
$game_temp.battle_turn = 1
end
if @command_a == true
# Actor command phase start
start_phase3
else
$game_temp.battle_main_phase = true
end
when 1 # It escapes
# When it is not flight possible,
if $game_temp.battle_can_escape == false
# Performing buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Performing decision SE
$game_system.se_play($data_system.decision_se)
@phase = 0
# Nullifying the party command window
@party_command_window.active = false
@party_command_window.visible = false
$game_temp.battle_main_phase = true
if $game_temp.battle_turn == 0
update_phase2_escape
$game_temp.battle_turn = 1
for battler in $game_party.actors
battler.at -= @max / 2
end
return
end
# Performing decision SE
$game_system.se_play($data_system.decision_se)
@escape = true
for battler in $game_party.actors
@command_a = false
@command.delete(battler)
@action_battlers.delete(battler)
skill_reset(battler)
end
end
return
end
end
#--------------------------------------------------------------------------
# * Frame renewal (party command phase: It escapes)
#--------------------------------------------------------------------------
def update_phase2_escape
# The enemy it is fast, calculating mean value
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
# The actor it is fast, calculating mean value
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
# Flight success decision
success = rand(100) < 50 * actors_agi / enemies_agi
# In case of flight success
if success
# Performing flight SE
$game_system.se_play($data_system.escape_se)
# You reset to BGM before the battle starting
$game_system.bgm_play($game_temp.map_bgm)
# Battle end
battle_end(1)
# In case of failure of flight
else
@help_window.set_text("Cannot escape", 1)
@help_wait = @help_time
# Clearing the action of party everyone
$game_party.clear_actions
# Main phase start
start_phase4
end
end
#--------------------------------------------------------------------------
# * After battle phase start
#--------------------------------------------------------------------------
def start_phase5
# It moves to phase 5
@phase = 5
# Performing battle end ME
$game_system.me_play($game_system.battle_end_me)
# You reset to BGM before the battle starting
$game_system.bgm_play($game_temp.map_bgm)
# Initializing EXP, the gold and the treasure
exp = 0
gold = 0
treasures = []
if @active_actor != nil
@active_actor.blink = false
end
# Setting the main phase flag
$game_temp.battle_main_phase = true
# Nullifying the party command window
@party_command_window.active = false
@party_command_window.visible = false
# Nullifying the actor command window
@actor_command_window.active = false
@actor_command_window.visible = false
if @skill_window != nil
# Releasing the skill window
@skill_window.dispose
@skill_window = nil
end
if @item_window != nil
# Releasing the item window
@item_window.dispose
@item_window = nil
end
# The help window is hidden
@help_window.visible = false if @help_wait == 0
# Loop
for enemy in $game_troop.enemies
# When the enemy hides and it is not state,
unless enemy.hidden
# Adding acquisition EXP and the gold
exp += enemy.exp
gold += enemy.gold
# Treasure appearance decision
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
# It limits the number of treasures up to 6
treasures = treasures[0..5]
# EXP acquisition
for i in 0...$game_party.actors.size
actor = $game_party.actors
if actor.cant_get_exp? == false
last_level = actor.level
actor.exp += exp
if actor.level > last_level
@status_window.level_up(i)
actor.damage[[actor, -1]] = "Level up!"
actor.up_level = actor.level - last_level
end
end
end
# Gold acquisition
$game_party.gain_gold(gold)
# Treasure acquisition
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::Armor
$game_party.gain_armor(item.id, 1)
end
end
# Drawing up the battle result window
@result_window = Window_BattleResult.new(exp, gold, treasures)
# Setting wait count
@phase5_wait_count = 100
end
#--------------------------------------------------------------------------
# * Frame renewal (after battle phase)
#--------------------------------------------------------------------------
def update_phase5
# When wait count is larger than 0,
if @phase5_wait_count > 0
# Wait count is decreased
@phase5_wait_count -= 1
# When wait count becomes 0,
if @phase5_wait_count == 0
# Indicating the result window
@result_window.visible = true
# Clearing the main phase flag
$game_temp.battle_main_phase = false
# Refreshing the status window
@status_window.refresh
for actor in $game_party.actors
if actor.damage.include?([actor, 0])
@phase5_wait_count = 20
actor.damage_pop[[actor, 0]] = true
end
if actor.damage.include?([actor, -1])
@phase5_wait_count = 20
actor.damage_pop[[actor, -1]] = true
for level in actor.level - actor.up_level + 1..actor.level
for skill in $data_classes[actor.class_id].learnings
if level == skill.level and not actor.skill_learn?(skill.id)
actor.damage[[actor, 0]] = "New Skill!"
break
end
end
end
end
end
end
return
end
# When C button is pushed,
if Input.trigger?(Input::C)
# Battle end
battle_end(0)
end
end

#==============================================================================
# ** Scene_Battle (Part 3)
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================

#--------------------------------------------------------------------------
# * Actor command phase start
#--------------------------------------------------------------------------
def start_phase3
if victory?
return
end
# Clearing the main phase flag
$game_temp.battle_main_phase = false
@command_a = true
@active_actor = @command[0]
cnt = 0
for actor in $game_party.actors
if actor == @active_actor
@actor_index = cnt
end
cnt += 1
end
@active_actor.blink = true
unless @active_actor.inputable?
@active_actor.current_action.clear
phase3_next_actor
return
end
phase3_setup_command_window
# Setting of camera
@camera = "command"
plus = ($game_party.actors.size - 1) / 2.0 - @actor_index
y = [(plus.abs - 1.5) * 10 , 0].min
@spriteset.screen_target(plus * 50, y, 1.0 + y * 0.002)
end
#--------------------------------------------------------------------------
# * Command input end of actor
#--------------------------------------------------------------------------
def phase3_next_actor
@command.shift
@command_a = false
# Setting the main phase flag
$game_temp.battle_main_phase = true
# Nullifying the actor command window
@actor_command_window.active = false
@actor_command_window.visible = false
# Blinking effect OFF of actor
if @active_actor != nil
@active_actor.blink = false
end
action_start(@active_actor)
# You reset on the basis of the camera
if @camera == "command"
@spriteset.screen_target(0, 0, 1)
end
return
end
#--------------------------------------------------------------------------
# * Setup of actor command window
#--------------------------------------------------------------------------
def phase3_setup_command_window
# Nullifying the party command window
@party_command_window.active = false
@party_command_window.visible = false
# Enabling the actor command window
@actor_command_window.active = true
@actor_command_window.visible = true
# Setting the position of the actor command window
@actor_command_window.x = @actor_index * 160 +
(4 - $game_party.actors.size) * 80
# Setting the index to 0
@actor_command_window.index = 0
end
#--------------------------------------------------------------------------
# * Enemy action compilation
#--------------------------------------------------------------------------
def enemy_action(number)
enemy = $game_troop.enemies[number]
unless enemy.current_action.forcing
enemy.make_action
end
action_start(enemy)
end
#--------------------------------------------------------------------------
# * Frame renewal (actor command phase)
#--------------------------------------------------------------------------
def update_phase3
if victory? and @command_a
command_delete
@command.push(@active_actor)
return
end
# When the enemy arrow is effective,
if @enemy_arrow != nil
update_phase3_enemy_select
# When the actor arrow is effective,
elsif @actor_arrow != nil
update_phase3_actor_select
# When the skill window is effective,
elsif @skill_window != nil
update_phase3_skill_select
# When the item window is effective
elsif @item_window != nil
update_phase3_item_select
# When the actor command window is effective,
elsif @actor_command_window.active
update_phase3_basic_command
end
end
#--------------------------------------------------------------------------
# * Frame renewal (actor command phase: Basic command)
#--------------------------------------------------------------------------
def update_phase3_basic_command
unless @active_actor.inputable?
@active_actor.current_action.clear
phase3_next_actor
return
end
# The B when button is pushed,
if Input.trigger?(Input::B) and @party == false
# Performing cancellation SE
$game_system.se_play($data_system.cancel_se)
@party = true
end
if @party == true and
((@action > 0 and @action_battlers.empty?) or (@action == 0 and
(@action_battlers.empty? or @action_battlers[0].phase == 1)))
# To party command phase
start_phase2
return
end
# When C button is pushed,
if Input.trigger?(Input::C)
@party = false
# It diverges at cursor position of the actor command window
case @actor_command_window.index
when 0 # Attack
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# Starting the selection of the enemy
start_enemy_select
when 1 # Skill
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# Starting the selection of skill
start_skill_select
when 2 # Defense
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# Setting action
@active_actor.current_action.kind = 0
@active_actor.current_action.basic = 1
# To command input of the following actor
phase3_next_actor
when 3 # Item
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# Starting the selection of the item
start_item_select
end
return
end
# Change Character
if @command.size > 1
# When the R when button is pushed,
if Input.trigger?(Input::R)
$game_system.se_play($data_system.cursor_se)
@party = false
# Blinking effect OFF of actor
if @active_actor != nil
@active_actor.blink = false
end
@command.push(@command[0])
@command.shift
@command_a = false
# Start-up of new command window
start_phase3
end
# When the L when button is pushed,
if Input.trigger?(Input::L)
$game_system.se_play($data_system.cursor_se)
@party = false
# Blinking effect OFF of actor
if @active_actor != nil
@active_actor.blink = false
end
@command.unshift(@command[@command.size - 1])
@command.delete_at(@command.size - 1)
@command_a = false
# Start-up of new command window
start_phase3
end
# When the right button is pushed,
if Input.trigger?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
@party = false
# Blinking effect OFF of actor
if @active_actor != nil
@active_actor.blink = false
end
actor = $game_party.actors[@actor_index]
while actor == @command[0] or (not @command.include?(actor))
@actor_index += 1
@actor_index %= $game_party.actors.size
actor = $game_party.actors[@actor_index]
if actor == @command[0]
break
end
end
while actor != @command[0]
@command.push(@command.shift)
end
@command_a = false
# Start-up of new command window
start_phase3
end
# When the left button is pushed,
if Input.trigger?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
@party = false
# Blinking effect OFF of actor
if @active_actor != nil
@active_actor.blink = false
end
actor = $game_party.actors[@actor_index]
while actor == @command[0] or (not @command.include?(actor))
@actor_index -= 1
@actor_index %= $game_party.actors.size
actor = $game_party.actors[@actor_index]
if actor == @command[0]
break
end
end
while actor != @command[0]
@command.push(@command.shift)
end
@command_a = false
# Start-up of new command window
start_phase3
end
end
end
#--------------------------------------------------------------------------
# * Frame renewal (actor command phase: Skill selection)
#--------------------------------------------------------------------------
def update_phase3_skill_select
# During command selecting when it becomes incapacitation,
unless @active_actor.inputable?
@active_actor.current_action.clear
command_delete
# To command input of the following actor
phase3_next_actor
return
end
# The skill window is put in visible state
@skill_window.visible = true
# Renewing the skill window
@skill_window.update
# The B when button is pushed,
if Input.trigger?(Input::B)
# Performing cancellation SE
$game_system.se_play($data_system.cancel_se)
# End selection of skill
end_skill_select
return
end
# When C button is pushed,
if Input.trigger?(Input::C)
# Acquiring the data which presently is selected in the skill window
@skill = @skill_window.skill
# When you cannot use,
if @skill == nil or not @active_actor.skill_can_use?(@skill.id)
# Performing buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# Setting action
@active_actor.current_action.skill_id = @skill.id
# The skill window is put in invisibility state
@skill_window.visible = false
# When the effective range is the enemy single unit,
if @skill.scope == 1
# Starting the selection of the enemy
start_enemy_select
# When the effective range is the friend single unit,
elsif @skill.scope == 3 or @skill.scope == 5
# Starting the selection of the actor
start_actor_select
# When the effective range is not the single unit,
else
# Setting action
@active_actor.current_action.kind = 1
# End selection of skill
end_skill_select
# To command input of the following actor
phase3_next_actor
end
return
end
end
#--------------------------------------------------------------------------
# * Frame renewal (actor command phase: Item selection)
#--------------------------------------------------------------------------
def update_phase3_item_select
# During command selecting when it becomes incapacitation,
unless @active_actor.inputable?
@active_actor.current_action.clear
command_delete
# To command input of the following actor
phase3_next_actor
return
end
# The item window is put in visible state
@item_window.visible = true
# Renewing the item window
@item_window.update
# The B when button is pushed,
if Input.trigger?(Input::B)
# Performing cancellation SE
$game_system.se_play($data_system.cancel_se)
# End selection of item
end_item_select
return
end
#When C button is pushed,
if Input.trigger?(Input::C)
# Acquiring the data which presently is selected in the item window
@item = @item_window.item
# When you cannot use,
unless $game_party.item_can_use?(@item.id)
# Performing buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# Setting action
@active_actor.current_action.item_id = @item.id
# The item window is put in invisibility state
@item_window.visible = false
# When the effective range is the enemy single unit,
if @item.scope == 1
# Starting the selection of the enemy
start_enemy_select
# When the effective range is the friend single unit,
elsif @item.scope == 3 or @item.scope == 5
# Starting the selection of the actor
start_actor_select
# When the effective range is not the single unit,
else
# Setting action
@active_actor.current_action.kind = 2
# End selection of item
end_item_select
# To command input of the following actor
phase3_next_actor
end
return
end
end
#--------------------------------------------------------------------------
# * Frame renewal (actor command phase: Enemy selection)
#--------------------------------------------------------------------------
def update_phase3_enemy_select
# During command selecting when it becomes incapacitation,
unless @active_actor.inputable?
# You reset on the basis of the camera
if @camera == "select"
@spriteset.screen_target(0, 0, 1)
end
@active_actor.current_action.clear
command_delete
# To command input of the following actor
phase3_next_actor
return
end
# Renewing the enemy arrow
@enemy_arrow.update
# The B when button is pushed,
if Input.trigger?(Input::B)
# Performing cancellation SE
$game_system.se_play($data_system.cancel_se)
# You reset on the basis of the camera
if @camera == "select"
# Setting of camera
@camera = "command"
plus = ($game_party.actors.size - 1) / 2.0 - @actor_index
y = [(plus.abs - 1.5) * 10 , 0].min
@spriteset.screen_target(plus * 50, y, 1.0 + y * 0.002)
end
# End selection of enemy
end_enemy_select
return
end
# When C button is pushed,
if Input.trigger?(Input::C)
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# Performing decision SE
@active_actor.current_action.kind = 0
@active_actor.current_action.basic = 0
@active_actor.current_action.target_index = @enemy_arrow.index
# When it is in the midst of skill window indicating,
if @skill_window != nil
# Resetting action
@active_actor.current_action.kind = 1
# End selection of skill
end_skill_select
end
# When it is in the midst of item window indicating,
if @item_window != nil
# Resetting action
@active_actor.current_action.kind = 2
# End selection of item
end_item_select
end
# End selection of enemy
end_enemy_select
# To command input of the following actor
phase3_next_actor
end
end
#--------------------------------------------------------------------------
# * Frame renewal (actor command phase: Actor selection)
#--------------------------------------------------------------------------
def update_phase3_actor_select
# During command selecting when it becomes incapacitation,
unless @active_actor.inputable?
@active_actor.current_action.clear
command_delete
# To command input of the following actor
phase3_next_actor
return
end
# Renewing the actor arrow
@actor_arrow.update
# The B when button is pushed,
if Input.trigger?(Input::B)
# Performing cancellation SE
$game_system.se_play($data_system.cancel_se)
# End selection of actor
end_actor_select
return
end
# When C button is pushed,
if Input.trigger?(Input::C)
# Performing decision SE
$game_system.se_play($data_system.decision_se)
# Setting action
@active_actor.current_action.kind = 0
@active_actor.current_action.basic = 0
@active_actor.current_action.target_index = @actor_arrow.index
# End selection of actor
end_actor_select
# When it is in the midst of skill window indicating,
if @skill_window != nil
# Resetting action
@active_actor.current_action.kind = 1
# End selection of skill
end_skill_select
end
# When it is in the midst of item window indicating
if @item_window != nil
# Resetting action
@active_actor.current_action.kind = 2
# End selection of item
end_item_select
end
# To command input of the following actor
phase3_next_actor
end
end
#--------------------------------------------------------------------------
# * Start of enemy selection
#--------------------------------------------------------------------------
alias :start_enemy_select_rtab :start_enemy_select
def start_enemy_select
@camera = "select"
for enemy in $game_troop.enemies
if enemy.exist?
zoom = 1 / enemy.zoom
@spriteset.screen_target(enemy.attack_x(zoom) * 0.75,
enemy.attack_y(zoom) * 0.75, zoom)
break
end
end
# Original processing
start_enemy_select_rtab
end
#--------------------------------------------------------------------------
# * Enemy selection end
#--------------------------------------------------------------------------
alias :end_enemy_select_rtab :end_enemy_select
def end_enemy_select
# Original processing
end_enemy_select_rtab
if (@action == 0 and not @action_battlers.empty?) or
(@camera == "select" and (@active_actor.current_action.kind != 0 or
@active_actor.animation1_id != 0))
@spriteset.screen_target(0, 0, 1)
end
end
#--------------------------------------------------------------------------
# * Start of skill selection
#--------------------------------------------------------------------------
def start_skill_select
# Drawing up the skill window
@skill_window = Window_Skill.new(@active_actor)
# Help window association
@skill_window.help_window = @help_window
# Nullifying the actor command window
@actor_command_window.active = false
@actor_command_window.visible = false
end

#==============================================================================
# ** Scene_Battle (Part 4)
#------------------------------------------------------------------------------
#  It is the class which processes the battle picture.
#==============================================================================

#--------------------------------------------------------------------------
# * Main phase start
#--------------------------------------------------------------------------
def start_phase4
$game_temp.battle_main_phase = true
end
#--------------------------------------------------------------------------
# * Frame renewal (main phase)
#--------------------------------------------------------------------------
def update_phase4
# When the battler who is forced action exists
if $game_temp.forcing_battler != nil
battler = $game_temp.forcing_battler
if battler.current_action.forcing == false
if @action_battlers.include?(battler)
if @action > 0 or @action_battlers[0].phase == 1
@action_battlers.delete(battler)
@action_battlers.push(battler)
end
if battler.phase == 1
battler.current_action.forcing = true
force_action(battler)
end
else
battler.current_action.forcing = true
force_action(battler)
action_start(battler)
@action_battlers.delete(battler)
@action_battlers.push(battler)
end
battler.at = @max
battler.atp = 100 * battler.at / @max
end
end
# When action is 1 or more, conduct is caused simultaneously
for battler in @action_battlers.reverse
# When it is in wait,
if battler.wait > 0
# Wait count is decreased
battler.wait -= 1
break if @action == 0
next
end
unless fin? and battler.phase < 3 and
not $game_system.battle_interpreter.running?
action_phase(battler)
end
break if @action == 0
end
# When the battler who is forced action does not exist
if $game_temp.forcing_battler == nil
# Setting up the battle event
setup_battle_event
# When it is in the midst of battle event executing,
if $game_system.battle_interpreter.running?
return
end
end
# The case where victory or defeat is decided processing
if fin?
# When being defeated, designated time wait
if $game_party.all_dead? and @after_wait[0] > 0
@after_wait[0] -= 1
return
end
# At the time of victory, designated time wait
if victory? and @after_wait[1] > 0
@after_wait[1] -= 1
return
end
# When battle ends, at the same time the actor is immediately before the acting, eliminating the conduct of the actor
for battler in @action_battlers.reverse
if battler.phase < 3 and not $game_system.battle_interpreter.running?
@action_battlers.delete(battler)
end
end
# Victory or defeat decision
if @action_battlers.empty? and
not $game_system.battle_interpreter.running?
judge
end
end
end
#--------------------------------------------------------------------------
# * Action renewal (main phase)
#--------------------------------------------------------------------------
def action_phase(battler)
# When action 1 is, verification whether or not the battler while acting
if @action == 1 and battler.phase <= 3
for target in battler.target
speller = synthe?(target)
if speller == nil
# When the target is in the midst of usual acting,
if @action_battlers.include?(target)
if target.phase > 2
return
end
end
else
# When the target is in the midst of cooperation skill moving
for spell in speller
if @action_battlers.include?(spell)
if spell.phase > 2
return
end
end
end
end
end
end
case battler.phase
when 1
update_phase4_step1(battler)
when 2
update_phase4_step2(battler)
when 3
update_phase4_step3(battler)
when 4
update_phase4_step4(battler)
when 5
update_phase4_step5(battler)
when 6
update_phase4_step6(battler)
end
end
#--------------------------------------------------------------------------
# * Frame Update (main phase step 1 : action preparation)
#--------------------------------------------------------------------------
def update_phase4_step1(battler)
# Already, when it is removed from battle
if battler.index == nil
@action_battlers.delete(battler)
anime_wait_return
return
end
speller = synthe?(battler)
if speller == nil
# When it is while the damage receiving
unless battler.damage.empty? or @action > 2
return
end
# Whether or not conduct possibility decision
unless battler.movable?
battler.phase = 6
return
end
else
# When it is while the damage receiving,
for spell in speller
unless spell.damage.empty? or @action > 2
return
end
# Whether or not conduct possibility decision
unless spell.movable?
battler.phase = 6
return
end
end
end
# At the time of skill use, permanent residence time setting
# When forced action and @force 2 being, skill immediately motion
if battler.current_action.kind == 1 and
(not battler.current_action.forcing or @force != 2)
if battler.rtp == 0
# If it is in the midst of skill residing permanently, cancellation
skill_reset(battler)
# Skill permanent residence time setting
recite_time(battler)
# Cooperation skill setting
synthe_spell(battler)
# When skill you reside permanently,
if battler.rtp > 0
# When forced action and @force 1 being, only cooperation skill immediately motion
speller = synthe?(battler)
if battler.current_action.forcing and @force > 0 and speller != nil
for spell in speller
spell.rt = spell.rtp
end
else
battler.blink = true
if battler.current_action.forcing
$game_temp.forcing_battler = nil
battler.current_action.forcing = false
end
@action_battlers.delete(battler)
return
end
end
end
end
# Blinking effect OFF of actor
if battler != nil
battler.blink = false
end
speller = synthe?(battler)
if speller == nil
@spell_p.delete(battler)
@spell_e.delete(battler)
else
for spell in speller
spell.blink = false
@spell_p.delete(spell)
@spell_e.delete(spell)
end
end
# It moves to step 2
battler.phase = 2
end
#--------------------------------------------------------------------------
# * Frame renewal (main phase step 2: Action start)
#--------------------------------------------------------------------------
def update_phase4_step2(battler)
# If it is not forced action
unless battler.current_action.forcing
# When restriction [ the enemy is attacked ] [ friend attacks ] usually usually
if battler.restriction == 2 or battler.restriction == 3
# Setting attack to action
battler.current_action.kind = 0
battler.current_action.basic = 0
end
end
# It diverges with classification of action
case battler.current_action.kind
when 0 # Basis
if fin?
battler.phase = 6
return
end
make_basic_action_result(battler)
when 1 # Skill
if fin? and $data_skills[battler.current_action.skill_id].scope == 1..2
battler.phase = 6
return
end
make_skill_action_result(battler)
when 2 # Item
if fin? and $data_items[battler.current_action.item_id].scope == 1..2
battler.phase = 6
return
end
make_item_action_result(battler)
end
if battler.phase == 2
# It moves to step 3
battler.phase = 3
end
end
#--------------------------------------------------------------------------
# * Basic action result compilation
#--------------------------------------------------------------------------
def make_basic_action_result(battler)
# In case of attack
if battler.current_action.basic == 0
# Setting animation ID
battler.anime1 = battler.animation1_id
battler.anime2 = battler.animation2_id
# When the conduct side battler is the enemy
if battler.is_a?(Game_Enemy)
if battler.restriction == 3
target = $game_troop.random_target_enemy
elsif battler.restriction == 2
target = $game_party.random_target_actor
else
index = battler.current_action.target_index
target = $game_party.smooth_target_actor(index)
end
end
# When the conduct side battler is the actor
if battler.is_a?(Game_Actor)
if battler.restriction == 3
target = $game_party.random_target_actor
elsif battler.restriction == 2
target = $game_troop.random_target_enemy
else
index = battler.current_action.target_index
target = $game_troop.smooth_target_enemy(index)
end
end
# Setting the arrangement of the object side battler
battler.target = [target]
# Applying the effect of normality attack
for target in battler.target
target.attack_effect(battler)
end
return
end
# In case of defense
if battler.current_action.basic == 1
return
end
# When escapes and is
if battler.is_a?(Game_Enemy) and battler.current_action.basic == 2
return
end
# When what is not and is
if battler.current_action.basic == 3
# It moves to step 6
battler.phase = 6
return
end
end
#--------------------------------------------------------------------------
# * Object side battler setting of skill or item
# scope : Effective range of skill or item
#--------------------------------------------------------------------------
def set_target_battlers(scope, battler)
# When the conduct side battler is the enemy,
if battler.is_a?(Game_Enemy)
# It diverges in the effective range
case scope
when 1 # Enemy single unit
index =battler.current_action.target_index
battler.target.push($game_party.smooth_target_actor(index))
when 2 # Whole enemy
for actor in $game_party.actors
if actor.exist?
battler.target.push(actor)
end
end
when 3 # Friend single unit
index = battler.current_action.target_index
battler.target.push($game_troop.smooth_target_enemy(index))
when 4 # Whole friend
for enemy in $game_troop.enemies
if enemy.exist?
battler.target.push(enemy)
end
end
when 5 # Friend single unit (HP 0)
index = battler.current_action.target_index
enemy = $game_troop.enemies[index]
if enemy != nil and enemy.hp0?
battler.target.push(enemy)
end
when 6 # Whole friend (HP 0)
for enemy in $game_troop.enemies
if enemy != nil and enemy.hp0?
battler.target.push(enemy)
end
end
when 7 # User
battler.target.push(battler)
end
end
# When the conduct side battler is the actor,
if battler.is_a?(Game_Actor)
# It diverges in the effective range
case scope
when 1 # Enemy single unit
index = battler.current_action.target_index
battler.target.push($game_troop.smooth_target_enemy(index))
when 2 # Whole enemy
for enemy in $game_troop.enemies
if enemy.exist?
battler.target.push(enemy)
end
end
when 3 # Friend single unit
index = battler.current_action.target_index
battler.target.push($game_party.smooth_target_actor(index))
when 4 # Whole friend
for actor in $game_party.actors
if actor.exist?
battler.target.push(actor)
end
end
when 5 # Friend single unit (HP 0)
index = battler.current_action.target_index
actor = $game_party.actors[index]
if actor != nil and actor.hp0?
battler.target.push(actor)
end
when 6 # Whole friend (HP 0)
for actor in $game_party.actors
if actor != nil and actor.hp0?
battler.target.push(actor)
end
end
when 7 # User
battler.target.push(battler)
end
end
end
#--------------------------------------------------------------------------
# * Skill action result compilation
#--------------------------------------------------------------------------
def make_skill_action_result(battler)
# Acquiring skill
@skill = $data_skills[battler.current_action.skill_id]
# Verification whether or not it is cooperation skill,
speller = synthe?(battler)
# If it is not forced action
unless battler.current_action.forcing
# When with SP and so on is cut off and it becomes not be able to use
if speller == nil
unless battler.skill_can_use?(@skill.id)
# It moves to step 6
battler.phase = 6
return
end
end
end
# SP consumption
temp = false
if speller != nil
for spell in speller
if spell.current_action.spell_id == 0
spell.sp -= @skill.sp_cost
else
spell.sp -= $data_skills[spell.current_action.spell_id].sp_cost
end
# Refreshing the status window
status_refresh(spell)
end
else
battler.sp -= @skill.sp_cost
# Refreshing the status window
status_refresh(battler)
end
# Setting animation ID
battler.anime1 = @skill.animation1_id
battler.anime2 = @skill.animation2_id
# Setting common event ID
battler.event = @skill.common_event_id
# Setting the object side battler
set_target_battlers(@skill.scope, battler)
# Applying the effect of skill
for target in battler.target
if speller != nil
damage = 0
d_result = false
effective = false
state_p = []
state_m = []
for spell in speller
if spell.current_action.spell_id != 0
@skill = $data_skills[spell.current_action.spell_id]
end
effective |= target.skill_effect(spell, @skill)
if target.damage[spell].class != String
d_result = true
damage += target.damage[spell]
elsif effective
effect = target.damage[spell]
end
state_p += target.state_p[spell]
state_m += target.state_m[spell]
target.damage.delete(spell)
target.state_p.delete(spell)
target.state_m.delete(spell)
end
if d_result
target.damage[battler] = damage
elsif effective
target.damage[battler] = effect
else
target.damage[battler] = 0
end
target.state_p[battler] = state_p
target.state_m[battler] = state_m
else
target.skill_effect(battler, @skill)
end
end
end
#--------------------------------------------------------------------------
# * Item action result compilation
#--------------------------------------------------------------------------
def make_item_action_result(battler)
# Acquiring the item
@item = $data_items[battler.current_action.item_id]
# When with the item and so on is cut off and it becomes not be able to use
unless $game_party.item_can_use?(@item.id)
# It moves to step 6
battler.phase = 6
return
end
# In case of consumable
if @item.consumable
# The item which you use is decreased 1
$game_party.lose_item(@item.id, 1)
end
# Setting animation ID
battler.anime1 = @item.animation1_id
battler.anime2 = @item.animation2_id
# Setting common event ID
battler.event = @item.common_event_id
# Deciding the object
index = battler.current_action.target_index
target = $game_party.smooth_target_actor(index)
# Setting the object side battler
set_target_battlers(@item.scope, battler)
# Applying the effect of the item
for target in battler.target
target.item_effect(@item, battler)
end
end
#--------------------------------------------------------------------------
# * Frame renewal (main phase step 3: Conduct side animation)
#--------------------------------------------------------------------------
def update_phase4_step3(battler)
# Renewal of help window. It diverges with classification of action
case battler.current_action.kind
when 0 # Basis
if battler.current_action.basic == 1
@help_window.set_text($data_system.words.guard, 1)
@help_wait = @help_time
end
if battler.current_action.basic == 2
# Escape
@help_window.set_text("Escape", 1)
@help_wait = @help_time
battler.escape
battler.phase = 4
return
end
when 1 # Skill
skill = $data_skills[battler.current_action.skill_id]
@help_window.set_text(skill.name, 1)
@help_wait = @help_time
when 2 # Item
item = $data_items[battler.current_action.item_id]
@help_window.set_text(item.name, 1)
@help_wait = @help_time
end
# When conduct side animation (ID 0 is, the white flash)
if battler.anime1 == 0
battler.white_flash = true
battler.wait = 5
# Camera setting
if battler.target[0].is_a?(Game_Enemy)
camera_set(battler)
end
else
battler.animation.push([battler.anime1, true])
speller = synthe?(battler)
if speller != nil
for spell in speller
if spell != battler
if spell.current_action.spell_id == 0
spell.animation.push([battler.anime1, true])
else
skill = spell.current_action.spell_id
spell.animation.push([$data_skills[skill].animation1_id, true])
spell.current_action.spell_id = 0
end
end
end
end
battler.wait = 2 * $data_animations[battler.anime1].frame_max - 10
end
# It moves to step 4
battler.phase = 4
end
#--------------------------------------------------------------------------
# * Frame renewal (main phase step 4: Object side animation)
#--------------------------------------------------------------------------
def update_phase4_step4(battler)
# Camera setting
if battler.target[0].is_a?(Game_Enemy) and battler.anime1 != 0
camera_set(battler)
end
# Object side animation
for target in battler.target
target.animation.push([battler.anime2,
(target.damage[battler] != "Miss")])
unless battler.anime2 == 0
battler.wait = 2 * $data_animations[battler.anime2].frame_max - 10
end
end
# It moves to step 5
battler.phase = 5
end
#--------------------------------------------------------------------------
# * Frame renewal (main phase step 5: Damage indication)
#--------------------------------------------------------------------------
def update_phase4_step5(battler)
# Damage indication
for target in battler.target
if target.damage[battler] != nil
target.damage_pop[battler] = true
target.damage_effect(battler, battler.current_action.kind)
battler.wait = @damage_wait
# Refreshing the status window
status_refresh(target)
end
end
# It moves to step 6
battler.phase = 6
end
#--------------------------------------------------------------------------
# * Frame renewal (main phase step 6: Refreshment)
#--------------------------------------------------------------------------
def update_phase4_step6(battler)
# The camera is reset
if battler.target[0].is_a?(Game_Enemy) and @camera == battler
@spriteset.screen_target(0, 0, 1)
end
# Skill learning
if battler.target[0].is_a?(Game_Actor) and battler.current_action.kind == 1
for target in battler.target
skill_learning(target, target.class_id,
battler.current_action.skill_id)
end
end
# Clearing the battler of the action forced object
if battler.current_action.forcing == true and
battler.current_action.force_kind == 0 and
battler.current_action.force_basic == 0 and
battler.current_action.force_skill_id == 0
$game_temp.forcing_battler = nil
battler.current_action.forcing = false
end
refresh_phase(battler)
speller = synthe?(battler)
if speller != nil
for spell in speller
if spell != battler
refresh_phase(spell)
end
end
synthe_delete(speller)
end
# When common event ID is valid
if battler.event > 0
# Setting up the event
common_event = $data_common_events[battler.event]
$game_system.battle_interpreter.setup(common_event.list, 0)
end
act = 0
for actor in $game_party.actors + $game_troop.enemies
if actor.movable?
act += 1
end
end
if @turn_cnt >= act and act > 0
@turn_cnt %= act
$game_temp.battle_turn += 1
# Searching the full page of the battle event
for index in 0...$data_troops[@troop_id].pages.size
# Acquiring the event page
page = $data_troops[@troop_id].pages[index]
# When the span of this page [ turn ] is
if page.span == 1
# Clearing the execution being completed flag
$game_temp.battle_event_flags[index] = false
end
end
end
battler.phase = 1
@action_battlers.delete(battler)
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh_phase(battler)
battler.at -= @max
if battler.movable?
battler.atp = 100 * battler.at / @max
end
spell_reset(battler)
# Slip damage
if battler.hp > 0 and battler.slip_damage?
battler.slip_damage_effect
battler.damage_pop["slip"] = true
end
# State natural cancellation
battler.remove_states_auto
# Refreshing the status window
status_refresh(battler, true)
unless battler.movable?
return
end
# Turn several counts
@turn_cnt += 1
end
#--------------------------------------------------------------------------
# * Battler action start
#--------------------------------------------------------------------------
def action_start(battler)
battler.phase = 1
battler.anime1 = 0
battler.anime2 = 0
battler.target = []
battler.event = 0
@action_battlers.unshift(battler)
end
#--------------------------------------------------------------------------
# * Refreshing the status window
#--------------------------------------------------------------------------
def status_refresh(battler, at = false)
if battler.is_a?(Game_Actor)
for i in 0...$game_party.actors.size
if battler == $game_party.actors
number = i + 1
end
end
@status_window.refresh(number)
if at == true
@status_window.at_refresh(number)
end
end
end
#--------------------------------------------------------------------------
# * Animation wait judgement processing
#--------------------------------------------------------------------------
def anime_wait_return
if (@action_battlers.empty? or @anime_wait == false) and
not $game_system.battle_interpreter.running?
# When the enemy arrow is valid
if @enemy_arrow != nil
return [@active - 2, 0].min == 0
# When the actor arrow is valid
elsif @actor_arrow != nil
return [@active - 2, 0].min == 0
# When the skill window is valid
elsif @skill_window != nil
return [@active - 3, 0].min == 0
# When the item window is valid
elsif @item_window != nil
return [@active - 3, 0].min == 0
# When the actor command window is valid
elsif @actor_command_window.active
return [@active - 1, 0].min == 0
else
return true
end
else
return false
end
end
#--------------------------------------------------------------------------
# * Actor command elimination judgement
#--------------------------------------------------------------------------
def command_delete
# When the enemy arrow is valid
if @enemy_arrow != nil
end_enemy_select
# When the actor is valid
elsif @actor_arrow != nil
end_actor_select
end
# When the skill window is valid
if @skill_window != nil
end_skill_select
# When the item window is valid
elsif @item_window != nil
end_item_select
end
# When the actor command window is valid
if @actor_command_window.active
@command.shift
@command_a = false
# Setting the main phase flag
$game_temp.battle_main_phase = true
# Hides the actor command window when it is invalid
@actor_command_window.active = false
@actor_command_window.visible = false
# Blinking effect OFF of actor
if @active_actor != nil
@active_actor.blink = false
end
end
end
#--------------------------------------------------------------------------
# * Forcing action setting
#--------------------------------------------------------------------------
def force_action(battler)
battler.current_action.kind = battler.current_action.force_kind
battler.current_action.basic = battler.current_action.force_basic
battler.current_action.skill_id = battler.current_action.force_skill_id
battler.current_action.force_kind = 0
battler.current_action.force_basic = 0
battler.current_action.force_skill_id = 0
end
#--------------------------------------------------------------------------
# * Camera set
#--------------------------------------------------------------------------
def camera_set(battler)
@camera = battler
if battler.target.size == 1
if battler.current_action.kind == 0
zoom = 1.2 / battler.target[0].zoom
elsif synthe?(battler) == nil
zoom = 1.5 / battler.target[0].zoom
else
zoom = 2.0 / battler.target[0].zoom
end
@spriteset.screen_target(battler.target[0].attack_x(zoom),
battler.target[0].attack_y(zoom), zoom)
else
@spriteset.screen_target(0, 0, 0.75)
end
end
#--------------------------------------------------------------------------
# * Skill permanent residence time compilation
#--------------------------------------------------------------------------
def recite_time(battler)
end
#--------------------------------------------------------------------------
# * Cooperation skill distinction
#--------------------------------------------------------------------------
def synthe_spell(battler)
end
#--------------------------------------------------------------------------
# * Skill learning system
#--------------------------------------------------------------------------
def skill_learning(actor, class_id, skill_id)
end
#--------------------------------------------------------------------------
# * Conduct possible decision
#--------------------------------------------------------------------------
def active?(battler)
speller = synthe?(battler)
if speller != nil
if synthe_delete?(speller)
return false
end
else
unless battler.inputable?
spell_reset(battler)
unless battler.movable?
battler.atp = 0
return false
end
end
if battler.current_action.forcing
spell_reset(battler)
end
end
return true
end
#--------------------------------------------------------------------------
# * During synthesis skill residing permanently?
#--------------------------------------------------------------------------
def synthe?(battler)
for speller in @synthe
if speller.include?(battler)
return speller
end
end
return nil
end
#--------------------------------------------------------------------------
# * Synthesis skill elimination judgement
#--------------------------------------------------------------------------
def synthe_delete?(speller)
for battler in speller
if not battler.inputable? and dead_ok?(battler)
synthe_delete(speller)
return true
end
end
return false
end
#--------------------------------------------------------------------------
# * Synthesis skill elimination
#--------------------------------------------------------------------------
def synthe_delete(speller)
for battler in speller
spell_reset(battler)
if dead_ok?(battler)
@action_battlers.delete(battler)
end
end
@synthe.delete(speller)
end
#--------------------------------------------------------------------------
# * Cooperation the skill permanent residence cancellation which is included
#--------------------------------------------------------------------------
def skill_reset(battler)
speller = synthe?(battler)
if speller != nil
synthe_delete(speller)
else
spell_reset(battler)
end
end
#--------------------------------------------------------------------------
# * Skill permanent residence cancellation
#--------------------------------------------------------------------------
def spell_reset(battler)
battler.rt = 0
battler.rtp = 0
battler.blink = false
battler.spell = false
battler.current_action.spell_id = 0
@spell_p.delete(battler)
@spell_e.delete(battler)
end
#--------------------------------------------------------------------------
# * Battle end decision
#--------------------------------------------------------------------------
def fin?
return (victory? or $game_party.all_dead? or $game_party.actors.size == 0)
end
#--------------------------------------------------------------------------
# * Enemy total destruction decision
#--------------------------------------------------------------------------
def victory?
for battler in $game_troop.enemies
if not battler.hidden and (battler.rest_hp > 0 or
battler.immortal or battler.damage_pop.size > 0)
return false
end
end
return true
end
#--------------------------------------------------------------------------
# * Death permission decision
#--------------------------------------------------------------------------
def dead_ok?(battler)
speller = synthe?(battler)
if speller == nil
if @action_battlers.include?(battler)
if battler.phase > 2
return false
end
end
else
for battler in speller
if @action_battlers.include?(battler)
if battler.phase > 2
return false
end
end
end
end
return true
end
end

#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  It is the class which handles the actor. This class Game_Actors class
# ($game_actors) is used in inside, Game_Party class ($game_party) from is
# referred to.
#==============================================================================

class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Acquisition in battle picture X coordinate
#--------------------------------------------------------------------------
def screen_x
# Calculating X coordinate from line order inside the party, it returns
if self.index != nil
return self.index * 160 + (4 - $game_party.actors.size) * 80 + 80
else
return 0
end
end
end

#==============================================================================
# ** Spriteset_Battle
#------------------------------------------------------------------------------
#  It is the class which collected the sprite of the battle picture. This class
# is used inside Scene_Battle クラ ス.
#==============================================================================

class Spriteset_Battle
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :real_x # X coordinate revision (presently value)
attr_reader :real_y # Y coordinate revision (presently value)
attr_reader :real_zoom # Enlargement ratio (presently value)
#--------------------------------------------------------------------------
# * Object initialization
#--------------------------------------------------------------------------
def initialize
# Drawing up the viewport
@viewport1 = Viewport.new(0, 0, 640, 480)
@viewport2 = Viewport.new(0, 0, 640, 480)
@viewport3 = Viewport.new(0, 0, 640, 480)
@viewport4 = Viewport.new(0, 0, 640, 480)
@viewport2.z = 101
@viewport3.z = 200
@viewport4.z = 5000
@wait = 0
@real_x = 0
@real_y = 0
@real_zoom = 1.0
@target_x = 0
@target_y = 0
@target_zoom = 1.0
@gap_x = 0
@gap_y = 0
@gap_zoom = 0.0
# Make battleback sprite
@battleback_sprite = Sprite.new(@viewport1)
# Drawing up enemy sprite
@enemy_sprites = []
for enemy in $game_troop.enemies.reverse
@enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
end
# Drawing up actor sprite
@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))
# Drawing up the weather
@weather = RPG::Weather.new(@viewport1)
# Drawing up picture sprite
@picture_sprites = []
for i in 51..100
@picture_sprites.push(Sprite_Picture.new(@viewport3,
$game_screen.pictures))
end
# Drawing up timer sprite
@timer_sprite = Sprite_Timer.new
# Frame renewal
update
end
#--------------------------------------------------------------------------
# * Frame renewal
#--------------------------------------------------------------------------
def update
# Contents of actor sprite renewal (in replacement of actor correspondence)
@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]
# When file name of the battle back is different from present ones,
if @battleback_name != $game_temp.battleback_name
make_battleback
end
# Scroll of picture
screen_scroll
# Position revision of monster
for enemy in $game_troop.enemies
enemy.real_x = @real_x
enemy.real_y = @real_y
enemy.real_zoom = @real_zoom
end
# Renewing battler sprite
for sprite in @enemy_sprites + @actor_sprites
sprite.update
end
# Renewing weather graphics
@weather.type = $game_screen.weather_type
@weather.max = $game_screen.weather_max
@weather.update
# Renewing picture sprite
for sprite in @picture_sprites
sprite.update
end
# Renewing timer sprite
@timer_sprite.update
# Setting the color tone and shake position of the picture
@viewport1.tone = $game_screen.tone
@viewport1.ox = $game_screen.shake
# Setting the flash color of the picture
@viewport4.color = $game_screen.flash_color
# Renewing the viewport
@viewport1.update
@viewport2.update
@viewport4.update
end
#--------------------------------------------------------------------------
# * Setting of battle background
#--------------------------------------------------------------------------
def make_battleback
@battleback_name = $game_temp.battleback_name
if @battleback_sprite.bitmap != nil
@battleback_sprite.bitmap.dispose
end
@battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
if @battleback_sprite.bitmap.width == 640 and
@battleback_sprite.bitmap.height == 320
@battleback_sprite.src_rect.set(0, 0, 1280, 640)
@base_zoom = 2.0
@battleback_sprite.zoom_x = @base_zoom
@battleback_sprite.zoom_y = @base_zoom
@real_y = 4
@battleback_sprite.x = 320
@battleback_sprite.y = @real_y
@battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
@battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
elsif @battleback_sprite.bitmap.width == 640 and
@battleback_sprite.bitmap.height == 480
@battleback_sprite.src_rect.set(0, 0, 960, 720)
@base_zoom = 1.5
@battleback_sprite.zoom_x = @base_zoom
@battleback_sprite.zoom_y = @base_zoom
@battleback_sprite.x = 320
@battleback_sprite.y = 0
@battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
@battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
else
@battleback_sprite.src_rect.set(0, 0, @battleback_sprite.bitmap.width,
@battleback_sprite.bitmap.height)
@base_zoom = 1.0
@battleback_sprite.zoom_x = @base_zoom
@battleback_sprite.zoom_y = @base_zoom
@battleback_sprite.x = 320
@battleback_sprite.y = 0
@battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
@battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
end
end
#--------------------------------------------------------------------------
# * Position enlargement ratio setting of scroll goal of picture
#--------------------------------------------------------------------------
def screen_target(x, y, zoom)
return unless $scene.drive
@wait = $scene.scroll_time
@target_x = x
@target_y = y
@target_zoom = zoom
screen_over
@gap_x = @target_x - @real_x
@gap_y = @target_y - @real_y
@gap_zoom = @target_zoom - @real_zoom
end
#--------------------------------------------------------------------------
# * Scroll of picture
#--------------------------------------------------------------------------
def screen_scroll
if @wait > 0
@real_x = @target_x - @gap_x * (@wait ** 2) / ($scene.scroll_time ** 2)
@real_y = @target_y - @gap_y * (@wait ** 2) / ($scene.scroll_time ** 2)
@real_zoom = @target_zoom -
@gap_zoom * (@wait ** 2) / ($scene.scroll_time ** 2)
@battleback_sprite.x = 320 + @real_x
@battleback_sprite.y = @real_y
@battleback_sprite.zoom_x = @base_zoom * @real_zoom
@battleback_sprite.zoom_y = @base_zoom * @real_zoom
@battleback_sprite.ox = @battleback_sprite.bitmap.width / 2
@battleback_sprite.oy = @battleback_sprite.bitmap.height / 4
@wait -= 1
end
end
#--------------------------------------------------------------------------
# * When the screen goes outside the picture, revision processing
#--------------------------------------------------------------------------
def screen_over
width = @battleback_sprite.bitmap.width * @base_zoom * @target_zoom / 2
unless 324 + @target_x > width and 324 - @target_x > width
if 324 + @target_x > width
@target_x = width - 324
elsif 324 - @target_x > width
@target_x = 324 - width
end
end
height = @battleback_sprite.bitmap.height * @base_zoom * @target_zoom / 4
unless @target_y > height - 4 and 484 - @target_y > 3 * height
if @target_y > height - 4
@target_y = height - 4
elsif 484 - @target_y > 3 * height
@target_y = 484 - 3 * height
end
end
end
end

#==============================================================================
# ** Game_Battler (Part 1)
#------------------------------------------------------------------------------
#  It is the class which handles the battler. This class is used as superclass
# of Game_Actor class and Game_Enemy クラ ス.
#==============================================================================

class Game_Battler
#--------------------------------------------------------------------------
# * Release instance variable addition
#--------------------------------------------------------------------------
attr_accessor :up_level # The frequency of levelling up
attr_accessor :at # AT (time gauge)
attr_accessor :atp # AT (for indication)
attr_accessor :rt # RP (permanent residence gauge)
attr_accessor :rtp # RP (permanent residence necessary quantity)
attr_accessor :spell # In the midst of synthesis skill motion
attr_accessor :recover_hp # HP recovery quantity
attr_accessor :recover_sp # SP recovery quantity
attr_accessor :state_p # Status abnormal arrangement
attr_accessor :state_m # Status abnormal arrangement
attr_accessor :damage_sp # SP damage indicatory flag
attr_accessor :animation # Arrangement of animation ID and Hit
attr_accessor :phase
attr_accessor :wait
attr_accessor :target
attr_accessor :anime1
attr_accessor :anime2
attr_accessor :event
#--------------------------------------------------------------------------
# * Object initialization
#--------------------------------------------------------------------------
alias :initialize_rtab :initialize
def initialize
initialize_rtab
@damage_pop = {}
@damage = {}
@damage_sp = {}
@critical = {}
@recover_hp = {}
@recover_sp = {}
@state_p = {}
@state_m = {}
@animation = []
@phase = 1
@wait = 0
@target = []
@anime1 = 0
@anime2 = 0
@event = 0
end
#--------------------------------------------------------------------------
# * Existence decision
#--------------------------------------------------------------------------
def exist?
return (not @hidden and (@hp > 0 or @immortal or @damage.size > 0))
end
#--------------------------------------------------------------------------
# * Remaining HP estimate
#--------------------------------------------------------------------------
def rest_hp
# Substituting reality HP to rest_hp
rest_hp = @hp
# All damage which the battler receives is made to reflect on rest_hp
for pre_damage in @damage
if pre_damage[1].is_a?(Numeric)
rest_hp -= pre_damage[1]
end
end
return rest_hp
end
#--------------------------------------------------------------------------
# * Cancellation of state
# state_id : State ID
# force : Forced cancellation flag (with processing of automatic state use)
#--------------------------------------------------------------------------
def remove_state(state_id, force = false)
# When this state is added,
if state?(state_id)
# When with the state which it is forced is added, at the same time cancellation is not forcing
if @states_turn[state_id] == -1 and not force
# Method end
return
end
# When present HP 0 and option [ the state of HP 0 you regard ] it is valid
if @hp == 0 and $data_states[state_id].zero_hp
# Whether or not [ you regard the state of HP 0 ] there is a state in other things, decision
zero_hp = false
for i in @states
if i != state_id and $data_states.zero_hp
zero_hp = true
end
end
# If you are possible to cancel aggressive failure, HP in 1 modification
if zero_hp == false
@hp = 1
end
end
unless self.movable?
# Deleting state ID from @states arrangement and @states_turn hash
@states.delete(state_id)
@states_turn.delete(state_id)
if self.movable?
self.at = 0
end
else
# Deleting state ID from @states arrangement and @states_turn hash
@states.delete(state_id)
@states_turn.delete(state_id)
end
end
# The maximum check of HP and SP
@hp = [@hp, self.maxhp].min
@sp = [@sp, self.maxsp].min
end
#--------------------------------------------------------------------------
# * Effective application of normality attack
# attacker : Attack person (battler)
#--------------------------------------------------------------------------
def attack_effect(attacker)
# Clearing the critical flag
self.critical[attacker] = false
state_p[attacker] = []
state_m[attacker] = []
# First on-target hit decision
hit_result = (rand(100) < attacker.hit)
# In case of on-target hit
hit_result = true
if hit_result == true
# Calculating the basic damage
atk = [attacker.atk - self.pdef / 2, 0].max
self.damage[attacker] = atk * (20 + attacker.str) / 20
# Attribute correction
self.damage[attacker] *= elements_correct(attacker.element_set)
self.damage[attacker] /= 100
# When the mark of the damage is correct,
if self.damage[attacker] > 0
# Critical correction
if rand(100) < 4 * attacker.dex / self.agi
self.damage[attacker] *= 2
self.critical[attacker] = true
end
# Defense correction
if self.guarding?
self.damage[attacker] /= 2
end
end
# Dispersion
if self.damage[attacker].abs > 0
amp = [self.damage[attacker].abs * 15 / 100, 1].max
self.damage[attacker] += rand(amp+1) + rand(amp+1) - amp
end
# Second on-target hit decision
eva = 8 * self.agi / attacker.dex + self.eva
hit = self.damage[attacker] < 0 ? 100 : 100 - eva
hit = self.cant_evade? ? 100 : hit
hit_result = (rand(100) < hit)
end
# In case of on-target hit
if hit_result == true
# State shocking cancellation
remove_states_shock
# From HP damage subtraction
# State change
@state_changed = false
states_plus(attacker, attacker.plus_state_set)
states_minus(attacker, attacker.minus_state_set)
# In case of miss
else
# Setting "Miss" to the damage
self.damage[attacker] = "Miss"
# Clearing the critical flag
self.critical[attacker] = false
end
# Method end
return true
end
#--------------------------------------------------------------------------
# * Effective application of skill
# user : User of skill (battler)
# skill : Skill
#--------------------------------------------------------------------------
def skill_effect(user, skill)
# Clearing the critical flag
self.critical[user] = false
state_p[user] = []
state_m[user] = []
# Effective range of skill with friend of HP 1 or more, your own HP 0,
# Or when the effective range of skill with the friend of HP 0, your own HP are 1 or more
if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
# Method end
return false
end
# Clearing the effective flag
effective = false
# When common event ID is valid setting the effective flag
effective |= skill.common_event_id > 0
# First on-target hit decision
hit = skill.hit
if skill.atk_f > 0
hit *= user.hit / 100
end
hit_result = (rand(100) < hit)
# In case of uncertain skill setting the effective flag
effective |= hit < 100
# In case of on-target hit
if hit_result == true
# Calculating power
power = skill.power + user.atk * skill.atk_f / 100
if power > 0
power -= self.pdef * skill.pdef_f / 200
power -= self.mdef * skill.mdef_f / 200
power = [power, 0].max
end
# Calculating magnification ratio
rate = 20
rate += (user.str * skill.str_f / 100)
rate += (user.dex * skill.dex_f / 100)
rate += (user.agi * skill.agi_f / 100)
rate += (user.int * skill.int_f / 100)
# Calculating the basic damage
self.damage[user] = power * rate / 20
# Attribute correction
self.damage[user] *= elements_correct(skill.element_set)
self.damage[user] /= 100
# When the mark of the damage is correct
if self.damage[user] > 0
# Defense correction
if self.guarding?
self.damage[user] /= 2
end
end
# Dispersion
if skill.variance > 0 and self.damage[user].abs > 0
amp = [self.damage[user].abs * skill.variance / 100, 1].max
self.damage[user] += rand(amp+1) + rand(amp+1) - amp
end
# Second on-target hit decision
eva = 8 * self.agi / user.dex + self.eva
hit = self.damage[user] < 0 ? 100 : 100 - eva * skill.eva_f / 100
hit = self.cant_evade? ? 100 : hit
hit_result = (rand(100) < hit)
# In case of uncertain skill setting the effective flag
effective |= hit < 100
end
# In case of on-target hit
if hit_result == true
# In case of physical attack other than power 0
if skill.power != 0 and skill.atk_f > 0
# State shocking cancellation
remove_states_shock
# Setting the effective flag
effective = true
end
# The fluctuation decision of HP
last_hp = [[self.hp - self.damage[user], self.maxhp].min, 0].max # Effective decision
effective |= self.hp != last_hp
# State change
@state_changed = false
effective |= states_plus(user, skill.plus_state_set)
effective |= states_minus(user, skill.minus_state_set)
unless $game_temp.in_battle
self.damage_effect(user, 1)
end
# When power 0 is,
if skill.power == 0
# Setting the null line to the damage
self.damage[user] = ""
# When there is no change in the state,
unless @state_changed
# Setting "Miss" to the damage
self.damage[user] = "Miss"
end
end
# In case of miss
else
# Setting "Miss" to the damage
self.damage[user] = "Miss"
end
# When it is not in the midst of fighting,
unless $game_temp.in_battle
# Setting nil to the damage
self.damage[user] = nil
end
# Method end
return effective
end
#--------------------------------------------------------------------------
# * Effective application of item
# item : Item
#--------------------------------------------------------------------------
def item_effect(item, user = $game_party.actors[0])
# Clearing the critical flag
self.critical[user] = false
state_p[user] = []
state_m[user] = []
self.recover_hp[user] = 0
self.recover_sp[user] = 0
# Effective range of item with friend of HP 1 or more, your own HP 0,
# Or when the effective range of the item with the friend of HP 0, your own HP are 1 or more,
if ((item.scope == 3 or item.scope == 4) and self.hp == 0) or
((item.scope == 5 or item.scope == 6) and self.hp >= 1)
# Method end
return false
end
# Clearing the effective flag
effective = false
# When common event ID is valid setting the effective flag
effective |= item.common_event_id > 0
# On-target hit decision
hit_result = (rand(100) < item.hit)
# In case of uncertain skill setting the effective flag
effective |= item.hit < 100
# In case of on-target hit
if hit_result == true
# Calculating the recovery quantity
self.recover_hp[user] = maxhp * item.recover_hp_rate / 100 +
item.recover_hp
self.recover_sp[user] = maxsp * item.recover_sp_rate / 100 +
item.recover_sp
if self.recover_hp[user] < 0
self.recover_hp[user] += self.pdef * item.pdef_f / 20
self.recover_hp[user] += self.mdef * item.mdef_f / 20
self.recover_hp[user] = [self.recover_hp[user], 0].min
end
# Attribute correction
self.recover_hp[user] *= elements_correct(item.element_set)
self.recover_hp[user] /= 100
self.recover_sp[user] *= elements_correct(item.element_set)
self.recover_sp[user] /= 100
# Dispersion
if item.variance > 0 and self.recover_hp[user].abs > 0
amp = [self.recover_hp[user].abs * item.variance / 100, 1].max
self.recover_hp[user] += rand(amp+1) + rand(amp+1) - amp
end
if item.variance > 0 and self.recover_sp[user].abs > 0
amp = [self.recover_sp[user].abs * item.variance / 100, 1].max
self.recover_sp[user] += rand(amp+1) + rand(amp+1) - amp
end
# When the mark of the recovery quantity is negative number
if self.recover_hp[user] < 0
# Defense correction
if self.guarding?
self.recover_hp[user] /= 2
end
end
# The mark of the HP recovery quantity it reverses, sets to the value of the damage
self.damage[user] = -self.recover_hp[user]
# The fluctuation decision of HP and SP
last_hp = [[self.hp + self.recover_hp[user], self.maxhp].min, 0].max
last_sp = [[self.sp + self.recover_sp[user], self.maxsp].min, 0].max
effective |= self.hp != last_hp
effective |= self.sp != last_sp
# State change
@state_changed = false
effective |= states_plus(user, item.plus_state_set)
effective |= states_minus(user, item.minus_state_set)
unless $game_temp.in_battle
self.damage_effect(user, 2)
end
# When parameter rise value is valid
if item.parameter_type > 0 and item.parameter_points != 0
# It diverges with parameter
case item.parameter_type
when 1 # MaxHP
@maxhp_plus += item.parameter_points
when 2 # MaxSP
@maxsp_plus += item.parameter_points
when 3 #Strength
@str_plus += item.parameter_points
when 4 # Dexterity
@dex_plus += item.parameter_points
when 5 # Agility
@agi_plus += item.parameter_points
when 6 # Intelligence
@int_plus += item.parameter_points
end
# Setting the effective flag
effective = true
end
# When HP recovery factor and the recovery quantity 0 is
if item.recover_hp_rate == 0 and item.recover_hp == 0
# Setting the null line to the damage
self.damage[user] = ""
# When SP recovery factor and the recovery quantity 0, parameter rise value is invalid,
if item.recover_sp_rate == 0 and item.recover_sp == 0 and
(item.parameter_type == 0 or item.parameter_points == 0)
# When there is no change in the state,
unless @state_changed
# Setting "Miss" to the damage
self.damage[user] = "Miss"
end
end
end
# In case of miss
else
# Setting "Miss" to the damage
self.damage[user] = "Miss"
end
# When it is not in the midst of fighting,
unless $game_temp.in_battle
# Setting nil to the damage
self.damage[user] = nil
end
# Method end
return effective
end
#--------------------------------------------------------------------------
# * State change (+) application
# plus_state_set : State change (+)
#--------------------------------------------------------------------------
def states_plus(battler, plus_state_set)
# Clearing the effective flag
effective = false
# The loop (the state which is added)
for i in plus_state_set
# When this state is not defended,
unless self.state_guard?(i)
# If this state is not full, setting the effective flag
effective |= self.state_full?(i) == false
# When the state [ it does not resist ] is,
if $data_states.nonresistance
# Setting the state change flag
@state_changed = true
# Adding the state
self.state_p[battler].push(i)
# When this state is not full,
elsif self.state_full?(i) == false
# It converts degree of state validity to probability, compares with random number
if rand(100) < [0,100,80,60,40,20,0][self.state_ranks]
# Setting the state change flag
@state_changed = true
# Adding the state
self.state_p[battler].push(i)
end
end
end
end
# Method end
return effective
end
#--------------------------------------------------------------------------
# * State change (-) application
# minus_state_set : State change (-)
#--------------------------------------------------------------------------
def states_minus(battler, minus_state_set)
# Clearing the effective flag
effective = false
# The loop (the state which is cancelled)
for i in minus_state_set
# If this state is added, setting the effective flag
effective |= self.state?(i)
# Setting the state change flag
@state_changed = true
# Cancelling the state
self.state_m[battler].push(i)
end
# Method end
return effective
end
#--------------------------------------------------------------------------
# * Damage operation
#--------------------------------------------------------------------------
def damage_effect(battler, item)
if item == 2
self.hp += self.recover_hp[battler]
self.sp += self.recover_sp[battler]
if self.recover_sp[battler] != 0
self.damage_sp[battler] = -self.recover_sp[battler]
end
self.recover_hp.delete(battler)
self.recover_sp.delete(battler)
else
if self.damage[battler].class != String
self.hp -= self.damage[battler]
end
end
for i in self.state_p[battler]
add_state(i)
end
for i in self.state_m[battler]
remove_state(i)
end
end
#--------------------------------------------------------------------------
# * Effective application of slip damage
#--------------------------------------------------------------------------
def slip_damage_effect
# Setting the damage
self.damage["slip"] = self.maxhp / 10
# Dispersion
if self.damage["slip"].abs > 0
amp = [self.damage["slip"].abs * 15 / 100, 1].max
self.damage["slip"] += rand(amp+1) + rand(amp+1) - amp
end
# From HP damage subtraction
self.hp -= self.damage["slip"]
# Method end
return true
end
end

#==============================================================================
# ** Game_BattleAction
#------------------------------------------------------------------------------
#  Action (the conduct which is in the midst of fighting) it is the class which
# is handled. This class is used inside Game_Battler クラ ス.
#==============================================================================

class Game_BattleAction
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :spell_id # Skill ID for union magic
attr_accessor :force_kind # Classification (basis/skill/item)
attr_accessor :force_basic # basis (attack/defend/escape)
attr_accessor :force_skill_id # Skill ID
#--------------------------------------------------------------------------
# * Validity decision
#--------------------------------------------------------------------------
def valid?
return (not (@force_kind == 0 and @force_basic == 3))
end
end

#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  It is the class which handles the actor. This class Game_Actors class
# ($game_actors) is used in inside, Game_Party class ($game_party) from is
# referred to.
#==============================================================================

class Game_Actor < Game_Battler
def skill_can_use?(skill_id)
return super
end
end

#==============================================================================
# ** Game_Enemy
#------------------------------------------------------------------------------
#  It is the class which handles the enemy. This class Game_Troop class
# ($game_troop) is used in inside.
#==============================================================================

class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :height # Height of picture
attr_accessor :real_x # X-coordinate revision
attr_accessor :real_y # Y-coordinate revision
attr_accessor :real_zoom # Enlargement ratio
#--------------------------------------------------------------------------
# * Object initialization
# troop_id :Troop ID
# member_index : Index of troop member
#--------------------------------------------------------------------------
def initialize(troop_id, member_index)
super()
@troop_id = troop_id
@member_index = member_index
troop = $data_troops[@troop_id]
@enemy_id = troop.members[@member_index].enemy_id
enemy = $data_enemies[@enemy_id]
@battler_name = enemy.battler_name
@battler_hue = enemy.battler_hue
@hp = maxhp
@sp = maxsp
@real_x = 0
@real_y = 0
@real_zoom = 1.0
@fly = 0
enemy.name.sub(/\\[Ff]\[([0-9]+)\]/) {@fly = $1.to_i}
@hidden = troop.members[@member_index].hidden
@immortal = troop.members[@member_index].immortal
end
alias :true_x :screen_x
alias :true_y :screen_y
#--------------------------------------------------------------------------
# * Acquisition in battle picture X coordinate
#--------------------------------------------------------------------------
def screen_x
return 320 + (true_x - 320) * @real_zoom + @real_x
end
#--------------------------------------------------------------------------
# * Acquisition in battle picture Y coordinate
#--------------------------------------------------------------------------
def screen_y
return true_y * @real_zoom + @real_y
end
#--------------------------------------------------------------------------
# * Acquisition in battle picture Z coordinate
#--------------------------------------------------------------------------
def screen_z
return true_y + @fly
end
#--------------------------------------------------------------------------
# * Acquisition of battle picture enlargement ratio
#--------------------------------------------------------------------------
def zoom
return ($scene.zoom_rate[1] - $scene.zoom_rate[0]) *
(true_y + @fly) / 320 + $scene.zoom_rate[0]
end
#--------------------------------------------------------------------------
# * For attack and acquisition in battle picture X coordinate
#--------------------------------------------------------------------------
def attack_x(z)
return (320 - true_x) * z * 0.75
end
#--------------------------------------------------------------------------
# * For attack and acquisition of battle picture Y-coordinate
#--------------------------------------------------------------------------
def attack_y(z)
return (160 - (true_y + @fly / 4) * z + @height * zoom * z / 2) * 0.75
end
#--------------------------------------------------------------------------
# * Action compilation
#--------------------------------------------------------------------------
def make_action
# Clearing current action
self.current_action.clear
# When it cannot move,
unless self.inputable?
# Method end
return
end
# Presently extracting effective action
available_actions = []
rating_max = 0
for action in self.actions
# Turn conditional verification
n = $game_temp.battle_turn
a = action.condition_turn_a
b = action.condition_turn_b
if (b == 0 and n != a) or
(b > 0 and (n < 1 or n < a or n % b != a % b))
next
end
# HP conditional verification
if self.hp * 100.0 / self.maxhp > action.condition_hp
next
end
# Level conditional verification
if $game_party.max_level < action.condition_level
next
end
# Switch conditional verification
switch_id = action.condition_switch_id
if switch_id > 0 and $game_switches[switch_id] == false
next
end
# Skill active conditional verification
if action.kind == 1
unless self.skill_can_use?(action.skill_id)
next
end
end
# It corresponds to condition : Adding this action
available_actions.push(action)
if action.rating > rating_max
rating_max = action.rating
end
end
# Maximum rating value as 3 total calculation (as for 0 or less exclusion)
ratings_total = 0
for action in available_actions
if action.rating > rating_max - 3
ratings_total += action.rating - (rating_max - 3)
end
end
# When total of rating 0 is not,
if ratings_total > 0
# Drawing up random number
value = rand(ratings_total)
# Setting those which correspond to the random number which it drew up to current action
for action in available_actions
if action.rating > rating_max - 3
if value < action.rating - (rating_max - 3)
self.current_action.kind = action.kind
self.current_action.basic = action.basic
self.current_action.skill_id = action.skill_id
self.current_action.decide_random_target_for_enemy
return
else
value -= action.rating - (rating_max - 3)
end
end
end
end
end
end

#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
#  It is the class which handles the party. Information of the gold and the
# item etc. is included. Instance of this ク lath is referred to being
# $game_party.
#==============================================================================

class Game_Party
#--------------------------------------------------------------------------
# * Total destruction decision
#--------------------------------------------------------------------------
def all_dead?
# When party number of people 0 is
if $game_party.actors.size == 0
return false
end
# When the actor of HP 0 or more is in the party,
for actor in @actors
if actor.rest_hp > 0
return false
end
end
# Total destruction
return true
end
#--------------------------------------------------------------------------
# * Random of object actor decision
# hp0 : Limits to the actor of HP 0
#--------------------------------------------------------------------------
# Original target decisive routine smooth_target_actor_rtab and name modification
alias :random_target_actor_rtab :random_target_actor
def random_target_actor(hp0 = false)
# Initializing the roulette
roulette = []
# Loop
for actor in @actors
# When it corresponds to condition
if (not hp0 and actor.exist? and actor.rest_hp > 0) or
(hp0 and actor.hp0?)
# Acquiring the [ position ] of class of actor
position = $data_classes[actor.class_id].position
# At the time of avant-garde n = 4、At the time of medium defense n = 3、At the time rear guard n = 2
n = 4 - position
# In roulette actor n time addition
n.times do
roulette.push(actor)
end
end
end
# When size of the roulette 0 is
if roulette.size == 0
return random_target_actor_rtab(hp0)
end
# It turns the roulette, deciding the actor
return roulette[rand(roulette.size)]
end
#--------------------------------------------------------------------------
# * Smooth decision of object actor
# actor_index : actor index
#--------------------------------------------------------------------------
# Original target decisive routine smooth_target_actor_rtab and name modification
alias :smooth_target_actor_rtab :smooth_target_actor
def smooth_target_actor(actor_index)
# Acquiring the actor
actor = @actors[actor_index]
# When the actor exists
if actor != nil and actor.exist? and actor.rest_hp > 0
return actor
end
# Loop
for actor in @actors
# When the actor exists
if actor.exist? and actor.rest_hp > 0
return actor
end
end
# When friend has destroyed, original target decisive routine is executed
return smooth_target_actor_rtab(actor_index)
end
end

#==============================================================================
# ** Game_Troop
#------------------------------------------------------------------------------
#  It is the class which handles the troop. As for instance of this class with
# $game_troop reference the れ it increases.
#==============================================================================

class Game_Troop
#--------------------------------------------------------------------------
# * Random of object enemy decision
# hp0 : It limits to the enemy of HP 0
#--------------------------------------------------------------------------
# Original target decisive routine random_target_enemy_rtab and name modification
alias :random_target_enemy_rtab :random_target_enemy
def random_target_enemy(hp0 = false)
# Initializing the roulette
roulette = []
# Loop
for enemy in @enemies
# When it corresponds to condition,
if (not hp0 and enemy.exist? and enemy.rest_hp > 0) or
(hp0 and enemy.hp0?)
# Adding the enemy to the roulette
roulette.push(enemy)
end
end
# When size of the roulette 0 is,
if roulette.size == 0
return random_target_enemy_rtab(hp0)
end
# It turns the roulette, deciding the enemy
return roulette[rand(roulette.size)]
end
#--------------------------------------------------------------------------
# * Smooth decision of object enemy
# enemy_index : enemy index
#--------------------------------------------------------------------------
# Original target decisive routine smooth_target_enemy_rtab and name modification
alias :smooth_target_enemy_rtab :smooth_target_enemy
def smooth_target_enemy(enemy_index)
# Acquiring the enemy
enemy = @enemies[enemy_index]
# When the enemy exists,
if enemy != nil and enemy.exist? and enemy.rest_hp > 0
return enemy
end
# Loop
for enemy in @enemies
# When the enemy exists,
if enemy.exist? and enemy.rest_hp > 0
return enemy
end
end
# When the enemy has destroyed, it searches the enemy for the second time
return smooth_target_enemy_rtab(enemy_index)
end
end

#==============================================================================
# ** Sprite_Battler
#------------------------------------------------------------------------------
#  It is sprite for battler indication. Instance of Game_Battler class is watched,
# state of sprite changes automatically.
#==============================================================================

class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
# * Frame Renewal
#--------------------------------------------------------------------------
def update
super
# When the battler is nil
if @battler == nil
self.bitmap = nil
loop_animation(nil)
return
end
# When file name or hue differs from present ones
if @battler.battler_name != @battler_name or
@battler.battler_hue != @battler_hue
# To acquire bitmap, setting
@battler_name = @battler.battler_name
@battler_hue = @battler.battler_hue
self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
@width = bitmap.width
@height = bitmap.height
self.ox = @width / 2
self.oy = @height
if @battler.is_a?(Game_Enemy)
@battler.height = @height
end
# Aggressive failure or it hides and if state it designates opacity as 0
if @battler.dead? or @battler.hidden
self.opacity = 0
end
end
# When animation ID differs from present ones
if @battler.state_animation_id != @state_animation_id
@state_animation_id = @battler.state_animation_id
loop_animation($data_animations[@state_animation_id])
end
# In case of the actor whom it should indicate
if @battler.is_a?(Game_Actor) and @battler_visible
# When being main phase, opacity is lowered a little
if $game_temp.battle_main_phase
self.opacity += 3 if self.opacity < 255
else
self.opacity -= 3 if self.opacity > 207
end
end
# Blinking
if @battler.blink
blink_on
else
blink_off
end
# In case of invisibility
unless @battler_visible
# Appearance
if not @battler.hidden and not @battler.dead? and
(@battler.damage.size < 2 or @battler.damage_pop.size < 2)
appear
@battler_visible = true
end
end
# Damage
for battler in @battler.damage_pop
if battler[0].class == Array
if battler[0][1] >= 0
$scene.skill_se
else
$scene.levelup_se
end
damage(@battler.damage[battler[0]], false, 2)
else
damage(@battler.damage[battler[0]], @battler.critical[battler[0]])
end
if @battler.damage_sp.include?(battler[0])
damage(@battler.damage_sp[battler[0]],
@battler.critical[battler[0]], 1)
@battler.damage_sp.delete(battler[0])
end
@battler.damage_pop.delete(battler[0])
@battler.damage.delete(battler[0])
@battler.critical.delete(battler[0])
end
# When it is visible
if @battler_visible
# Flight
if @battler.hidden
$game_system.se_play($data_system.escape_se)
escape
@battler_visible = false
end
# White Flash
if @battler.white_flash
whiten
@battler.white_flash = false
end
# Animation
unless @battler.animation.empty?
for animation in @battler.animation.reverse
animation($data_animations[animation[0]], animation[1])
@battler.animation.delete(animation)
end
end
# Collapse
if @battler.damage.empty? and @battler.dead?
if $scene.dead_ok?(@battler)
if @battler.is_a?(Game_Enemy)
$game_system.se_play($data_system.enemy_collapse_se)
else
$game_system.se_play($data_system.actor_collapse_se)
end
collapse
@battler_visible = false
end
end
end
# Setting the coordinate of sprite
self.x = @battler.screen_x
self.y = @battler.screen_y
self.z = @battler.screen_z
if @battler.is_a?(Game_Enemy)
self.zoom_x = @battler.real_zoom * @battler.zoom
self.zoom_y = @battler.real_zoom * @battler.zoom
end
end
end

#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
#  It is superclass of all windows in the game.
#==============================================================================

class Window_Base < Window
#--------------------------------------------------------------------------
# * Drawing of gauge
#--------------------------------------------------------------------------
def gauge_rect_at(width, height, align3,
color1, color2, color3, color4, color5, color6, color7,
color8, color9, color10, color11, color12, grade1, grade2)
# Framework drawing
@at_gauge = Bitmap.new(width, height * 5)
@at_gauge.fill_rect(0, 0, width, height, color1)
@at_gauge.fill_rect(1, 1, width - 2, height - 2, color2)
if (align3 == 1 and grade1 == 0) or grade1 > 0
color = color3
color3 = color4
color4 = color
end
if (align3 == 1 and grade2 == 0) or grade2 > 0
color = color5
color5 = color6
color6 = color
color = color7
color7 = color8
color8 = color
color = color9
color9 = color10
color10 = color
color = color11
color11 = color12
color12 = color
end
if align3 == 0
if grade1 == 2
grade1 = 3
end
if grade2 == 2
grade2 = 3
end
end
# Drawing vertically of empty gauge gradation indication
@at_gauge.gradation_rect(2, 2, width - 4, height - 4,
color3, color4, grade1)
# Drawing of actual gauge
@at_gauge.gradation_rect(2, height + 2, width- 4, height - 4,
color5, color6, grade2)
@at_gauge.gradation_rect(2, height * 2 + 2, width- 4, height - 4,
color7, color8, grade2)
@at_gauge.gradation_rect(2, height * 3 + 2, width- 4, height - 4,
color9, color10, grade2)
@at_gauge.gradation_rect(2, height * 4 + 2, width- 4, height - 4,
color11, color12, grade2)
end
end

#==============================================================================
# ** Window_Help
#------------------------------------------------------------------------------
#  It is the window which indicates the item description the skill and the
# status etc. of the actor.
#==============================================================================

class Window_Help < Window_Base
#--------------------------------------------------------------------------
# * Enemy Setting
# enemy : The enemy which indicates name and the state
#--------------------------------------------------------------------------
def set_enemy(enemy)
text = enemy.name.sub(/\\[Ff]\[([0-9]+)\]/) {""}
state_text = make_battler_state_text(enemy, 112, false)
if state_text != ""
text += " " + state_text
end
set_text(text, 1)
end
end

#==============================================================================
# ** Window_BattleStatus
#------------------------------------------------------------------------------
#  It is the window which indicates the status of the party member in the
# battle picture.
#==============================================================================

class Window_BattleStatus < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
x = (4 - $game_party.actors.size) * 80
width = $game_party.actors.size * 160
super(x, 320, width, 160)
self.back_opacity = 160
@actor_window = []
for i in 0...$game_party.actors.size
@actor_window.push(Window_ActorStatus.new(i, x + i * 160))
end
@level_up_flags = [false, false, false, false]
refresh
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
for window in @actor_window
window.dispose
end
super
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(number = 0) if number == 0
cnt = 0
for window in @actor_window
window.refresh(@level_up_flags[cnt])
cnt += 1
end
else
@actor_window[number - 1].refresh(@level_up_flags[number - 1])
end
end
#--------------------------------------------------------------------------
# * AT gauge refreshment
#--------------------------------------------------------------------------
def at_refresh(number = 0)
if number == 0
for window in @actor_window
window.at_refresh
end
else
@actor_window[number - 1].at_refresh
end
end
#--------------------------------------------------------------------------
# * Frame Renewal
#--------------------------------------------------------------------------
def update
super
if self.x != (4 - $game_party.actors.size) * 80
self.x = (4 - $game_party.actors.size) * 80
self.width = $game_party.actors.size * 160
for window in @actor_window
window.dispose
end
@actor_window = []
for i in 0...$game_party.actors.size
@actor_window.push(Window_ActorStatus.new(i, x + i * 160))
end
refresh
end
for window in @actor_window
window.update
end
end
end

#==============================================================================
# ** Window_ActorStatus
#------------------------------------------------------------------------------
#  It is the window which indicates the status of the party member respectively
# in the battle picture.
#==============================================================================

class Window_ActorStatus < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(id, x)
@actor_num = id
super(x, 320, 160, 160)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
self.back_opacity = 0
actor = $game_party.actors[@actor_num]
@actor_nm = actor.name
@actor_mhp = actor.maxhp
@actor_msp = actor.maxsp
@actor_hp = actor.hp
@actor_sp = actor.sp
@actor_st = make_battler_state_text(actor, 120, true)
@status_window = []
for i in 0...5
@status_window.push(Window_DetailsStatus.new(actor, i, x))
end
refresh(false)
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
for i in 0...5
@status_window.dispose
end
super
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(level_up_flags)
self.contents.clear
actor = $game_party.actors[@actor_num]
@status_window[0].refresh(actor) if @actor_nm != actor.name
@status_window[1].refresh(actor) if
@actor_mhp != actor.maxhp or @actor_hp != actor.hp
@status_window[2].refresh(actor) if
@actor_msp != actor.maxsp or @actor_sp != actor.sp
@status_window[3].refresh(actor, level_up_flags) if
@actor_st != make_battler_state_text(actor, 120, true) or level_up_flags
@actor_nm = actor.name
@actor_mhp = actor.maxhp
@actor_msp = actor.maxsp
@actor_hp = actor.hp
@actor_sp = actor.sp
@actor_st = make_battler_state_text(actor, 120, true)
end
#--------------------------------------------------------------------------
# * AT gauge refreshment
#--------------------------------------------------------------------------
def at_refresh
@status_window[4].refresh($game_party.actors[@actor_num])
end
#--------------------------------------------------------------------------
# * Frame Renewal
#--------------------------------------------------------------------------
def update
for window in @status_window
window.update
end
end
end

#==============================================================================
# ** Window_DetailsStatus
#------------------------------------------------------------------------------
#  It is the window which indicates the status of the actor in individually in the battle picture.
#==============================================================================

class Window_DetailsStatus < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(actor, id, x)
@status_id = id
super(x, 320 + id * 26, 160, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
self.back_opacity = 0
refresh(actor, false)
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
super
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(actor, level_up_flags = false)
self.contents.clear
case @status_id
when 0
draw_actor_name(actor, 4, 0)
when 1
draw_actor_hp(actor, 4, 0, 120)
when 2
draw_actor_sp(actor, 4, 0, 120)
when 3
if level_up_flags
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 120, 32, "LEVEL UP!")
else
draw_actor_state(actor, 4, 0)
end
when 4
draw_actor_atg(actor, 4, 0, 120)
end
end
#--------------------------------------------------------------------------
# * Frame renewal
#--------------------------------------------------------------------------
def update
#At the time of main phase opacity is lowered a little
if $game_temp.battle_main_phase
self.contents_opacity -= 4 if self.contents_opacity > 191
else
self.contents_opacity += 4 if self.contents_opacity < 255
end
end
end

#==============================================================================
# ** Arrow_Base
#------------------------------------------------------------------------------
#  It is sprite for the arrow cursor indication which is used in the battle picture.
# This class is used as superclass of Arrow_Enemy class and Arrow_Actor class.
#==============================================================================

class Arrow_Base < Sprite
#--------------------------------------------------------------------------
# * Object Initialization
# viewport :viewport
#--------------------------------------------------------------------------
def initialize(viewport)
super(viewport)
self.bitmap = RPG::Cache.windowskin($game_system.windowskin_name)
self.ox = 16
self.oy = 32
self.z = 2500
@blink_count = 0
@index = 0
@help_window = nil
update
end
end

#==============================================================================
# ** Arrow_Enemy
#------------------------------------------------------------------------------
#  It is arrow cursor in order to make the enemy select.
# This class succeeds Arrow_Base.
#==============================================================================

class Arrow_Enemy < Arrow_Base
#--------------------------------------------------------------------------
# * Frame renewal
#--------------------------------------------------------------------------
def update
super
# When it points to the enemy which does not exist, it throws
$game_troop.enemies.size.times do
break if self.enemy.exist?
@index += 1
@index %= $game_troop.enemies.size
end
# The cursor right
if Input.repeat?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
$game_troop.enemies.size.times do
@index += 1
@index %= $game_troop.enemies.size
break if self.enemy.exist?
end
$scene.camera = "select"
zoom = 1 / self.enemy.zoom
$scene.spriteset.screen_target(self.enemy.attack_x(zoom) * 0.75,
self.enemy.attack_y(zoom) * 0.75, zoom)
end
# The cursor left
if Input.repeat?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
$game_troop.enemies.size.times do
@index += $game_troop.enemies.size - 1
@index %= $game_troop.enemies.size
break if self.enemy.exist?
end
$scene.camera = "select"
zoom = 1 / self.enemy.zoom
$scene.spriteset.screen_target(self.enemy.attack_x(zoom) * 0.75,
self.enemy.attack_y(zoom) * 0.75, zoom)
end
# Setting the coordinate of sprite
if self.enemy != nil
self.x = self.enemy.screen_x
self.y = self.enemy.screen_y
end
end
end

#==============================================================================
# ** Interpreter
#------------------------------------------------------------------------------
# It is the interpreter which executes event command. This class is used inside
# the Game_System class and Game_Event class.
#==============================================================================

class Interpreter
#--------------------------------------------------------------------------
# ● アクターの入れ替え
#--------------------------------------------------------------------------
def command_129
# Acquiring the actor
actor = $game_actors[@parameters[0]]
# When the actor is valid
if actor != nil
# It diverges with operation
if @parameters[1] == 0
if @parameters[2] == 1
$game_actors[@parameters[0]].setup(@parameters[0])
end
$game_party.add_actor(@parameters[0])
if $game_temp.in_battle
$game_actors[@parameters[0]].at = 0
$game_actors[@parameters[0]].atp = 0
$scene.spell_reset($game_actors[@parameters[0]])
$game_actors[@parameters[0]].damage_pop = {}
$game_actors[@parameters[0]].damage = {}
$game_actors[@parameters[0]].damage_sp = {}
$game_actors[@parameters[0]].critical = {}
$game_actors[@parameters[0]].recover_hp = {}
$game_actors[@parameters[0]].recover_sp = {}
$game_actors[@parameters[0]].state_p = {}
$game_actors[@parameters[0]].state_m = {}
$game_actors[@parameters[0]].animation = []
end
else
$game_party.remove_actor(@parameters[0])
end
end
if $game_temp.in_battle
$scene.status_window.update
end
# Continuation
return true
end
#--------------------------------------------------------------------------
# * The increase and decrease of HP
#--------------------------------------------------------------------------
alias :command_311_rtab :command_311
def command_311
command_311_rtab
if $game_temp.in_battle
$scene.status_window.refresh
end
end
#--------------------------------------------------------------------------
# *The increase and decrease of SP
#--------------------------------------------------------------------------
alias :command_312_rtab :command_312
def command_312
command_312_rtab
if $game_temp.in_battle
$scene.status_window.refresh
end
end
#--------------------------------------------------------------------------
# * Modification of state
#--------------------------------------------------------------------------
alias :command_313_rtab :command_313
def command_313
command_313_rtab
if $game_temp.in_battle
$scene.status_window.refresh
end
end
#--------------------------------------------------------------------------
# * All recovery
#--------------------------------------------------------------------------
alias :command_314_rtab :command_314
def command_314
command_314_rtab
if $game_temp.in_battle
$scene.status_window.refresh
end
end
#--------------------------------------------------------------------------
# * The increase and decrease of EXP
#--------------------------------------------------------------------------
alias :command_315_rtab :command_315
def command_315
command_315_rtab
if $game_temp.in_battle
$scene.status_window.refresh
end
end
#--------------------------------------------------------------------------
# * Increase and decrease of level
#--------------------------------------------------------------------------
alias :command_316_rtab :command_316
def command_316
command_316_rtab
if $game_temp.in_battle
$scene.status_window.refresh
end
end
#--------------------------------------------------------------------------
# * Increase and decrease of parameter
#--------------------------------------------------------------------------
alias :command_317_rtab :command_317
def command_317
command_317_rtab
if $game_temp.in_battle
$scene.status_window.refresh
end
end
#--------------------------------------------------------------------------
# * Modification of equipment
#--------------------------------------------------------------------------
alias :command_319_rtab :command_319
def command_319
command_319_rtab
if $game_temp.in_battle
$scene.status_window.refresh
end
end
#--------------------------------------------------------------------------
# * Name modification of actor
#--------------------------------------------------------------------------
alias :command_320_rtab :command_320
def command_320
command_320_rtab
if $game_temp.in_battle
$scene.status_window.refresh
end
end
#--------------------------------------------------------------------------
# * Class modification of actor
#--------------------------------------------------------------------------
alias :command_321_rtab :command_321
def command_321
command_321_rtab
if $game_temp.in_battle
$scene.status_window.refresh
end
end
#--------------------------------------------------------------------------
# * Indication of animation
#--------------------------------------------------------------------------
def command_337
# Process iteration
iterate_battler(@parameters[0], @parameters[1]) do |battler|
# When the battler exists
if battler.exist?
# Setting animation ID
battler.animation.push([@parameters[2], true])
end
end
# continuous
return true
end
#--------------------------------------------------------------------------
# * Deal Damage
#--------------------------------------------------------------------------
def command_338
# of the damage the value which is operated acquisition
value = operate_value(0, @parameters[2], @parameters[3])
# Process iteration
iterate_battler(@parameters[0], @parameters[1]) do |battler|
# battler exists with
if battler.exist?
# HP modification
battler.hp -= value
# fighting
if $game_temp.in_battle
# damage setting
battler.damage["event"] = value
battler.damage_pop["event"] = true
end
end
end
if $game_temp.in_battle
$scene.status_window.refresh
end
# continuation
return true
end
#--------------------------------------------------------------------------
# * Forcing the action
#--------------------------------------------------------------------------
def command_339
# If it is not in the midst of fighting, disregard
unless $game_temp.in_battle
return true
end
# If the number of turns 0 disregard
if $game_temp.battle_turn == 0
return true
end
# Processing (With convenient ones, there are no times when it becomes plural)
iterate_battler(@parameters[0], @parameters[1]) do |battler|
# When the battler exists,
if battler.exist?
# Setting action
battler.current_action.force_kind = @parameters[2]
if battler.current_action.force_kind == 0
battler.current_action.force_basic = @parameters[3]
else
battler.current_action.force_skill_id = @parameters[3]
end
# Setting the conduct object
if @parameters[4] == -2
if battler.is_a?(Game_Enemy)
battler.current_action.decide_last_target_for_enemy
else
battler.current_action.decide_last_target_for_actor
end
elsif @parameters[4] == -1
if battler.is_a?(Game_Enemy)
battler.current_action.decide_random_target_for_enemy
else
battler.current_action.decide_random_target_for_actor
end
elsif @parameters[4] >= 0
battler.current_action.target_index = @parameters[4]
end
# When action validity and [ directly execution ] is,
if battler.current_action.valid? and @parameters[5] == 1
# Setting the battler of the forced object
$game_temp.forcing_battler = battler
# The index is advanced
@index += 1
# end
return false
elsif battler.current_action.valid? and @parameters[5] == 0
battler.current_action.forcing = true
end
end
end
# continuation
return true
end
end

#==============================================================================
# * Sprite module
#------------------------------------------------------------------------------
# This module manages and controls animation.
#==============================================================================

module RPG

class Sprite < ::Sprite
def initialize(viewport = nil)
super(viewport)
@_whiten_duration = 0
@_appear_duration = 0
@_escape_duration = 0
@_collapse_duration = 0
@_damage = []
@_animation = []
@_animation_duration = 0
@_blink = false
end
def damage(value, critical, type = 0)
if value.is_a?(Numeric)
damage_string = value.abs.to_s
else
damage_string = value.to_s
end
bitmap = Bitmap.new(160, 48)
bitmap.font.name = "Arial Black"
bitmap.font.size = 32
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
if value.is_a?(Numeric) and value < 0
if type == 0
bitmap.font.color.set(176, 255, 144)
else
bitmap.font.color.set(176, 144, 255)
end
else
if type == 0
bitmap.font.color.set(255, 255, 255)
else
bitmap.font.color.set(255, 176, 144)
end
end
if type == 2
bitmap.font.color.set(255, 224, 128)
end
bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
if critical
string = "CRITICAL"
bitmap.font.size = 20
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(-1, -1, 160, 20, string, 1)
bitmap.draw_text(+1, -1, 160, 20, string, 1)
bitmap.draw_text(-1, +1, 160, 20, string, 1)
bitmap.draw_text(+1, +1, 160, 20, string, 1)
bitmap.font.color.set(255, 255, 255)
bitmap.draw_text(0, 0, 160, 20, string, 1)
end
num = @_damage.size
if type != 2
@_damage.push([::Sprite.new, 40, 0, rand(40) - 20, rand(30) + 50])
else
@_damage.push([::Sprite.new, 40, 0, rand(20) - 10, rand(20) + 60])
end
@_damage[num][0].bitmap = bitmap
@_damage[num][0].ox = 80 + self.viewport.ox
@_damage[num][0].oy = 20 + self.viewport.oy
if self.battler.is_a?(Game_Actor)
@_damage[num][0].x = self.x
@_damage[num][0].y = self.y - self.oy / 2
else
@_damage[num][0].x = self.x + self.viewport.rect.x -
self.ox + self.src_rect.width / 2
@_damage[num][0].y = self.y - self.oy * self.zoom_y / 2 +
self.viewport.rect.y
@_damage[num][0].zoom_x = self.zoom_x
@_damage[num][0].zoom_y = self.zoom_y
@_damage[num][0].z = 3000
end
end
def animation(animation, hit)
return if animation == nil
num = @_animation.size
@_animation.push([animation, hit, animation.frame_max, []])
bitmap = RPG::Cache.animation(animation.animation_name,
animation.animation_hue)
if @@_reference_count.include?(bitmap)
@@_reference_count[bitmap] += 1
else
@@_reference_count[bitmap] = 1
end
if @_animation[num][0].position != 3 or
not @@_animations.include?(animation)
for i in 0..15
sprite = ::Sprite.new
sprite.bitmap = bitmap
sprite.visible = false
@_animation[num][3].push(sprite)
end
unless @@_animations.include?(animation)
@@_animations.push(animation)
end
end
update_animation(@_animation[num])
end
def loop_animation(animation)
return if animation == @_loop_animation
dispose_loop_animation
@_loop_animation = animation
return if @_loop_animation == nil
@_loop_animation_index = 0
animation_name = @_loop_animation.animation_name
animation_hue = @_loop_animation.animation_hue
bitmap = RPG::Cache.animation(animation_name, animation_hue)
if @@_reference_count.include?(bitmap)
@@_reference_count[bitmap] += 1
else
@@_reference_count[bitmap] = 1
end
@_loop_animation_sprites = []
for i in 0..15
sprite = ::Sprite.new
sprite.bitmap = bitmap
sprite.visible = false
@_loop_animation_sprites.push(sprite)
end
# update_loop_animation
end
def dispose_damage
for damage in @_damage.reverse
damage[0].bitmap.dispose
damage[0].dispose
@_damage.delete(damage)
end
end
def dispose_animation
for anime in @_animation.reverse
sprite = anime[3][0]
if sprite != nil
@@_reference_count[sprite.bitmap] -= 1
if @@_reference_count[sprite.bitmap] == 0
sprite.bitmap.dispose
end
end
for sprite in anime[3]
sprite.dispose
end
@_animation.delete(anime)
end
end
def effect?
@_whiten_duration > 0 or
@_appear_duration > 0 or
@_escape_duration > 0 or
@_collapse_duration > 0 or
@_damage.size == 0 or
@_animation.size == 0
end
def update
super
if @_whiten_duration > 0
@_whiten_duration -= 1
self.color.alpha = 128 - (16 - @_whiten_duration) * 10
end
if @_appear_duration > 0
@_appear_duration -= 1
self.opacity = (16 - @_appear_duration) * 16
end
if @_escape_duration > 0
@_escape_duration -= 1
self.opacity = 256 - (32 - @_escape_duration) * 10
end
if @_collapse_duration > 0
@_collapse_duration -= 1
self.opacity = 256 - (48 - @_collapse_duration) * 6
end
for damage in @_damage
if damage[1] > 0
damage[1] -= 1
damage[4] -= 3
damage[2] -= damage[4]
if self.battler.is_a?(Game_Actor)
damage[0].x = self.x + (40 - damage[1]) * damage[3] / 10
damage[0].y = self.y - self.oy / 2 + damage[2] / 10
else
damage[0].x = self.x + self.viewport.rect.x -
self.ox + self.src_rect.width / 2 +
(40 - damage[1]) * damage[3] / 10
damage[0].y = self.y - self.oy * self.zoom_y / 2 +
self.viewport.rect.y + damage[2] / 10
damage[0].zoom_x = self.zoom_x
damage[0].zoom_y = self.zoom_y
end
damage[0].z = 2960 + damage[1]
damage[0].opacity = 256 - (12 - damage[1]) * 32
if damage[1] == 0
damage[0].bitmap.dispose
damage[0].dispose
@_damage.delete(damage)
end
end
end
for anime in @_animation
if (Graphics.frame_count % 2 == 0)
anime[2] -= 1
update_animation(anime)
end
end
if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
update_loop_animation
@_loop_animation_index += 1
@_loop_animation_index %= @_loop_animation.frame_max
end
if @_blink
@_blink_count = (@_blink_count + 1) % 32
if @_blink_count < 16
alpha = (16 - @_blink_count) * 6
else
alpha = (@_blink_count - 16) * 6
end
self.color.set(255, 255, 255, alpha)
end
@@_animations.clear
end
def update_animation(anime)
if anime[2] > 0
frame_index = anime[0].frame_max - anime[2]
cell_data = anime[0].frames[frame_index].cell_data
position = anime[0].position
animation_set_sprites(anime[3], cell_data, position)
for timing in anime[0].timings
if timing.frame == frame_index
animation_process_timing(timing, anime[1])
end
end
else
@@_reference_count[anime[3][0].bitmap] -= 1
if @@_reference_count[anime[3][0].bitmap] == 0
anime[3][0].bitmap.dispose
end
for sprite in anime[3]
sprite.dispose
end
@_animation.delete(anime)
end
end
def animation_set_sprites(sprites, cell_data, position)
for i in 0..15
sprite = sprites
pattern = cell_data[i, 0]
if sprite == nil or pattern == nil or pattern == -1
sprite.visible = false if sprite != nil
next
end
sprite.visible = true
sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
if position == 3
if self.viewport != nil
sprite.x = self.viewport.rect.width / 2
if $game_temp.in_battle and self.battler.is_a?(Game_Enemy)
sprite.y = self.viewport.rect.height - 320
else
sprite.y = self.viewport.rect.height - 160
end
else
sprite.x = 320
sprite.y = 240
end
else
sprite.x = self.x + self.viewport.rect.x -
self.ox + self.src_rect.width / 2
if $game_temp.in_battle and self.battler.is_a?(Game_Enemy)
sprite.y = self.y - self.oy * self.zoom_y / 2 +
self.viewport.rect.y
if position == 0
sprite.y -= self.src_rect.height * self.zoom_y / 4
elsif position == 2
sprite.y += self.src_rect.height * self.zoom_y / 4
end
else
sprite.y = self.y + self.viewport.rect.y -
self.oy + self.src_rect.height / 2
sprite.y -= self.src_rect.height / 4 if position == 0
sprite.y += self.src_rect.height / 4 if position == 2
end
end
sprite.x += cell_data[i, 1]
sprite.y += cell_data[i, 2]
sprite.z = 2000
sprite.ox = 96
sprite.oy = 96
sprite.zoom_x = cell_data[i, 3] / 100.0
sprite.zoom_y = cell_data[i, 3] / 100.0
if position != 3
sprite.zoom_x *= self.zoom_x
sprite.zoom_y *= self.zoom_y
end
sprite.angle = cell_data[i, 4]
sprite.mirror = (cell_data[i, 5] == 1)
sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
sprite.blend_type = cell_data[i, 7]
end
end
def x=(x)
sx = x - self.x
if sx != 0
for anime in @_animation
if anime[3] != nil
for i in 0..15
anime[3].x += sx
end
end
end
if @_loop_animation_sprites != nil
for i in 0..15
@_loop_animation_sprites.x += sx
end
end
end
super
end
def y=(y)
sy = y - self.y
if sy != 0
for anime in @_animation
if anime[3] != nil
for i in 0..15
anime[3].y += sy
end
end
end
if @_loop_animation_sprites != nil
for i in 0..15
@_loop_animation_sprites.y += sy
end
end
end
super
end
end
end

#------------------------------------------------------------------------------
# New routine added to the Bitmap class.
#==============================================================================

class Bitmap
#--------------------------------------------------------------------------
# * Rectangle Gradation Indicator
# color1: Start color
# color2: Ending color
# align: 0: On side gradation
# 1: Vertically gradation
# 2: The gradation (intense concerning slantedly heavily note)
#--------------------------------------------------------------------------
def gradation_rect(x, y, width, height, color1, color2, align = 0)
if align == 0
for i in x...x + width
red = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
green = color1.green +
(color2.green - color1.green) * (i - x) / (width - 1)
blue = color1.blue +
(color2.blue - color1.blue) * (i - x) / (width - 1)
alpha = color1.alpha +
(color2.alpha - color1.alpha) * (i - x) / (width - 1)
color = Color.new(red, green, blue, alpha)
fill_rect(i, y, 1, height, color)
end
elsif align == 1
for i in y...y + height
red = color1.red +
(color2.red - color1.red) * (i - y) / (height - 1)
green = color1.green +
(color2.green - color1.green) * (i - y) / (height - 1)
blue = color1.blue +
(color2.blue - color1.blue) * (i - y) / (height - 1)
alpha = color1.alpha +
(color2.alpha - color1.alpha) * (i - y) / (height - 1)
color = Color.new(red, green, blue, alpha)
fill_rect(x, i, width, 1, color)
end
elsif align == 2
for i in x...x + width
for j in y...y + height
red = color1.red + (color2.red - color1.red) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
green = color1.green + (color2.green - color1.green) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
blue = color1.blue + (color2.blue - color1.blue) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
alpha = color1.alpha + (color2.alpha - color1.alpha) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
color = Color.new(red, green, blue, alpha)
set_pixel(i, j, color)
end
end
elsif align == 3
for i in x...x + width
for j in y...y + height
red = color1.red + (color2.red - color1.red) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
green = color1.green + (color2.green - color1.green) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
blue = color1.blue + (color2.blue - color1.blue) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
alpha = color1.alpha + (color2.alpha - color1.alpha) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
color = Color.new(red, green, blue, alpha)
set_pixel(i, j, color)
end
end
end
end
end
 
I am using it in correspondence with Skill Casting Time Counter Ver 1.00, Remodeled Damage Display, Enemies Use Items, Grouping and Details System, Limit Break System (and the scripts that allow them to work together), and several other minor scripts which have no effect on the battle. Just to get basic troubleshooting out of the way, I did install the same non-translated version from cogwheels sight to see if my script was messed up. It did the same.
 
You should probably try taking out each of those scripts, and put them back in one at a time until you start getting the skill defect again, then take out the script that you put in before it got messed up, until I know which script it
is, i'm useless.

I tried it in a blank project, and it worked fine for me.
 
Here they are in there block order, I hope the spoilers work.


#==============================================================================
# ** 'GROUPING AND DETAILS' and 'Limit Break Menu' Patch
#------------------------------------------------------------------------------
# by DerVVulfman
# version 1.3
# 07-07-2007
# SDK 2.2+ Incompatible. All defs involved are rewritten.
#------------------------------------------------------------------------------
# This patch is used to permit the 'Grouping and Details' system to work along
# side of the 'Limit Break' menu. Unlike other patches, this one needs to be
# posted 'ABOVE' both systems as it contains a GLOBAL value used by the two
# for detection and compatability purposes.
#
# As such, this system replaces and combines a number of functions within both
# of the systems.
#==============================================================================


# Global value for auto-detecting
$gnd_lb_patch = true



#==============================================================================
# ** Window_Skill
#------------------------------------------------------------------------------
# This window displays usable skills on the skill and battle screens.
#==============================================================================

class Window_Skill < Window_Selectable

#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
skillkind = $game_temp.gnd_window
@data = []
if self.contents != nil
self.contents.dispose
self.contents = nil
end
# If not in the Limit Break Menu
unless $game_temp.limit_menu
# If sorting through groups
if @group[skillkind] != 0
for i in 0...@actor.skills.size
skill = $data_skills[@actor.skills]
if skill != nil && skill.element_set.include?(@group[skillkind])
if $game_system.lb_attack_detected
@data.push(skill) unless skill.element_set.include?($lb_element_id)
else
unless $game_temp.in_battle
@data.push(skill) unless skill.element_set.include?($lb_element_id)
else
@data.push(skill)
end
end
end
end
# Else if in the 'All' group category
else
for i in 0...@actor.skills.size
skill = $data_skills[@actor.skills]
if skill != nil
if $game_system.lb_attack_detected
@data.push(skill) unless skill.element_set.include?($lb_element_id)
else
unless $game_temp.in_battle
@data.push(skill) unless skill.element_set.include?($lb_element_id)
else
@data.push(skill)
end
end
end
end
end
# Else in the Limit Break menu
else
for i in 0...@actor.skills.size
skill = $data_skills[@actor.skills]
unless skill == nil
if $game_temp.seperation
if $game_temp.limitbreak_skills
@data.push(skill) if skill.element_set.include?($lb_element_id)
else
@data.push(skill) unless skill.element_set.include?($lb_element_id)
end
else
@data.push(skill)
end
end
end
end
# If item count is not 0, make a bit map and draw all items
@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
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
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::Cache.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)
unless HIDE_ZERO_SP && skill.sp_cost == 0
self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
end
end
end


#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================

class Scene_Battle
#--------------------------------------------------------------------------
# * Start Skill Selection
#--------------------------------------------------------------------------
def start_skill_select
# RTAB detection value built into Limit Break (DVV)
# Assigns 'battler' value for the Skill Window.
if $game_system.lb_rtab_detected
battler = @active_actor
else
battler = @active_battler
end
$game_temp.limit_menu = false
# Make skill window
@skill_window = Window_Skill.new(battler)
if $game_system.lb_attack_detected
$game_temp.seperation = true
$game_temp.limitbreak_skills = false
@skill_window.refresh
else
$game_temp.seperation = false
$game_temp.limitbreak_skills = false
@skill_window.refresh
end
@skill_window.z = 1000
# Associate help window
@skill_window.help_window = @help_window
# Disable actor command window
@actor_command_window.active = false
@actor_command_window.visible = false
if B_S_WINDOW
@skill_group_window = Window_SkillGroup2.new(battler)
@skill_group_window.x = @actor_command_window.x
@skill_group_window.y = @actor_command_window.y
@skill_group_window.height = @actor_command_window.height
@skill_group_window.width = @actor_command_window.width
else
@skill_group_window = Window_SkillGroup.new(battler)
@skill_group_window.y = @help_window2 != nil ? 64 : 0
end
@skill_group_window.back_opacity = 160
@skill_group_select = true
@now_skillkind = nil
if @help_window2 != nil
@skill_group_window.help_window = @help_window2
end
end
#--------------------------------------------------------------------------
# * Start Skill Selection #2
#--------------------------------------------------------------------------
def start_skill_select2
# RTAB detection value built into Limit Break (DVV)
# Assigns 'battler' value for the Skill Window.
if $game_system.lb_rtab_detected
battler = @active_actor
else
battler = @active_battler
end
$game_temp.limit_menu = true
# Create but disable
@skill_group_window = Window_SkillGroup.new(battler)
@skill_group_window.visible = false
@skill_group_window.active = false
@skill_group_select = false
# Set new values for Limit Break seperation
$game_temp.seperation = true
$game_temp.limitbreak_skills = true
# Make skill window
@skill_window = Window_Skill.new(@active_battler)
# Associate help window
@skill_window.help_window = @help_window
# Disable actor command window
@actor_command_window.active = false
@actor_command_window.visible = false
end
end


#==============================================================================
# ** GROUPING AND DETAILS
#------------------------------------------------------------------------------
# by DerVVulfman
# version 6.9
# 07-18-2007
# SDK 2.2+ Compliant (Forced to rewrite four defs, two in Scene_Battle)
#------------------------------------------------------------------------------
# * INTRODUCTION
#------------------------------------------------------------------------------
#
# The original KGC_ItemGrouping script translated by Mr. DJ allows you to sub-
# divide the item menu, allowing you to view items, key items, healing items,
# armors and the like in their own windows. The only tweaking required in this
# script were to edit the elements (Fire, Ice, vs Darkness) in the RpgMaker XP
# Database, and have matching categories in the ItemGrouping script's opening
# section.
#
# The original KGC_SkillGrouping script that has two translated versions (one
# by Mr. DJ and one by Armor Nick) allows you to subdivide the skill menu, so
# as to allow you to view healing magic, attack spells, and the like in their
# own windows. The only tweaking required in this script was to edit the
# elements (Fire, Ice, vs Darkness) in the RMXP Database, and have matching
# categories in the SkillGrouping script's opening section.
#
# The Item Detail script, created by jackatrades (no longer supported), allows
# you to press the "Shift" key on a highlighted item in the Item Menu and it
# accesses a text file (named Item_Detail.rxdata) to retrieve data about the
# item for a more detailed description.
#
# Additional text files (Armor_Detail.rxdata 'n Weapon_Detail.rxdata) provided
# additional data as required.
#
# The Skill Detail script, reworked by Meâ„¢, allowed you to press the "Shift"
# key on a highlighted skill in the Skill Menu and it accesses a text file
# (named Skill_Detail.rxdata) to retrieve data about the skill for a more de-
# tailed description.
#
# The original scripts required use of various overlapping scripts...you could
# not just paste these scripts into your project and expect all of them to
# work. But... that's where I came in and reworked them.
#
#
#------------------------------------------------------------------------------
# * FEATURES
#------------------------------------------------------------------------------
#
# This feature DOES encorporate the four systems as described above, allowing
# you, the designer, to subdivide your 'skills' and/or 'items' into smaller
# groups.
#
# TEST SYSTEMS
# Before sending your game out...there are two test systems that check if you
# are missing any ICON or PICTURE resources. While missing picture resources
# will not cause problems with your game, missing ICONS can cause the system
# to halt. Hence... the reason for this test system.
#
# ON/OFF FEATURES
# You can turn on or off the Groupings and/or Details features. The Grouping
# switches control features both in the field menu and in combat. However,
# the Detail screen switches only work for the field menu.
#
# MASS AUTO TAGGING
# You can tag your items and/or skills for the item and skill grouping system
# through the RMXP database, or use the MASS_ITEMS or MASS_SKILLS array to
# list the items or skills that belong to one or more elements. This auto
# tagging method can be useful for tagging large numbers of items in one fell
# swoop.
#
# ICONS
# You can use icons in your Group Heading windows, whether along with the
# text headings for these groups, or in place of the text in the group head-
# ings. You can also use icons to replace the general text used to describe
# the element and/or status effects shown in the detail screens.
#
# DETAIL FILE PATHWAYS
# Originally, the pathways for the detail files were hardcoded into the data
# folder, and was required to be item_detail.rxdata and so on. Now, you can
# have them named YOUR way.
#
# THE GROUPING SETUP SYSTEM
# Both the original system by KGC and this system utilizes elements set up in
# the RMXP database to set items and/or skills apart. But the manner in which
# you set up your groups in the script have been made MUCH easier. Now you
# have one array to set up the whole ITEM group system instead of three (or
# six if you remember KGC's)...
#
# And if you wish to do so, you can also make individual sets of skill groups
# for each of your actors.
#
# THOSE '$' and '%' THAT I USED EARLIER...
# Forget about 'em... this works much better now. :)
#
# BATTLESYSTEM WINDOWS
# This system has two switches (one for items and one for skills) that allows
# you to use a 'Grouping' window in combat that resembles and is positioned
# just like the Actor Command Window. Like the Actor Command Window, it has
# no icons as it is meant to minic the fore-mentioned 'Actor Command Window'.
#
# PICTURES
# You can now show pictures in your details screen. It'll appear in the right
# side of the screen, and I find a 128 x 192 image works out just fine. The
# filename of the image is based on a special 'prefix' (set in PIC_PREFIX_I,
# PIC_PREFIX_A... and so on) and the ID number of the item/skill. Assuming
# that the stored prefix for Armor is 'ARMOR-' and you're loading the picture
# of an Iron Helm (id# 006), the file would be 'ARMOR-6'.
#
# GENERAL TEXT
# Instead of the text and headers being hard coded into the script, it is now
# available to edit/change in the configuration file. That's right, you can
# now change every (or nearly every) bit of text in the script just by going
# into the config section. Figured... other language users would like that.
#
# SDK
# The SDK version 2.2 uses a new update system, which made the previous sys-
# temp of Grouping and Details fumble about in the 'GROUP' menu... making it
# scroll through the choices twice. This version detects the SDK,and accounts
# for the new update routines. The system may not be up to SDK standards by
# rewriting some systems... but it tries.
#
# GUILLAUME777 MULTI-SLOT
# It is now compatible with the Multi-Slot Equipment script. The earlier one
# was not, and had problems with the equip screen's detail function.
#
#
#------------------------------------------------------------------------------
# REWRITES (Important for merging scripts together)
#------------------------------------------------------------------------------
#
# This system rewrites a few defs for the system to work. Sorry, but it was
# necessary. The refresh routines 'had' to be rewritten in order to divide
# up the skills and items. And the defs rewritten in Scene_Battle were ne-
# cessary to apply the grouping system in battle:
#
# ITEM_WINDOW: refresh
# SKILL_WINDOW: refresh (referred as an alias... but barely...)
# SCENE_BATTLE: update_phase3_item_select, update_phase3_skill_select
#
#==============================================================================
#==============================================================================
# ** GROUPING AND DETAILS
#------------------------------------------------------------------------------
# by DerVVulfman
# version 6.9
# 07-18-2007
# SDK 2.2+ Compliant (Forced to rewrite four defs, two in Scene_Battle)
#------------------------------------------------------------------------------
# PART 1 : CONFIGURATION
#------------------------------------------------------------------------------
# This page allows you to set up the system in the manner in which you desire.
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
#==============================================================================



#=======================================================================#
# ** C O N F I G U R A T I O N S Y S T E M ** #
#=======================================================================#

#===========================================================#
# ** S Y S T E M C H E C K R O U T I N E S ** #
#===========================================================#


ERROR_CHK_SYSTEM = true # Tests for any missing ICON files in use
ERROR_PIC_SYSTEM = false # Tests for any missing detail pictures


#===========================================================#
# ** S Y S T E M E N A B L I N G S W I T C H E S ** #
#===========================================================#

GROUP_ITEMS_ON = true # If true, the item grouping system is enabled
GROUP_SKILL_ON = true # If true, the skill grouping system is enabled
DETAILS_ITEMS_ON = true # If true, details will work in the item menu *
DETAILS_SKILL_ON = true # If true, details will work in the skill menu *
DETAILS_EQUIP_ON = true # If true, details will work in the equip menu *
# * These menus refer to use in the 'field' menu.
# 'Details' are not available when in combat.


#===========================================================#
# ** M A S S E L E M E N T T A G G I N G ** #
#===========================================================#

# This system allows you to assign a list of ITEMS or SKILLS (by ID number)
# to one or more elements (by name) in the RMXP Database. It can be kept
# empty by setting the array to 'nil'.
#
# Element ID Numbers
MASS_ITEMS = [ ['Standard', [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,
20,21,22,23,24,25,26,27,28]],
['Special' , [29,30,31,32,33,34,35]] ]

MASS_SKILLS = nil


#===========================================================#
# ** G R O U P I N G C O N F I G U R A T I O N ** #
#===========================================================#

# ---------------------------- ITEM GROUP SETTINGS --------------------------

ITEM_ICONS = 1 # 0=Text, 1=Icon&Text, 2=Icons

# Element Heading Icon Help Text
ITEM_ARRAY = [ ['Standard', 'Standard', 'L-ITEM0', 'Here you find all normal Items'] ,
['Special', 'Special', 'L-ITEM5', 'Here you find special rare Items'],
[-1, 'Weapons', 'L-ITEM1', 'Here you find all Weapons'] ,
[-2, 'Equipment', 'L-ITEM2', 'Here you find all Armors and Accessories'],
['Key', 'Key Items', 'L-ITEM4', 'Here you find unique and important Items'],
[0, 'All', 'L-MENU0', 'Here you find everything in your Inventory'] ]

HIDDEN_ITEM = 'Hidden' # Any item you want specifically hidden...

B_I_WINDOW = false # If true, smaller Item Group window matching A C Window.



# --------------------------- SKILL GROUP SETTINGS --------------------------

SKILL_ICONS =0 # 0=Text, 1=Icon&Text, 2=Icons

# Element Heading Icon Help Text
SKILL_ARRAY = [ ['Technique', 'Battle', '', 'Useful fighting skills.'] ,
['Defense', 'Magick+', '', 'Healing elemental magick.'],
['Offence', 'Magick-', '', 'Harmful elemental magick.'] ,
['Arcane', 'Arcane', '', 'Arcane spells and magick.'],
[0, 'All', '', 'All your learned skills.'] ]
# ID Element Heading Icon Help Text
ACTOR_S_ARRAY = {9 => [ ['attack', 'Ouchie', '044-Skill01', "General whuppin' skills." ],
['uniqueness', 'Too Much IF', 'Barrier', 'Time for a little payback.' ],
[0, 'MAX', '038-Item07', 'What you know to survive.' ] ] }


B_S_WINDOW = true # If true, smaller Skill Group window matching A C Window.



#===========================================================#
# ** D E T A I L C O N F I G U R A T I O N ** #
#===========================================================#

# ------------------------------ DETAIL PATHWAYS ----------------------------

DETAIL_ITEM = 'Data/Item_Detail.rxdata' # Path a& file of the item file
DETAIL_ARMOR = 'Data/Armor_Detail.rxdata' # Path & file of the weapon file
DETAIL_WEAPON = 'Data/Weapon_Detail.rxdata' # Path & file of the armor file
DETAIL_SKILLS = 'Data/Skill_Detail.rxdata' # Path & File of the skill file



# ---------------------------- DETAIL SCREEN FONTS --------------------------

DETAIL_FONTNAME = 'Arial' # Font used in Detail Window
DETAIL_FONTSIZE = 20 # Size of font in Detail Window
HLIT_COLOR = Color.new(255, 128, 0, 255) # Color for highlighted text
ELEM_COLOR = Color.new(0, 128, 0, 255) # Color for Element 'text'
SATK_COLOR = Color.new(0, 0, 255, 255) # Color of Status Attack 'text'
SDEF_COLOR = Color.new(255, 64, 0, 255) # Color of Status Defense 'text'



# ------------------------------ DETAIL PICTURES ----------------------------
# (NOTE: For best results,use 128 X 192 image files)

PIC_PREFIX_I = 'GND-ITEM_' # Prefix for Item Pictures
PIC_PREFIX_A = 'GND-ARMOR_' # Prefix for Armor Pictures
PIC_PREFIX_W = 'GND-WEAPON_' # Prefix for Weapon Pictures
PIC_PREFIX_S = 'GND-SKILL_' # Prefix for Skill Pictures



# -------------------------------- DETAIL TEXT ------------------------------

EXTRA_TEXT = 'Description:' # Title of text from detail file
EXTRA_TEXT_CLR = Color.new(255, 255, 0, 255) # Color of text's last line
DETAIL_LEADER = 5 # Leading spaces in Detail Files
DETAIL_LINES = 7 # Number of detail text lines



# --------------------- ELEMENT & STATUS DETAILS ----------------------------

ICONS_ON = true # If true, uses icons... not text
NONE_TEXT = 'None' # Text shown if no states...
HIDDEN_ELEMENT = [] # Elements not visible
HIDDEN_STATUSES = [] # Statuses not visible




#===========================================================#
# ** D E F A U L T T E X T S E T T I N G S ** #
#===========================================================#


# --------------------------- DEFAULT TEXT SETTINGS -------------------------

GENERAL_POSTN = 360 # Left position of Cost/Qty
GENERAL_COSTS = ' Costs' # Heading for the SP/MP Power Cost
GENERAL_VALUE = 'Value:' # Heading for the item's price.
GENERAL_OWNED = 'Owned No.:' # Heading for the quantity owned


# ---------------------------- ITEM TEXT SETTINGS ---------------------------

ATTR_POWER = 'Power' # Text showing power strength
ATTR_H_PWR = 'Heal Pwr' # Text showing healing power strength
ATTR_ACC = 'Accuracy' # Accuracy of item usage
ATTR_VAR = 'Variance' # Variance of the item's power


# --------------------------- ITEM EFFECT SETTINGS --------------------------

ITEM_EFFECT1 = 'Effect on:' # Effective on...
ITEM_EFFECT2 = 'Inflict' # Inflict / Apply physical change
ITEM_EFFECT3 = 'Recover' # Recover / Heal physical change
ITEM_EFFECT4 = 'Accuracy:' # Item accuracy text
ITEM_EFFECT5 = 'VAR' # Variance in item accuracy


# --------------------- 'PARAMETER EFFECT' TEXT SETTINGS --------------------

PARAM_FX1 = 'None' # Text if no parameter is affected
PARAM_FX2 = 'Max HP' # Text if max HP is affected
PARAM_FX3 = 'Max SP' # Text if max SP is affected
PARAM_FX4 = 'Strength' # Text if Strength is affected
PARAM_FX5 = 'Dexterity' # Text if Dexterity is affected
PARAM_FX6 = 'Agility' # Text if Agility is affected
PARAM_FX7 = 'Intelligence' # Text if Intelligence is affected
PARAM_PTS = ' Points' # end text... for points applied.


# -------------------------- 'SCOPE' TEXT SETTINGS --------------------------

SCOPE_HEAD = 'Type:' # Heading text for scope
SCOPE_NONE = 'Nobody' # An effect only, there is no target
SCOPE_1ENEMY = 'One Enemy' # If it affects a single enemy
SCOPE_AENEMY = 'All Enemies' # If it affects all enemies
SCOPE_1ALLY = 'One Ally' # If it affects a single actor
SCOPE_AALLY = 'All Allies' # If it affects all actors
SCOPE_1DEAD = 'One Dead (hp = 0) Ally' # If it affects a single dead actor
SCOPE_ADEAD = 'All Dead (hp = 0) Ally' # If it affects all dead actors
SCOPE_USER = 'User of the Skill' # If it affects the user only


# ---------------------- 'OCCASION OF USE' TEXT SETTINGS --------------------

OCCASION_HD = 'Occasion:' # Heading text for the Occasion
OCCASION_MB = 'Menu + Battle' # Can be used in battle or in the menu
OCCASION_OB = 'Only in Battle' # Can only be used in battle
OCCASION_OM = 'Only in Menu' # Can only be used from the menu
OCCASION_NU = 'Not Usable' # Cannot be used


# --------------------------- ARMOUR TEXT SETTINGS --------------------------
# This can be expanded to use with Guillaume777's Multi-Slot Equipment Script

ARMOR_HEAD = 'Type' # Heading text to showcase the armor
ARMOR_TYPE = [ 'Shield', # Text used when a shield is shown
'Helmet', # Text used when a helmet is shown
'Armor', # Text used when armor is shown
'Accessory', # Text used when accessories shown
]



# ---------------------- ELEMENT & STATUS TEXT HEADINGS ---------------------

HEAD_E_ATK = 'Elemental Attack:' # Heading for element effects
HEAD_S_ATK = 'Status Attack:' # Heading for applied status effects
HEAD_S_RMV = 'Status Removal:' # Heading for removed status effects
HEAD_E_GRD = 'Elemental Guard:' # Heading for armor element effects
HEAD_S_GRD = 'Status Guard:' # Heading for armor status effects



#=======================================================================#
# C O N F I G U R A T I O N S Y S T E M E N D #
#=======================================================================#
#==============================================================================
# ** GROUPING AND DETAILS
#------------------------------------------------------------------------------
# by DerVVulfman
# version 6.9
# 07-18-2007
# SDK 2.2+ Compliant (Forced to rewrite four defs, two in Scene_Battle)
#------------------------------------------------------------------------------
# PART 2 : MECHANICS & ERROR CHECKING
#------------------------------------------------------------------------------
# This page provides the group system's mechanics, and error checking systems
# that searches your system for adequate graphics.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
#==============================================================================



#=======================================================================#
# ** M E C H A N I C S ** #
#=======================================================================#

# Load data for element tagging
dat_system = load_data("Data/System.rxdata")
dat_states = load_data("Data/States.rxdata")
dat_actors = load_data("Data/Actors.rxdata")
dat_items = load_data("Data/Items.rxdata")

#===========================================================#
# ** G R O U P I N G S Y S T E M C O D E S ** #
#===========================================================#

# Mechanics for creating the item group index
ITEM_G_ARRAY = []
for i in 0..ITEM_ARRAY.size-1
if ITEM_ARRAY[0].is_a?(Numeric) && ITEM_ARRAY[0] <= 0
ITEM_G_ARRAY = ITEM_ARRAY[0]
next
end
ITEM_G_ARRAY = dat_system.elements.index(ITEM_ARRAY[0])
end
# Sets the Grouping system's hidden item element
ITEM_G_HIDE = dat_system.elements.index(HIDDEN_ITEM)
# Mechanics for creating the skill group index
SKILL_G_ARRAY = []
for i in 0..SKILL_ARRAY.size-1
# If '0', then set group element is '0'
if SKILL_ARRAY[0] == 0
SKILL_G_ARRAY = 0
next
end
SKILL_G_ARRAY = dat_system.elements.index(SKILL_ARRAY[0])
end
# Mechanics for creating individual actor skill group indexes
A_S_G_ARRAY = []
for i in 1..dat_actors.size-2
temp_array = ACTOR_S_ARRAY
temp_two = []
if temp_array != nil
for j in 0..temp_array.size-1
if temp_array[j][0] == 0
temp_two[j] = 0
next
end
temp_two[j] = dat_system.elements.index(temp_array[j][0])
end
else
temp_two = nil
end
A_S_G_ARRAY = temp_two
end

#===========================================================#
# ** D E T A I L S Y S T E M C O D E S ** #
#===========================================================#

# Create the hidden element array
HIDDEN_G_ARRAY = []
# * Add Item Groups to the hidden element array
for i in 0..ITEM_ARRAY.size-1
HIDDEN_G_ARRAY.push(dat_system.elements.index(ITEM_ARRAY[0]))
end
# Add Skill Groups to the hidden element array
for i in 0..SKILL_ARRAY.size-1
HIDDEN_G_ARRAY.push(dat_system.elements.index(SKILL_ARRAY[0]))
end
# Add Hidden Elements to the hidden element array
for i in 0..HIDDEN_ELEMENT.size-1
HIDDEN_G_ARRAY.push(dat_system.elements.index(HIDDEN_ELEMENT))
end
# Add the Grouping system's hidden item element to the hidden element array
HIDDEN_G_ARRAY.push(dat_system.elements.index(HIDDEN_ITEM))



#=======================================================================#
# ** S Y S T E M C H E C K I N G ** #
#=======================================================================#

# Set flags and list arrays
temp_array = []
ig_names, sg_names, ag_names, ed_names, sd_names = [],[],[],[],[]
pi_names, pw_names, pa_names, ps_names = [],[],[],[]
i_flag, gr_flag, p_flag = false, false, false


#===========================================================#
# ** M I S S I N G I C O N C H E C K S ** #
#===========================================================#

# DISPLAY IF ERROR CHECK SYSTEM is ON
if ERROR_CHK_SYSTEM
# Go through ITEM ARRAY for icons
if ITEM_ICONS != 0
for i in 0..ITEM_ARRAY.size-1
begin
tmp_icon = RPG::Cache.icon(ITEM_ARRAY[2])
rescue Errno::ENOENT
ig_names.push(ITEM_ARRAY[2]+ ', ')
grflag = true
end
end
end
# Go through SKILL ARRAY for Icons
if SKILL_ICONS != 0
# SKILL ARRAY
for i in 0..SKILL_ARRAY.size-1
begin
tmp_icon = RPG::Cache.icon(SKILL_ARRAY[2])
rescue Errno::ENOENT
sg_names.push(SKILL_ARRAY[2]+ ', ')
grflag = true
end
end
# ACTOR SKILL ARRAY
for i in 1..dat_actors.size-2
temp_array = ACTOR_S_ARRAY
if temp_array != nil
for j in 0..temp_array.size-1
begin
tmp_icon = RPG::Cache.icon(temp_array[j][2])
rescue Errno::ENOENT
ag_names.push(temp_array[j][2]+ ', ')
grflag = true
end
end
end
end
end
# CHECKING ELEMENT AND STATUS ICONS (if needed)
if ICONS_ON
# Go through element lists
for i in dat_system.elements
begin
tmp_icon = RPG::Cache.icon(i)
rescue Errno::ENOENT
ed_names.push(i+', ')
iflag = true
end
end
# Go through status lists
for i in 1..dat_states.size-1
begin
tmp_icon = RPG::Cache.icon(dat_states.name)
rescue Errno::ENOENT
sd_names.push(dat_states.name + ', ')
iflag = true
end
end
end
# Display message for missing Group Icons
if grflag
gr_message = ""
gr_message += 'Icons that may be used for the Item and/or Skill Grouping'
gr_message += "\n"
gr_message += 'windows for display are missing. Please make sure you have'
gr_message += "\n"
gr_message += 'adequate icons for use:'
gr_message += "\n"
if ig_names.size != 0
gr_message += "\n"
gr_message += 'Item Window:'
gr_message += "\n"
gr_message += ig_names.to_s
end
if sg_names.size != 0
gr_message += "\n"
gr_message += 'Skill Window:'
gr_message += "\n"
gr_message += sg_names.to_s
end
if ag_names.size != 0
gr_message += "\n"
gr_message += 'Actor Skill Window:'
gr_message += "\n"
gr_message += ag_names.to_s
end
print gr_message
end
# Display message for missing Detail Icons
if iflag
i_message = ""
i_message += 'Icons that may be used for the Element and/or Status Effect'
i_message += "\n"
i_message += 'display are missing. Please make sure you have adequate'
i_message += "\n"
i_message += 'icons for use:'
i_message += "\n"
i_message += "\n"
if ed_names.size != 0
i_message += 'Elements:'
i_message += "\n"
i_message += ed_names.to_s
end
if sd_names.size != 0
if ed_names.size != 0
i_message += "\n"
i_message += "\n"
end
i_message += 'States:'
i_message += "\n"
i_message += sd_names.to_s
end
print i_message
end
end


#===========================================================#
# ** M I S S I N G D E T A I L P I C T U R E S ** #
#===========================================================#

# DISPLAY IF PICTURE CHECK SYSTEM is ON
if ERROR_PIC_SYSTEM
p_flag = nil
dat_temp = load_data("Data/Items.rxdata")
for i in 1..dat_temp.size-1
begin
tmp_pic = RPG::Cache.picture(PIC_PREFIX_I + (i.to_s))
rescue Errno::ENOENT
pi_names.push(dat_temp.name + ', ')
p_flag = true
end
end
# Display message for missing Group Icons
if p_flag
if pi_names.size != 0
q_message = ""
q_message += 'Picture files that may be used in the details system are'
q_message += "\n"
q_message += 'not available in your Graphics\Pictures folder. Though the'
q_message += "\n"
q_message += 'system will not stop running without these files, these'
q_message += "\n"
q_message += "files may have been overlooked:"
q_message += "\n"
q_message += "\n"
q_message += "Item Pictures:"
q_message += "\n"
q_message += pi_names.to_s
q_message += "\n"
print q_message
end
end
p_flag = nil
dat_temp = load_data("Data/Weapons.rxdata")
for i in 1..dat_temp.size-1
begin
tmp_pic = RPG::Cache.picture(PIC_PREFIX_W + (i.to_s))
rescue Errno::ENOENT
pw_names.push(dat_temp.name + ', ')
p_flag = true
end
end
# Display message for missing Group Icons
if p_flag
if pw_names.size != 0
q_message = ""
q_message += 'Picture files that may be used in the details system are'
q_message += "\n"
q_message += 'not available in your Graphics\Pictures folder. Though the'
q_message += "\n"
q_message += 'system will not stop running without these files, these'
q_message += "\n"
q_message += "files may have been overlooked:"
q_message += "\n"
q_message += "\n"
q_message += "Weapon Pictures:"
q_message += "\n"
q_message += pw_names.to_s
q_message += "\n"
print q_message
end
end
p_flag = nil
dat_temp = load_data("Data/Armors.rxdata")
for i in 1..dat_temp.size-1
begin
tmp_pic = RPG::Cache.picture(PIC_PREFIX_A + (i.to_s))
rescue Errno::ENOENT
pa_names.push(dat_temp.name + ', ')
p_flag = true
end
end
# Display message for missing Group Icons
if p_flag
if pa_names.size != 0
q_message = ""
q_message += 'Picture files that may be used in the details system are'
q_message += "\n"
q_message += 'not available in your Graphics\Pictures folder. Though the'
q_message += "\n"
q_message += 'system will not stop running without these files, these'
q_message += "\n"
q_message += "files may have been overlooked:"
q_message += "\n"
q_message += "\n"
q_message += "Armor Pictures:"
q_message += "\n"
q_message += pa_names.to_s
q_message += "\n"
print q_message
end
end
p_flag = nil
dat_temp = load_data("Data/Skills.rxdata")
for i in 1..dat_temp.size-1
begin
tmp_pic = RPG::Cache.picture(PIC_PREFIX_S + (i.to_s))
rescue Errno::ENOENT
ps_names.push(dat_temp.name + ', ')
p_flag = true
end
end
# Display message for missing Group Icons
if p_flag
if ps_names.size != 0
q_message = ""
q_message += 'Picture files that may be used in the details system are'
q_message += "\n"
q_message += 'not available in your Graphics\Pictures folder. Though the'
q_message += "\n"
q_message += 'system will not stop running without these files, these'
q_message += "\n"
q_message += "files may have been overlooked:"
q_message += "\n"
q_message += "\n"
q_message += "Skill Pictures:"
q_message += "\n"
q_message += ps_names.to_s
q_message += "\n"
print q_message
end
end
end

#==============================================================================
# ** GROUPING AND DETAILS
#------------------------------------------------------------------------------
# by DerVVulfman
# version 6.9
# 07-18-2007
# SDK 2.2+ Compliant (Forced to rewrite four defs, two in Scene_Battle)
#------------------------------------------------------------------------------
# PART 3 : MODULES
#------------------------------------------------------------------------------
# This page provides additions to default modules within the RGSS system, adds
# compatability checks for enhanced systems, and previously repetitive code.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# (All defaults performed via Aliases)
#==============================================================================



#==============================================================================
# ** RMXP Standard Development Kit (SDK)
#------------------------------------------------------------------------------
# A system aimed to increase compatibility between RGSS scripts
#==============================================================================
module SDK
# Set Autodetect global to false
$gnd_sdk_detect = false
# SDK Autodetect routine
if defined?(log_alias)
# Set Autodetect global to true
$gnd_sdk_detect = true
end
end



#==============================================================================
# ** RPG
#------------------------------------------------------------------------------
# A module containing RPGXP's data structures and more.
#==============================================================================

module RPG
#============================================================================
# ** Item
#----------------------------------------------------------------------------
# Data Class for items.
#============================================================================

class Item
#--------------------------------------------------------------------------
# * Determine Usable Item
#--------------------------------------------------------------------------
def usable?
if $game_party.item_can_use?(self.id)
return true
end
return false
end
end
#============================================================================
# ** Weapon
#----------------------------------------------------------------------------
# Data Class for weapons.
#============================================================================

class Weapon
#--------------------------------------------------------------------------
# * Determine Usable Item
#--------------------------------------------------------------------------
def usable?
return false
end
end
end



#==============================================================================
# ** Graphics
#------------------------------------------------------------------------------
# The module that carries out graphics processing.
#==============================================================================

module Graphics
unless defined?(trans_interrupt)
#--------------------------------------------------------------------------
# * Transition
# duration : number of frames the transition will last
# filename : transition graphic file name
# vague : ambiguity of the borderline
#--------------------------------------------------------------------------
class << Graphics
alias trans_interrupt transition
end
def self.transition(duration = 8, filename = "", vague = 40)
if $game_temp && $game_temp.interrupt_transition
return
end
trans_interrupt(duration, filename, vague)
end
end
end



#==============================================================================
# ** Reusable Item Groups
#------------------------------------------------------------------------------
# This module contains routines used throughout two versions of the the Item
# Grouping Windows.
#==============================================================================

module ItemGroups
#--------------------------------------------------------------------------
# * Reused portion of 'Object Initialization'
#--------------------------------------------------------------------------
def reusable_init
@commands = []
@icon_cmd = []
for name in 0..ITEM_ARRAY.size-1
@commands.push(ITEM_ARRAY end
@item_max = @commands.size
if B_I_WINDOW && $game_temp.in_battle
@column_max = 1
else
@column_max = @commands.size
end
@item_width = (width - 32) / @commands.size
self.index = 0
refresh
end
#--------------------------------------------------------------------------
# * Reused portion of 'Help Text Update'
#--------------------------------------------------------------------------
def reusable_help
@help_window.set_text(ITEM_ARRAY[self.index][3])
end
end





#==============================================================================
# ** Reusable Skill Groups
#------------------------------------------------------------------------------
# This module contains routines used throughout two versions of the the Skill
# Grouping Windows.
#==============================================================================

module SkillGroups
#--------------------------------------------------------------------------
# * Reused portion of 'Object Initialization'
#--------------------------------------------------------------------------
def reusable_init(actor)
@commands = []
@icon_cmd = []
temp_array = []
@s_actor = actor.id
unless ACTOR_S_ARRAY.include?(@s_actor)
for name in 0..SKILL_ARRAY.size-1
@commands.push(SKILL_ARRAY
end
end
unless ACTOR_S_ARRAY.include?(@s_actor)
for name in 0..SKILL_ARRAY.size-1
@icon_cmd.push(SKILL_ARRAY
end
end
@item_max = @commands.size
if B_S_WINDOW && $game_temp.in_battle
@column_max = 1
else
@column_max = @commands.size
end
@item_width = (width - 32) / @column_max
self.index = 0
unless B_S_WINDOW
if $game_temp.in_battle
self.y = 0
end
end
self.z = 2000
refresh
end
#--------------------------------------------------------------------------
# * Reused portion of 'Help Text Update'
#--------------------------------------------------------------------------
def reusable_help
temp_array = []
unless ACTOR_S_ARRAY.include?(@s_actor)
@help_window.set_text(SKILL_ARRAY[self.index][3])
else
temp_array = ACTOR_S_ARRAY[@s_actor]
@help_window.set_text(temp_array[self.index][3])
end
end
end



#==============================================================================
# ** Details
#------------------------------------------------------------------------------
# This module contains routines used throughout the Items and Skills Detail
# Screens.
#==============================================================================

module Details
#--------------------------------------------------------------------------
# * READER SECTIONS
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# * Read the basics
#--------------------------------------------------------------------------
def reader_basics(data_type)
@gnd_temp = $game_temp.gnd_highlight # Obtain the item/skill
@gnd_bitmap = RPG::Cache.icon(@gnd_temp.icon_name) # The icon bitmap
@gnd_name = data_type[@gnd_temp.id].name # The name
@gnd_descr = data_type[@gnd_temp.id].description # Help Text Description
end
#--------------------------------------------------------------------------
# * Read ITEM values
#--------------------------------------------------------------------------
def reader_items(data_type)
#Qty and Cost
@gnd_qty = ($game_party.item_number(@gnd_temp.id)).to_s
@gnd_price = (data_type[@gnd_temp.id].price).to_s
# Below lines target the items parameter effect
@gnd_parafx = data_type[@gnd_temp.id].parameter_type
@gnd_itemfx = data_type[@gnd_temp.id].parameter_points.to_s
case @gnd_parafx
when 0 ; @gnd_parafx = PARAM_FX1
when 1 ; @gnd_parafx = PARAM_FX2
when 2 ; @gnd_parafx = PARAM_FX3
when 3 ; @gnd_parafx = PARAM_FX4
when 4 ; @gnd_parafx = PARAM_FX5
when 5 ; @gnd_parafx = PARAM_FX6
when 6 ; @gnd_parafx = PARAM_FX7
end
# HP and SP Recovery Rates (1st numeric, 2nd string)
@vhp_rte = data_type[@gnd_temp.id].recover_hp_rate # HP rate %
@vhp_amt = data_type[@gnd_temp.id].recover_hp # HP amount.
@vsp_rte = data_type[@gnd_temp.id].recover_sp_rate # SP rate %
@vsp_amt = data_type[@gnd_temp.id].recover_sp # SP amount.
@rhp_rte = data_type[@gnd_temp.id].recover_hp_rate.to_s # HP rate %
@rhp_amt = data_type[@gnd_temp.id].recover_hp.to_s # HP amount.
@rsp_rte = data_type[@gnd_temp.id].recover_sp_rate.to_s # SP rate %
@rsp_amt = data_type[@gnd_temp.id].recover_sp.to_s # SP amount.
# This stores the hit rate and variance to a variable
@gnd_acc = data_type[@gnd_temp.id].hit.to_s
@gnd_var = data_type[@gnd_temp.id].variance.to_s
# PDEF and MDEF values for all
temp = data_type[@gnd_temp.id].pdef_f
if temp > 0 ; @p5 = "+" ; end
@gnd_pdf = temp.to_s
temp = data_type[@gnd_temp.id].mdef_f
if temp > 0 ; @p6 = "+" ; end
@gnd_mdf = temp.to_s
end
#--------------------------------------------------------------------------
# * Read Weapon values
#--------------------------------------------------------------------------
def reader_weaps(data_type)
#Qty and Cost
@gnd_qty = ($game_party.weapon_number(@gnd_temp.id)).to_s
@gnd_price = (data_type[@gnd_temp.id].price).to_s
@gnd_atk = data_type[@gnd_temp.id].atk.to_s
end
#--------------------------------------------------------------------------
# * Read Armor
#--------------------------------------------------------------------------
def reader_armor(data_type)
#Qty and Cost
@gnd_qty = ($game_party.armor_number(@gnd_temp.id)).to_s
@gnd_price = (data_type[@gnd_temp.id].price).to_s
# Checks armor's type and inserts appropriate string.
type = data_type[@gnd_temp.id].kind
@type = ""
@type = ARMOR_TYPE[type] if ARMOR_TYPE[type] != nil
end
#--------------------------------------------------------------------------
# * Read Gear
#--------------------------------------------------------------------------
def reader_gear(data_type)
gnd_temp = data_type[@gnd_temp.id].str_plus
if gnd_temp > 0 ; @p1 = "+" ; end
@gnd_str = gnd_temp.to_s
gnd_temp = data_type[@gnd_temp.id].dex_plus
if gnd_temp > 0 ; @p2 = "+" ;end
@gnd_dex = gnd_temp.to_s
gnd_temp = data_type[@gnd_temp.id].agi_plus
if gnd_temp > 0 ; @p3 = "+" ; end
@gnd_agi = gnd_temp.to_s
gnd_temp = data_type[@gnd_temp.id].int_plus
if gnd_temp > 0 ; @p4 = "+" ; end
@gnd_int = gnd_temp.to_s
gnd_temp = data_type[@gnd_temp.id].pdef
if gnd_temp > 0 ; @p5 = "+" ; end
@gnd_pdf = gnd_temp.to_s
gnd_temp = data_type[@gnd_temp.id].mdef
if gnd_temp > 0 ; @p6 = "+" ; end
@gnd_mdf = gnd_temp.to_s
end
#--------------------------------------------------------------------------
# * Read Skills
#--------------------------------------------------------------------------
def reader_skills(data_type)
@gnd_spc = data_type[@gnd_temp.id].sp_cost.to_s # SP Cost for use
@gnd_atk = data_type[@gnd_temp.id].atk_f.to_s # Attack Power
@gnd_eva = data_type[@gnd_temp.id].eva_f.to_s # Evasion
@gnd_pwr = data_type[@gnd_temp.id].power.to_s # Power
@gnd_str = data_type[@gnd_temp.id].str_f.to_s # Strength Adjustment
@gnd_dex = data_type[@gnd_temp.id].dex_f.to_s # Dexterity Adjustment
@gnd_agi = data_type[@gnd_temp.id].agi_f.to_s # Agility Adjustment
@gnd_int = data_type[@gnd_temp.id].int_f.to_s # Intelligence Adjustment
@gnd_acc = data_type[@gnd_temp.id].hit.to_s # Hit Adjustment
@gnd_pdf = data_type[@gnd_temp.id].pdef_f.to_s # Physical Def. Adjustment
@gnd_mdf = data_type[@gnd_temp.id].mdef_f.to_s # Magical Def. Adjustment
@gnd_var = data_type[@gnd_temp.id].variance.to_s # Variance
end
#--------------------------------------------------------------------------
# * Read the Scope and Occasion of Use
#--------------------------------------------------------------------------
def reader_scopes(data_type)
# Scope of Target(s)
@gnd_scope = data_type[@gnd_temp.id].scope
case @gnd_scope
when 0; @gnd_scope = SCOPE_NONE
when 1; @gnd_scope = SCOPE_1ENEMY
when 2; @gnd_scope = SCOPE_AENEMY
when 3; @gnd_scope = SCOPE_1ALLY
when 4; @gnd_scope = SCOPE_AALLY
when 5; @gnd_scope = SCOPE_1DEAD
when 6; @gnd_scope = SCOPE_ADEAD
when 7; @gnd_scope = SCOPE_USER
end
# Occasion of use
@gnd_occasion = data_type[@gnd_temp.id].occasion
case @gnd_occasion
when 0; @gnd_occasion = OCCASION_MB
when 1; @gnd_occasion = OCCASION_OB
when 2; @gnd_occasion = OCCASION_OM
when 3; @gnd_occasion = OCCASION_NU
end
end
#--------------------------------------------------------------------------
# * READER SUBSECTION - ICON STATES
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# * Read the ICON - Element State
#--------------------------------------------------------------------------
def reader_icons_es(data_type)
@gnd_icon = []
for i in data_type[@gnd_temp.id].element_set
gnd_temp = $data_system.elements.clone
unless HIDDEN_G_ARRAY.include?(i)
@gnd_icon.push(RPG::Cache.icon($data_system.elements.clone))
end
end
end
#--------------------------------------------------------------------------
# * Read the ICON - Plus State
#--------------------------------------------------------------------------
def reader_icons_pss(data_type)
@gnd_icon = []
for i in data_type[@gnd_temp.id].plus_state_set
gnd_temp = $data_states.name.clone
unless HIDDEN_STATUSES.include?(i)
@gnd_icon.push(RPG::Cache.icon($data_states.name.clone))
end
end
end
#--------------------------------------------------------------------------
# * Read the ICON - Minus State
#--------------------------------------------------------------------------
def reader_icons_mss(data_type)
@gnd_icon = []
for i in data_type[@gnd_temp.id].minus_state_set
gnd_temp = $data_states.name.clone
unless HIDDEN_STATUSES.include?(i)
@gnd_icon.push(RPG::Cache.icon($data_states.name.clone))
end
end
end
#--------------------------------------------------------------------------
# * Read the ICON - Armor's Guard Element
#--------------------------------------------------------------------------
def reader_icons_ges(data_type)
@gnd_icon = []
for i in data_type[@gnd_temp.id].guard_element_set
gnd_temp = $data_system.elements.clone
unless HIDDEN_STATUSES.include?(i)
@gnd_icon.push(RPG::Cache.icon($data_system.elements.clone))
end
end
end
#--------------------------------------------------------------------------
# * Read the ICON - Armor's Guard State
#--------------------------------------------------------------------------
def reader_icons_gss(data_type)
@gnd_icon = []
for i in data_type[@gnd_temp.id].guard_state_set
gnd_temp = $data_states.name.clone
unless HIDDEN_STATUSES.include?(i)
@gnd_icon.push(RPG::Cache.icon($data_states.name.clone))
end
end
end
#--------------------------------------------------------------------------
# * READER SUBSECTION - TEXT STATES
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# * Read the TEXT - Element State
#--------------------------------------------------------------------------
def reader_text_es(data_type)
@gnd_text = ""
flag = false
for i in data_type[@gnd_temp.id].element_set
$data_temp = $data_system.elements.clone
unless HIDDEN_G_ARRAY.include?(i)
if flag
@gnd_text += "/"
end
@gnd_text += $data_system.elements
flag = true
end
end
# Checks whether item_element is blank. If it is, then sets it to 'None'.
if @gnd_text == ""
@gnd_text = NONE_TEXT
end
end
#--------------------------------------------------------------------------
# * Read the TEXT - Plus State
#--------------------------------------------------------------------------
def reader_text_pss(data_type)
@gnd_text = ""
flag = false
for i in data_type[@gnd_temp.id].plus_state_set
$data_temp = $data_states.name.clone
unless HIDDEN_STATUSES.include?(i)
if flag
@gnd_text += "/"
end
@gnd_text += $data_states.name
flag = true
end
end
# Checks whether item_element is blank. If it is, then sets it to 'None'.
if @gnd_text == ""
@gnd_text = NONE_TEXT
end
end
#--------------------------------------------------------------------------
# * Read the TEXT - Minus State
#--------------------------------------------------------------------------
def reader_text_mss(data_type)
@gnd_text = ""
flag = false
for i in data_type[@gnd_temp.id].minus_state_set
$data_temp = $data_states.name.clone
unless HIDDEN_STATUSES.include?(i)
if flag
@gnd_text += "/"
end
@gnd_text += $data_states.name
flag = true
end
end
# Checks whether item_element is blank. If it is, then sets it to 'None'.
if @gnd_text == ""
@gnd_text = NONE_TEXT
end
end
#--------------------------------------------------------------------------
# * Read the TEXT - Armor's Guard Element
#--------------------------------------------------------------------------
def reader_text_ges(data_type)
@gnd_text = ""
flag = false
for i in data_type[@gnd_temp.id].guard_element_set
$data_temp = $data_system.elements.clone
unless HIDDEN_STATUSES.include?(i)
if flag
@gnd_text += "/"
end
@gnd_text += $data_system.elements
flag = true
end
end
# Checks whether item_element is blank. If it is, then sets it to 'None'
if @gnd_text == ""
@gnd_text = NONE_TEXT
end
end
#--------------------------------------------------------------------------
# * Read the ICON - Armor's Guard State
#--------------------------------------------------------------------------
def reader_text_gss(data_type)
@gnd_text = ""
flag = false
for i in data_type[@gnd_temp.id].guard_state_set
$data_temp = $data_states.name.clone
unless HIDDEN_STATUSES.include?(i)
if flag
@gnd_text += "/"
end
@gnd_text += $data_states.name
flag = true
end
end
# Checks whether item_element is blank. If it is, then sets it to 'None'
if @gnd_text == ""
@gnd_text = NONE_TEXT
end
end
#--------------------------------------------------------------------------
# * Read Detail File
# id : ID
#--------------------------------------------------------------------------
def reader_detail(detail_id)
# Set the missing detail flag to false
desc_empty_flag = false
# The description array stores the lines needed to call the proper detail
# description from the text file.

desc_array = []
for i in 0..(DETAIL_LINES - 1)
desc_array.push((detail_id - 1)* DETAIL_LINES + i )
end

# The if-then statements below checks the highlighted item and use
# the right .rxdata.
if $game_temp.gnd_highlight.is_a?(RPG::Item)
if FileTest.exist?(DETAIL_ITEM)
f = File.open(DETAIL_ITEM)
else
desc_flag = true
end
end
if $game_temp.gnd_highlight.is_a?(RPG::Weapon)
if FileTest.exist?(DETAIL_WEAPON)
f = File.open(DETAIL_WEAPON)
else
desc_flag = true
end
end
if $game_temp.gnd_highlight.is_a?(RPG::Armor)
if FileTest.exist?(DETAIL_ARMOR)
f = File.open(DETAIL_ARMOR)
else
desc_flag = true
end
end
if $game_temp.gnd_highlight.is_a?(RPG::Skill)
if FileTest.exist?(DETAIL_SKILLS)
f = File.open(DETAIL_SKILLS)
else
desc_flag = true
end
end
# If the missing detail file flag is true
if desc_flag
@description = []
for i in 0..(DETAIL_LINES - 1)
@description = " "
end
return
end
# Stores _every_ line of the file into @itemdetail as an array.
@gnd_detail = f.readlines
# Crops the excess characters in each line.
for i in 0..(DETAIL_LINES - 1)
reader_crop(desc_array)
end
# Stores the cropped lines into description array.
@description = []
for i in 0..(DETAIL_LINES - 1)
@description = @gnd_detail[desc_array]
end
return
end
#--------------------------------------------------------------------------
# * Reader Crop Characters
#--------------------------------------------------------------------------
def reader_crop(desc_array)
# Checks to see if any lines are nil. If so, it sets them as blank lines.
if @gnd_detail[desc_array] == nil
@gnd_detail[desc_array] = " "
end
# Crops the first (DETAIL_LEADER) characters in each line. (default = 5)
@gnd_detail[desc_array].slice!(0..(DETAIL_LEADER - 1).to_i)
return
end
#--------------------------------------------------------------------------
# * HEADERS
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# * Display General Header
#--------------------------------------------------------------------------
def basics_header(data_type)
self.contents.font.size = DETAIL_FONTSIZE - 4 # Font Size Adjustment
self.contents.font.color = HLIT_COLOR # Font Color Adjustment
self.contents.font.color = system_color
# Hero's Attribute Headers
self.contents.draw_text( 33, 164, 256, 24, $data_system.words.pdef)
self.contents.draw_text( 33, 178, 256, 24, $data_system.words.mdef)
# Power Attribute Header Texts
if data_type[@gnd_temp.id].power >= 0
self.contents.draw_text(223, 108, 256, 24, ATTR_POWER)
else if data_type[@gnd_temp.id].power <= 0
self.contents.draw_text(223, 108, 256, 24, ATTR_H_PWR)
end
end
self.contents.draw_text(223, 122, 256, 24, ATTR_ACC)
self.contents.draw_text(223, 136, 256, 24, ATTR_VAR)
# Status Line Headers
self.contents.draw_text( 33, 206, 256, 24, HEAD_E_ATK)
self.contents.draw_text( 33, 234, 256, 24, HEAD_S_ATK)
self.contents.draw_text( 33, 262, 256, 24, HEAD_S_RMV)
end
#--------------------------------------------------------------------------
# * Display Item Header
#--------------------------------------------------------------------------
def items_header
# Display Heading for Item's effectiveness.
self.contents.font.color = system_color
self.contents.font.size = DETAIL_FONTSIZE - 4
self.contents.draw_text(-16, 52, 100, 24, ITEM_EFFECT1, 2)
if @vhp_amt < 0 then
self.contents.draw_text(-16, 66 , 100, 24, ITEM_EFFECT2 + "(" +
$data_system.words.hp + "):", 2)
else
if @vhp_rte < 0 then
self.contents.draw_text(-16, 66, 100, 24, ITEM_EFFECT2 + "(" +
$data_system.words.hp + "):", 2)
else
self.contents.draw_text(-16, 66, 100, 24, ITEM_EFFECT3 + "(" +
$data_system.words.hp + "):", 2)
end
end
if @vsp_amt < 0 then
self.contents.draw_text(-16, 80, 100, 24, ITEM_EFFECT2 + "(" +
$data_system.words.sp + "):", 2)
else
if @vsp_rte < 0 then
self.contents.draw_text(-16, 80, 100, 24, ITEM_EFFECT2 + "(" +
$data_system.words.sp + "):", 2)
else
self.contents.draw_text(-16, 80, 100, 24, ITEM_EFFECT3 + "(" +
$data_system.words.sp + "):", 2)
end
end
self.contents.draw_text(-16, 94, 100, 24, ITEM_EFFECT4, 2)
self.contents.draw_text( 33, 122, 256, 24, $data_system.words.pdef)
self.contents.draw_text( 33, 136, 256, 24, $data_system.words.mdef)
self.contents.draw_text( 33, 150, 256, 24, ITEM_EFFECT5)
end
#--------------------------------------------------------------------------
# * Display WEAPON Header
#--------------------------------------------------------------------------
def weapon_header
# Display Heading for Attack Power of Weapon
self.contents.font.color = HLIT_COLOR
self.contents.font.size = DETAIL_FONTSIZE - 2
self.contents.draw_text( 33, 52, 256, 24, $data_system.words.atk)
# Hero's Attribute Headers
self.contents.font.size = DETAIL_FONTSIZE - 4
self.contents.font.color = system_color
self.contents.draw_text( 33, 80, 256, 24, $data_system.words.str)
self.contents.draw_text( 33, 94, 256, 24, $data_system.words.dex)
self.contents.draw_text( 33, 108, 256, 24, $data_system.words.agi)
self.contents.draw_text( 33, 122, 256, 24, $data_system.words.int)
self.contents.draw_text( 33, 136, 256, 24, $data_system.words.pdef)
self.contents.draw_text( 33, 150, 256, 24, $data_system.words.mdef)
end
#--------------------------------------------------------------------------
# * Draw ARMOR Header
#--------------------------------------------------------------------------
def armor_header
# Display Heading for Armor Type and Protection
self.contents.font.color = HLIT_COLOR
self.contents.font.size = DETAIL_FONTSIZE - 2
self.contents.draw_text( 33, 52, 256, 24, ARMOR_HEAD)
self.contents.font.size = DETAIL_FONTSIZE - 4
self.contents.draw_text( 33, 66, 256, 24, $data_system.words.pdef)
self.contents.draw_text( 33, 80, 256, 24, $data_system.words.mdef)
# Hero's Attribute Headers
self.contents.font.color = system_color
self.contents.draw_text( 33, 122, 256, 24, $data_system.words.str)
self.contents.draw_text( 33, 136, 256, 24, $data_system.words.dex)
self.contents.draw_text( 33, 150, 256, 24, $data_system.words.agi)
self.contents.draw_text( 33, 164, 256, 24, $data_system.words.int)
end
#--------------------------------------------------------------------------
# * Display SKILL Header
#--------------------------------------------------------------------------
def skills_header
self.contents.font.color = HLIT_COLOR # Font Color Adjustment
self.contents.draw_text( 33, 52, 256, 24, $data_system.words.sp + GENERAL_COSTS)
self.contents.draw_text( 33, 66, 256, 24, $data_system.words.atk)
# Hero's Attribute Headers
self.contents.font.color = system_color
self.contents.draw_text( 33, 108, 256, 24, $data_system.words.str)
self.contents.draw_text( 33, 122, 256, 24, $data_system.words.dex)
self.contents.draw_text( 33, 136, 256, 24, $data_system.words.agi)
self.contents.draw_text( 33, 150, 256, 24, $data_system.words.int)
end

#--------------------------------------------------------------------------
# * Draw Header for Scope and Occasion of Use
#--------------------------------------------------------------------------
def scope_header
# Skill Usage Texts
self.contents.draw_text(180, 52, 100, 24, SCOPE_HEAD, 2)
self.contents.draw_text(180, 66, 100, 24, OCCASION_HD, 2)
end
#--------------------------------------------------------------------------
# * -- ENTRIES --
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# * Display General Details
#--------------------------------------------------------------------------
def entries_basic
# Icon
self.contents.blt(5, 8, @gnd_bitmap, Rect.new(0, 0, 24, 24), 255)
# Draws the skill's name.
self.contents.font.size = DETAIL_FONTSIZE
self.contents.font.color = normal_color
self.contents.draw_text(33, 8, 256, 24, @gnd_name)
# Draws the skill's default description.
self.contents.font.size = (DETAIL_FONTSIZE - 6)
self.contents.draw_text(33, 28, 256, 14, @gnd_descr)
end
#--------------------------------------------------------------------------
# * Display Item Details
#--------------------------------------------------------------------------
def entries_item
# Below Lines write the Item's Effect on Parameter
self.contents.font.color = normal_color
self.contents.font.size = DETAIL_FONTSIZE - 4
if @gnd_parafx != PARAM_FX1
self.contents.draw_text(100, 52, 250, 24, @gnd_parafx + " - " +
@gnd_itemfx + PARAM_PTS, 0)
else
self.contents.draw_text(100, 52, 250, 24, @gnd_parafx, 0)
end
# Alter text color if item damages health
if @vhp_amt < 0 then ; self.contents.font.color = knockout_color ; end
if @vhp_rte < 0 then ; self.contents.font.color = knockout_color ; end
# Draw item's recovery or damage rate
self.contents.draw_text(100, 66, 250, 24, @rhp_rte + "% - " + @rhp_amt +
PARAM_PTS, 0)
self.contents.font.color = normal_color
# Alter text color it item damages sp
if @vsp_amt < 0 then ; self.contents.font.color = knockout_color ; end
if @vsp_amt < 0 then ; self.contents.font.color = knockout_color ; end
# Draw item's recovery or damage rate
self.contents.draw_text(100, 80, 250, 24, @rsp_rte + "% - " + @rsp_amt +
PARAM_PTS, 0)
# Draw item's accuracy
self.contents.draw_text(100, 94, 250, 24, @gnd_acc + "%", 0)
self.contents.font.color = normal_color
self.contents.draw_text(107, 122, 64, 24, @p5 + @gnd_pdf, 2)
self.contents.draw_text(107, 136, 64, 24, @p6 + @gnd_mdf, 2)
self.contents.draw_text(107, 150, 64, 24, @gnd_var, 2)
end
#--------------------------------------------------------------------------
# * Display Weapon Details
#--------------------------------------------------------------------------
def entries_weapon
self.contents.font.color = HLIT_COLOR
self.contents.font.size = DETAIL_FONTSIZE - 2
self.contents.draw_text( 107, 52, 64, 24, @gnd_atk, 2)
# Regular stuff
self.contents.font.size = DETAIL_FONTSIZE - 4
self.contents.font.color = normal_color
self.contents.draw_text( 107, 80, 64, 24, @p1 + @gnd_str, 2)
self.contents.draw_text( 107, 94, 64, 24, @p2 + @gnd_dex, 2)
self.contents.draw_text( 107, 108, 64, 24, @p3 + @gnd_agi, 2)
self.contents.draw_text( 107, 122, 64, 24, @p4 + @gnd_int, 2)
self.contents.draw_text( 107, 136, 64, 24, @p5 + @gnd_pdf, 2)
self.contents.draw_text( 107, 150, 64, 24, @p6 + @gnd_mdf, 2)
end
#--------------------------------------------------------------------------
# * Display Armor Details
#--------------------------------------------------------------------------
def entries_armor
# Draw Armor type and effectiveness
self.contents.font.color = HLIT_COLOR
self.contents.font.size = DETAIL_FONTSIZE - 2
self.contents.draw_text(87, 52, 84, 24, @type, 2)
self.contents.font.size = DETAIL_FONTSIZE - 4
self.contents.draw_text(107, 66, 64, 24, @p5 + @gnd_pdf, 2)
self.contents.draw_text(107, 80, 64, 24, @p6 + @gnd_mdf, 2)
# Regular Stats
self.contents.font.color = normal_color
self.contents.draw_text(107, 122, 64, 24, @p1 + @gnd_str, 2)
self.contents.draw_text(107, 136, 64, 24, @p2 + @gnd_dex, 2)
self.contents.draw_text(107, 150, 64, 24, @p3 + @gnd_agi, 2)
self.contents.draw_text(107, 164, 64, 24, @p4 + @gnd_int, 2)
end
#--------------------------------------------------------------------------
# * Display Skill Details
#--------------------------------------------------------------------------
def entries_skill(data_type)
# Draw the skill's SP cost & Attack Power
self.contents.font.color = HLIT_COLOR
self.contents.draw_text(107, 52, 64, 24, @gnd_spc, 2)
self.contents.draw_text(107, 66, 64, 24, @gnd_atk, 2)
# Draw the Skill's effect on hero's attributes
self.contents.font.color = normal_color
self.contents.draw_text(107, 108, 64, 24, @gnd_str, 2)
self.contents.draw_text(107, 122, 64, 24, @gnd_dex, 2)
self.contents.draw_text(107, 136, 64, 24, @gnd_agi, 2)
self.contents.draw_text(107, 150, 64, 24, @gnd_int, 2)
self.contents.draw_text(107, 164, 64, 24, @gnd_pdf, 2)
self.contents.draw_text(107, 178, 64, 24, @gnd_mdf, 2)
self.contents.draw_text(297, 122, 64, 24, @gnd_acc, 2)
self.contents.draw_text(297, 136, 64, 24, @gnd_var, 2)
# Draw the Power Attributes for the skill.
if data_type[@gnd_temp.id].power >= 0
self.contents.draw_text(297, 108, 64, 24, @gnd_pwr, 2)
else if data_type[@gnd_temp.id].power <= 0
@gnd_pwr = data_type[@gnd_temp.id].power * -1
self.contents.font.color = Color.new(128, 255, 128, 255)
self.contents.draw_text(297, 108, 64, 24, @gnd_pwr.to_s, 2)
self.contents.font.color = normal_color
end
end
end
#--------------------------------------------------------------------------
# * Display Scope and Occasion of Use
#--------------------------------------------------------------------------
def entries_scope
# Draw Skill's Scope & Usage Data
self.contents.font.size = DETAIL_FONTSIZE - 4
self.contents.draw_text(296, 52, 250, 24, @gnd_scope, 0)
self.contents.draw_text(296, 66, 250, 24, @gnd_occasion, 0)
end
#--------------------------------------------------------------------------
# * Display Attribute Icons
# y : Y-Position of element/status icons
#--------------------------------------------------------------------------
def entries_icons(y)
for i in 0...@gnd_icon.length
rect = Rect.new(163 + (i * 26), y, 0, 24)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.blt(163 + (i * 26), y, @gnd_icon, Rect.new(0, 0, 24, 24), 255)
end
end
#--------------------------------------------------------------------------
# * Display Attribute Text
# y : Y-Position of element/status text
#--------------------------------------------------------------------------
def entries_text(y)
self.contents.font.size = DETAIL_FONTSIZE - 4
self.contents.draw_text(153, y, 420, 24, @gnd_text, 0)
end
#--------------------------------------------------------------------------
# * Display Optional Picture
# filename : file name
#--------------------------------------------------------------------------
def entries_picture(filename)
if FileTest.exist?("Graphics/Pictures/" + filename + ".png")
bitmap = RPG::Cache.picture(filename)
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(448, 66-14, bitmap, src_rect)
end
end
#--------------------------------------------------------------------------
# * Description Entry
# x : horizontal position on screen
# y : vertical position on screen
#--------------------------------------------------------------------------
def entries_description(x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y - 20, 640, 32, EXTRA_TEXT)
self.contents.font.color = normal_color
self.contents.font.size = DETAIL_FONTSIZE - 4
# Draws the first set of lines in normal color.
for i in 0..(DETAIL_LINES - 2)
self.contents.draw_text(x, y, 640, 24, @description)
y += 16
end
# Draws the last line in another color.
self.contents.font.color = EXTRA_TEXT_CLR
self.contents.draw_text(x, y, 640, 32, @description[(DETAIL_LINES - 1)])
end
end



#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
# This class handles temporary data that is not included with save data.
# Refer to "$game_temp" for the instance of this class.
#==============================================================================

class Game_Temp
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :interrupt_transition
attr_accessor :gnd_window
attr_accessor :gnd_highlight
attr_accessor :limit_menu
#--------------------------------------------------------------------------
# * Object initialization
#--------------------------------------------------------------------------
alias gnd_init initialize
def initialize
gnd_init
@interrupt_transition = false
@gnd_window = 0
@gnd_highlight = 0
@limit_menu = false
end
end



#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
# This class handles data surrounding the system. Backround music, etc.
# is managed here as well. Refer to "$game_system" for the instance of
# this class.
#==============================================================================

class Game_System
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :gnd_rtab # Grouping & Details's RTAB Flag
#--------------------------------------------------------------------------
# * Object initialization
#--------------------------------------------------------------------------
alias gnd_init initialize
def initialize
gnd_init # Perform the Original Call
@gnd_rtab = false # Set the RTAB flag to false (default)
end
end



#==============================================================================
# ** Spriteset_Battle
#------------------------------------------------------------------------------
# This class brings together battle screen sprites. It's used within
# the Scene_Battle class.
#==============================================================================

class Spriteset_Battle
#--------------------------------------------------------------------------
# * Change Enemy Viewport
#--------------------------------------------------------------------------
alias gnd_init initialize
def initialize
gnd_init
# Determine if RTAB system in use
if @real_zoom != nil
$game_system.gnd_rtab = true
end
end
end
">
">">">">">

#==============================================================================
# ** GROUPING AND DETAILS
#------------------------------------------------------------------------------
# by DerVVulfman
# version 6.9
# 07-18-2007
# SDK 2.2+ Compliant (Forced to rewrite four defs, two in Scene_Battle)
#------------------------------------------------------------------------------
# PART 4 : WINDOWS
#------------------------------------------------------------------------------
# This page contains the revised window code, mostly through modified systems
# or new windows for enhanced functions. Only two defs needed rewriting.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# (WRITES- Window_Item: refresh & Window_Skill: refresh)
#==============================================================================



#==============================================================================
# ** Window_Item
#------------------------------------------------------------------------------
# This window displays items in possession on the item and battle screens.
#==============================================================================

class Window_Item < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias gnd_init initialize
def initialize
# Original Call
gnd_init
# If the Grouping system is enabled...
if GROUP_ITEMS_ON
# Setup Item Group Window
unless $game_temp.in_battle
self.y += 64
self.height -= 64
self.index = -1
self.active = false
end
end
end
#--------------------------------------------------------------------------
# * Decide if item is hidden
# index : item number
# type : Type of item checked 1:Weapon, 2:Armor)
#--------------------------------------------------------------------------
def hide?(index, type = 0)
case type
when 0
elements = $data_items[index].element_set.dup
when 1
elements = $data_weapons[index].element_set.dup
when 2
elements = $data_armors[index].guard_element_set.dup
end
return elements.include?(ITEM_G_HIDE)
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
# If the Grouping system is enabled...
if GROUP_ITEMS_ON
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
self.itemlist($game_temp.gnd_window)
@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
end
#--------------------------------------------------------------------------
# * List the items (part of refresh above)
# itemkind : type of item
#--------------------------------------------------------------------------
def itemlist(itemkind)
@data = []
if ITEM_G_ARRAY[itemkind] == 0
for i in 1...$data_items.size
if $game_party.item_number(i) > 0 && !self.hide?(i, 0)
@data.push($data_items)
end
end
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0 && !self.hide?(i, 1)
@data.push($data_weapons)
end
end
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0 && !self.hide?(i, 2)
@data.push($data_armors)
end
end
elsif ITEM_G_ARRAY[itemkind] == -1
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0 && !self.hide?(i, 1)
@data.push($data_weapons)
end
end
elsif ITEM_G_ARRAY[itemkind] == -2
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0 && !self.hide?(i, 2)
@data.push($data_armors)
end
end
else
for i in 1...$data_items.size
if $game_party.item_number(i) > 0 && !self.hide?(i, 0) &&
$data_items.element_set.include?(ITEM_G_ARRAY[itemkind])
@data.push($data_items)
end
end
end
end
end



#==============================================================================
# ** Window_Skill
#------------------------------------------------------------------------------
# This window displays usable skills on the skill and battle screens.
#==============================================================================

class Window_Skill < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
#--------------------------------------------------------------------------
alias gnd_init initialize
def initialize(actor)
# Obtain index of the skill group
@group = SKILL_G_ARRAY
# Obtain index of a actor's custom skill group
@group = A_S_G_ARRAY[actor.id] if A_S_G_ARRAY[actor.id] != nil
# Original Call
gnd_init(actor)
# If not using the Limit Break Menu...
unless $game_temp.limit_menu
# If the Grouping system is enabled...
if GROUP_SKILL_ON
unless $game_temp.in_battle
self.y += 64
self.height -= 64
end
self.index = -1
self.active = false
end
end
end
#--------------------------------------------------------------------------
# * Refresh (only a minor alias... most rewritten)
#--------------------------------------------------------------------------
unless $gnd_lb_patch
# If the Grouping system is enabled...
if GROUP_SKILL_ON
alias gnd_refresh refresh
def refresh
skillkind = $game_temp.gnd_window
if @group[skillkind] != 0
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in
0...@actor.skills.size
skill = $data_skills[@actor.skills]
if skill != nil && skill.element_set.include?(@group[skillkind])
@data.push(skill)
end
end
# If item count is not 0, make a bit map and draw all items
@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
else
# Original Call
gnd_refresh
end
end
end
end
end



#==============================================================================
# ** Window_ItemGroup
#------------------------------------------------------------------------------
# This window displays types of items available on the item and battle
# Screens. From here, you branch off to use the items in possession.
#==============================================================================

class Window_ItemGroup < Window_Selectable
include ItemGroups
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 64, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
# Perform reusable initialization code
reusable_init
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
for i in 0...@commands.size
# Branch on Icon Style Setting
case ITEM_ICONS
when 1
# Text and Icons
rect = Rect.new((@item_width * i)+26, 0, @item_width - 26, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.font.color = system_color
bitmap = RPG::Cache.icon(@icon_cmd)
self.contents.draw_text(rect, @commands, 1)
self.contents.blt((@item_width * i)+2, 4,bitmap,Rect.new(0,0,24,24),255)
when 2
rect = Rect.new((@item_width * i)+26, 0, @item_width - 26, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(@icon_cmd)
self.contents.blt((@item_width / 2)+(@item_width * i)-12,4,bitmap,Rect.new(0,0,24,24),255)
else
# Default Text Only
rect = Rect.new(@item_width * i, 0, @item_width, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.font.color = system_color
self.contents.draw_text(rect, @commands, 1)
end
end
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
if index != -1
self.cursor_rect.set(@item_width * index, 0, @item_width, 32)
end
end
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
# Perform reusable help window code
reusable_help
end
end



#==============================================================================
# ** Window_ItemGroup #2
#------------------------------------------------------------------------------
# This window displays the types of items available in the battlesystem. It
# mimics the Actor Command Window, and branches to the individual items you
# can select.
#==============================================================================

class Window_ItemGroup2 < Window_Selectable
include ItemGroups
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 64, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
# Perform reusable initialization code
reusable_init
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
# If item count is not 0, make a bit map and draw all items
@item_max = @commands.size
if @item_max > 0
self.contents = Bitmap.new(@item_width , row_max * 32)
for i in 0...@commands.size
rect = Rect.new(0, i * 32, @item_width, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands, 0)
end
end
end
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
# Perform reusable help window code
reusable_help
#@help_window.set_text(ITEM_ARRAY[self.index][3])
end
end



#==============================================================================
# ** Window_SkillGroup
#------------------------------------------------------------------------------
# This window displays the types of skills available on the skill and battle
# screens. From here, you branch off to select the individual skills.
#==============================================================================

class Window_SkillGroup < Window_Selectable
include SkillGroups
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 64, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
# Perform reusable initialization code
reusable_init(actor)
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
for i in 0...@commands.size
# Branch on Icon Style Setting
case SKILL_ICONS
when 1
# Text and Icons
rect = Rect.new((@item_width * i)+26, 0, @item_width - 26, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.font.color = system_color
bitmap = RPG::Cache.icon(@icon_cmd)
self.contents.draw_text(rect, @commands, 1)
self.contents.blt((@item_width * i)+2,4,bitmap,Rect.new(0,0,24,24),255)
when 2
rect = Rect.new((@item_width * i)+26, 0, @item_width - 26, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(@icon_cmd)
self.contents.blt((@item_width / 2)+(@item_width * i)-12,4,bitmap,Rect.new(0,0,24,24),255)
else
# Default Text Only
rect = Rect.new(@item_width * i, 0, @item_width, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.font.color = system_color
self.contents.draw_text(rect, @commands, 1)
end
end
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
if index != -1
self.cursor_rect.set(@item_width * index, 0, @item_width, 32)
end
end
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
# Perform reusable help window code
reusable_help
end
end



#==============================================================================
# ** Window_SkillGroup #2
#------------------------------------------------------------------------------
# This window displays the types of skills available in the battlesystem. It
# mimics the Actor Command Window, and branches to the individual skills you
# can select.
#==============================================================================

class Window_SkillGroup2 < Window_Selectable
include SkillGroups
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 0, 160, 160)
# Perform reusable initialization code
reusable_init(actor)
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
# If item count is not 0, make a bit map and draw all items
@item_max = @commands.size
if @item_max > 0
self.contents = Bitmap.new(@item_width , row_max * 32)
for i in 0...@commands.size
rect = Rect.new(0, i * 32, @item_width, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands, 0)
end
end
end
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
# Perform reusable help window code
reusable_help
end
end



#==============================================================================
# ** Window_ItemDetail
#------------------------------------------------------------------------------
# This window displays the item's individual statistics on the screen.
#==============================================================================
class Window_ItemDetail < Window_Base
include Details
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = DETAIL_FONTNAME
self.contents.font.size = DETAIL_FONTSIZE
self.contents.font.color = normal_color
self.z += 10
@itemdetail = []
self.contents.clear
refresh2
end
#--------------------------------------------------------------------------
# * Refresh 2
#--------------------------------------------------------------------------
def refresh2
self.contents.font.name = DETAIL_FONTNAME
self.contents.font.size = DETAIL_FONTSIZE
self.contents.font.color = normal_color
self.contents.clear
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
item = $game_temp.gnd_highlight
@p1 = ""
@p2 = ""
@p3 = ""
@p4 = ""
@p5 = ""
@p6 = ""
# Loading data from database
if item.is_a?(RPG::Item)
reader_basics($data_items)
reader_scopes($data_items)
reader_items($data_items)
end
if item.is_a?(RPG::Weapon)
reader_basics($data_weapons)
reader_weaps($data_weapons)
reader_gear($data_weapons)
end
if item.is_a?(RPG::Armor)
reader_basics($data_armors)
reader_gear($data_armors)
reader_armor($data_armors)
end

# Display Headers
self.contents.font.size = DETAIL_FONTSIZE
self.contents.font.color = system_color
self.contents.draw_text(GENERAL_POSTN, 8, 100, 24, GENERAL_VALUE, 2)
self.contents.draw_text(GENERAL_POSTN, 32, 100, 24, GENERAL_OWNED, 2)
if item.is_a?(RPG::Item)
items_header
scope_header
end
if item.is_a?(RPG::Weapon)
weapon_header
end
if item.is_a?(RPG::Armor)
armor_header
end
# Status Line Headers
self.contents.font.size = DETAIL_FONTSIZE - 4
if item.is_a?(RPG::Armor)
self.contents.draw_text(33, 206, 256, 24, HEAD_E_GRD)
self.contents.draw_text(33, 234, 256, 24, HEAD_S_GRD)
else
self.contents.draw_text(33, 206, 256, 24, HEAD_E_ATK)
self.contents.draw_text(33, 234, 256, 24, HEAD_S_ATK)
self.contents.draw_text(33, 262, 256, 24, HEAD_S_RMV)
end
# Displaying data from the database
# Gold & Qty
self.contents.font.size = DETAIL_FONTSIZE
cx = contents.text_size(" " + $data_system.words.gold).width
self.contents.draw_text(GENERAL_POSTN + 16, 8, 160, 24, @gnd_price, 2)
self.contents.draw_text(GENERAL_POSTN + 16, 32, 160, 24, @gnd_qty, 2)
self.contents.font.color = system_color
self.contents.draw_text(136 + GENERAL_POSTN + cx, 8 ,cx, 24, $data_system.words.gold, 1)

entries_basic

# Item exclusive entries
if item.is_a?(RPG::Item)
entries_item
entries_scope
if ICONS_ON
reader_icons_es($data_items)
entries_icons(206)
reader_icons_pss($data_items)
entries_icons(234)
reader_icons_mss($data_items)
entries_icons(262)
else
reader_text_es($data_items)
self.contents.font.color = ELEM_COLOR
entries_text(206)
reader_text_pss($data_items)
self.contents.font.color = SATK_COLOR
entries_text(234)
reader_text_mss($data_items)
self.contents.font.color = SDEF_COLOR
entries_text(262)
end
end
# Weapon Exclusive Entries
if item.is_a?(RPG::Weapon)
self.contents.font.color = HLIT_COLOR
entries_weapon
if ICONS_ON
reader_icons_es($data_weapons)
entries_icons(206)
reader_icons_pss($data_weapons)
entries_icons(234)
reader_icons_mss($data_weapons)
entries_icons(262)
else
reader_text_es($data_weapons)
self.contents.font.color = ELEM_COLOR
entries_text(206)
reader_text_pss($data_weapons)
self.contents.font.color = SATK_COLOR
entries_text(234)
reader_text_mss($data_weapons)
self.contents.font.color = SDEF_COLOR
entries_text(262)
end
end
# Armor Exclusive Entries
if item.is_a?(RPG::Armor)
entries_armor
if ICONS_ON
reader_icons_ges($data_armors)
entries_icons(206)
reader_icons_gss($data_armors)
entries_icons(234)
else
reader_text_ges($data_armors)
self.contents.font.color = ELEM_COLOR
entries_text(206)
reader_text_gss($data_armors)
self.contents.font.color = SATK_COLOR
entries_text(234)
end
end
# Pictures
if item.is_a?(RPG::Item)
entries_picture(PIC_PREFIX_I + @gnd_temp.id.to_s)
end
if item.is_a?(RPG::Weapon)
entries_picture(PIC_PREFIX_W + @gnd_temp.id.to_s)
end
if item.is_a?(RPG::Armor)
entries_picture(PIC_PREFIX_A + @gnd_temp.id.to_s)
end
# Displaying data from the text file
reader_detail(@gnd_temp.id)
entries_description(5, 316)
end
end




#==============================================================================
# ** Window_SkillDetail
#------------------------------------------------------------------------------
# This window displays the skill's individual statistics on the screen.
#==============================================================================
class Window_SkillDetail < Window_Base
include Details
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = DETAIL_FONTNAME
self.contents.font.size = DETAIL_FONTSIZE
self.contents.font.color = normal_color
# z acts as "layer order."
self.z += 2009
@skilldetail = []
# Clears and resets the window everytime it is requested by Scene_Item.
refresh2
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh2
self.contents.font.name = DETAIL_FONTNAME
self.contents.font.size = DETAIL_FONTSIZE
self.contents.font.color = normal_color
self.contents.clear
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# Obtain Basic Info
reader_basics($data_skills)
reader_skills($data_skills)
reader_scopes($data_skills)
basics_header($data_skills)
skills_header
scope_header
entries_basic
entries_scope
entries_skill($data_skills)
entries_picture(PIC_PREFIX_S + @gnd_temp.id.to_s)
if ICONS_ON
reader_icons_es($data_skills)
entries_icons(206)
reader_icons_pss($data_skills)
entries_icons(234)
reader_icons_mss($data_skills)
entries_icons(262)
else
reader_text_es($data_skills)
self.contents.font.color = ELEM_COLOR
entries_text(206)
reader_text_pss($data_skills)
self.contents.font.color = SATK_COLOR
entries_text(234)
reader_text_mss($data_skills)
self.contents.font.color = SDEF_COLOR
entries_text(262)
end
# Display data from the text file
reader_detail(@gnd_temp.id)
entries_description(5, 316)
end
end

#==============================================================================
# ** GROUPING AND DETAILS
#------------------------------------------------------------------------------
# by DerVVulfman
# version 6.9
# 07-18-2007
# SDK 2.2+ Compliant (Forced to rewrite four defs, two in Scene_Battle)
#------------------------------------------------------------------------------
# PART 5 : SCENES
#------------------------------------------------------------------------------
# This page contains the revised scene code, mostly through modified systems
# that enhances the system's functions. Only two defs needed rewriting.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# (WRITES- Scene_Battle: update_phase3_item_select, update_phase3_skill_select)
#==============================================================================



#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
# This class performs title screen processing.
#==============================================================================

class Scene_Title
#--------------------------------------------------------------------------
# * Command: New Game
#--------------------------------------------------------------------------
alias gnd_cng command_new_game
def command_new_game
# Perform the original call
gnd_cng
# Create a temporary Array
temp_array = []
# Check the Mass Items array
unless MASS_ITEMS == nil
# Cycle through the element list and items for auto-tagging
for g in 1..MASS_ITEMS.size
temp_array = MASS_ITEMS[g-1]
for i in 1..$data_items.size-1
if temp_array[1].include?(i)
$data_items.element_set.push($data_system.elements.index(MASS_ITEMS[g-1][0]))
end
end
end
end
# Check the Mass Skills array
unless MASS_SKILLS == nil
# Cycle through the element list and items for auto-tagging
for g in 1..MASS_SKILLS.size
temp_array = MASS_SKILLS[g-1]
for i in 1..$data_skills.size-1
if temp_array[1].include?(i)
$data_skills.element_set.push($data_system.elements.index(MASS_SKILLS[g-1][0]))
end
end
end
end
end
#--------------------------------------------------------------------------
# * Command: Continue
#--------------------------------------------------------------------------
alias gnd_cc command_continue
def command_continue
# Perform the original call
gnd_cc
# Create a temporary Array
temp_array = []
# Check the Mass Items array
unless MASS_ITEMS == nil
# Cycle through the element list and items for auto-tagging
for g in 1..MASS_ITEMS.size
temp_array = MASS_ITEMS[g-1]
for i in 1..$data_items.size-1
if temp_array[1].include?(i)
$data_items.element_set.push($data_system.elements.index(MASS_ITEMS[g-1][0]))
end
end
end
end
# Check the Mass Skills array
unless MASS_SKILLS == nil
# Cycle through the element list and items for auto-tagging
for g in 1..MASS_SKILLS.size
temp_array = MASS_SKILLS[g-1]
for i in 1..$data_skills.size-1
if temp_array[1].include?(i)
$data_skills.element_set.push($data_system.elements.index(MASS_SKILLS[g-1][0]))
end
end
end
end
end
end



#==============================================================================
# ** Scene_Item
#------------------------------------------------------------------------------
# This class performs item screen processing.
#==============================================================================

class Scene_Item
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
alias gnd_main main
def main
# Detail Window Setup
@itemdetail_window = Window_ItemDetail.new
@itemdetail_window.visible = false
@itemdetail_window.active = false
# If the Grouping system is enabled...
if GROUP_ITEMS_ON
# Group Window Setup
@group_window = Window_ItemGroup.new
$game_temp.interrupt_transition = true
end
# Original Call
gnd_main
# Detail Window Dispose
@itemdetail_window.dispose
# If the Grouping system is enabled...
if GROUP_ITEMS_ON
# Group Window Dispose
@group_window.dispose
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
alias gnd_update update
def update
# Detail
$game_temp.gnd_highlight = @item_window.item
# If the Grouping system is enabled...
if GROUP_ITEMS_ON
# Group Updated
unless @window_initialize
@group_window.z = @help_window.z + 1
@group_window.help_window = @help_window
@window_initialize = true
$game_temp.interrupt_transition = false
Graphics.transition
end
unless $gnd_sdk_detect
unless $gnd_sdk_detect
@group_window.update
end
end
end
# Original Call
gnd_update
# Update Detail
if @itemdetail_window.active
update_detail
return
end
# If the Grouping system is enabled...
if GROUP_ITEMS_ON
# Update Group
if @group_window.active
update_group
return
end
end
end
#--------------------------------------------------------------------------
# * Frame Update (when item window is active)
#--------------------------------------------------------------------------
alias gnd_update_item update_item
def update_item
# If the Details system is enabled...
if DETAILS_ITEMS_ON
# If Detail Button Pressed
if Input.trigger?(Input::A)
if $game_temp.gnd_highlight == nil
return
end
$game_system.se_play($data_system.decision_se)
@itemdetail_window.refresh
@item_window.active = false
@itemdetail_window.visible = true
@itemdetail_window.active = true
end
end
# If the Grouping system is enabled...
if GROUP_ITEMS_ON
# Group Window Pressed
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@group_window.active = true
@group_window.visible = true
@item_window.index = -1
return
end
end
# Original Call
gnd_update_item
end
#--------------------------------------------------------------------------
# * Frame Update (when detail window is active)
#--------------------------------------------------------------------------
def update_detail
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
unless $game_party.item_can_use?(@item.id)
@item_window.refresh
end
@item_window.active = true
@itemdetail_window.visible = false
@itemdetail_window.active = false
@itemdetail_window.refresh2
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when group window is active)
#--------------------------------------------------------------------------
def update_group
$game_temp.gnd_window = @group_window.index
if @now_itemkind != @group_window.index
@item_window.refresh
@item_window.top_row = 0
@now_itemkind = @group_window.index
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
if @item_window.active != true
$scene = Scene_Menu.new(0)
else
@group_window.active = true
@item_window.active = false
end
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@item_window.active = true
@item_window.index = 0
@group_window.active = false
return
end
end
end



#==============================================================================
# ** Scene_Skill
#------------------------------------------------------------------------------
# This class performs skill screen processing.
#==============================================================================

class Scene_Skill
#--------------------------------------------------------------------------
# * Object Initialization
# actor_index : actor index
#--------------------------------------------------------------------------
if $gnd_sdk_detect
alias gnd_init initialize
def initialize(actor_index = 0)
gnd_init(actor_index)
# Attach the Limit Menu Flag
$game_temp.limit_menu = false
end
else
alias gnd_init initialize
def initialize(actor_index = 0, equip_index = 0)
gnd_init(actor_index, equip_index)
# Attach the Limit Menu Flag
$game_temp.limit_menu = false
end
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
alias gnd_main main
def main
s_actor = $game_party.actors[@actor_index]
# Detail Window Setup
@skilldetail_window = Window_SkillDetail.new
@skilldetail_window.visible = false
@skilldetail_window.active = false
# If the Grouping system is enabled...
if GROUP_SKILL_ON
# Group Window Setup
@group_window = Window_SkillGroup.new(s_actor)
@group_window.y = 64
$game_temp.interrupt_transition = true
end
# Original Call
gnd_main
# Detail Window Dispose
@skilldetail_window.dispose
# If the Grouping system is enabled...
if GROUP_SKILL_ON
# Group Window Dispose
@group_window.dispose
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
alias gnd_update update
def update
# Detail Update
$game_temp.gnd_highlight = @skill_window.skill
# If the Grouping system is enabled...
if GROUP_SKILL_ON
# Group Update
unless @window_initialize
@status_window.y = 128
@target_window.z = 2100
@group_window.help_window = @help_window
@window_initialize = true
$game_temp.interrupt_transition = false
Graphics.transition
end
unless $gnd_sdk_detect
@group_window.update
end
end
# Original Call
gnd_update
# detail window
if @skilldetail_window.active
update_detail
return
end
# If the Grouping system is enabled...
if GROUP_SKILL_ON
# group window
if @group_window.active
update_group
return
end
end
end
#--------------------------------------------------------------------------
# * Frame Update (when detail window is active)
#--------------------------------------------------------------------------
def update_detail
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@skill_window.active = true
@skilldetail_window.visible = false
@skilldetail_window.active = false
@skilldetail_window.refresh2
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (if group window is active)
#--------------------------------------------------------------------------
def update_group
$game_temp.gnd_window = @group_window.index
if @now_skillkind != @group_window.index
@skill_window.refresh
@skill_window.top_row = 0
@now_skillkind = @group_window.index
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
if @skill_window.active != true
$scene = Scene_Menu.new(1)
else
@group_window.active = true
@skill_window.active = false
end
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@skill_window.active = true
@skill_window.index = 0
@group_window.active = false
return
end
if Input.trigger?(Input::R)
$game_system.se_play($data_system.cursor_se)
@actor_index += 1
@actor_index %= $game_party.actors.size
$scene = Scene_Skill.new(@actor_index)
return
end
if Input.trigger?(Input::L)
$game_system.se_play($data_system.cursor_se)
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
$scene = Scene_Skill.new(@actor_index)
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (if skill window is active)
#--------------------------------------------------------------------------
alias gnd_update_skill update_skill
def update_skill
# If the Details system is enabled...
if DETAILS_SKILL_ON
# if detail window button
if Input.trigger?(Input::A)
if $game_temp.gnd_highlight == nil
return
end
$game_system.se_play($data_system.decision_se)
@skilldetail_window.refresh
@skill_window.active = false
@skilldetail_window.visible = true
@skilldetail_window.active = true
end
end
# If the Grouping system is enabled...
if GROUP_SKILL_ON
# if group window button
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@group_window.active = true
@group_window.visible = true
@skill_window.index = -1
return
end
end
# Original call
gnd_update_skill
end
end



#==============================================================================
# ** Scene_Equip
#------------------------------------------------------------------------------
# This class performs equipment screen processing.
#==============================================================================

class Scene_Equip
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
alias gnd_main main
def main
# Detail Window Setup
@itemdetail_window = Window_ItemDetail.new
@itemdetail_window.visible = false
@itemdetail_window.active = false
# Original Call
gnd_main
# Detail Window Dispose
@itemdetail_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
alias gnd_update update
def update
# Detail
$game_temp.gnd_highlight = @item_window.item
# Original Call
gnd_update
# update Detail
if @itemdetail_window.active
update_detail
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when item window is active)
#--------------------------------------------------------------------------
alias gnd_update_item update_item
def update_item
# If the Details system is enabled...
if DETAILS_EQUIP_ON
# If Detail Button Pressed
if Input.trigger?(Input::A)
if $game_temp.gnd_highlight == nil
return
end
$game_system.se_play($data_system.decision_se)
@itemdetail_window.refresh
@item_window.active = false
@itemdetail_window.visible = true
@itemdetail_window.active = true
end
end
# Original Call
gnd_update_item
end
#--------------------------------------------------------------------------
# * Frame Update (when detail window is active)
#--------------------------------------------------------------------------
def update_detail
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
unless $game_party.item_can_use?(@item.id)
@item_window.refresh
end
@item_window.active = true
@itemdetail_window.visible = false
@itemdetail_window.active = false
@itemdetail_window.refresh2
return
end
end
end



#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================

class Scene_Battle
#--------------------------------------------------------------------------
# * Frame Update (actor command phase : item selection)
#--------------------------------------------------------------------------
def update_phase3_item_select
# Branch if RTAB detected
if $game_system.gnd_rtab
battler = @active_actor
else
battler = @active_battler
end
@item_window.visible = true
if GROUP_ITEMS_ON
if @item_group_select
unless B_I_WINDOW
@help_window.visible = false
end
@item_window.active = false
@item_group_window.visible = true
@item_group_window.active = true
else
@help_window.visible = true
@item_window.active = true
@item_group_window.visible = false
@item_group_window.active = false
end
else
@help_window.visible = true
@item_window.active = true
end
unless $gnd_sdk_detect
@item_window.update
end
if GROUP_ITEMS_ON
unless $gnd_sdk_detect
@item_group_window.update
end
if @now_itemkind != @item_group_window.index
$game_temp.gnd_window = @item_group_window.index
@item_window.refresh
@item_window.top_row = 0
@now_itemkind = @item_group_window.index
if B_I_WINDOW
@help_window.set_text(ITEM_ARRAY[@now_itemkind][3])
end
end
end

if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
if GROUP_ITEMS_ON
if @item_group_select
end_item_select
else
@item_group_select = true
@item_window.index = -1
end
else
end_item_select
end
return
end

if Input.trigger?(Input::C)
if GROUP_ITEMS_ON
if @item_group_select
$game_system.se_play($data_system.decision_se)
@item_group_select = false
@item_window.index = 0
else
@item = @item_window.item
unless $game_party.item_can_use?(@item.id)
$game_system.se_play($data_system.buzzer_se)
return
end
# If item is a weapon (unusable, no scope)
if @item.is_a?(RPG::Weapon)
$game_system.se_play($data_system.buzzer_se)
return
end
# If item is armor (unusable, no scope)
if @item.is_a?(RPG::Armor)
$game_system.se_play($data_system.buzzer_se)
return
end
if @help_window2 != nil
@help_window2.visible = false
else
@help_window.visible = false
end
$game_system.se_play($data_system.decision_se)
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
end
else
@item = @item_window.item
unless $game_party.item_can_use?(@item.id)
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
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
end
return
end
end
#--------------------------------------------------------------------------
# * Start Item Select
#--------------------------------------------------------------------------
alias gnd_sis start_item_select
def start_item_select
# Original call
gnd_sis
if GROUP_ITEMS_ON
if B_I_WINDOW
# Re-position right overtop of the actor command window
@item_group_window = Window_ItemGroup2.new
@item_group_window.x = @actor_command_window.x
@item_group_window.y = @actor_command_window.y
@item_group_window.height = @actor_command_window.height
@item_group_window.width = @actor_command_window.width
else
@item_group_window = Window_ItemGroup.new
@item_group_window.y = @help_window2 != nil ? 64 : 0
end
@item_group_window.back_opacity = 160
@item_group_select = true
@now_itemkind = nil
if @help_window2 != nil
@item_group_window.help_window = @help_window2
end
end
end
#--------------------------------------------------------------------------
# * End Skill Select
#--------------------------------------------------------------------------
alias gnd_eis end_item_select
def end_item_select
# Original Call
gnd_eis
if GROUP_ITEMS_ON
# Skill Group dispose
@item_group_window.dispose
@item_group_window = nil
end
end
#--------------------------------------------------------------------------
# * Frame Update (actor command phase : skill selection)
#--------------------------------------------------------------------------
def update_phase3_skill_select
# Branch if RTAB detected
if $game_system.gnd_rtab
battler = @active_actor
else
battler = @active_battler
end
@skill_window.visible = true
# Ensure only Limit Break for proper conditions
if $gnd_lb_patch && $game_system.lb_attack_detected && $game_temp.limit_menu
$game_temp.limitbreak_skills = true
end
if GROUP_SKILL_ON
if @skill_group_select
unless B_S_WINDOW
@help_window.visible = false
end
@skill_window.active = false
@skill_group_window.visible = true
@skill_group_window.active = true
else
@help_window.visible = true
@skill_window.active = true
@skill_group_window.visible = false
@skill_group_window.active = false
end
else
@help_window.visible = true
@skill_window.active = true
end
unless $gnd_sdk_detect
@skill_window.update
end
if GROUP_SKILL_ON
unless $gnd_sdk_detect
@skill_group_window.update
end
if @now_skillkind != @skill_group_window.index
$game_temp.gnd_window = @skill_group_window.index
@skill_window.refresh
@skill_window.top_row = 0
@now_skillkind = @skill_group_window.index
if B_S_WINDOW
temp_array = []
unless ACTOR_S_ARRAY.include?(battler.id)
@help_window.set_text(SKILL_ARRAY[@now_skillkind][3])
else
temp_array = ACTOR_S_ARRAY[battler.id]
@help_window.set_text(temp_array[@now_skillkind][3])
end
end
end
end

if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
if GROUP_SKILL_ON
# This 'if' assumes GnD, LB Menu (ON) and Attack Replacer combined
if $gnd_lb_patch && $game_system.lb_attack_detected && $game_temp.limit_menu
end_skill_select
else
if @skill_group_select
end_skill_select
else
@skill_group_select = true
@skill_window.index = -1
end
end
else
end_skill_select
end
return
end
if Input.trigger?(Input::C)
if GROUP_SKILL_ON
if @skill_group_select
$game_system.se_play($data_system.decision_se)
@skill_group_select = false
@skill_window.index = 0
else
@skill = @skill_window.skill
if @skill == nil || !battler.skill_can_use?(@skill.id)
$game_system.se_play($data_system.buzzer_se)
return
end
if @help_window2 != nil
@help_window2.visible = false
else
@help_window.visible = false
end
$game_system.se_play($data_system.decision_se)
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
end
else
@skill = @skill_window.skill
if @skill == nil || !battler.skill_can_use?(@skill.id)
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
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
end
return
end
end
#--------------------------------------------------------------------------
# * Start Skill Select
#--------------------------------------------------------------------------
unless $gnd_lb_patch
alias gnd_sss start_skill_select
def start_skill_select
# Original call
gnd_sss
# Branch if RTAB detected
if $game_system.gnd_rtab
battler = @active_actor
else
battler = @active_battler
end
if GROUP_SKILL_ON
# Skill Group
if B_S_WINDOW
# Re-position right overtop of the actor command window
@skill_group_window = Window_SkillGroup2.new(battler)
@skill_group_window.x = @actor_command_window.x
@skill_group_window.y = @actor_command_window.y
@skill_group_window.height = @actor_command_window.height
@skill_group_window.width = @actor_command_window.width
else
@skill_group_window = Window_SkillGroup.new(battler)
@skill_group_window.y = @help_window2 != nil ? 64 : 0
end
@skill_group_window.back_opacity = 160
@skill_group_select = true
@now_skillkind = nil
if @help_window2 != nil
@skill_group_window.help_window = @help_window2
end
end
end
end
#--------------------------------------------------------------------------
# * End Skill Select
#--------------------------------------------------------------------------
alias gnd_ess end_skill_select
def end_skill_select
# Original Call
gnd_ess
if GROUP_SKILL_ON
# Skill Group dispose
@skill_group_window.dispose
@skill_group_window = nil
end
end
end

#==============================================================================
# ** Limit Break (DVV's)
#------------------------------------------------------------------------------
# by DerVVulfman
# version 2.3
# 07-05-2007
# Full SDK 2.2 Compatible (Does not need or require SDK 2.2)
#------------------------------------------------------------------------------
#
# INTRODUCTION:
#
# This system is a revamped & rewritten system that disables 'element-tagged'
# skills until the hero's limitbreak bar is filled. Once the skill is used,
# the skill becomes disabled again. Works with and without the RTAB system.
#
# One feature that was sadly lacking in all other systems was the inability
# to fill the limitbreak bar with item damage. Previous systems only looked
# to damage inflicted through attacks and skill use. Items such as grenades
# were entirely overlooked.
#
# It has been designed 'menu-less' by intent, and this is to prevent any pos-
# sible conflicts with any custom menu system. However Alistor (RMXP.ORG) has
# designed a menu system that can change an actor's limit break fill-type:
# (Attack/Defend/Guard). It is ready for plug-n-play use.
#
# The system, by itself, does not change the 'ATTACK' option in the Actor's
# command window either. Instead, this system enables/disables the skills
# in the skill menu for you to select. Another add-on has been created by
# me to change the 'Attack' option for you. * It's been asked for. :) *
#
# It still requires a bar-drawing system such as 'Cogwheel's HP/SP/EXP Gauge'
# script to draw the Limit Break bar, unless a suitable Bar Drawing script is
# available. However, when not using a bar-drawing system, you merely do not
# have bars visible in-game. Previous versions either had their own built-in
# cheaply designed bar system, or required a separate script to prevent the
# project from crashing. This system neither needs bars to be drawn or re-
# quires a bar system to prevent crashes.
#
#------------------------------------------------------------------------------
#
# SYSTEMS OF NOTE:
#
# While most of the configuration system is set via CONSTANTS, the 'Flexible
# Positioning System' is set via ($)Global values that can be edited from any
# MAP EVENT script call. That way, positioning of the bars can be changed
# based on which menu or battlestatus window you are using at the time. The
# RTAB battlesystem uses its own set of $Global values ($lb_rtab_pos & _var)
# as it has an almost unique way to draw its own BattleStatus window. The
# ParaDog v 2.58 battlesystem also uses these two values for its own limit
# break bar placement.
#
# The $lb_hidden global array can hold the ID of actors in your database that
# do not have their Limit Break bars visible on the screen. It also disables
# the Limit Break Sound Effect from playing if the same actor's 'limit-break'
# value has maxed out (his/her non-visible bar becomes filled). As a $global
# value, it too can be edited from any MAP EVENT script call.
#
#------------------------------------------------------------------------------
#
# COMPATABILITY:
#
# This system has been designed initially for the default and RTAB battlesys-
# tems, however by the use of ALIASes throughout the system... this script is
# also SDK 2.2 compliant, and compliant with both the XRXS #65 and the Para-
# Dog V 2.58 battlesystem:
#
# RE: ParaDog's V 2.58
# * As stated above, the ParaDog system also uses the same section of the
# 'Flexible Positioning System as RTAB. This allows the use of Verti-
# cally aligned Limit Break bars instead of the default Horizontal bars.
#
#
#------------------------------------------------------------------------------
#
# CREDITS AND THANKS:
#
# Thanks goes to link2795 for discovering the 'healing items/RTAB' bug. And
# to Jaide for recommending the 'Death Wipe' feature, & finding an RTAB bug.
#
#==============================================================================


#=======================================================================#
# ** C O N F I G U R A T I O N S Y S T E M ** #
#=======================================================================#

# Name of the Limit Break element
LB_NAME = "TRANSFORM"


# Starting/Default Limit Break Setting
LB_START = 0 # 0 = Attack | 1 = Critical | 2 = Damaged
# 3 = Killed an enemy | 4 = Killed a Boss | 5 = Hero Died
# 6 = Victory | 7 = Escape/Flee | 8 = Defending
# 9 = Lone Combatant | 10 = Any Action | 11 = Crit. Health


# Enemy Bosses (by ID)
# Related to the LB_Rate, it determines if points garnered through 'killing'
# an ememy gives regular 'enemy' points or 'boss' points to your LB gauge.
LB_BOSSES = [nil] # Set to enemy 17 (Skeleton)

# Hidden Actors (by ID)
# This array holds the ID number of Actors who hide their own Limit Break bars
# in both the battle and menu screens. Will only apply to both battle & menu.
$lb_hidden = [nil] # Set to actor #7: Gloria


# Limit Break Max Value
LB_MAX = 1000


# Limit Break Fill Rates
# For flat rates & max value settings, the max value should not exceed LB_MAX.
LB_RATE = [ 10, 50, 200, # Hero Attacks the Enemy (rate, min., max.)
25, 25, 1000, # Hero delivers a CRITICAL! (rate, min., max.)
30, 1, 1000, # Hero takes Damage (rate, min., max.)
500, 750, 900, # Fatalaties: Enemy, Boss or Self (flat rate)
200, 200, 100, # Victory, Escape & Defending (flat rate)
160, 40, 160] # Loner, Action & Crit. Health (flat rate)

# Limit Break Death Wipe
# This supercedes the LB_RATE condition for the 'Hero Died' setting.
LB_D_WIPE = true # If true, death wipes out their LB points.


# Flexible positioning system. Default position appears under the STATUS txt.
$lb_menu_on = 1 # If set to '1', the bar is shown in the menu.
$lb_menu_pos = [ 0, 0, 190] # Positioning in the menu: X, Y, & bar width.
$lb_battle_pos = [ 0, 64, 120] # Positioning in the battle menu. Same setup.

# For special consideration... # RTAB and ParaDog Limit break bars use below.

$lb_rtab_pos = [ 0, -25, 111] # Position if using RTAB system. Same setup.
$lb_rtab_var = [0, 40] # Variable distances between hero's LB gauges.


# SE played when Limit Break filled
LB_RING = "006-System06"


#------------------------------------------------------------------------------#
# Do not edit below unless you know what you're doing. The following code is #
# for automatic systems in the script. Values are edited or passed elsewhere. #
#------------------------------------------------------------------------------#

# Stores the battler id for item users (needed for non-RTAB systems)
$item_user = nil
# Obtain the Limit Break 'id' from the system
$data_system = load_data("Data/System.rxdata")
$lb_element_id = $data_system.elements.index(LB_NAME)

#========================================================================
# C O N F I G U R A T I O N S Y S T E M E N D #
#========================================================================


module Limit_Shortcuts
#--------------------------------------------------------------------------
# * Attack / Struck an enemy (for type 0 conditions)
# aggressor : battler
# victim : battler
#--------------------------------------------------------------------------
def lb_attacker(aggressor, victim, current_dmg)
# Check to make sure the victim is an enemy and the aggressor is self
if aggressor.is_a?(Game_Actor) && victim.is_a?(Game_Enemy) && aggressor.lb_type == 0
# Limit Break growth calculation
lb_calc = current_dmg * LB_RATE[0] * 10 / victim.base_damage
# Adjust Limit Break growth between min & max values
lb_add = [[lb_calc, LB_RATE[1]].max, LB_RATE[2]].min
# OD gauge increase
aggressor.limitbreak += lb_add
end
end
#--------------------------------------------------------------------------
# * Damaged by an enemy (for type 2 conditions)
# aggressor : battler
# victim : battler
#--------------------------------------------------------------------------
def lb_damaged(aggressor, victim, current_dmg)
# Check to make sure the agressor is an enemy and the victim is self
if aggressor.is_a?(Game_Enemy) && victim.is_a?(Game_Actor) && victim.lb_type == 2
lb_calc = current_dmg * LB_RATE[6] * 10 / victim.maxhp
# Adjust Limit Break growth between min & max values
lb_add = [[lb_calc, LB_RATE[7]].max, LB_RATE[8]].min
victim.limitbreak += lb_add
end
end
end

#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
# This class handles data surrounding the system. Backround music, etc.
# is managed here as well. Refer to "$game_system" for the instance of
# this class.
#==============================================================================

class Game_System
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
# Additional values for the save/load feature
attr_accessor :lb_rtab_detected # Detect RTAB system
attr_accessor :lb_para_detected # Detect ParaDog system
attr_accessor :lb_mn # menu on
attr_accessor :lb_mp # menu position
attr_accessor :lb_bp # battle position
attr_accessor :lb_rp # rtab position
attr_accessor :lb_rv # rtab variance
attr_accessor :lb_h # hidden
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias lb_init initialize
def initialize
# Perform the original call
lb_init
@lb_rtab_detected = nil
@lb_para_detected = nil
# Create the savable values
@lb_mn = 0
@lb_mp = []
@lb_bp = []
@lb_rp = []
@lb_rv = []
@lb_h = []
end
end



#==============================================================================
# ** Scene_Save
#------------------------------------------------------------------------------
# This class performs save screen processing.
#==============================================================================

class Scene_Save < Scene_File
#--------------------------------------------------------------------------
# * Write Save Data
# file : write file object (opened)
#--------------------------------------------------------------------------
alias lb_wsd write_save_data
def write_save_data(file)
# Store the globals
$game_system.lb_mn = $lb_menu_on
$game_system.lb_mp = $lb_menu_pos
$game_system.lb_bp = $lb_battle_pos
$game_system.lb_rp = $lb_rtab_pos
$game_system.lb_rv = $lb_rtab_var
$game_system.lb_h = $lb_hidden
# Perform the original call
lb_wsd(file)
end
end



#==============================================================================
# ** Scene_Load
#------------------------------------------------------------------------------
# This class performs load screen processing.
#==============================================================================

class Scene_Load < Scene_File
#--------------------------------------------------------------------------
# * Read Save Data
# file : file object for reading (opened)
#--------------------------------------------------------------------------
alias lb_rsd read_save_data
def read_save_data(file)
#Perform the original call
lb_rsd(file)
# ReStore the globals
$lb_menu_on = $game_system.lb_mn
$lb_menu_pos = $game_system.lb_mp
$lb_battle_pos = $game_system.lb_bp
$lb_rtab_pos = $game_system.lb_rp
$lb_rtab_var = $game_system.lb_rv
$lb_hidden = $game_system.lb_h
end
end



#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
# This class deals with battlers. It's used as a superclass for the Game_Actor
# and Game_Enemy classes.
#==============================================================================

class Game_Battler
include Limit_Shortcuts
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :max_ct
attr_accessor :base_damage
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias lb_init initialize
def initialize
lb_init
if max_ct != nil
$game_system.lb_para_detected = true
end
end
#--------------------------------------------------------------------------
# * Applying Normal Attack Effects (Edited)
# attacker : battler
#--------------------------------------------------------------------------
alias lb_attack_effect attack_effect
def attack_effect(attacker)
# Attach base damage to battler (for self.base_damage)
@base_damage = nil
# Execute the original process
result = lb_attack_effect(attacker)
# Set current damage (rtab or not)
current_dmg = self.damage
if $game_system.lb_rtab_detected; current_dmg = self.damage[attacker]; end
# Set crit flag (rtab or not)
current_crit = self.critical
if $game_system.lb_rtab_detected; current_crit = self.critical[attacker]; end
# Calculate basic damage
if @base_damage == nil
@base_damage =
[attacker.atk - self.pdef / 2, 0].max * (20 + attacker.str) / 20
end
# When actual physical damage is applied
if result && current_dmg.is_a?(Numeric) && self.base_damage > 0
# When HERO attacking the enemy (and tagged for 'Attack')
lb_attacker(attacker, self, current_dmg)
# If the HERO made a critical hit on the Enemy
if attacker.is_a?(Game_Actor) && self.is_a?(Game_Enemy) && attacker.lb_type == 1
if current_crit
# Limit Break growth calculation
lb_calc = current_dmg * LB_RATE[3] * 10 / self.base_damage
# Adjust Limit Break growth between min & max values
lb_add = [[lb_calc, LB_RATE[4]].max, LB_RATE[5]].min
# OD gauge increase
attacker.limitbreak += lb_add
end
end
# When HERO is damaged by the enemy (and tagged for 'Damaged')
lb_damaged(attacker, self, current_dmg)
end
return result
end
#--------------------------------------------------------------------------
# * Apply Skill Effects
# user : the one using skills (battler)
# skill : skill
#--------------------------------------------------------------------------
alias lb_skill_effect skill_effect
def skill_effect(user, skill)
# Attach base damage to battler (for self.base_damage)
@base_damage = nil
# Execute the original process
result = lb_skill_effect(user, skill)
# Set current damage (rtab or not)
current_dmg = self.damage
if $game_system.lb_rtab_detected; current_dmg = self.damage[user]; end
# Recalculate the base (unadjusted) damage
if @base_damage == nil
# Calculate power
power = skill.power + user.atk * skill.atk_f / 100
if power > 0
power -= self.pdef * skill.pdef_f / 200
power -= self.mdef * skill.mdef_f / 200
power = [power, 0].max
end
# Calculate rate
rate = 20
rate += (user.str * skill.str_f / 100)
rate += (user.dex * skill.dex_f / 100)
rate += (user.agi * skill.agi_f / 100)
rate += (user.int * skill.int_f / 100)
# Calculate basic damage
@base_damage = power * rate / 20
end
# When actual physical damage is applied
if result && current_dmg.is_a?(Numeric) && self.base_damage > 0
# When HERO attacking the enemy (and tagged for 'Attack')
lb_attacker(user, self, current_dmg)
# When HERO is damaged by the enemy (and tagged for 'Damaged')
lb_damaged(user, self, current_dmg)
end
# When limitbreak skill is used
if user.is_a?(Game_Actor) && skill.element_set.include?($lb_element_id)
# Reset gauge
user.limitbreak = 0
end
return result
end
#--------------------------------------------------------------------------
# * Application of Item Effects
# item : item
#--------------------------------------------------------------------------
alias lb_item_effect item_effect
def item_effect(item, battler = @active_battler)
# Attach base damage to battler (for self.base_damage)
@base_damage = nil
# Set 'user' to the current battler (and ensure if RTAB)
user = $item_user
if $game_system.lb_rtab_detected; user = battler; end
# Execute the original process (RTAB or not)
if $game_system.lb_rtab_detected
result = lb_item_effect(item, user)
else
result = lb_item_effect(item)
end
# Set current damage (rtab or not)
current_dmg = self.damage
if $game_system.lb_rtab_detected; current_dmg = self.damage[user]; end
# Recalculate the base (unadjusted) damage
if @base_damage == nil
#Calculate power
power = maxhp * item.recover_hp_rate / 100 + item.recover_hp
if power < 0
power += self.pdef * item.pdef_f / 20
power = [power, 0].min
end
# Set damage value and reverse item power amount
@base_damage = -power
end
# When actual physical damage is applied
if result && current_dmg.is_a?(Numeric) && self.base_damage > 0
# When HERO attacking the enemy (and tagged for 'Attack')
lb_attacker(user, self, current_dmg)
# When HERO is damaged by the enemy (and tagged for 'Damaged')
lb_damaged(user, self, current_dmg)
end
return result
end
end



#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles the actor. It's used within the Game_Actors class
# ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================

class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :limitbreak # Limitbreak value
attr_accessor :lb_type # Limitbreak action type
attr_accessor :limitbreak_ring # Limit Break Ring Checker
attr_accessor :battle_started
#--------------------------------------------------------------------------
# * Setup
# actor_id : actor ID
#--------------------------------------------------------------------------
alias lb_setup setup
def setup(actor_id)
# Perform the original call
lb_setup(actor_id)
@limitbreak = 0 # Reset Limit Break gauge to zero
@lb_type = LB_START # Set the Limit Break type to 'config' settings.
@limitbreak_ring = false # Turn the 'ring' off
@battle_started = false
end
#--------------------------------------------------------------------------
# * Determine if Skill can be Used
# skill_id : skill ID
#--------------------------------------------------------------------------
alias lb_skill_can_use? skill_can_use?
def skill_can_use?(skill_id)
# Get result from original call
result = lb_skill_can_use?(skill_id)
# Return if already disabled
return if result == false
# Obtain skill from database
skill = $data_skills[skill_id]
# Only perform if skill
if skill != nil
# Only perform if includes the Element
if skill.element_set.include?($lb_element_id)
# If the limitbreak bar is filled, skill is available
if self.limitbreak == LB_MAX
result = true
# Otherwise, it isn't
else
result = false
end
end
end
return result & super
end
#--------------------------------------------------------------------------
# * Adjust the limitbreak value (permits addition & keeps within range)
#--------------------------------------------------------------------------
def limitbreak=(limitbreak)
@limitbreak = limitbreak
@limitbreak = LB_MAX if @limitbreak > LB_MAX
@limitbreak = 0 if @limitbreak < 0
end
#--------------------------------------------------------------------------
# * Acquire Limit Break value (nil values won't cause errors now)
#--------------------------------------------------------------------------
def limitbreak
# Return 0 if nil (prevent errors)
@limitbreak = 0 if @limitbreak == nil
return @limitbreak
end
end



#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This class is for all in-game windows.
#==============================================================================
class Window_Base
#--------------------------------------------------------------------------
# * Draw Actor Name
#--------------------------------------------------------------------------
alias lb_draw_actor_name draw_actor_name
def draw_actor_name(actor, x, y)
# Only perform if the actor isn't hidden
unless $lb_hidden.include?(actor.id)
# Set/reset the x, y and width of the Limit Break bar.
ox = $game_temp.in_battle ? $lb_battle_pos[0] : $lb_menu_pos[0]
oy = $game_temp.in_battle ? $lb_battle_pos[1] : $lb_menu_pos[1]
ow = $game_temp.in_battle ? $lb_battle_pos[2] : $lb_menu_pos[2]
# To menu... or not to menu
if $lb_menu_on == 1 && !$game_temp.in_battle
draw_actor_lb(actor, x + ox, y + oy + 32, ow)
elsif $game_temp.in_battle
unless $game_system.lb_rtab_detected or $game_system.lb_para_detected
draw_actor_lb(actor, x + ox, y + oy + 32, ow)
end
end
end
lb_draw_actor_name(actor, x, y)
end
#--------------------------------------------------------------------------
# * Draw Battler Name
#--------------------------------------------------------------------------
# If the BattleStatus value of 'Alignment' exists
if $bstat_align != nil
alias lb_draw_battler_name draw_battler_name
def draw_battler_name(actor, x, y)
# Only perform if the actor isn't hidden
unless $lb_hidden.include?(actor.id)
# Set/reset the x, y and width of the Limit Break bar.
ox = $game_temp.in_battle ? $lb_battle_pos[0] : $lb_menu_pos[0]
oy = $game_temp.in_battle ? $lb_battle_pos[1] : $lb_menu_pos[1]
ow = $game_temp.in_battle ? $lb_battle_pos[2] : $lb_menu_pos[2]
# To menu... or not to menu
if $lb_menu_on == 1 && !$game_temp.in_battle
draw_actor_lb(actor, x + ox, y + oy + 32, ow)
elsif $game_temp.in_battle
unless $game_system.lb_rtab_detected or $game_system.lb_para_detected
draw_actor_lb(actor, x + ox, y + oy + 32, ow)
end
end
end
lb_draw_battler_name(actor, x, y)
end
end
#--------------------------------------------------------------------------
# * Draw Limit Break Meter
#--------------------------------------------------------------------------
def draw_actor_lb(actor, x, y, width = 144)
if defined?(gauge_rect)
rate = actor.limitbreak.to_f / LB_MAX
plus_x = 0
rate_x = 0
plus_y = 25
plus_width = 0
rate_width = 100
height = 10
align1 = 1
align2 = 2
align3 = 0
grade1 = 1
grade2 = 0
color1 = Color.new(0, 0, 0, 192)
color2 = Color.new(255, 255, 192, 192)
color3 = Color.new(0, 0, 0, 192)
color4 = Color.new(64, 0, 0, 192)
color5 = Color.new(80 - 24 * rate, 80 * rate, 14 * rate, 192)
color6 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 192)
lb = (width + plus_width) * actor.limitbreak * rate_width / 100 / LB_MAX
gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
width, plus_width + width * rate_width / 100,
height, lb, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
end
end
end



#==============================================================================
# ** Window_BattleStatus
#------------------------------------------------------------------------------
# This window displays the status of all party members on the battle screen.
#==============================================================================
class Window_BattleStatus < Window_Base

alias lb_init initialize
def initialize
lb_init
if defined?(at_refresh)
$game_system.lb_rtab_detected = true
end
refresh
end
#--------------------------------------------------------------------------
# * Full Limit Break Gauge SE
#--------------------------------------------------------------------------
def full_lb_se
if LB_RING != nil
if LB_RING != ""
Audio.se_play("Audio/SE/" + LB_RING, 80, 100)
end
end
end
#--------------------------------------------------------------------------
# * Frame renewal
#--------------------------------------------------------------------------
alias lb_refresh refresh
def refresh(number = 0)
# Call the original def
if $game_system.lb_rtab_detected
lb_refresh(number)
else
lb_refresh
end
# This block is needed only if RTAB in use
if $game_system.lb_rtab_detected or $game_system.lb_para_detected
# Ensure bitmap available for bar drawing
if self.contents == nil
self.contents = Bitmap.new(width - 32 ,height - 32)
end
# Search through actors & draw bar if applicable
if number == 0
for i in 0...$game_party.actors.size
rtab_pos_x = $lb_rtab_pos[0] + ($lb_rtab_var[0] * i)
rtab_pos_y = $lb_rtab_pos[1] + ($lb_rtab_var[1] * i)
unless $lb_hidden.include?($game_party.actors.id)
draw_actor_lb($game_party.actors, rtab_pos_x, rtab_pos_y+10, $lb_rtab_pos[2])
end
end
else
if $game_party.actors[number].is_a?(Game_Actor)
rtab_pos_x = $lb_rtab_pos[0] + ($lb_rtab_var[0] * number)
rtab_pos_y = $lb_rtab_pos[1] + ($lb_rtab_var[1] * number)
unless $lb_hidden.include?($game_party.actors[number].id)
draw_actor_lb($game_party.actors[number], rtab_pos_x, rtab_pos_y+10, $lb_rtab_pos[2])
end
end
end
end
# Go through the Actors
$game_party.actors.each { |actor|
# Only perform if the actor exists
next unless actor.exist?
# When the Limit Break gauge is set to zero,
# Reset the Limit Break Ringer to false
if actor.limitbreak == 0
actor.limitbreak_ring = false
end
# When the Limit Break Ringer hasn't rung
if actor.limitbreak_ring == false
# But, if the Limit Break Bar is filled
if actor.limitbreak == LB_MAX
# Do not permit hidden actor bars to ring
unless $lb_hidden.include?(actor.id)
# If the battle only just started
if actor.battle_started == true
# turn off the battle started flag
actor.battle_started = false
else
# Play the Limit Break Sound Effect
full_lb_se
end
end
# And Set the Limit Break Ringer to true
actor.limitbreak_ring = true
end
end
}
end
end



#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================

class Scene_Battle
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
alias lb_main main
def main
# Ensure that the limitbreak SE doesn't chime at battle start
for i in 0...$game_party.actors.size
if $game_party.actors.limitbreak == LB_MAX
$game_party.actors.battle_started = true
$game_party.actors.limitbreak_ring = true
end
end
lb_main
end
#--------------------------------------------------------------------------
# * Battle Ends
# result : results (0:win 1:lose 2:escape)
#--------------------------------------------------------------------------
alias lb_battle_end battle_end
def battle_end(result)
# Branch on Battle condition
case result
when 0 # Victory
$game_party.actors.each { |actor|
next unless actor.exist?
# For each actor who won & set to Victory
if actor.lb_type == 6
actor.limitbreak += LB_RATE[12]
end
}
when 1 # Escape
$game_party.actors.each { |actor|
next unless actor.exist?
# For each actor who ran & set to Escape
if actor.lb_type == 7
actor.limitbreak += LB_RATE[13]
end
}
end
# Defeat
lb_battle_end(result)
end
#--------------------------------------------------------------------------
# * Frame Update (main phase step 2 : start action)
#--------------------------------------------------------------------------
alias lb_adddate_p4_s2 update_phase4_step2
def update_phase4_step2(battler = @active_battler)
# Perform only if actor
if battler.is_a?(Game_Actor)
# Reset adding value
lb_add = 0
# Branch on LimitBreak type
case battler.lb_type
when 8 # When Defending
if battler.current_action.kind = 0
if battler.current_action.basic == 1
lb_add = LB_RATE[14]
end
end
when 9 # When it's a lone battler
if $game_party.actors.size == 1
lb_add = LB_RATE[15]
end
when 10 # When performing ANY acton
lb_add = LB_RATE[16]
when 11 # If in CRITICAL
if battler.hp <= @active_battler.maxhp / 4
lb_add = LB_RATE[17]
end
end
# Add values to limitbreak
battler.limitbreak += lb_add
end
# Perform the original call
if $game_system.lb_rtab_detected; lb_adddate_p4_s2(battler); else; lb_adddate_p4_s2; end
end
#--------------------------------------------------------------------------
# * Make Item Action Results
#--------------------------------------------------------------------------
alias lb_miar make_item_action_result
def make_item_action_result(battler = @active_battler)
$item_user = battler
# Perform the original call
if $game_system.lb_rtab_detected; lb_miar(battler); else; lb_miar; end
end
#--------------------------------------------------------------------------
# * Frame Update (main phase step 4 : animation for target)
#--------------------------------------------------------------------------
alias lb_update_p4_s4 update_phase4_step4
def update_phase4_step4(battler = @active_battler)
if $game_system.lb_rtab_detected
@status_window.update
@status_window.refresh
end
# Perform the original call
if $game_system.lb_rtab_detected; lb_update_p4_s4(battler); else lb_update_p4_s4 ; end
end
#--------------------------------------------------------------------------
# * Frame Update (main phase step 6 : refresh)
#--------------------------------------------------------------------------
alias lb_up4s6 update_phase4_step6
def update_phase4_step6(battler=@active_battler)
@rtab = !@target_battlers
for target in (@rtab ? battler.target : @target_battlers)
# If a battler has died
if target.dead?
# If the battler is an enemy
if target.is_a?(Game_Enemy)
# If an enemy killed check is performed
if battler.lb_type == 3
battler.limitbreak += LB_RATE[9]
# If a boss enemy check is performed
elsif battler.lb_type == 4
if LB_BOSSES.include?(target.id)
battler.limitbreak += LB_RATE[10]
end
end
# else the battler is an actor
else
# if a 'Hero Dies' check is performed
if target.lb_type == 5
target.limitbreak += LB_RATE[11]
end
# If the Limit Break Death Wipe feature is on
if LB_D_WIPE
target.limitbreak = 0
end
end
if $game_system.lb_rtab_detected
@status_window.update
@status_window.refresh
end
end
end
@rtab ? lb_up4s6(battler) : lb_up4s6
end
end

#==============================================================================
# ** Limit Break (DVV's)
#------------------------------------------------------------------------------
# by DerVVulfman
# version 2.3
# 07-05-2007
# Full SDK 2.2 Compatible (Does not need or require SDK 2.2)
#------------------------------------------------------------------------------
#
# INTRODUCTION:
#
# This system is a revamped & rewritten system that disables 'element-tagged'
# skills until the hero's limitbreak bar is filled. Once the skill is used,
# the skill becomes disabled again. Works with and without the RTAB system.
#
# One feature that was sadly lacking in all other systems was the inability
# to fill the limitbreak bar with item damage. Previous systems only looked
# to damage inflicted through attacks and skill use. Items such as grenades
# were entirely overlooked.
#
# It has been designed 'menu-less' by intent, and this is to prevent any pos-
# sible conflicts with any custom menu system. However Alistor (RMXP.ORG) has
# designed a menu system that can change an actor's limit break fill-type:
# (Attack/Defend/Guard). It is ready for plug-n-play use.
#
# The system, by itself, does not change the 'ATTACK' option in the Actor's
# command window either. Instead, this system enables/disables the skills
# in the skill menu for you to select. Another add-on has been created by
# me to change the 'Attack' option for you. * It's been asked for. :) *
#
# It still requires a bar-drawing system such as 'Cogwheel's HP/SP/EXP Gauge'
# script to draw the Limit Break bar, unless a suitable Bar Drawing script is
# available. However, when not using a bar-drawing system, you merely do not
# have bars visible in-game. Previous versions either had their own built-in
# cheaply designed bar system, or required a separate script to prevent the
# project from crashing. This system neither needs bars to be drawn or re-
# quires a bar system to prevent crashes.
#
#------------------------------------------------------------------------------
#
# SYSTEMS OF NOTE:
#
# While most of the configuration system is set via CONSTANTS, the 'Flexible
# Positioning System' is set via ($)Global values that can be edited from any
# MAP EVENT script call. That way, positioning of the bars can be changed
# based on which menu or battlestatus window you are using at the time. The
# RTAB battlesystem uses its own set of $Global values ($lb_rtab_pos & _var)
# as it has an almost unique way to draw its own BattleStatus window. The
# ParaDog v 2.58 battlesystem also uses these two values for its own limit
# break bar placement.
#
# The $lb_hidden global array can hold the ID of actors in your database that
# do not have their Limit Break bars visible on the screen. It also disables
# the Limit Break Sound Effect from playing if the same actor's 'limit-break'
# value has maxed out (his/her non-visible bar becomes filled). As a $global
# value, it too can be edited from any MAP EVENT script call.
#
#------------------------------------------------------------------------------
#
# COMPATABILITY:
#
# This system has been designed initially for the default and RTAB battlesys-
# tems, however by the use of ALIASes throughout the system... this script is
# also SDK 2.2 compliant, and compliant with both the XRXS #65 and the Para-
# Dog V 2.58 battlesystem:
#
# RE: ParaDog's V 2.58
# * As stated above, the ParaDog system also uses the same section of the
# 'Flexible Positioning System as RTAB. This allows the use of Verti-
# cally aligned Limit Break bars instead of the default Horizontal bars.
#
#
#------------------------------------------------------------------------------
#
# CREDITS AND THANKS:
#
# Thanks goes to link2795 for discovering the 'healing items/RTAB' bug. And
# to Jaide for recommending the 'Death Wipe' feature, & finding an RTAB bug.
#
#==============================================================================


#=======================================================================#
# ** C O N F I G U R A T I O N S Y S T E M ** #
#=======================================================================#

# Name of the Limit Break element
LB_NAME = "TRANSFORM"


# Starting/Default Limit Break Setting
LB_START = 0 # 0 = Attack | 1 = Critical | 2 = Damaged
# 3 = Killed an enemy | 4 = Killed a Boss | 5 = Hero Died
# 6 = Victory | 7 = Escape/Flee | 8 = Defending
# 9 = Lone Combatant | 10 = Any Action | 11 = Crit. Health


# Enemy Bosses (by ID)
# Related to the LB_Rate, it determines if points garnered through 'killing'
# an ememy gives regular 'enemy' points or 'boss' points to your LB gauge.
LB_BOSSES = [nil] # Set to enemy 17 (Skeleton)

# Hidden Actors (by ID)
# This array holds the ID number of Actors who hide their own Limit Break bars
# in both the battle and menu screens. Will only apply to both battle & menu.
$lb_hidden = [nil] # Set to actor #7: Gloria


# Limit Break Max Value
LB_MAX = 1000


# Limit Break Fill Rates
# For flat rates & max value settings, the max value should not exceed LB_MAX.
LB_RATE = [ 10, 50, 200, # Hero Attacks the Enemy (rate, min., max.)
25, 25, 1000, # Hero delivers a CRITICAL! (rate, min., max.)
30, 1, 1000, # Hero takes Damage (rate, min., max.)
500, 750, 900, # Fatalaties: Enemy, Boss or Self (flat rate)
200, 200, 100, # Victory, Escape & Defending (flat rate)
160, 40, 160] # Loner, Action & Crit. Health (flat rate)

# Limit Break Death Wipe
# This supercedes the LB_RATE condition for the 'Hero Died' setting.
LB_D_WIPE = true # If true, death wipes out their LB points.


# Flexible positioning system. Default position appears under the STATUS txt.
$lb_menu_on = 1 # If set to '1', the bar is shown in the menu.
$lb_menu_pos = [ 0, 0, 190] # Positioning in the menu: X, Y, & bar width.
$lb_battle_pos = [ 0, 64, 120] # Positioning in the battle menu. Same setup.

# For special consideration... # RTAB and ParaDog Limit break bars use below.

$lb_rtab_pos = [ 0, -25, 111] # Position if using RTAB system. Same setup.
$lb_rtab_var = [0, 40] # Variable distances between hero's LB gauges.


# SE played when Limit Break filled
LB_RING = "006-System06"


#------------------------------------------------------------------------------#
# Do not edit below unless you know what you're doing. The following code is #
# for automatic systems in the script. Values are edited or passed elsewhere. #
#------------------------------------------------------------------------------#

# Stores the battler id for item users (needed for non-RTAB systems)
$item_user = nil
# Obtain the Limit Break 'id' from the system
$data_system = load_data("Data/System.rxdata")
$lb_element_id = $data_system.elements.index(LB_NAME)

#========================================================================
# C O N F I G U R A T I O N S Y S T E M E N D #
#========================================================================


module Limit_Shortcuts
#--------------------------------------------------------------------------
# * Attack / Struck an enemy (for type 0 conditions)
# aggressor : battler
# victim : battler
#--------------------------------------------------------------------------
def lb_attacker(aggressor, victim, current_dmg)
# Check to make sure the victim is an enemy and the aggressor is self
if aggressor.is_a?(Game_Actor) && victim.is_a?(Game_Enemy) && aggressor.lb_type == 0
# Limit Break growth calculation
lb_calc = current_dmg * LB_RATE[0] * 10 / victim.base_damage
# Adjust Limit Break growth between min & max values
lb_add = [[lb_calc, LB_RATE[1]].max, LB_RATE[2]].min
# OD gauge increase
aggressor.limitbreak += lb_add
end
end
#--------------------------------------------------------------------------
# * Damaged by an enemy (for type 2 conditions)
# aggressor : battler
# victim : battler
#--------------------------------------------------------------------------
def lb_damaged(aggressor, victim, current_dmg)
# Check to make sure the agressor is an enemy and the victim is self
if aggressor.is_a?(Game_Enemy) && victim.is_a?(Game_Actor) && victim.lb_type == 2
lb_calc = current_dmg * LB_RATE[6] * 10 / victim.maxhp
# Adjust Limit Break growth between min & max values
lb_add = [[lb_calc, LB_RATE[7]].max, LB_RATE[8]].min
victim.limitbreak += lb_add
end
end
end

#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
# This class handles data surrounding the system. Backround music, etc.
# is managed here as well. Refer to "$game_system" for the instance of
# this class.
#==============================================================================

class Game_System
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
# Additional values for the save/load feature
attr_accessor :lb_rtab_detected # Detect RTAB system
attr_accessor :lb_para_detected # Detect ParaDog system
attr_accessor :lb_mn # menu on
attr_accessor :lb_mp # menu position
attr_accessor :lb_bp # battle position
attr_accessor :lb_rp # rtab position
attr_accessor :lb_rv # rtab variance
attr_accessor :lb_h # hidden
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias lb_init initialize
def initialize
# Perform the original call
lb_init
@lb_rtab_detected = nil
@lb_para_detected = nil
# Create the savable values
@lb_mn = 0
@lb_mp = []
@lb_bp = []
@lb_rp = []
@lb_rv = []
@lb_h = []
end
end



#==============================================================================
# ** Scene_Save
#------------------------------------------------------------------------------
# This class performs save screen processing.
#==============================================================================

class Scene_Save < Scene_File
#--------------------------------------------------------------------------
# * Write Save Data
# file : write file object (opened)
#--------------------------------------------------------------------------
alias lb_wsd write_save_data
def write_save_data(file)
# Store the globals
$game_system.lb_mn = $lb_menu_on
$game_system.lb_mp = $lb_menu_pos
$game_system.lb_bp = $lb_battle_pos
$game_system.lb_rp = $lb_rtab_pos
$game_system.lb_rv = $lb_rtab_var
$game_system.lb_h = $lb_hidden
# Perform the original call
lb_wsd(file)
end
end



#==============================================================================
# ** Scene_Load
#------------------------------------------------------------------------------
# This class performs load screen processing.
#==============================================================================

class Scene_Load < Scene_File
#--------------------------------------------------------------------------
# * Read Save Data
# file : file object for reading (opened)
#--------------------------------------------------------------------------
alias lb_rsd read_save_data
def read_save_data(file)
#Perform the original call
lb_rsd(file)
# ReStore the globals
$lb_menu_on = $game_system.lb_mn
$lb_menu_pos = $game_system.lb_mp
$lb_battle_pos = $game_system.lb_bp
$lb_rtab_pos = $game_system.lb_rp
$lb_rtab_var = $game_system.lb_rv
$lb_hidden = $game_system.lb_h
end
end



#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
# This class deals with battlers. It's used as a superclass for the Game_Actor
# and Game_Enemy classes.
#==============================================================================

class Game_Battler
include Limit_Shortcuts
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :max_ct
attr_accessor :base_damage
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias lb_init initialize
def initialize
lb_init
if max_ct != nil
$game_system.lb_para_detected = true
end
end
#--------------------------------------------------------------------------
# * Applying Normal Attack Effects (Edited)
# attacker : battler
#--------------------------------------------------------------------------
alias lb_attack_effect attack_effect
def attack_effect(attacker)
# Attach base damage to battler (for self.base_damage)
@base_damage = nil
# Execute the original process
result = lb_attack_effect(attacker)
# Set current damage (rtab or not)
current_dmg = self.damage
if $game_system.lb_rtab_detected; current_dmg = self.damage[attacker]; end
# Set crit flag (rtab or not)
current_crit = self.critical
if $game_system.lb_rtab_detected; current_crit = self.critical[attacker]; end
# Calculate basic damage
if @base_damage == nil
@base_damage =
[attacker.atk - self.pdef / 2, 0].max * (20 + attacker.str) / 20
end
# When actual physical damage is applied
if result && current_dmg.is_a?(Numeric) && self.base_damage > 0
# When HERO attacking the enemy (and tagged for 'Attack')
lb_attacker(attacker, self, current_dmg)
# If the HERO made a critical hit on the Enemy
if attacker.is_a?(Game_Actor) && self.is_a?(Game_Enemy) && attacker.lb_type == 1
if current_crit
# Limit Break growth calculation
lb_calc = current_dmg * LB_RATE[3] * 10 / self.base_damage
# Adjust Limit Break growth between min & max values
lb_add = [[lb_calc, LB_RATE[4]].max, LB_RATE[5]].min
# OD gauge increase
attacker.limitbreak += lb_add
end
end
# When HERO is damaged by the enemy (and tagged for 'Damaged')
lb_damaged(attacker, self, current_dmg)
end
return result
end
#--------------------------------------------------------------------------
# * Apply Skill Effects
# user : the one using skills (battler)
# skill : skill
#--------------------------------------------------------------------------
alias lb_skill_effect skill_effect
def skill_effect(user, skill)
# Attach base damage to battler (for self.base_damage)
@base_damage = nil
# Execute the original process
result = lb_skill_effect(user, skill)
# Set current damage (rtab or not)
current_dmg = self.damage
if $game_system.lb_rtab_detected; current_dmg = self.damage[user]; end
# Recalculate the base (unadjusted) damage
if @base_damage == nil
# Calculate power
power = skill.power + user.atk * skill.atk_f / 100
if power > 0
power -= self.pdef * skill.pdef_f / 200
power -= self.mdef * skill.mdef_f / 200
power = [power, 0].max
end
# Calculate rate
rate = 20
rate += (user.str * skill.str_f / 100)
rate += (user.dex * skill.dex_f / 100)
rate += (user.agi * skill.agi_f / 100)
rate += (user.int * skill.int_f / 100)
# Calculate basic damage
@base_damage = power * rate / 20
end
# When actual physical damage is applied
if result && current_dmg.is_a?(Numeric) && self.base_damage > 0
# When HERO attacking the enemy (and tagged for 'Attack')
lb_attacker(user, self, current_dmg)
# When HERO is damaged by the enemy (and tagged for 'Damaged')
lb_damaged(user, self, current_dmg)
end
# When limitbreak skill is used
if user.is_a?(Game_Actor) && skill.element_set.include?($lb_element_id)
# Reset gauge
user.limitbreak = 0
end
return result
end
#--------------------------------------------------------------------------
# * Application of Item Effects
# item : item
#--------------------------------------------------------------------------
alias lb_item_effect item_effect
def item_effect(item, battler = @active_battler)
# Attach base damage to battler (for self.base_damage)
@base_damage = nil
# Set 'user' to the current battler (and ensure if RTAB)
user = $item_user
if $game_system.lb_rtab_detected; user = battler; end
# Execute the original process (RTAB or not)
if $game_system.lb_rtab_detected
result = lb_item_effect(item, user)
else
result = lb_item_effect(item)
end
# Set current damage (rtab or not)
current_dmg = self.damage
if $game_system.lb_rtab_detected; current_dmg = self.damage[user]; end
# Recalculate the base (unadjusted) damage
if @base_damage == nil
#Calculate power
power = maxhp * item.recover_hp_rate / 100 + item.recover_hp
if power < 0
power += self.pdef * item.pdef_f / 20
power = [power, 0].min
end
# Set damage value and reverse item power amount
@base_damage = -power
end
# When actual physical damage is applied
if result && current_dmg.is_a?(Numeric) && self.base_damage > 0
# When HERO attacking the enemy (and tagged for 'Attack')
lb_attacker(user, self, current_dmg)
# When HERO is damaged by the enemy (and tagged for 'Damaged')
lb_damaged(user, self, current_dmg)
end
return result
end
end



#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles the actor. It's used within the Game_Actors class
# ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================

class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :limitbreak # Limitbreak value
attr_accessor :lb_type # Limitbreak action type
attr_accessor :limitbreak_ring # Limit Break Ring Checker
attr_accessor :battle_started
#--------------------------------------------------------------------------
# * Setup
# actor_id : actor ID
#--------------------------------------------------------------------------
alias lb_setup setup
def setup(actor_id)
# Perform the original call
lb_setup(actor_id)
@limitbreak = 0 # Reset Limit Break gauge to zero
@lb_type = LB_START # Set the Limit Break type to 'config' settings.
@limitbreak_ring = false # Turn the 'ring' off
@battle_started = false
end
#--------------------------------------------------------------------------
# * Determine if Skill can be Used
# skill_id : skill ID
#--------------------------------------------------------------------------
alias lb_skill_can_use? skill_can_use?
def skill_can_use?(skill_id)
# Get result from original call
result = lb_skill_can_use?(skill_id)
# Return if already disabled
return if result == false
# Obtain skill from database
skill = $data_skills[skill_id]
# Only perform if skill
if skill != nil
# Only perform if includes the Element
if skill.element_set.include?($lb_element_id)
# If the limitbreak bar is filled, skill is available
if self.limitbreak == LB_MAX
result = true
# Otherwise, it isn't
else
result = false
end
end
end
return result & super
end
#--------------------------------------------------------------------------
# * Adjust the limitbreak value (permits addition & keeps within range)
#--------------------------------------------------------------------------
def limitbreak=(limitbreak)
@limitbreak = limitbreak
@limitbreak = LB_MAX if @limitbreak > LB_MAX
@limitbreak = 0 if @limitbreak < 0
end
#--------------------------------------------------------------------------
# * Acquire Limit Break value (nil values won't cause errors now)
#--------------------------------------------------------------------------
def limitbreak
# Return 0 if nil (prevent errors)
@limitbreak = 0 if @limitbreak == nil
return @limitbreak
end
end



#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This class is for all in-game windows.
#==============================================================================
class Window_Base
#--------------------------------------------------------------------------
# * Draw Actor Name
#--------------------------------------------------------------------------
alias lb_draw_actor_name draw_actor_name
def draw_actor_name(actor, x, y)
# Only perform if the actor isn't hidden
unless $lb_hidden.include?(actor.id)
# Set/reset the x, y and width of the Limit Break bar.
ox = $game_temp.in_battle ? $lb_battle_pos[0] : $lb_menu_pos[0]
oy = $game_temp.in_battle ? $lb_battle_pos[1] : $lb_menu_pos[1]
ow = $game_temp.in_battle ? $lb_battle_pos[2] : $lb_menu_pos[2]
# To menu... or not to menu
if $lb_menu_on == 1 && !$game_temp.in_battle
draw_actor_lb(actor, x + ox, y + oy + 32, ow)
elsif $game_temp.in_battle
unless $game_system.lb_rtab_detected or $game_system.lb_para_detected
draw_actor_lb(actor, x + ox, y + oy + 32, ow)
end
end
end
lb_draw_actor_name(actor, x, y)
end
#--------------------------------------------------------------------------
# * Draw Battler Name
#--------------------------------------------------------------------------
# If the BattleStatus value of 'Alignment' exists
if $bstat_align != nil
alias lb_draw_battler_name draw_battler_name
def draw_battler_name(actor, x, y)
# Only perform if the actor isn't hidden
unless $lb_hidden.include?(actor.id)
# Set/reset the x, y and width of the Limit Break bar.
ox = $game_temp.in_battle ? $lb_battle_pos[0] : $lb_menu_pos[0]
oy = $game_temp.in_battle ? $lb_battle_pos[1] : $lb_menu_pos[1]
ow = $game_temp.in_battle ? $lb_battle_pos[2] : $lb_menu_pos[2]
# To menu... or not to menu
if $lb_menu_on == 1 && !$game_temp.in_battle
draw_actor_lb(actor, x + ox, y + oy + 32, ow)
elsif $game_temp.in_battle
unless $game_system.lb_rtab_detected or $game_system.lb_para_detected
draw_actor_lb(actor, x + ox, y + oy + 32, ow)
end
end
end
lb_draw_battler_name(actor, x, y)
end
end
#--------------------------------------------------------------------------
# * Draw Limit Break Meter
#--------------------------------------------------------------------------
def draw_actor_lb(actor, x, y, width = 144)
if defined?(gauge_rect)
rate = actor.limitbreak.to_f / LB_MAX
plus_x = 0
rate_x = 0
plus_y = 25
plus_width = 0
rate_width = 100
height = 10
align1 = 1
align2 = 2
align3 = 0
grade1 = 1
grade2 = 0
color1 = Color.new(0, 0, 0, 192)
color2 = Color.new(255, 255, 192, 192)
color3 = Color.new(0, 0, 0, 192)
color4 = Color.new(64, 0, 0, 192)
color5 = Color.new(80 - 24 * rate, 80 * rate, 14 * rate, 192)
color6 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 192)
lb = (width + plus_width) * actor.limitbreak * rate_width / 100 / LB_MAX
gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
width, plus_width + width * rate_width / 100,
height, lb, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
end
end
end



#==============================================================================
# ** Window_BattleStatus
#------------------------------------------------------------------------------
# This window displays the status of all party members on the battle screen.
#==============================================================================
class Window_BattleStatus < Window_Base

alias lb_init initialize
def initialize
lb_init
if defined?(at_refresh)
$game_system.lb_rtab_detected = true
end
refresh
end
#--------------------------------------------------------------------------
# * Full Limit Break Gauge SE
#--------------------------------------------------------------------------
def full_lb_se
if LB_RING != nil
if LB_RING != ""
Audio.se_play("Audio/SE/" + LB_RING, 80, 100)
end
end
end
#--------------------------------------------------------------------------
# * Frame renewal
#--------------------------------------------------------------------------
alias lb_refresh refresh
def refresh(number = 0)
# Call the original def
if $game_system.lb_rtab_detected
lb_refresh(number)
else
lb_refresh
end
# This block is needed only if RTAB in use
if $game_system.lb_rtab_detected or $game_system.lb_para_detected
# Ensure bitmap available for bar drawing
if self.contents == nil
self.contents = Bitmap.new(width - 32 ,height - 32)
end
# Search through actors & draw bar if applicable
if number == 0
for i in 0...$game_party.actors.size
rtab_pos_x = $lb_rtab_pos[0] + ($lb_rtab_var[0] * i)
rtab_pos_y = $lb_rtab_pos[1] + ($lb_rtab_var[1] * i)
unless $lb_hidden.include?($game_party.actors.id)
draw_actor_lb($game_party.actors, rtab_pos_x, rtab_pos_y+10, $lb_rtab_pos[2])
end
end
else
if $game_party.actors[number].is_a?(Game_Actor)
rtab_pos_x = $lb_rtab_pos[0] + ($lb_rtab_var[0] * number)
rtab_pos_y = $lb_rtab_pos[1] + ($lb_rtab_var[1] * number)
unless $lb_hidden.include?($game_party.actors[number].id)
draw_actor_lb($game_party.actors[number], rtab_pos_x, rtab_pos_y+10, $lb_rtab_pos[2])
end
end
end
end
# Go through the Actors
$game_party.actors.each { |actor|
# Only perform if the actor exists
next unless actor.exist?
# When the Limit Break gauge is set to zero,
# Reset the Limit Break Ringer to false
if actor.limitbreak == 0
actor.limitbreak_ring = false
end
# When the Limit Break Ringer hasn't rung
if actor.limitbreak_ring == false
# But, if the Limit Break Bar is filled
if actor.limitbreak == LB_MAX
# Do not permit hidden actor bars to ring
unless $lb_hidden.include?(actor.id)
# If the battle only just started
if actor.battle_started == true
# turn off the battle started flag
actor.battle_started = false
else
# Play the Limit Break Sound Effect
full_lb_se
end
end
# And Set the Limit Break Ringer to true
actor.limitbreak_ring = true
end
end
}
end
end



#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================

class Scene_Battle
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
alias lb_main main
def main
# Ensure that the limitbreak SE doesn't chime at battle start
for i in 0...$game_party.actors.size
if $game_party.actors.limitbreak == LB_MAX
$game_party.actors.battle_started = true
$game_party.actors.limitbreak_ring = true
end
end
lb_main
end
#--------------------------------------------------------------------------
# * Battle Ends
# result : results (0:win 1:lose 2:escape)
#--------------------------------------------------------------------------
alias lb_battle_end battle_end
def battle_end(result)
# Branch on Battle condition
case result
when 0 # Victory
$game_party.actors.each { |actor|
next unless actor.exist?
# For each actor who won & set to Victory
if actor.lb_type == 6
actor.limitbreak += LB_RATE[12]
end
}
when 1 # Escape
$game_party.actors.each { |actor|
next unless actor.exist?
# For each actor who ran & set to Escape
if actor.lb_type == 7
actor.limitbreak += LB_RATE[13]
end
}
end
# Defeat
lb_battle_end(result)
end
#--------------------------------------------------------------------------
# * Frame Update (main phase step 2 : start action)
#--------------------------------------------------------------------------
alias lb_adddate_p4_s2 update_phase4_step2
def update_phase4_step2(battler = @active_battler)
# Perform only if actor
if battler.is_a?(Game_Actor)
# Reset adding value
lb_add = 0
# Branch on LimitBreak type
case battler.lb_type
when 8 # When Defending
if battler.current_action.kind = 0
if battler.current_action.basic == 1
lb_add = LB_RATE[14]
end
end
when 9 # When it's a lone battler
if $game_party.actors.size == 1
lb_add = LB_RATE[15]
end
when 10 # When performing ANY acton
lb_add = LB_RATE[16]
when 11 # If in CRITICAL
if battler.hp <= @active_battler.maxhp / 4
lb_add = LB_RATE[17]
end
end
# Add values to limitbreak
battler.limitbreak += lb_add
end
# Perform the original call
if $game_system.lb_rtab_detected; lb_adddate_p4_s2(battler); else; lb_adddate_p4_s2; end
end
#--------------------------------------------------------------------------
# * Make Item Action Results
#--------------------------------------------------------------------------
alias lb_miar make_item_action_result
def make_item_action_result(battler = @active_battler)
$item_user = battler
# Perform the original call
if $game_system.lb_rtab_detected; lb_miar(battler); else; lb_miar; end
end
#--------------------------------------------------------------------------
# * Frame Update (main phase step 4 : animation for target)
#--------------------------------------------------------------------------
alias lb_update_p4_s4 update_phase4_step4
def update_phase4_step4(battler = @active_battler)
if $game_system.lb_rtab_detected
@status_window.update
@status_window.refresh
end
# Perform the original call
if $game_system.lb_rtab_detected; lb_update_p4_s4(battler); else lb_update_p4_s4 ; end
end
#--------------------------------------------------------------------------
# * Frame Update (main phase step 6 : refresh)
#--------------------------------------------------------------------------
alias lb_up4s6 update_phase4_step6
def update_phase4_step6(battler=@active_battler)
@rtab = !@target_battlers
for target in (@rtab ? battler.target : @target_battlers)
# If a battler has died
if target.dead?
# If the battler is an enemy
if target.is_a?(Game_Enemy)
# If an enemy killed check is performed
if battler.lb_type == 3
battler.limitbreak += LB_RATE[9]
# If a boss enemy check is performed
elsif battler.lb_type == 4
if LB_BOSSES.include?(target.id)
battler.limitbreak += LB_RATE[10]
end
end
# else the battler is an actor
else
# if a 'Hero Dies' check is performed
if target.lb_type == 5
target.limitbreak += LB_RATE[11]
end
# If the Limit Break Death Wipe feature is on
if LB_D_WIPE
target.limitbreak = 0
end
end
if $game_system.lb_rtab_detected
@status_window.update
@status_window.refresh
end
end
end
@rtab ? lb_up4s6(battler) : lb_up4s6
end
end

#==============================================================================
# DerVVulfman's Limit Break Menu v 2.7
# By Alistor, with Edits by DerVVulfman
# Original Concept by SephirothSpawn
#==============================================================================
# This script has an Auto-Detect function that, when used with SDK, replaces the
# internal Window_HorizCommand with the SDK version. Thanks go to DerVVulfman for that
# method. Added a second Auto-Detect function that, when used with the Attack Replacer LB
# Add-On, removes limits from the skill window in battle and vice-versa.
#==============================================================================



#=======================================================================#
# ** C O N F I G U R A T I O N S Y S T E M ** #
#=======================================================================#


# Allows you to hide SP values of zero:
# =====================================
HIDE_ZERO_SP = true


# Basic Menu Text:
# ================
LB_MENU_TITLE = 'Transform' # Menu Title
LB_HEADING_1 = 'View Forms' # Option 1 Text: List of Limit Break Skills
LB_HEADING_2 = 'Set Gain Mode' # Option 2 Text: List of Limit Break Types


# Preset Gain Mode Help Text System:
# =================================+
# This customizes the text shown after you choose the limit break style for an
# actor. Originally hardwired, you can now edit the layout right here.
#
# {lb_a_name} :Actor's Name
# {lb_a_type} :Actor's Gain Mode Text (Limit Type)
LB_GAIN_TEXT = "{lb_a_name}'s Gain Mode is Now {lb_a_type}"
# - Sample output: Aluxes's Gain Mode is now Stotic -
#
# Optionally, you could have it be this:
# LB_GAIN_TEXT = "Gain Mode of {lb_a_type} now set to {lb_a_name}"
# - Sample output: Gain Mode of Victor now set to Gloria -


# Array of Limit Break types:
# ===========================
# This allows you to list the limit break styles or settings available in your
# system. You can choose to list them in any order and pick and choose whether
# a limit break style will even be in your game. You no longer have to use
# 'all' the limit break types available. And as such, this system is already
# designed to accomodate any newer limit break types not yet available.
#
# Idx: The index/setting of a 'limit break type' as defined by LB_START
# Type Name: The basic choice/option of a 'limit break type' in the menu
# Type Desc: A help text description of a 'limit break type'
#
# FORMAT:
# LB_MENU_ARRAY = [ [Limit Array], [Limit Array],... ]
# with...
# Limit Array = [Idx(as number), Type Name(as string), Type Desc(as string)]
#
# NOTE: The array can be set in any order, so the menu options can be arranged
# in any order. What controls the limit break type in use is the 'Idx'
# number in the array.
#
# Idx Type Name Type Desc
LB_MENU_ARRAY = [ [0, 'Warrior', 'Warrior - Gains When Hero Damages Enemy'] ,
[1, 'Heavy Hitter', 'Heavy Hitter - Gains When Hero Lands a Critical Hit'],
[2, 'Beserker', 'Beserker - Gains When Hero Receives Damage'] ,
[3, 'Slayer', 'Slayer - Gains When Hero Kills Enemy'],
[4, 'Godslayer', 'GodSlayer - Gains When Hero Defeats a Boss'],
[5, 'Victim', 'Victim - Gains When Hero is Slain'],
[6, 'Victor', 'Victor - Gains When Party Wins Battle'],
[7, 'Coward', 'Coward - Gains When Hero Escapes Battle'],
[8, 'Defender', 'Defender - Gains When Hero Chooses to Guard'],
[9, 'Loner', 'Loner - Gains When Hero Is Only Member in Party'],
[10, 'Active', 'Active - Gains When Hero Performs an Action'],
[11, 'Daredevil', 'Daredevil - Gains When Hero is in Critical Condition'] ]


#=======================================================================#
# C O N F I G U R A T I O N S Y S T E M E N D #
#=======================================================================#



#==============================================================================
# ** RMXP Standard Development Kit (SDK)
#------------------------------------------------------------------------------
# A system aimed to increase compatibility between RGSS scripts
#==============================================================================
module SDK
# Set Autodetect global to false
$lbadd_menu_sdk = false
# SDK Autodetect routine
if defined?(log_alias)
# Set Autodetect global to true
$lbadd_menu_sdk = true
end
end



#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
# This class handles data surrounding the system. Backround music, etc.
# is managed here as well. Refer to "$game_system" for the instance of
# this class.
#==============================================================================

class Game_System
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :lb_attack_detected
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias lbadd1_init initialize
def initialize
lbadd1_init
if @lb_height != nil
@lb_attack_detected = true
end
end
end



#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
# This class handles temporary data that is not included with save data.
# Refer to "$game_temp" for the instance of this class.
#==============================================================================

class Game_Temp
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :seperation # Seperation flag
attr_accessor :limitbreak_skills # Limit Break skill flag
attr_accessor :limit_menu # Limit Break menu flag
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias lbadd1_init initialize
def initialize
lbadd1_init
@seperation = true
@limitbreak_skills = false
@limit_menu = false
end
end



#==============================================================================
# ** Window_Skill
#------------------------------------------------------------------------------
# This window displays usable skills on the skill and battle screens.
#==============================================================================

class Window_Skill < Window_Selectable
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
unless $gnd_lb_patch
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
unless @actor == nil
for i in 0...@actor.skills.size
skill = $data_skills[@actor.skills]
unless skill == nil
if $game_temp.seperation
if $game_temp.limitbreak_skills
@data.push(skill) if skill.element_set.include?($lb_element_id)
else
@data.push(skill) unless skill.element_set.include?($lb_element_id)
end
else
@data.push(skill)
end
end
end
end
# If item count is not 0, make a bit map and draw all items
@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
$game_temp.seperation = true
$game_temp.limitbreak_skills = false
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
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::Cache.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)
unless HIDE_ZERO_SP && skill.sp_cost == 0
self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
end
end
#--------------------------------------------------------------------------
# * Check Data
#--------------------------------------------------------------------------
def data
return @data
end
end



#==============================================================================
# ** Window Horizontal Command (conditional on SDK system)
#------------------------------------------------------------------------------
# This window deals with general command choices, horizontally.
#==============================================================================

# If no SDK exists...
if !$lbadd_menu_sdk
# Use the Non-SDK system
class Window_HorizCommand < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(commands, width = 640, height = 64)
super(0, 0, width, height)
self.contents = Bitmap.new(width - 32, height - 32)
@commands = commands
@item_max = @commands.size
@column_max = @commands.size
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
x = width / @item_max * index
off = width / @item_max - 32
self.contents.draw_text(x, 0, off, 32, @commands[index], 1)
end
#--------------------------------------------------------------------------
# * Disable Item
# index : item number
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
end
end



#==============================================================================
# ** Scene_LimitMenu
#------------------------------------------------------------------------------
# This class performs limit break screen processing.
#==============================================================================

class Scene_LimitMenu
#--------------------------------------------------------------------------
# * Object Initialization
# actor_index : actor index
#--------------------------------------------------------------------------
def initialize(actor_index = 0)
@actor_index = actor_index
# Attach the Limit Menu flag
$game_temp.limit_menu = true
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
if @actor_index < $game_party.actors.size
@actor = $game_party.actors[@actor_index]
else
@actor = $game_party.reserve_actors[@actor_index - $game_party.actors.size]
end
# Make Help Window
@help_window = Window_Help.new
# Command Window
# If the SDK is disabled
if $lbadd_menu_sdk
@command_window = Window_HorizCommand.new(640, [LB_HEADING_1, LB_HEADING_2])
else
@command_window = Window_HorizCommand.new([LB_HEADING_1, LB_HEADING_2])
end
@command_window.y = 128
# Skill Window
@skill_window = Window_Skill.new(@actor)
@skill_window.y = 192
@skill_window.height = 288
$game_temp.seperation = true
$game_temp.limitbreak_skills = true
@skill_window.refresh
@skill_window.active = false
# Skill Status Window
@status_window = Window_SkillStatus.new(@actor)
@status_window.y = 64
# Limit Break Types Window
@lb_type_window = Window_Limit_Types.new
@lb_type_window.y = 192
@lb_type_window.index = @actor.lb_type
@lb_type_window.visible = @lb_type_window.active = false
# Associate help window
if @skill_window.help_window == nil
@help_window.set_text(LB_MENU_TITLE, 1)
else
@skill_window.help_window = @help_window
end
# Scene Objects
@objects = [@help_window, @command_window, @skill_window, @lb_type_window, @status_window]
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Objects Update
@objects.each {|x| x.update}
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of Objects
@objects.each {|x| x.dispose}
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# If Main Command Active : call update_main
if @command_window.active
update_main
return
end
# If skill window is active: call update_skill
if @skill_window.active
update_skill
return
end
# If Limit Type is active: call update_type
if @lb_type_window.active
update_type
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (if main window is active)
#--------------------------------------------------------------------------
def update_main
# Toggles Windows Visiblity
@skill_window.visible = @command_window.index == 0 ? true : false
@lb_type_window.visible = @command_window.index == 1 ? true : false
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
$scene = Scene_Menu.new(0)
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Branch Point
case @command_window.index
when 0 # View Skills
if @skill_window.data.size == 0
$game_system.se_play($data_system.buzzer_se)
@help_window.set_text(LB_MENU_TITLE, 1)
else
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@skill_window.active = true
end
when 1 # Set Limit Break Type
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@lb_type_window.active = true
@help_window.set_text(@lb_type_window.help_text, 1)
end
end
# If R button was pressed
if Input.trigger?(Input::R)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# To next actor
@actor_index += 1
@actor_index %= $game_party.actors.size
# Switch to different skill screen
$scene = Scene_LimitMenu.new(@actor_index)
return
end
# If L button was pressed
if Input.trigger?(Input::L)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# To previous actor
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
# Switch to different skill screen
$scene = Scene_LimitMenu.new(@actor_index)
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (if main window is active)
#--------------------------------------------------------------------------
def update_skill
# Refreshes Help Window Text
@skill_window.help_window = @help_window
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
@help_window.set_text(LB_MENU_TITLE, 1)
# Switch to main menu
@command_window.active = true
@skill_window.active = false
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (if main window is active)
#--------------------------------------------------------------------------
def update_type
# Refreshes Help Window Text (if triggered once or pressed continuously)
if Input.trigger?(Input::UP) || Input.trigger?(Input::DOWN) ||
Input.trigger?(Input::RIGHT) || Input.trigger?(Input::LEFT) ||
Input.press?(Input::UP) || Input.press?(Input::DOWN) ||
Input.press?(Input::RIGHT) || Input.press?(Input::LEFT)
@help_window.set_text(@lb_type_window.help_text, 1)
end
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
@help_window.set_text(LB_MENU_TITLE, 1)
# Switch to main menu
@command_window.active = true
@lb_type_window.active = false
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Play cancel SE
$game_system.se_play($data_system.decision_se)
# Retrieve Limit Type from array
actor_lb_type = LB_MENU_ARRAY[@lb_type_window.index][0]
# Set Actor Limit Type
@actor.lb_type = actor_lb_type
# Set the character's gain text
lb_a_name = @actor.name
lb_a_type = LB_MENU_ARRAY[@lb_type_window.index][1]
text = LB_GAIN_TEXT.dup
begin
text[/{lb_a_name}/] = "#{lb_a_name}"
rescue
end
begin
text[/{lb_a_type}/] = "#{lb_a_type}"
rescue
end
@help_window.set_text(text, 1)
return
end
end
end



#==============================================================================
# ** Window_Limit_Types
#------------------------------------------------------------------------------
# This window displays the available limit types on the limit break screen.
#==============================================================================

class Window_Limit_Types < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 128, 640, 288)
@column_max = 2
@data = []
for i in 0...LB_MENU_ARRAY.size
@data.push(LB_MENU_ARRAY[1])
end
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Get Type
#--------------------------------------------------------------------------
def get_type
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Help Text
#--------------------------------------------------------------------------
def help_text
for i in 0...LB_MENU_ARRAY.size
text = LB_MENU_ARRAY[2] if LB_MENU_ARRAY[0] == index
end
return text
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
# If item count is not 0, make a bit map and draw all items
@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
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
self.contents.draw_text(x, y, contents.width / 2 - 32, 32, @data[index], 1)
end
end



#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================

class Scene_Battle
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
alias lbmenu_main main
def main
# Autodetect value added
@lb_menu = true
# Perform the original call
lbmenu_main
end
#--------------------------------------------------------------------------
# * Start Skill Selection
#--------------------------------------------------------------------------
unless $gnd_lb_patch
def start_skill_select
# RTAB detection value built into Limit Break (DVV)
# Assigns 'battler' value for the Skill Window.
if $game_system.lb_rtab_detected
battler = @active_actor
else
battler = @active_battler
end
# Make skill window
@skill_window = Window_Skill.new(battler)
if $game_system.lb_attack_detected
$game_temp.seperation = true
$game_temp.limitbreak_skills = false
@skill_window.refresh
else
$game_temp.seperation = false
$game_temp.limitbreak_skills = false
@skill_window.refresh
end
@skill_window.z = 1000
# Associate help window
@skill_window.help_window = @help_window
# Disable actor command window
@actor_command_window.active = false
@actor_command_window.visible = false
end
end
end

#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs menu screen processing.
#==============================================================================

class Scene_Menu
#--------------------------------------------------------------------------
# * Object Initialization
# menu_index : command cursor's initial position
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Make command window
s1 = $data_system.words.item
s2 = $data_system.words.skill
s3 = $data_system.words.equip
s4 = "Status"
s5 = "Forms"
s6 = "Save"
s7 = "End Game"
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
@command_window.index = @menu_index
# If number of party members is 0
if $game_party.actors.size == 0
# Disable items, skills, equipment, and status
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
@command_window.disable_item(4)
end
# If save is forbidden
if $game_system.save_disabled
# Disable save
@command_window.disable_item(5)
end
# Make play time window
@playtime_window = Window_PlayTime.new
@playtime_window.x = 0
@playtime_window.y = 320
# Make gold window
@gold_window = Window_Gold.new
@gold_window.x = 0
@gold_window.y = 416
# Make status window
@status_window = Window_MenuStatus.new
@status_window.x = 160
@status_window.y = 0
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@command_window.dispose
@playtime_window.dispose
@gold_window.dispose
@status_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@command_window.update
@playtime_window.update
@gold_window.update
@status_window.update
# If command window is active: call update_command
if @command_window.active
update_command
return
end
# If status window is active: call update_status
if @status_window.active
update_status
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when command window is active)
#--------------------------------------------------------------------------
def update_command
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to map screen
$scene = Scene_Map.new
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# If command other than save or end game, and party members = 0
if $game_party.actors.size == 0 and @command_window.index < 5
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Branch by command window cursor position
case @command_window.index
when 0 # item
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to item screen
$scene = Scene_Item.new
when 1 # skill
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 2 # equipment
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 3 # status
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 4 # limit
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 5 # save
# If saving is forbidden
if $game_system.save_disabled
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to save screen
$scene = Scene_Save.new
when 6 # end game
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to end game screen
$scene = Scene_End.new
end
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when status window is active)
#--------------------------------------------------------------------------
def update_status
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Make command window active
@command_window.active = true
@status_window.active = false
@status_window.index = -1
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @command_window.index
when 1 # skill
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to skill screen
$scene = Scene_Skill.new(@status_window.index)
when 2 # equipment
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to equipment screen
$scene = Scene_Equip.new(@status_window.index)
when 3 # status
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to status screen
$scene = Scene_Status.new(@status_window.index)
when 4 # limits
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to skill screen
$scene = Scene_LimitMenu.new(@status_window.index)
end
return
end
end
end
#===========================================================================
# *** HP/MP/ATB/LimitBreak bar Slanted Style Compatible with RTAB ***
# *** Version 2.1
#---------------------------------------------------------------------------
# by Clive
# based on Cogwheel's Bars and Sephiroth Spawn's Slanted Bars.
#---------------------------------------------------------------------------
# ----- GREAT THANKS to DerVVulfman for solving the lag problem
#------This is a plug and play script so it should work without any problem!
#=============================================================================

# If using with Limit Break, must paste BELOW the Limit Break script as it re-
# writes the 'Gauge drawing' system. Will cause an error if not properly put.

# If used with Trickster's STEAL SCRIPT version 6 R1 (revision 1), then the
# height of RTAB's AT Bar (Draw Actor ATG) may not be smaller than 5 pixels
# due to a float-to-float error. A height of 6 pixels is the smallest.


#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles the actor. It's used within the Game_Actors class
# ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================

class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Get the current EXP
#--------------------------------------------------------------------------
def now_exp
return @exp - @exp_list[@level]
end
#--------------------------------------------------------------------------
# * Get the next level's EXP
#--------------------------------------------------------------------------
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
end


#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This class is for all in-game windows.
#==============================================================================

class Window_Base < Window

#==========================================================================
# * Draw Slant Bar(by SephirothSpawn)
#==========================================================================
def draw_slant_bar(x, y, min, max, width = 152, height = 6,
bar_color = Color.new(150, 0, 0, 255),
end_color = Color.new(255, 255, 60, 255))
# Draw Border
for i in 0..height
self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255))
end
# Draw Background
for i in 1..(height - 1)
r = 100 * (height - i) / height + 0 * i / height
g = 100 * (height - i) / height + 0 * i / height
b = 100 * (height - i) / height + 0 * i / height
a = 255 * (height - i) / height + 255 * i / height
self.contents.fill_rect(x + i, y + height - i, width, 1, Color.new(r, b, g, a))
end
# Draws Bar
for i in 1..( (min.to_f / max.to_f) * width - 1)
for j in 1..(height - 1)
r = bar_color.red * (width - i) / width + end_color.red * i / width
g = bar_color.green * (width - i) / width + end_color.green * i / width
b = bar_color.blue * (width - i) / width + end_color.blue * i / width
a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
self.contents.fill_rect(x + i + j, y + height - j, 1, 1, Color.new(r, g, b, a))
end
end
end

#==========================================================================
# * Draw HP
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : draw spot width
#==========================================================================
alias :draw_actor_hp_hpsp :draw_actor_hp
def draw_actor_hp(actor, x, y, width = 144)
draw_slant_bar(x, y + 12, actor.hp, actor.maxhp, width, 6,
bar_color = Color.new(150, 0, 0, 255),
end_color = Color.new(255, 255, 60, 255))
draw_actor_hp_hpsp(actor, x, y, width)
end
#==========================================================================
# * Draw SP
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : draw spot width
#==========================================================================
alias :draw_actor_sp_hpsp :draw_actor_sp
def draw_actor_sp(actor, x, y, width = 144)
draw_slant_bar(x, y + 12, actor.sp, actor.maxsp, width, 6,
bar_color = Color.new(0, 0, 155, 255),
end_color = Color.new(255, 255, 255, 255))
draw_actor_sp_hpsp(actor, x, y, width)
end
#==========================================================================
# * Draw EXP
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#==========================================================================
alias raz_bars_base_exp draw_actor_exp
def draw_actor_exp(actor, x, y)
if actor.level == 99
draw_slant_bar(x, y + 18, 1, 1, 190, 6, bar_color = Color.new(0, 100, 0, 255), end_color = Color.new(0, 255, 0, 255))
else
draw_slant_bar(x, y + 18, actor.now_exp, actor.next_exp, 190, 6, bar_color = Color.new(0, 100, 0, 255), end_color = Color.new(255, 255, 255, 255))
end
raz_bars_base_exp(actor, x, y)
end
#==========================================================================
# * Draw Parameter
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# type : parameter type (0-6)
#==========================================================================
alias raz_bars_base_parameter draw_actor_parameter
def draw_actor_parameter(actor, x, y, type)
case type
when 0
para_color1 = Color.new(100,0,0)
para_color2 = Color.new(255,0,0)
para_begin = actor.atk
when 1
para_color1 = Color.new(100,100,0)
para_color2 = Color.new(255,255,0)
para_begin = actor.pdef
when 2
para_color1 = Color.new(100,0,100)
para_color2 = Color.new(255,0,255)
para_begin = actor.mdef
when 3
para_color1 = Color.new(50,0,100)
para_color2 = Color.new(50,0,255)
para_begin = actor.str
when 4
para_color1 = Color.new(0,100,0)
para_color2 = Color.new(0,255,0)
para_begin = actor.dex
when 5
para_color1 = Color.new(50,0,50)
para_color2 = Color.new(255,0,255)
para_begin = actor.agi
when 6
para_color1 = Color.new(0,100,100)
para_color2 = Color.new(0,255,255)
para_begin = actor.int
end
draw_slant_bar(x, y + 18, para_begin, 999, 155, 4, bar_color = para_color1,
end_color = para_color2)
raz_bars_base_parameter(actor, x, y, type)
end
#=========================================================================
# * Draw Actor ATG
# actor : Actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : draw spot width
#=========================================================================
def draw_actor_atg(actor, x, y, width = 144, height = 6)
if @at_gauge == nil
# plus_x: revised x-coordinate
# rate_x: revised X-coordinate as (%)
# plus_y: revised y-coordinate
# plus_width: revised width
# rate_width: revised width as (%)
# height: Vertical width
# align1: Type 1 ( 0: left justify 1: center justify 2: right justify )
# align2: Type 2 ( 0: Upper stuffing 1: Central arranging 2:Lower stuffing )
# align3: Gauge type 0:Left justify 1: Right justify
@plus_x = 0
@rate_x = 0
@plus_y = 16
@plus_width = 0
@rate_width = 100
@width = @plus_width + width * @rate_width / 100
@height = 6
@align1 = 0
@align2 = 1
@align3 = 0
# Gradation settings: grade1: Empty gauge grade2:Actual gauge
# (0:On side gradation 1:Vertically gradation 2: Slantedly gradation)
grade1 = 1
grade2 = 0
# Color setting. color1: Outermost framework, color2: Medium framework
# color3: Empty framework dark color, color4: Empty framework light/write color
color1 = Color.new(0, 0, 0)
color2 = Color.new(255, 255, 192)
color3 = Color.new(0, 0, 0, 192)
color4 = Color.new(0, 0, 64, 192)
# Color setting of gauge
# Usually color setting of the time
color5 = Color.new(0, 64, 80)
color6 = Color.new(255, 255, 255)#(0, 128, 160)
# When gauge is MAX, color setting
color7 = Color.new(80, 0, 0)
color8 = Color.new(255, 255,255) #(240,0,0)
# Color setting at time of cooperation skill use
color9 = Color.new(80, 64, 32)
color10 = Color.new(255, 255, 255) #(240, 192, 96)
# Color setting at time of skill permanent residence
color11 = Color.new(80, 0, 64)
color12 = Color.new(255,255, 255) #(240, 0, 192)
# Drawing of gauge
gauge_rect_at(@width, @height, @align3, color1, color2, color3, color4,
color5, color6, color7, color8, color9, color10, color11, color12,
grade1, grade2)
end
# Variable at substituting the width of the gauge which is drawn
if actor.rtp == 0
at = (width + @plus_width) * actor.atp * @rate_width / 10000
else
at = (width + @plus_width) * actor.rt * @rate_width / actor.rtp / 100
end
# AT Width Check
if at > width
at = width
end
# Revision such as the left stuffing central posture of gauge
case @align1
when 1
x += (@rect_width - width) / 2
when 2
x += @rect_width - width
end
case @align2
when 1
y -= @height / 2
when 2
y -= @height
end
# Draw Border
for i in 0..height
self.contents.fill_rect(x + 1.5 + i, y + 12 + height - i, width - 2 , 3,
Color.new(50, 50, 50, 255))
end
# Draw Background
for i in 1..(height - 1)
r = 100 * (height - i) / height + 0 * i / height
g = 100 * (height - i) / height + 0 * i / height
b = 100 * (height - i) / height + 0 * i / height
a = 255 * (height - i) / height + 255 * i / height
self.contents.fill_rect(x + 1.5 + i, y + 12 + height - i, width - 3, 3,
Color.new(r, b, g, a))
end
# Rect_X control
if @align3 == 0
rect_x = 0
else
x += @width - at - 1
rect_x = @width - at - 1
end

# Color setting of gauge
if at == width
#Gauge drawing at the time of MAX
for i in 0..height
self.contents.blt(x + i + @plus_x + @width * @rate_x / 100, y -i +
@plus_y, @at_gauge, Rect.new(rect_x, @height * 2, at, @height))
end
else
if actor.rtp == 0
for i in 0..height
# Usually gauge drawing of the time
self.contents.blt(x + i + @plus_x + @width * @rate_x / 100, y- i +
@plus_y, @at_gauge,Rect.new(rect_x, @height, at, @height))
end
else
if actor.spell == true
for i in 0..height
#Gauge drawing at time of cooperation skill use
self.contents.blt(x + i + @plus_x + @width * @rate_x / 100, y - i +
@plus_y, @at_gauge, Rect.new(rect_x, @height * 3, at, @height))
end
else
for i in 0..height
# Gauge drawing at time of skill permanent residence
self.contents.blt(x + i + @plus_x + @width * @rate_x / 100, y - i +
@plus_y, @at_gauge, Rect.new(rect_x, @height * 4, at, @height))
end
end
end
end
end
#=========================================================================
# * Draw Actor Limit Break Bar
# actor : Actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# width : draw spot width
#=========================================================================
def draw_actor_lb(actor, x, y, width = 144)
rate = actor.limitbreak.to_f / LB_MAX
plus_x = 0
rate_x = 0
plus_y = 15
plus_width = 0
rate_width = 100
height = 7
lb = (width + plus_width) * actor.limitbreak * rate_width / 100 / LB_MAX
# Drawing of gauge
if actor.limitbreak == LB_MAX
# Draw Silver Blue Bar
draw_slant_bar(x + plus_x + width * rate_x / 100, y + plus_y, lb, width,
width, height, od_color1 = Color.new(0,80,200,192),
od_color2 = Color.new(255,255,255,192))
else
# Draw Green Bar
draw_slant_bar(x + plus_x + width * rate_x / 100, y + plus_y, lb, width,
width, height, od_color1 = Color.new(31, 128, 0, 128),
od_color2 = Color.new(255, 255, 191))
end
end
end
">">">">">">
 
I am posting them one at a time. Here is the patch that was supposed to make them work together.

#==============================================================================
# ** 'GROUPING AND DETAILS' and 'Limit Break Menu' Patch
#------------------------------------------------------------------------------
# by DerVVulfman
# version 1.3
# 07-07-2007
# SDK 2.2+ Incompatible. All defs involved are rewritten.
#------------------------------------------------------------------------------
# This patch is used to permit the 'Grouping and Details' system to work along
# side of the 'Limit Break' menu. Unlike other patches, this one needs to be
# posted 'ABOVE' both systems as it contains a GLOBAL value used by the two
# for detection and compatability purposes.
#
# As such, this system replaces and combines a number of functions within both
# of the systems.
#==============================================================================


# Global value for auto-detecting
$gnd_lb_patch = true



#==============================================================================
# ** Window_Skill
#------------------------------------------------------------------------------
# This window displays usable skills on the skill and battle screens.
#==============================================================================

class Window_Skill < Window_Selectable

#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
skillkind = $game_temp.gnd_window
@data = []
if self.contents != nil
self.contents.dispose
self.contents = nil
end
# If not in the Limit Break Menu
unless $game_temp.limit_menu
# If sorting through groups
if @group[skillkind] != 0
for i in 0...@actor.skills.size
skill = $data_skills[@actor.skills]
if skill != nil && skill.element_set.include?(@group[skillkind])
if $game_system.lb_attack_detected
@data.push(skill) unless skill.element_set.include?($lb_element_id)
else
unless $game_temp.in_battle
@data.push(skill) unless skill.element_set.include?($lb_element_id)
else
@data.push(skill)
end
end
end
end
# Else if in the 'All' group category
else
for i in 0...@actor.skills.size
skill = $data_skills[@actor.skills]
if skill != nil
if $game_system.lb_attack_detected
@data.push(skill) unless skill.element_set.include?($lb_element_id)
else
unless $game_temp.in_battle
@data.push(skill) unless skill.element_set.include?($lb_element_id)
else
@data.push(skill)
end
end
end
end
end
# Else in the Limit Break menu
else
for i in 0...@actor.skills.size
skill = $data_skills[@actor.skills]
unless skill == nil
if $game_temp.seperation
if $game_temp.limitbreak_skills
@data.push(skill) if skill.element_set.include?($lb_element_id)
else
@data.push(skill) unless skill.element_set.include?($lb_element_id)
end
else
@data.push(skill)
end
end
end
end
# If item count is not 0, make a bit map and draw all items
@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
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
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::Cache.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)
unless HIDE_ZERO_SP && skill.sp_cost == 0
self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
end
end
end


#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================

class Scene_Battle
#--------------------------------------------------------------------------
# * Start Skill Selection
#--------------------------------------------------------------------------
def start_skill_select
# RTAB detection value built into Limit Break (DVV)
# Assigns 'battler' value for the Skill Window.
if $game_system.lb_rtab_detected
battler = @active_actor
else
battler = @active_battler
end
$game_temp.limit_menu = false
# Make skill window
@skill_window = Window_Skill.new(battler)
if $game_system.lb_attack_detected
$game_temp.seperation = true
$game_temp.limitbreak_skills = false
@skill_window.refresh
else
$game_temp.seperation = false
$game_temp.limitbreak_skills = false
@skill_window.refresh
end
@skill_window.z = 1000
# Associate help window
@skill_window.help_window = @help_window
# Disable actor command window
@actor_command_window.active = false
@actor_command_window.visible = false
if B_S_WINDOW
@skill_group_window = Window_SkillGroup2.new(battler)
@skill_group_window.x = @actor_command_window.x
@skill_group_window.y = @actor_command_window.y
@skill_group_window.height = @actor_command_window.height
@skill_group_window.width = @actor_command_window.width
else
@skill_group_window = Window_SkillGroup.new(battler)
@skill_group_window.y = @help_window2 != nil ? 64 : 0
end
@skill_group_window.back_opacity = 160
@skill_group_select = true
@now_skillkind = nil
if @help_window2 != nil
@skill_group_window.help_window = @help_window2
end
end
#--------------------------------------------------------------------------
# * Start Skill Selection #2
#--------------------------------------------------------------------------
def start_skill_select2
# RTAB detection value built into Limit Break (DVV)
# Assigns 'battler' value for the Skill Window.
if $game_system.lb_rtab_detected
battler = @active_actor
else
battler = @active_battler
end
$game_temp.limit_menu = true
# Create but disable
@skill_group_window = Window_SkillGroup.new(battler)
@skill_group_window.visible = false
@skill_group_window.active = false
@skill_group_select = false
# Set new values for Limit Break seperation
$game_temp.seperation = true
$game_temp.limitbreak_skills = true
# Make skill window
@skill_window = Window_Skill.new(@active_battler)
# Associate help window
@skill_window.help_window = @help_window
# Disable actor command window
@actor_command_window.active = false
@actor_command_window.visible = false
end
end
 
I have a question about that HorizCommand thing, why is it (or how can you) that you can't make the window's height less than 64? Everytime I've tried it doesn't seem to show the text at all lol.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top