# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Picture Battle
# Author: Soulpour777
# Version 1.0
# Requested by: zno2012
# Category: Battle Related
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Description: Lets you show an image below the Battle Status.
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# The image must be placed on the Pictures Folder.
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Image Battle
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This module holds the image creation and disposal.
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

module ImageBattle
# --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Create Leaves
# --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
def self.create_leaves
@leaves = Plane.new
@leaves.bitmap = Cache.picture("Leaves")
end

# --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Dispose Leaves
# --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
def self.dispose_leaves
@leaves.bitmap.dispose
@leaves.dispose
end

end


class Window_BattleStatus < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias picture_initialize initialize
def initialize
picture_initialize()
ImageBattle.create_leaves
end

end


module BattleManager

#--------------------------------------------------------------------------
# * Battle Abort
#--------------------------------------------------------------------------
def self.abort
@phase = :aborting
ImageBattle.dispose_leaves
end

#--------------------------------------------------------------------------
# * Victory Processing
#--------------------------------------------------------------------------
def self.process_victory
ImageBattle.dispose_leaves
play_battle_end_me
replay_bgm_and_bgs
$game_message.add(sprintf(Vocab::Victory, $game_party.name))
display_exp
gain_gold
gain_drop_items
gain_exp
SceneManager.return
battle_end(0)
return true
end
#--------------------------------------------------------------------------
# * Abort Processing
#--------------------------------------------------------------------------
def self.process_abort
replay_bgm_and_bgs
ImageBattle.dispose_leaves
SceneManager.return
battle_end(1)
return true
end
#--------------------------------------------------------------------------
# * Defeat Processing
#--------------------------------------------------------------------------
def self.process_defeat
$game_message.add(sprintf(Vocab::Defeat, $game_party.name))
wait_for_message
if @can_lose
revive_battle_members
replay_bgm_and_bgs
ImageBattle.dispose_leaves
SceneManager.return
else
ImageBattle.dispose_leaves
SceneManager.goto(Scene_Gameover)
end
battle_end(2)
return true
end

end