?#------------------------------------------------------------------
#------------------------------------------------------------------
# The Mormegil's Overdrive System
# v 1.0
#------------------------------------------------------------------
#------------------------------------------------------------------
# This script is intended as an add-on to Yanfly's Engine Melody Battle Engine.
# It creates an overdrive system with as much personalization as possible
# that you can set up mainly using notetags.
# For the expert users, there are some advanced options within the code itself.
#
# NOTETAGS:
# The Overdrive System requires intensive notetag use. Here is a compendium of
# the notetags' functions.
#
# <<overdrive>>
# This is the main notetag. It identifies the skill as an overdrive skill.
# + type: trigger
# + type: sequence
# + addon: consumable
# + type: press
# + type: random
# + type: slot effect
# + type: slot increase
# These are the notetags that determinate the Overdrive's type.
# Default is normal type. Normal type means the Overdrive is just a simple skill.
# Trigger type creates a bar. You need to input at the correct time the action button
# in order for the command to work at maximum power.
# Sequence type creates a button sequence. You need to input the button sequence
# in order for the overdrive skill to work.
# Consumable uses up an object to work. This overdrive type can be used as an "add-on" to another
# type (normal included), so that another overdrive skill has an extra requisite.
# Press displays a button that you must press quickly to increase the efficacy of the overdrive.
# Random chooses a random skill from a list of skills.
# Slot effect creates a slot machine. Depending on the results of the slot machine, you can
# have different effects.
# Slot increase creates a slot machine. Depending on the results of the slot machine, you can
# increase or decrease the efficacy of the overdrive skill.
#
# + trigger: back and forth
# + trigger: speed x
# + trigger: times x
# + trigger: nothing
# + trigger: half damage
# + trigger: percentage damage
# + trigger: no effects
# + trigger: percentage effects
# These are Trigger type specific notetags. Back and forth makes the cursor on the bar
# move back and forth until you either miss or hit all spots. If you activate this option hits can appear on the first
# half of the bar too.
# Speed sets the cursor's speed. X should be a number between 1 and 5: 1 means the cursor
# reaches the end of the gauge in 10 seconds, 2 means 8 seconds, 3 means 6, 4 means 4 and 5 means 2.
# Times sets the number of hits the player has on the bar. Hits are put in randomly generated spots on the
# second half of the bar. Do not place more than 3 or 4 hits, tops; up to about 6 or 7 hits with back and forth
# activated.
# Nothing, half damage, percentage damage, no effects and percentage effects are miss notetags:
# they affect how the skill works if the player misses the hit spots. Nothing means the skill fails,
# half damage means exactly that, percentage damage means you get a damage % depending on how many
# hits you have done right, no effects means you don't get to apply status effects and percentage effect
# means there's only a chance (again, depending on the number of correct hits) to do so.
#
# + sequence: n button
# + sequence: hide sequence
# + sequence: any of flag
# + sequence: timeout x
# + sequence: show correct
# These are Sequence specific notetags. The main notetag is n button: it creates the sequence.
# You must place numbers from 0 to whatever you like (suggested cap is at 9 max) and then the
# button you want the player to press, in order.
# Here is a list of buttons you could place: a, b, c, x, y, z, l, r, up, down, left, right, random.
# Hide sequence hides the sequence. You can use the Overdrive Equip script to display the information
# to the player outside of combat.
# Any of creates a group of skills that are identified by "flag". If you use this notetag, hide sequence
# is also suggested. This notetag means that the player can input any sequence from the "flag" group
# and the proper skill will be activated.
# Timeout places a timer. If the timer runs out, the overdrive won't work.
# Show correct means that if the player presses the proper button, the sequence will delete it and only
# the other buttons will remain.
#
# + consumable: item x
# + consumable: weapon x
# + consumable: armor x
# + consumable: quantity x
# + consumable: random x..y
# These are the consumable tags. Item x, armor x and weapon x fix the consumed item. Quantity fixes the quantity
# of the item to be deleted (default is 1). Random is the same, but the quantity will be a random number between
# x and y.
#
# + press: button
# + press: timeout x
# + press: max x
# + press: change x button
# + press: wrong cancels
# + press: wrong decreases
# These are press tags. Button fixes the button to use.
# Timeout x fixes the max timer. Max fixes the maximum amount of button presses counting.
# Change x button fixes a frame before the timeout (x) and from that frame you must press a different
# button (button). Wrong cancels means that a wrong input resets the count to 0. Wrong decrease means
# that a wrong input decreases the count by 1.
#
# + random: x
# + random: chance x, y
# + random: cost on
# + random: cast x
# These are random tags. X sets a skill; use it multiple times to create a list.
# Chance x, y adds a skill with a greater chance to be chosen (y times higher).
# Cost on means you must pay the cost of the skill. Cast x means using x random skills.
#
# + slot effect: n slots
# + slot effect: n chance
# + slot effect: base x
# + slot effect: req_chance req_number x
# These are slot effect tags. N slots fixes the number of slots (from 3 to 9)
# N chance fixes the number of different pictures appearing in the slot (from 2 to 10)
# Base x fixes the skill to use if no combination is reached.
# Req_chance is the required picture, req_number is the minimum number of times the picture must appear
# and x is the skill associated with that combination. The combinations are read in order from top to last,
# and only one combination is used.
#
# + slot increase: n slots
# + slot increase: lose chance x
# + slot increase: win chance x
# + slot increase: nothing
# + slot increase: percentage damage
# + slot increase: percentage effect
# + slot increase: percentage hit
# These are slot increase tags. N slots fixes the slots number (from 3 to 9).
# Lose chance is the number of "losing" chances; win chance is the number of "winning" chances.
# The rest fix the results if some slots are "losing". Nothing means the skill won't work.
# Percentage damage means the damage is reduce with every failure. Percentage effect means the status effects
# will be placed upon enemy only with a lower % rate, depending on failures. Percentage hit
# means the attack will have a reduce hit ratio.
#
# + overdrive reaction
# This notetag means the overdrive skill will be used immediately after the overdrive gauge is filled.
#
# + overdrive level x
# This notetag fixes the overdrive level. Default level is 1. Overdrive skills cost more the higher their level is.
# Your overdrive gauge's size depends on the highest level overdrive skill you have learned.
#
# <overdrive x%> <no overdrive> <overdrive!>
# These are status notetags. Overdrive x% means the overdrive gauge will be filled at x% speed rate when under this status.
# No overdrive means you won't be able to use overdrive skills, but the overdrive gauge is unaffected. Overdrive! means
# you will be able to use overdrive skills no matter what.
#
# <during effect: overdrive +x> <during effect: overdrive -x> <during effect: overdrive x%>
# This is an item notetag. It means the overdrive gauge of the target will be affected with an increase or decrease
# as chosen.
#
#------------------------------------------------------------------
#
# $$$$$$$$$$$$$$$ CUSTOMIZATION OPTIONS $$$$$$$$$$$$$$$$$$$$
#
# This part of the script affects how actors gain overdrive gauges.
# Firstly, these are script commands that affect the overdrive gauge:
#
# $game_actors[actor_ID].overdrive.gain(x)
# $game_actors[actor_ID].overdrive.lose(x)
# $game_actors[actor_ID].overdrive.percent(x)
#
# They work the same as the item notetags. I leave the rest to your imagination.
#
# This is the Limit Break Counter. Turn it to an integer > 0 if you want your characters to be able to use their
# overdrive if at low hp. If they are at low hp (less than x%, where x is the integer specified) they will
# bypass normal Overdrive rules, and use it without spending Overdrive
module TheMormegil # DO NOT DELETE!
module Overdrive_System # DO NOT DELETE!
LIMIT_BREAK = 0
# If you want to entirely disable the overdrive counter, turn this to true. This means that if you turned on
# the Limit Break, your characters will use their overdrive when on low hp only.
NO_OVERDRIVE = false
#
# This is the Actor Hash. It links every actor to one or more "Overdrive Types".
# These Overdrive Types are described below the Hash. They affect how each hero gains
# or loses Overdrive.
OVERDRIVE_ACTOR_HASH = { # DO NOT DELETE!
1 => ["stoic", "pacifist", "comrade", "healer", "animist"]
2 => ["brutal", "berserker", "sadist", "slayer"]
3 => ["evader", "coward", "afraid"]
4 => ["avenger", "tactician", "striker", "weak"]
} # DO NOT DELETE!
# To change the Overdrive Types for an actor mid-game, the code command is:
#
# $game_actors[actor_ID].overdrive.type = ["type", "type", "type"]
#
# This is the description for every type. The first type in every pair is the
# positive one, while the second is the negative - lowering Overdrive instead of
# augmenting it.
# Stoic / Weak:
# This type depends on damage taken. Rate depends on maximum hp.
# Comrade / Afraid:
# This type depends on damage taken by allies. Rate depends on allies maximum hp.
# Striker / Pacifist:
# This type depends on damage inflicted. Rate depends on target's maximum hp compared to yours.
# Healer / Sadist:
# This type depends on healed damage. Rate depends on target's maximum hp.
# Tactician / Brutal:
# This type depends on imposed statuses. Rate is fixed.
# Slayer / Animist:
# This type depends on slayed enemies. Rate is fixed.
# Avenger / Coward:
# This type depends on fallen allies. Rate is fixed.
# Evader / Berserker:
# This type depends on evaded blows. Rate is fixed.
#
# You can change the individual rate of overdrive growth here. Every value is a percentage.
# You can modify both the actor hash and the general rate value. Beware! This will affect also
# overdrive lost...
OVERDRIVE_RATE = 100
OVERDRIVE_RATE_ACTOR_HASH = {
1 => 100
2 => 100
3 => 100
4 => 100
}
#
end #DO NOT DELETE!
end #DO NOT DELETE!
#
#------------------------------------------------------------------
#------------------------------------------------------------------
#------------------------------------------------------------------
# STOP EDITING PAST THIS POINT!
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
#
$imported = {} if $imported == nil
$imported["TM_OverdriveSystem"] = true
class Window_ActorCommand < Window_Command
alias in_ov_sy_tm initialize
def initialize
in_ov_sy_tm
@overdrive_gauge = OverdriveGauge.new
end
alias di_ov_sy_tm dispose
def dispose
di_ov_sy_tm
@overdrive_gauge.terminate
end
alias set_ov_sy_tm setup
def setup(actor)
set_ov_sy_tm(actor)
@overdrive_gauge.set(actor)
end
alias up_ov_sy_tm update
def update
up_ov_sy_tm
return unless $scene.is_a?(Scene_Battle)
return unless @actor == $scene.status_window.actor
@overdrive_gauge.update
end
alias ref_ov_sy_tm refresh
def refresh
ref_ov_sy_tm
@overdrive_gauge.set(@actor)
end
end
class OverdriveGauge
def initialize
@viewport = Viewport.new(0, Graphics.height - 128, Graphics.width, 24)
@sprite = Sprite.new(@viewport)
@sprite.visible = false
@bitmap = Cache.system("Overdrive_Gauge")
@sprite.bitmap = @bitmap
@level = 0 if @level.nil?
end
def set(actor)
@actor = nil
@actor = actor
if @actor.no_overdrive?
@actor = nil
@sprite.visible = false
return
end
@level = actor.overdrive.n
level_update
end
def update
actual_level = @actor.overdrive.n
if @level != actual_level
Audio.play_se("Chime2", 100, 150) unless @sound_done
@sound_done = true
if @level < actual_level
@level = (@level+10, actual_level).min
else
@level = (@level-10, actual_level).max
end
level_update
else
@sound_done = false
end
return if @sprite.visible
if $scene.actor_command_window.active ### CHECK IF VISIBLE
@sprite.visible = true unless @actor == nil
end
end
def level_update
bitmap = @bitmap
width = ((@bitmap.width-4)/@actor.overdrive.max)*@level
rect = Rect.new(2, 2, width, 20)
yellow = Color.new(200, 200, 40, 255)
red = Color.new(255, 40, 40, 255)
bitmap.grandient_fill_rect(rect, yellow, red)
end
def terminate
@sprite.dispose
@sprite = nil
@viewport = nil
self = nil
end
end
class Scene_Battle < Scene_Base
attr_accessor :overdrive_successes
attr_accessor :overdrive_failures
attr_accessor :overdrive_trigger_back_and_forth
attr_accessor :overdrive_trigger_bar
attr_accessor :overdrive_trigger_cursor
attr_accessor :overdrive_trigger_hits
attr_reader :overdrive_sequence_show_correct
attr_reader :overdrive_percent_damage
attr_reader :overdrive_percent_effects
attr_reader :overdrive_percent_hit
attr_reader :overdrive_nullify
attr_reader :overdrive_nullify_effects
attr_reader :overdrive_half
# Item notetags
alias lunatic_obj_effects_overdrive_system lunatic_obj_effects
def lunatic_obj_effects(type, obj = nil, target = @active_battler)
obj.nil? ? effects = [] : effects = obj.lunatic_effects[:during]
for effect in effects
next if TheMormegil::Overdrive_System::NO_OVERDRIVE
case effect.upcase
when TheMormegil::Regexp::OVERDRIVE_ITEM_PLUS
if target.actor?
target.overdrive.gain($1.to_i)
end
when TheMormegil::Regexp::OVERDRIVE_ITEM_MINUS
if target.actor?
target.overdrive.lose($1.to_i)
end
when TheMormegil::Regexp::OVERDRIVE_ITEM_PERCENT
if target.actor?
target.overdrive.percent($1.to_i)
end
end
end
lunatic_obj_effects_overdrive_system(type, obj, target)
end
# Use Overdrive Skill
alias perform_normal_skill perform_skill
def perform_skill(skill)
if skill.overdrive?
perform_overdrive(skill)
else
perform_normal_skill(skill)
end
end
def perform_overdrive(skill)
start_overdrive(skill)
define_overdrive_scene(skill)
pay_overdrive_cost(@active_battler, skill) unless actor.bypass_overdrive_cost?
process_consumable_overdrive_cost(skill)
end
def start_overdrive(skill)
@overdrive_trigger_back_and_forth = false
@speed = 3
@overdrive_trigger_hits_number = 1
@overdrive_nullify = 0
@overdrive_half = false
@overdrive_percent_damage = false
@overdrive_effect_nullify = false
@overdrive_percent_effects = false
@overdrive_sequence_hide = false
@overdrive_sequence_group = "NONE"
@overdrive_sequence_show_correct = false
@overdrive_press_change_frames = []
@overdrive_press_change_buttons = []
@overdrive_press_max = 0
@overdrive_press_wrong_cancels = false
@overdrive_press_wrong_decreases = false
@overdrive_random_skills = []
@overdrive_random_cast = 1
@overdrive_cost_on = false
@overdrive_slots = 3
@overdrive_slot_chances = 5
@overdrive_slot_effect_requisites = []
@overdrive_slot_increase_lose_chances = 0
@overdrive_slot_increase_win_chances = 0
@overdrive_percent_hit = false
lines = skill.note.split(/[\r\n]+/)
for line in lines
case line
when OVERDRIVE_TRIGGER_BACK_AND_FORTH
@overdrive_trigger_back_and_forth = true
when OVERDRIVE_TRIGGER_SPEED
@speed = (($1.to_i, 1).max, 5).min
when OVERDRIVE_TRIGGER_TIMES
@overdrive_trigger_hits_number = $1.to_i
when OVERDRIVE_TRIGGER_NOTHING
@overdrive_nullify = true
when OVERDRIVE_TRIGGER_HALF
@overdrive_half = true
when OVERDRIVE_TRIGGER_PERCENT_DAMAGE
@overdrive_percent_damage = true
when OVERDRIVE_TRIGGER_NO_EFFECTS
@overdrive_effect_nullify = true
when OVERDRIVE_TRIGGER_PERCENT_EFFECTS
@overdrive_percent_effects = true
when OVERDRIVE_SEQUENCE_HIDE
@overdrive_sequence_hide = true
when OVERDRIVE_SEQUENCE_ANY_OF
@overdrive_sequence_group = $1.upcase
when OVERDRIVE_SEQUENCE_SHOW_CORRECT
@overdrive_sequence_show_correct = true
when OVERDRIVE_PRESS_CHANGE_BUTTON
@overdrive_press_change_frames.push($1.to_i)
@overdrive_press_change_buttons.push($2.upcase)
when OVERDRIVE_PRESS_MAX
@overdrive_press_max = $1.to_i
when OVERDRIVE_PRESS_WRONG_CANCELS
@overdrive_press_wrong_cancels = true
when OVERDRIVE_PRESS_WRONG_DECREASES
@overdrive_press_wrong_decreases = true
when OVERDRIVE_RANDOM_SKILL
@overdrive_random_skills.push($data_skills[$1.to_i])
when OVERDRIVE_RANDOM_CAST
@overdrive_random_cast = $1.to_i
when OVERDRIVE_RANDOM_CHANCE
for i in 1..$2.to_i
@overdrive_random_skills.push($data_skills[$1.to_i])
end
when OVERDRIVE_RANDOM_COST_ON
@overdrive_cost_on = true
when OVERDRIVE_SLOT_EFFECT_SLOTS
@overdrive_slots = $1.to_i
when OVERDRIVE_SLOT_EFFECT_CHANCE
@overdrive_slot_chances = $1.to_i
when OVERDRIVE_SLOT_EFFECT_BASE
@overdrive_slot_effect_base_skill = $data_skills[$1.to_i]
when OVERDRIVE_SLOT_EFFECT_REQUISITE
@overdrive_slot_effect_requisites.push([$1.to_i, $2.to_i, $3.to_i])
when OVERDRIVE_SLOT_INCREASE_SLOTS
@overdrive_slots = $1.to_i
when OVERDRIVE_SLOT_INCREASE_LOSE_CHANCE
@overdrive_slot_increase_lose_chances = $1.to_i
when OVERDRIVE_SLOT_INCREASE_WIN_CHANCE
@overdrive_slot_increase_win_chances = $1.to_i
when OVERDRIVE_SLOT_INCREASE_NOTHING
@overdrive_nullify = true
when OVERDRIVE_SLOT_INCREASE_PERCENT_DAMAGE
@overdrive_percent_damage = true
when OVERDRIVE_SLOT_INCREASE_PERCENT_HIT
@overdrive_percent_hit = true
when OVERDRIVE_SLOT_INCREASE_PERCENT_EFFECTS
@overdrive_percent_effects = true
end
end
def finish_overdrive(skill_a)
@overdrive_skills_to_perform = [skill_a] if @overdrive_skills_to_perform.nil?
if (@overdrive_scene == "RANDOM")
random = true
for i in 1..@overdrive_random_cast
r = rand(@overdrive_random_skills.size)
@overdrive_skills_to_perform.push($data_skills[r])
end
@overdrive_successes -= 1 if (@overdrive_scene == "SLOT INCREASE")
for skill in @overdrive_skills_to_perform
next if @overdrive_nullify
perform_normal_skill(skill)
if random
@ignore_cost = true
random = false
end
end
@ignore_cost = false
@overdrive_skills_to_perform = nil
@overdrive_trigger_back_and_forth = nil
@speed = nil
@overdrive_trigger_hits_number = nil
@overdrive_nullify = nil
@overdrive_half = nil
@overdrive_percent_damage = nil
@overdrive_effect_nullify = nil
@overdrive_percent_effects = nil
@overdrive_sequence_hide = nil
@overdrive_sequence_group = nil
@overdrive_sequence_show_correct = nil
@overdrive_press_change_frames = nil
@overdrive_press_change_buttons = nil
@overdrive_press_max = nil
@overdrive_press_wrong_cancels = nil
@overdrive_press_wrong_decreases = nil
@overdrive_random_skills = nil
@overdrive_random_cast = nil
@overdrive_cost_on = nil
@overdrive_slots = nil
@overdrive_slot_chances = nil
@overdrive_slot_effect_base_skill = nil
@overdrive_slot_effect_requisites = nil
@overdrive_slot_increase_lose_chances = nil
@overdrive_slot_increase_win_chances = nil
@overdrive_percent_hit = nil
end
def define_overdrive_scene(skill)
skill.note.split(/[\r\n]+/).each {|line|
if line =~ TheMormegil::Regexp::OVERDRIVE_TYPE
@overdrive_scene = $1.upcase
return
end}
@overdrive_scene = "NORMAL"
end
def update
if @overdrive_scene != nil
super
return unless $scene.is_a?(Scene_Battle)
update_basic(true)
overdrive_scene_update
else
super
return unless $scene.is_a?(Scene_Battle)
update_basic(true)
update_info_viewport
@message_window.visible = true if $game_message.visible
update_input_windows unless atb?
update_scene_change
for actor in @current_party
next if actor.dead?
next if actor.overdrive.reaction_flag.nil?
perform_reaction_overdrive(actor)
end
end
end
def overdrive_scene_update
update_basic(true)
case @overdrive_scene.upcase
when "NORMAL"
unless overdrive_title_update
finish_overdrive(@active_battler.action.skill)
@overdrive_scene = nil
@overdrive_title_done? = false
end
when "TRIGGER"
unless overdrive_title_update
unless overdrive_trigger_update
finish_overdrive(@active_battler.action.skill)
@overdrive_scene = nil
@overdrive_title_done? = false
end
end
when "SEQUENCE"
unless overdrive_title_update
unless overdrive_sequence_update
finish_overdrive(@active_battler.action.skill)
@overdrive_scene = nil
@overdrive_title_done? = false
end
end
when "PRESS"
unless overdrive_title_update
unless overdrive_press_update
finish_overdrive(@active_battler.action.skill)
@overdrive_scene = nil
@overdrive_title_done? = false
end
end
when "RANDOM"
unless overdrive_title_update
finish_overdrive(@active_battler.action.skill)
@overdrive_scene = nil
@overdrive_title_done? = false
end
when "SLOT INCREASE"
unless overdrive_title_update
unless overdrive_slot_increase_update
finish_overdrive(@active_battler.action.skill)
@overdrive_scene = nil
@overdrive_title_done? = false
end
end
when "SLOT EFFECT"
unless overdrive_title_update
unless overdrive_slot_effect_update
finish_overdrive(@active_battler.action.skill)
@overdrive_scene = nil
@overdrive_title_done? = false
end
end
else
@overdrive_scene = nil
end
end
def overdrive_title_update
@overdrive_title_done = false if @overdrive_title_done.nil?
if @overdrive_title_done?
return false
end
if @ov_ti_viewport.nil?
bitmap = Cache.system("Overdrive_Title")
@ov_ti_viewport = Viewport.new((Graphics.width - bitmap.width) / 2, (Graphics.height - bitmap.height) / 2, bitmap.width, bitmap.height)
@overdrive_title = Sprite.new(@ov_ti_viewport)
@overdrive_title.bitmap = bitmap
@overdrive_title.ox = Graphics.width
@overdrive_title.z = 1000
end
@overdrive_title.update
pos = Graphics.width - @overdrive_title.width
if @overdrive_title.ox > pos
@overdrive_title.ox -= (Graphics.width - pos) / 30
@overdrive_title.ox = (@overdrive_title.ox, pos).max
end
if @overdrive_title.ox == pos
@overdrive_title.z +=1
end
if @overdrive_title.z == 1120
@overdrive_title.ox -= pos / 30
end
if @overdrive_title.ox <= -@overdrive_title.width
@overdrive_title.dispose
@overdrive_title = nil
@ov_ti_viewport = nil
@overdrive_title_done? = true
end
return true
end
def overdrive_trigger_update
if (@overdrive_trigger_hits_number - @overdrive_successes) == 0
return false
end
if @overdrive_failures > 0
return false
end
if @overdrive_trigger_bar.nil?
@overdrive_trigger_bar = Sprite.new
bitmap = Cache.system("Overdrive_Trigger_Bar")
@overdrive_trigger_bar.bitmap = bitmap
@overdrive_trigger_bar.x = (Graphics.width - bitmap.width) / 2
@overdrive_trigger_bar.y = (Graphics.height - bitmap.height)
@overdrive_trigger_bar.z = 1000
end
if @overdrive_trigger_cursor.nil?
@overdrive_trigger_cursor = Sprite.new
bit_map = Cache.system("Overdrive_Trigger_Cursor")
@overdrive_trigger_cursor.bitmap = bit_map
@overdrive_trigger_cursor.x = @overdrive_trigger_bar.x + @overdrive_trigger_bar.width - bit_map.width
@overdrive_trigger_cursor.y = @overdrive_trigger_bar.y - ( (@overdrive_trigger_bar.height - bit_map.height) / 2 )
@overdrive_trigger_cursor.z = 1010
end
if @overdrive_trigger_hits.nil?
@overdrive_trigger_hits = []
for i in 1..@overdrive_trigger_hits_number
@overdrive_trigger_hits.push(OverdriveHit.new(@overdrive_trigger_bar))
end
end
overdrive_trigger_cursor_move
if Input.press?(Input::C)
$input_pause_tm = 20
overdrive_trigger_hit_process
end
return true
end
def overdrive_trigger_cursor_move
move = (@overdrive_trigger_bar.width - @overdrive_trigger_cursor.width) / (60 * (12 - @overdrive_trigger_speed*2))
minimum = @overdrive_trigger_bar.x + @overdrive_trigger_bar.width - @overdrive_trigger_cursor.width
maximum = @overdrive_trigger_bar.x
if @overdrive_trigger_back_and_forth
if @overdrive_trigger_back?
@overdrive_trigger_cursor.x += move
@overdrive_trigger_cursor.x = (@overdrive_trigger_cursor.x, minimum).min
@overdrive_trigger_back? = false if (@overdrive_trigger_cursor.x == minimum)
else
@overdrive_trigger_cursor.x -= move
@overdrive_trigger_cursor.x = (@overdrive_trigger_cursor.x, maximum).max
@overdrive_trigger_back? = true if @overdrive_trigger_cursor.x == maximum
end
else
@overdrive_trigger_cursor.x -= move
@overdrive_trigger_cursor.x = (@overdrive_trigger_cursor.x, maximum).max
@overdrive_failures += 1 if (@overdrive_trigger_cursor.x == maximum)
end
end
def overdrive_trigger_hit_process
for hit in @overdrive_trigger_hits
if hit.in_range?(@overdrive_trigger_cursor.x)
@overdrive_successes += 1
hit.success
return
end
end
@overdrive_failures += 1
end
def overdrive_sequence_update
if @overdrive_sequence_buttons.nil?
@overdrive_sequence_buttons = @active_battler.action.skill.create_button_sequence
end
if @overdrive_successes == @overdrive_sequence_buttons.size
return false
end
if @overdrive_failures > 0
return false
end
if @overdrive_sequence_button_window.nil?
@overdrive_sequence_button_window = Window_OverdriveSequence.new(@overdrive_sequence_buttons)
end
if @overdrive_timer.nil?
@overdrive_timer = make_overdrive_timer
end
@overdrive_sequence_button_window.update
@overdrive_failures += 1 unless (@overdrive_timer > 0)
process_overdrive_sequence_input unless (@overdrive_sequence_group.size > 0)
process_overdrive_sequence_group_input if (@overdrive_sequence_group.size > 0)
end
def process_overdrive_sequence_input
correct = @overdrive_sequence_buttons[@overdrive_successes]
all = [Input::A, Input::B, Input::C, Input::X, Input::Y, Input::Z, Input::L, Input::R, Input::LEFT, Input::RIGHT, Input::UP, Input::DOWN]
wrong = all - correct
for b_wrong in wrong
if Input.press?(b_wrong)
@overdrive_failures += 1
$input_pause_tm = 20
end
end
if Input.press?(correct)
@overdrive_successes += 1
$input_pause_tm = 20
end
end
def process_overdrive_sequence_group_input
all = [Input::A, Input::B, Input::C, Input::X, Input::Y, Input::Z, Input::L, Input::R, Input::LEFT, Input::RIGHT, Input::UP, Input::DOWN]
for input in all
if Input.press?(input)
@overdrive_sequence_group_sequence_buttons.push(input)
$input_pause_tm = 20
end
end
for skill in @overdrive_sequence_group
sequence = skill.create_overdrive_sequence
if @overdrive_sequence_group_sequence_buttons == sequence
@overdrive_successes = @overdrive_sequence_buttons.size
@overdrive_skills_to_perform.push(skill)
end
end
end
def make_overdrive_timer
skill = @active_battler.action.skill
skill.note.split(/[\r\n]+).each{|l|
if l =~ TheMormegil::Regexp::OVERDRIVE_SEQUENCE_TIMEOUT
@overdrive_timer = $1.to_i
elsif l =~ TheMormegil::Regexp::OVERDRIVE_PRESS_TIMEOUT
@overdrive_timer = $1.to_i
end}
@overdrive_timer = 300 if @overdrive_timer.nil?
end
def overdrive_press_update
make_overdrive_timer if @overdrive_timer.nil?
return false if @overdrive_timer == 0
if @overdrive_press_button.nil?
@overdrive_press_button = "C"
end
if @overdrive_press_background.nil?
bitmap = Cache.system("Overdrive_Press_Background")
viewport = Viewport.new( (Graphics.width - bitmap.width) / 2, (Graphics.height - bitmap.height) / 2, bitmap.width, bitmap.height)
@overdrive_press_background = Sprite.new(viewport)
@overdrive_press_background.bitmap = bitmap
@overdrive_press_background.z = 1000
end
if @overdrive_press_button_sprite.nil?
name = "Button/"
name << @overdrive_press_button
bitmap = Cache.system(name)
@overdrive_press_button_sprite = Sprite.new
@overdrive_press_button_sprite.bitmap = bitmap
@overdrive_press_button_sprite.z = 1010
@overdrive_press_button_sprite.x = @overdrive_press_background.x + (@overdrive_press_background.width - @overdrive_press_button_sprite.width) / 2
@overdrive_press_button_sprite.y = @overdrive_press_background.y + (@overdrive_press_background.height - @overdrive_press_button_sprite.height) / 2
end
process_overdrive_press_input
process_overdrive_press_change_button
@overdrive_timer -= 1
return true
end
def process_overdrive_press_input
correct = make_overdrive_press_correct_button
all = [Input::A, Input::B, Input::C, Input::X, Input::Y, Input::Z, Input::L, Input::R, Input::LEFT, Input::RIGHT, Input::UP, Input::DOWN]
wrong = all - correct
for b_wrong in wrong
if Input.trigger?(b_wrong)
@overdrive_successes -= 1 if @overdrive_press_wrong_decreases
@overdrive_successes = 0 if @overdrive_press_wrong_cancels
Audio.se_play("Shot3", 100, 150)
end
end
if Input.trigger?(correct)
@overdrive_successes += 1 if @overdrive_successes < @overdrive_max_successes
Audio.se_play("Shot2", 100, 150)
end
end
def make_overdrive_press_correct_button
case @overdrive_press_button.upcase
when "A"
return Input::A
when "B"
return Input::B
when "C"
return Input::C
when "X"
return Input::X
when "Y"
return Input::Y
when "Z"
return Input::Z
when "L"
return Input::L
when "R"
return Input::R
when "LEFT"
return Input::LEFT
when "RIGHT"
return Input::RIGHT
when "UP"
return Input::UP
when "DOWN"
return Input::DOWN
else
return Input::C
end
end
def process_overdrive_press_change_button
return unless @overdrive_press_change_frames.size > 0
for i in 0..(@overdrive_press_change_frames.size - 1)
if @overdrive_timer == @overdrive_press_change_frames[i]
@overdrive_press_button = @overdrive_press_change_buttons[i]
end
end
end
def overdrive_slot_increase_update
if (@overdrive_successes + @overdrive_failures) == @overdrive_slots + 1
return false
end
if (@overdrive_successes + @overdrive_failures) == @overdrive_slots
@overdrive_slot_machine.terminate
@overdrive_slot_machine = nil
@overdrive_successes += 1
return false
end
if @overdrive_slot_machine.nil?
@overdrive_slot_machine = Slot_Machine.new(@overdrive_slots, nil, @overdrive_slot_increase_win_chances, @overdrive_slot_increase_lose_chances)
end
@overdrive_slot_machine.update
if Input.trigger?(Input::C)
process_slot_increase_input
end
return true
end
def process_slot_increase_input
n = @overdrive_successes + @overdrive_failures
@overdrive_slot_machine.display(n)
case @overdrive_slot_machine.result?(n)
when 0
@overdrive_successes += 1
when 1
@overdrive_failures += 1
end
end
def overdrive_slot_effect_update
if @overdrive_successes == @overdrive_slots + 1
return false
end
if @overdrive_successes == @overdrive_slots
determinate_overdrive_slot_effect_results
@overdrive_slot_machine.terminate
@overdrive_slot_machine = nil
@overdrive_successes += 1
return false
end
if @overdrive_slot_machine.nil?
@overdrive_slot_machine = Slot_Machine.new(@overdrive_slots, @overdrive_slot_effect_chances, 0, 0)
end
@overdrive_slot_machine.update
if Input.trigger?(Input::C)
process_slot_effect_input
end
end
def determinate_overdrive_slot_effect_results
end
def process_slot_effect_input(i)
@overdrive_slot_machine.display(n)
@overdrive_successes += 1
end
# Consume Overdrive
def pay_overdrive_cost(user, skill)
return unless user.actor?
return unless skill.overdrive?
cost = skill.overdrive_level * 100
user.overdrive.lose(cost)
@overdrive_gauge_window.update
end
def process_consumable_overdrive_cost(skill)
lines = skill.note.split(/[\r\n]+/)
for l in lines
if l =~ TheMormegil::Regexp::OVERDRIVE_CONSUMABLE
consumable = true
elsif l =~ TheMormegil::Regexp::OVERDRIVE_CONSUMABLE_ITEM
item = $data_items[$1.to_i]
elsif l =~ TheMormegil::Regexp::OVERDRIVE_CONSUMABLE_ARMOR
item = $data_armors[$1.to_i]
elsif l =~ TheMormegil::Regexp::OVERDRIVE_CONSUMABLE_WEAPON
item = $data_weapons[$1.to_i]
elsif l =~ TheMormegil::Regexp::OVERDRIVE_CONSUMABLE_QUANTITY
@overdrive_consume_q = $1.to_i if @overdrive_consume_q.nil?
elsif l =~ TheMormegil::Regexp::OVERDRIVE_CONSUMABLE_RANDOM
min = $1.to_i
max = $1.to_i
@overdrive_consume_q = rand(max-min) + min if @overdrive_consume_q.nil?
end
end
return unless consumable
return if item.nil?
for i in 1..@overdrive_consume_q
perform_consume_item(item)
end
end
def check_consumable_cost(skill)
lines = skill.note.split(/[\r\n]+/)
for l in lines
if l =~ TheMormegil::Regexp::OVERDRIVE_CONSUMABLE
consumable = true
elsif l =~ TheMormegil::Regexp::OVERDRIVE_CONSUMABLE_ITEM
item = $data_items[$1.to_i]
elsif l =~ TheMormegil::Regexp::OVERDRIVE_CONSUMABLE_ARMOR
item = $data_armors[$1.to_i]
elsif l =~ TheMormegil::Regexp::OVERDRIVE_CONSUMABLE_WEAPON
item = $data_weapons[$1.to_i]
elsif l =~ TheMormegil::Regexp::OVERDRIVE_CONSUMABLE_QUANTITY
@overdrive_consume_q = $1.to_i
elsif l =~ TheMormegil::Regexp::OVERDRIVE_CONSUMABLE_RANDOM
min = $1.to_i
max = $1.to_i
@overdrive_consume_q = rand(max-min) + min
end
end
return unless consumable
return if item.nil?
return ($game_party.item_number(item) >= @overdrive_consume_q)
end
# Use Reaction Overdrives
def perform_reaction_overdrive(user)
flag = user.overdrive.reaction_flag
return if flag.nil?
user.set_skill(flag)
return if atb?
last_active = @active_battler
last_battler = @selected_battler
@selected_battler = user
@active_battler = user
last_instant = skill.instant
skill.instant = true
perform_instant_action
@selected_battler = last_battler
@active_battler = last_active
skill.instant = last_instant
user.overdrive.reaction_flag = nil
end
end
First part. Most of the main script here.