#==============================================================================
# Skill Blitz
# By Atoa
# Based on Claimh Blitz Script
#==============================================================================
# With this script, you must make an command input before the skills
#
# When the input fail, the skill may fail or have the damage reduce.
# (it can be set individually for each skill)
#==============================================================================
module Atoa
# Keyborard setting (don't change unless you know what you doing)
A = Input::A # Keyborard:Z
B = Input::B # Keyborard:X
C = Input::C # Keyborard:C
X = Input::X # Keyborard:A
Y = Input::Y # Keyborard:S
Z = Input::Z # Keyborard:D
L = Input::L # Keyborard:Q
R = Input::R # Keyborard:W
UP = Input::UP
DOWN = Input::DOWN
LEFT = Input::LEFT
RIGHT = Input::RIGHT
# Time for each input
Key_Sec = 0.35
# Configuration of the input exhibition.
Keyboard_Type = true
# true = keyboard exhibition (Ex.: X = keyboard X)
# false = input exhibition (Ex.: X = keyboard A)
# Settings for command input for skill with cast time
# Works only with the scripts Atoa ATB our Atoa CTB
Blitz_Aftercast = true
# true = Command Input is made after cast time
# false = Command Input is made before cast time
# Graphic file name of the Blitz Bar, must be on the Graphic/Windowskins folder
Blitz_Bar_Name = 'BLITZMeter'
# Type of Bar advance.
Bar_Advance_Type = 0
# 0 = the bar increase
# 1 = the bar decrease
# Input display position
Input_Display_Position = 0
# 0 = Default, not centralized
# 1 = Default, centralized
# 2 = Customized
# Postion of the input display if Input_Display_Position = 2
Custom_Diplay_Postion = [[320,180],[320,180],[320,180],[320,180]]
# Sound file used when the input fails
Input_Fail_Sound = '003-System03'
# Sound file used when the input succeceds
Input_Success_Sound = '007-System07'
# Message shown when the input fails
Input_Fail_Message = 'Failed'
# Message shown when the input succeceds
Input_Success_Message = 'Success!'
# ID of the animation used when the input fails
Input_Fail_Anim = 4
# Skill setting
Blitz_Skill = {
# Skill ID => [[Key 1, Key 2,...], Cancel, Power)]
# Skill_ID: ID of the Skill
# Key 1, Key 2,...: Input order.
# Cancel: set if the skill will canceled
# true = the skill isn't used if the input fail
# false = the skill is used even if the input fail
# Power: Power rate if the input fail, only valid if Cancel = false
1 => [[C, Z, RIGHT], true, 50],
2 => [[X, Z, UP], true, 50],
3 => [[X, Z, UP,DOWN], true, 50],
4 => [[X, Z, UP,DOWN], true, 50],
5 => [[C, X, Z, UP,DOWN,], true, 50],
6 => [[UP,DOWN,LEFT,RIGHT], true, 50],
8 => [[X,C,Z], true, 50],
9 => [[DOWN,UP], true, 50],
10 => [[LEFT,UP], true, 50],
11 => [[L,X,R], true, 50],
12 => [[X,Z], true, 50],
13 => [[X,Z], true, 50],
14 => [[L,Z,A], true, 50],
15 => [[R,X,X,DOWN], true, 50],
16 => [[DOWN, RIGHT], true, 50],
17 => [[A,B,C], true, 50],
18 => [[Y,X,DOWN,B], true, 50],
19 => [[LEFT,DOWN], true, 50],
20 => [[Z,Y,A], true, 50],
21 => [[B,C,X,L], true, 50],
22 => [[RIGHT,DOWN], true, 50],
23 => [[A,B,R], true, 50],
24 => [[X,Y,LEFT,R], true, 50],
25 => [[LEFT,RIGHT], true, 50],
26 => [[X,L,B], true, 50],
27 => [[LEFT,X,C,Z], true, 50],
28 => [[LEFT,DOWN], true, 50],
29 => [[C,X,A], true, 50],
30 => [[X,Z,C,UP], true, 50],
31 => [[UP,DOWN,X], true, 50],
32 => [[LEFT,RIGHT,L,R], true, 50],
57 => [[A, C], true, 50],
58 => [[C, X, UP], true, 50],
59 => [[A, UP, RIGHT, A], true, 50],
60 => [[Z, C, A, B], true, 50],
61 => [[X, C], true, 50],
62 => [[UP, X, DOWN], true, 50],
63 => [[LEFT, C, Y, A], true, 50],
64 => [[X, C, Y, A], true, 50],
65 => [[Y, A], true, 50],
66 => [[RIGHT, B, A], true, 50],
67 => [[LEFT, UP, Z, A], true, 50],
68 => [[Y, B, Y, A], true, 50],
69 => [[LEFT, A], true, 50],
70 => [[A, C, A], true, 50],
71 => [[B, B, A, A], true, 50],
72 => [[A, B, X, Y], true, 50],
73 => [[X, A], true, 50],
74 => [[Y, A, B], true, 50],
75 => [[LEFT, RIGHT, Y, A], true, 50],
76 => [[A, C, L, A], true, 50],
77 => [[R, X], true, 50],
78 => [[L, C, R], true, 50],
79 => [[LEFT, L, RIGHT, R], true, 50],
80 =>[[C, C, Z, RIGHT], true, 50],
}
end
#==============================================================================
# ■ Atoa Module
#==============================================================================
$atoa_script = {} if $atoa_script.nil?
$atoa_script['Atoa Blitz'] = true
#==============================================================================
# ■ Input
#==============================================================================
module Input
#--------------------------------------------------------------------------
module_function
#--------------------------------------------------------------------------
def n_trigger?(num)
if trigger?(num)
return false
elsif trigger?(A) or trigger?(B) or trigger?(C) or
trigger?(X) or trigger?(Y) or trigger?(Z) or
trigger?(L) or trigger?(R) or
trigger?(UP) or trigger?(DOWN) or trigger?(RIGHT) or trigger?(LEFT)
return true
end
return false
end
#--------------------------------------------------------------------------
def key_converter(key)
if Atoa::Keyboard_Type
case key
when A
return 'Z'
when B
return 'X'
when C
return 'C'
when X
return 'A'
when Y
return 'S'
when Z
return 'D'
when L
return 'Q'
when R
return 'W'
end
else
case key
when A
return 'A'
when B
return 'B'
when C
return 'C'
when X
return 'X'
when Y
return 'Y'
when Z
return 'Z'
when L
return 'R'
when R
return 'L'
end
end
case key
when UP
return '↑'
when DOWN
return '↓'
when LEFT
return '←'
when RIGHT
return '→'
end
end
end
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
attr_accessor :blitz_flag
#--------------------------------------------------------------------------
alias atoa_initialize_blitz initialize
def initialize
atoa_initialize_blitz
@blitz_flag = false
end
#--------------------------------------------------------------------------
alias atoa_skill_effect_blitz skill_effect
def skill_effect(user, skill)
set_tatic_hp(user)
result = atoa_skill_effect_blitz(user, skill)
set_blitz_damage(user, skill)
return result
end
#--------------------------------------------------------------------------
def set_tatic_hp(user)
if $scene.is_a?(Scene_Battle) and user.blitz_flag
@hp_blitz = self.hp
@sp_blitz = self.sp
end
end
#--------------------------------------------------------------------------
def set_blitz_damage(user, skill)
if $scene.is_a?(Scene_Battle) and user.blitz_flag
self.damage = (self.damage * Blitz_Skill[skill.id][2]) / 100
self.hp = @hp_blitz - self.damage unless self.sp_damage
self.sp = @sp_blitz - self.damage if self.sp_damage
end
end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
alias atoa_update_phase4_step2_blitz update_phase4_step2
def update_phase4_step2
atoa_update_phase4_step2_blitz
@active_battler.blitz_flag = false
if @active_battler.actor? and @active_battler.current_action.kind == 1 and
Blitz_Skill[@active_battler.current_action.skill_id] != nil
if ($atoa_script['Atoa ATB'] or $atoa_script['Atoa CTB'])
return if Blitz_Aftercast and @active_battler.casting
return if !Blitz_Aftercast and !@active_battler.casting
end
result = make_blitz_result
if result and Blitz_Skill[@active_battler.current_action.skill_id][1]
blitz_fail_anime
@phase4_step = 6
if $atoa_script['Atoa ATB']
@active_battler.cast_action = nil
elsif $atoa_script['Atoa CTB']
@active_battler.cast_action = nil
@action_cost = No_Action_Cost
end
end
end
end
#--------------------------------------------------------------------------
def blitz_fail_anime
unless Input_Fail_Anim == 0
@active_battler.animation_id = Input_Fail_Anim
@active_battler.animation_hit = true
wait($data_animations[Input_Fail_Anim].frame_max * 2)
end
end
#--------------------------------------------------------------------------
def make_blitz_result
blitz_skill = Blitz_Skill[@active_battler.current_action.skill_id][0]
time = Key_Sec * blitz_skill.size * Graphics.frame_rate
key_count = 0
@active_battler.blitz_flag = true
case Input_Display_Position
when 0
actor_x = (@active_battler.index * 156) - (@active_battler.index * 38)
actor_y = 192
when 1
actor_x = (((640 / Max_Party) * ((4 - $game_party.actors.size)/2.0 + @active_battler.index)).floor) - (@active_battler.index * 40)
actor_y = 192
when 2
actor_x = Custom_Diplay_Postion[@active_battler.index][0]
actor_y = Custom_Diplay_Postion[@active_battler.index][0]
end
img = RPG::Cache.windowskin(Blitz_Bar_Name)
imgw = img.width
img.dispose
skill_name = $data_skills[ @active_battler.current_action.skill_id].name
window_keycount = Window_KeyCount.new(blitz_skill, @active_battler.name, skill_name)
window_counter = Window_KeyCounter.new(actor_x, actor_y + 80, imgw + 32, 64)
window_keycount.x = actor_x
window_keycount.y = actor_y
for i in 0...time
if Input.trigger?(blitz_skill[key_count])
key_count += 1
window_keycount.key_in(@active_battler.name, skill_name)
elsif Input.n_trigger?(blitz_skill[key_count])
break
end
if key_count >= blitz_skill.size
window_keycount.text_in(Input_Success_Message, @active_battler.name, skill_name)
Audio.se_play('Audio/SE/' + Input_Success_Sound)
@active_battler.blitz_flag = false
break
end
window_counter.refresh((i * imgw / time), imgw)
update_basic
end
if @active_battler.blitz_flag
window_keycount.text_in(Input_Fail_Message, @active_battler.name, skill_name)
Audio.se_play('Audio/SE/' + Input_Fail_Sound)
end
wait(10)
window_keycount.dispose
window_counter.dispose
return @active_battler.blitz_flag
end
end
#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
def draw_counter_bar(x, y, current)
bitmap = RPG::Cache.windowskin(Blitz_Bar_Name)
cw = bitmap.width
ch = bitmap.height / 2
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x, y, bitmap, src_rect)
cw = bitmap.width * current / bitmap.width
src_rect = Rect.new(0, ch, cw, ch)
self.contents.blt(x, y, bitmap, src_rect)
end
end
#==============================================================================
# ■ Window_KeyCounter
#==============================================================================
class Window_KeyCounter < Window_Base
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super(x, y, width, height)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
self.z = 4000
refresh(0, width - 32)
end
#--------------------------------------------------------------------------
def refresh(current, w)
self.contents.clear
draw_counter_bar(0, 0, current) if Bar_Advance_Type == 0
draw_counter_bar(0, 0, w - current) if Bar_Advance_Type == 1
end
end
#==============================================================================
# ■ Window_KeyCount
#==============================================================================
class Window_KeyCount < Window_Base
#--------------------------------------------------------------------------
def initialize(key, battler_name, skill_name)
super(0, 0, 280, 128)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = Base_Opacity
self.z = 4000
@key = key
@key_count = 0
refresh(battler_name, skill_name)
end
#--------------------------------------------------------------------------
def refresh(battler_name, skill_name)
self.contents.clear
self.contents.draw_text(0, 0, 240, 32, battler_name)
self.contents.font.color = system_color
self.contents.draw_text(0, 24, 240, 32, skill_name)
for i in
0...@key.size
x = i * 32
if i < @key_count
self.contents.font.color = knockout_color
else
self.contents.font.color = normal_color
end
self.contents.draw_text(x, 48, 100, 32, Input.key_converter(@key
))
end
end
#--------------------------------------------------------------------------
def key_in(battler_name, skill_name)
@key_count += 1
refresh(battler_name, skill_name)
end
#--------------------------------------------------------------------------
def text_in(text, battler_name, skill_name)
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(0, 0, 240, 32, battler_name)
self.contents.font.color = system_color
self.contents.draw_text(0, 24, 240, 32, skill_name)
self.contents.font.color = text == Input_Success_Message ? crisis_color : knockout_color
self.contents.draw_text(0, 48, 240, 32, text)
end
end