top of page
Forum Posts
New Quest Gaming
Feb 23, 2024
In Modifications
This addon is quite nice.
This allows you to show word options in the menu instead of just a bar with a number changing.
Credit and Thanks
Roninator2
#==============================================================================
#
# ▼ Yanfly Engine Ace - System Options v1.00 Add-on++
# -- Last Updated: 2019.06.21
# -- Level: Normal
# -- Requires: n/a
#
#==============================================================================
# ▼ EDITED by Roninator2
# -- Variable text lists add-on for System Options
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script adds onto Yanfly's System Options menu
# Custom lists for variables have been added.
# You can specify in the Custom_Lists below which variable you
# want to use and the text to be displayed.
# The text must be short, otherwise you will have to adjust the script.
#==============================================================================
module YEA
module SYSTEM
CUSTOM_LISTS ={
# -------------------------------------------------------------------------
# :list => [Variable, Name, minimum, maximum, Color1, Color2,
# Help Window Description, Value1, Value2, Value3, etc
# ], # Do not remove this.
# -------------------------------------------------------------------------
:list_1 => [ 67, "Difficulty", 0, 3, 0, 7, "Change Difficulty?",
"Easy", "Normal", "Heroic", "Legendary"
],
# -------------------------------------------------------------------------
:list_2 => [ 127, "Cursor", 0, 3, 0, 7, "Change the cursor for the menu.\n"+
"Exit screen for change to take effect.",
"Magic", "Crystal", "Hand", "None"
],
# -------------------------------------------------------------------------
} # Do not remove this.
end
end
class Window_SystemOptions < Window_Command
#--------------------------------------------------------------------------
# Overwrite * update_help
#--------------------------------------------------------------------------
def update_help
if current_symbol == :custom_switch || current_symbol == :custom_variable ||
current_symbol == :custom_list
text = @help_descriptions[current_ext]
else
text = @help_descriptions[current_symbol]
end
text = "" if text.nil?
@help_window.set_text(text)
end
#--------------------------------------------------------------------------
# new * process_custom_list
#--------------------------------------------------------------------------
def process_custom_list(command)
return unless YEA::SYSTEM::CUSTOM_LISTS.include?(command)
name = YEA::SYSTEM::CUSTOM_LISTS[command][1]
add_command(name, :custom_list, true, command)
@help_descriptions[command] = YEA::SYSTEM::CUSTOM_LISTS[command][6]
end
#--------------------------------------------------------------------------
# draw_item
#--------------------------------------------------------------------------
alias r2_draw_item_823gf draw_item
def draw_item(index)
reset_font_settings
rect = item_rect(index)
contents.clear_rect(rect)
r2_draw_item_823gf(index)
case @list[index][:symbol]
when :custom_list
draw_custom_list(rect, index, @list[index][:ext])
end
end
def item_height
line_height
end
def line_height
return 23
end
#--------------------------------------------------------------------------
# Overwrite * make_command_list
#--------------------------------------------------------------------------
def make_command_list
@help_descriptions = {}
for command in YEA::SYSTEM::COMMANDS
case command
when :blank
add_command(YEA::SYSTEM::COMMAND_VOCAB[command][0], command)
@help_descriptions[command] = YEA::SYSTEM::COMMAND_VOCAB[command][3]
when :window_red, :window_grn, :window_blu
add_command(YEA::SYSTEM::COMMAND_VOCAB[command][0], command)
@help_descriptions[command] = YEA::SYSTEM::COMMAND_VOCAB[command][3]
when :volume_bgm, :volume_bgs, :volume_sfx
add_command(YEA::SYSTEM::COMMAND_VOCAB[command][0], command)
@help_descriptions[command] = YEA::SYSTEM::COMMAND_VOCAB[command][3]
when :autodash, :instantmsg, :animations
add_command(YEA::SYSTEM::COMMAND_VOCAB[command][0], command)
@help_descriptions[command] = YEA::SYSTEM::COMMAND_VOCAB[command][3]
when :varmenu, :encyclopedia, :achievement, :stats, :overview, :cancel, :to_title, :shutdown
add_command(YEA::SYSTEM::COMMAND_VOCAB[command][0], command)
@help_descriptions[command] = YEA::SYSTEM::COMMAND_VOCAB[command][3]
when :fullscreen
add_command(YEA::SYSTEM::COMMAND_VOCAB[command][0], command)
@help_descriptions[command] = YEA::SYSTEM::COMMAND_VOCAB[command][3]
else
process_custom_list(command)
process_custom_switch(command)
process_custom_variable(command)
end
end
end
#--------------------------------------------------------------------------
# New * draw_custom_list
#--------------------------------------------------------------------------
def draw_custom_list(rect, index, ext)
name = @list[index][:name]
change_color(normal_color)
draw_text(0, rect.y, contents.width/2, line_height, name, 1)
#---
value = $game_variables[YEA::SYSTEM::CUSTOM_LISTS[ext][0]]
minimum = YEA::SYSTEM::CUSTOM_LISTS[ext][2]
maximum = YEA::SYSTEM::CUSTOM_LISTS[ext][3]
if minimum > value
value = minimum
$game_variables[YEA::SYSTEM::CUSTOM_LISTS[ext][0]] = value
end
pos = 0
for i in minimum...maximum + 1
dx = -120
entry = YEA::SYSTEM::CUSTOM_LISTS[ext][pos + 7]
color1 = text_color(YEA::SYSTEM::CUSTOM_LISTS[ext][5].to_i)
change_color(color1)
draw_text(dx + contents.width/2 + contents.width/maximum*pos/2, rect.y, contents.width/maximum, line_height, entry, 1)
if value == i
color2 = text_color(YEA::SYSTEM::CUSTOM_LISTS[ext][4].to_i)
change_color(color2)
entry = YEA::SYSTEM::CUSTOM_LISTS[ext][pos + 7]
draw_text(dx + contents.width/2 + contents.width/maximum*pos/2, rect.y, contents.width/maximum, line_height, entry, 1)
end
pos += 1
end
end
#--------------------------------------------------------------------------
# cursor_change
#--------------------------------------------------------------------------
alias r2_cursor_change_92fkw cursor_change
def cursor_change(direction)
r2_cursor_change_92fkw(direction)
case current_symbol
when :custom_list
change_custom_lists(direction)
end
end
#--------------------------------------------------------------------------
# Overwrite * draw_item
#--------------------------------------------------------------------------
def draw_item(index)
reset_font_settings
contents.font.size = 20
rect = item_rect(index)
contents.clear_rect(rect)
case @list[index][:symbol]
when :blank
when :window_red, :window_grn, :window_blu
draw_window_tone(rect, index, @list[index][:symbol])
when :volume_bgm, :volume_bgs, :volume_sfx
rect.y -= 3
draw_volume(rect, index, @list[index][:symbol])
when :autodash, :instantmsg, :animations
draw_toggle(rect, index, @list[index][:symbol])
when :custom_switch
draw_custom_switch(rect, index, @list[index][:ext])
when :custom_variable
rect.y -= 3
draw_custom_variable(rect, index, @list[index][:ext])
when :fullscreen
draw_toggle(rect, index, @list[index][:symbol])
when :custom_list
draw_custom_list(rect, index, @list[index][:ext])
when :cancel, :varmenu, :encyclopedia, :achievement, :to_title, :shutdown, :stats, :overview
draw_text(item_rect_for_text(index), command_name(index), 1)
end
end
#--------------------------------------------------------------------------
# new * change_custom_lists
#--------------------------------------------------------------------------
def change_custom_lists(direction)
Sound.play_cursor
value = direction == :left ? -1 : 1
ext = current_ext
var = YEA::SYSTEM::CUSTOM_LISTS[ext][0]
minimum = YEA::SYSTEM::CUSTOM_LISTS[ext][2]
maximum = YEA::SYSTEM::CUSTOM_LISTS[ext][3]
$game_variables[var] += value
$game_variables[var] = [[$game_variables[var], minimum].max, maximum].min
draw_item(index)
end
end # Window_SystemOptions
0
0
16
New Quest Gaming
Feb 23, 2024
In Modifications
This addon allows showing a total count of items
Credit and Thanks
Yanfly
Roninator2
# ╔═════════════════════════════════════╦════════════════════╗
# ║ Title: Yanfly Shop Options add on ║ Version: 1.03 ║
# ║ Author: Roninator2 ║ ║
# ╠═════════════════════════════════════╬════════════════════╣
# ║ Function: ║ Date Created ║
# ║ ╠════════════════════╣
# ║ Show total count including equips ║ 16 Jan 2021 ║
# ╚═════════════════════════════════════╩════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Requires: Yanfly Engine Ace - Ace Shop Options ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Script adjusts Ace Shop to show the total amount of ║
# ║ items in party inventory, including equipment. ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Updates: ║
# ║ 1.00 - 16 Jan 2021 - Initial publish ║
# ║ 1.01 - 17 Jan 2021 - Accounted for dual wield ║
# ║ 1.02 - 18 Jan 2021 - Added support for Hime Instance item║
# ║ 1.03 - 19 Jan 2021 - Fixed dual wield bug ║
# ╚══════════════════════════════════════════════════════════╝
# ╔══════════════════════════════════════════════════════════╗
# ║ Terms of use: ║
# ║ Follow the Original Authors terms ║
# ╚══════════════════════════════════════════════════════════╝
class Window_ShopStatus < Window_Base
#--------------------------------------------------------------------------
# * Draw Quantity Possessed
#--------------------------------------------------------------------------
def draw_possession(x, y)
rect = Rect.new(x, y, contents.width - 4 - x, line_height)
change_color(system_color)
draw_text(rect, Vocab::Possession)
change_color(normal_color)
eqinc = 0
$game_party.all_members.each {|actor|
if actor.equips.include?(@item)
eqinc += 1 if !@item.nil?
eqinc += 1 if actor.dual_wield? && !@item.nil? &&
@item.is_a?(RPG::Weapon)
eqinc -= 1 if actor.dual_wield? && !@item.nil? &&
(actor.equips[0].id != actor.equips[1].id)
end
}
if $imported["TH_InstanceItems"]
item = InstanceManager.get_instance(@item)
$game_party.all_members.each {|actor|
eqitem = nil
actor.equip_slots.each_with_index {|e, i|
if item != nil && item.is_a?(RPG::EquipItem)
eqitem = actor.equips[i] if e == item.etype_id
end
}
if eqitem != nil && item != nil
if eqitem.is_a?(RPG::EquipItem) || item.is_a?(RPG::EquipItem)
if eqitem.etype_id == item.etype_id
eqinc += 1 if item.template_id == eqitem.template_id
eqinc += 1 if actor.dual_wield? && !item.nil? &&
item.is_a?(RPG::Weapon) && !actor.equips[1].nil? &&
actor.equips[1].template_id == item.template_id
eqinc -= 1 if actor.dual_wield? && !item.nil? && !actor.equips[1].nil? &&
actor.equips[1].template_id != actor.equips[0].template_id
end
end
end
}
end
draw_text(rect, $game_party.item_number(@item) + eqinc, 2)
end
end
0
0
7
New Quest Gaming
Feb 23, 2024
In Modifications
This addon allows to target allies but user
Credit and Thanks
Yanfly
Roninator2
#==============================================================================
#
# ▼ Yanfly Engine Ace - Target Manager v1.04
# -- Last Updated: 2012.01.13
# -- Level: Normal, Hard
# -- Requires: n/a
# -- Addon by Roninator2
#==============================================================================
$imported = {} if $imported.nil?
$imported["YEA-TargetManager"] = true
#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2021.05.30 - Added option to use skill on random allies except user
# 2012.01.13 - Bug Fixed: AoE removing targets.
# 2012.01.04 - Compatibility Update: Area of Effect
# 2012.01.02 - Started Script and Finished.
# - Compatibility Update: Lunatic Targets
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script provides the ability to expand the targeting scope for skills and
# items. This script provides the ability to up the number of maximum hits
# past 9, expand the targeting range to target different types of groups, and
# give more control over random targeting.
#
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
#
# -----------------------------------------------------------------------------
# Skill Notetags - These notetags go in the skills notebox in the database.
# -----------------------------------------------------------------------------
# <total hits: x>
# Sets the total hits performed to x. This value can exceed 9, the limit RPG
# Maker VX Ace imposes.
#
# <targets: everybody>
# Sets the targeting scope to hit all alive actors and all alive enemies.
#
# <targets: target all foes>
# Sets the targeting scope to hit the selected target foe first and then the
# remaining foes.
#
# <targets: target x random foes>
# Sets the targeting scope to hit the selected target foe first and then hit
# x random foes.
#
# <targets: x random foes>
# Sets the targeting scope to random. This will hit x random foes.
#
# <targets: all but user>
# Targets all allies except for the user.
#
# <targets: target all allies>
# Sets the targeting scope to hit the selected target ally first and then the
# remaining allies.
#
# <targets: target x random allies>
# Sets the targeting scope to hit the selected target ally first and then hit
# x random allies.
#
# <targets: x random allies>
# Sets the targeting scope to random. This will hit x random allies.
#
# -----------------------------------------------------------------------------
# Item Notetags - These notetags go in the items notebox in the database.
# -----------------------------------------------------------------------------
# <total hits: x>
# Sets the total hits performed to x. This value can exceed 9, the limit RPG
# Maker VX Ace imposes.
#
# <targets: everybody>
# Sets the targeting scope to hit all alive actors and all alive enemies.
#
# <targets: target all foes>
# Sets the targeting scope to hit the selected target foe first and then the
# remaining foes.
#
# <targets: target x random foes>
# Sets the targeting scope to hit the selected target foe first and then hit
# x random foes.
#
# <targets: x random foes>
# Sets the targeting scope to random. This will hit x random foes.
#
# <targets: all but user>
# Targets all allies except for the user.
#
# <targets: target all allies>
# Sets the targeting scope to hit the selected target ally first and then the
# remaining allies.
#
# <targets: target x random allies>
# Sets the targeting scope to hit the selected target ally first and then hit
# x random allies.
#
# <targets: x random allies>
# Sets the targeting scope to random. This will hit x random allies.
# <targets: x other allies>
# Sets the targeting scope to random. This will hit x random allies, but not the user
#
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
# This script is compatible with Yanfly Engine Ace - Ace Battle Engine v1.12+.
# Place this script under Ace Battle Engine in the script listing. Also, for
# maximum compatibility with Yanfly Engine Ace - Lunatic Targets, place this
# script under Yanfly Engine Ace - Lunatic Targets as well.
#
#==============================================================================
module YEA
module TARGET
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - General Targeting Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# These settings adjust how targeting operates in your game. Here, you can
# choose to have random targeting redirect to a different target if the
# selected target is dead, change the default settings used for area of
# effects, and more.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# This setting, if true, will redirect the target of a random attack to an
# alive target if the current target is dead. If there are no alive targets
# then nothing happens.
RANDOM_REDIRECT = true
end # TARGET
end # YEA
#==============================================================================
# ▼ Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================
module YEA
module REGEXP
module USABLEITEM
TOTAL_HITS = /<(?:TOTAL_HITS|total hits):[ ](\d+)>/i
TARGETS = /<(?:TARGETS|target):[ ](.*)>/i
end # USABLEITEM
end # REGEXP
end # YEA
#==============================================================================
# ■ DataManager
#==============================================================================
module DataManager
#--------------------------------------------------------------------------
# alias method: load_database
#--------------------------------------------------------------------------
class <<self; alias load_database_target load_database; end
def self.load_database
load_database_target
load_notetags_target
end
#--------------------------------------------------------------------------
# new method: load_notetags_target
#--------------------------------------------------------------------------
def self.load_notetags_target
groups = [$data_skills, $data_items]
for group in groups
for obj in group
next if obj.nil?
obj.load_notetags_target
end
end
end
end # DataManager
#==============================================================================
# ■ RPG::UsableItem
#==============================================================================
class RPG::UsableItem < RPG::BaseItem
#--------------------------------------------------------------------------
# common cache: load_notetags_target
#--------------------------------------------------------------------------
def load_notetags_target
@random_hits = [3, 4, 5, 6].include?(@scope) ? @scope - 2 : 0
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when YEA::REGEXP::USABLEITEM::TOTAL_HITS
@repeats = [$1.to_i, 1].max
#---
when YEA::REGEXP::USABLEITEM::TARGETS
@random_hits = 0
case $1
when /EVERYBODY/i
@scope = :everybody
when /TARGET ALL FOES/i
@scope = :target_all_foes
when /TARGET[ ](\d+)[ ]RANDOM FOE/i
@scope = :target_random_foes
@random_hits = $1.to_i
when /(\d+)[ ]RANDOM FOE/i
@scope = 3
@random_hits = $1.to_i
when /ALL BUT USER/i
@scope = :all_but_user
when /TARGET ALL ALLIES/i
@scope = :target_all_allies
when /TARGET[ ](\d+)[ ]RANDOM ALL/i
@scope = :target_random_allies
@random_hits = $1.to_i
when /(\d+)[ ]RANDOM ALLIES/i
@scope = :random_allies
@random_hits = $1.to_i
when /(\d+)[ ]OTHER ALLIES/i
@scope = :other_allies
@random_hits = $1.to_i
end
#---
end
} # self.note.split
#---
end
#--------------------------------------------------------------------------
# overwrite method: for_random?
#--------------------------------------------------------------------------
def for_random?; return @random_hits > 0; end
#--------------------------------------------------------------------------
# overwrite method: number_of_targets
#--------------------------------------------------------------------------
def number_of_targets; return @random_hits; end
#--------------------------------------------------------------------------
# alias method: for_opponent?
#--------------------------------------------------------------------------
alias rpg_usableitem_for_opponent_target for_opponent?
def for_opponent?
return true if @scope == :target_all_foes
return true if @scope == :target_random_foes
return rpg_usableitem_for_opponent_target
end
#--------------------------------------------------------------------------
# alias method: for_friend?
#--------------------------------------------------------------------------
alias rpg_usableitem_for_friend_target for_friend?
def for_friend?
return true if @scope == :all_but_user
return true if @scope == :target_all_allies
return true if @scope == :target_random_allies
return true if @scope == :random_allies
return true if @scope == :other_allies
return rpg_usableitem_for_friend_target
end
#--------------------------------------------------------------------------
# alias method: for_all?
#--------------------------------------------------------------------------
alias rpg_usableitem_for_all_target for_all?
def for_all?
return true if @scope == :all_but_user
return rpg_usableitem_for_all_target
end
#--------------------------------------------------------------------------
# alias method: need_selection?
#--------------------------------------------------------------------------
alias rpg_usableitem_need_selection_target need_selection?
def need_selection?
return true if @scope == :target_all_foes
return true if @scope == :target_random_foes
return true if @scope == :target_all_allies
return true if @scope == :target_random_allies
return true if @scope == :target_other_allies
return rpg_usableitem_need_selection_target
end
#--------------------------------------------------------------------------
# new method: for_custom?
#--------------------------------------------------------------------------
def for_custom?
return !@scope.is_a?(Integer)
end
#--------------------------------------------------------------------------
# new method: for_everybody?
#--------------------------------------------------------------------------
def for_everybody?
return @scope == :everybody
end
#--------------------------------------------------------------------------
# new method: for_target_all_foes?
#--------------------------------------------------------------------------
def for_target_all_foes?
return @scope == :target_all_foes
end
#--------------------------------------------------------------------------
# new method: for_target_random_foes?
#--------------------------------------------------------------------------
def for_target_random_foes?
return @scope == :target_random_foes
end
#--------------------------------------------------------------------------
# new method: for_all_but_user?
#--------------------------------------------------------------------------
def for_all_but_user?
return @scope == :all_but_user
end
#--------------------------------------------------------------------------
# new method: for_target_all_allies?
#--------------------------------------------------------------------------
def for_target_all_allies?
return @scope == :target_all_allies
end
#--------------------------------------------------------------------------
# new method: for_target_random_allies?
#--------------------------------------------------------------------------
def for_target_random_allies?
return @scope == :target_random_allies
end
#--------------------------------------------------------------------------
# new method: for_random_allies?
#--------------------------------------------------------------------------
def for_random_allies?
return @scope == :random_allies
end
#--------------------------------------------------------------------------
# new method: for_other_allies?
#--------------------------------------------------------------------------
def for_other_allies?
return @scope == :other_allies
end
end # class RPG::UsableItem
#==============================================================================
# ■ Game_Action
#==============================================================================
class Game_Action
#--------------------------------------------------------------------------
# alias method: make_targets
#--------------------------------------------------------------------------
unless $imported["YEA-LunaticTargets"]
alias game_action_make_targets_target make_targets
def make_targets
if !forcing && subject.confusion?
targets = [confusion_target]
elsif item.for_custom?
targets = make_custom_targets
else
targets = game_action_make_targets_target
end
targets = aoe_targets(targets) if $imported["YEA-AreaofEffect"]
return targets
end
end # $imported["YEA-LunaticTargets"]
#--------------------------------------------------------------------------
# compatibility method: default_target_set
#--------------------------------------------------------------------------
if $imported["YEA-LunaticTargets"]
def default_target_set
if !forcing && subject.confusion?
targets = [confusion_target]
elsif item.for_custom?
targets = make_custom_targets
else
targets = game_action_make_targets_ltar
end
targets = aoe_targets(targets) if $imported["YEA-AreaofEffect"]
return targets
end
end # $imported["YEA-LunaticTargets"]
#--------------------------------------------------------------------------
# new method: make_custom_targets
#--------------------------------------------------------------------------
def make_custom_targets
array = []
if item.for_everybody?
array |= opponents_unit.alive_members
array |= friends_unit.alive_members
elsif item.for_target_all_foes?
array |= [opponents_unit.smooth_target(@target_index)]
array |= opponents_unit.alive_members
elsif item.for_target_random_foes?
array |= [opponents_unit.smooth_target(@target_index)]
array += Array.new(item.number_of_targets) { opponents_unit.random_target }
elsif item.for_all_but_user?
array |= friends_unit.alive_members
array -= [subject]
elsif item.for_target_all_allies?
array |= [friends_unit.smooth_target(@target_index)]
array |= friends_unit.alive_members
elsif item.for_target_random_allies?
array |= [friends_unit.smooth_target(@target_index)]
array += Array.new(item.number_of_targets) { friends_unit.random_target }
elsif item.for_random_allies?
array += Array.new(item.number_of_targets) { friends_unit.random_target }
elsif item.for_other_allies?
loop do
array += Array.new(item.number_of_targets) { friends_unit.random_target }
array -= [subject]
if !array.empty?
break
end
end
end
return array
end
end # Game_Action
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# alias method: invoke_item
#--------------------------------------------------------------------------
unless $imported["YEA-BattleEngine"]
alias scene_battle_invoke_item_target invoke_item
def invoke_item(target, item)
target = alive_random_target(target, item) if item.for_random?
scene_battle_invoke_item_target(target, item)
end
end # $imported["YEA-BattleEngine"]
#--------------------------------------------------------------------------
# new method: alive_random_target
#--------------------------------------------------------------------------
def alive_random_target(target, item)
return target if target.alive?
return target if target.dead? == item.for_dead_friend?
return target unless YEA::TARGET::RANDOM_REDIRECT
if item.for_dead_friend? && target.friends_unit.dead_members.empty?
return target
elsif item.for_dead_friend?
return target.friends_unit.random_dead_target
elsif target.friends_unit.all_dead?
return target
else
return target.friends_unit.random_target
end
end
end # Scene_Battle
#==============================================================================
#
# ▼ End of File
#
#==============================================================================
0
0
6
New Quest Gaming
Feb 23, 2024
In Modifications
This addon adds more capabilities to the skill cost script
Credit and Thanks
Yanfly
Roninator2
#==============================================================================
#
# ▼ Yanfly Engine Ace - Skill Cost Manager v1.03.1 add on
# -- Last Updated: 2019.06.06
# -- Level: Normal, Hard, Lunatic
# -- Requires: n/a
# -- add on by Roninator2
#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2019.06.06 - added on mp cost
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# -----------------------------------------------------------------------------
# Actor Notetags - These notetags go in the actors notebox in the database.
# -----------------------------------------------------------------------------
# <mp cost rate: x%>
# Allows the actor to drop the MP cost of skills to x%.
# -----------------------------------------------------------------------------
# Class Notetags - These notetags go in the class notebox in the database.
# -----------------------------------------------------------------------------
# <mp cost rate: x%>
# Allows the class to drop the MP cost of skills to x%.
# -----------------------------------------------------------------------------
# Weapon Notetags - These notetags go in the weapons notebox in the database.
# -----------------------------------------------------------------------------
# <mp cost rate: x%>
# Allows the weapon to drop the MP cost of skills to x% when worn.
# -----------------------------------------------------------------------------
# Armour Notetags - These notetags go in the armours notebox in the database.
# -----------------------------------------------------------------------------
# <mp cost rate: x%>
# Allows the armour to drop the MP cost of skills to x% when worn.
# -----------------------------------------------------------------------------
# State Notetags - These notetags go in the states notebox in the database.
# -----------------------------------------------------------------------------
# <mp cost rate: x%>
# Allows the state to drop the MP cost of skills to x% when afflicted.
module YEA
module REGEXP
module BASEITEM
MP_COST_RATE = /<(?:MP_COST_RATE|mp cost rate):[ ](\d+)([%%])>/i
end
end
end
class RPG::BaseItem
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :mp_cost_rate
#--------------------------------------------------------------------------
# common cache: load_notetags_scm
#--------------------------------------------------------------------------
alias r2_load_notetags_scm_8237fg load_notetags_scm
def load_notetags_scm
r2_load_notetags_scm_8237fg
@mp_cost_rate = 1.0
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when YEA::REGEXP::BASEITEM::MP_COST_RATE
@mp_cost_rate = $1.to_i * 0.01
end
}
end
end
class Game_BattlerBase
def mcr#; sparam(4); end # MCR Mp Cost Rate
n = 1.0
if actor?
n *= self.actor.mp_cost_rate
n *= self.class.mp_cost_rate
for equip in equips
next if equip.nil?
n *= equip.mp_cost_rate
end
else
n *= self.enemy.mp_cost_rate
if $imported["YEA-Doppelganger"] && !self.class.nil?
n *= self.class.mp_cost_rate
end
end
for state in states
next if state.nil?
n *= state.mp_cost_rate
end
return n
end
end
0
0
4
New Quest Gaming
Feb 23, 2024
In Modifications
This mod allows events to slide on slippery tiles
Credit and Thanks
Yanfly
Roninator2
#==============================================================================
#
# ▼ Yanfly Engine Ace - Slippery Tiles v1.00
# -- Last Updated: 2011.12.03
# -- Level: Normal
# -- Requires: n/a
#
#==============================================================================
$imported = {} if $imported.nil?
$imported["YEA-SlipperyTiles"] = true
#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2011.12.03 - Started Script and Finished.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Want slippery tiles without needing to make hundreds of events? Now you can!
# This script binds slippery tile properties to individual tiles through usage
# of notetags and terrain tags.
#
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
#
# -----------------------------------------------------------------------------
# Tileset Notetags - These notetags go in the tileset notebox in the database.
# -----------------------------------------------------------------------------
# <slippery: x>
# <slippery: x, x>
# Sets the tiles marked with terrain tag x to be slippery for that particular
# tileset. When the player walks over a slippery terrain, the player will keep
# moving forward until stopped by an object or until the player lands on ground
# without slippery properties.
#
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
#==============================================================================
module YEA
module SLIPPERY_TILES
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Sliding Animation -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Set what sliding frame you want characters to use when they're on
# slippery tiles. Standing frame is 1.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
SLIDE_FRAME = 2
end # SLIPPERY_TILES
end # YEA
#==============================================================================
# ▼ Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================
module YEA
module REGEXP
module TILESET
SLIPPERY = /<(?:SLIPPERY|slippery tile):[ ]*(\d+(?:\s*,\s*\d+)*)>/i
end # TILESET
end # REGEXP
end # YEA
#==============================================================================
# ■ DataManager
#==============================================================================
module DataManager
#--------------------------------------------------------------------------
# alias method: load_database
#--------------------------------------------------------------------------
class <<self; alias load_database_st load_database; end
def self.load_database
load_database_st
load_notetags_st
end
#--------------------------------------------------------------------------
# new method: load_notetags_st
#--------------------------------------------------------------------------
def self.load_notetags_st
groups = [$data_tilesets]
for group in groups
for obj in group
next if obj.nil?
obj.load_notetags_st
end
end
end
end # DataManager
#==============================================================================
# ■ RPG::Tileset
#==============================================================================
class RPG::Tileset
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :slippery
#--------------------------------------------------------------------------
# common cache: load_notetags_st
#--------------------------------------------------------------------------
def load_notetags_st
@slippery = []
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when YEA::REGEXP::TILESET::SLIPPERY
$1.scan(/\d+/).each { |num|
@slippery.push(num.to_i) if num.to_i > 0 }
#---
end
} # self.note.split
#---
end
end # RPG::Tileset
#==============================================================================
# ■ Game_Map
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# new method: slippery_floor?
#--------------------------------------------------------------------------
def slippery_floor?(dx, dy)
return (valid?(dx, dy) && slippery_tag?(dx, dy))
end
#--------------------------------------------------------------------------
# new method: slippery_tag?
#--------------------------------------------------------------------------
def slippery_tag?(dx, dy)
return tileset.slippery.include?(terrain_tag(dx, dy))
end
end # Game_Map
#==============================================================================
# ■ Game_CharacterBase
#==============================================================================
class Game_CharacterBase
#--------------------------------------------------------------------------
# new method: on_slippery_floor?
#--------------------------------------------------------------------------
def on_slippery_floor?; $game_map.slippery_floor?(@x, @y); end
#--------------------------------------------------------------------------
# new method: slippery_pose?
#--------------------------------------------------------------------------
def slippery_pose?
return false unless on_slippery_floor?
return false if @step_anime
return true
end
end # Game_CharacterBase
# Patch to make events slide on slippery tiles
# requires yanfly's slippery tiles script.
# patch by Roninator2
class Game_Event < Game_Character
#--------------------------------------------------------------------------
# alias method: update
#--------------------------------------------------------------------------
alias game_event_update_st update
def update
game_event_update_st
update_event_slippery
end
#--------------------------------------------------------------------------
# new method: update_event_slippery
#--------------------------------------------------------------------------
def update_event_slippery
return if $game_map.interpreter.running?
return unless on_slippery_floor?
return if moving?
move_straight(@direction)
end
#--------------------------------------------------------------------------
# new method: pattern
#--------------------------------------------------------------------------
def pattern
return YEA::SLIPPERY_TILES::SLIDE_FRAME if slippery_pose?
return @pattern
end
end
#==============================================================================
# ■ Game_Player
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# alias method: dash?
#--------------------------------------------------------------------------
alias game_player_dash_st dash?
def dash?
return false if on_slippery_floor?
return game_player_dash_st
end
#--------------------------------------------------------------------------
# alias method: update
#--------------------------------------------------------------------------
alias game_player_update_st update
def update
game_player_update_st
update_slippery
end
#--------------------------------------------------------------------------
# new method: update_slippery
#--------------------------------------------------------------------------
def update_slippery
return if $game_map.interpreter.running?
return unless on_slippery_floor?
return if moving?
move_straight(@direction)
end
#--------------------------------------------------------------------------
# new method: pattern
#--------------------------------------------------------------------------
def pattern
return YEA::SLIPPERY_TILES::SLIDE_FRAME if slippery_pose?
return @pattern
end
end # Game_Player
#==============================================================================
# ■ Game_Follower
#==============================================================================
class Game_Follower < Game_Character
#--------------------------------------------------------------------------
# new method: pattern
#--------------------------------------------------------------------------
def pattern
return YEA::SLIPPERY_TILES::SLIDE_FRAME if slippery_pose?
return @pattern
end
end # Game_Follower
#==============================================================================
#
# ▼ End of File
#
#==============================================================================
0
0
1
New Quest Gaming
Feb 23, 2024
In Modifications
This mod combines an old feature from yanfly that was removed into the new script
Showing a tp gauge and icon
Credit and Thanks
Yanfly
Roninator2
#==============================================================================
#
# �� Yanfly Engine Ace - Ace Battle Engine v1.24 (mod by Roninator2)
# -- Last Updated: 2012.08.21
# -- Level: Normal, Hard
# -- Requires: n/a
#
#==============================================================================
$imported = {} if $imported.nil?
$imported["YEA-BattleEngine"] = true
#==============================================================================
# �� Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.08.06 - Bug fixed: Repeating sound effect when using a revive spell/item.
#
# 2012.08.06 - Bug fixed: Screen effect for Slip Damage.
# - Bug fixed: Performing Collapse for Slip Damage.
# - Bug fixed: Divided by Zero when Troop has no member.
# 2012.03.04 - Bug fixed: Input crash bug.
# 2012.02.13 - Bug fixed: Odd Victory game crash fixed.
# 2012.02.12 - Bug fixed: Displayed damage in combat log is correct now.
# 2012.01.29 - Visual Changes: Buff stacks now show one popup upon one skill.
# 2012.01.24 - Compatibility Update: Enemy Levels
# 2012.01.18 - Bug Fixed: Help Window clears text upon selecting nil items.
# 2012.01.11 - Added <one animation> tag for multi-hit skills to play an
# animation only once.
# - Reduced lag from battle system constantly recreating bitmaps.
# 2012.01.10 - Compatibility Update: Battle System FTB
# 2012.01.09 - Anticrash methods implemented.
# - Damage Popups are now separate for damage formulas and recovery.
# 2012.01.05 - Bug fixed: Game no longer crashes with escape skills/items.
# 2012.01.02 - Compatibility Update: Target Manager
# - Added Option: AUTO_FAST
# - Random hits now show animations individually.
# 2011.12.30 - Compatibility Update: Enemy Levels
# - Added Option to center the actors in the HUD.
# 2011.12.27 - Bug fixed: TP Damage skills and items no longer crash game.
# - Default battle system bug fixes are now included from YEA's Ace
# Core Engine.
# - Groundwork is also made to support future battle system types.
# - Multi-hit actions no longer linger when a target dies during the
# middle of one of the hits.
# - Compatibility Update: Lunatic Objects v1.02
# 2011.12.26 - Bug fixed: Multi-hit popups occured even after an enemy's dead.
# 2011.12.22 - Bug fixed: Elemental Resistance popup didn't show.
# 2011.12.20 - Bug fixed: Death state popups against immortal states.
# - Bug fixed: During State popup fix.
# - Added HIDE_POPUP_SWITCH.
# 2011.12.17 - Compatibiilty Update: Cast Animations
# 2011.12.15 - Compatibility Update: Battle Command List
# 2011.12.14 - Compatibility Update: Lunatic Objects
# 2011.12.13 - Compatibility Update: Command Party
# 2011.12.12 - Bug fixed: Turn stalling if no inputable members.
# 2011.12.10 - Compatibility update for Automatic Party HUD.
# - Popup graphical bug fixed.
# - Bug fixed: Didn't wait for boss dead animations.
# - Bug fixed: Surprise attacks that froze the game.
# - Bug fixed: Popups didn't show for straight recovery effects.
# 2011.12.08 - Finished Script.
# 2011.12.04 - Started Script.
#
#==============================================================================
# �� Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Ace Battle Engine works as a foundation for future battle engine add-ons. It
# allows for easier management of the battle engine without adding too many
# features, allowing users to customize what they want as they see fit. While
# the Ace Battle Engine isn't an entirely new engine, it gives users control
# that RPG Maker VX Ace didn't originally give them.
#
# Furthermore, this script provides some new features. They are as follows:
#
# -----------------------------------------------------------------------------
# Animation Fixes
# -----------------------------------------------------------------------------
# Though the Yanfly Engine Ace - Ace Core Engine script contains these fixes,
# these fixes are included in this script as well to ensure it's working for
# the battle script in the event someone chooses not to work with the Ace Core
# Engine script. The animation fixes prevent excessive animation overlaying
# (and making the screen look really ugly) and prevents animation clashing
# between two dual wielding normal attack animations.
#
# -----------------------------------------------------------------------------
# Enemy Animations
# -----------------------------------------------------------------------------
# Enemies now show battle animations when they deliver attacks and skills
# against the player's party. Before in RPG Maker VX Ace, it was nothing more
# than just sound effects and the screen shaking. Now, animations play where
# the status window is and relative to the position of each party member.
#
# -----------------------------------------------------------------------------
# Left/Right Command Selection
# -----------------------------------------------------------------------------
# While choosing actions, the player can press Left or Right to move freely
# between (alive) actors to change their skills. Players no longer have to
# cancel all the way back to change one person's skill and reselect everything.
# On that note, there is now the option that when a battle starts or at the
# end of a turn, players will start immediately at command selection rather
# than needing to select "Fight" in the Party Command Window.
#
# -----------------------------------------------------------------------------
# Popups
# -----------------------------------------------------------------------------
# Dealing damage, inflicting states, adding buffs, landing critical hits,
# striking weaknesses, missing attacks, you name it, there's probably a popup
# for it. Popups deliver information to the player in a quick or orderly
# fashion without requiring the player to read lines of text.
#
# -----------------------------------------------------------------------------
# Targeting Window
# -----------------------------------------------------------------------------
# When targeting enemies, the window is no longer displayed. Instead, the
# targeted enemies are highlighted and their names are shown at the top of the
# screen in a help window. Another thing that's changed is when skills that
# target multiple targets are selected, there is a confirmation step that the
# player must take before continuing. In this confirmation step, all of the
# multiple targets are selected and in the help window would display the scope
# of the skill (such as "All Foes" or "Random Foes"). RPG Maker VX Ace skipped
# this step by default.
#
# -----------------------------------------------------------------------------
# Toggling On and Off Special Effects and Text
# -----------------------------------------------------------------------------
# Not everybody likes having the screen shake or the enemies blink when they
# take damage. These effects can now be toggled on and off. Certain text can
# also be toggled on and off from appearing. A lot of the displayed text has
# been rendered redundant through the use of popups.
#
# -----------------------------------------------------------------------------
# Visual Battle Status Window
# -----------------------------------------------------------------------------
# Rather than just having rows of names with HP and MP bars next to them, the
# Battle Status Window now displays actors' faces and their gauges aligned at
# the bottom. More status effects can be shown in addition to showing more
# members on screen at once. The Battle Status Window is also optimized to
# refresh less (thus, removing potential lag from the system).
#
# -----------------------------------------------------------------------------
# Window Position Changes
# -----------------------------------------------------------------------------
# Windows such as the Skill Window and Item Window have been rearranged to
# always provide the player a clear view of the battlefield rather than opening
# up and covering everything. As such, the window positions are placed at the
# bottom of the screen and are repositioned.
#
#==============================================================================
# �� Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below �� Materials/�ef?T but above �� Main. Remember to save.
#
# -----------------------------------------------------------------------------
# Skill Notetags - These notetags go in the skills notebox in the database.
# -----------------------------------------------------------------------------
# <one animation>
# Causes the action to display the action animation only once, even if it's a
# multi-hit action. This is used primarily for non-all scope targeting.
#
# -----------------------------------------------------------------------------
# Item Notetags - These notetags go in the items notebox in the database.
# -----------------------------------------------------------------------------
# <one animation>
# Causes the action to display the action animation only once, even if it's a
# multi-hit action. This is used primarily for non-all scope targeting.
#
# -----------------------------------------------------------------------------
# Enemy Notetags - These notetags go in the enemy notebox in the database.
# -----------------------------------------------------------------------------
# <atk ani 1: x>
# <atk ani 2: x>
# Changes the normal attack animation of the particular enemy to animation x.
# Attack animation 1 is the first one that plays. If there's a second animation
# then the second one will play after in mirrored form.
#
# -----------------------------------------------------------------------------
# State Notetags - These notetags go in the state notebox in the database.
# -----------------------------------------------------------------------------
# <popup add: string>
# <popup rem: string>
# <popup dur: string>
# Status effects now create popups whenever they're inflicted. However, if you
# don't like that a certain status effect uses a particular colour setting,
# change "string" to one of the rulesets below to cause that popup to use a
# different ruleset.
#
# <popup hide add>
# <popup hide rem>
# <popup hide dur>
# Not everybody wants status effects to show popups when inflicted. When this
# is the case, insert the respective tag to hide popups from appearing when the
# state is added, removed, or during the stand-by phases.
#
# -----------------------------------------------------------------------------
# Debug Tools - These tools only work during Test Play.
# -----------------------------------------------------------------------------
# - F5 Key -
# Recovers all actors. Restores their HP and MP to max. Does not affect TP.
# All states and buffs are removed whether they are positive or negative.
#
# - F6 Key -
# Sets all actors to have 1 HP, 0 MP, and 0 TP. States are unaffected.
#
# - F7 Key -
# Sets all actors to have max TP. Everything else is unaffected.
#
# - F8 Key -
# Kills all enemies in battle. Ends the battle quickly.
#
#==============================================================================
# �� Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
#==============================================================================
module YEA
module BATTLE
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - General Battle Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# These settings are adjusted for the overall battle system. These are
# various miscellaneous options to adjust. Each of the settings below will
# explain what they do. Change default enemy battle animations here, too.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
BLINK_EFFECTS = false # Blink sprite when damaged?
FLASH_WHITE_EFFECT = true # Flash enemy white when it starts an attack.
SCREEN_SHAKE = false # Shake screen in battle?
SKIP_PARTY_COMMAND = true # Skips the Fight/Escape menu.
AUTO_FAST = true # Causes message windows to not wait.
ENEMY_ATK_ANI = 36 # Sets default attack animation for enemies.
# If this switch is ON, popups will be hidden. If OFF, the popups will be
# shown. If you do not wish to use this switch, set it to 0.
HIDE_POPUP_SWITCH = 0
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Battle Status Window -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# This sets the default battle system your game will use. If your game
# doesn't have any other battle systems installed, it will use :dtb.
#
# Battle System Requirement
# :dtb - Default Turn Battle. Default system.
# :ftb - YEA Battle System Add-On: Free Turn Battle
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
DEFAULT_BATTLE_SYSTEM = :dtb # Default battle system set.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Battle Status Window -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Here, you can adjust the settings for the battle status window. The
# battle status window, by default, will show the actor's face, HP, MP, TP
# (if viable), and any inflicted status effects.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
BATTLESTATUS_NAME_FONT_SIZE = 20 # Font size used for name.
BATTLESTATUS_TEXT_FONT_SIZE = 16 # Font size used for HP, MP, TP.
BATTLESTATUS_NO_ACTION_ICON = 185 # No action icon.
BATTLESTATUS_HPGAUGE_Y_PLUS = 11 # Y Location buffer used for HP gauge.
BATTLESTATUS_CENTER_FACES = false # Center faces for the Battle Status.
BATTLESTATUS_TP_ICON_GAUGE = true # Draw TP Icon or Gauge; true = icon
BATTLESTATUS_TP_ICON = 805 # Draw TP Icon for the Battle Status.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Help Window Text -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# When selecting a target to attack, this is the text that will be shown
# in place of a target's name for special cases. These special cases are
# for selections that were originally non-targetable battle scopes.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
HELP_TEXT_ALL_FOES = "All Foes"
HELP_TEXT_ONE_RANDOM_FOE = "One Random Foe"
HELP_TEXT_MANY_RANDOM_FOE = "%d Random Foes"
HELP_TEXT_ALL_ALLIES = "All Allies"
HELP_TEXT_ALL_DEAD_ALLIES = "All Dead Allies"
HELP_TEXT_ONE_RANDOM_ALLY = "One Random Ally"
HELP_TEXT_RANDOM_ALLIES = "%d Random Allies"
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Popup Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# These settings will adjust the popups that appear in battle. Popups
# deliver information to your player as battlers deal damage, inflict
# status effects, and more.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
ENABLE_POPUPS = true # Set this to false if you wish to disable them.
FLASH_CRITICAL = true # Sets critical hits to flash.
# This hash adjusts the popup settings that will govern how popups appear.
# Adjust them accordingly.
POPUP_SETTINGS ={
:offset => -24, # Height offset of a popup.
:fade => 12, # Fade rate for each popup.
:full => 60, # Frames before a popup fades.
:hp_dmg => "-%s ", # SprintF for HP damage.
:hp_heal => "+%s ", # SprintF for HP healing.
:mp_dmg => "-%s MP", # SprintF for MP damage.
:mp_heal => "+%s MP", # SprintF for MP healing.
:tp_dmg => "-%s TP", # SprintF for MP damage.
:tp_heal => "+%s TP", # SprintF for MP healing.
:drained => "DRAIN", # Text display for draining HP/MP.
:critical => "CRITICAL!", # Text display for critical hit.
:missed => "MISS", # Text display for missed attack.
:evaded => "EVADE!", # Text display for evaded attack.
:nulled => "NULL", # Text display for nulled attack.
:failed => "FAILED", # Text display for a failed attack.
:add_state => "+%s", # SprintF for added states.
:rem_state => "-%s", # SprintF for removed states.
:dur_state => "%s", # SprintF for during states.
:ele_rates => true, # This will display elemental affinities.
:ele_wait => 20, # This is how many frames will wait.
:weakpoint => "WEAKPOINT", # Appears if foe is weak to element.
:resistant => "RESIST", # Appears if foe is resistant to element.
:immune => "IMMUNE", # Appears if foe is immune to element.
:absorbed => "ABSORB", # Appears if foe can absorb the element.
:add_buff => "%s?{", # Appears when a positive buff is applied.
:add_debuff => "%s?|", # Appears when a negative buff is applied.
} # Do not remove this.
# This is the default font used for the popups. Adjust them accordingly
# or even add new ones.
DEFAULT = ["VL Gothic", "Verdana", "Arial", "Courier"]
# The following are the various rules that govern the individual popup
# types that will appear. Adjust them accordingly. Here is a list of what
# each category does.
# Zoom1 The zoom the popup starts at. Values over 2.0 may cause lag.
# Zoom2 The zoom the popup goes to. Values over 2.0 may cause lag.
# Sz The font size used for the popup text.
# Bold Applying bold for the popup text.
# Italic Applying italic for the popup text.
# Red The red value of the popup text.
# Grn The green value of the popup text.
# Blu The blue value of the popup text.
# Font The font used for the popup text.
POPUP_RULES ={
# Type => [ Zoom1, Zoom2, Sz, Bold, Italic, Red, Grn, Blu, Font]
"DEFAULT" => [ 2.0, 1.0, 24, true, false, 255, 255, 255, DEFAULT],
"CRITICAL" => [ 2.0, 1.0, 24, true, false, 255, 80, 80, DEFAULT],
"HP_DMG" => [ 2.0, 1.0, 36, true, false, 255, 255, 255, DEFAULT],
"HP_HEAL" => [ 2.0, 1.0, 36, true, false, 130, 250, 130, DEFAULT],
"MP_DMG" => [ 2.0, 1.0, 36, true, false, 220, 180, 255, DEFAULT],
"MP_HEAL" => [ 2.0, 1.0, 36, true, false, 160, 230, 255, DEFAULT],
"TP_DMG" => [ 2.0, 1.0, 36, true, false, 242, 108, 78, DEFAULT],
"TP_HEAL" => [ 2.0, 1.0, 36, true, false, 251, 175, 92, DEFAULT],
"ADDSTATE" => [ 2.0, 1.0, 24, true, false, 240, 100, 100, DEFAULT],
"REMSTATE" => [ 2.0, 1.0, 24, true, false, 125, 170, 225, DEFAULT],
"DURSTATE" => [ 2.0, 1.0, 24, true, false, 255, 240, 150, DEFAULT],
"DRAIN" => [ 2.0, 1.0, 36, true, false, 250, 190, 255, DEFAULT],
"POSITIVE" => [ 2.0, 1.0, 24, true, false, 110, 210, 245, DEFAULT],
"NEGATIVE" => [ 2.0, 1.0, 24, true, false, 245, 155, 195, DEFAULT],
"WEAK_ELE" => [ 0.5, 1.0, 24, true, false, 240, 110, 80, DEFAULT],
"IMMU_ELE" => [ 0.5, 1.0, 24, true, false, 185, 235, 255, DEFAULT],
"REST_ELE" => [ 0.5, 1.0, 24, true, false, 145, 230, 180, DEFAULT],
"ABSB_ELE" => [ 0.5, 1.0, 24, true, false, 250, 190, 255, DEFAULT],
"BUFF" => [ 2.0, 1.0, 24, true, false, 255, 240, 100, DEFAULT],
"DEBUFF" => [ 2.0, 1.0, 24, true, false, 160, 130, 200, DEFAULT],
} # Do not remove this.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Streamlined Messages -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Want to remove some of those annoying messages that appear all the time?
# Now you can! Select which messages you want to enable or disable. Some of
# these messages will be rendered useless due to popups.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
MSG_ENEMY_APPEARS = false # Message when enemy appears start of battle.
MSG_CURRENT_STATE = false # Show which states has affected battler.
MSG_CURRENT_ACTION = true # Show the current action of the battler.
MSG_COUNTERATTACK = true # Show the message for a counterattack.
MSG_REFLECT_MAGIC = true # Show message for reflecting magic attacks.
MSG_SUBSTITUTE_HIT = true # Show message for ally taking another's hit.
MSG_FAILURE_HIT = false # Show effect failed against target.
MSG_CRITICAL_HIT = false # Show attack was a critical hit.
MSG_HIT_MISSED = false # Show attack missed the target.
MSG_EVASION = false # Show attack was evaded by the target.
MSG_HP_DAMAGE = false # Show HP damage to target.
MSG_MP_DAMAGE = false # Show MP damage to target.
MSG_TP_DAMAGE = false # Show TP damage to target.
MSG_ADDED_STATES = false # Show target's added states.
MSG_REMOVED_STATES = false # Show target's removed states.
MSG_CHANGED_BUFFS = false # Show target's changed buffs.
end # BATTLE
end # YEA
#==============================================================================
# �� Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================
module YEA
module REGEXP
module ENEMY
ATK_ANI1 = /<(?:ATK_ANI_1|atk ani 1):[ ]*(\d+)>/i
ATK_ANI2 = /<(?:ATK_ANI_2|atk ani 2):[ ]*(\d+)>/i
end # ENEMY
module USABLEITEM
ONE_ANIMATION = /<(?:ONE_ANIMATION|one animation)>/i
end # USABLEITEM
module STATE
POPUP_ADD = /<(?:POPUP_ADD_RULE|popup add rule|popup add):[ ](.*)>/i
POPUP_REM = /<(?:POPUP_REM_RULE|popup rem rule|popup rem):[ ](.*)>/i
POPUP_DUR = /<(?:POPUP_DUR_RULE|popup dur rule|popup dur):[ ](.*)>/i
HIDE_ADD = /<(?:POPUP_HIDE_ADD|popup hide add|hide add)>/i
HIDE_REM = /<(?:POPUP_HIDE_REM|popup hide rem|hide rem)>/i
HIDE_DUR = /<(?:POPUP_HIDE_DUR|popup hide dur|hide dur)>/i
end # STATE
end # REGEXP
end # YEA
#==============================================================================
# ?! Switch
#==============================================================================
module Switch
#--------------------------------------------------------------------------
# self.hide_popups
#--------------------------------------------------------------------------
def self.hide_popups
return false if YEA::BATTLE::HIDE_POPUP_SWITCH <= 0
return $game_switches[YEA::BATTLE::HIDE_POPUP_SWITCH]
end
end # Switch
#==============================================================================
# ?! Colour
#==============================================================================
module Colour
#--------------------------------------------------------------------------
# self.text_colour
#--------------------------------------------------------------------------
def self.text_colour(index)
windowskin = Cache.system("Window")
x = 64 + (index % 8) * 8
y = 96 + (index / 8) * 8
return windowskin.get_pixel(x, y)
end
end # Colour
#==============================================================================
# ?! Icon
#==============================================================================
module Icon
#--------------------------------------------------------------------------
# self.no_action
#--------------------------------------------------------------------------
def self.no_action; return YEA::BATTLE::BATTLESTATUS_NO_ACTION_ICON; end
end # Icon
#==============================================================================
# ?! Numeric
#==============================================================================
class Numeric
#--------------------------------------------------------------------------
# new method: group_digits
#--------------------------------------------------------------------------
unless $imported["YEA-CoreEngine"]
def group; return self.to_s; end
end # $imported["YEA-CoreEngine"]
end # Numeric
#==============================================================================
# ?! DataManager
#==============================================================================
module DataManager
#--------------------------------------------------------------------------
# alias method: load_database
#--------------------------------------------------------------------------
class <<self; alias load_database_abe load_database; end
def self.load_database
load_database_abe
load_notetags_abe
end
#--------------------------------------------------------------------------
# new method: load_notetags_abe
#--------------------------------------------------------------------------
def self.load_notetags_abe
groups = [$data_enemies, $data_states, $data_skills, $data_items]
for group in groups
for obj in group
next if obj.nil?
obj.load_notetags_abe
end
end
end
end # DataManager
#==============================================================================
# ?! RPG::UsableItem
#==============================================================================
class RPG::UsableItem < RPG::BaseItem
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :one_animation
#--------------------------------------------------------------------------
# common cache: load_notetags_abe
#--------------------------------------------------------------------------
def load_notetags_abe
@one_animation = false
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when YEA::REGEXP::USABLEITEM::ONE_ANIMATION
@one_animation = true
end
} # self.note.split
#---
end
end # RPG::UsableItem
#==============================================================================
# ?! RPG::Enemy
#==============================================================================
class RPG::Enemy < RPG::BaseItem
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :atk_animation_id1
attr_accessor :atk_animation_id2
#--------------------------------------------------------------------------
# common cache: load_notetags_abe
#--------------------------------------------------------------------------
def load_notetags_abe
@atk_animation_id1 = YEA::BATTLE::ENEMY_ATK_ANI
@atk_animation_id2 = 0
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when YEA::REGEXP::ENEMY::ATK_ANI1
@atk_animation_id1 = $1.to_i
when YEA::REGEXP::ENEMY::ATK_ANI2
@atk_animation_id2 = $1.to_i
end
} # self.note.split
#---
end
end # RPG::Enemy
#==============================================================================
# ?! RPG::Enemy
#==============================================================================
class RPG::State < RPG::BaseItem
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :popup_rules
#--------------------------------------------------------------------------
# common cache: load_notetags_abe
#--------------------------------------------------------------------------
def load_notetags_abe
@popup_rules = {
:add_state => "ADDSTATE",
:rem_state => "REMSTATE",
:dur_state => nil
} # Do not remove this.
#---
self.note.split(/[\r\n]+/).each { |line|
case line
#---
when YEA::REGEXP::STATE::POPUP_ADD
@popup_rules[:add_state] = $1.upcase.to_s
when YEA::REGEXP::STATE::POPUP_REM
@popup_rules[:rem_state] = $1.upcase.to_s
when YEA::REGEXP::STATE::POPUP_DUR
@popup_rules[:dur_state] = $1.upcase.to_s
when YEA::REGEXP::STATE::HIDE_ADD
@popup_rules[:add_state] = nil
when YEA::REGEXP::STATE::HIDE_REM
@popup_rules[:rem_state] = nil
when YEA::REGEXP::STATE::HIDE_DUR
@popup_rules[:dur_state] = nil
end
} # self.note.split
#---
end
end # RPG::State
#==============================================================================
# ?! BattleManager
#==============================================================================
module BattleManager
#--------------------------------------------------------------------------
# overwrite method: self.battle_start
#--------------------------------------------------------------------------
def self.battle_start
$game_system.battle_count += 1
$game_party.on_battle_start
$game_troop.on_battle_start
return unless YEA::BATTLE::MSG_ENEMY_APPEARS
$game_troop.enemy_names.each do |name|
$game_message.add(sprintf(Vocab::Emerge, name))
end
if @preemptive
$game_message.add(sprintf(Vocab::Preemptive, $game_party.name))
elsif @surprise
$game_message.add(sprintf(Vocab::Surprise, $game_party.name))
end
wait_for_message
end
#--------------------------------------------------------------------------
# overwrite method: make_action_orders
#--------------------------------------------------------------------------
def self.make_action_orders
make_dtb_action_orders if btype?(:dtb)
end
#--------------------------------------------------------------------------
# new method: make_dtb_action_orders
#--------------------------------------------------------------------------
def self.make_dtb_action_orders
@action_battlers = []
@action_battlers += $game_party.members unless @surprise
@action_battlers += $game_troop.members unless @preemptive
@action_battlers.each {|battler| battler.make_speed }
@action_battlers.sort! {|a,b| b.speed - a.speed }
end
#--------------------------------------------------------------------------
# overwrite method: turn_start
#--------------------------------------------------------------------------
def self.turn_start
@phase = :turn
clear_actor
$game_troop.increase_turn
@performed_battlers = []
make_action_orders
end
#--------------------------------------------------------------------------
# overwrite method: next_subject
#--------------------------------------------------------------------------
def self.next_subject
@performed_battlers = [] if @performed_battlers.nil?
loop do
@action_battlers -= @performed_battlers
battler = @action_battlers.shift
return nil unless battler
next unless battler.index && battler.alive?
@performed_battlers.push(battler)
return battler
end
end
#--------------------------------------------------------------------------
# overwrite method: force_action
#--------------------------------------------------------------------------
def self.force_action(battler)
@action_forced = [] if @action_forced == nil
@action_forced.push(battler)
return unless Switch.forced_action_remove
@action_battlers.delete(battler)
end
#--------------------------------------------------------------------------
# overwrite method: action_forced?
#--------------------------------------------------------------------------
def self.action_forced?
@action_forced != nil
end
#--------------------------------------------------------------------------
# overwrite method: action_forced_battler
#--------------------------------------------------------------------------
def self.action_forced_battler
@action_forced.shift
end
#--------------------------------------------------------------------------
# overwrite method: clear_action_force
#--------------------------------------------------------------------------
def self.clear_action_force
return if @action_forced.nil?
@action_forced = nil if @action_forced.empty?
end
#--------------------------------------------------------------------------
# new method: self.init_battle_type
#--------------------------------------------------------------------------
def self.init_battle_type
set_btype($game_system.battle_system)
end
#--------------------------------------------------------------------------
# new method: self.set_btype
#--------------------------------------------------------------------------
def self.set_btype(btype = :dtb)
@battle_type = btype
end
#--------------------------------------------------------------------------
# new method: self.btype?
#--------------------------------------------------------------------------
def self.btype?(btype)
return @battle_type == btype
end
end # BattleManager
#==============================================================================
# ?! Game_System
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# new method: battle_system
#--------------------------------------------------------------------------
def battle_system
if @battle_system.nil?
return battle_system_corrected(YEA::BATTLE::DEFAULT_BATTLE_SYSTEM)
else
return battle_system_corrected(@battle_system)
end
end
#--------------------------------------------------------------------------
# new method: set_battle_system
#--------------------------------------------------------------------------
def set_battle_system(type)
case type
when :dtb; @battle_system = :dtb
when :ftb; @battle_system = $imported["YEA-BattleSystem-FTB"] ? :ftb : :dtb
else; @battle_system = :dtb
end
end
#--------------------------------------------------------------------------
# new method: battle_system_corrected
#--------------------------------------------------------------------------
def battle_system_corrected(type)
case type
when :dtb; return :dtb
when :ftb; return $imported["YEA-BattleSystem-FTB"] ? :ftb : :dtb
else; return :dtb
end
end
end # Game_System
#==============================================================================
# ?! Sprite_Base
#==============================================================================
class Sprite_Base < Sprite
#--------------------------------------------------------------------------
# new method: start_pseudo_animation
#--------------------------------------------------------------------------
unless $imported["YEA-CoreEngine"]
def start_pseudo_animation(animation, mirror = false)
dispose_animation
@animation = animation
return if @animation.nil?
@ani_mirror = mirror
set_animation_rate
@ani_duration = @animation.frame_max * @ani_rate + 1
@ani_sprites = []
end
end # $imported["YEA-CoreEngine"]
end # Sprite_Base
#==============================================================================
# ?! Sprite_Battler
#==============================================================================
class Sprite_Battler < Sprite_Base
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :effect_type
attr_accessor :battler_visible
attr_accessor :popups
#--------------------------------------------------------------------------
# alias method: initialize
#--------------------------------------------------------------------------
alias sprite_battler_initialize_abe initialize
def initialize(viewport, battler = nil)
sprite_battler_initialize_abe(viewport, battler)
@popups = []
@popup_flags = []
end
#--------------------------------------------------------------------------
# alias method: update_bitmap
#--------------------------------------------------------------------------
alias sprite_battler_update_bitmap_abe update_bitmap
def update_bitmap
return if @battler.actor? && @battler.battler_name == ""
sprite_battler_update_bitmap_abe
end
#--------------------------------------------------------------------------
# alias method: setup_new_animation
#--------------------------------------------------------------------------
unless $imported["YEA-CoreEngine"]
alias sprite_battler_setup_new_animation_abe setup_new_animation
def setup_new_animation
sprite_battler_setup_new_animation_abe
return if @battler.pseudo_ani_id <= 0
animation = $data_animations[@battler.pseudo_ani_id]
mirror = @battler.animation_mirror
start_pseudo_animation(animation, mirror)
@battler.pseudo_ani_id = 0
end
end # $imported["YEA-CoreEngine"]
#--------------------------------------------------------------------------
# alias method: setup_new_effect
#--------------------------------------------------------------------------
alias sprite_battler_setup_new_effect_abe setup_new_effect
def setup_new_effect
sprite_battler_setup_new_effect_abe
setup_popups
end
#--------------------------------------------------------------------------
# new method: setup_popups
#--------------------------------------------------------------------------
def setup_popups
return unless @battler.use_sprite?
@battler.popups = [] if @battler.popups.nil?
return if @battler.popups == []
array = @battler.popups.shift
create_new_popup(array[0], array[1], array[2])
end
#--------------------------------------------------------------------------
# new method: create_new_popup
#--------------------------------------------------------------------------
def create_new_popup(value, rules, flags)
return if @battler == nil
return if flags & @popup_flags != []
array = YEA::BATTLE::POPUP_RULES[rules]
for popup in @popups
popup.y -= 24
end
return unless SceneManager.scene.is_a?(Scene_Battle)
return if SceneManager.scene.spriteset.nil?
view = SceneManager.scene.spriteset.viewportPopups
new_popup = Sprite_Popup.new(view, @battler, value, rules, flags)
@popups.push(new_popup)
@popup_flags.push("weakness") if flags.include?("weakness")
@popup_flags.push("resistant") if flags.include?("resistant")
@popup_flags.push("immune") if flags.include?("immune")
@popup_flags.push("absorbed") if flags.include?("absorbed")
end
#--------------------------------------------------------------------------
# alias method: update_effect
#--------------------------------------------------------------------------
alias sprite_battler_update_effect_abe update_effect
def update_effect
sprite_battler_update_effect_abe
update_popups
end
#--------------------------------------------------------------------------
# new method: update_popups
#--------------------------------------------------------------------------
def update_popups
for popup in @popups
popup.update
next unless popup.opacity <= 0
popup.bitmap.dispose
popup.dispose
@popups.delete(popup)
popup = nil
end
@popup_flags = [] if @popups == [] && @popup_flags != []
return unless SceneManager.scene_is?(Scene_Battle)
if @current_active_battler != SceneManager.scene.subject
@current_active_battler = SceneManager.scene.subject
@popup_flags = []
end
end
end # Sprite_Battler
#==============================================================================
# ?! Sprite_Popup
#==============================================================================
class Sprite_Popup < Sprite_Base
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :flags
#--------------------------------------------------------------------------
# initialize
#--------------------------------------------------------------------------
def initialize(viewport, battler, value, rules, flags)
super(viewport)
@value = value
@rules = rules
@rules = "DEFAULT" unless YEA::BATTLE::POPUP_RULES.include?(@rules)
@fade = YEA::BATTLE::POPUP_SETTINGS[:fade]
@full = YEA::BATTLE::POPUP_SETTINGS[:full]
@flags = flags
@battler = battler
create_popup_bitmap
end
#--------------------------------------------------------------------------
# create_popup_bitmap
#--------------------------------------------------------------------------
def create_popup_bitmap
rules_array = YEA::BATTLE::POPUP_RULES[@rules]
bw = Graphics.width
bw += 48 if @flags.include?("state")
bh = Font.default_size * 3
bitmap = Bitmap.new(bw, bh)
bitmap.font.name = rules_array[8]
size = @flags.include?("critical") ? rules_array[2] * 1.2 : rules_array[2]
bitmap.font.size = size
bitmap.font.bold = rules_array[3]
bitmap.font.italic = rules_array[4]
if flags.include?("critical")
crit = YEA::BATTLE::POPUP_RULES["CRITICAL"]
bitmap.font.out_color.set(crit[5], crit[6], crit[7], 255)
else
bitmap.font.out_color.set(0, 0, 0, 255)
end
dx = 0; dy = 0; dw = 0
dx += 24 if @flags.include?("state")
dw += 24 if @flags.include?("state")
if @flags.include?("state") || @flags.include?("buff")
c_width = bitmap.text_size(@value).width
icon_bitmap = $game_temp.iconset
icon_index = flag_state_icon
rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
bitmap.blt(dx+(bw-c_width)/2-36, (bh - 24)/2, icon_bitmap, rect, 255)
end
bitmap.font.color.set(rules_array[5], rules_array[6], rules_array[7])
bitmap.draw_text(dx, dy, bw-dw, bh, @value, 1)
self.bitmap = bitmap
self.x = @battler.screen_x
self.x += rand(4) - rand(4) if @battler.sprite.popups.size >= 1
self.x -= SceneManager.scene.spriteset.viewport1.ox
self.y = @battler.screen_y - @battler.sprite.oy/2
self.y -= @battler.sprite.oy/2 if @battler.actor?
self.y -= SceneManager.scene.spriteset.viewport1.oy
self.ox = bw/2; self.oy = bh/2
self.zoom_x = self.zoom_y = rules_array[0]
if @flags.include?("no zoom")
self.zoom_x = self.zoom_y = rules_array[1]
end
@target_zoom = rules_array[1]
@zoom_direction = (self.zoom_x > @target_zoom) ? "down" : "up"
self.z = 500
end
#--------------------------------------------------------------------------
# update
#--------------------------------------------------------------------------
def update
super
#---
if @flags.include?("critical") && YEA::BATTLE::FLASH_CRITICAL
@hue_duration = 2 if @hue_duration == nil || @hue_duration == 0
@hue_duration -= 1
self.bitmap.hue_change(15) if @hue_duration <= 0
end
#---
if @zoom_direction == "up"
self.zoom_x = [self.zoom_x + 0.075, @target_zoom].min
self.zoom_y = [self.zoom_y + 0.075, @target_zoom].min
else
self.zoom_x = [self.zoom_x - 0.075, @target_zoom].max
self.zoom_y = [self.zoom_y - 0.075, @target_zoom].max
end
#---
@full -= 1
return if @full > 0
self.y -= 1
self.opacity -= @fade
end
#--------------------------------------------------------------------------
# flag_state_icon
#--------------------------------------------------------------------------
def flag_state_icon
for item in @flags; return item if item.is_a?(Integer); end
return 0
end
end # Sprite_Popup
#==============================================================================
# ?! Spriteset_Battle
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :actor_sprites
attr_accessor :enemy_sprites
attr_accessor :viewport1
attr_accessor :viewportPopups
#--------------------------------------------------------------------------
# alias method: create_viewports
#--------------------------------------------------------------------------
alias spriteset_battle_create_viewports_abe create_viewports
def create_viewports
spriteset_battle_create_viewports_abe
@viewportPopups = Viewport.new
@viewportPopups.z = 200
end
#--------------------------------------------------------------------------
# alias method: dispose_viewports
#--------------------------------------------------------------------------
alias spriteset_battle_dispose_viewports_abe dispose_viewports
def dispose_viewports
spriteset_battle_dispose_viewports_abe
@viewportPopups.dispose
end
#--------------------------------------------------------------------------
# alias method: update_viewports
#--------------------------------------------------------------------------
alias spriteset_battle_update_viewports_abe update_viewports
def update_viewports
spriteset_battle_update_viewports_abe
@viewportPopups.update
end
end # Spriteset_Battle
#==============================================================================
# ?! Game_Temp
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :battle_aid
attr_accessor :evaluating
attr_accessor :iconset
#--------------------------------------------------------------------------
# alias method: initialize
#--------------------------------------------------------------------------
alias game_temp_initialize_abe initialize
def initialize
game_temp_initialize_abe
@iconset = Cache.system("Iconset")
end
end # Game_Temp
#==============================================================================
# ?! Game_Action
#==============================================================================
class Game_Action
#--------------------------------------------------------------------------
# overwrite method: speed
#--------------------------------------------------------------------------
def speed
speed = subject.agi
speed += item.speed if item
speed += subject.atk_speed if attack?
return speed
end
#--------------------------------------------------------------------------
# alias method: evaluate_item_with_target
#--------------------------------------------------------------------------
alias evaluate_item_with_target_abe evaluate_item_with_target
def evaluate_item_with_target(target)
$game_temp.evaluating = true
result = evaluate_item_with_target_abe(target)
$game_temp.evaluating = false
return result
end
end # Game_Action
#==============================================================================
# ?! Game_ActionResult
#==============================================================================
class Game_ActionResult
#--------------------------------------------------------------------------
# alias method: clear
#--------------------------------------------------------------------------
alias game_actionresult_clear_abe clear
def clear
game_actionresult_clear_abe
clear_stored_damage
end
#--------------------------------------------------------------------------
# new method: clear_stored_damage
#--------------------------------------------------------------------------
def clear_stored_damage
@stored_hp_damage = 0
@stored_mp_damage = 0
@stored_tp_damage = 0
@stored_hp_drain = 0
@stored_mp_drain = 0
end
#--------------------------------------------------------------------------
# new method: store_damage
#--------------------------------------------------------------------------
def store_damage
@stored_hp_damage += @hp_damage
@stored_mp_damage += @mp_damage
@stored_tp_damage += @tp_damage
@stored_hp_drain += @hp_drain
@stored_mp_drain += @mp_drain
end
#--------------------------------------------------------------------------
# new method: restore_damage
#--------------------------------------------------------------------------
def restore_damage
@hp_damage = @stored_hp_damage
@mp_damage = @stored_mp_damage
@tp_damage = @stored_tp_damage
@hp_drain = @stored_hp_drain
@mp_drain = @stored_mp_drain
clear_stored_damage
end
end # Game_ActionResult
#==============================================================================
# ?! Game_BattlerBase
#==============================================================================
class Game_BattlerBase
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :popups
#--------------------------------------------------------------------------
# new method: create_popup
#--------------------------------------------------------------------------
def create_popup(value, rules = "DEFAULT", flags = [])
return unless SceneManager.scene_is?(Scene_Battle)
return unless YEA::BATTLE::ENABLE_POPUPS
return if Switch.hide_popups
@popups = [] if @popups.nil?
@popups.push([value, rules, flags])
end
#--------------------------------------------------------------------------
# new method: make_damage_popups
#--------------------------------------------------------------------------
def make_damage_popups(user)
if @result.hp_drain != 0
text = YEA::BATTLE::POPUP_SETTINGS[:drained]
rules = "DRAIN"
user.create_popup(text, rules)
setting = :hp_dmg if @result.hp_drain < 0
setting = :hp_heal if @result.hp_drain > 0
rules = "HP_DMG" if @result.hp_drain < 0
rules = "HP_HEAL" if @result.hp_drain > 0
value = @result.hp_drain.abs
text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
user.create_popup(text, rules)
end
if @result.mp_drain != 0
text = YEA::BATTLE::POPUP_SETTINGS[:drained]
rules = "DRAIN"
user.create_popup(text, rules)
setting = :mp_dmg if @result.mp_drain < 0
setting = :mp_heal if @result.mp_drain > 0
rules = "HP_DMG" if @result.mp_drain < 0
rules = "HP_HEAL" if @result.mp_drain > 0
value = @result.mp_drain.abs
text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
user.create_popup(text, rules)
end
#---
flags = []
flags.push("critical") if @result.critical
if @result.hp_damage != 0
setting = :hp_dmg if @result.hp_damage > 0
setting = :hp_heal if @result.hp_damage < 0
rules = "HP_DMG" if @result.hp_damage > 0
rules = "HP_HEAL" if @result.hp_damage < 0
value = @result.hp_damage.abs
text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
create_popup(text, rules, flags)
end
if @result.mp_damage != 0
setting = :mp_dmg if @result.mp_damage > 0
setting = :mp_heal if @result.mp_damage < 0
rules = "MP_DMG" if @result.mp_damage > 0
rules = "MP_HEAL" if @result.mp_damage < 0
value = @result.mp_damage.abs
text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
create_popup(text, rules, flags)
end
if @result.tp_damage != 0
setting = :tp_dmg if @result.tp_damage > 0
setting = :tp_heal if @result.tp_damage < 0
rules = "TP_DMG" if @result.tp_damage > 0
rules = "TP_HEAL" if @result.tp_damage < 0
value = @result.tp_damage.abs
text = sprintf(YEA::BATTLE::POPUP_SETTINGS[setting], value.group)
create_popup(text, rules)
end
@result.store_damage
@result.clear_damage_values
end
#--------------------------------------------------------------------------
# alias method: erase_state
#--------------------------------------------------------------------------
alias game_battlerbase_erase_state_abe erase_state
def erase_state(state_id)
make_state_popup(state_id, :rem_state) if @states.include?(state_id)
game_battlerbase_erase_state_abe(state_id)
end
#--------------------------------------------------------------------------
# new method: make_during_state_popup
#--------------------------------------------------------------------------
def make_during_state_popup
state_id = most_important_state_id
return if state_id == 0
make_state_popup(state_id, :dur_state)
end
#--------------------------------------------------------------------------
# new method: most_important_state_id
#--------------------------------------------------------------------------
def most_important_state_id
states.each {|state| return state.id unless state.message3.empty? }
return 0
end
#--------------------------------------------------------------------------
# new method: make_state_popup
#--------------------------------------------------------------------------
def make_state_popup(state_id, type)
state = $data_states[state_id]
return if state.icon_index == 0
rules = state.popup_rules[type]
return if rules.nil?
text = sprintf(YEA::BATTLE::POPUP_SETTINGS[type], state.name)
flags = ["state", state.icon_index]
create_popup(text, rules, flags)
end
#--------------------------------------------------------------------------
# new method: make_miss_popups
#--------------------------------------------------------------------------
def make_miss_popups(user, item)
return if dead?
if @result.missed
text = YEA::BATTLE::POPUP_SETTINGS[:missed]
rules = "DEFAULT"
create_popup(text, rules)
end
if @result.evaded
text = YEA::BATTLE::POPUP_SETTINGS[:evaded]
rules = "DEFAULT"
create_popup(text, rules)
end
if @result.hit? && !@result.success
text = YEA::BATTLE::POPUP_SETTINGS[:failed]
rules = "DEFAULT"
create_popup(text, rules)
end
if @result.hit? && item.damage.to_hp?
if @result.hp_damage == 0 && @result.hp_damage == 0
text = YEA::BATTLE::POPUP_SETTINGS[:nulled]
rules = "DEFAULT"
create_popup(text, rules)
end
end
end
#--------------------------------------------------------------------------
# new method: make_rate_popup
#--------------------------------------------------------------------------
def make_rate_popup(rate)
return if rate == 1.0
flags = []
if rate > 1.0
text = YEA::BATTLE::POPUP_SETTINGS[:weakpoint]
rules = "WEAK_ELE"
flags.push("weakness")
elsif rate == 0.0
text = YEA::BATTLE::POPUP_SETTINGS[:immune]
rules = "IMMU_ELE"
flags.push("immune")
elsif rate < 0.0
text = YEA::BATTLE::POPUP_SETTINGS[:absorbed]
rules = "ABSB_ELE"
flags.push("absorbed")
else
text = YEA::BATTLE::POPUP_SETTINGS[:resistant]
rules = "REST_ELE"
flags.push("resistant")
end
create_popup(text, rules, flags)
end
#--------------------------------------------------------------------------
# new method: make_buff_popup
#--------------------------------------------------------------------------
def make_buff_popup(param_id, positive = true)
return unless SceneManager.scene_is?(Scene_Battle)
return unless alive?
name = Vocab::param(param_id)
if positive
text = sprintf(YEA::BATTLE::POPUP_SETTINGS[:add_buff], name)
rules = "BUFF"
buff_level = 1
else
text = sprintf(YEA::BATTLE::POPUP_SETTINGS[:add_debuff], name)
rules = "DEBUFF"
buff_level = -1
end
icon = buff_icon_index(buff_level, param_id)
flags = ["buff", icon]
return if @popups.include?([text, rules, flags])
create_popup(text, rules, flags)
end
end # Game_BattlerBase
#==============================================================================
# ?! Game_Battler
#==============================================================================
class Game_Battler < Game_BattlerBase
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :pseudo_ani_id
#--------------------------------------------------------------------------
# alias method: on_battle_end
#--------------------------------------------------------------------------
alias game_battler_on_battle_end_abe on_battle_end
def on_battle_end
game_battler_on_battle_end_abe
@popups = []
end
#--------------------------------------------------------------------------
# alias method: clear_sprite_effects
#--------------------------------------------------------------------------
alias game_battler_clear_sprite_effects_abe clear_sprite_effects
def clear_sprite_effects
game_battler_clear_sprite_effects_abe
@pseudo_ani_id = 0
end
#--------------------------------------------------------------------------
# alias method: item_apply
#--------------------------------------------------------------------------
alias game_battler_item_apply_abe item_apply
def item_apply(user, item)
game_battler_item_apply_abe(user, item)
make_miss_popups(user, item)
end
#--------------------------------------------------------------------------
# alias method: make_damage_value
#--------------------------------------------------------------------------
alias game_battler_make_damage_value_abe make_damage_value
def make_damage_value(user, item)
game_battler_make_damage_value_abe(user, item)
rate = item_element_rate(user, item)
make_rate_popup(rate) unless $game_temp.evaluating
end
#--------------------------------------------------------------------------
# alias method: execute_damage
#--------------------------------------------------------------------------
alias game_battler_execute_damage_abe execute_damage
def execute_damage(user)
game_battler_execute_damage_abe(user)
make_damage_popups(user)
end
#--------------------------------------------------------------------------
# alias method: item_effect_recover_hp
#--------------------------------------------------------------------------
alias game_battler_item_effect_recover_hp_abe item_effect_recover_hp
def item_effect_recover_hp(user, item, effect)
game_battler_item_effect_recover_hp_abe(user, item, effect)
make_damage_popups(user)
end
#--------------------------------------------------------------------------
# alias method: item_effect_recover_mp
#--------------------------------------------------------------------------
alias game_battler_item_effect_recover_mp_abe item_effect_recover_mp
def item_effect_recover_mp(user, item, effect)
game_battler_item_effect_recover_mp_abe(user, item, effect)
make_damage_popups(user)
end
#--------------------------------------------------------------------------
# alias method: item_effect_gain_tp
#--------------------------------------------------------------------------
alias game_battler_item_effect_gain_tp_abe item_effect_gain_tp
def item_effect_gain_tp(user, item, effect)
game_battler_item_effect_gain_tp_abe(user, item, effect)
make_damage_popups(user)
end
#--------------------------------------------------------------------------
# alias method: item_user_effect
#--------------------------------------------------------------------------
alias game_battler_item_user_effect_abe item_user_effect
def item_user_effect(user, item)
game_battler_item_user_effect_abe(user, item)
@result.restore_damage
end
#--------------------------------------------------------------------------
# alias method: add_new_state
#--------------------------------------------------------------------------
alias game_battler_add_new_state_abe add_new_state
def add_new_state(state_id)
game_battler_add_new_state_abe(state_id)
make_state_popup(state_id, :add_state) if @states.include?(state_id)
end
#--------------------------------------------------------------------------
# alias method: add_buff
#--------------------------------------------------------------------------
alias game_battler_add_buff_abe add_buff
def add_buff(param_id, turns)
make_buff_popup(param_id, true)
game_battler_add_buff_abe(param_id, turns)
end
#--------------------------------------------------------------------------
# alias method: add_debuff
#--------------------------------------------------------------------------
alias game_battler_add_debuff_abe add_debuff
def add_debuff(param_id, turns)
make_buff_popup(param_id, false)
game_battler_add_debuff_abe(param_id, turns)
end
#--------------------------------------------------------------------------
# alias method: regenerate_all
#--------------------------------------------------------------------------
alias game_battler_regenerate_all_abe regenerate_all
def regenerate_all
game_battler_regenerate_all_abe
return unless alive?
make_damage_popups(self)
end
#--------------------------------------------------------------------------
# overwrite method: regenerate_hp
#--------------------------------------------------------------------------
def regenerate_hp
damage = -(mhp * hrg).to_i
perform_map_damage_effect if !$game_party.in_battle && damage > 0
@result.hp_damage = [damage, max_slip_damage].min
self.hp -= @result.hp_damage
end
#--------------------------------------------------------------------------
# new method: can_collapse?
#--------------------------------------------------------------------------
def can_collapse?
return false unless dead?
unless actor?
return false unless sprite.battler_visible
array = [:collapse, :boss_collapse, :instant_collapse]
return false if array.include?(sprite.effect_type)
end
return true
end
#--------------------------------------------------------------------------
# new method: draw_mp?
#--------------------------------------------------------------------------
def draw_mp?; return true; end
#--------------------------------------------------------------------------
# new method: draw_tp?
#--------------------------------------------------------------------------
def draw_tp?
return $data_system.opt_display_tp
end
end # Game_Battler
#==============================================================================
# ?! Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# overwrite method: perform_damage_effect
#--------------------------------------------------------------------------
def perform_damage_effect
$game_troop.screen.start_shake(5, 5, 10) if YEA::BATTLE::SCREEN_SHAKE
@sprite_effect_type = :blink if YEA::BATTLE::BLINK_EFFECTS
Sound.play_actor_damage
end
#--------------------------------------------------------------------------
# overwrite method: use_sprite?
#--------------------------------------------------------------------------
def use_sprite?; return true; end
#--------------------------------------------------------------------------
# new method: screen_x
#--------------------------------------------------------------------------
def screen_x
return 0 unless SceneManager.scene_is?(Scene_Battle)
status_window = SceneManager.scene.status_window
return 0 if status_window.nil?
item_rect_width = (status_window.width-24) / $game_party.max_battle_members
ext = SceneManager.scene.info_viewport.ox
rect = SceneManager.scene.status_window.item_rect(self.index)
constant = 128 + 12
return constant + rect.x + item_rect_width / 2 - ext
end
#--------------------------------------------------------------------------
# new method: screen_y
#--------------------------------------------------------------------------
def screen_y
return Graphics.height - 120 unless SceneManager.scene_is?(Scene_Battle)
return Graphics.height - 120 if SceneManager.scene.status_window.nil?
return Graphics.height - (SceneManager.scene.status_window.height * 7/8)
end
#--------------------------------------------------------------------------
# new method: screen_z
#--------------------------------------------------------------------------
def screen_z; return 100; end
#--------------------------------------------------------------------------
# new method: sprite
#--------------------------------------------------------------------------
def sprite
index = $game_party.battle_members.index(self)
return SceneManager.scene.spriteset.actor_sprites[index]
end
#--------------------------------------------------------------------------
# new method: draw_mp?
#--------------------------------------------------------------------------
def draw_mp?
return true unless draw_tp?
for skill in skills
next unless added_skill_types.include?(skill.stype_id)
return true if skill.mp_cost > 0
end
return false
end
#--------------------------------------------------------------------------
# new method: draw_tp?
#--------------------------------------------------------------------------
def draw_tp?
return false unless $data_system.opt_display_tp
for skill in skills
next unless added_skill_types.include?(skill.stype_id)
return true if skill.tp_cost > 0
end
return false
end
#--------------------------------------------------------------------------
# alias method: input
#--------------------------------------------------------------------------
alias game_actor_input_abe input
def input
if @actions.nil?
make_actions
@action_input_index = 0
end
if @actions[@action_input_index].nil?
@actions[@action_input_index] = Game_Action.new(self)
end
return game_actor_input_abe
end
end # Game_Actor
#==============================================================================
# ?! Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# overwrite method: perform_damage_effect
#--------------------------------------------------------------------------
def perform_damage_effect
@sprite_effect_type = :blink if YEA::BATTLE::BLINK_EFFECTS
Sound.play_enemy_damage
end
#--------------------------------------------------------------------------
# new methods: attack_animation_id
#--------------------------------------------------------------------------
def atk_animation_id1; return enemy.atk_animation_id1; end
def atk_animation_id2; return enemy.atk_animation_id2; end
#--------------------------------------------------------------------------
# new method: sprite
#--------------------------------------------------------------------------
def sprite
return SceneManager.scene.spriteset.enemy_sprites.reverse[self.index]
end
end # Game_Enemy
#==============================================================================
# ?! Game_Unit
#==============================================================================
class Game_Unit
#--------------------------------------------------------------------------
# alias method: make_actions
#--------------------------------------------------------------------------
alias game_unit_make_actions_abe make_actions
def make_actions
game_unit_make_actions_abe
refresh_autobattler_status_window
end
#--------------------------------------------------------------------------
# new method: refresh_autobattler_status_window
#--------------------------------------------------------------------------
def refresh_autobattler_status_window
return unless SceneManager.scene_is?(Scene_Battle)
return unless self.is_a?(Game_Party)
SceneManager.scene.refresh_autobattler_status_window
end
end # Game_Unit
#==============================================================================
# ?! Window_PartyCommand
#==============================================================================
class Window_PartyCommand < Window_Command
#--------------------------------------------------------------------------
# overwrite method: process_handling
#--------------------------------------------------------------------------
def process_handling
return unless open? && active
return process_dir6 if Input.repeat?(:RIGHT)
return super
end
#--------------------------------------------------------------------------
# new method: process_dir6
#--------------------------------------------------------------------------
def process_dir6
Sound.play_cursor
Input.update
deactivate
call_handler(:dir6)
end
end # Window_PartyCommand
#==============================================================================
# ?! Window_ActorCommand
#==============================================================================
class Window_ActorCommand < Window_Command
#--------------------------------------------------------------------------
# overwrite method: process_handling
#--------------------------------------------------------------------------
def process_handling
return unless open? && active
return process_dir4 if Input.repeat?(:LEFT)
return process_dir6 if Input.repeat?(:RIGHT)
return super
end
#--------------------------------------------------------------------------
# new method: process_dir4
#--------------------------------------------------------------------------
def process_dir4
Sound.play_cursor
Input.update
deactivate
call_handler(:cancel)
end
#--------------------------------------------------------------------------
# new method: process_dir6
#--------------------------------------------------------------------------
def process_dir6
Sound.play_cursor
Input.update
deactivate
call_handler(:dir6)
end
end # Window_ActorCommand
#==============================================================================
# ?! Window_BattleStatus
#==============================================================================
class Window_BattleStatus < Window_Selectable
#--------------------------------------------------------------------------
# overwrite method: initialize
#--------------------------------------------------------------------------
def initialize
super(0, 0, window_width, window_height)
self.openness = 0
@party = $game_party.battle_members.clone
end
#--------------------------------------------------------------------------
# overwrite method: col_max
#--------------------------------------------------------------------------
def col_max; return $game_party.max_battle_members; end
#--------------------------------------------------------------------------
# new method: battle_members
#--------------------------------------------------------------------------
def battle_members; return $game_party.battle_members; end
#--------------------------------------------------------------------------
# new method: actor
#--------------------------------------------------------------------------
def actor; return battle_members[@index]; end
#--------------------------------------------------------------------------
# overwrite method: update
#--------------------------------------------------------------------------
def update
super
return if @party == $game_party.battle_members
@party = $game_party.battle_members.clone
refresh
end
#--------------------------------------------------------------------------
# overwrite method: draw_item
#--------------------------------------------------------------------------
def draw_item(index)
return if index.nil?
clear_item(index)
actor = battle_members[index]
rect = item_rect(index)
return if actor.nil?
draw_actor_face(actor, rect.x+2, rect.y+2, actor.alive?)
draw_actor_name(actor, rect.x, rect.y, rect.width-8)
draw_actor_action(actor, rect.x, rect.y)
draw_actor_icons(actor, rect.x, line_height*1, rect.width)
gx = YEA::BATTLE::BATTLESTATUS_HPGAUGE_Y_PLUS
contents.font.size = YEA::BATTLE::BATTLESTATUS_TEXT_FONT_SIZE
draw_actor_hp(actor, rect.x+2, line_height*2+gx, rect.width-4)
if draw_tp?(actor) && draw_mp?(actor)
dw = rect.width/2-2
dw += 1 if $imported["YEA-CoreEngine"] && YEA::CORE::GAUGE_OUTLINE
draw_actor_tp(actor, rect.x+2, line_height*3, dw)
if YEA::BATTLE::BATTLESTATUS_TP_ICON_GAUGE
draw_actor_mp(actor, rect.x+2, line_height*3, rect.width-4)
else
dw = rect.width - rect.width/2 - 2
draw_actor_mp(actor, rect.x+rect.width/2, line_height*3, dw)
end
elsif draw_tp?(actor) && !draw_mp?(actor)
draw_actor_tp(actor, rect.x+2, line_height*3, rect.width-4)
else
draw_actor_mp(actor, rect.x+2, line_height*3, rect.width-4)
end
end
#--------------------------------------------------------------------------
# overwrite method: item_rect
#--------------------------------------------------------------------------
def item_rect(index)
rect = Rect.new
rect.width = contents.width / $game_party.max_battle_members
rect.height = contents.height
rect.x = index * rect.width
if YEA::BATTLE::BATTLESTATUS_CENTER_FACES
rect.x += (contents.width - $game_party.members.size * rect.width) / 2
end
rect.y = 0
return rect
end
#--------------------------------------------------------------------------
# overwrite method: draw_face
#--------------------------------------------------------------------------
def draw_face(face_name, face_index, dx, dy, enabled = true)
bitmap = Cache.face(face_name)
fx = [(96 - item_rect(0).width + 1) / 2, 0].max
fy = face_index / 4 * 96 + 2
fw = [item_rect(0).width - 4, 92].min
rect = Rect.new(fx, fy, fw, 92)
rect = Rect.new(face_index % 4 * 96 + fx, fy, fw, 92)
contents.blt(dx, dy, bitmap, rect, enabled ? 255 : translucent_alpha)
bitmap.dispose
end
#--------------------------------------------------------------------------
# overwrite method: draw_actor_name
#--------------------------------------------------------------------------
def draw_actor_name(actor, dx, dy, dw = 112)
reset_font_settings
contents.font.size = YEA::BATTLE::BATTLESTATUS_NAME_FONT_SIZE
change_color(hp_color(actor))
draw_text(dx+24, dy, dw-24, line_height, actor.name)
end
#--------------------------------------------------------------------------
# new method: draw_actor_action
#--------------------------------------------------------------------------
def draw_actor_action(actor, dx, dy)
draw_icon(action_icon(actor), dx, dy)
end
#--------------------------------------------------------------------------
# new method: action_icon
#--------------------------------------------------------------------------
def action_icon(actor)
return Icon.no_action if actor.current_action.nil?
return Icon.no_action if actor.current_action.item.nil?
return actor.current_action.item.icon_index
end
#--------------------------------------------------------------------------
# new method: draw_tp?
#--------------------------------------------------------------------------
def draw_tp?(actor)
return actor.draw_tp?
end
#--------------------------------------------------------------------------
# new method: draw_mp?
#--------------------------------------------------------------------------
def draw_mp?(actor)
return actor.draw_mp?
end
#--------------------------------------------------------------------------
# overwrite method: draw_current_and_max_values
#--------------------------------------------------------------------------
def draw_current_and_max_values(dx, dy, dw, current, max, color1, color2)
change_color(color1)
draw_text(dx, dy, dw, line_height, current.group, 2)
end
#--------------------------------------------------------------------------
# overwrite method: draw_actor_hp
#--------------------------------------------------------------------------
def draw_actor_hp(actor, dx, dy, width = 124)
draw_gauge(dx, dy, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
change_color(system_color)
cy = (Font.default_size - contents.font.size) / 2 + 1
draw_text(dx+2, dy+cy, 30, line_height, Vocab::hp_a)
draw_current_and_max_values(dx, dy+cy, width, actor.hp, actor.mhp,
hp_color(actor), normal_color)
end
#--------------------------------------------------------------------------
# overwrite method: draw_actor_mp
#--------------------------------------------------------------------------
def draw_actor_mp(actor, dx, dy, width = 124)
draw_gauge(dx, dy, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
change_color(system_color)
cy = (Font.default_size - contents.font.size) / 2 + 1
draw_text(dx+2, dy+cy, 30, line_height, Vocab::mp_a)
draw_current_and_max_values(dx, dy+cy, width, actor.mp, actor.mmp,
mp_color(actor), normal_color)
end
#--------------------------------------------------------------------------
# overwrite method: draw_actor_tp
#--------------------------------------------------------------------------
if YEA::BATTLE::BATTLESTATUS_TP_ICON_GAUGE
def draw_actor_tp(actor, dx, dy, width = 124)
cy = (Font.default_size - contents.font.size) / 2 + 1
icon = YEA::BATTLE::BATTLESTATUS_TP_ICON
draw_icon(icon, dx+70, dy-53)
draw_text(dx+46, dy-48, 42, line_height, actor.tp.to_i, 2)
end
else
def draw_actor_tp(actor, dx, dy, width = 124)
draw_gauge(dx, dy, width, actor.tp_rate, tp_gauge_color1, tp_gauge_color2)
change_color(system_color)
cy = (Font.default_size - contents.font.size) / 2 + 1
draw_text(dx+2, dy+cy, 30, line_height, Vocab::tp_a)
change_color(tp_color(actor))
draw_text(dx + width - 42, dy+cy, 42, line_height, actor.tp.to_i, 2)
end
end
end # Window_BattleStatus
#==============================================================================
# ?! Window_BattleActor
#==============================================================================
class Window_BattleActor < Window_BattleStatus
#--------------------------------------------------------------------------
# overwrite method: show
#--------------------------------------------------------------------------
def show
create_flags
super
end
#--------------------------------------------------------------------------
# new method: create_flags
#--------------------------------------------------------------------------
def create_flags
set_select_flag(:any)
select(0)
return if $game_temp.battle_aid.nil?
if $game_temp.battle_aid.need_selection?
select(0)
set_select_flag(:dead) if $game_temp.battle_aid.for_dead_friend?
elsif $game_temp.battle_aid.for_user?
battler = BattleManager.actor
id = battler.nil? ? 0 : $game_party.battle_members.index(battler)
select(id)
set_select_flag(:user)
elsif $game_temp.battle_aid.for_all?
select(0)
set_select_flag(:all)
set_select_flag(:all_dead) if $game_temp.battle_aid.for_dead_friend?
elsif $game_temp.battle_aid.for_random?
select(0)
set_select_flag(:random) if $game_temp.battle_aid.for_random?
end
end
#--------------------------------------------------------------------------
# new method: set_flag
#--------------------------------------------------------------------------
def set_select_flag(flag)
@select_flag = flag
case @select_flag
when :all, :all_dead, :random
@cursor_all = true
else
@cursor_all = false
end
end
#--------------------------------------------------------------------------
# overwrite method: update_cursor
#--------------------------------------------------------------------------
def update_cursor
if @cursor_all
cursor_rect.set(0, 0, contents.width, contents.height)
self.top_row = 0
elsif @index < 0
cursor_rect.empty
else
ensure_cursor_visible
cursor_rect.set(item_rect(@index))
end
end
#--------------------------------------------------------------------------
# overwrite method: cursor_movable?
#--------------------------------------------------------------------------
def cursor_movable?
return false if @select_flag == :user
return super
end
#--------------------------------------------------------------------------
# overwrite method: current_item_enabled?
#--------------------------------------------------------------------------
def current_item_enabled?
return true if $game_temp.battle_aid.nil?
if $game_temp.battle_aid.need_selection?
member = $game_party.battle_members[@index]
return member.dead? if $game_temp.battle_aid.for_dead_friend?
elsif $game_temp.battle_aid.for_dead_friend?
for member in $game_party.battle_members
return true if member.dead?
end
return false
end
return true
end
end # Window_BattleActor
#==============================================================================
# ?! Window_BattleStatusAid
#==============================================================================
class Window_BattleStatusAid < Window_BattleStatus
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :status_window
#--------------------------------------------------------------------------
# overwrite method: initialize
#--------------------------------------------------------------------------
def initialize
super
self.visible = false
self.openness = 255
end
#--------------------------------------------------------------------------
# overwrite method: window_width
#--------------------------------------------------------------------------
def window_width; return 128; end
#--------------------------------------------------------------------------
# overwrite method: show
#--------------------------------------------------------------------------
def show
super
refresh
end
#--------------------------------------------------------------------------
# overwrite method: refresh
#--------------------------------------------------------------------------
def refresh
contents.clear
return if @status_window.nil?
draw_item(@status_window.index)
end
#--------------------------------------------------------------------------
# overwrite method: item_rect
#--------------------------------------------------------------------------
def item_rect(index)
return Rect.new(0, 0, contents.width, contents.height)
end
end # Window_BattleStatusAid
#==============================================================================
# ?! Window_BattleEnemy
#==============================================================================
class Window_BattleEnemy < Window_Selectable
#--------------------------------------------------------------------------
# overwrite method: initialize
#--------------------------------------------------------------------------
def initialize(info_viewport)
super(0, Graphics.height, window_width, fitting_height(1))
refresh
self.visible = false
@info_viewport = info_viewport
end
#--------------------------------------------------------------------------
# overwrite method: col_max
#--------------------------------------------------------------------------
def col_max; return item_max > 0 ? item_max : 1; end
#--------------------------------------------------------------------------
# overwrite method: show
#--------------------------------------------------------------------------
def show
create_flags
super
end
#--------------------------------------------------------------------------
# new method: create_flags
#--------------------------------------------------------------------------
def create_flags
set_select_flag(:any)
select(0)
return if $game_temp.battle_aid.nil?
if $game_temp.battle_aid.need_selection?
select(0)
elsif $game_temp.battle_aid.for_all?
select(0)
set_select_flag(:all)
elsif $game_temp.battle_aid.for_random?
select(0)
set_select_flag(:random)
end
end
#--------------------------------------------------------------------------
# new method: set_flag
#--------------------------------------------------------------------------
def set_select_flag(flag)
@select_flag = flag
case @select_flag
when :all, :random
@cursor_all = true
else
@cursor_all = false
end
end
#--------------------------------------------------------------------------
# new method: select_all?
#--------------------------------------------------------------------------
def select_all?
return true if @select_flag == :all
return true if @select_flag == :random
return false
end
#--------------------------------------------------------------------------
# overwrite method: update_cursor
#--------------------------------------------------------------------------
def update_cursor
if @cursor_all
cursor_rect.set(0, 0, contents.width, contents.height)
self.top_row = 0
elsif @index < 0
cursor_rect.empty
else
ensure_cursor_visible
cursor_rect.set(item_rect(@index))
end
end
#--------------------------------------------------------------------------
# overwrite method: cursor_movable?
#--------------------------------------------------------------------------
def cursor_movable?
return false if @select_flag == :user
return super
end
#--------------------------------------------------------------------------
# overwrite method: current_item_enabled?
#--------------------------------------------------------------------------
def current_item_enabled?
return true if $game_temp.battle_aid.nil?
if $game_temp.battle_aid.need_selection?
member = $game_party.battle_members[@index]
return member.dead? if $game_temp.battle_aid.for_dead_friend?
elsif $game_temp.battle_aid.for_dead_friend?
for member in $game_party.battle_members
return true if member.dead?
end
return false
end
return true
end
#--------------------------------------------------------------------------
# overwrite method: enemy
#--------------------------------------------------------------------------
def enemy; @data[index]; end
#--------------------------------------------------------------------------
# overwrite method: refresh
#--------------------------------------------------------------------------
def refresh
make_item_list
create_contents
draw_all_items
end
#--------------------------------------------------------------------------
# overwrite method: make_item_list
#--------------------------------------------------------------------------
def make_item_list
@data = $game_troop.alive_members
@data.sort! { |a,b| a.screen_x <=> b.screen_x }
end
#--------------------------------------------------------------------------
# overwrite method: draw_item
#--------------------------------------------------------------------------
def draw_item(index); return; end
#--------------------------------------------------------------------------
# overwrite method: update
#--------------------------------------------------------------------------
def update
super
return unless active
enemy.sprite_effect_type = :whiten
return unless select_all?
for enemy in $game_troop.alive_members
enemy.sprite_effect_type = :whiten
end
end
end # Window_BattleEnemy
#==============================================================================
# ?! Window_BattleHelp
#==============================================================================
class Window_BattleHelp < Window_Help
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :actor_window
attr_accessor :enemy_window
#--------------------------------------------------------------------------
# update
#--------------------------------------------------------------------------
def update
super
if !self.visible and @text != ""
@text = ""
return refresh
end
update_battler_name
end
#--------------------------------------------------------------------------
# update_battler_name
#--------------------------------------------------------------------------
def update_battler_name
return unless @actor_window.active || @enemy_window.active
if @actor_window.active
battler = $game_party.battle_members[@actor_window.index]
elsif @enemy_window.active
battler = @enemy_window.enemy
end
if special_display?
refresh_special_case(battler)
else
refresh_battler_name(battler) if battler_name(battler) != @text
end
end
#--------------------------------------------------------------------------
# battler_name
#--------------------------------------------------------------------------
def battler_name(battler)
text = battler.name.clone
return text
end
#--------------------------------------------------------------------------
# refresh_battler_name
#--------------------------------------------------------------------------
def refresh_battler_name(battler)
contents.clear
reset_font_settings
change_color(normal_color)
@text = battler_name(battler)
icons = battler.state_icons + battler.buff_icons
dy = icons.size <= 0 ? line_height / 2 : 0
draw_text(0, dy, contents.width, line_height, @text, 1)
dx = (contents.width - (icons.size * 24)) / 2
draw_actor_icons(battler, dx, line_height, contents.width)
end
#--------------------------------------------------------------------------
# special_display?
#--------------------------------------------------------------------------
def special_display?
return false if $game_temp.battle_aid.nil?
return false if $game_temp.battle_aid.for_user?
return !$game_temp.battle_aid.need_selection?
end
#--------------------------------------------------------------------------
# refresh_special_case
#--------------------------------------------------------------------------
def refresh_special_case(battler)
if $game_temp.battle_aid.for_opponent?
if $game_temp.battle_aid.for_all?
text = YEA::BATTLE::HELP_TEXT_ALL_FOES
else
case $game_temp.battle_aid.number_of_targets
when 1
text = YEA::BATTLE::HELP_TEXT_ONE_RANDOM_FOE
else
number = $game_temp.battle_aid.number_of_targets
text = sprintf(YEA::BATTLE::HELP_TEXT_MANY_RANDOM_FOE, number)
end
end
else # $game_temp.battle_aid.for_friend?
if $game_temp.battle_aid.for_dead_friend?
text = YEA::BATTLE::HELP_TEXT_ALL_DEAD_ALLIES
elsif $game_temp.battle_aid.for_random?
case $game_temp.battle_aid.number_of_targets
when 1
text = YEA::BATTLE::HELP_TEXT_ONE_RANDOM_ALLY
else
number = $game_temp.battle_aid.number_of_targets
text = sprintf(YEA::BATTLE::HELP_TEXT_RANDOM_ALLIES, number)
end
else
text = YEA::BATTLE::HELP_TEXT_ALL_ALLIES
end
end
return if text == @text
@text = text
contents.clear
reset_font_settings
draw_text(0, 0, contents.width, line_height*2, @text, 1)
end
end # Window_BattleHelp
#==============================================================================
# ?! Window_BattleLog
#==============================================================================
class Window_BattleLog < Window_Selectable
#--------------------------------------------------------------------------
# alias method: display_current_state
#--------------------------------------------------------------------------
alias window_battlelog_display_current_state_abe display_current_state
def display_current_state(subject)
subject.make_during_state_popup
return unless YEA::BATTLE::MSG_CURRENT_STATE
window_battlelog_display_current_state_abe(subject)
end
#--------------------------------------------------------------------------
# alias method: display_use_item
#--------------------------------------------------------------------------
alias window_battlelog_display_use_item_abe display_use_item
def display_use_item(subject, item)
return unless YEA::BATTLE::MSG_CURRENT_ACTION
window_battlelog_display_use_item_abe(subject, item)
end
#--------------------------------------------------------------------------
# alias method: display_counter
#--------------------------------------------------------------------------
alias window_battlelog_display_counter_abe display_counter
def display_counter(target, item)
if YEA::BATTLE::MSG_COUNTERATTACK
window_battlelog_display_counter_abe(target, item)
else
Sound.play_evasion
end
end
#--------------------------------------------------------------------------
# alias method: display_reflection
#--------------------------------------------------------------------------
alias window_battlelog_display_reflection_abe display_reflection
def display_reflection(target, item)
if YEA::BATTLE::MSG_REFLECT_MAGIC
window_battlelog_display_reflection_abe(target, item)
else
Sound.play_reflection
end
end
#--------------------------------------------------------------------------
# alias method: display_substitute
#--------------------------------------------------------------------------
alias window_battlelog_display_substitute_abe display_substitute
def display_substitute(substitute, target)
return unless YEA::BATTLE::MSG_SUBSTITUTE_HIT
window_battlelog_display_substitute_abe(substitute, target)
end
#--------------------------------------------------------------------------
# alias method: display_failure
#--------------------------------------------------------------------------
alias window_battlelog_display_failure_abe display_failure
def display_failure(target, item)
return unless YEA::BATTLE::MSG_FAILURE_HIT
window_battlelog_display_failure_abe(target, item)
end
#--------------------------------------------------------------------------
# alias method: display_critical
#--------------------------------------------------------------------------
alias window_battlelog_display_critical_abe display_critical
def display_critical(target, item)
return unless YEA::BATTLE::MSG_CRITICAL_HIT
window_battlelog_display_critical_abe(target, item)
end
#--------------------------------------------------------------------------
# alias method: display_miss
#--------------------------------------------------------------------------
alias window_battlelog_display_miss_abe display_miss
def display_miss(target, item)
return unless YEA::BATTLE::MSG_HIT_MISSED
window_battlelog_display_miss_abe(target, item)
end
#--------------------------------------------------------------------------
# alias method: display_evasion
#--------------------------------------------------------------------------
alias window_battlelog_display_evasion_abe display_evasion
def display_evasion(target, item)
if YEA::BATTLE::MSG_EVASION
window_battlelog_display_evasion_abe(target, item)
else
if !item || item.physical?
Sound.play_evasion
else
Sound.play_magic_evasion
end
end
end
#--------------------------------------------------------------------------
# overwrite method: 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
return unless YEA::BATTLE::MSG_HP_DAMAGE
add_text(target.result.hp_damage_text)
wait
end
#--------------------------------------------------------------------------
# overwrite method: 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
return unless YEA::BATTLE::MSG_MP_DAMAGE
add_text(target.result.mp_damage_text)
wait
end
#--------------------------------------------------------------------------
# overwrite method: 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
return unless YEA::BATTLE::MSG_TP_DAMAGE
add_text(target.result.tp_damage_text)
wait
end
#--------------------------------------------------------------------------
# alias method: display_added_states
#--------------------------------------------------------------------------
alias window_battlelog_display_added_states_abe display_added_states
def display_added_states(target)
target.perform_collapse_effect if target.can_collapse?
return unless YEA::BATTLE::MSG_ADDED_STATES
window_battlelog_display_added_states_abe(target)
end
#--------------------------------------------------------------------------
# alias method: display_removed_states
#--------------------------------------------------------------------------
alias window_battlelog_display_removed_states_abe display_removed_states
def display_removed_states(target)
return unless YEA::BATTLE::MSG_REMOVED_STATES
window_battlelog_display_removed_states_abe(target)
end
#--------------------------------------------------------------------------
# alias method: display_changed_buffs
#--------------------------------------------------------------------------
alias window_battlelog_display_changed_buffs_abe display_changed_buffs
def display_changed_buffs(target)
return unless YEA::BATTLE::MSG_CHANGED_BUFFS
window_battlelog_display_changed_buffs_abe(target)
end
end # Window_BattleLog
#==============================================================================
# ?! Window_SkillList
#==============================================================================
class Window_SkillList < Window_Selectable
#--------------------------------------------------------------------------
# overwrite method: spacing
#--------------------------------------------------------------------------
def spacing
return 8 if $game_party.in_battle
return super
end
end # Window_SkillList
#==============================================================================
# ?! Window_ItemList
#==============================================================================
class Window_ItemList < Window_Selectable
#--------------------------------------------------------------------------
# overwrite method: spacing
#--------------------------------------------------------------------------
def spacing
return 8 if $game_party.in_battle
return super
end
end # Window_ItemList
#==============================================================================
# ?! Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# public instance variables
#--------------------------------------------------------------------------
attr_accessor :enemy_window
attr_accessor :info_viewport
attr_accessor :spriteset
attr_accessor :status_window
attr_accessor :status_aid_window
attr_accessor :subject
#--------------------------------------------------------------------------
# alias method: create_spriteset
#--------------------------------------------------------------------------
alias scene_battle_create_spriteset_abe create_spriteset
def create_spriteset
BattleManager.init_battle_type
scene_battle_create_spriteset_abe
end
#--------------------------------------------------------------------------
# alias method: update_basic
#--------------------------------------------------------------------------
alias scene_battle_update_basic_abe update_basic
def update_basic
scene_battle_update_basic_abe
update_debug
end
#--------------------------------------------------------------------------
# new method: update_debug
#--------------------------------------------------------------------------
def update_debug
return unless $TEST || $BTEST
debug_heal_party if Input.trigger?(:F5)
debug_damage_party if Input.trigger?(:F6)
debug_fill_tp if Input.trigger?(:F7)
debug_kill_all if Input.trigger?(:F8)
end
#--------------------------------------------------------------------------
# new method: debug_heal_party
#--------------------------------------------------------------------------
def debug_heal_party
Sound.play_recovery
for member in $game_party.battle_members
member.recover_all
end
@status_window.refresh
end
#--------------------------------------------------------------------------
# new method: debug_damage_party
#--------------------------------------------------------------------------
def debug_damage_party
Sound.play_actor_damage
for member in $game_party.alive_members
member.hp = 1
member.mp = 0
member.tp = 0
end
@status_window.refresh
end
#--------------------------------------------------------------------------
# new method: debug_fill_tp
#--------------------------------------------------------------------------
def debug_fill_tp
Sound.play_recovery
for member in $game_party.alive_members
member.tp = member.max_tp
end
@status_window.refresh
end
#--------------------------------------------------------------------------
# new method: debug_kill_all
#--------------------------------------------------------------------------
def debug_kill_all
for enemy in $game_troop.alive_members
enemy.hp = 0
enemy.perform_collapse_effect
end
BattleManager.judge_win_loss
@log_window.wait
@log_window.wait_for_effect
end
#--------------------------------------------------------------------------
# alias method: create_all_windows
#--------------------------------------------------------------------------
alias scene_battle_create_all_windows_abe create_all_windows
def create_all_windows
scene_battle_create_all_windows_abe
create_battle_status_aid_window
set_help_window
end
#--------------------------------------------------------------------------
# alias method: create_info_viewport
#--------------------------------------------------------------------------
alias scene_battle_create_info_viewport_abe create_info_viewport
def create_info_viewport
scene_battle_create_info_viewport_abe
@status_window.refresh
end
#--------------------------------------------------------------------------
# new method: create_battle_status_aid_window
#--------------------------------------------------------------------------
def create_battle_status_aid_window
@status_aid_window = Window_BattleStatusAid.new
@status_aid_window.status_window = @status_window
@status_aid_window.x = Graphics.width - @status_aid_window.width
@status_aid_window.y = Graphics.height - @status_aid_window.height
end
#--------------------------------------------------------------------------
# overwrite method: create_help_window
#--------------------------------------------------------------------------
def create_help_window
@help_window = Window_BattleHelp.new
@help_window.hide
end
#--------------------------------------------------------------------------
# new method: set_help_window
#--------------------------------------------------------------------------
def set_help_window
@help_window.actor_window = @actor_window
@help_window.enemy_window = @enemy_window
end
#--------------------------------------------------------------------------
# alias method: create_party_command_window
#--------------------------------------------------------------------------
alias scene_battle_create_party_command_window_abe create_party_command_window
def create_party_command_window
scene_battle_create_party_command_window_abe
@party_command_window.set_handler(:dir6, method(:command_fight))
end
#--------------------------------------------------------------------------
# alias method: create_actor_command_window
#--------------------------------------------------------------------------
alias scene_battle_create_actor_command_window_abe create_actor_command_window
def create_actor_command_window
scene_battle_create_actor_command_window_abe
@actor_command_window.set_handler(:dir4, method(:prior_command))
@actor_command_window.set_handler(:dir6, method(:next_command))
end
#--------------------------------------------------------------------------
# alias method: create_skill_window
#--------------------------------------------------------------------------
alias scene_battle_create_skill_window_abe create_skill_window
def create_skill_window
scene_battle_create_skill_window_abe
@skill_window.height = @info_viewport.rect.height
@skill_window.width = Graphics.width - @actor_command_window.width
@skill_window.y = Graphics.height - @skill_window.height
end
#--------------------------------------------------------------------------
# alias method: create_item_window
#--------------------------------------------------------------------------
alias scene_battle_create_item_window_abe create_item_window
def create_item_window
scene_battle_create_item_window_abe
@item_window.height = @skill_window.height
@item_window.width = @skill_window.width
@item_window.y = Graphics.height - @item_window.height
end
#--------------------------------------------------------------------------
# alias method: show_fast?
#--------------------------------------------------------------------------
alias scene_battle_show_fast_abe show_fast?
def show_fast?
return true if YEA::BATTLE::AUTO_FAST
return scene_battle_show_fast_abe
end
#--------------------------------------------------------------------------
# alias method: next_command
#--------------------------------------------------------------------------
alias scene_battle_next_command_abe next_command
def next_command
@status_window.show
redraw_current_status
@actor_command_window.show
@status_aid_window.hide
scene_battle_next_command_abe
end
#--------------------------------------------------------------------------
# alias method: prior_command
#--------------------------------------------------------------------------
alias scene_battle_prior_command_abe prior_command
def prior_command
redraw_current_status
scene_battle_prior_command_abe
end
#--------------------------------------------------------------------------
# new method: redraw_current_status
#--------------------------------------------------------------------------
def redraw_current_status
return if @status_window.index < 0
@status_window.draw_item(@status_window.index)
end
#--------------------------------------------------------------------------
# alias method: command_attack
#--------------------------------------------------------------------------
alias scene_battle_command_attack_abe command_attack
def command_attack
$game_temp.battle_aid = $data_skills[BattleManager.actor.attack_skill_id]
scene_battle_command_attack_abe
end
#--------------------------------------------------------------------------
# alias method: command_skill
#--------------------------------------------------------------------------
alias scene_battle_command_skill_abe command_skill
def command_skill
scene_battle_command_skill_abe
@status_window.hide
@actor_command_window.hide
@status_aid_window.show
end
#--------------------------------------------------------------------------
# alias method: command_item
#--------------------------------------------------------------------------
alias scene_battle_command_item_abe command_item
def command_item
scene_battle_command_item_abe
@status_window.hide
@actor_command_window.hide
@status_aid_window.show
end
#--------------------------------------------------------------------------
# overwrite method: on_skill_ok
#--------------------------------------------------------------------------
def on_skill_ok
@skill = @skill_window.item
$game_temp.battle_aid = @skill
BattleManager.actor.input.set_skill(@skill.id)
BattleManager.actor.last_skill.object = @skill
if @skill.for_opponent?
select_enemy_selection
elsif @skill.for_friend?
select_actor_selection
else
@skill_window.hide
next_command
$game_temp.battle_aid = nil
end
end
#--------------------------------------------------------------------------
# alias method: on_skill_cancel
#--------------------------------------------------------------------------
alias scene_battle_on_skill_cancel_abe on_skill_cancel
def on_skill_cancel
scene_battle_on_skill_cancel_abe
@status_window.show
@actor_command_window.show
@status_aid_window.hide
end
#--------------------------------------------------------------------------
# overwrite method: on_item_ok
#--------------------------------------------------------------------------
def on_item_ok
@item = @item_window.item
$game_temp.battle_aid = @item
BattleManager.actor.input.set_item(@item.id)
if @item.for_opponent?
select_enemy_selection
elsif @item.for_friend?
select_actor_selection
else
@item_window.hide
next_command
$game_temp.battle_aid = nil
end
$game_party.last_item.object = @item
end
#--------------------------------------------------------------------------
# alias method: on_item_cancel
#--------------------------------------------------------------------------
alias scene_battle_on_item_cancel_abe on_item_cancel
def on_item_cancel
scene_battle_on_item_cancel_abe
@status_window.show
@actor_command_window.show
@status_aid_window.hide
end
#--------------------------------------------------------------------------
# alias method: select_actor_selection
#--------------------------------------------------------------------------
alias scene_battle_select_actor_selection_abe select_actor_selection
def select_actor_selection
@status_aid_window.refresh
scene_battle_select_actor_selection_abe
@status_window.hide
@skill_window.hide
@item_window.hide
@help_window.show
end
#--------------------------------------------------------------------------
# alias method: on_actor_ok
#--------------------------------------------------------------------------
alias scene_battle_on_actor_ok_abe on_actor_ok
def on_actor_ok
$game_temp.battle_aid = nil
scene_battle_on_actor_ok_abe
@status_window.show
if $imported["YEA-BattleCommandList"] && !@confirm_command_window.nil?
@actor_command_window.visible = !@confirm_command_window.visible
else
@actor_command_window.show
end
@status_aid_window.hide
end
#--------------------------------------------------------------------------
# alias method: on_actor_cancel
#--------------------------------------------------------------------------
alias scene_battle_on_actor_cancel_abe on_actor_cancel
def on_actor_cancel
BattleManager.actor.input.clear
@status_aid_window.refresh
$game_temp.battle_aid = nil
scene_battle_on_actor_cancel_abe
case @actor_command_window.current_symbol
when :skill
@skill_window.show
when :item
@item_window.show
end
end
#--------------------------------------------------------------------------
# alias method: select_enemy_selection
#--------------------------------------------------------------------------
alias scene_battle_select_enemy_selection_abe select_enemy_selection
def select_enemy_selection
@status_aid_window.refresh
scene_battle_select_enemy_selection_abe
@help_window.show
end
#--------------------------------------------------------------------------
# alias method: on_enemy_ok
#--------------------------------------------------------------------------
alias scene_battle_on_enemy_ok_abe on_enemy_ok
def on_enemy_ok
$game_temp.battle_aid = nil
scene_battle_on_enemy_ok_abe
end
#--------------------------------------------------------------------------
# alias method: on_enemy_cancel
#--------------------------------------------------------------------------
alias scene_battle_on_enemy_cancel_abe on_enemy_cancel
def on_enemy_cancel
BattleManager.actor.input.clear
@status_aid_window.refresh
$game_temp.battle_aid = nil
scene_battle_on_enemy_cancel_abe
if @skill_window.visible || @item_window.visible
@help_window.show
else
@help_window.hide
end
end
#--------------------------------------------------------------------------
# alias method: battle_start
#--------------------------------------------------------------------------
alias scene_battle_battle_start_abe battle_start
def battle_start
scene_battle_battle_start_abe
return unless YEA::BATTLE::SKIP_PARTY_COMMAND
@party_command_window.deactivate
if BattleManager.input_start
command_fight
else
turn_start
end
end
#--------------------------------------------------------------------------
# overwrite method: turn_end
#--------------------------------------------------------------------------
def turn_end
all_battle_members.each do |battler|
battler.on_turn_end
status_redraw_target(battler)
@log_window.display_auto_affected_status(battler)
@log_window.wait_and_clear
end
update_party_cooldowns if $imported["YEA-CommandParty"]
BattleManager.turn_end
process_event
start_party_command_selection
return if end_battle_conditions?
return unless YEA::BATTLE::SKIP_PARTY_COMMAND
if BattleManager.input_start
@party_command_window.deactivate
command_fight
else
@party_command_window.deactivate
turn_start
end
end
#--------------------------------------------------------------------------
# new method: end_battle_conditions?
#--------------------------------------------------------------------------
def end_battle_conditions?
return true if $game_party.members.empty?
return true if $game_party.all_dead?
return true if $game_troop.all_dead?
return true if BattleManager.aborting?
return false
end
#--------------------------------------------------------------------------
# overwrite method: execute_action
#--------------------------------------------------------------------------
def execute_action
@subject.sprite_effect_type = :whiten if YEA::BATTLE::FLASH_WHITE_EFFECT
use_item
@log_window.wait_and_clear
end
#--------------------------------------------------------------------------
# overwrite method: apply_item_effects
#--------------------------------------------------------------------------
def apply_item_effects(target, item)
if $imported["YEA-LunaticObjects"]
lunatic_object_effect(:prepare, item, @subject, target)
end
target.item_apply(@subject, item)
status_redraw_target(@subject)
status_redraw_target(target) unless target == @subject
@log_window.display_action_results(target, item)
if $imported["YEA-LunaticObjects"]
lunatic_object_effect(:during, item, @subject, target)
end
perform_collapse_check(target)
end
#--------------------------------------------------------------------------
# overwite method: invoke_counter_attack
#--------------------------------------------------------------------------
def invoke_counter_attack(target, item)
@log_window.display_counter(target, item)
attack_skill = $data_skills[target.attack_skill_id]
@subject.item_apply(target, attack_skill)
status_redraw_target(@subject)
status_redraw_target(target) unless target == @subject
@log_window.display_action_results(@subject, attack_skill)
perform_collapse_check(target)
perform_collapse_check(@subject)
end
#--------------------------------------------------------------------------
# new method: perform_collapse_check
#--------------------------------------------------------------------------
def perform_collapse_check(target)
return if YEA::BATTLE::MSG_ADDED_STATES
target.perform_collapse_effect if target.can_collapse?
@log_window.wait
@log_window.wait_for_effect
end
#--------------------------------------------------------------------------
# overwrite method: show_attack_animation
#--------------------------------------------------------------------------
def show_attack_animation(targets)
show_normal_animation(targets, @subject.atk_animation_id1, false)
wait_for_animation
show_normal_animation(targets, @subject.atk_animation_id2, true)
end
#--------------------------------------------------------------------------
# overwrite method: show_normal_animation
#--------------------------------------------------------------------------
def show_normal_animation(targets, animation_id, mirror = false)
animation = $data_animations[animation_id]
return if animation.nil?
ani_check = false
targets.each do |target|
if ani_check && target.animation_id <= 0
target.pseudo_ani_id = animation_id
else
target.animation_id = animation_id
end
target.animation_mirror = mirror
ani_check = true if animation.to_screen?
end
end
#--------------------------------------------------------------------------
# overwrite method: process_action_end
#--------------------------------------------------------------------------
def process_action_end
@subject.on_action_end
status_redraw_target(@subject)
@log_window.display_auto_affected_status(@subject)
@log_window.wait_and_clear
@log_window.display_current_state(@subject)
@log_window.wait_and_clear
BattleManager.judge_win_loss
end
#--------------------------------------------------------------------------
# overwrite method: use_item
#--------------------------------------------------------------------------
def use_item
item = @subject.current_action.item
@log_window.display_use_item(@subject, item)
@subject.use_item(item)
status_redraw_target(@subject)
if $imported["YEA-LunaticObjects"]
lunatic_object_effect(:before, item, @subject, @subject)
end
process_casting_animation if $imported["YEA-CastAnimations"]
targets = @subject.current_action.make_targets.compact rescue []
show_animation(targets, item.animation_id) if show_all_animation?(item)
targets.each {|target|
if $imported["YEA-TargetManager"]
target = alive_random_target(target, item) if item.for_random?
end
item.repeats.times { invoke_item(target, item) } }
if $imported["YEA-LunaticObjects"]
lunatic_object_effect(:after, item, @subject, @subject)
end
end
#--------------------------------------------------------------------------
# alias method: invoke_item
#--------------------------------------------------------------------------
alias scene_battle_invoke_item_abe invoke_item
def invoke_item(target, item)
show_animation([target], item.animation_id) if separate_ani?(target, item)
if target.dead? != item.for_dead_friend?
@subject.last_target_index = target.index
return
end
scene_battle_invoke_item_abe(target, item)
end
#--------------------------------------------------------------------------
# new method: show_all_animation?
#--------------------------------------------------------------------------
def show_all_animation?(item)
return true if item.one_animation
return false if $data_animations[item.animation_id].nil?
return false unless $data_animations[item.animation_id].to_screen?
return true
end
#--------------------------------------------------------------------------
# new method: separate_ani?
#--------------------------------------------------------------------------
def separate_ani?(target, item)
return false if item.one_animation
return false if $data_animations[item.animation_id].nil?
return false if $data_animations[item.animation_id].to_screen?
return target.dead? == item.for_dead_friend?
end
#--------------------------------------------------------------------------
# new method: status_redraw_target
#--------------------------------------------------------------------------
def status_redraw_target(target)
return unless target.actor?
@status_window.draw_item($game_party.battle_members.index(target))
end
#--------------------------------------------------------------------------
# alias method: start_party_command_selection
#--------------------------------------------------------------------------
alias start_party_command_selection_abe start_party_command_selection
def start_party_command_selection
@status_window.refresh unless scene_changing?
start_party_command_selection_abe
end
#--------------------------------------------------------------------------
# overwrite method: refresh_status
#--------------------------------------------------------------------------
def refresh_status; return; end
#--------------------------------------------------------------------------
# new method: refresh_autobattler_status_window
#--------------------------------------------------------------------------
def refresh_autobattler_status_window
for member in $game_party.battle_members
next unless member.auto_battle?
@status_window.draw_item(member.index)
end
end
#--------------------------------------------------------------------------
# new method: hide_extra_gauges
#--------------------------------------------------------------------------
def hide_extra_gauges
# Made for compatibility
end
#--------------------------------------------------------------------------
# new method: show_extra_gauges
#--------------------------------------------------------------------------
def show_extra_gauges
# Made for compatibility
end
end # Scene_Battle
#==============================================================================
#
# �� End of File
#
#==============================================================================
0
0
4
New Quest Gaming
Feb 23, 2024
In Modifications
This is a fix for the Order Battlers script from Yami
It fixes crashes from hidden enemies
Two options - first is the normal one, second option doesn't require PCTB script to function.
Credit and Thanks
Yami
Roninator2
One
#==============================================================================
#
# ▼ YSA Battle Add-On: Order Battlers - Enemy Appear/Transform
# -- Last Updated: 2012.02.20
# -- Level: Easy
# -- Requires: n/a
# Mod by Roninator2
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Place below Order Battlers
#==============================================================================
#==============================================================================
# Function:
# Fixes the issue that the gauge doesn't update when an enemy is revealed,
# transformed, or revived
# * updated - added fix for memory leaks
#==============================================================================
module R2_Turn_Gauge_Display
SWITCH = 10 # Do not turn on. Used automatically to reset icons
end
class Game_Interpreter
#--------------------------------------------------------------------------
# * Enemy Appear
#--------------------------------------------------------------------------
def command_335
iterate_enemy_index(@params[0]) do |enemy|
enemy.appear
$game_switches[R2_Turn_Gauge_Display::SWITCH] = true
$game_troop.make_unique_names
end
end
#--------------------------------------------------------------------------
# * Enemy Transform
#--------------------------------------------------------------------------
def command_336
iterate_enemy_index(@params[0]) do |enemy|
enemy.transform(@params[1])
$game_switches[R2_Turn_Gauge_Display::SWITCH] = true
$game_troop.make_unique_names
end
end
end
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# overwrite method: create all windows
#--------------------------------------------------------------------------
def create_all_windows
order_gauge_create_all_windows
if @spriteset_order
for order in @spriteset_order
order.bitmap.dispose
order.dispose
end
@spriteset_order = nil
end
@spriteset_order = []
if $imported["YSA-PCTB"] && YSA::PCTB::CTB_MECHANIC[:predict] == 1
@active_order_sprite = Sprite_OrderBattler.new(@spriteset.viewportOrder, nil, :pctb2)
end
if $imported["YSA-PCTB"] && YSA::PCTB::CTB_MECHANIC[:predict] == 2
num = YSA::PCTB::CTB_MECHANIC[:pre_turns]
i = 0
num.times {
order = Sprite_OrderBattler.new(@spriteset.viewportOrder, nil, :pctb3, i)
@spriteset_order.push(order)
i += 1
}
return
end
for battler in $game_party.members + $game_troop.members
battle_type = :dtb
battle_type = :pctb if BattleManager.btype?(:pctb)
battle_type = :catb if BattleManager.btype?(:catb)
order = Sprite_OrderBattler.new(@spriteset.viewportOrder, battler, battle_type)
@spriteset_order.push(order)
end
end
#--------------------------------------------------------------------------
# new method: update spriteset
#--------------------------------------------------------------------------
def update_spriteset_order
if @spriteset_order
for order in @spriteset_order
order.bitmap.dispose
order.dispose
end
@spriteset_order = nil
end
@spriteset_order = []
if $imported["YSA-PCTB"] && YSA::PCTB::CTB_MECHANIC[:predict] == 1
@active_order_sprite = Sprite_OrderBattler.new(@spriteset.viewportOrder, nil, :pctb2)
end
if $imported["YSA-PCTB"] && YSA::PCTB::CTB_MECHANIC[:predict] == 2
num = YSA::PCTB::CTB_MECHANIC[:pre_turns]
i = 0
num.times {
order = Sprite_OrderBattler.new(@spriteset.viewportOrder, nil, :pctb3, i)
@spriteset_order.push(order)
i += 1
}
return
end
for battler in $game_party.members + $game_troop.members
battle_type = :dtb
battle_type = :pctb if BattleManager.btype?(:pctb)
battle_type = :catb if BattleManager.btype?(:catb)
order = Sprite_OrderBattler.new(@spriteset.viewportOrder, battler, battle_type)
@spriteset_order.push(order)
end
end
#--------------------------------------------------------------------------
# alias method: update
#--------------------------------------------------------------------------
alias update_order_guage update
def update
update_spriteset_order if $game_switches[R2_Turn_Gauge_Display::SWITCH] == true
$game_switches[R2_Turn_Gauge_Display::SWITCH] = false
update_order_guage
end
end
class Game_Battler < Game_BattlerBase
alias r2_enemy_revive_order_gauge revive
def revive
r2_enemy_revive_order_gauge
$game_switches[R2_Turn_Gauge_Display::SWITCH] = true
end
end
Two
# if you get an error under Order Battlers Line 679 put a # there
# if @actor_command_window.current_symbol == :attack #&& !BattleManager.actor.input.attack?
# Order patch by Roninator2
module R2_Turn_Gauge_Display
SWITCH = 10
end
class Game_Interpreter
#--------------------------------------------------------------------------
# * Enemy Appear
#--------------------------------------------------------------------------
def command_335
iterate_enemy_index(@params[0]) do |enemy|
enemy.appear
$game_switches[R2_Turn_Gauge_Display::SWITCH] = true
$game_troop.make_unique_names
end
end
#--------------------------------------------------------------------------
# * Enemy Transform
#--------------------------------------------------------------------------
def command_336
iterate_enemy_index(@params[0]) do |enemy|
enemy.transform(@params[1])
$game_switches[R2_Turn_Gauge_Display::SWITCH] = true
$game_troop.make_unique_names
end
end
end
module BattleManager
#--------------------------------------------------------------------------
# alias method: turn_start
#--------------------------------------------------------------------------
def self.sort_battlers(cache = false)
battlers = []
for battler in ($game_party.members + $game_troop.members)
next if battler.dead? || battler.hidden?
battlers.push(battler)
end
battlers.sort! { |a,b|
if a.agi != b.agi
b.agi <=> a.agi
else
a.name <=> b.name
end
}
return battlers
end
end
class Scene_Battle < Scene_Base
alias r2_order_gauge_create_all_windows create_all_windows
def create_all_windows
r2_order_gauge_create_all_windows
update_spriteset
end
#--------------------------------------------------------------------------
# new method: update spriteset
#--------------------------------------------------------------------------
def update_spriteset
@spriteset_order = []
h = []
$game_troop.members.each do |enemy|
h << enemy if enemy.hidden?
end
for battler in $game_party.members + $game_troop.members
battle_type = :dtb
battle_type = :pctb if BattleManager.btype?(:pctb)
battle_type = :catb if BattleManager.btype?(:catb)
next if h.include?(battler)
order = Sprite_OrderBattler.new(@spriteset.viewportOrder, battler, battle_type)
@spriteset_order.push(order)
end
end
#--------------------------------------------------------------------------
# alias method: update
#--------------------------------------------------------------------------
alias update_order_guage update
def update
update_order_guage
update_spriteset if $game_switches[R2_Turn_Gauge_Display::SWITCH] == true
$game_switches[R2_Turn_Gauge_Display::SWITCH] = false
end
end
class Game_Battler < Game_BattlerBase
alias r2_enemy_revive_order_gauge revive
def revive
r2_enemy_revive_order_gauge
$game_switches[R2_Turn_Gauge_Display::SWITCH] = true
end
end
0
0
1
New Quest Gaming
Feb 23, 2024
In Modifications
This mod changes the script so that it uses a variable to control the shaking and not the setting in the original script.
It was a request so that the shake could be easily changed by simply changing the variable
Credit and Thanks
Xail
Roninator2
#==============================================================================
# XaiL System - Image Shake
# Author: Nicke
# Created: 25/08/2012
# Edited: 03/09/2012
# Version: 1.0a
#==============================================================================
# Instructions
# -----------------------------------------------------------------------------
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ? Materials but above ? Main. Remember to save.
#
# Small snippet to make your picture's shake when the screen is shaking.
#
# *** Only for RPG Maker VX Ace. ***
#==============================================================================
($imported ||= {})["XAIL-IMAGE-SHAKE"] = true
module XAIL
module IMG_SHAKE
#--------------------------------------------------------------------------#
# * Settings
#--------------------------------------------------------------------------#
# Use this to setup which direction the pictures should move when a shaking
# occurs.
# x = horizontal
# y = vertical
# xy = both
# "" = none
# SHAKE_DIRECTION = strng
SHAKE_DIRECTION = 1 #"xy" Roninator2 edit
# changed to allow changing the setting in game with a variable
# if the variable is not set, the default is xy
# Switch to manually enable/disable the script.
# This will disable the script if switch_id is on/true.
# DISABLE_PIC_SHAKE = switch_id
DISABLE_PIC_SHAKE = 1
end
end
# *** Don't edit below unless you know what you are doing. ***
#==============================================================================#
# ** Module Sound
#==============================================================================#
class Spriteset_Map
alias xail_img_shake_spriteset_map_upd_viewports update_viewports
def update_viewports(*args, &block)
# // Method to when viewports are updating.
xail_img_shake_spriteset_map_upd_viewports(*args, &block)
if $game_variables[XAIL::IMG_SHAKE::SHAKE_DIRECTION] != "x" || "y" || "xy" || ""
# roninator2 edit
$game_variables[XAIL::IMG_SHAKE::SHAKE_DIRECTION] = "xy"
end
return if $game_switches[XAIL::IMG_SHAKE::DISABLE_PIC_SHAKE]
case XAIL::IMG_SHAKE::SHAKE_DIRECTION
when "x"
@viewport2.ox = $game_map.screen.shake
when "y"
@viewport2.oy = $game_map.screen.shake
when "xy"
@viewport2.ox = $game_map.screen.shake
@viewport2.oy = $game_map.screen.shake
end
end
end # END OF FILE
#=*==========================================================================*=#
# ** END OF FILE
#=*==========================================================================*=#
0
0
3
New Quest Gaming
Feb 23, 2024
In Modifications
This is a mod of Vlue's script
I don't remember the differences but it improves the original script
Credit and Thanks
Vlue
Roninator2
#Sleek Item Popup v1.14f
#Mod by Roninator2
#Features: A nice and sleek little pop up you can use to tell the player
# they received (or lost) an item! Now with automatic popups whenever
# you use the gain item commands in events!
#
#Usage: Event Script Call:
# popup(type,item,amount,[duration],[xoff],[yoff],event_id)
#
# Where: type is category of item (0 = item, 1 = weapon,
# 2 = armor, 3 = gold)
# item is the id number of the item
# amount is the amount lost or gained
# duration is the time the window is up and is optional
#
# Examples:
# popup(0,1,5)
# popup(2,12,1,120)
# $game_switches[X] = false
# $game_switches[X] = true
# To use the event, you can use x offset and y offset but it is
# not required, but still must be placed in the script call.
# popup(1, 5, 1, 120, 0, 0, 3)
# popup(type,item,amount,duration,xoff,yoff,event)
# event #3 will have the popup
#
#Customization: Everything down there under customization
#
#----------#
#-- Script by: V.M of D.T
#
#- Questions or comments can be:
# given by email: sumptuaryspade@live.ca
# provided on facebook: http://www.facebook.com/DaimoniousTailsGames
# All my other scripts and projects can be found here: http://daimonioustails.weebly.com/
#
#--- Free to use in any project, commercial or non-commercial, with credit given
# - - Though a donation's always a nice way to say thank you~ (I also accept actual thank you's)
$imported = {} if $imported.nil?
$imported[:Vlue_SleekPopup] = true
module Vlue_Popup
#Sound effect played on popup: # "Filename", Volume(0-100), Pitch(50-150)
PU_SOUND_EFFECT_GAIN = ["Item3",100,50]
PU_SOUND_EFFECT_LOSE = ["Item3",100,50]
PU_SOUND_GOLD_GAIN = ["Coin",100,50]
PU_SOUND_GOLD_LOSE = ["Coin",100,50]
#Animation to be played on the player during popup
PU_USE_ANIMATION = false
PU_POPUP_ANIMATION = 2
#Duration in frames of Item Popup fadein and fadeout
PU_FADEIN_TIME = 30
PU_FADEOUT_TIME = 30
#Default duration of the popup
PU_DEFAULT_DURATION = 90
#Use automatic popup? Can be enabled/disabled in game, see examples
PU_AUTOMATIC_POPUP = 186 # switch to turn on off
PU_IGNORE_ITEM_LOSS = true
#Whether to use a custom or default font
PU_USE_CUSTOM_FONT = false
#Settings for custom item popup font
PU_DEFAULT_FONT_NAME = ["Verdana"]
PU_DEFAULT_FONT_SIZE = 16
PU_DEFAULT_FONT_COLOR = Color.new(255,255,255,255)
PU_DEFAULT_FONT_BOLD = false
PU_DEFAULT_FONT_ITALIC = false
PU_DEFAULT_FONT_SHADOW = false
PU_DEFAULT_FONT_OUTLINE = true
#Compact mode will hide the amount unless it's greater then 1
PU_COMPACT_MODE = true
#Background Icon to be displayed under item icon
PU_USE_BACKGROUND_ICON = true
PU_BACKGROUND_ICON = 102
#Gold details:
PU_GOLD_NAME = "Lytil"
PU_GOLD_ICON = 262
#True for single line, false for multi line
PU_SINGLE_LINE = true
end
class Item_Popup < Window_Base
def initialize(item, amount, duration, nosound,xoff,yoff,event)
super(0,0,100,96)
return if item.nil?
amount = 0 if amount.nil?
if item.name == Vlue_Popup::PU_GOLD_NAME
sedg, sedl = Vlue_Popup::PU_SOUND_GOLD_GAIN, Vlue_Popup::PU_SOUND_GOLD_LOSE
else
sedg, sedl = Vlue_Popup::PU_SOUND_EFFECT_GAIN, Vlue_Popup::PU_SOUND_EFFECT_LOSE
end
se = RPG::SE.new(sedg[0],sedg[1],sedg[2]) unless sedg.nil? or nosound
se2 = RPG::SE.new(sedl[0],sedl[1],sedl[2]) unless sedl.nil? or nosound
se.play if se and amount > 0
se2.play if se2 and amount < 0
self.opacity = 0
self.x = $game_player.screen_x - 16
self.y = $game_player.screen_y - 80
@xoff = xoff
@yoff = yoff
@duration = duration ? duration : 120
@item = item
@amount = amount
@name = item.name.clone
@text = ""
@padding = ' '*@name.size
@timer = 0
@event = event
@split = (Vlue_Popup::PU_FADEIN_TIME) / @name.size
@split = 2 if @split < 2
amount > 0 ? @red = Color.new(0,255,0) : @red = Color.new(255,0,0)
if Vlue_Popup::PU_USE_CUSTOM_FONT
contents.font.size = Vlue_Popup::PU_DEFAULT_FONT_SIZE
else
contents.font.size = 16
end
@textsize = text_size(@name)
textsize2 = text_size("+" + amount.to_s)
self.width = @textsize.width + standard_padding * 2 + 24
self.width += textsize2.width + 48 if Vlue_Popup::PU_SINGLE_LINE
contents.font.size < 24 ? size = 24 : size = contents.font.size
self.height = size + standard_padding * 2
self.height += size if !Vlue_Popup::PU_SINGLE_LINE
self.x -= self.width / 2
create_contents
if Vlue_Popup::PU_USE_CUSTOM_FONT
contents.font.name = Vlue_Popup::PU_DEFAULT_FONT_NAME
contents.font.size = Vlue_Popup::PU_DEFAULT_FONT_SIZE
contents.font.color = Vlue_Popup::PU_DEFAULT_FONT_COLOR
contents.font.bold = Vlue_Popup::PU_DEFAULT_FONT_BOLD
contents.font.italic = Vlue_Popup::PU_DEFAULT_FONT_ITALIC
contents.font.shadow = Vlue_Popup::PU_DEFAULT_FONT_SHADOW
contents.font.outline = Vlue_Popup::PU_DEFAULT_FONT_OUTLINE
end
self.contents_opacity = 0
$game_player.animation_id = Vlue_Popup::PU_POPUP_ANIMATION if Vlue_Popup::PU_USE_ANIMATION
update
end
def update
#super
return if self.disposed?
return if @item.nil?
self.visible = true if !self.visible
@event = 0 if @event.nil?
if @event != 0
self.x = $game_map.events[@event].screen_x - contents.width/4 + 12
self.y = $game_map.events[@event].screen_y - 80 + @yoff
else
self.x = $game_player.screen_x - contents.width/4 + 12
self.y = $game_player.screen_y - 80 + @yoff
end
self.x -= self.width / 3
if self.x < $game_player.screen_x - 32 && $game_player.screen_x < 64
self.x = 0
end
if $game_player.screen_x > (Graphics.width - 64)
self.x -= 48
end
open if @timer < (Vlue_Popup::PU_FADEIN_TIME)
close if @timer > (Vlue_Popup::PU_FADEOUT_TIME + @duration)
@timer += 1
return if @timer % @split != 0
@text += @name.slice!(0,1)
@padding.slice!(0,1)
contents.clear
contents.font.color = @red
stringamount = @amount
stringamount = "+" + @amount.to_s if @amount > 0
if Vlue_Popup::PU_SINGLE_LINE
width = text_size(@item.name).width
draw_text(27 + width,0,36,24,stringamount) unless Vlue_Popup::PU_COMPACT_MODE and @amount == 1
if Module.const_defined?(:AFFIXES)
contents.font.color = @item.color
else
contents.font.color = Font.default_color
end
change_color(@item.rarity_colour) if $imported[:TH_ItemRarity]
draw_text(24,0,contents.width,contents.height,@text+@padding)
change_color(normal_color)
draw_icon(Vlue_Popup::PU_BACKGROUND_ICON,0,0) if Vlue_Popup::PU_USE_BACKGROUND_ICON
draw_icon(@item.icon_index,0,0)
else
draw_text(contents.width / 4 + 16,24,36,24,stringamount) unless Vlue_Popup::PU_COMPACT_MODE and @amount == 1
if Module.const_defined?(:AFFIXES)
contents.font.color = @item.color
else
contents.font.color = Font.default_color
end
draw_icon(Vlue_Popup::PU_BACKGROUND_ICON,contents.width / 2 - 24,24) if Vlue_Popup::PU_USE_BACKGROUND_ICON
draw_icon(@item.icon_index,contents.width / 2 - 24,24)
draw_text(0,0,contents.width,line_height,@text+@padding)
end
end
def close
self.contents_opacity -= (255 / (Vlue_Popup::PU_FADEOUT_TIME))
end
def open
self.contents_opacity += (255 / (Vlue_Popup::PU_FADEIN_TIME))
end
end
class Game_Interpreter
alias pu_command_126 command_126
alias pu_command_127 command_127
alias pu_command_128 command_128
alias pu_command_125 command_125
def popup(type,item,amount,duration = Vlue_Popup::PU_DEFAULT_DURATION,nosound = false, xo = 0, yo = 0, event)
event = 0 if event.nil?
data = $data_items[item] if type == 0
data = $data_weapons[item] if type == 1
data = $data_armors[item] if type == 2
if type == 3
data = RPG::Item.new
data.name = Vlue_Popup::PU_GOLD_NAME
data.icon_index = Vlue_Popup::PU_GOLD_ICON
end
Popup_Manager.add(data,amount,duration,nosound,xo,yo,event)
end
def command_125
pu_command_125
value = operate_value(@params[0], @params[1], @params[2])
popup(3,@params[0],value,0) if $game_switches[Vlue_Popup::PU_AUTOMATIC_POPUP]
end
end
module Popup_Manager
def self.init
@queue = {}
@last_item = nil
@last_event = 0
@yoff = false
end
def self.add(item,value,dura,ns,xo,yo,event)
return if Vlue_Popup::PU_IGNORE_ITEM_LOSS && value < 1
@last_item = item if @last_item.nil?
@last_event = event if @last_event.nil?
if @last_item != item && @last_event == event
@yoff = true
@last_item = item
@last_event = event
else
@yoff = false
end
i = @queue.size
@queue[i] = [item,value,dura,ns,xo,yo,event]
end
def self.queue
@queue
end
def self.yoff
@yoff
end
end
class Scene_Map
attr_accessor :popupwindow
alias popup_update update
alias popup_preterminate pre_terminate
alias r2_popup_start start
def start
@popupwindow = {}
Popup_Manager.init
r2_popup_start
end
alias r2_popup_call_menu call_menu
def call_menu
@popupwindow.each_with_index do |pop, i|
@popupwindow[i].dispose if !@popupwindow[i].nil?
if @popupwindow[i].nil?
Popup_Manager.queue.delete(i)
end
end
r2_popup_call_menu
end
def update
popup_update
update_popup_window unless @popupwindow.nil?
for i in 0..Popup_Manager.queue.size - 1
if @popupwindow[i].nil? or @popupwindow[i].contents_opacity <= 20
var = Popup_Manager.queue[i]
Popup_Manager.queue.delete(i)
next if var.nil?
if Popup_Manager.yoff == true
var[5] -= 24 * i
end
@popupwindow[i].dispose if !@popupwindow[i].nil? and !@popupwindow[i].disposed?
@popupwindow[i] = Item_Popup.new(var[0],var[1],var[2],var[3],var[4],var[5],var[6]) unless !@popupwindow[i].nil?
end
update_popup_window unless @popupwindow[i].nil?
end
end
def update_popup_window
for i in 0..@popupwindow.size - 1
next if @popupwindow[i].nil?
@popupwindow[i].update
@popupwindow[i].dispose if !@popupwindow[i].disposed? and @popupwindow[i].contents_opacity <= 10
@popupwindow[i] = nil if @popupwindow[i].disposed?
end
end
def pre_terminate
popup_preterminate
for i in 0..@popupwindow.size - 1
@popupwindow[i].visible = false unless @popupwindow[i].nil?
end
end
end
class Game_Party
def gain_item(item, amount, include_equip = false)
container = item_container(item.class)
return unless container
last_number = item_number(item)
new_number = last_number + amount
container[item.id] = [[new_number, 0].max, max_item_number(item)].min
container.delete(item.id) if container[item.id] == 0
if include_equip && new_number < 0
discard_members_equip(item, -new_number)
end
$game_map.need_refresh = true
if SceneManager.scene.is_a?(Scene_Map) && $game_switches[Vlue_Popup::PU_AUTOMATIC_POPUP]
Popup_Manager.add(item,amount,90,false,0,0,0)
end
end
end
0
0
4
New Quest Gaming
Feb 23, 2024
In Modifications
This addon lets you set different attack guard for actors
Credit and Thanks
Vlue
Roninator2
#Set Guard/Attack Skills v1.3.2
#----------#
#Features: Let's you set different attack/guard actions for individual actors
#
#Usage: Placed in note tags of actors, weapons, armors, classes:
# <Attack_Id skill_id level> - changes default attack if level matches
# <Guard_Id skill_id level> - changes default guard if level matchs
#
# e.g. <guard_id 44 15>
# guard skill is quick move at level 15
#
# Weapons/Armors overrides Classes overides Actors.
# Levels must be in a low to high order
# e.g. <guard_id 44 10>
# e.g. <guard_id 49 15>
#
# addon by Roninator2
#----------#
#-- Script by: V.M of D.T
class Game_Actor
def guard_skill_id
@equips.each do |item|
next unless item.object
iidg = item.object.note.upcase =~ /<GUARD_ID (\d+)>/i ? $1.to_i : 2
item.object.note.upcase.each_line { |line|
if line =~ /<GUARD_ID (\d+)\s*[ ,]?\s*(\d+)*>/i
if @level >= $2.to_i
iidg = $1.to_i
end
end
}
return iidg if item.object.note.upcase =~ /<GUARD_ID (\d+)>/i
return iidg if item.object.note.upcase =~ /<GUARD_ID (\d+)\s*[ ,]?\s*(\d+)*>/i
end
cidg = self.class.note.upcase =~ /<GUARD_ID (\d+)>/ ? $1.to_i : 2
self.class.note.upcase.each_line { |line|
if line =~ /<GUARD_ID (\d+)\s*[ ,]?\s*(\d+)*>/i
if @level >= $2.to_i
cidg = $1.to_i
end
end
}
return cidg if self.class.note.upcase =~ /<GUARD_ID (\d+)>/i
return cidg if self.class.note.upcase =~ /<GUARD_ID (\d+)\s*[ ,]?\s*(\d+)*>/i
idg = actor.note.upcase =~ /<GUARD_ID (\d+)>/i ? $1.to_i : 2
actor.note.upcase.each_line { |line|
if line =~ /<GUARD_ID (\d+)\s*[ ,]?\s*(\d+)*>/i
if @level >= $2.to_i
idg = $1.to_i
end
end
}
return idg
end
def attack_skill_id
@equips.each do |item|
next unless item.object
iida = item.object.note.upcase =~ /<ATTACK_ID (\d+)>/i ? $1.to_i : 1
item.object.note.upcase.each_line { |line|
if line =~ /<ATTACK_ID (\d+)\s*[ ,]?\s*(\d+)*>/i
if @level >= $2.to_i
iida = $1.to_i
end
end
}
return iida if item.object.note.upcase =~ /<ATTACK_ID (\d+)>/i
return iida if item.object.note.upcase =~ /<ATTACK_ID (\d+)\s*[ ,]?\s*(\d+)*>/i
end
cida = self.class.note.upcase =~ /<ATTACK_ID (\d+)>/i ? $1.to_i : 1
self.class.note.upcase.each_line { |line|
if line =~ /<ATTACK_ID (\d+)\s*[ ,]?\s*(\d+)*>/i
if @level >= $2.to_i
cida = $1.to_i
end
end
}
return cida if self.class.note.upcase =~ /<ATTACK_ID (\d+)>/i
return cida if self.class.note.upcase =~ /<ATTACK_ID (\d+)\s*[ ,]?\s*(\d+)*>/i
ida = actor.note.upcase =~ /<ATTACK_ID (\d+)>/i ? $1.to_i : 1
actor.note.upcase.each_line { |line|
if line =~ /<ATTACK_ID (\d+)\s*[ ,]?\s*(\d+)*>/i
if @level >= $2.to_i
ida = $1.to_i
end
end
}
return ida
end
end
0
0
3
New Quest Gaming
Feb 23, 2024
In Self Made
This was a script made for me by A-Moonless-Night
It was before I knew how to do it myself.
So I never made it but I use it in my project so here it is for others.
Requires V's Promotion system v1.2 - paid for script for commercial projects
What it does:
Makes the promotion require an item.
The intent was to have it work like the promotion from Final Fantasy 1
Use the rat tail to promote the character
Credit and Thanks
A-Moonless-Night
=begin
#=====================================================================
# AMN V's Promotions - Add-on
# Version 1.2
# Author: AMoonlessNight
# Date: 23 Mar 2018
# Latest: 24 Mar 2018
#=====================================================================#
# UPDATE LOG
#---------------------------------------------------------------------#
# 23 Mar 2018 - created the add-on script for V's Promotions
# 24 Mar 2018 - fixed level up and gain exp methods
# - added greyed out colour for actors that are promotable
# but don't have the correct items
# - fixed gain exp method
#=====================================================================#
This script was requested as an add-on to V's Promotions script.
It will not work without it.
V's Promotions script can be found here:
https://forums.rpgmakerweb.com/index.php?threads/vs-promotion-system-v0-2.18875/
Requested by Roninator2
#=====================================================================#
NOTETAGS
#=====================================================================#
Notetag actors as many times as you require with the following:
* <Promotion: Level, Graphic_Name, Graphic_Index, Cost, Class, Item>
#----------------------------------------------------------------#
# Item is a new addition and should be replaced with the number
# of the item that the party must have in order for this actor
# to be promoted (e.g. 5 for Stimulant).
#----------------------------------------------------------------#
=end
#==============================================================================
#
# ** Please do not edit below this point unless you know what you are doing.
#
#==============================================================================
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles actors. It is used within the Game_Actors class
# ($game_actors) and is also referenced from the Game_Party class ($game_party).
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :next_promotion_item # Item needed to promote actor
attr_accessor :next_promo_level # The next promotion level
#--------------------------------------------------------------------------
# * Setup # ALIAS METHOD #
#--------------------------------------------------------------------------
alias :amn_vpromo_gameactor_setup :setup
def setup(actor_id)
@next_promotion_item = 0
amn_vpromo_gameactor_setup(actor_id)
end
#--------------------------------------------------------------------------
# * Gain EXP (Account for Experience Rate)
#--------------------------------------------------------------------------
alias :amn_vpromo_gameactor_gainexp :gain_exp
def gain_exp(exp)
req_exp = exp_for_level(next_promo_level?)
value = self.exp + (exp * final_exp_rate).to_i
if !at_promotion_level?
if value < req_exp
amn_vpromo_gameactor_gainexp(exp)
else
change_exp(req_exp, true)
end
end
end
#--------------------------------------------------------------------------
# * Change Experience
# show : Level up display flag
#--------------------------------------------------------------------------
def change_exp(exp, show)
@exp[@class_id] = [exp, 0].max unless at_promotion_level?
last_level = @level
last_skills = skills
level_up while !max_level? && self.exp >= next_level_exp
level_down while self.exp < current_level_exp
display_level_up(skills - last_skills) if show && @level > last_level
refresh
end
#--------------------------------------------------------------------------
# * Sets up the actor's note # OVERWRITE METHOD #
#--------------------------------------------------------------------------
def set_up_actor_note(actor_id)
note= /<Promotion:\s*(\d*)\S*\s*(\w*)\S*\s*(\d*)\S*\s*(\d*)\S*\s*(\d*)\S*\s*(\d*)>/i
@actors_note = $data_actors[actor_id].note.scan(note)
end
#--------------------------------------------------------------------------
# * Check For Promotions # ALIAS METHOD #
#--------------------------------------------------------------------------
alias amn_vpromo_checkforpromo check_for_promotion
def check_for_promotion
amn_vpromo_checkforpromo &&
@actors_note.size.times { |i| @next_promotion_item = @actors_note[i][5].to_i if @level == @actors_note[i][0].to_i }
end
#--------------------------------------------------------------------------
# * Check Promotion Items # NEW METHOD #
#--------------------------------------------------------------------------
def check_promotion_items
return true if needs_promotion_item? && $game_party.items.include?($data_items[@next_promotion_item])
end
#--------------------------------------------------------------------------
# * Needs Promotion Item? # NEW METHOD #
#--------------------------------------------------------------------------
def needs_promotion_item?
return false if @next_promotion_item == 0
return true
end
#--------------------------------------------------------------------------
# * Checks if actor is promotable # ALIAS METHOD #
#--------------------------------------------------------------------------
alias amn_vpromo_promotable? promotable?
def promotable?
if needs_promotion_item?
return true if check_promotion_items && @needs_promotion == true
else
amn_vpromo_promotable?
end
end
#--------------------------------------------------------------------------
# * Next Promotion Level # NEW METHOD #
#--------------------------------------------------------------------------
def next_promo_level?
array = []
@actors_note.size.times { |i| array.push(@actors_note[i][0].to_i) }
array.keep_if { |a| a > @level }
array.sort
if array.empty?
@next_promo_level = max_level
else
@next_promo_level = array[0]
end
end
#--------------------------------------------------------------------------
# * At Promotion Level? # NEW METHOD #
#--------------------------------------------------------------------------
# Had to do this in order for level up commands to work properly
#--------------------------------------------------------------------------
def at_promotion_level?
amn_vpromo_promotable?
end
#--------------------------------------------------------------------------
# * Promote Processing # ALIAS METHOD #
#--------------------------------------------------------------------------
alias amn_vpromo_promote promote
def promote
if @next_promotion_item > 0
$game_party.lose_item($data_items[@next_promotion_item], 1)
end
amn_vpromo_promote
end
#--------------------------------------------------------------------------
# * Promotion Items # NEW METHOD #
#--------------------------------------------------------------------------
def promotion_items?
return @next_promotion_item
end
end
#==============================================================================
# ** Game_Interpreter
#------------------------------------------------------------------------------
# An interpreter for executing event commands. This class is used within the
# Game_Map, Game_Troop, and Game_Event classes.
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# * Change EXP
#--------------------------------------------------------------------------
alias amn_vpromo_gameint_cmd315 command_315
def command_315
value = operate_value(@params[2], @params[3], @params[4])
iterate_actor_var(@params[0], @params[1]) do |actor|
req_exp = actor.exp_for_level(actor.next_promo_level?)
if !actor.at_promotion_level?
if value < req_exp
actor.change_exp(actor.exp + value, @params[5])
else
actor.change_exp(req_exp, @params[5])
end
end
end
end
#--------------------------------------------------------------------------
# * Change Level
#--------------------------------------------------------------------------
alias amn_vpromo_gameint_cmd316 command_316
def command_316
value = operate_value(@params[2], @params[3], @params[4])
iterate_actor_var(@params[0], @params[1]) do |actor|
if !actor.at_promotion_level?
if value < actor.next_promo_level?
actor.change_level(actor.level + value, @params[5])
else
actor.change_level(actor.next_promo_level, @params[5])
end
end
end
end
end
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This is a super class of all windows within the game.
#==============================================================================
class Window_Base < Window
def greyout_colour; text_color(7); end; # Greyed out
#--------------------------------------------------------------------------
# * Draw Level
#--------------------------------------------------------------------------
alias :amn_vpromo_windbase_drawactorlevel :draw_actor_level
def draw_actor_level(actor, x, y)
amn_vpromo_windbase_drawactorlevel(actor, x, y)
if actor.promotable?
draw_v_text(x, y + 25, 150, line_height, "Promotable", 0, 24, crisis_color)
elsif actor.at_promotion_level? && !actor.promotable?
draw_v_text(x, y + 25, 150, line_height, "Promotable", 0, 24, greyout_colour)
end
end
end
#==============================================================================
# ** Promotion_Info_Window
#------------------------------------------------------------------------------
# This class handles all of the Promotion Info Window processing.
#==============================================================================
class Promotion_Info_Window < Window_Base
#--------------------------------------------------------------------------
# * Draws actors info # OVERWRITE METHOD #
#--------------------------------------------------------------------------
def draw_actor_info(index)
actor = @promotables[@index]
cost = "Cost: " + actor.promotion_cost?.to_s
# AMN addition
if actor.next_promotion_item > 0
item = $data_items[actor.next_promotion_item]
icon = '\i[' + item.icon_index.to_s + '] '
name = item.name.to_s + ' '
amt = $game_party.item_number(item)
if amt == 0
itemtxt = icon + name + '\c[2]' + amt.to_s + '\c[2] / 1'
else
itemtxt = icon + name + amt.to_s + ' / 1'
end
else
itemtxt = ''
end
#
draw_v_text(120, 55, (Graphics.width / 3) * 2, 75, actor.name, 0, 45)
draw_actor_face(actor, 10, 10)
draw_zoomed_actor_graphic(actor, 40, 150, 2)
draw_v_text(-105, 200, (Graphics.width / 3) * 2, 75, $data_classes[actor.class_id].name, 1, 22)
draw_v_text(-10, 150, (Graphics.width / 3) * 2, 75, ">", 1, 55)
draw_zoomed_character(actor.next_promotion_name, actor.next_promotion_index, 230, 150, 2)
draw_v_text(85, 200, (Graphics.width / 3) * 2, 75, $data_classes[actor.next_promotion_class].name, 1, 22)
draw_v_text(-10, 250, (Graphics.width / 3) * 2, 75, cost, 1, 40)
draw_text_ex(10, 250, itemtxt)
end
end
#==============================================================================
# ** Promotion_Command_Window
#------------------------------------------------------------------------------
# This class handles all of the Promotion Command Window processing.
#==============================================================================
class Promotion_Command_Window < Window_Command
#--------------------------------------------------------------------------
# * Checks if party has enough to buy promotion # ALIAS METHOD #
#--------------------------------------------------------------------------
alias amn_vpromo_promocmdwdw_afford? afford?
def afford?(id)
if @promotables[id].promotion_items? != 0
$game_party.gold >= @promotables[id].promotion_cost? && $game_party.items.include?($data_items[@promotables[id].promotion_items?])
else
$game_party.gold >= @promotables[id].promotion_cost?
end
end
end
0
0
4
New Quest Gaming
Feb 23, 2024
In Self Made
This is an addon to Ventwigs Enemy HP Selection script
Adds option to hide hp bar when not selecting the enemy
Credit and Thanks
Ventwig
Roninator2
# ╔═══════════════════════════════════════════════╦════════════════════╗
# ║ Title: Ventwig Enemy HP Selection ║ Version: 1.07 ║
# ║ Author: Roninator2 ║ ║
# ╠═══════════════════════════════════════════════╬════════════════════╣
# ║ Function: ║ Date Created ║
# ║ ╠════════════════════╣
# ║ Show hp only for enemy selected ║ 03 Jan 2022 ║
# ╚═══════════════════════════════════════════════╩════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Requires: Ventwig Enemy HP Bars Script ║
# ║ ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Brief Description: ║
# ║ Script adjusts Ventwigs script to make the Bars shown to ║
# ║ only be visible on the enemy when that enemy is selected ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Instructions: ║
# ║ Configure setting below ║
# ║ ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Updates: ║
# ║ 1.00 - 03 Jan 2021 - Script Finished ║
# ║ 1.01 - 03 Jan 2021 - Fixed glitch in battle processing ║
# ║ 1.02 - 03 Jan 2021 - show hp when enemy is attacked ║
# ║ 1.03 - 03 Jan 2021 - Fixed HP showing when enemy attacked ║
# ║ 1.04 - 05 Jan 2021 - Corrected for hidden enemies & bug ║
# ║ 1.05 - 06 Jan 2021 - Added show hp for all enemies skills ║
# ║ 1.06 - 08 Jan 2022 - New - Show hp when skill allows ║
# ║ 1.07 - 08 Jan 2022 - Combine last with 1.05 ║
# ║ ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Credits and Thanks: ║
# ║ Roninator2 ║
# ║ Ventwig ║
# ╚════════════════════════════════════════════════════════════════════╝
# ╔════════════════════════════════════════════════════════════════════╗
# ║ Terms of use: ║
# ║ Follow the original Authors terms of use where applicable ║
# ║ - When not made by me (Roninator2) ║
# ║ Free for all uses in RPG Maker except nudity ║
# ║ Anyone using this script in their project before these terms ║
# ║ were changed are allowed to use this script even if it conflicts ║
# ║ with these new terms. New terms effective 03 Apr 2024 ║
# ║ No part of this code can be used with AI programs or tools ║
# ║ Credit must be given ║
# ╚════════════════════════════════════════════════════════════════════╝
module R2_Enemy_Hud_Hold_Time
Hold_Time = 120 # time bar will show when enemy is hit
Skill = [80,105] # skills that will show the HP bar
Switch = 88 # switch that will enable showing for skills
end
# ╔════════════════════════════════════════════════════════════════════╗
# ║ End of editable region ║
# ╚════════════════════════════════════════════════════════════════════╝
class Window_Enemy_Hud < Window_Base
attr_accessor :damage_time
alias r2_init_enemy_hp initialize
def initialize
r2_init_enemy_hp
show_hp(false)
show_hp_all(false)
end
def show_hp(value = false)
@show_hp = value
end
def show_hp_all(value = false)
@show_hp_all = value
end
def enemy_id(value = -1)
@enemy_id = value
end
def hold_hp
@show_hp = false if @damage_time == 0
for i in 0..@etroop.alive_members.size-1
e = @enemy[i]
next if e.nil? # for hidden enemies
if $game_switches[EHUD::HIDE_MINIONS] != true && @show_hp == true && @damage_time != 0 && e.index == @enemy_id
draw_actor_hp(e,e.screen_x-50,e.screen_y+EHUD::Y_MOVE-50+e.personal_y,width=96) unless @damage_time == 0
end
end
end
def damage_time(value = 0)
@damage_time = value
end
def update
if @damage_time != nil
@damage_time -= 1 if @damage_time != 0
end
hold_hp
refresh_okay = false
$game_troop.alive_members.each do |enemy|
if enemy.hp != enemy.old_hp || enemy.mp != enemy.old_mp
refresh_okay = true
enemy.old_hp = enemy.hp
enemy.old_mp = enemy.mp
end
end
if $game_troop.alive_members.size != @old_size
refresh_okay = true
end
if refresh_okay
refresh
end
end
def enemy_hud
troop_fix
for i in 0..@etroop.alive_members.size-1
e = @enemy[i]
if i <= 1 and e.boss_bar == true and e == @boss_enemy[i]
draw_actor_name(e,EHUD::BOSS_GAUGEX,5+50*i)
draw_actor_hp(e,EHUD::BOSS_GAUGEX,20+50*i,width=EHUD::BOSS_GAUGEW) unless e.hide_hp == true
draw_actor_mp(e,EHUD::BOSS_GAUGEX,30+50*i,width=EHUD::BOSS_GAUGEW) unless e.show_mp == false
draw_actor_icons(e,EHUD::BOSS_GAUGEX+200,5+50*i, width = 96)
elsif ($game_switches[EHUD::HIDE_MINIONS] != true && @show_hp_all == true)
draw_actor_hp(e,e.screen_x-50,e.screen_y+EHUD::Y_MOVE-50+e.personal_y,width=96) unless e.hide_hp == true
draw_actor_mp(e,e.screen_x-50,e.screen_y+EHUD::Y_MOVE-40+e.personal_y,width=96) unless e.show_mp == false
draw_actor_icons(e,e.screen_x-50,e.screen_y+EHUD::Y_MOVE-70+e.personal_y,width=96)
elsif ($game_switches[EHUD::HIDE_MINIONS] != true && @show_hp == true) && e.index == @enemy_id
draw_actor_hp(e,e.screen_x-50,e.screen_y+EHUD::Y_MOVE-50+e.personal_y,width=96) unless e.hide_hp == true
draw_actor_mp(e,e.screen_x-50,e.screen_y+EHUD::Y_MOVE-40+e.personal_y,width=96) unless e.show_mp == false
draw_actor_icons(e,e.screen_x-50,e.screen_y+EHUD::Y_MOVE-70+e.personal_y,width=96)
end
end
end
end
class Scene_Battle < Scene_Base
alias r2_update_basic_hp update_basic
def update_basic
@skill_check = -1 unless @enemy_window.active
@skill_check = @skill_window.item.id if @skill_window.active
if @enemy_window.active && $game_switches[R2_Enemy_Hud_Hold_Time::Switch] == true
enemy_hp_shown(true) if R2_Enemy_Hud_Hold_Time::Skill.include?(@skill_check)
elsif @enemy_window.active && $game_switches[R2_Enemy_Hud_Hold_Time::Switch] == false
enemy_hp_shown(true)
else
enemy_hp_shown(false) if (!@subject && @enemy_hud_window.damage_time = 0) && !@enemy_window.active
enemy_hp_shown_all(false)
end
r2_update_basic_hp
end
alias r2_execute_hp_show execute_action
def execute_action
skill_check = false
@skill = @skill_window.item
targets = @subject.current_action.make_targets.compact
targets.each { |e|
e.is_a?(Game_Actor) ? next : @skill.nil? ? enemy_hp_shown(true) : skill_check = true
@enemy_hud_window.enemy_id(e.index)
@enemy_hud_window.damage_time(R2_Enemy_Hud_Hold_Time::Hold_Time)
if skill_check == true
case @skill.scope
when 1
@enemy_hud_window.enemy_id(e.index)
if $game_switches[R2_Enemy_Hud_Hold_Time::Switch] == true
enemy_hp_shown(true) if R2_Enemy_Hud_Hold_Time::Skill.include?(@skill_check)
else
enemy_hp_shown(true)
end
when 2..6
if $game_switches[R2_Enemy_Hud_Hold_Time::Switch] == true
enemy_hp_shown_all(true) if R2_Enemy_Hud_Hold_Time::Skill.include?(@skill_check)
@enemy_hud_window.damage_time(R2_Enemy_Hud_Hold_Time::Hold_Time * 2)
else
enemy_hp_shown_all(true)
@enemy_hud_window.damage_time(R2_Enemy_Hud_Hold_Time::Hold_Time * 2)
end
else
enemy_hp_shown(false)
enemy_hp_shown_all(false)
end
skill_check = false
end
}
r2_execute_hp_show
enemy_hp_shown_all(false)
end
alias r2_skill_enemy_select select_enemy_selection
def select_enemy_selection
@skill = @skill_window.item
if !@skill.nil?
case @skill.scope
when 1
@enemy_hud_window.enemy_id(@enemy_window.index)
if $game_switches[R2_Enemy_Hud_Hold_Time::Switch] == true
enemy_hp_shown(true) if R2_Enemy_Hud_Hold_Time::Skill.include?(@skill_check)
enemy_hp_shown_all(false)
else
enemy_hp_shown(true)
end
when 2..6
if $game_switches[R2_Enemy_Hud_Hold_Time::Switch] == true
enemy_hp_shown_all(true) if R2_Enemy_Hud_Hold_Time::Skill.include?(@skill_check)
enemy_hp_shown(false)
else
enemy_hp_shown_all(true)
end
@enemy_hud_window.damage_time(R2_Enemy_Hud_Hold_Time::Hold_Time * 2)
else
enemy_hp_shown(false)
enemy_hp_shown_all(false)
end
end
r2_skill_enemy_select
end
def enemy_hp_shown(value = false)
@enemy_hud_window.show_hp(value)
if @enemy_window.enemy != nil
@enemy_hud_window.enemy_id(@enemy_window.enemy.index)
end
@enemy_window.refresh
@enemy_hud_window.refresh
end
def enemy_hp_shown_all(value = false)
@enemy_hud_window.show_hp_all(value)
@enemy_window.refresh
@enemy_hud_window.refresh
end
end
0
0
6
New Quest Gaming
Feb 23, 2024
In Modifications
This is a mod of the original script to remove crashes and memory leaks
Credit and Thanks
Venka
Roninator2
#==============================================================================
# ▼ Venka's Bestiary v1.8.2 Updated: 01/21/2014
# author: Venka
#==============================================================================
# - Changelog -
#------------------------------------------------------------------------------
# 01/21/2014 - Added in a section for debuff resistances.
# - Fixed display issue when a resistance was set to 120%
# - Added compatibility with Yanfly's Element Absorb script
# - Added a spot to set the text color for Immunity and Absorbtion
# - Fixed a bug that wasn't displaying state immunities.
# 12/05/2014 - Stats will now correct if passive stats boost them for states
# and elements as well.
# 12/03/2014 - Stats will now correct if passive stats boost them
# 11/30/2014 - Fixed issue with manually adding enemy entries.
# 11/09/2014 - Added in a scroll speed setting so you can speed up the scroll
# when viewing information about an enemy.
# - Added in stats revealed by kill counts. You can set what
# information will be shown after you kill an enemy x amount of
# times
# 10/27/2014 - Forgot to dispose of the instructions on the battle scene.
# 10/14/2014 - Added ability to store quotes for the Actor's Input addon.
# - Added KilloZapit's Word Wrapper support
# 09/24/2014 - Adjusted the contents of the bestiary stat windows so be able
# to show large amounts of elements and states. The window panes
# are now scrollable to view all the information.
# - The scan window in battle was also updated in the above way.
# 09/21/2014 - Fixed a bug if no categories are set up in the enemy note tags.
# 09/14/2014 - changed the name of one of the methods so it's compatiable with
# some of my other scripts.
# 08/14/2014 - Released for code off challenge
# 10/13/2022 - Fixed crashes and memory leaks - Roninator2
#------------------------------------------------------------------------------
# - Author's Note -
#------------------------------------------------------------------------------
# Just a quick note. This script was written for the Code Off Challenge found
# here: http://forums.rpgmakerweb.com/index.php?/forum/102-code-off-challenge/
#------------------------------------------------------------------------------
# - Terms -
#------------------------------------------------------------------------------
# This script can be used commercially or non-commercially. If it's used
# commercially, I'd like a PM via the forums with a link to the game so I can
# follow it's progress.. but this isn't required ;) Just a I'd like to take a
# peak type of thing :)
#------------------------------------------------------------------------------
# - Introduction -
#------------------------------------------------------------------------------
# This script will give you a scene that you can track the enemies you've
# discovered and/or killed. It will keep track of the enemy's stats, skills,
# drops, resistances to elements and status effects as well as showing a
# description and image of the enemy.
#------------------------------------------------------------------------------
# - Instructions -
#------------------------------------------------------------------------------
# This script will work if you drop it into your game project. Knowledge of
# note tagging will help take advantage of all the features.
#
#------------------------------------------------------------------------------
# - Enemy Note Tags -
#------------------------------------------------------------------------------
# You can set a custom description for each enemy. If you skip this notetag,
# then it'll use the description set at Default_Description. The text will
# take the same codes you use in message windows but you'll need to add an
# extra \ before each. So \C[1] will need to be \\C[1]. You can use KilloZapit's
# word wrapper to auto fit the text into the box for you or use | to start a
# new line of text if you don't want to use KilloZapit's Word Wrapper.
# See the demo enemy note tag boxes for examples.
# <description1: your text goes here>
#
# When in the Bestiary Scene, enemies will appear on a background that looks
# the battleback images. You can set the default images used and set images to
# use for each Category you set up. However, if you'd like certain enemies to
# have their very own images that's different from the default or category
# images then use the following tags:
# <bg_floor: file> - It'll look for the file in Battlebacks1 and if not
# found, then it'll look in the Pictures folder.
# <bg_wall: file> - It'll look for the file in Battlebacks2 and if not
# found, then it'll look in the Pictures folder.
# NOTE: Do not put ""'s around the file's name. If you want to use a single
# file, then set either the bg_floor or bg_wall to the image you want to use
# and set the other one to nil.
#
# Sometimes there are enemies that you do not want to track or if you are like
# me, you like to sort your database in sections and use labels. To make sure
# none of these database entries make it into the bestiary scene, use this tag:
# <skip> - when this tag is used, no entry will be made
#
# Some games have multiple database entries of the same enemy but they change
# the stats a little for variance or change the graphic for varity. But they
# are all still considered the same enemy. In this case you can use this tag
# so no matter which one you encounter, it'll only show one entry.
# <shown_id: x> - x is the database ID to use in the Bestiary
#
# The category tag will be the most used tag. You can set up categories in
# the customize section. You can sort your Bestiary Scene any way you like.
# For example could have Common Enemies, Rare Enemies, Boss Enemies, Elite, etc
# or by location like in this demo. An enemy can appear in multiple categories.
# Use the following tag to set the enemy's category:
# <category: x> - x is the Category ID defined below.
#
# To make an enemy immune to scans, use the following code
# <no_scan> - enemy is immune to scan skill
#
#------------------------------------------------------------------------------
# - Item/Skill Note Tags -
#------------------------------------------------------------------------------
# The last note tag can go in a skill or items note tag. It allows you to scan
# an emeny to learn information about it.
# <scan> - When used on an enemy, it unlocks information
#
#------------------------------------------------------------------------------
# - Script Call -
#------------------------------------------------------------------------------
# - Manually Add Bestiary Entry -
# Just incase you need to manually add a bestiary entry, use the following:
# add_enemy_entry(enemy_id) - enemy_id is the id in the Database
#
# - Changing Enemy's Description via script call -
# You can change an enemy's description with a script call. When you set a
# description with the script call it will override any other description text
# that is found (the default description or custom descriptions by kills).
# To set the description by script call use the following format:
# set_enemy_description(enemy_id, text) - enemy_id is the database id
# - text is text shown.
# The text follows the same rules as all the other description text. You can
# use message codes to change text color, size, use icons.. etc. Use | to form
# a line break. If you want the description to be blank, then set text to "".
#
# To reset the description text back to what it'd normally be use:
# reset_enemy_description(enemy_id) - enemy_id is the database id
#
# - Getting the kill count for an Enemy -
# You can get the amount of times you've killed a given enemy should you need
# it for a conditional check or whatever reason. Use:
# enemy_kill_count(enemy_id) - enemy_id is the database id
#
# NOTE: If the enemy_id given has the <shown_id: x> in it, then it'll go to
# the enemy id pointed to by the note tag.
#==============================================================================
# ■ Configuration
#==============================================================================
$imported ||= {}; $imported[:Venka_Bestiary] = true
module Venka; module Bestiary
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - General Settings -
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Windowskin = "Window" # Set to nil for default skin.
Window_Opacity = 255 # Window's over all opacity. Number 0 - 255
Window_BGOpacity = 180 # Window's background opacity (default 192)
Use_Dividers = true # Draw divider lines to break up info?
Line_Color = [150, 150, 250, 225] # [Red, Blue, Green, Alpha] color for lines
Frame_Image = false # Draw window border around the enemy image?
Menu_Access = true # Access to Bestiary from the menu?
BG_Image = "Book" # Found in Title1 or Pictures Folder
Bestiary_BGM = ["Theme2", 80, 100] # ["File", Volume, Pitch]. Can set to nil
Scroll_Speed = 6 # The speed the info moves when ↑↓ pressed
Track_Progress = true # This shows completion for each category
Track_Kills = true # Track the times you've killed an enemy
Show_Debuff_Info = true # Show the debuff info section
Use_Wordwrapper = true # Use KilloZapit's word wrapping script to
# handle text
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Default Settings -
#----------------------------------------------------------------------------
# You can set the default info for the back ground images used for each
# enemy and the enemy's description if you don't make custom info for each.
# If you only want to use one background image, then set one to an image
# found in it's Battleback folder or the Pictures folder and set the other to
# nil.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Default_BGFloor = "Dirt1" # Default ground image used (Battlebacks1)
Default_BGWall = "Forest1" # Default wall image used (Battlebacks2)
# The description text can use message codes (ex: \c[1] - changes text color).
# Use | to force a line break.
Default_Description = "Not much is known about this |enemy."
# Descriptions can evolve as you kill more enemies. These descriptions must
# be set via the note tags. If the description isn't set, then it will skip
# the description and show the lower message or default message instead.
# Set the kill goals here:
Description1 = 0 # This message will show at 0 kills
Description2 = 3 # This message will show after 3 kills
Description3 = 8 # This message will show after 8 kills
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Reveal by Kill Settings -
#----------------------------------------------------------------------------
# You can set what information will be shown for enemies by the amount of
# times they have been killed. Using the scan skill will also unlock all of
# the following information regardless of the kills for a given enemy.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Show_BaseStats = 3 # Shows base stats: Atk, Def, Mdf, Mat, etc
Show_Elements = 3 # Shows elemental resistances
Show_States = 5 # Shows state resistances
Show_DebuffStats = 1 # Shows debuff rates
Show_Abilities = 7 # Shows a list of abilities that can be used
Show_Loot = 5 # Shows the drop list for the enemy
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Text Settings -
#----------------------------------------------------------------------------
# You can set all text that appears in the Bestiary scene.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Bestiary_Command = "Bestiary" # Text for the scene in the menu
Category_Select = "Select a category" # Help text for picking a category
Enemy_Select = "Select an Enemy" # Help text for picking an enemy
Discovered_Text = "Enemies Discovered" # Text that appears at the bottom
Percent_Finished = "Completed" # Percentage completed text
Unknown_Loot = "Loot Unknown" # Text to show when loot is unknown
Unknown_Skills = "Abilities Unkown" # Text to show when skills are unknown
View_Stats = "Statistics" # Button text for stats
View_More = "Other Info" # Button text for other info
View_Element = "Elements" # Button text for element info
View_States = "States" # Button text for state info
View_Debuff = "Debuffs" # Button text for debuff info
Stats_Text = "Base Stats" # Header text for basic stats
Element_Text = "Elemental Resistances" # Header text for element resists
Status_Text = "Status Resistances" # Header text for status resists
Debuff_Text = "Debuff Rates" # Header text for debuff rates
Loot_Text = "Rewards" # List of items you can get
Skill_Text = "Abilities" # Text for skills enemy uses
Immune_Text = "Imm" # Text that appears when enemy is immune to a state
Absorb_Text = "Abs" # Text for element absorbtion (Yanfly Element Absorb Script)
Unknown_Stat = "??" # Text for unkown resistance/stat
# For the next two settings, you can set the icon or text to nil if you don't
# want to use the icon or text
Exp_Text = ["Exp:", 117] # Text and Icon for Exp
Gold_Text = ["Gold:", 262] # Text and Icon for Gold
Kills_Text = "Kills" # Text shown from enemies killed
Instructions_Text = "Use PageUp and PageDown to change enemies."
Battle_Instructions = "Press Shift to see more info about the target."
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Scan Skill Setting -
#----------------------------------------------------------------------------
# You can set stuff for the scan skill here. Mostly this is setting text
# that appears in the game. You can also set the key that is pressed to
# make the pop up window show when you select an enemy in the enemy window.
# NOTE: The window will pop up on a successful scan as well
#
# Key options are: :A - this is the Shift key
# :X - this is the A key :Y - this is the S key
# :Z - this is the D key :L - this is PageUp/Q Keys
# :R - this is PageDw/W keys :SHIFT, :CTRL, :ATL - shift, cntl, atl keys
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Target_Scanned = "%s scanned!" # Battle message when successfully scanned
No_Scan = "%s can't be scanned!" # Battle message when target can't be scanned
No_Info = "No information found" # Text when the target is immune to scans.
Scan_PopUp = :SHIFT # Input key to make the window pop up
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - List Sort Setting -
#----------------------------------------------------------------------------
# You can set how the list will sort. You can sort it by order discovered
# (discovery order should be the default), by their database id, or name.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Sort_Type = :id # choices are :id, :name, or :default
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Font Settings -
#----------------------------------------------------------------------------
# :help_font = font that appears in the top and bottom windows
# :list_font = font in the list windows
# :header_font = font used for statistic types
# :stat_font = font used for statistics
# :description = font for enemy description text.
#
# For each text type you need to set up the Fonts, Size, Boldness and Color.
# Use the following format:
# [["Font_Name, Font_Name, etc], Font_Size, Bold?, Color]],
# Font_Name = an array holding font choices. The fist one is your first
# choice to use, but if the player doesn't have that font on their
# computer, it will go through the list until it finds one it can use
# Font_Size = the size font you want to use
# Bold? = this should be true for bold, false to turn bold off
# Color = This is the same format as setting colors for Gauge Color.
# Use [red, blue, green, opacity] or window skin color number.
# Outline? = this turns the font's outline on or off
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Fonts = { # [["Fonts"]], Size, Bold?, Color, Outline?
:normal_font => [["Calibri", "Sylfaen"], 24, false, 0, true],
:list_font => [["Calibri", "Sylfaen"], 24, false, 0, true],
:header_font => [["Calibri", "Sylfaen"], 23, true, 1, true],
:stat_name => [["Calibri", "Sylfaen"], 20, true, 0, true],
:stats_font => [["Calibri", "Sylfaen"], 20, false, 0, true],
:description => [["Calibri", "Sylfaen"], 22, false, 0, true],
} # <- DO NOT REMOVE
# The two color settings below can be windowskin colors or [red, blue, green]
High_Resist = 3 # Color used for high resistances
Low_Resist = 18 # Color used for low resistances (weaknesses)
Immunity_Color = 17 # Color used for immunity/absorb text
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Battle Font Settings -
#----------------------------------------------------------------------------
# The battle font is slightly different then the font that appears in windows.
# For this one, colors MUST be in [red, blue, green] format.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Font Family, Size, Bold?, Color, Outline?]
Battle_Font = [["Calibri", "Sylfaen"], 24, true, [255,255,255], true]
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Base Stat Settings -
#----------------------------------------------------------------------------
# Set the text and/or Icon used for base stats (HP, MP, Attack, etc)
# You can set either the text or the icon to nil to omit them.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Base_Stats = [] #["Text", IconIndex]
Base_Stats[0] = ["HP", 122] # Max Health
Base_Stats[1] = ["MP", 112] # Max Mana
Base_Stats[2] = ["Atk", 116] # Attack
Base_Stats[3] = ["Def", 161] # Defense
Base_Stats[4] = ["MAtk", 113] # Magical Attack
Base_Stats[5] = ["MDef", 15] # Magical Defense
Base_Stats[6] = ["Agi", 12] # Agility
Base_Stats[7] = ["Luck", 202] # Luck
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Element Settings -
#----------------------------------------------------------------------------
# Elements you want to track. Prioritize the elements. In the default game
# resolution, about 9 icons will show. If you make the screen wider, then
# more could be shown. So list the icons you want to show in order of
# importance.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Elements = [
# [ID, IconIndex],
[3, 104], # Fire
[4, 105], # Ice
[5, 106], # Thunder
[6, 107], # Water
[7, 108], # Earth
[8, 109], # Wind
[9, 110], # Holy
[10, 111], # Dark
] # <- DO NOT REMOVE!!
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - State Settings -
#----------------------------------------------------------------------------
# This is just like setting the Elements, but there is no need to define an
# icon because all that status/states have an icon set in the database.
# So for this one, just set the status id's that you want to track in order
# of priority.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
States = [1, 2, 3, 4, 5, 6, 7, 8]
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# - Category Settings -
#----------------------------------------------------------------------------
# You can set up categories that the enemies will be sorted into. This can
# be by whatever you like. For example you could sort them by breed (mammal,
# avian, demon, etc) or by region (Forest, River, Mountains, etc). You must
# set up all the categories here and then use a note tag Enemies Tab of the
# database to set it.
#
# Category[ID] = { # ID must be a unique number.
# :name => "Miscellaneous", # Name of Category as it appears in scene
# :bg_floor => "file", # Image used if not default (can omit)
# :bg_wall => "file", # Image used if not default (can omit)
# file = file used instead of the default image. Set to "" if you
# want to use no image.
# }
#
# NOTE: both the floor and wall images can be omited to use the default
# images. If using a single image, then set one or the other to the image
# you want to use (found in the corrosponding battleback folder or the
# picture's folder) and then set the other to "" (a blank file). Do not set
# the other image to nil as this will pick up the default image.
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Category ||= {}
#----------------------------------------------------------------------------
Category[0] = { # This is the default category. Enemies appear in this
# category if they don't have one assigned or there was a typo in the tag.
:name => "Miscellaneous",
} # <-DO NOT REMOVE
#----------------------------------------------------------------------------
Category[1] = { # Enemies found in the Forsaken Forest area
:name => "Forsaken Forest", # Name of Category
:bg_floor => "Meadow", # Floor image used
:bg_wall => "Forest2", # Wall image used
}
#----------------------------------------------------------------------------
Category[2] = { # Enemies found in the Abandoned Mines area
:name => "Abandoned Mines", # Name of Category
:bg_floor => "DirtCave", # Floor image used
:bg_wall => "Mine", # Wall image used
}
#----------------------------------------------------------------------------
Category[3] = { # Enemies found in the Deep Space area
:name => "Deep Space", # Name of Category
:bg_floor => "DarkSpace", # Floor image used (Single image used)
:bg_wall => "", # Wall image used
}
#----------------------------------------------------------------------------
Category[4] = { # Enemies found in the Nocturnal Plains area
:name => "Nocturnal Plains", # Name of Category
:bg_floor => "GrassMaze", # Floor image used
:bg_wall => "PoisonSwamp", # Wall image used
}
#----------------------------------------------------------------------------
Category[5] = { # Undead Enemies
:name => "Undead", # Name of Category
:bg_floor => "DemonCastle", # Floor image used
:bg_wall => "DemonCastle1", # Wall image used
}
#----------------------------------------------------------------------------
Category[6] = { # Enemies found in the Nocturnal Plains area
:name => "Bosses", # Name of Category
:bg_floor => "Cobblestones3", # Floor image used
:bg_wall => "Cliff", # Wall image used
}
#==============================================================================
# ■ Edits should stop here unless you know what you're doing :)
#==============================================================================
end
module Notetag
Skip_Enemy = /<skip>/i
Enemy_Category = /<category:\s*(\d+(?:\s*,\s*\d+)*)>/i
BG_Floor = /<bg_floor:\s*(\w+)>/i
BG_Wall = /<bg_wall:\s*(\w+)>/i
Enemy_Desc1 = /<description1:\s*(.*)>/i
Enemy_Desc2 = /<description2:\s*(.*)>/i
Enemy_Desc3 = /<description3:\s*(.*)>/i
Shown_ID = /<shown_id:\s*(\d+)>/i
Scan_Skill = /<scan>/i
No_Scan = /<no_scan>/i
end
end
#------------------------------------------------------------------------------
# ○ Creating a way to store discovered info about the enemy with Struct.
#------------------------------------------------------------------------------
Bestiary_Entry = Struct.new(:enemy_id, :category, :elements, :states, :kills,
:quotes, :scanned)
#==============================================================================
# ■ Vocab
#==============================================================================
module Vocab
# Scan Skill
Scanned = Venka::Bestiary::Target_Scanned
No_Scan = Venka::Bestiary::No_Scan
end
#==============================================================================
# ■ DataManager
#==============================================================================
module DataManager
#----------------------------------------------------------------------------
# ● alias method: load_database
#----------------------------------------------------------------------------
class << self; alias bestiary_db_notetags load_database; end
def self.load_database
bestiary_db_notetags
load_bestiary_notetags
end
#----------------------------------------------------------------------------
# ○ new method: load_bestiary_notetags
#----------------------------------------------------------------------------
def self.load_bestiary_notetags
($data_enemies + $data_skills + $data_items).compact.each do |item|
item.load_bestiary_notetags
end
end
end
#==============================================================================
# ■ RPG::UsableItem
#==============================================================================
class RPG::UsableItem
#----------------------------------------------------------------------------
# ♦ Public Instance Variables
#----------------------------------------------------------------------------
attr_accessor :scan
#----------------------------------------------------------------------------
# ○ new method: load_bestiary_notetags
#----------------------------------------------------------------------------
def load_bestiary_notetags
@scan = false
self.note.split(/[\r\n]+/).each do |line|
info = []
case line
when Venka::Notetag::Scan_Skill; @scan = true
end
end
end
end
#==============================================================================
# ■ RPG::Enemy
#==============================================================================
class RPG::Enemy
#----------------------------------------------------------------------------
# ♦ Public Instance Variables
#----------------------------------------------------------------------------
attr_accessor :skip, :category, :bg_floor, :bg_wall, :description, :shown_id
attr_accessor :no_scan, :descript1, :descript2, :descript3
#----------------------------------------------------------------------------
# ○ new method: load_bestiary_notetags
#----------------------------------------------------------------------------
def load_bestiary_notetags
@skip = false
@category = [0]
@bg_floor = @bg_wall = ""
@shown_id = @id
@no_scan = false
@description = nil
@descript1 = @descript2 = @descript3 = nil
self.note.split(/[\r\n]+/).each do |line|
info = []
case line
when Venka::Notetag::Skip_Enemy; @skip = true
when Venka::Notetag::No_Scan; @no_scan = true
when Venka::Notetag::Enemy_Category
$1.scan(/\d+/).each { |num| info.push(num.to_i) }
@category = info ? info : 0
when Venka::Notetag::BG_Floor; @bg_floor = $1.to_s
when Venka::Notetag::BG_Wall; @bg_wall = $1.to_s
when Venka::Notetag::Enemy_Desc1; @descript1 = $1.to_s
when Venka::Notetag::Enemy_Desc2; @descript2 = $1.to_s
when Venka::Notetag::Enemy_Desc3; @descript3 = $1.to_s
when Venka::Notetag::Shown_ID; @shown_id = $1.to_i
end
end
end
end
#==============================================================================
# ■ BattleManager
#==============================================================================
module BattleManager
#----------------------------------------------------------------------------
# ● alias method: battle_start
#----------------------------------------------------------------------------
class << self; alias bestiary_battle_start battle_start; end
def self.battle_start
bestiary_battle_start
add_bestiary_enemies
end
#----------------------------------------------------------------------------
# ○ new method: add_bestiary_enemies
#----------------------------------------------------------------------------
def self.add_bestiary_enemies
$game_troop.members.each do |enemy|
rpg_enemy = $data_enemies[enemy.enemy_id]
next if rpg_enemy.nil? || rpg_enemy.skip
unless $game_party.bestiary_include?(rpg_enemy.shown_id)
$game_party.add_enemy($data_enemies[rpg_enemy.shown_id])
end
end
end
end
#==============================================================================
# ■ Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
#----------------------------------------------------------------------------
# ● upgraded method: add_state
#----------------------------------------------------------------------------
def add_state(state_id)
Venka::Bestiary::States.each_with_index do |id, i|
next unless state_id == id
$game_party.bestiary.each do |enemy|
next unless enemy.enemy_id == $data_enemies[@enemy_id].shown_id
enemy.states[i] = true
end
end
super
end
end
#==============================================================================
# ■ Game_Troop
#==============================================================================
class Game_Troop < Game_Unit
#----------------------------------------------------------------------------
# ● alias method: battle_start
#----------------------------------------------------------------------------
alias bestiary_kill_count make_drop_items
def make_drop_items
add_encounter_count
bestiary_kill_count
end
#----------------------------------------------------------------------------
# ○ new method: add_encounter_count
#----------------------------------------------------------------------------
def add_encounter_count
dead_members.each do |enemy|
rpg_enemy = $data_enemies[enemy.enemy_id]
next if rpg_enemy.nil? || rpg_enemy.skip
$game_party.bestiary.each do |entry|
next unless entry.enemy_id == rpg_enemy.shown_id
entry.kills += 1
if entry.kills >= Venka::Bestiary::Show_Elements
entry.elements.size.times {|i| entry.elements[i] = true}
end
if entry.kills >= Venka::Bestiary::Show_States
entry.states.size.times {|i| entry.states[i] = true}
end
end
end
end
end
#==============================================================================
# ■ Game_Party
#==============================================================================
class Game_Party < Game_Unit
#----------------------------------------------------------------------------
# ♦ Public Instance Variables
#----------------------------------------------------------------------------
attr_accessor :bestiary
#----------------------------------------------------------------------------
# ● alias method: initialize
#----------------------------------------------------------------------------
alias venka_bestiary_enounters_ini initialize
def initialize
venka_bestiary_enounters_ini
@bestiary = []
end
#----------------------------------------------------------------------------
# ○ new method: add_enemy
#----------------------------------------------------------------------------
# The entries are: EnemyID, BestiaryCategory, Array for Element info,
# Array for State info, Kill Counter, Actor Quotes, and Scanned?
#----------------------------------------------------------------------------
def add_enemy(enemy)
@bestiary << Bestiary_Entry.new(enemy.id, enemy.category,
Array.new(Venka::Bestiary::Elements.size, false),
Array.new(Venka::Bestiary::States.size, false), 0, [], false)
end
#----------------------------------------------------------------------------
# ○ new method: reveal_resist
#----------------------------------------------------------------------------
def reveal_resist(enemy_id, reveal = true)
rpg_enemy = $data_enemies[enemy_id]
return if rpg_enemy.nil? || rpg_enemy.skip
@bestiary.each do |entry|
next unless entry.enemy_id == rpg_enemy.shown_id
next if rpg_enemy.no_scan && !reveal
entry.elements.size.times {|i| entry.elements[i] = true}
entry.states.size.times {|i| entry.states[i] = true}
end
end
#----------------------------------------------------------------------------
# ○ new method: bestiary_include?
#----------------------------------------------------------------------------
def bestiary_include?(id)
@bestiary.each do |entry|
return true if entry.enemy_id == id
end
return false
end
end
#==============================================================================
# ■ Game_Interpreter
#==============================================================================
class Game_Interpreter
#----------------------------------------------------------------------------
# ○ new method: add_enemy_entry
#----------------------------------------------------------------------------
def add_enemy_entry(enemy_id)
rpg_enemy = $data_enemies[enemy_id]
return if rpg_enemy.nil? || rpg_enemy.skip
if $game_party.bestiary == []
$game_party.add_enemy($data_enemies[rpg_enemy.shown_id])
elsif !$game_party.bestiary_include?(rpg_enemy.shown_id)
$game_party.add_enemy($data_enemies[rpg_enemy.shown_id])
end
end
#----------------------------------------------------------------------------
# ○ new method: set_enemy_description
#----------------------------------------------------------------------------
def set_enemy_description(enemy_id, text)
id = $data_enemies[enemy_id].shown_id
$data_enemies[id].description = text
end
#----------------------------------------------------------------------------
# ○ new method: reset_enemy_description
#----------------------------------------------------------------------------
def reset_enemy_description(enemy_id)
id = $data_enemies[enemy_id].shown_id
$data_enemies[id].description = nil
end
#----------------------------------------------------------------------------
# ○ new method: enemy_kill_count(enemy_id)
#----------------------------------------------------------------------------
def enemy_kill_count(enemy_id)
kills = 0
$game_party.bestiary.each do |entry|
next unless entry.enemy_id == $data_enemies[enemy_id].shown_id
kills = entry.kills
if entry.kills >= Venka::Bestiary::Show_Elements
entry.elements.size.times {|i| entry.elements[i] = true}
end
if entry.kills >= Venka::Bestiary::Show_States
entry.states.size.times {|i| entry.states[i] = true}
end
end
return kills
end
end
#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
#----------------------------------------------------------------------------
# ○ new method: set_windowskin
#----------------------------------------------------------------------------
def set_windowskin
return unless Venka::Bestiary::Windowskin
self.windowskin = Cache.system(Venka::Bestiary::Windowskin)
self.opacity = Venka::Bestiary::Window_Opacity
self.back_opacity = Venka::Bestiary::Window_BGOpacity
end
#----------------------------------------------------------------------------
# ○ new method: get_color - method determines if text color or new color
#----------------------------------------------------------------------------
def get_color(input)
input.is_a?(Integer) ? text_color([[input, 0].max, 31].min) : Color.new(*input)
end
#----------------------------------------------------------------------------
# ○ new method: font_color
#----------------------------------------------------------------------------
def font_color(text_type)
f_color = Venka::Bestiary::Fonts[text_type][3]
color = f_color.is_a?(Integer) ? text_color(f_color) : Color.new(*f_color)
end
#----------------------------------------------------------------------------
# ○ new method: set_bestiary_font
#----------------------------------------------------------------------------
def set_bestiary_font(text_type, enabled = true)
font = Venka::Bestiary::Fonts[text_type]
contents.font.name = font[0]
contents.font.size = font[1]
contents.font.bold = font[2]
contents.font.outline = font[4]
change_color(font_color(text_type), enabled)
end
#----------------------------------------------------------------------------
# ○ new method: font_height
#----------------------------------------------------------------------------
def font_height
[contents.font.size, 24].max
end
#----------------------------------------------------------------------------
# ○ new method: draw_line
#----------------------------------------------------------------------------
def draw_line(y)
return unless Venka::Bestiary::Use_Dividers
color = get_color(Venka::Bestiary::Line_Color)
contents.fill_rect(4, y, contents_width - 8, 2, color)
contents.fill_rect(4, y + 2, contents_width - 8, 1, Color.new(16,16,16,100))
end
end
#==============================================================================
# ■ Window_Message
#==============================================================================
class Window_Message
#----------------------------------------------------------------------------
# ♦ Public Instance Variables
#----------------------------------------------------------------------------
attr_accessor :wordwrap
end
#==============================================================================
# ■ Window_MenuCommand
#==============================================================================
class Window_MenuCommand < Window_Command
#----------------------------------------------------------------------------
# ● alias method: add_original_commands
#----------------------------------------------------------------------------
alias bestiary_menu_access_aoc add_original_commands
def add_original_commands
bestiary_menu_access_aoc
add_command(Venka::Bestiary::Bestiary_Command, :bestiary) if Venka::Bestiary::Menu_Access
end
end
#==============================================================================
# ■ Window_BattleLog
#==============================================================================
class Window_BattleLog < Window_Selectable
#----------------------------------------------------------------------------
# ● alias method: display_failure
#----------------------------------------------------------------------------
alias bestiary_scan_fail_msg display_failure
def display_failure(target, item)
if item.scan && target.result.hit? && !target.result.success
text = $data_enemies[target.enemy_id].no_scan ? Vocab::No_Scan : Vocab::Scanned
add_text(sprintf(text, target.name))
wait
else
bestiary_scan_fail_msg(target, item)
end
end
end
#==============================================================================
# ■ Window_BestiaryHelp
#==============================================================================
class Window_BestiaryHelp < Window_Base
#----------------------------------------------------------------------------
# ● upgraded method: initialize
#----------------------------------------------------------------------------
def initialize(x, y)
height = [Venka::Bestiary::Fonts[:normal_font][1], 24].max + 24
super(x, y, Graphics.width, height)
set_windowskin
end
#----------------------------------------------------------------------------
# ○ new method: set_text
#----------------------------------------------------------------------------
def set_text(text)
contents.clear
set_bestiary_font(:normal_font)
draw_text(0, 0, contents.width, font_height, text, 1)
end
#----------------------------------------------------------------------------
# ○ new method: draw_completion
#----------------------------------------------------------------------------
def draw_completion
contents.clear
draw_enemies_discovered
end
#----------------------------------------------------------------------------
# ○ new method: draw_enemies_discovered
#----------------------------------------------------------------------------
def draw_enemies_discovered
set_bestiary_font(:normal_font)
enemies_discovered = $game_party.bestiary.size
total = total_enemies
text = "#{enemies_discovered}/#{total} #{Venka::Bestiary::Discovered_Text}"
draw_text(0, 0, contents.width, font_height, text)
discovered = (enemies_discovered.to_f / total) * 100
text = "#{discovered.round(1)}% #{Venka::Bestiary::Percent_Finished}"
draw_text(0, 0, contents.width, font_height, text, 2)
end
#----------------------------------------------------------------------------
# ○ new method: total_enemies
#----------------------------------------------------------------------------
def total_enemies
total = 0
for i in 1...$data_enemies.size
next if $data_enemies[i].shown_id != $data_enemies[i].id
total += 1 unless $data_enemies[i].skip
end
total
end
#----------------------------------------------------------------------------
# ○ new method: draw_instructions
#----------------------------------------------------------------------------
def draw_instructions
contents.clear
set_bestiary_font(:normal_font)
text = Venka::Bestiary::Instructions_Text
draw_text(0, 0, contents.width, font_height, text, 1)
end
#----------------------------------------------------------------------------
# ○ new method: set_description
#----------------------------------------------------------------------------
def set_description(enemy)
contents.clear
create_contents # Remake contents since the window size changed
get_description_text(enemy)
text = get_description_text(enemy)
if Venka::Bestiary::Use_Wordwrapper
wrapping = @wordwrap
@wordwrap = true
draw_text_ex(0, 0, text.gsub(/[|]/, ""))
@wordwrap = wrapping
else
draw_text_ex(0, 0, text.gsub(/[|]/, "\n"))
end
end
#----------------------------------------------------------------------------
# ○ new method: get_description_text
#----------------------------------------------------------------------------
def get_description_text(enemy)
if enemy.description
text = enemy.description
else
text = Venka::Bestiary::Default_Description
kills = 0
$game_party.bestiary.each do |foe|
kills = foe.kills if foe.enemy_id == enemy.shown_id
end
if kills >= Venka::Bestiary::Description3 && enemy.descript3
text = enemy.descript3
elsif kills >= Venka::Bestiary::Description2 && enemy.descript2
text = enemy.descript2
elsif kills >= Venka::Bestiary::Description1 && enemy.descript1
text = enemy.descript1
end
end
text
end
#----------------------------------------------------------------------------
# ● upgraded method: draw_text_ex
#----------------------------------------------------------------------------
def draw_text_ex(x, y, text)
set_bestiary_font(:description)
text = convert_escape_characters(text)
pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
process_character(text.slice!(0, 1), text, pos) until text.empty?
end
end
#==============================================================================
# ■ Window_BestiaryCategory
#==============================================================================
class Window_BestiaryCategory < Window_Command
#----------------------------------------------------------------------------
# ● upgraded method: initialize
#----------------------------------------------------------------------------
def initialize(x, y)
@wy = y
@categories = Venka::Bestiary::Category
super(x, @wy)
set_windowskin
end
#----------------------------------------------------------------------------
# ● window settings
#----------------------------------------------------------------------------
def window_width; Graphics.width * 0.5; end
def window_height; Graphics.height - (@wy * 2); end
def item_height; [Venka::Bestiary::Fonts[:list_font][1], 24].max; end
#----------------------------------------------------------------------------
# ● upgraded method: make_command_list
#----------------------------------------------------------------------------
def make_command_list
@categories.each{|key, info| add_command(info[:name], key)}
end
#----------------------------------------------------------------------------
# ● upgraded method: draw_item
#----------------------------------------------------------------------------
def draw_item(index)
set_bestiary_font(:normal_font)
@width = Venka::Bestiary::Track_Progress ? text_size("99.9%").width + 5 : 0
rect = item_rect_for_text(index)
set_bestiary_font(:list_font)
draw_text(rect.x, rect.y, rect.width - @width, rect.height, command_name(index))
found_text(index, rect) if Venka::Bestiary::Track_Progress
end
#----------------------------------------------------------------------------
# ○ new method: found_text
#----------------------------------------------------------------------------
def found_text(index, rect)
set_bestiary_font(:normal_font)
total = total_enemies(index)
discovered = total_found(index)
value = (total > 0) ? (discovered.to_f / total) * 100 : 0.0
text = (value > 0 && value < 100) ? value.round(1) : value.round
draw_text(rect.width - @width, rect.y, @width, rect.height, "#{text}%", 2)
end
#----------------------------------------------------------------------------
# ○ new method: total_enemies
#----------------------------------------------------------------------------
def total_enemies(index)
total = 0
for i in 1...$data_enemies.size
next unless $data_enemies[i].category.include?(index)
next if $data_enemies[i].shown_id != $data_enemies[i].id
total += 1 unless $data_enemies[i].skip
end
return total
end
#----------------------------------------------------------------------------
# ○ new method: total_found
#----------------------------------------------------------------------------
def total_found(index)
total = 0
$game_party.bestiary.each {|e| total += 1 if e.category.include?(index)}
return total
end
end
#==============================================================================
# ■ Window_BestiaryEnemyList
#==============================================================================
class Window_BestiaryEnemyList < Window_Command
#----------------------------------------------------------------------------
# ♦ Public Instance Variables
#----------------------------------------------------------------------------
attr_reader :category_window, :stats_window
#----------------------------------------------------------------------------
# ● upgraded method: initialize
#----------------------------------------------------------------------------
def initialize(x, y)
@category = 0
@wy = y
super(x, @wy)
set_windowskin
end
#----------------------------------------------------------------------------
# ● window settings
#----------------------------------------------------------------------------
def window_width; Graphics.width * 0.5; end
def window_height; Graphics.height - (@wy * 2); end
def item_height; [Venka::Bestiary::Fonts[:list_font][1], 24].max; end
#----------------------------------------------------------------------------
# ○ new method: category_window
#----------------------------------------------------------------------------
def category_window=(category_window)
if @category_window != category_window
@category_window = category_window
@category = category_window.current_symbol.to_s.to_i
refresh
end
end
#----------------------------------------------------------------------------
# ○ new method: stats_window
#----------------------------------------------------------------------------
def stats_window=(stats_window)
if @stats_window != stats_window
@stats_window = stats_window
end
end
#----------------------------------------------------------------------------
# ● upgraded method: make_command_list
#----------------------------------------------------------------------------
def make_command_list
@enemies = []
sort_list
@bestiary_list.each do |enemy|
next if enemy.nil?
next unless enemy.category.include?(@category)
@enemies << enemy
add_command($data_enemies[enemy.enemy_id].name, :ok, true, enemy.enemy_id)
end
end
#----------------------------------------------------------------------------
# ○ new method: sort_list
#----------------------------------------------------------------------------
def sort_list
@bestiary_list = $game_party.bestiary.clone
if Venka::Bestiary::Sort_Type == :id # Sort by enemy id
@bestiary_list.sort!{|a, b| a.enemy_id <=> b.enemy_id}
elsif Venka::Bestiary::Sort_Type == :name # Sort by name
@bestiary_list.sort!{|a, b|
$data_enemies[a.enemy_id].name <=> $data_enemies[b.enemy_id].name}
end
end
#----------------------------------------------------------------------------
# ● upgraded method: draw_item
#----------------------------------------------------------------------------
def draw_item(index)
set_bestiary_font(:normal_font)
@width = contents_width * 0.33
@width = 0 unless Venka::Bestiary::Track_Kills
rect = item_rect_for_text(index)
set_bestiary_font(:list_font)
draw_text(rect.x, rect.y, rect.width - @width, rect.height, command_name(index))
draw_kills(index) if Venka::Bestiary::Track_Kills
end
#----------------------------------------------------------------------------
# ○ new method: draw_kills
#----------------------------------------------------------------------------
def draw_kills(index)
set_bestiary_font(:normal_font)
text = "#{@enemies[index].kills} #{Venka::Bestiary::Kills_Text}"
draw_text(item_rect_for_text(index), text, 2)
end
#----------------------------------------------------------------------------
# ● upgraded method: update
#----------------------------------------------------------------------------
def update
super
if @category_window && @category != @category_window.current_symbol.to_s.to_i
@category = @category_window.current_symbol.to_s.to_i
refresh
end
end
end
#==============================================================================
# ■ Window_BestiaryStatSelection
#==============================================================================
class Window_BestiaryStatSelection < Window_Selectable
#----------------------------------------------------------------------------
# ● upgraded method: initialize
#----------------------------------------------------------------------------
def initialize(x, y, width, height)
super(x, y, width, height)
set_windowskin
select(0)
hide
refresh
end
#----------------------------------------------------------------------------
# ● window settings;
#----------------------------------------------------------------------------
def col_max; return item_max; end
def spacing; return 5; end
def item_height; [Venka::Bestiary::Fonts[:normal_font][1].size, 24].max; end
#----------------------------------------------------------------------------
# ● upgraded method: item_max
#----------------------------------------------------------------------------
def item_max
if SceneManager.scene_is?(Scene_Battle)
Venka::Bestiary::Show_Debuff_Info ? 4 : 3
else
return 2
end
end
#----------------------------------------------------------------------------
# ○ new method: enemy_id
#----------------------------------------------------------------------------
def enemy_id=(enemy_id)
return @enemy = nil if enemy_id == 0
if @enemy != $data_enemies[enemy_id]
@enemy = $data_enemies[enemy_id]
refresh
end
end
#----------------------------------------------------------------------------
# ● upgraded method: item_rect
#----------------------------------------------------------------------------
def item_rect(index)
rect = super
if SceneManager.scene_is?(Scene_Battle)
rect.y += [Venka::Bestiary::Fonts[:normal_font][1], 24].max + 6
end
rect
end
#----------------------------------------------------------------------------
# ● upgraded method: draw_item
#----------------------------------------------------------------------------
def draw_item(index)
rect = item_rect_for_text(index)
if SceneManager.scene_is?(Scene_Battle)
text = [Venka::Bestiary::View_Stats, Venka::Bestiary::View_Element,
Venka::Bestiary::View_States, Venka::Bestiary::View_Debuff]
else
text = [Venka::Bestiary::View_Stats, Venka::Bestiary::View_More]
end
set_bestiary_font(:normal_font)
draw_text(rect, text[index], 1)
end
#----------------------------------------------------------------------------
# ● upgraded method: refresh
#----------------------------------------------------------------------------
def refresh
contents.clear
if SceneManager.scene_is?(Scene_Battle)
set_bestiary_font(:normal_font)
@y = font_height
draw_enemy_name if @enemy
end
draw_all_items
end
#----------------------------------------------------------------------------
# ○ new method: draw_enemy_name
#----------------------------------------------------------------------------
def draw_enemy_name
draw_text(0, 0, contents.width, font_height, @enemy.name, 1)
draw_line(@y + 2)
@y += 6
draw_line(@y + item_height + 3)
end
#----------------------------------------------------------------------------
# ● upgraded method: update_help
#----------------------------------------------------------------------------
def update_help
@help_window.set_index(@index)
end
#----------------------------------------------------------------------------
# ● upgraded method: select
#----------------------------------------------------------------------------
def select(index)
super
@help_window.oy = 0 if @help_window
end
#----------------------------------------------------------------------------
# ● upgraded method: cursor_down
#----------------------------------------------------------------------------
def cursor_down(wrap = false)
super
if @help_window && display_window_oy < @help_window.total_height
@help_window.oy += Venka::Bestiary::Scroll_Speed
end
end
#----------------------------------------------------------------------------
# ○ new method: display_window_oy
#----------------------------------------------------------------------------
def display_window_oy
@help_window.oy + @help_window.height - (@help_window.standard_padding * 2)
end
#----------------------------------------------------------------------------
# ● upgraded method: cursor_up
#----------------------------------------------------------------------------
def cursor_up(wrap = false)
super
@help_window.oy -= Venka::Bestiary::Scroll_Speed if @help_window && @help_window.oy > 0
end
#----------------------------------------------------------------------------
# ○ new method: wait_to_close
#----------------------------------------------------------------------------
def wait_to_close
loop do
Graphics.update
Input.update
update
break if Input.trigger?(:C) || Input.trigger?(:B)
end
@help_window.hide
deactivate
self.hide
end
end
#==============================================================================
# ■ Window_BestiaryStats
#==============================================================================
class Window_BestiaryStats < Window_Base
#----------------------------------------------------------------------------
# ♦ Public Instance Variables
#----------------------------------------------------------------------------
attr_accessor :enemy, :total_height
#----------------------------------------------------------------------------
# ● upgraded method: initialize
#----------------------------------------------------------------------------
def initialize(x, y, width, height)
@win_height = height
super(x, y, width, height)
self.opacity = 0
@enemy = nil
hide
end
#----------------------------------------------------------------------------
# ○ new method: enemy_id
#----------------------------------------------------------------------------
def enemy_id=(enemy_id)
return @enemy = nil if enemy_id == 0
if @enemy != $data_enemies[enemy_id]
@enemy = $data_enemies[enemy_id]
end
refresh
end
#----------------------------------------------------------------------------
# ○ new method: set_index
#----------------------------------------------------------------------------
def set_index(index)
if @index != index
@index = index
refresh
end
end
#----------------------------------------------------------------------------
# ● upgraded method: contents_height
#----------------------------------------------------------------------------
def contents_height
@total_height ? @total_height : super
end
#----------------------------------------------------------------------------
# ● upgraded method: refresh
#----------------------------------------------------------------------------
def refresh
contents.clear
return if @enemy.nil?
if SceneManager.scene_is?(Scene_Bestiary)
@index == 0 ? draw_basic_stats : draw_other_info
end
end
#----------------------------------------------------------------------------
# ○ new method: determine_window_height
#----------------------------------------------------------------------------
def determine_window_height(text_lines)
set_bestiary_font(:header_font)
@total_height = font_height * text_lines
self.height = ([(@total_height + standard_padding * 2), @win_height].min)
create_contents
end
#----------------------------------------------------------------------------
# ○ new method: info_rect
#----------------------------------------------------------------------------
def info_rect(index)
rect = Rect.new
rect.width = contents.width * 0.5 - 3
rect.height = [Venka::Bestiary::Fonts[:stat_name][1], 24].max
rect.x = index % 2 * (rect.width + 3)
rect.y = index / 2 * font_height
rect
end
#----------------------------------------------------------------------------
# ○ new method: draw_basic_stats
#----------------------------------------------------------------------------
def draw_basic_stats
elements = Venka::Bestiary::Elements.size
states = Venka::Bestiary::States.size
# Get the total text lines to show
height = (elements / 2 + elements % 2) + (states / 2 + states % 2) + 10
height += 6 if Venka::Bestiary::Show_Debuff_Info
determine_window_height(height)
draw_line(5)
@y = 12
draw_main_stats
draw_line(@y + 5)
@y += 12
get_revealed_resists
draw_elements
draw_line(@y + 5)
@y += 12
draw_states
return unless Venka::Bestiary::Show_Debuff_Info
draw_line(@y + 5)
@y += 12
draw_debuffs
end
#----------------------------------------------------------------------------
# ○ new method: draw_main_stats
#----------------------------------------------------------------------------
def draw_main_stats
set_bestiary_font(:header_font)
draw_text(0, @y, contents.width, font_height, Venka::Bestiary::Stats_Text, 1)
@y += font_height
8.times {|stat| draw_stat(stat, :stat)}
@y += info_rect(0).height * 4
end
#----------------------------------------------------------------------------
# ○ new method: draw_stat
#----------------------------------------------------------------------------
def draw_stat(stat, stat_type)
rect = info_rect(stat)
rect.y += @y
stat_info = Venka::Bestiary::Base_Stats[stat]
if stat_info[1]
draw_icon(stat_info[1], rect.x, rect.y)
rect.x += 25; rect.width -= 25
end
if stat_info[0]
set_bestiary_font(:stat_name)
draw_text(rect, stat_info[0])
text_width = text_size(stat_info[0]).width + 5
rect.x += text_width; rect.width -= text_width
end
set_bestiary_font(:stats_font)
text = Venka::Bestiary::Unknown_Stat
$game_party.bestiary.each do |entry|
next unless entry.enemy_id == @enemy.shown_id
if stat_type == :stat && (entry.scanned ||
entry.kills >= Venka::Bestiary::Show_BaseStats)
text = Game_Enemy.new(0, @enemy.shown_id).param(stat)
elsif stat_type == :debuff && (entry.scanned ||
entry.kills >= Venka::Bestiary::Show_DebuffStats)
rate = Game_Enemy.new(0, @enemy.shown_id).debuff_rate(stat)
text = get_resist_info(stat, rate)
end
end
draw_text(rect, text, 2)
end
#----------------------------------------------------------------------------
# ○ new method: get_revealed_resists
#----------------------------------------------------------------------------
def get_revealed_resists
$game_party.bestiary.each do |entry|
@eles = entry.elements if entry.enemy_id == @enemy.shown_id
@states = entry.states if entry.enemy_id == @enemy.shown_id
end
end
#----------------------------------------------------------------------------
# ○ new method: draw_elements
#----------------------------------------------------------------------------
def draw_elements
set_bestiary_font(:header_font)
draw_text(0, @y, contents.width, font_height, Venka::Bestiary::Element_Text, 1)
@y += font_height
elements = Venka::Bestiary::Elements
(elements.size).times {|i| draw_ele_info(i, elements[i], info_rect(i))}
@y += (info_rect(0).height) * (elements.size * 0.5 + elements.size % 2)
end
#----------------------------------------------------------------------------
# ○ new method: draw_ele_info
#----------------------------------------------------------------------------
def draw_ele_info(i, element, rect)
rect.y += @y
if element[1]
draw_icon(element[1], rect.x, rect.y)
rect.x += 25; rect.width -= 25
end
set_bestiary_font(:stat_name)
tw = text_size(99).width + 5
draw_text(rect, $data_system.elements[element[0]])
text_width = text_size(element[0]).width + 5
# Scale text so the value will fit as well in small resolutions
rect.x = [(rect.x + text_width), (rect.x + rect.width - tw)].min
rect.width = [(rect.width - text_width), tw].max
set_bestiary_font(:stats_font)
text = @eles[i] ? get_resist_info(element[0], 11) : Venka::Bestiary::Unknown_Stat
draw_text(rect, text, 2)
end
#----------------------------------------------------------------------------
# ○ new method: get_resist_info
#----------------------------------------------------------------------------
def get_resist_info(stat_id, code_id)
case code_id
when 11 # Element
resist = Game_Enemy.new(0, @enemy.shown_id).element_rate(stat_id)
if $imported["YEA-Element Absorb"] && Game_Enemy.new(0, @enemy.shown_id).element_absorb?(stat_id)
set_resist_style(resist, Venka::Bestiary::Absorb_Text)
else
set_resist_style(resist)
end
when 13
enemy = Game_Enemy.new(0, @enemy.shown_id)
if enemy.features_with_id(14, stat_id).empty?
resist = enemy.state_rate(stat_id)
set_resist_style(resist)
else
set_resist_style(1.0, Venka::Bestiary::Immune_Text)
end
else
set_resist_style(code_id)
end
end
#----------------------------------------------------------------------------
# ○ new method: set_resist_style
#----------------------------------------------------------------------------
def set_resist_style(resist, text = "")
if text != ""
color = Venka::Bestiary::Immunity_Color
else
color = Venka::Bestiary::Fonts[:stats_font][3]
color = Venka::Bestiary::High_Resist if resist > 1.0
color = Venka::Bestiary::Low_Resist if resist < 1.0
resist -= 1.0 if resist >= 1.0
text = (resist * 100).round
end
new_color = color.is_a?(Integer) ? text_color(color) : Color.new(*color)
change_color(new_color)
return text
end
#----------------------------------------------------------------------------
# ○ new method: draw_states
#----------------------------------------------------------------------------
def draw_states
set_bestiary_font(:header_font)
draw_text(0, @y, contents.width, font_height, Venka::Bestiary::Status_Text, 1)
@y += font_height
states = Venka::Bestiary::States
(states.size).times {|i| draw_state_info(i, states[i], info_rect(i))}
@y += (info_rect(0).height) * (states.size / 2).round
end
#----------------------------------------------------------------------------
# ○ new method: draw_state_info
#----------------------------------------------------------------------------
def draw_state_info(i, state_id, rect)
state = $data_states[state_id]
rect.y += @y
draw_icon(state.icon_index, rect.x, rect.y)
rect.x += 25; rect.width -= 25
set_bestiary_font(:stat_name)
tw = text_size(99).width + 5
draw_text(rect.x, rect.y, rect.width - tw, rect.height, state.name)
text_width = text_size(state.name).width + 5
# Scale text so the value will fit as well in small resolutions
rect.x = [(rect.x + text_width), (rect.x + rect.width - tw)].min
rect.width = [(rect.width - text_width), tw].max
set_bestiary_font(:stats_font)
text = @states[i] ? get_resist_info(state_id, 13) : Venka::Bestiary::Unknown_Stat
draw_text(rect, text, 2)
end
#----------------------------------------------------------------------------
# ○ new method: draw_debuffs
#----------------------------------------------------------------------------
def draw_debuffs
set_bestiary_font(:header_font)
draw_text(0, @y, contents.width, font_height, Venka::Bestiary::Debuff_Text, 1)
@y += font_height
8.times do |stat|
draw_stat(stat, :debuff)
end
end
#----------------------------------------------------------------------------
# ○ new method: draw_other_info
#----------------------------------------------------------------------------
def draw_other_info
# Get the number of lines to display loot
drops = @enemy.drop_items.select {|d| d.kind > 0 }
# Get the number of lines to display enemy skills
ids = []
@enemy.actions.each do |action|
ids << action.skill_id unless ids.include?(action.skill_id)
end
# Total number of lines to display with skills, loot, headers, etc
height = 5 + drops.size + ids.size
determine_window_height(height)
draw_line(5)
@y = 12
set_bestiary_font(:header_font)
draw_text(0, @y, contents.width, font_height, Venka::Bestiary::Loot_Text, 1)
@y += font_height
draw_exp_and_gold
draw_drops
draw_skills
end
#----------------------------------------------------------------------------
# ○ new method: draw_exp
#----------------------------------------------------------------------------
def draw_exp_and_gold
exp = Venka::Bestiary::Exp_Text
gold = Venka::Bestiary::Gold_Text
width = contents.width
width = ((@enemy.exp > 0 || @enemy.gold > 0) ? width * 0.5 : width).to_i
draw_icon_text(exp, 0, width, @enemy.exp) if @enemy.exp > 0
x = @enemy.exp > 0 ? width : 0
draw_icon_text(gold, x, width, @enemy.gold) if @enemy.gold > 0
@y += font_height
end
#----------------------------------------------------------------------------
# ○ new method: draw_icon_and_text
#----------------------------------------------------------------------------
def draw_icon_text(info, x, width, amount)
draw_icon(info[1], x, @y) if info[1]
dx = info[1] ? 25 : 0
set_bestiary_font(:stat_name)
draw_text(x + dx, @y, width - dx, font_height, info[0])
set_bestiary_font(:stats_font)
dx += text_size(info[0]).width + 10
draw_text(x + dx, @y, width - dx, font_height, amount)
end
#----------------------------------------------------------------------------
# ○ new method: draw_drops
#----------------------------------------------------------------------------
def draw_drops
drops_revealed = false
$game_party.bestiary.each do |entry|
next unless entry.enemy_id == @enemy.shown_id
if entry.scanned || entry.kills >= Venka::Bestiary::Show_Loot
drops_revealed = true
end
end
if drops_revealed
@enemy.drop_items.each do |drop_info|
next if drop_info.kind == 0
item = $data_items[drop_info.data_id] if drop_info.kind == 1
item = $data_weapons[drop_info.data_id] if drop_info.kind == 2
item = $data_armors[drop_info.data_id] if drop_info.kind == 3
set_bestiary_font(:stat_name)
tw = text_size("100%").width + 5
draw_item_name(item, 0, @y, contents.width - tw)
chance = (1.to_f / drop_info.denominator) * 100
chance = (chance > 0.9) ? chance.round : chance.round(1)
set_bestiary_font(:stats_font)
draw_text(0, @y, contents.width, font_height, "#{chance}%", 2)
@y += font_height
end
else
set_bestiary_font(:stat_name)
draw_text(0, @y, contents.width, font_height, Venka::Bestiary::Unknown_Loot)
@y += font_height
end
draw_line(@y + 5)
@y += 12
end
#----------------------------------------------------------------------------
# ○ new method: draw_skills
#----------------------------------------------------------------------------
def draw_skills
set_bestiary_font(:header_font)
draw_text(0, @y, contents.width, font_height, Venka::Bestiary::Skill_Text, 1)
@y += font_height
set_bestiary_font(:stat_name)
skills_revealed = false
$game_party.bestiary.each do |entry|
next unless entry.enemy_id == @enemy.shown_id
if entry.scanned || entry.kills >= Venka::Bestiary::Show_Abilities
skills_revealed = true
end
end
if skills_revealed
skills.each do |id|
draw_item_name($data_skills[id], 0, @y, contents.width)
@y += font_height
end
else
draw_text(0, @y, contents.width, font_height, Venka::Bestiary::Unknown_Skills)
end
end
#----------------------------------------------------------------------------
# ○ new method: skills
#----------------------------------------------------------------------------
def skills
ids = []
@enemy.actions.each do |action|
ids << action.skill_id unless ids.include?(action.skill_id)
end
return ids
end
end
#==============================================================================
# ■ Window_BattleScan
#==============================================================================
class Window_BattleScan < Window_BestiaryStats
#----------------------------------------------------------------------------
# ♦ Public Instance Variables
#----------------------------------------------------------------------------
attr_accessor :show_stats
#----------------------------------------------------------------------------
# ● upgraded method: initialize
#----------------------------------------------------------------------------
def initialize(x, y, width, height)
super(x, y, width, height)
end
#----------------------------------------------------------------------------
# ● upgraded method: refresh
#----------------------------------------------------------------------------
def refresh
contents.clear
return if @enemy.nil?
if $game_party.bestiary_include?(@enemy.shown_id)
@y = 0
case @index
when 0; draw_basic_stats
when 1; draw_enemy_resists
when 2; draw_enemy_states
when 3; draw_debuff_rates
end
else
set_bestiary_font(:stat_name)
text = Venka::Bestiary::No_Info
draw_text(0, 0, contents.width, contents.height, text, 1)
end
end
#----------------------------------------------------------------------------
# ○ new method: draw_basic_stats
#----------------------------------------------------------------------------
def draw_basic_stats
determine_window_height(4)
8.times {|stat| draw_stat(stat, :stat)}
end
#----------------------------------------------------------------------------
# ○ new method: draw_enemy_resists
#----------------------------------------------------------------------------
def draw_enemy_resists
elements = Venka::Bestiary::Elements
height = (elements.size / 2) + (elements.size % 2)
determine_window_height(height)
get_revealed_resists
(elements.size).times {|i| draw_ele_info(i, elements[i], info_rect(i))}
end
#----------------------------------------------------------------------------
# ○ new method: draw_enemy_states
#----------------------------------------------------------------------------
def draw_enemy_states
states = Venka::Bestiary::States
height = (states.size / 2) + (states.size % 2)
determine_window_height(height)
(states.size).times {|i| draw_state_info(i, states[i], info_rect(i))}
end
#----------------------------------------------------------------------------
# ○ new method: draw_debuff_rates
#----------------------------------------------------------------------------
def draw_debuff_rates
determine_window_height(4)
8.times {|stat| draw_stat(stat, :debuff)}
end
end
#==============================================================================
# ■ Scene_Menu
#==============================================================================
class Scene_Menu < Scene_MenuBase
#----------------------------------------------------------------------------
# ● alias method: create_command_window
#----------------------------------------------------------------------------
alias bestiary_menu_access_ccw create_command_window
def create_command_window
bestiary_menu_access_ccw
@command_window.set_handler(:bestiary, method(:command_bestiary))
end
#----------------------------------------------------------------------------
# ○ new method: command_bestiary
#----------------------------------------------------------------------------
def command_bestiary
SceneManager.call(Scene_Bestiary)
end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#----------------------------------------------------------------------------
# ● alias method: create_all_windows
#----------------------------------------------------------------------------
alias scan_window_caw create_all_windows
def create_all_windows
scan_window_caw
create_info_instructions
create_stats_selection
create_stats_window
end
#----------------------------------------------------------------------------
# ○ new method: create_stats_selection
#----------------------------------------------------------------------------
def create_stats_selection
width = [Graphics.width * 0.6, 420].max
x = (Graphics.width - width) * 0.5
# Get total height of the window since it can change based on fonts used.
height = 40 + ([Venka::Bestiary::Fonts[:normal_font][1], 24].max * 2) +
([Venka::Bestiary::Fonts[:stat_name][1], 24].max * 4)
y = (Graphics.height - @status_window.height - height) * 0.5
@stats_selection = Window_BestiaryStatSelection.new(x, y, width, height)
end
#----------------------------------------------------------------------------
# ○ new method: create_stats_window
#----------------------------------------------------------------------------
def create_stats_window
y = @stats_selection.y + @stats_selection.item_height + 15 +
Venka::Bestiary::Fonts[:normal_font][1]
# Make the info window the same height as the selection window minus the
# header info and selection area.
height = @stats_selection.height - @stats_selection.item_height - 15 -
Venka::Bestiary::Fonts[:normal_font][1]
@stats_window = Window_BattleScan.new(@stats_selection.x, y,
@stats_selection.width, height)
@stats_selection.help_window = @stats_window
end
#----------------------------------------------------------------------------
# ○ new method: create_scan_window
#----------------------------------------------------------------------------
def create_info_instructions
@info_instructions = Sprite.new
@info_instructions.visible = false
font = Venka::Bestiary::Battle_Font
@info_instructions.bitmap = Bitmap.new(Graphics.width, font[1])
@info_instructions.bitmap.font.name = font[0]
@info_instructions.bitmap.font.size = font[1]
@info_instructions.bitmap.font.bold = font[2]
@info_instructions.bitmap.font.color = Color.new(*font[3])
@info_instructions.bitmap.font.outline = font[4]
text = Venka::Bestiary::Battle_Instructions
@info_instructions.bitmap.draw_text(0, 0, Graphics.width, font[1], text, 1)
@info_instructions.y = @enemy_window.y - font[1]
end
#----------------------------------------------------------------------------
# ● alias method: select_enemy_selection
#----------------------------------------------------------------------------
alias bestiary_info_enemy_select select_enemy_selection
def select_enemy_selection
@info_instructions.visible = true
bestiary_info_enemy_select
end
#----------------------------------------------------------------------------
# ● alias method: on_enemy_ok
#----------------------------------------------------------------------------
alias bestiary_info_enemy_ok on_enemy_ok
def on_enemy_ok
@info_instructions.visible = false
bestiary_info_enemy_ok
end
#----------------------------------------------------------------------------
# ● alias method: on_enemy_cancel
#----------------------------------------------------------------------------
alias bestiary_info_enemy_cancel on_enemy_cancel
def on_enemy_cancel
@info_instructions.visible = false
bestiary_info_enemy_cancel
end
#----------------------------------------------------------------------------
# ○ new method: show_enemy_info
#----------------------------------------------------------------------------
def show_enemy_info(enemy_id)
@stats_window.show
@stats_selection.enemy_id = enemy_id
@stats_window.enemy_id = enemy_id
@stats_selection.show.activate
@stats_selection.wait_to_close
end
#----------------------------------------------------------------------------
# ● alias method: update
#----------------------------------------------------------------------------
alias show_enemy_info_update update
def update
show_enemy_info_update
if @enemy_window.active && Input.trigger?(Venka::Bestiary::Scan_PopUp)
show_enemy_info(@enemy_window.enemy.enemy_id)
end
end
#----------------------------------------------------------------------------
# ● alias method: item_apply
#----------------------------------------------------------------------------
alias venka_scan_skill_used apply_item_effects
def apply_item_effects(target, item)
if target.is_a?(Game_Enemy)
enemy = $data_enemies[target.enemy_id]
$game_party.reveal_resist(enemy.id, false) if item.scan
attack_element = item.damage.element_id
Venka::Bestiary::Elements.size.times do |i|
if Venka::Bestiary::Elements[i][0] == attack_element
$game_party.bestiary.each do |entry|
entry.elements[i] = true if entry.enemy_id == enemy.shown_id
end
end
end
if item.scan
$game_party.bestiary.each do |entry|
entry.scanned = true if entry.enemy_id == enemy.shown_id
end
show_enemy_info(target.enemy_id)
end
end
venka_scan_skill_used(target, item)
end
#----------------------------------------------------------------------------
# ● alias method: terminate
#----------------------------------------------------------------------------
alias :dispose_instructions_on_term :terminate
def terminate
dispose_instructions_on_term
dispose_instructions
end
#----------------------------------------------------------------------------
# ○ new method: dispose_instructions
#----------------------------------------------------------------------------
def dispose_instructions
return if @info_instructions
@info_instructions.bitmap.dispose
@info_instructions.dispose
@info_instructions = nil
end
end
#==============================================================================
# ■ Scene_Bestiary
#==============================================================================
class Scene_Bestiary < Scene_MenuBase
#----------------------------------------------------------------------------
# ● upgraded method: start
#----------------------------------------------------------------------------
def start
stop_music if Venka::Bestiary::Bestiary_BGM
super
bestiary_music if Venka::Bestiary::Bestiary_BGM
@enemy = nil
create_all_windows
end
#----------------------------------------------------------------------------
# ○ new method: stop_music
#----------------------------------------------------------------------------
def stop_music
@map_bgm = RPG::BGM.last
fadeout_all(60)
end
#----------------------------------------------------------------------------
# ○ new method: bestiary_music
#----------------------------------------------------------------------------
def bestiary_music
RPG::BGM.new(*Venka::Bestiary::Bestiary_BGM).play
end
#----------------------------------------------------------------------------
# ● upgraded method: create_background
#----------------------------------------------------------------------------
def create_background
if Venka::Bestiary::BG_Image
@background_sprite = Sprite.new
@background_sprite.bitmap = Bitmap.new(Graphics.width, Graphics.height)
bitmap = bestiary_bgimage
dest_rect = Rect.new(0, 0, Graphics.width, Graphics.height)
@background_sprite.bitmap.stretch_blt(dest_rect, bitmap, bitmap.rect)
@background_sprite.color.set(16, 16, 16, 128)
else
super
end
end
#----------------------------------------------------------------------------
# ○ new method: bestiary_bgimage
#----------------------------------------------------------------------------
def bestiary_bgimage
file_info = Venka::Bestiary::BG_Image
begin; Cache.title1(file_info)
rescue; Cache.picture(file_info)
end
end
#----------------------------------------------------------------------------
# ○ new method: create_all_windows
#----------------------------------------------------------------------------
def create_all_windows
create_help_window
create_bottom_window
create_category_window
create_bestiary_list
create_enemy_image
create_stats_selection
create_stats_window
create_description_window
create_image_frame if Venka::Bestiary::Frame_Image
end
#----------------------------------------------------------------------------
# ● upgraded method: create_help_window
#----------------------------------------------------------------------------
def create_help_window
@help_window = Window_BestiaryHelp.new(0, 0)
@help_window.viewport = @viewport
@help_window.y = 0
@help_window.set_text(Venka::Bestiary::Category_Select)
end
#----------------------------------------------------------------------------
# ○ new method: create_bottom_window
#----------------------------------------------------------------------------
def create_bottom_window
y = Graphics.height - @help_window.height
@bottom_window = Window_BestiaryHelp.new(0, y)
@bottom_window.draw_completion
end
#----------------------------------------------------------------------------
# ○ new method: create_category_window
#----------------------------------------------------------------------------
def create_category_window
@category_window = Window_BestiaryCategory.new(0, @help_window.height)
@category_window.viewport = @viewport
@category_window.set_handler(:ok, method(:command_list))
@category_window.set_handler(:cancel, method(:return_scene))
end
#----------------------------------------------------------------------------
# ○ new method: command_list
#----------------------------------------------------------------------------
def command_list
@list_window.show.activate
@help_window.set_text(Venka::Bestiary::Enemy_Select)
end
#----------------------------------------------------------------------------
# ○ new method: create_bestiary_list
#----------------------------------------------------------------------------
def create_bestiary_list
@list_window = Window_BestiaryEnemyList.new(@category_window.width,
@help_window.height)
@list_window.viewport = @viewport
@list_window.category_window = @category_window
@list_window.deactivate
@list_window.set_handler(:ok, method(:command_bestiary))
@list_window.set_handler(:cancel, method(:command_category))
end
#----------------------------------------------------------------------------
# ○ new method: command_category
#----------------------------------------------------------------------------
def command_category
@category_window.activate
@help_window.set_text(Venka::Bestiary::Category_Select)
end
#----------------------------------------------------------------------------
# ○ new method: command_bestiary
#----------------------------------------------------------------------------
def command_bestiary
@list_window.hide
@category_window.hide
@stats_selection.show.activate
@stats_window.show
@descript_window.show
@frame_window.show if @frame_window
@enemy_bg.visible = true
update_enemy_info
end
#----------------------------------------------------------------------------
# ○ new method: create_enemy_image
#----------------------------------------------------------------------------
def create_enemy_image
width = (Graphics.width * 0.55).round; height = Graphics.height * 0.55
@enemy_bg = Sprite.new(@viewport)
@enemy_bg.visible = false
@enemy_bg.x = Graphics.width - (Graphics.width * 0.55).round
@enemy_bg.y = @help_window.height
@enemy_bg.bitmap = Bitmap.new(width, height)
end
#----------------------------------------------------------------------------
# ○ new method: create_stats_selection
#----------------------------------------------------------------------------
def create_stats_selection
height = Graphics.height - (@help_window.height * 2)
@stats_selection = Window_BestiaryStatSelection.new(0, @help_window.height,
Graphics.width - @enemy_bg.width, height)
@stats_selection.viewport = @viewport
@stats_selection.set_handler(:pageup, method(:prev_enemy))
@stats_selection.set_handler(:pagedown, method(:next_enemy))
@stats_selection.set_handler(:cancel, method(:to_enemy_list))
end
#----------------------------------------------------------------------------
# ○ new method: create_stats_window
#----------------------------------------------------------------------------
def create_stats_window
y = @stats_selection.y + @stats_selection.item_height
height = @stats_selection.height - @stats_selection.item_height
@stats_window = Window_BestiaryStats.new(0, y, @stats_selection.width, height)
@stats_window.viewport = @viewport
@stats_selection.help_window = @stats_window
@list_window.stats_window = @stats_window
end
#----------------------------------------------------------------------------
# ○ new method: prev_enemy
#----------------------------------------------------------------------------
def prev_enemy
if @list_window.index == 0
@list_window.index = @list_window.item_max - 1
else
@list_window.index -= 1
end
update_enemy_info
@stats_selection.activate
end
#----------------------------------------------------------------------------
# ○ new method: next_enemy
#----------------------------------------------------------------------------
def next_enemy
if @list_window.index == @list_window.item_max - 1
@list_window.index = 0
else
@list_window.index += 1
end
update_enemy_info
@stats_selection.activate
end
#----------------------------------------------------------------------------
# ○ new method: to_enemy_list
#----------------------------------------------------------------------------
def to_enemy_list
@help_window.set_text(Venka::Bestiary::Category_Select)
@bottom_window.draw_completion
@category_window.show
@stats_selection.hide.deactivate
@stats_window.hide
@descript_window.hide
@frame_window.hide if @frame_window
@enemy_bg.visible = false
command_list
end
#----------------------------------------------------------------------------
# ○ new method: create_description_window
#----------------------------------------------------------------------------
def create_description_window
y = (@help_window.height + @enemy_bg.height).to_i
@descript_window = Window_BestiaryHelp.new(@stats_window.width, y)
@descript_window.viewport = @viewport
@descript_window.width = Graphics.width - @stats_window.width
@descript_window.height = Graphics.height - y - @bottom_window.height
@descript_window.hide
end
#----------------------------------------------------------------------------
# ○ new method: create_image_frame
#----------------------------------------------------------------------------
def create_image_frame
@frame_window = Window_Base.new(@enemy_bg.x, @enemy_bg.y, @enemy_bg.width,
@enemy_bg.height)
@frame_window.viewport = @viewport
@frame_window.set_windowskin
@frame_window.back_opacity = 0
@frame_window.hide
end
#----------------------------------------------------------------------------
# ○ new method: update_enemy_info
#----------------------------------------------------------------------------
def update_enemy_info
enemy = $data_enemies[@list_window.current_ext]
@help_window.set_text(enemy.name)
@bottom_window.draw_instructions
@stats_window.enemy_id = @list_window.current_ext
@descript_window.set_description(enemy)
update_enemy_image(enemy)
end
#----------------------------------------------------------------------------
# ○ new method: update_enemy_image
#----------------------------------------------------------------------------
def update_enemy_image(enemy)
@enemy_bg.bitmap.clear
enemy = $data_enemies[@list_window.current_ext]
if floor_image(enemy)
bg_floor = enemy_image(:floor, floor_image(enemy))
draw_image(bg_floor, @enemy_bg.width, @enemy_bg.height)
end
if wall_image(enemy)
bg_wall = enemy_image(:wall, wall_image(enemy))
draw_image(bg_wall, @enemy_bg.width, @enemy_bg.height)
end
enemy = enemy_image(:battler, enemy.battler_name, enemy.battler_hue)
draw_image(enemy, @enemy_bg.width, @enemy_bg.height)
end
#----------------------------------------------------------------------------
# ○ new method: floor_image
#----------------------------------------------------------------------------
def floor_image(enemy)
floor = enemy.bg_floor # Get the enemie's wall image (high priority)
if floor == "" # If it's not set, then get category image
floor = Venka::Bestiary::Category[@category_window.index][:bg_floor]
# If the category image wasn't set, then use the default image
floor = Venka::Bestiary::Default_BGFloor if floor.nil?
end
floor = nil if floor == "" # Set to no image if category was set to ""
return floor
end
#----------------------------------------------------------------------------
# ○ new method: wall_image
#----------------------------------------------------------------------------
def wall_image(enemy)
wall = enemy.bg_wall # Get the enemie's wall image (high priority)
if wall == "" # If it's not set, then get category image
wall = Venka::Bestiary::Category[@category_window.index][:bg_wall]
# If the category image wasn't set, then use the default image
wall = Venka::Bestiary::Default_BGWall if wall.nil?
end
wall = nil if wall == "" # Set to no image if category was set to ""
return wall
end
#----------------------------------------------------------------------------
# ○ new method: enemy_image
#----------------------------------------------------------------------------
def enemy_image(type, file, hue = 0)
begin
case type
when :floor; Cache.battleback1(file)
when :wall; Cache.battleback2(file)
when :battler; Cache.battler(file, hue)
end
rescue; Cache.picture(file)
end
end
#----------------------------------------------------------------------------
# ○ new method: draw_image
#----------------------------------------------------------------------------
def draw_image(bitmap, width, height)
x = (bitmap.width - width) * 0.5
y = (bitmap.height - height) * 0.5
src_rect = Rect.new(x, y, width, height)
@enemy_bg.bitmap.blt(0, 0, bitmap, src_rect)
end
#----------------------------------------------------------------------------
# ● upgraded method: terminate
#----------------------------------------------------------------------------
def terminate
super
dispose_enemy_image
fadeout_all(60)
@map_bgm.replay
end
#----------------------------------------------------------------------------
# ○ new method: dispose_enemy_image
#----------------------------------------------------------------------------
def dispose_enemy_image
return unless @enemy_bg
@enemy_bg.bitmap.dispose if @enemy_bg.bitmap
@enemy_bg.dispose
end
end
0
0
2
New Quest Gaming
Feb 23, 2024
In Modifications
This is a mod to add a switch check to call map
Credit and thanks
Xane
Roninator2
#==============================================================================
# Script : Map Navigation
# Author : Xane
# Build : v1.5
# Created On : 12.17.2020
# Last Update : 12.19.2020
#------------------------------------------------------------------------------
# Terms and Conditions:
# Retain this header at all times and do not release any new revisions online
# without prior consent. You may modify the code below at your own discretion
# but only for private usage. This script may be used both Non Commercially
# and Commercially with credit provided.
#------------------------------------------------------------------------------
# Bugs, Compatibility, and Reporting:
# Report all bugs to me on the RM forums. Any version prior to the current
# version is not supported. All bugs steaming from user changes such as
# modification of code will not be supported. Any compatibility patches
# will be provided at my own accord and are not guaranteed in any way.
#------------------------------------------------------------------------------
# Update Log (U - Unreleased | R - Released):
# 1.0(R) - Wrote original version of script.
# 1.1(U) - Added map effects and sprite viewings back in.
# 1.2(U) - Fixed a few bugs.
# 1.3(R) - Rewrote script to use data already provided by RM rather then
# trying to collect new data. Script will now properly update
# event data, weather effects, and any pictures display originally
# in Scene_Map.
# 1.4(R) - Fixed typo error with variable. Added check for display coordinate
# to check for map edges when maps do not loop.
# 1.5(R) - Fixed some more syntax typos and fixed the check for the display coordinates
# 1.51(U)- Roninator2 edit. Added check for switch to call map
#------------------------------------------------------------------------------
# Usage:
# This script is plug-in-play. If you want to access the scene, use the script
# call "(SceneManager.call(Scene_MapNav)" without quotes in an event or via
# the main menu if you have another script installed that allows custom
# commands such as Yanfly's Menu.
#==============================================================================
#==============================================================================
# ** Xane_MapNavSettings
#------------------------------------------------------------------------------
# This module handles various settings. New versions may add more settings.
#==============================================================================
module Xane_MapNavSettings
# Controls how fast you want to move around the map.
# Use a float point to adjust this setting. The max speed is 1.0
Nav_Speed = 0.4
# Set the text to be displayed on the screen.
# You'll have a max width of 272 pixels to show a string. Consider this
# when choosing what the message will display.
Display_Text = 'Press ESC to return'
# Displays arrows on screen for visual feedback.
# Arrows use a single image stored inside your 'Graphics/System' folder.
# The script will then create copies and map them to the edges of the game
# window. You can also turn off visual feedback if you wish as well as set
# the value for a 'blink' effect if you want more flare.
Use_Nav_Arrows = true
Use_Nav_Blink_Effect = true
Nav_Arrow_Image = 'Nav_Arrow'
# Use button to call map
Map_Button_Switch = 1
Map_Button = :ALT
end
#==============================================================================
# ** Scene_MapNav
#------------------------------------------------------------------------------
# This scene allows the player to have a viewing of the map as well as its
# events across the map by scrolling around.
#==============================================================================
class Scene_MapNav < Scene_MenuBase
#--------------------------------------------------------------------------
# * Included Modules
#--------------------------------------------------------------------------
include Xane_MapNavSettings
#--------------------------------------------------------------------------
# * Start Processing
#--------------------------------------------------------------------------
def start
super
@last_display_x = $game_map.display_x
@last_display_y = $game_map.display_y
@display_x = @last_display_x
@display_y = @last_display_y
@blink_count = 0
@speed = [[Nav_Speed, 1.0].min, 0].max
create_all_sprites
$game_map.refresh
end
#--------------------------------------------------------------------------
# * Create All Sprites
#--------------------------------------------------------------------------
def create_all_sprites
@spriteset = Spriteset_Map.new
@text_display = Sprite.new
@text_display.bitmap = Bitmap.new(272, 48)
@text_display.bitmap.draw_text(@text_display.bitmap.rect, Display_Text, 1)
return unless Use_Nav_Arrows
@nav_arrows = Sprite.new
@nav_arrows.bitmap = Cache.system(Nav_Arrow_Image)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
$game_map.update
update_navigation
update_all_sprites
if Input.trigger?(:B) or Input.trigger?(:C)
SceneManager.return
end
end
#--------------------------------------------------------------------------
# * Update Navigation
#--------------------------------------------------------------------------
def update_navigation
@display_x -= @speed if Input.press?(:LEFT) && !Input.press?(:RIGHT)
@display_x += @speed if Input.press?(:RIGHT) && !Input.press?(:LEFT)
@display_y -= @speed if Input.press?(:UP) && !Input.press?(:DOWN)
@display_y += @speed if Input.press?(:DOWN) && !Input.press?(:UP)
@display_x = [0, [@display_x, $game_map.width - $game_map.screen_tile_x].min].max unless $game_map.loop_horizontal?
@display_y = [0, [@display_y, $game_map.height - $game_map.screen_tile_y].min].max unless $game_map.loop_vertical?
$game_map.set_display_pos(@display_x, @display_y)
end
#--------------------------------------------------------------------------
# * Update Sprites
#--------------------------------------------------------------------------
def update_all_sprites
@spriteset.update
@text_display.update
return unless Use_Nav_Arrows
@nav_arrows.update
return unless Use_Nav_Blink_Effect
@blink_count = (@blink_count + 1) % 40
@nav_arrows.opacity = 255 if @blink_count < 20
@nav_arrows.opacity = 0 if @blink_count >= 20
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
super
dispose_all_sprites
$game_map.set_display_pos(@last_display_x, @last_display_y)
dispose_variables
end
#--------------------------------------------------------------------------
# * Dispose All Sprites
#--------------------------------------------------------------------------
def dispose_all_sprites
@spriteset.dispose
@text_display.bitmap.dispose unless @text_display.bitmap.disposed?
@text_display.dispose
return unless Use_Nav_Arrows
@nav_arrows.bitmap.dispose unless @nav_arrows.bitmap.disposed?
@nav_arrows.dispose
end
#--------------------------------------------------------------------------
# * Dispose Variables * Good Coding Practice *
# Any @ variable is always stored in ram. This will free it.
#--------------------------------------------------------------------------
def dispose_variables
@last_display_x = nil
@last_display_y = nil
@display_x = nil
@display_y = nil
@blink_count = nil
@speed = nil
@spriteset = nil
@text_display = nil
@nav_arrows = nil
end
end
class Scene_Map < Scene_Base
alias test_update update
def update
test_update
if Xane_MapNavSettings::Map_Button_Switch == true
if Input.trigger?(Xane_MapNavSettings::Map_Button)
SceneManager.call(Scene_MapNav)
end
end
end
end
0
0
1
New Quest Gaming
Feb 23, 2024
In Modifications
This is a mod to improve the script function
Credit and Thanks
Yato (Rachael)
Leonardo Ark
Roninator2
# -*- coding: utf-8 -*-
#==============================================================================
# Window Message Pause Icon
# Created: 11/11/2013 by Yato (Racheal)
# Updated: 27/06/2018 by Leonardo Ark (ArkDG)
# Modded: 25/06/2019 by roninator2
# Instructions:
# * Insert in the Materials section
# * Configure to your liking below
#==============================================================================
# Compatibility:
# This script is for RPG Maker VX Ace
#==============================================================================
=begin
Originally designed by Yato(Racheal) and modified by me (Leonardo Ark)
Release Date: 06/27/2018
Yato's profile at RPGMakerWeb.com: https://forums.rpgmakerweb.com/index.php?members/yato.587/
PLEASE, Credit her in your game, not me.
Set the variable you wish to use for the position and the variable name.
Change the icon by changing the variable. Must be in quotes
Terms of Use
* Contact Yato for commercial use
* No real support. The script is provided as-is
* No bug fixes, no compatibility patches
* Preserve this header
=end
class Window_Message < Window_Base
####### CUSTOMIZATION HERE #######
@@sprite_name = "pauseicon" #should be in /Graphics/System - Must be in quotes "pauseicon"
@@sprite_var = 11 #variable used to change the graphic file
@@sprite_cell_width = 16 #the original is 16, but you can make a img with any cell size
@@sprite_cell_height = 16 #the original is 16, but you can make a img with any cell size
@@pause_pos_x = 12 #start at right corner of the screen. The higher the number, more to the left
@@pause_pos_y = 4 #start at bottom of the screen. The higher the number, more to the top
@@pause_var = 10 #variable to set position. 0 = right, 1 = center, 2 = left
#### END OF THE CUSTOMIZATION ####
@@sprite_pause = nil
#--------------------------------------------------------------------------
# * Initialize
#--------------------------------------------------------------------------
alias move_pause_graphic_initialize initialize
def initialize
if $game_variables[@@sprite_var] != @@sprite_pause
$game_variables[@@sprite_var] = @@sprite_name
@@sprite_pause = @@sprite_name
end
move_pause_graphic_initialize
make_pause_sprite
end
#--------------------------------------------------------------------------
# * Free
#--------------------------------------------------------------------------
alias move_pause_graphic_dispose dispose
def dispose
move_pause_graphic_dispose
@pause_sprite.dispose
end
#--------------------------------------------------------------------------
# * Make Pause Sprite
#--------------------------------------------------------------------------
def make_pause_sprite
@pause_sprite = Sprite.new
@pause_sprite.bitmap = Cache.system(@@sprite_pause)
@pause_sprite.src_rect = Rect.new(0, 0, @@sprite_cell_width, @@sprite_cell_height)
@pause_sprite.z = self.z + 10
@pause_sprite.visible = false
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
alias move_pause_graphic_update update
def update
if $game_variables[@@sprite_var] != @@sprite_pause
@@sprite_pause = $game_variables[@@sprite_var]
@pause_sprite.dispose
make_pause_sprite
end
move_pause_graphic_update
update_pause_sprite if @pause_sprite.visible
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update_pause_sprite
frame = Graphics.frame_count % 60 / 15
@pause_sprite.src_rect.x = 0 + @@sprite_cell_width * (frame % 2)
@pause_sprite.src_rect.y = 0 + @@sprite_cell_height * (frame / 2)
end
#--------------------------------------------------------------------------
# * Set Pause
#--------------------------------------------------------------------------
def pause=(pause)
if $game_variables[@@pause_var] == 0
@pause_sprite.x = self.x + self.width - padding - @@pause_pos_x
@pause_sprite.y = self.y + self.height - padding - @@pause_pos_y
@pause_sprite.visible = pause
elsif $game_variables[@@pause_var] == 1
@pause_sprite.x = Graphics.width / 2
@pause_sprite.y = self.y + self.height - padding - @@pause_pos_y
@pause_sprite.visible = pause
else
@pause_sprite.y = self.y + self.height - padding - @@pause_pos_y
@pause_sprite.visible = pause
end
end
end
0
0
2
New Quest Gaming
Feb 23, 2024
In Modifications
This mod changes how the states are displayed by removing the number
Credit and Thanks
Grilled Paste
Roninator2
=begin
#==============================================================================
[Name] Display of remaining turns of state + α
[Author] Grilled paste
[Distributor] Relaxing Maker miscellaneous goods
http://mata-tuku.ldblog.jp/
# ------------------------------------------------- -----------------------------
[Change log]・2012/10/28 public
・2012/12/01 Bug fixes. Added "Hide state icon with display priority 0" function
Modified by Roninator2 to change icon and not show number
#==============================================================================
#------------------------------------------------------------------------------
[Correspondence]
・ Only RGSS3 is possible
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
[function]
-Only during battle, the number of remaining turns of state and ability change
is displayed on the icon.
-Hide the icon of the state where the display priority is 0.
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
[how to use]
-There is no special operation. Just install this script and it will work.
#------------------------------------------------------------------------------
[Redefined part]
・Window_Base の draw_actor_icons
#------------------------------------------------------------------------------
[○: New definition, ◎: Alias definition, ●: Redefinition]
#------------------------------------------------------------------------------
=end
module R2_State_Icon_Turns
Switch = 3 # switch used to change behavior from icon change to numbers.
# set to zero to disable.
# icon change is set to the number below
Added = 2
# the number is how many extra icons to use
# default = 3, Added = 3, inflicted = icon 5
end
#==============================================================================
# ■ Game_BattlerBase
#==============================================================================
class Game_BattlerBase
#--------------------------------------------------------------------------
# ◎ Get the current state as an array of icon numbers
#--------------------------------------------------------------------------
alias yknr_ShowStatesTurnsGame_BattlerBase_state_icons :state_icons
def state_icons
states = self.states.select {|state| !state.priority.zero? }
yknr_ShowStatesTurnsGame_BattlerBase_state_icons
end
#--------------------------------------------------------------------------
# ○ Get the current state as an array of the number of remaining turns
#--------------------------------------------------------------------------
def state_turns
turns = []
states.each do |s|
if !s.icon_index.zero?
is_turn = !s.auto_removal_timing.zero? && !s.priority.zero?
turn = is_turn ? @state_turns[s.id].truncate : -1
turns.push(turn)
end
end
turns
end
#--------------------------------------------------------------------------
# ○ Get the current enhancement /
# weakness in an array of the number of remaining turns
#--------------------------------------------------------------------------
def buff_turns
turns = []
@buffs.each_with_index do |lv, i|
turns.push(@buff_turns[i].truncate) if !lv.zero?
end
turns
end
end
#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# ● Draw state and enhancement / weakness icons
#--------------------------------------------------------------------------
def draw_actor_icons(actor, x, y, width = 96)
last_font = contents.font.clone
contents.font.size = 19
contents.font.bold = true
contents.font.color = crisis_color
icons = []
turns = []
icons = (actor.state_icons + actor.buff_icons)[0, width / 24]
if $game_switches[R2_State_Icon_Turns::Switch] == true
turns = actor.state_turns[0, width / 24]
turns.each_with_index do |n, i| # turns, array index
if n >= R2_State_Icon_Turns::Added
turns[i] = R2_State_Icon_Turns::Added
end
end
icons.each_with_index do |n, i| # icon, array index
draw_icon(n + turns[i], x + 24 * i, y)
end
else
turns = (actor.state_turns + actor.buff_turns)[0, width / 24]
icons.each_with_index do |n, i|
draw_icon(n, x + 24 * i, y)
if $game_party.in_battle && turns[i] != -1
draw_text(x + 24 * i, y, 24, line_height, turns[i] + 1, 2)
end
end
end
contents.font = last_font
end
end
0
0
1
New Quest Gaming
Feb 23, 2024
In Modifications
This mod removes global switches from the script and cleans up the processes
Credit and Thanks
Triacular
Roninator2
Caracrazy_petrassi
#==============================================================================
#
# ▼ Triacular - Steal Shop v1.06
# -- Last Updated: 2019.03.13
# -- Level: Easy, Normal
# -- Requires: n/a
#
#==============================================================================
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script allows stealing of items in scene shop, made for RPG Maker VX Ace.
#
# Please give credit to Triacular
# free for non-commercial and commercial uses
#==============================================================================
($imported ||= {})[:Triacular_ShopSteal] = 1.06
#==============================================================================
# ▼ Versions Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2019-01-26 - Initial script - Triacular
# 2019-01-27 - Reduced duplicate parts - Triacular
# 2019-02-12 - Added switch to disable script - Triacular
# 2019-02-13 - Added alias, removed global switches - Roninator2
# 2019-03-03 - Changed to not show the number window - Roninator2
# 2019-03-13 - Several Changes. Listed below - CaRaCrAzY_Petrassi
# ▼ [Compatibility]
# Moved all classes inside a namespace module
# Changed the use of Aliasing to Method Wrapping
# Added a component module for wrapping extension objects
# Moved all Scene_Shop's new methods to an extension class
# Added version data to $imported global variable
# ▼ [Convenience]
# Moved constants to the module root
# Transformed the DICE constant into VARIABLE_STEAL_BONUS
# ▼ [Features]
# Displays the Stealing Success rate insteand of item's price.
# Added a constant for controling the [steal] command's position in the list
# Added a switch to enable or disable steal command mid-game
# Added a constant for inputing a formula for General Stealing Success Rate
# Entries in the shop that has zero percent chance of stealing are disabled
# Added notetag support for editing Custom Stealing Success Rate formulas
#==============================================================================
#==============================================================================
# ▼ Notetags
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script support the following notetags:
#
#-------------------------------------------------------------------------------
# <steal: x>
#-------------------------------------------------------------------------------
# This will add a custom calculation method for a particular item. This
# means that the default Success Rate formula will be replaced for this one.
# x : formula
#
# Considerations about the Formula:
# The formula is an actual piece of code that will be evaluated, its final
# output must be a number between zero and one that will be converted into a
# percentage; and these are the following values that will be passed to it:
# a : Game Party (Same thing as $game_party)
# b : item (The item itself)
# p : item's price (converted to float, used for calculating divisions)
#
# Examples:
# <steal: a.agi / p>
# <steal: 0.5>
# <steal: a.agi / (a.agi + p / 10.0)>
#==============================================================================
#===============================================================================
# ** TRIACULAR
#-------------------------------------------------------------------------------
# Module used for namespacing the Shop Steal System
# Everything about this system is contained inside this module.
#===============================================================================
module TRIACULAR
#-----------------------------------------------------------------------------
# * ID of the Switch that enables the script
#-----------------------------------------------------------------------------
SWITCH_ENABLE = 22
#-----------------------------------------------------------------------------
# * ID of the Switch that will become ON when stealing fails
#-----------------------------------------------------------------------------
SWITCH_STEAL = 21
#-----------------------------------------------------------------------------
# * ID of the Switch that enable/disable the shop's [Steal] command at runtime
#-----------------------------------------------------------------------------
SWITCH_COMMAND = 23
#-----------------------------------------------------------------------------
# * ID of the Variable responsible for giving a percent bonus to steal chance
#-----------------------------------------------------------------------------
VARIABLE_STEAL_BONUS = 20
#-----------------------------------------------------------------------------
# * [Steal] command's name in the Shop's command list
#-----------------------------------------------------------------------------
VOCAB_STEAL = "Steal"
#-----------------------------------------------------------------------------
# * Steal command's position at Shop's command list
# Useful if you want the [Steal] command to appear between [Buy] or [Sell]
#-----------------------------------------------------------------------------
COMMAND_POSITION = 2
#-----------------------------------------------------------------------------
# * Dynamically increases the number of columns in Shop's command list to fit
# the [Steal] command entry.
#-----------------------------------------------------------------------------
DYNAMIC_COL_COUNT = true
#-----------------------------------------------------------------------------
# * General Stealing Success Rate formula usef for all items lacking a Custom
# Stealing Formula notetag.
#-----------------------------------------------------------------------------
# a : Game Party (Same thing as $game_party)
# b : item
# p : item's price (converted to float, used for calculating divisions)
#-----------------------------------------------------------------------------
STEAL_FORMULA = "a.agi / p"
#-----------------------------------------------------------------------------
# * Maximum Stealing Rate chance
#-----------------------------------------------------------------------------
STEAL_RATE_CAP = 0.9
#=============================================================================
# ** Component
#-----------------------------------------------------------------------------
# Component used to avoid poluting the engine classes with new methods.
#=============================================================================
module Component
#---------------------------------------------------------------------------
# * Forwards calls from a class public interface through an attribute
#---------------------------------------------------------------------------
# Public instance method calls from a given class are forwarded to the
# given attribute.
#
# By design, method calls from super classes are not forwarded. You
# should explicitly invoke this command again for each super class you
# need its calls forwarded.
#---------------------------------------------------------------------------
def forward(klass, attribute)
klass.public_instance_methods(false).each do |meth|
define_method(meth) { |*args| self.send(attribute).send(meth, *args) }
end
end
#---------------------------------------------------------------------------
# * Adds itself as a component attribute into a compositor class
#---------------------------------------------------------------------------
# This command is equivalent to reopenning a class definition and adding
# a getter for lazily loading and retrieving a component's instance.
#
# That means every instance of a composite class will wrap a lazy loaded
# component instance through an automatically generated attribute.
#---------------------------------------------------------------------------
def compose(composite, attr_name)
component = self
body = eval("proc { @#{attr_name} ||= component.new(self) }")
composite.send(:define_method, attr_name) { instance_eval(&body) }
end
#---------------------------------------------------------------------------
# * Generates attribute readers for getting forwarded instance variables
#---------------------------------------------------------------------------
# This method really breaks incapsulation. Use it only when dealing with
# compositors that lack attr_readers.
#---------------------------------------------------------------------------
def forward_reader(compositor, *args)
args.each do |variable|
define_method(variable) do
self.send(compositor).instance_variable_get("@#{variable}".to_sym)
end
end
end
end
#==============================================================================
# ** Window_ShopCommand
#------------------------------------------------------------------------------
# Wraping and redefining methods inside Window_ShopCommand class
#==============================================================================
class ::Window_ShopCommand
#---------------------------------------------------------------------------
# * Wraping Methods for redefinition
#---------------------------------------------------------------------------
old_make_command_list = instance_method :make_command_list
old_col_max = instance_method :col_max
#---------------------------------------------------------------------------
# * Redefining method
#---------------------------------------------------------------------------
# Updates the shining command effect
#---------------------------------------------------------------------------
define_method :make_command_list do |*args|
expectations = old_make_command_list.bind(self).(*args)
return expectations unless $game_switches[SWITCH_ENABLE]
command = {
name: VOCAB_STEAL,
symbol: :steal,
enabled: $game_switches[SWITCH_COMMAND],
}
@list.insert([[COMMAND_POSITION, 0].max, @list.size].min, command)
expectations
end
#--------------------------------------------------------------------------
# * Get Digit Count
#--------------------------------------------------------------------------
define_method :col_max do |*args|
old_col_max.bind(self).(*args) + ($game_switches[SWITCH_ENABLE] ? 1 : 0)
end if DYNAMIC_COL_COUNT
end
#=============================================================================
# ** Scene_Shop
#-----------------------------------------------------------------------------
# Wraping and redefining methods inside Scene_Shop class
#=============================================================================
class ::Scene_Shop
#---------------------------------------------------------------------------
# * Wraping Methods for redefinition
#---------------------------------------------------------------------------
old_start = instance_method :start
old_create_command_window = instance_method :create_command_window
#---------------------------------------------------------------------------
# * Redefining method
#---------------------------------------------------------------------------
# Adding Steal Window creation to scene Start
#---------------------------------------------------------------------------
define_method :start do |*args|
expectations = old_start.bind(self).(*args)
wy = @dummy_window.y
wh = @dummy_window.height
@steal_window = Window_ShopSteal.new(0, wy, wh, @goods)
triacular_shopsteal.create_steal_window
expectations
end
#---------------------------------------------------------------------------
# * Redefining method
#---------------------------------------------------------------------------
# * Adding :steal handler to command window
#---------------------------------------------------------------------------
define_method :create_command_window do |*args|
expectations = old_create_command_window.bind(self).(*args)
meth = triacular_shopsteal.method(:command_steal)
@command_window.set_handler(:steal, meth)
expectations
end
end
#=============================================================================
# ** Stealable_Item
#-----------------------------------------------------------------------------
# Class containing steal data to be inserted into RPG::BaseItem
# Used almost exclusively to extract notetags about stealing.
#=============================================================================
class Stealable_Item
#---------------------------------------------------------------------------
# * Macros
#---------------------------------------------------------------------------
extend Component
compose RPG::BaseItem, :triacular_shopsteal
forward RPG::BaseItem, :item
#---------------------------------------------------------------------------
# * Public instance attributes
#---------------------------------------------------------------------------
attr_reader :item # BaseItem wrapping this object
#---------------------------------------------------------------------------
# * Object Initialization
#---------------------------------------------------------------------------
def initialize(item)
@item = item
end
#-------------------------------------------------------------------------
# * Calculates the chances of stealing this item
#-------------------------------------------------------------------------
def rate
rate = steal_rate_formula.($game_party, item, item.price.to_f)
rate += $game_variables[VARIABLE_STEAL_BONUS] / 100.0
[[rate, 0].max, STEAL_RATE_CAP].min
end
private
#---------------------------------------------------------------------------
# * Formula for calculating the chances of stealing this item from a shop
#---------------------------------------------------------------------------
def steal_rate_formula
@steal_rate_formula ||= retrieve_steal_rate_data
end
#---------------------------------------------------------------------------
# * Steal Rate formula from a retrieved notetag
#---------------------------------------------------------------------------
def retrieve_steal_rate_data
if match_data = steal_rate_tag
eval("lambda {|a, b, p| #{match_data[:value]} }")
else
Steal.default_rate
end
end
#---------------------------------------------------------------------------
# * Match_data from all matches of <steal: formula>
#---------------------------------------------------------------------------
def steal_rate_tag
Notetag.scan_tags(note, :steal, :single).first
end
end
#=============================================================================
# ** Window_ShopSteal
#-----------------------------------------------------------------------------
# This window displays a list of steal goods on the shop screen.
#=============================================================================
class Window_ShopSteal < Window_Selectable
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :status_window # Status window
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(x, y, height, shop_goods)
super(x, y, window_width, height)
@shop_goods = shop_goods
refresh
select(0)
end
#--------------------------------------------------------------------------
# * Get Window Width
#--------------------------------------------------------------------------
def window_width
return 304
end
#--------------------------------------------------------------------------
# * Get Number of Items
#--------------------------------------------------------------------------
def item_max
@data ? @data.size : 1
end
#--------------------------------------------------------------------------
# * Get Item
#--------------------------------------------------------------------------
def item
@data[index]
end
#--------------------------------------------------------------------------
# * Get Activation State of Selection Item
#--------------------------------------------------------------------------
def current_item_enabled?
enable?(@data[index])
end
#--------------------------------------------------------------------------
# * Get Price of Item
#--------------------------------------------------------------------------
def price(item)
@price[item]
end
#--------------------------------------------------------------------------
# * Display in Enabled State?
#--------------------------------------------------------------------------
def enable?(item)
item && price(item) > 0 && !$game_party.item_max?(item)
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
make_item_list
create_contents
draw_all_items
end
#--------------------------------------------------------------------------
# * Create Item List
#--------------------------------------------------------------------------
def make_item_list
containers = [$data_items, $data_weapons, $data_armors]
@data = @shop_goods.map { |goods| item = containers[goods[0]][goods[1]] }
@price = Hash[@data.map { |item| [item, item.triacular_shopsteal.rate] }]
end
#--------------------------------------------------------------------------
# * Draw Item
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
rect = item_rect(index)
draw_item_name(item, rect.x, rect.y, enable?(item))
rect.width -= 4
draw_text(rect, "#{(price(item) * 100).to_i}%", 2)
end
#--------------------------------------------------------------------------
# * Set Status Window
#--------------------------------------------------------------------------
def status_window=(status_window)
@status_window = status_window
call_update_help
end
#--------------------------------------------------------------------------
# * Update Help Text
#--------------------------------------------------------------------------
def update_help
@help_window.set_item(item) if @help_window
@status_window.item = item if @status_window
end
end
#=============================================================================
# ** Steal
#-----------------------------------------------------------------------------
# Class containing additional data to be inserted into Scene_Shop
#=============================================================================
module Steal
#-------------------------------------------------------------------------
# * Default Stealing Success formula defined at the start of the script.
# This formula is used for items lacking a <steal:formula> Notetag.
#-------------------------------------------------------------------------
def self.default_rate
@default_rate ||= eval("lambda {|a, b, p| #{STEAL_FORMULA} }")
end
end
#=============================================================================
# ** Scene_ShopSteal
#-----------------------------------------------------------------------------
# Class containing additional data to be inserted into Scene_Shop
#=============================================================================
class Scene_ShopSteal
#---------------------------------------------------------------------------
# * Macros
#---------------------------------------------------------------------------
extend Component
compose Scene_Shop , :triacular_shopsteal
forward Scene_Shop , :scene
forward Scene_MenuBase, :scene
forward Scene_Base , :scene
#--------------------------------------------------------------------------
# * Public Instance Attributes
#--------------------------------------------------------------------------
forward_reader :scene, :command_window, :help_window, :dummy_window
forward_reader :scene, :status_window , :goods , :viewport
forward_reader :scene, :steal_window
#---------------------------------------------------------------------------
# * Public instance attributes
#---------------------------------------------------------------------------
attr_reader :scene # Scene wraping this object. The compositor.
#---------------------------------------------------------------------------
# * Object Initialization
#---------------------------------------------------------------------------
def initialize(scene)
@scene = scene
end
#--------------------------------------------------------------------------
# * Create Steal Window
#--------------------------------------------------------------------------
def create_steal_window
steal_window.viewport = viewport
steal_window.help_window = help_window
steal_window.status_window = status_window
steal_window.hide
steal_window.set_handler(:ok, method(:on_steal_ok))
steal_window.set_handler(:cancel, method(:on_steal_cancel))
end
#--------------------------------------------------------------------------
# * The current selected item
#--------------------------------------------------------------------------
def item
steal_window.item
end
#--------------------------------------------------------------------------
# * [Steal] Command
#--------------------------------------------------------------------------
def command_steal
dummy_window.hide
activate_steal_window
end
#--------------------------------------------------------------------------
# * Category Steal [Cancel]
#--------------------------------------------------------------------------
def on_steal_cancel
command_window.activate
dummy_window.show
steal_window.hide
status_window.hide
status_window.item = nil
help_window.clear
end
#--------------------------------------------------------------------------
# * Category Steal [OK]
#--------------------------------------------------------------------------
def on_steal_ok
do_steal(1)
end
#--------------------------------------------------------------------------
# * Quantity Input [OK]
#--------------------------------------------------------------------------
def activate_steal_window
steal_window.show.activate
status_window.show
end
#--------------------------------------------------------------------------
# * Execute Steal
#--------------------------------------------------------------------------
def do_steal(number)
if rand <= item.triacular_shopsteal.rate
$game_party.gain_item(item, number)
activate_steal_window
else
$game_switches[SWITCH_STEAL] = true
SceneManager.goto(Scene_Map)
end
end
end
#=============================================================================
# ** Notetag
#-----------------------------------------------------------------------------
# Module for extrating Notetags
#=============================================================================
module Notetag
class << self
#-------------------------------------------------------------------------
# * Extracts notetag data matching the given pattern type
#-------------------------------------------------------------------------
# note : The note field or string
# tag : The tag's name i.e. :Expertise will search for <Expertise>
# type : The notetag's pattern (:plain, :single or :pair)
#-------------------------------------------------------------------------
def scan_tags(note, tag, type)
note.to_enum(:scan, pattern(tag, type)).map { Regexp.last_match }
end
private
#-------------------------------------------------------------------------
# * Return a regex for the given pattern to match the given tag_name
#-------------------------------------------------------------------------
def pattern(tag, type)
method(type).(tag)
end
#-------------------------------------------------------------------------
# * Regex for retrieving a notetag containing only one value
# base format: <tag_name> or <tag_name:opt>
#-------------------------------------------------------------------------
def plain(tag_name)
%r{
(?: <\s*#{tag_name}\s*) # < tag_name the tag name
(?: :\s*(?<opt> .+?))? # : optional the optional value
(?: \s*\/?>) # /> the tag closing
}ix
end
#-------------------------------------------------------------------------
# * Regex for retrieving a notetag containing only one value
# base format: <tag_name:value> or <tag_name:value,opt>
#-------------------------------------------------------------------------
def single(tag_name)
%r{
(?: <\s*#{tag_name}\s*) # < tag_name the tag name
(?: :\s*(?<value>.+?)) # : value the second value
(?: ,\s*(?<opt> .+?))? # , optional the optional value
(?: \s*\/?>) # /> the tag closing
}ix
end
#-------------------------------------------------------------------------
# * Regex for retrieving a notetag containing two values
# base format: <tag_name:key,value> or <tag_name:key,value,opt>
#-------------------------------------------------------------------------
def pair(tag_name)
%r{
(?: <\s*#{tag_name}\s*) # < tag_name the tag name
(?: :\s*(?<key> .+?)) # : key the first value
(?: ,\s*(?<value>.+?)) # , value the second value
(?: ,\s*(?<opt> .+?))? # , optional the optional value
(?: \s*\/?>) # /> the tag closing
}ix
end
end
end
end
0
0
1
New Quest Gaming
Feb 23, 2024
In Modifications
This mod fixes some bugs in the original script
Credit and Thanks
TG22
Roninator2
#===============================================================================#
#
# Better Critical Chance
# Custom Script File by TG22
# Mod by Roninator2
# This script creates skill notetags to give the developper a better control
# of skills' critical chance
#-------------------------------------------------------------------------------#
# Status : v0 : Just implemented, needs alpha testing.
#-------------------------------------------------------------------------------#
#
# Usage : In the skill notes you can add :
#
# <critical chance: = 10>
# This notetag will override the battler crit chance (but not the "can-crit?"
# flag of the skill). In this example, if the skill can crit, the chance is
# 10%, whoever uses it. Only the target CEV can modify it.
# Set the value to zero and the skill will not be able to crit.
# The entered value must be an integer!
#
# <critical chance: + 5>
# <critical chance: - 5>
# Unless overriden by an "=" notetag, this skill will have an additional chance
# to have a critical effect. In this example, if the user has 4% cri, the
# resulting crit chance will be 4+5 = 9% or 9-5 = 4%
# Note: the target's cev is applied to the final value (9%)
# The entered value must be an integer!
#
# <critical chance: x 110>
# Unless overriden by an "=" notetag, this skill will have a multiplied chance
# to have a critical effect. In this example, if the user has 4% cri, the
# resulting critical chance will be 4 * 1.10 = 4.4%
# Note: the target's cev is applied to the final value (4.4%)
# Note: Can be used to increase or decrease (<100%) crit chance.
# The entered value must be an integer!
#
# Stacking :
# <critical chance: x 110>
# <critical chance: + 5>
# If these two tags are used, and unless they are overriden by the "=" notetag,
# if the battler has a base 4% cri, the resulting crit chance will be :
# (4 + 5) * 1.10 = 9.9% chance. The multiply tag is applied after the
# additive one.
# Note: the target's cev is applied to the final value (9.9%)
#
#-------------------------------------------------------------------------------#
# Compatibility :
# Warning : the method
# -Game_Battler > item_cri
# is erased.
#-------------------------------------------------------------------------------#
# Configuration
#===============================================================================#
module TGTT
module BETTERCRITCHANCE
REGEXP_CRITCHANCE = /<critical[ -_]chance:[ -_](.)[ -_](\d+)>/i
end
end
#===============================================================================#
# End of Configuration
#-------------------------------------------------------------------------------#
# Erasing the crit chance computation
#===============================================================================#
class Game_Battler < Game_BattlerBase
def item_cri(user, item)
#Zero crit chance if the critical flag is not set.
return 0 unless item.damage.critical
#Base user crit chance
base_cri = user.cri
#Apply additional notetag
if item.critchance_additional != 0.0
base_cri += item.critchance_additional
end
#Apply subtractive notetag
if item.critchance_subtractive != 0.0
base_cri -= item.critchance_subtractive
base_cri = 0 if base_cri < 0
end
#Apply multiplicative notetag
if item.critchance_multiplier != 1.0
base_cri *= item.critchance_multiplier
end
#Apply overriding notetag, if present
if !item.critchance_override.nil?
base_cri = item.critchance_override
end
#Applying CEV to the final value.
return base_cri * (1.0 - cev)
end
end
#===============================================================================#
# Notetag management
#===============================================================================#
module DataManager
#Aliasing the module "static" method
class << self
alias hrpg_betcc_load_database load_database
end
def self.load_database
hrpg_betcc_load_database
hrpg_betcc_load_notetags
end
def self.hrpg_betcc_load_notetags
for sk in $data_skills
next if sk.nil?
sk.hrpg_betcc_load_notetags
end
end
end
class RPG::BaseItem
attr_accessor :critchance_additional
attr_accessor :critchance_subtractive
attr_accessor :critchance_multiplier
attr_accessor :critchance_override
def hrpg_betcc_load_notetags
#Default values.
@critchance_additional = 0.0
@critchance_subtractive = 0.0
@critchance_multiplier = 1.0
@critchance_override = nil #nil means not present. Do not change that.
self.note.split(/[\r\n]+/).each do |line|
case line
when TGTT::BETTERCRITCHANCE::REGEXP_CRITCHANCE
case $1
when '+'
@critchance_additional = $2.to_i * 0.01
when '-'
@critchance_subtractive = $2.to_i * 0.01
when 'x'
@critchance_multiplier = $2.to_i * 0.01
when '='
@critchance_override = $2.to_i * 0.01
end
end
end
end
end
0
0
5
New Quest Gaming
Feb 23, 2024
In Modifications
This mod does something more than the original, I can't remember what
Credit and Thanks
Tenseiten
Roninator2
#===============================================================================
# * Vehicle Additions
# Version 0.41b
#-------------------------------------------------------------------------------
# * Authored by: tenseiten/seitensei
# * With help from: shaz
# * Updated by Roninator2
#===============================================================================
#===============================================================================
# * Change log
#-------------------------------------------------------------------------------
=begin
0.41b - 2020-12-10 18:05 CST
- added switches to turn feature on or off
0.4b - 2020-12-10 18:00 CST
- Added support for ship interior
0.35b - 2011-12-27 1:19 JST
- Replaced cloned methods with alias to fix possible compatibility issues.
This script should be placed below any other that modified the default
vehicle behavior.
0.35a - 2011-12-22, 19:16 JST
- Fixed Boat and Ship not being passed through
0.30a - 2011-12-21, 19:20 JST
- First Public Release
- Fixed Teleport on Unlandable Spaces
0.20a - Internal Version
0.10a - Internal Version
0.00a - Internal Version
=end
#===============================================================================
#===============================================================================
=begin
.:Introduction:.
This Vehicle Additions script adds the ability to access an additional map as
the interior of the vehicle. So far, only the airship has been implemented. This
script overwrites the get_on_vehicle and the get_off_vehicle methods, so it is
not compatible with anything that edits those. However, since it uses a the
default code when the system is not enabled for a vehicle, created a patch to
solve incompatibilities is not within the real of impossibility.
.:Instruction:.
Set the map ID and X/Y coordinates of for the map that will serve as the
interior of the vehicle. Create an event that brings the player back to the
overmap and forces them to pilot the vehicle by by creating and event that
calls the following code:
$game_player.pilot_vehicle
To exit the vehicle's interior, and return to the overmap (on foot), call
the following:
$game_player.exit_vehicle
=end
#===============================================================================
#-------------------------------------------------------------------------------
# * Config Section
#-------------------------------------------------------------------------------
module Tenseiten
module Vehicle
AIRSHIP_ENABLED = 2 # switch # Whether or not we want to invoke additions
AIRSHIP_MAP = 3 # interior map id
AIRSHIP_MAP_X = 10 # interior x
AIRSHIP_MAP_Y = 10 # interior y
SHIP_ENABLED = 3 # switch # Whether or not we want to invoke additions
SHIP_MAP = 4 # interior map id
SHIP_MAP_X = 10 # interior x
SHIP_MAP_Y = 10 # interior y
end
end
#-------------------------------------------------------------------------------
# * Config End
#-------------------------------------------------------------------------------
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# * Get on Vehicle (From Overmap)
# Intercept the player, and send them inside.
#--------------------------------------------------------------------------
alias control_vehicle get_on_vehicle
def get_on_vehicle
front_x = $game_map.round_x_with_direction(@x, @direction)
front_y = $game_map.round_y_with_direction(@y, @direction)
# check if player is allowed to get onto the airship
if $game_map.airship.pos?(@x, @y)
if $game_switches[Tenseiten::Vehicle::AIRSHIP_ENABLED] == true
#Save world map information
@player_w_map = $game_map.map_id
@player_w_x = @x
@player_w_y = @y
@used_vehicle = :airship
#Now Teleport to the map set in config
reserve_transfer(Tenseiten::Vehicle::AIRSHIP_MAP, Tenseiten::Vehicle::AIRSHIP_MAP_X, Tenseiten::Vehicle::AIRSHIP_MAP_Y, @direction) # transfer to new map
else
#Continue to normal function when not enabled
@vehicle_type = :airship
control_vehicle
end
end
if $game_map.boat.pos?(front_x, front_y)
@vehicle_type = :boat
control_vehicle
end
if $game_map.ship.pos?(front_x, front_y)
if $game_switches[Tenseiten::Vehicle::SHIP_ENABLED] == true
#Save world map information
@player_w_map = $game_map.map_id
@player_w_x = @x
@player_w_y = @y
@player_w_d = @direction
@used_vehicle = :ship
#Now Teleport to the map set in config
reserve_transfer(Tenseiten::Vehicle::SHIP_MAP, Tenseiten::Vehicle::SHIP_MAP_X, Tenseiten::Vehicle::SHIP_MAP_Y, @direction) # transfer to new map
else
#Continue to normal function when not enabled
@vehicle_type = :ship
control_vehicle
end
end
end
#--------------------------------------------------------------------------
# * Pilot Vehicle (From Interior)
# Brings player back to the overmap to control the ship
#--------------------------------------------------------------------------
def pilot_vehicle
# Save Interior Map Location
@player_int_map = $game_map.map_id
@player_int_x = @x
@player_int_y = @y
# Transfer to World Map
if @used_vehicle == :ship
@direction = @player_w_d
if @player_w_d == 2
@player_w_y += 1
elsif @player_w_d == 4
@player_w_x -= 1
elsif @player_w_d == 6
@player_w_x += 1
elsif @player_w_d == 8
@player_w_y -= 1
end
end
reserve_transfer(@player_w_map, @player_w_x, @player_w_y, @direction)
@vehicle_type = @used_vehicle
control_vehicle
end
#--------------------------------------------------------------------------
# * Leave Vehicle (From Overmap)
# Intercept the player, and end them inside
#--------------------------------------------------------------------------
alias abandon_vehicle get_off_vehicle
def get_off_vehicle
if @vehicle_type == :airship
if $game_switches[Tenseiten::Vehicle::AIRSHIP_ENABLED] == true
if vehicle.land_ok?(@x, @y, @direction)
set_direction(1) if in_airship?
@followers.synchronize(@x, @y, @direction)
vehicle.get_off
unless in_airship?
force_move_forward
@transparent = false
end
@vehicle_getting_off = true
@move_speed = 4
@through = false
make_encounter_count
@followers.gather
end
@vehicle_getting_off
if vehicle.land_ok?(@x, @y, @direction)
@player_w_map = $game_map.map_id
@player_w_x = @x
@player_w_y = @y
reserve_transfer(@player_int_map, @player_int_x, @player_int_y, @direction) # transfer to new map
end
else
abandon_vehicle
end
elsif @vehicle_type == :ship
if $game_switches[Tenseiten::Vehicle::SHIP_ENABLED] == true
vehicle.get_off
force_move_forward
@transparent = false
@vehicle_getting_off = true
@move_speed = 4
@through = false
make_encounter_count
@followers.gather
@vehicle_getting_off
@player_w_map = $game_map.map_id
@player_w_x = @x
@player_w_y = @y
reserve_transfer(@player_int_map, @player_int_x, @player_int_y, @direction) # transfer to new map
else
abandon_vehicle
end
else
abandon_vehicle
end
end
#--------------------------------------------------------------------------
# * Exit Vehicle (From Interior)
# Returns the party to the overmap
#--------------------------------------------------------------------------
def exit_vehicle
reserve_transfer(@player_w_map, @player_w_x, @player_w_y, @direction)
end
end
0
0
2
New Quest Gaming
Feb 23, 2024
In Modifications
This mod adds on more floor damage and adds a switch to turn that specific damage off
Credit and Thanks
Kio Kurashi
Roninator2
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Damage for more types of Floors Script v 1.2
#Author = Kio Kurashi
#Credit = Kio Kurashi
#Modded by Roninator2
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Notes:
# Currently this script only works for three types of Floor damage. It doesn't
# nessesarily need to be Poison, Lava, and Shock, however. If more than the
# provided number of Floors are needed I can add more.
# Options added to allow inflicting states when damaged
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Instructions:
# The editable section is directly bellow. For each you will have a Terrain tag,
# and a Damage ammount. The Terrain tag will be a number between 0 and 7.
# as the number on the tiles. Damage will be the Base damage that is
# applied for each number.
#Important:
# The map tileset must be properly configured.
# The tile that will be a damage tile must be marked as a damage tile. go figure
# The tile must also have the terrain tag matching the settings below.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Update:
# The script will now apply a damage effect at the specified interval
# 60 = 1 second
# Also available is a switch to turn the interval damage off.
# Turn switch on to stop interval damage.
#~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#~ BEGINING OF EDITABLE SECTION
#~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
module R2_Floor_Damage
NORMAL_TERRAIN_REGION = 0
NORMAL_TERRAIN_DAMAGE = 0
POISON_TERRAIN_REGION = 1 # Poison terrain tag
POISON_TERRAIN_DAMAGE = 10 # Poison damage
CHANCE_POISON = 15 # Chance to inflict poison
POISON_STATE = 2 # Poison state
LAVA_TERRAIN_REGION = 2 # Burn terrain tag
LAVA_TERRAIN_DAMAGE = 40 # Burn damage
CHANGE_BURN = 25 # Chance to inflict burn
BURN_STATE = 25 # Burn state
SHOCK_TERRAIN_REGION = 3 # Shock terrain tag
SHOCK_TERRAIN_DAMAGE = 20 # Shock damage
CHANGE_SHOCK = 50 # Chance to inflict shock
SHOCK_STATE = 35 # Shock state
FDR_DAMAGE_INT = 60 # interval at which the damage effect will apply again.
FDR_DAMAGE_SWITCH = 151 # Turn switch on to turn off interval damage
BLOCK_STATES = [160, 190] # States that will block damage
INFLICT_STATE = 191 # Switch used to inflict states
end
#~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#~ END OF EDITABLE SECTION
#~ Editing beyond this point without prior knowledge is dangerous!!
#~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class Game_Actor
def basic_floor_damage
case $game_map.terrain_tag($game_player.x, $game_player.y)
when R2_Floor_Damage::NORMAL_TERRAIN_REGION
return R2_Floor_Damage::NORMAL_TERRAIN_DAMAGE
when R2_Floor_Damage::POISON_TERRAIN_REGION
return R2_Floor_Damage::POISON_TERRAIN_DAMAGE
when R2_Floor_Damage::LAVA_TERRAIN_REGION
return R2_Floor_Damage::LAVA_TERRAIN_DAMAGE
when R2_Floor_Damage::SHOCK_TERRAIN_REGION
return R2_Floor_Damage::SHOCK_TERRAIN_DAMAGE
when nil
return 10
end
end
end
class Game_Player < Game_Character
alias r2_fdr_initialize initialize
def initialize
@standingtime = 0
r2_fdr_initialize
end
alias r2_input_move_fdr move_by_input
def move_by_input
@standingtime = 0 if $game_player.moving?
r2_input_move_fdr
end
alias r2_fdr_update_nonmoving update_nonmoving
def update_nonmoving(last_moving)
if !$game_switches[R2_Floor_Damage::FDR_DAMAGE_SWITCH]
@standingtime += 1 if !$game_map.interpreter.running?
actor.check_floor_effect if @standingtime > R2_Floor_Damage::FDR_DAMAGE_INT
@standingtime = 0 if @standingtime > R2_Floor_Damage::FDR_DAMAGE_INT
end
r2_fdr_update_nonmoving(last_moving)
end
end
class Game_Actor < Game_Battler
alias r2_state_block_floor_damage execute_floor_damage
def execute_floor_damage
state_ids = self.states.collect {|obj| obj.id }
return if state_ids.include?(R2_Floor_Damage::BLOCK_STATES)
r2_state_block_floor_damage
case $game_map.terrain_tag($game_player.x, $game_player.y)
when R2_Floor_Damage::POISON_TERRAIN_REGION
chance = R2_Floor_Damage::CHANCE_POISON
state = R2_Floor_Damage::POISON_STATE
when R2_Floor_Damage::LAVA_TERRAIN_REGION
chance = R2_Floor_Damage::CHANCE_BURN
state = R2_Floor_Damage::BURN_STATE
when R2_Floor_Damage::SHOCK_TERRAIN_REGION
chance = R2_Floor_Damage::CHANCE_SHOCK
state = R2_Floor_Damage::SHOCK_STATE
else
return
end
return if $game_switches[R2_Floor_Damage::INFLICT_STATE] == false
roll = rand(100).to_i
if roll <= chance
act = $game_actors[@actor_id]
act.add_state(state)
end
end
end
0
0
2
New Quest Gaming
Admin
More actions
bottom of page