#====================================================
# Action Battle System 2
#------------------------------------------------------------------------------
#  It is the class which processes the title picture
#
# Script téléchargé sur RPG-création -
www.rpg-creation.com #====================================================
class Scene_Map
#--------------------------------------------------------------------------
# â—� Refer setup to Scene Map
#--------------------------------------------------------------------------
alias scene_map_main main
alias scene_map_update update
#--------------------------------------------------------------------------
# â—� Refers to Main
#--------------------------------------------------------------------------
def main
@on_map_diplay = Window_Mapstats.new
$ABS.display = Sprite.new
$ABS.display.bitmap = Bitmap.new(88, 48)
scene_map_main
$ABS.display.dispose
@on_map_diplay.dispose
end
#--------------------------------------------------------------------------
# â—� Refers to Update
#--------------------------------------------------------------------------
def update
@on_map_diplay.update
$ABS.update
if Input.trigger?(Input::L)
# Player Attack
if $ABS.player_defending == false
$ABS.player_melee_preconditions
end
end
if Input.press?(Input::R)
# Player Shield Active
$ABS.player_defending= true
else
# Player Sheild Disactive
$ABS.player_defending = false
end
if Input.trigger?(Input::X)
# Player Skill Hot Key 1
$ABS.player_skill_preconditions(1)
end
if Input.trigger?(Input::Y)
# Player Skill Hot Key 2
$ABS.player_skill_preconditions(2)
end
if Input.trigger?(Input::Z)
# Player Skill Hot Key 3
$ABS.player_skill_preconditions(3)
end
scene_map_update
end
end
#====================================================
# Window_Base
#------------------------------------------------------------------------------
# Adds Draw line function, Draw Hp, Draw Sp, Draw Exp,
# Adds Draw Actors Battler, Refines Draw Text Actors Level
#====================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# â—� The drawing of HP
# actor : actor
# x : Ahead drawing X coordinate
# y : Ahead drawing Y-coordinate
# width : Width ahead drawing
#--------------------------------------------------------------------------
def draw_actor_hp_text(actor, x, y, width = 144)
# Character string "HP" It draws
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
# Calculates is a space which draws MaxHP
if width - 32 >= 108
hp_x = x + width - 108
flag = true
elsif width - 32 >= 48
hp_x = x + width - 48
flag = false
end
# Drawing HP
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.draw_text(hp_x, y, 40, 32, actor.hp.to_s, 2)
# Drawing MaxHP
if flag
self.contents.font.color = normal_color
self.contents.draw_text(hp_x + 40, y, 12, 32, "/", 1)
self.contents.draw_text(hp_x + 52, y, 48, 32, actor.maxhp.to_s)
end
end
#--------------------------------------------------------------------------
# â—� The drawing of SP
# actor : actor
# x : Ahead drawing X coordinate
# y : Ahead drawing Y-coordinate
# width : Width ahead drawing
#--------------------------------------------------------------------------
def draw_actor_sp_text(actor, x, y, width = 144)
# Character string "sP" It draws
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
# Calculates is a space which draws MaxSP
if width - 32 >= 108
sp_x = x + width - 108
flag = true
elsif width - 32 >= 48
sp_x = x + width - 48
flag = false
end
# Drawing HP
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
self.contents.draw_text(sp_x, y, 40, 32, actor.sp.to_s, 2)
# Drawing MaxHP
if flag
self.contents.font.color = normal_color
self.contents.draw_text(sp_x + 40, y, 12, 32, "/", 1)
self.contents.draw_text(sp_x + 52, y, 48, 32, actor.maxsp.to_s)
end
end
#--------------------------------------------------------------------------
# â—� Draws Actors Hp meter
#--------------------------------------------------------------------------
def draw_actor_hp_bar(actor, x, y, width = 100, height = 10, bar_color = Color.new(255, 0, 0, 255))
self.contents.fill_rect(x, y, width, height, Color.new(255, 255, 255, 100))
w = width * actor.hp / actor.maxhp
for i in 0..height
r = bar_color.red * (height -i)/height + 0 * i/height
g = bar_color.green * (height -i)/height + 0 * i/height
b = bar_color.blue * (height -i)/height + 0 * i/height
a = bar_color.alpha * (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w , 1, Color.new(r, g, b, a))
end
end
#--------------------------------------------------------------------------
# â—� Draws Actors Sp meter
#--------------------------------------------------------------------------
def draw_actor_sp_bar(actor, x, y, width = 100, height = 10, bar_color = Color.new(0, 0, 255, 255))
self.contents.fill_rect(x, y, width, height, Color.new(255, 255, 255, 100))
w = width * actor.sp / actor.maxsp
for i in 0..height
r = bar_color.red * (height -i)/height + 0 * i/height
g = bar_color.green * (height -i)/height + 0 * i/height
b = bar_color.blue * (height -i)/height + 0 * i/height
a = bar_color.alpha * (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w , 1, Color.new(r, g, b, a))
end
end
#--------------------------------------------------------------------------
# â—� Draws Actors Exp meter
#--------------------------------------------------------------------------
def draw_actor_exp_bar(actor, x, y, width = 100, height = 10, bar_color = Color.new(255, 255, 0, 255))
self.contents.fill_rect(x, y, width, height, Color.new(255, 255, 255, 100))
if actor.level == 99
w = 0
else
w = width * actor.exp / actor.next_exp_s.to_f
end
for i in 0..height
r = bar_color.red * (height -i)/height + 0 * i/height
g = bar_color.green * (height -i)/height + 0 * i/height
b = bar_color.blue * (height -i)/height + 0 * i/height
a = bar_color.alpha * (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w , 1, Color.new(r, g, b, a))
end
end
#--------------------------------------------------------------------------
# â—� Draws Actors Str meter
#--------------------------------------------------------------------------
def draw_actor_str_bar(actor, i, x, y, width = 100, height = 10, bar_color = Color.new(255, 0, 0, 255))
self.contents.fill_rect(x, y, width, height, Color.new(255, 255, 255, 100))
w = width * actor.str / 999
for i in 0..height
r = bar_color.red * (height -i)/height + 0 * i/height
g = bar_color.green * (height -i)/height + 0 * i/height
b = bar_color.blue * (height -i)/height + 0 * i/height
a = bar_color.alpha * (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w , 1, Color.new(r, g, b, a))
end
end
#--------------------------------------------------------------------------
# â—� Draws Actors Dex meter
#--------------------------------------------------------------------------
def draw_actor_dex_bar(actor, i, x, y, width = 100, height = 10, bar_color = Color.new(0, 255, 0, 255))
self.contents.fill_rect(x, y, width, height, Color.new(255, 255, 255, 100))
w = width * actor.dex / 999
for i in 0..height
r = bar_color.red * (height -i)/height + 0 * i/height
g = bar_color.green * (height -i)/height + 0 * i/height
b = bar_color.blue * (height -i)/height + 0 * i/height
a = bar_color.alpha * (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w , 1, Color.new(r, g, b, a))
end
end
#--------------------------------------------------------------------------
# â—� Draws Actors Agi meter
#--------------------------------------------------------------------------
def draw_actor_agi_bar(actor, i, x, y, width = 100, height = 10, bar_color = Color.new(0, 0, 255, 255))
self.contents.fill_rect(x, y, width, height, Color.new(255, 255, 255, 100))
w = width * actor.agi / 999
for i in 0..height
r = bar_color.red * (height -i)/height + 0 * i/height
g = bar_color.green * (height -i)/height + 0 * i/height
b = bar_color.blue * (height -i)/height + 0 * i/height
a = bar_color.alpha * (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w , 1, Color.new(r, g, b, a))
end
end
#--------------------------------------------------------------------------
# â—� Draws Actors Int meter
#--------------------------------------------------------------------------
def draw_actor_int_bar(actor, i, x, y, width = 100, height = 10, bar_color = Color.new(180, 100, 200, 255))
self.contents.fill_rect(x, y, width, height, Color.new(255, 255, 255, 100))
w = width * actor.int / 999
for i in 0..height
r = bar_color.red * (height -i)/height + 0 * i/height
g = bar_color.green * (height -i)/height + 0 * i/height
b = bar_color.blue * (height -i)/height + 0 * i/height
a = bar_color.alpha * (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w , 1, Color.new(r, g, b, a))
end
end
#--------------------------------------------------------------------------
# â—� Draws Dash Power bar
#--------------------------------------------------------------------------
def draw_dash_bar(x, y, width = 50, height = 10)
self.contents.fill_rect(x, y, width, height, Color.new(255, 255, 255, 100))
case $ABS.dash_level
when 0 .. 1
bar_color = Color.new(255, 0, 0, 255)
when 2 .. 3
bar_color = Color.new(255, 255, 0, 255)
else
bar_color = Color.new(0, 255, 0, 255)
end
w = width * $ABS.dash_level / 5
for i in 0..height
r = bar_color.red * (height -i)/height + 0 * i/height
g = bar_color.green * (height -i)/height + 0 * i/height
b = bar_color.blue * (height -i)/height + 0 * i/height
a = bar_color.alpha * (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w , 1, Color.new(r, g, b, a))
end
end
#--------------------------------------------------------------------------
# â—� Draws Actors Battler
#--------------------------------------------------------------------------
def draw_actor_battler(actor, x, y)
bitmap = RPG::Cache.battler(actor.character_name, actor.character_hue)
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end
end