# ╔══════════════════════════════════════════════════════╤═══════╤════════════╗
# ║ Final Fantasy Style Battle Log │ v2.04 │ (08/28/15) ║
# ╠══════════════════════════════════════════════════════╧═══════╧════════════╣
# ║ Author : William Couillard ║
# ║ Thanks : KilloZapIt, Swish & Keith Brewer ║
# ║ E-Mail : cooliebk18@yahoo.com ║
# ║ Website : http://ffdiscovery.wikia.com
# ╠═══════════════════════════════════════════════════════════════════════════╣
# ║ ABOUT ║
# ╠═══════════════════════════════════════════════════════════════════════════╣
# ║ This script changes the behavior of the battle log window to act as the ║
# ║ Battle Log window in a Final Fantasy game would. ║
# ╠═══════════════════════════════════════════════════════════════════════════╣
# ║ TERMS OF USE ║
# ╠═══════════════════════════════════════════════════════════════════════════╣
# ║ ► Do not edit the script's header or comments. ║
# ║ ► If the script code is modified for your own purposes, then it must ║
# ║ remain encrypted in your project upon release. ║
# ║ ► NOT free to use in commercial projects. ║
# ╠═══════════════════════════════════════════════════════════════════════════╣
# ║ FEATURES ║
# ╠═══════════════════════════════════════════════════════════════════════════╣
# ║ ► Removes the black background behind the default Battle Log window. ║
# ║ ► Custom opacity for the Battle Log window. ║
# ║ ► Text alignment setings for the Battle Log window. ║
# ║ ► Restrict skill IDs from showing up in the Battle Log window, such as ║
# ║ normal attacks, defending, hidden skills). ║
# ║ ► Width and alignment settings for the Battle Log window. ║
# ║ ► Option to use different windowskin suffixes for skills used by actors ║
# ║ or enemies. ║
# ╠═══════════════════════════════════════════════════════════════════════════╣
# ║ KNOWN ISSUES ║
# ╠═══════════════════════════════════════════════════════════════════════════╣
# ║ ► This script is intended to be used alongside a Damage Popup script, ║
# ║ such as the ones made by Yanfly or Victor Sant. Using it by itself will ║
# ║ only take effect on skill and item names and messages, and all other ║
# ║ messages will still appear the default way that VX processes them. ║
# ║ ║
# ║ I wrote this script out of a personal need for it. ║
# ╠═══════════════════════════════════════════════════════════════════════════╣
# ║ CHANGE LOG ║
# ╠═════════════════════════════════════════════════════════════════╤═════════╣
# ║ ■ August 28, 2015 : Bugfixes (enemy death animation) │ (v2.04) ║
# ╟─────────────────────────────────────────────────────────────────┼─────────╢
# ║ ■ December 12, 2014 : Bugfixes (battle sounds playing again) │ (v2.03) ║
# ╟─────────────────────────────────────────────────────────────────┼─────────╢
# ║ ■ December 11, 2014 : Bugfixes (y offset text positioning) │ (v2.02) ║
# ╟─────────────────────────────────────────────────────────────────┼─────────╢
# ║ ■ December 11, 2014 : Bugfixes (blank window fix) │ (v2.01) ║
# ╟─────────────────────────────────────────────────────────────────┼─────────╢
# ║ ■ December 10, 2014 : Almost a full rewrite. Needless features │ (v2.00) ║
# ║ removed. Some new ones added. Skill and │ ║
# ║ Item icons displaying now. Option for │ ║
# ║ different fonts for ally and enemy skills │ ║
# ║ added. │ ║
# ╟─────────────────────────────────────────────────────────────────┼─────────╢
# ║ ■ October 31, 2014 : New option to use different windowskins │ (v1.04) ║
# ║ for actor and enemy attacks │ ║
# ╟─────────────────────────────────────────────────────────────────┼─────────╢
# ║ ■ August 15, 2013 : Bugfixes. │ (v1.03) ║
# ╟─────────────────────────────────────────────────────────────────┼─────────╢
# ║ ■ December 12, 2012 : Font options added. │ (v1.02) ║
# ╟─────────────────────────────────────────────────────────────────┼─────────╢
# ║ ■ December 06, 2012 : Width and Window alignment options added. │ (v1.01) ║
# ║ Show Name option added. │ ║
# ╟─────────────────────────────────────────────────────────────────┼─────────╢
# ║ ■ December 05, 2012 : Initial release. │ (v1.00) ║
# ╠═════════════════════════════════════════════════════════════════╧═════════╣
# ║ NEXT VERSION ║
# ╠═══════════════════════════════════════════════════════════════════════════╣
# ║ ■ TBA ║
# ╠═══════════════════════════════════════════════════════════════════════════╣
# ║ OVERWRITTEN METHODS ║
# ╠═══════════════════════════════════════════════════════════════════════════╣
# ║ This script overwrites a several methods in Window_BattleLog. ║
# ╟───────────────────────────────────────────────────────────────────────────╢
# ║ ■ class Window_BattleLog < Window_Selectable ║
# ║ ► def initialize ║
# ║ ► def window_width ║
# ║ ► def max_line_number ║
# ║ ► def create_back_bitmap ║
# ║ ► def create_back_sprite ║
# ║ ► def dispose_back_bitmap ║
# ║ ► def dispose_back_sprite ║
# ║ ► def last_text ║
# ║ ► def draw_background ║
# ║ ► def back_color ║
# ║ ► def clear ║
# ║ ► def display_use_item ║
# ║ ► def display_affected_status ║
# ║ ► def display_critical ║
# ║ ► def display_miss ║
# ║ ► def display_failure ║
# ║ ► def display_counterattack ║
# ║ ► def display_reflection ║
# ║ ► def display_substitute ║
# ║ ► def display_hp_damage ║
# ║ ► def display_mp_damage ║
# ║ ► def display_tp_damage ║
# ║ ► def display_affected_status ║
# ║ ► def display_added_state ║
# ║ ► def display_removed_states ║
# ║ ► def display_buffs ║
# ╠═══════════════════════════════════════════════════════════════════════════╣
# ║ NEW METHODS ║
# ╠═══════════════════════════════════════════════════════════════════════════╣
# ║ There are several new methods added to Window_BattleLog. ║
# ╟───────────────────────────────────────────────────────────────────────────╢
# ║ ■ class Window_BattleLog < Window_Selectable ║
# ║ ► def window_left_position ║
# ║ ► def window_center_position ║
# ║ ► def window_right_position ║
# ║ ► def y_offset ║
# ║ ► def item_name_width ║
# ║ ► def skill_name_width ║
# ║ ► def draw_skill_name ║
# ║ ► def draw_items_name ║
# ╠═══════════════════════════════════════════════════════════════════════════╣
# ║ INSTRUCTIONS ║
# ╠═══════════════════════════════════════════════════════════════════════════╣
# ║ Simply paste this script anywhere above the Main Process script and below ║
# ║ the "Materials" section. ║
# ║ ║
# ║ NOTE: When setting the "use" message in the database for a skill, it is ║
# ║ important to remember that the Actor name or Enemy name is OMITTED. ║
# ║ It's usually a good idea just to input the skill's name in the ║
# ║ "use" message dialogue box. The skill/item icon is shown with the ║
# ║ skill/item name. This is what will determine the text displayed ║
# ║ You can name the skill in the database whatever you want, and the ║
# ║ script will display the icon and whatever is in the message box. ║
# ║ ║
# ║ Example: Just input "Fire" instead of "casts Fire!" ║
# ║ ║
# ║ NOTE: You can also show a custom message, by using the second message box ║
# ║ in the database for skills. Simply write whatever you want in that ║
# ║ box, and the skill/item icon will not be shown. Your new custom ║
# ║ message will display instead. ║
# ║ ║
# ║ Example: "Precious light, be our armor to protect us! Protect!" ║
# ╠═══════════════════════════════════════════════════════════════════════════╣
# ║ IMPORT SETTING ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
$imported = {} if $imported.nil? # Do not edit
$imported = true # Do not edit
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ CUSTOMIZATION MODULE ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
module COOLIE
module LOG
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Set window width (in pixels) ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
WINDOW_WIDTH = 640
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Set window Y offset (in pixels; can be negative) ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
WINDOW_Y_OFFSET = 0
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Set window alignment (0 = Left, 1 = Center, 2 = Right) ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
WINDOW_ALIGN = 1
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Set windowskin opacity (0-255) ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
WINDOWSKIN_OPACITY = 255
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Set windowskin back opacity (0-255) ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
WINDOWSKIN_BACK_OPACITY = 255
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Set windowskin used for actor skills/items (Graphics/System folder) ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
WINDOWSKIN_ACTOR = "Window"
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Set windowskin used for enemy skills/items (Graphics/System folder) ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
WINDOWSKIN_ENEMY = "Window"
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Set ignored skill IDS (these skills will not show the BattleLog Window) ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
IGNORED_SKILLS = # Do not remove!
end # module LOG
end # module COOLIE
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ WINDOW_BATTLELOG ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
class Window_BattleLog < Window_Selectable
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Object Initialization ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def initialize
case COOLIE::LOG::WINDOW_ALIGN
when 0 # Left Aligned
super(window_left_position, y_offset, window_width, window_height)
when 1 # Center Aligned
super(window_center_position, y_offset, window_width, window_height)
when 2 # Right Aligned
super(window_right_position, y_offset, window_width, window_height)
end
self.z -= 10
self.opacity = 0
@lines =
@num_wait = 0
create_back_bitmap
create_back_sprite
refresh
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Get Window Width ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def window_width
COOLIE::LOG::WINDOW_WIDTH
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Get Window Y Offset ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def y_offset
return COOLIE::LOG::WINDOW_Y_OFFSET
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Get Maximum Number of Lines ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def max_line_number
return 1
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Create Background Bitmap ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def create_back_bitmap
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Create Background Sprite ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def create_back_sprite
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Free Background Bitmap ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def dispose_back_bitmap
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Free Background Sprite ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def dispose_back_sprite
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Last Text ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def last_text
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Draw_Background ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def draw_background
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Get Background Color ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def back_color
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Clear ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def clear
@num_wait = 0
@lines.clear
self.opacity = 0
self.back_opacity = 0
refresh
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Display Affected Status ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def display_affected_status(target, item)
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Display Counterattack ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def display_counter(target, item)
Sound.play_evasion
clear
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Display Reflection ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def display_reflection(target, item)
Sound.play_reflection
clear
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Display Substitute ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def display_substitute(substitute, target)
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Display Action Results ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def display_action_results(target, item)
if target.result.used
display_damage(target, item)
display_affected_status(target, item)
end
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Display Failure ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def display_failure(target, item)
if target.result.hit? && !target.result.success
end
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Display Critical Hit ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def display_critical(target, item)
if target.result.critical
end
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Display Miss ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def display_miss(target, item)
if !item || item.physical?
Sound.play_miss
end
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Display Evasion ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def display_evasion(target, item)
if !item || item.physical?
Sound.play_evasion
else
Sound.play_magic_evasion
end
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Display HP Damage ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def display_hp_damage(target, item)
return if target.result.hp_damage == 0 && item && !item.damage.to_hp?
if target.result.hp_damage > 0 && target.result.hp_drain == 0
target.perform_damage_effect
end
Sound.play_recovery if target.result.hp_damage < 0
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Display MP Damage ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def display_mp_damage(target, item)
return if target.dead? || target.result.mp_damage == 0
Sound.play_recovery if target.result.mp_damage < 0
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Display TP Damage ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def display_tp_damage(target, item)
return if target.dead? || target.result.tp_damage == 0
Sound.play_recovery if target.result.tp_damage < 0
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Display Affected Status ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def display_affected_status(target, item)
if target.result.status_affected?
display_changed_states(target)
display_changed_buffs(target)
end
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Display Added State ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def display_added_states(target)
target.result.added_state_objects.each do |state|
if $imported
else
target.perform_collapse_effect if state.id == target.death_state_id
end
wait_for_effect
end
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Display Removed States ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def display_removed_states(target)
target.result.removed_state_objects.each do |state|
end
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Display Buffs/Debuffs ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def display_buffs(target, buffs, fmt)
buffs.each do |param_id|
end
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Get Window Left Position ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def window_left_position
return 0
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Get Window Center Position ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def window_center_position
return Graphics.width / 2 - window_width / 2
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Get Window Right Position ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def window_right_position
return Graphics.width - window_width
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Draw Skill Name ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def draw_skill_name(item, x, y, enabled = true, width = 172)
return unless item
draw_icon(item.icon_index, x, 0, enabled)
change_color(normal_color, enabled)
draw_text(x + 24, 0, width, line_height, item.message1)
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Draw Item Name ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def draw_items_name(item, x, y, enabled = true, width = 172)
return unless item
draw_icon(item.icon_index, x, 0, enabled)
change_color(normal_color, enabled)
draw_text(x + 24, 0, width, line_height, item.name)
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Skill Name Width ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def skill_name_width(item)
size = text_size(item.message1).width
size += 24 if item.icon_index > 0
return size
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Item Name Width ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def item_name_width(item)
size = text_size(item.name).width
size += 24 if item.icon_index > 0
return size
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ Display Skill/Item Use ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
def display_use_item(subject, item)
# Handle Font and Windowskin processing
if subject.is_a?(Game_Enemy)
self.windowskin = Cache.system(COOLIE::LOG::WINDOWSKIN_ENEMY.to_s)
else
self.windowskin = Cache.system(COOLIE::LOG::WINDOWSKIN_ACTOR.to_s)
end
# Handle ignored skill IDs
if item.is_a?(RPG::Skill)
for i in 0..COOLIE::LOG::IGNORED_SKILLS.length
if item.id.to_s == COOLIE::LOG::IGNORED_SKILLS.to_s
return
end # if item.id
end # for i
end # if item.is_a?
# Handle display of Window, Opacity, Icons and Text
if item.is_a?(RPG::Skill) # For Skills
self.opacity = COOLIE::LOG::WINDOWSKIN_OPACITY
self.back_opacity = COOLIE::LOG::WINDOWSKIN_BACK_OPACITY
ix = (window_width / 2 - skill_name_width(item) / 2) - 12 if item.icon_index > 0
ix = (window_width / 2 - skill_name_width(item) / 2) - 36 if item.icon_index <= 0
draw_skill_name(item, ix, y, enabled = true)
unless item.message2.empty?
wait
clear
self.opacity = COOLIE::LOG::WINDOWSKIN_OPACITY
self.back_opacity = COOLIE::LOG::WINDOWSKIN_BACK_OPACITY
draw_text(0, 0, window_width - 24, line_height, item.message2, 1)
wait
end
elsif item.is_a?(RPG::Item) # For Items
self.opacity = COOLIE::LOG::WINDOWSKIN_OPACITY
self.back_opacity = COOLIE::LOG::WINDOWSKIN_BACK_OPACITY
ix = (window_width / 2 - item_name_width(item) / 2) - 12 if item.icon_index > 0
ix = (window_width / 2 - item_name_width(item) / 2) - 36 if item.icon_index <= 0
draw_items_name(item, ix, y, enabled = true)
else # Failsafe
self.opacity = COOLIE::LOG::WINDOWSKIN_OPACITY
self.back_opacity = COOLIE::LOG::WINDOWSKIN_BACK_OPACITY
draw_text(0, 0, window_width - 24, line_height, item.name, 1)
wait
end
reset_font_settings
end
# ╔═══════════════════════════════════════════════════════════════════════════╗
# ║ End of Script ║
# ╚═══════════════════════════════════════════════════════════════════════════╝
end