[tag]Code:
#===============================================================================
# ---> XIDEROWG ACTION SYSTEM) <---
# (XRXS64 Self Action System)
#===============================================================================
# By Xiderowg / ?? ??
#
http://xms.rdy.jp/#
http://scriptshelf.jpn.org/x/#===============================================================================
# Hero Edition -> Support / Updates / Add-ons / Tutorial
#
http://www.atelier-rgss.com/RGSS/Battle/XAS_00.html#===============================================================================
#English Version - translated by Joaocarlos
#===============================================================================
# XAS - System Config
#===============================================================================
module XAS_COMMAND
#Keyboard configuration.
#-------Button--------#
# A B C X Y Z L R #
#-------Keyboard------# O equivalente no teclado.
# Z B C A S D Q W # (modo Default)
#---------------------#
#Use skill.
SKILL_ACTION = Input::Y
#Change the skill in the map.
SKILL_CHANGE = Input::R
#Use Item.
ITEM_ACTION = Input::Z
#Change the Item in the map.
ITEM_CHANGE = Input::L
#Attack with weapon.
SLASH_ACTION = Input::C
#Use sheild.
SHIELD_ACTION = Input::A
end
##############
# HUD_CONFIG #
##############
module XAS_HUD
#Items and Skills windows position.
WINDOW_SKILL_X = 550
WINDOW_SKILL_Y = 370
WINDOW_ITEM_X = 480
WINDOW_ITEM_Y = 370
#Switch ID that deactivates the window
HIDE_WINDOW = 5
end
module XAS_BA
# Sound selected when the character obtains damage
HERO_HIT_SE = RPG::AudioFile.new("Mana - Duran_Hit", 100, 100)
#-------------------------------------------------------------------------------
# Specified animation to tool damage.
# ATTACK_ANI_HIT = {A=>B,A=>B...}
# A = Tool ID.
# B = Animation ID.
ATTACK_ANI_HIT = {
# A B
1=>14, #Bronze Sword
2=>27, #Fire Sword
3=>45, #Light Sword
15=>27, #Fire Ball
20=>30 #Ice Cloud
}
#-------------------------------------------------------------------------------
# Default animation when it’s not specified.
DEFAULT_ATTACK_ANI_HIT = 4
#-------------------------------------------------------------------------------
# Skills that will make the map shake in the HIT moment.
# (Put the Tool ID )
ATTACK_SKILL_SHAKE = [
14, #Bomb
16, #Thunder
18, #Fire Fist
21, #Illumina
23, #Cross Cut
24, #Chidori
25, #Ultima Wind
32, #Bomb Enemy
34, #Bronze Shield - Left Hand
35 #Heal Shield - Left Hand
]
#-------------------------------------------------------------------------------
# Shake definition.
SH_POWER = 5 #Poder (Força)
SH_SPEED = 10 #Velocidade
SH_DUR = 20 #Duração(20 = 1 segundo)
#-------------------------------------------------------------------------------
# Activate JUMP HIT, the character will hop when gets damage .
JUMP_HIT_HERO = true
#-------------------------------------------------------------------------------
# Enemies that will not have the animation hop when gets HIT
JUMP_HIT_ENEMY_DISABLE = [
8, # Great Bird
9 # Great Bird L2
]
#-------------------------------------------------------------------------------
# Variable ID that will define the
# action activation arena.
SENSOR_VAR = 10
#-------------------------------------------------------------------------------
# Tool that will be activated when a weapon is equipped
# a weapon is equipped
#
# WEP_ID_TOOL = { A=>B, A=>B, ...}
#
# A = Weapon ID
# B = Tool ID
WEP_ID_TOOL = {
# A B Weapon Name
1=>1, # Bronze Sword
2=>2, # Fire Sword
3=>3, # Light Sword
4=>4, # Dwarf Axe
5=>5, # Wizard Staff
6=>6, # Elf Bow
7=>7 # Disc
}
#-------------------------------------------------------------------------------
# Secondary equipment definition
# In this case is SHIELD function.
#
# SECOND_HAND_ID_TOOL = { A=>B, A=>B, ...}
# A=>B
#
# A = Armor ID (SHIELD function).
# B = Tool ID.
SECOND_HAND_ID_TOOL = {
# A B Armor Name
1=>34, #Bronze Shield.
4=>35 #Heal Shield.
}
#-------------------------------------------------------------------------------
# Activate automatic gameover when character dies.
AUTOGAMEOVER = true
#-------------------------------------------------------------------------------
# Switch IDthat will be activated character dies.
# (only when the AUTOGAMEOVER option is False)
GAMEOVER_SWITCH_ID = 4
#-------------------------------------------------------------------------------
# Make character blink when HIT.
# (The blink duration is the some duration as the invisibility.)
BLINK_ON = false
#-------------------------------------------------------------------------------
# Invisibility duration when HIT.
INVICIBLE_DURATION_HERO = 35
#-------------------------------------------------------------------------------
# Time that the character will be paralyze when HIT.
KNOCK_BACK_DURATION_HERO = 30
#-------------------------------------------------------------------------------
# Default time that the enemy will be paralyze and invisible
# when HIT.
DEFAULT_INVICIBLE_DURATION_ENEMY = 60
#-------------------------------------------------------------------------------
# Specific time that the enemy will be paralyze and invisible
# when HIT .
#
# A=>B
#
# A = Enemy ID (Troop enemy ID).
# B = Invisibility time.
INVICIBLE_DURATION_ENEMY = {
# A B
1=>1, #TRAP ENEMY.
2=>45, #Sahagin.
5=>30, #Honeyman.
6=>140 #ARCHER.
}
#-------------------------------------------------------------------------------
# Hop speed when battler is HIT.
# (Hero and enemy)
KNOCK_BACK_SPEED = 5
#-------------------------------------------------------------------------------
# ME when Level Up.
LEVEL_UP_ME = RPG::AudioFile.new("007-Fanfare01")
#-------------------------------------------------------------------------------
# SE when pick of from the ground an item.
ITEMDROP_SE = RPG::AudioFile.new("056-Right02", 70, 140)
#-------------------------------------------------------------------------------
# SE when Shield function is activated.
SHIELD_SE = RPG::AudioFile.new("097-Attack09", 80, 150)
#-------------------------------------------------------------------------------
# Texto when Shield function is activated.
SHIELD_TEXT = "Guard"
#-------------------------------------------------------------------------------
# Animation ID when Shield function is activated.
SHIELD_ANI = 64
#-------------------------------------------------------------------------------
end
#===============================================================================
# XAS - Item Config
#===============================================================================
module XAS
# Definição das ferramentas que correspondem os itens
# no banco de dados.
#
# A=>B
#
# A = ID da ferramenta.
# B = ID do item no banco de dados.
ITEM_COST = {
# A / B Name
8=>1, #Potion.
9=>2, #Hi Potion.
10=>3, #Ether.
11=>4, #Hi Ether.
12=>5, #Remedy.
13=>6, #Elixir.
14=>7, #Bomb.
6=>8 #Elf Bow(Arrow)
}
end
#===============================================================================
# XAS - Enemy Config
#===============================================================================
module XAS_BA_ENEMY
#Activate animation when enemy dies.
#The animation duration is proportional to the collapse time
#to the collapse time, default is 40Frames(2s).
# DEF_ANI = {A=>B, A=>B, A=>B...}
# A = Enemy ID
# B = Animation ID
DEF_ANI = {
2=>119, #Fishman
3=>121, #Chibi Devil
4=>122, #Scorpion
5=>120, #Honeyman
6=>119, #Archer
7=>121, #Knight
8=>122, #Great Bird (Boss)
9=>122 #Great Bird L2(Boss)
}
#-------------------------------------------------------------------------------
# Defection of the enemy that will be invulnerable to one side.
#
# A=>
#
# A = Enemy ID
# B = Invulnerable direction side.
#
#(2 = Frontal defense.)
#(4 = Left defense.)
#(6 = Right defense.)
#(8 = Back defense.)
SHILED_DIRECTIONS = {
1=>[2,4,6,8], # Trap Enemy
7=>[2] # Knight
}
#-------------------------------------------------------------------------------
# Tools that the enemy will be invulnerable.
#
# A=>[B,B,B,B,B,B...]
#
# A = Enemy ID
# B = Tool ID that will not have effect on the enemy.
SHILED_ACTIONS = {
2=>[28,33], # Sahagin
3=>[28,33], # Chibi Devil
4=>[1,2,3,4,5,6,7,15,16,17,18,19,20,23,33,34,35], # Scorpion
5=>[28,33], # Honeman
6=>[28,33], # Archer
7=>[28,33], # Knight
8=>[6,15,16,17,18,19,20,23,34,35], # Great Bird (Boss)
9=>[6,15,16,17,18,19,20,23,34,35] # Great Bird L2(Boss)
}
#-------------------------------------------------------------------------------
# Enemy that have hop when HIT deactivated.
KNOCK_BACK_DISABLES = [
1, # Trap Enemy
4, # Scorpion
8, # Great Bird
9 # Great Birt L2
]
#-------------------------------------------------------------------------------
# Enemy extra impact area size.
#
# BODY_SQUARE = {A=>B, A=>B, A=>B...}
#
# A = Enemy ID
# B = Enemy extra impact area size.
BODY_SQUARE = {}
#-------------------------------------------------------------------------------
# Automatic Switches activation when enemy dies.
#
# A=>B
#
# A = Enemy ID
# B = Switch ID that will be activated when enemy dies.
DEFEAT_SWITCH_IDS = {
8=>57, #Great Bird - End of tutorial.
9=>57 #Great Bird L2 - End of tutorial.
}
end
#===============================================================================
# XAS - Map tool customization.
#===============================================================================
module XAS
# ID da variável de impacto de Ferramentas.
HIT_ID = 3
# ID do mapa onde fica ficarão os eventos de ferramentas.
ACTION_TEMPLATE_MAP_ID = 1
end
#===============================================================================
# XAS - Customizações gerais de evento.
#===============================================================================
module XAS_BA
# Variable that defines the enemy ID.
ENEMY_ID_VARIABLE_ID = 4
# Sensor that defines the action enemy page.
SENSOR_SELF_SWITCH = "D"
# Variable that registers the number of enemy slay.
DEFEAT_NUMBER_ID = 999
end
#===============================================================================
# XAS - SCENE_SKILL_AX
#===============================================================================
module XAS_WINDOW_SKILL
#Text when Skill is equipped.
EQUIPPED = "Equipado"
#Indicial help Text.
PRESS = "Pressione C para Equipar"
#Button to equipped skill.
BUTTON = Input::C
#To activate profit of Tools through the profit of skill
#for level and through the addition and removal of Skill being used
#the command of events. (Only with the button change Activated.)
LVGAINGOOD = false
end
#===============================================================================
# XAS - SCENE_ITEM_AX
#===============================================================================
module XAS_WINDOW_ITEM
#Definição da ID do item que ativará a Ferramenta ID.
# XASITEM_ID = {A=>B, A=>B,...}
# A = Item ID
# B = Tool ID
XASITEM_ID = {
# A B Item name
1=>8, # Potion
2=>9, # HI-Potion
3=>10, # Ether
4=>11, # HI-Ether
5=>12, # Remedy
6=>13, # Elixir
7=>14 # Bomb
}
#Text when Item is equipped.
EQUIPPED = "Equipped"
#Indicial help Text.
PRESS = "Pressione C para Equipar"
#Button to equip Item.
BUTTON = Input::C
end
#===============================================================================
#===============================================================================
# XAS EX - SYSTEM (XRXS64 Self Action System)
#===============================================================================
$xrxs = {} if $xrxs == nil
$xrxs["xas"] = true
$mogscript = {} if $mogscript == nil
################
# RPG_FileTest #
################
module RPG_FileTest
def RPG_FileTest.character_exist?(filename)
return RPG::Cache.character(filename, 0) rescue return false
end
def RPG_FileTest.picture_exist?(filename)
return RPG::Cache.picture(filename) rescue return false
end
def RPG_FileTest.battler_exist?(filename)
return RPG::Cache.battler(filename, 0) rescue return false
end
end
#######
# L14 #
#######
class Bitmap
def draw_hemming_text(x, y, w, h, text, align = 0)
original_color = self.font.color.dup
self.font.color = Color.new(0,0,0,255)
self.draw_text(x , y , w, h, text, align)
self.draw_text(x , y+2, w, h, text, align)
self.draw_text(x+2, y+2, w, h, text, align)
self.draw_text(x+2, y , w, h, text, align)
self.font.color = original_color
self.draw_text(x+1, y+1, w, h, text, align)
end
end
module RPG_FileTest
def RPG_FileTest.character_exist?(filename)
return RPG::Cache.character(filename, 0) rescue return false
end
def RPG_FileTest.picture_exist?(filename)
return RPG::Cache.picture(filename) rescue return false
end
def RPG_FileTest.battler_exist?(filename)
return RPG::Cache.battler(filename, 0) rescue return false
end
end
class Sprite_Number < Sprite
attr_reader :w
def initialize(font = Font.new)
super()
self.bitmap = Bitmap.new(1,1)
self.bitmap.font = font
max = s = 0
for i in 0..9
s = self.bitmap.text_size(i.to_s).width
max = s if max < s
end
@w = max + 2
@h = font.size + 2
self.bitmap.dispose
self.bitmap = Bitmap.new(@w, @h * 10)
self.bitmap.font = font
(0..9).each {|n| self.bitmap.draw_hemming_text(0, @h * n, @w, @h, n.to_s) }
self.src_rect.height /= 10
end
def number=(n)
self.src_rect.y = n * @h
end
def n=(n)
self.number = n
end
end
class Spriteset_Numbers
attr_reader :x
attr_reader :y
attr_reader :z
attr_reader :visible
def initialize(font = Font.new)
@font = font
@numbers = []
@x = 0
@y = 0
@z = 0
@visible = true
end
def number=(n)
@numbers.each{|number| number.n = 10 }
d = (n == 0 ? 0 : Math.log10(n).to_i)
for i in 0..d
@numbers = Sprite_Number.new(@font) if @numbers == nil
@numbers.n = n % 10
@numbers.visible = true
n /= 10
end
self.x = self.x
self.y = self.y
self.z = self.z
end
def n=(n)
self.number=(n)
end
def x=(n)
@x = n
for i in 0...@numbers.size
@numbers.x = n
n -= @numbers.w
end
end
def y=(n)
@y = n
@numbers.each{|sprite| sprite.y = @y }
end
def z=(n)
@z = n
@numbers.each{|sprite| sprite.z = @z }
end
def visible=(b)
@visible = b
@numbers.each{|sprite| sprite.visible = b }
end
def dispose
@numbers.each{|sprite| sprite.dispose }
end
end
#################
# Sprite_Number #
#################
class Sprite_Number < Sprite
attr_reader :w
def initialize(font = Font.new)
super()
self.bitmap = Bitmap.new(1,1)
self.bitmap.font = font
max = s = 0
for i in 0..9
s = self.bitmap.text_size(i.to_s).width
max = s if max < s
end
@w = max + 2
@h = font.size + 2
self.bitmap.dispose
self.bitmap = Bitmap.new(@w, @h * 10)
self.bitmap.font = font
(0..9).each {|n| self.bitmap.draw_hemming_text(0, @h * n, @w, @h, n.to_s) }
self.src_rect.height /= 10
end
def number=(n)
self.src_rect.y = n * @h
end
def n=(n)
self.number = n
end
end
class Spriteset_Numbers
attr_reader :x
attr_reader :y
attr_reader :z
attr_reader :visible
def initialize(font = Font.new)
@font = font
@numbers = []
@x = 0
@y = 0
@z = 0
@visible = true
end
def number=(n)
@numbers.each{|number| number.n = 10 }
d = (n == 0 ? 0 : Math.log10(n).to_i)
for i in 0..d
@numbers = Sprite_Number.new(@font) if @numbers == nil
@numbers.n = n % 10
@numbers.visible = true
n /= 10
end
self.x = self.x
self.y = self.y
self.z = self.z
end
def n=(n)
self.number=(n)
end
def x=(n)
@x = n
for i in 0...@numbers.size
@numbers.x = n
n -= @numbers.w
end
end
def y=(n)
@y = n
@numbers.each{|sprite| sprite.y = @y }
end
def z=(n)
@z = n
@numbers.each{|sprite| sprite.z = @z }
end
def visible=(b)
@visible = b
@numbers.each{|sprite| sprite.visible = b }
end
def dispose
@numbers.each{|sprite| sprite.dispose }
end
end
#########
# Lib15 #
#########
class Game_Map
attr_accessor :need_refresh_token
def need_add_tokens
@need_add_tokens = [] if @need_add_tokens == nil
return @need_add_tokens
end
def need_remove_tokens
@need_remove_tokens = [] if @need_remove_tokens == nil
return @need_remove_tokens
end
def add_token(token_event)
@events[token_event.id] = token_event
self.need_add_tokens.push(token_event)
self.need_refresh_token = true
end
def remove_token(token_event)
@events.delete(token_event.id)
self.need_remove_tokens.push(token_event)
self.need_refresh_token = true
end
def clear_tokens
for event in @events.values.dup
remove_token(event) if event.is_a?(Token_Event)
end
channels = ["A", "B", "C", "D"]
for id in 1001..(token_id_shift - 1)
for a in channels
key = [self.map_id, id, a]
$game_self_switches.delete(key)
end
end
clear_token_id
end
end
class Game_SelfSwitches
def delete(key)
@data.delete(key)
end
end
class Game_Map
def token_id_shift
@token_id = 1000 if @token_id == nil
@token_id += 1
return @token_id
end
def clear_token_id
@token_id = nil
end
end
module XRXS_CTS_RefreshToken
def refresh_token
for event in $game_map.need_add_tokens
@character_sprites.push(Sprite_Character.new(@viewport1, event))
end
$game_map.need_add_tokens.clear
for sprite in @character_sprites.dup
if $game_map.need_remove_tokens.empty?
break
end
if $game_map.need_remove_tokens.delete(sprite.character)
@character_sprites.delete(sprite)
sprite.dispose
end
end
$game_map.need_refresh_token = false
end
end
class Spriteset_Map
include XRXS_CTS_RefreshToken
alias xrxs_lib15_update update
def update
xrxs_lib15_update
refresh_token if $game_map.need_refresh_token
end
end
class Scene_Map
alias xrxs_lib15_transfer_player transfer_player
def transfer_player
$game_map.clear_tokens
xrxs_lib15_transfer_player
end
end
class Token_Event < Game_Event
def initialize(map_id, event)
event.id = $game_map.token_id_shift
super
end
def erase
super
$game_map.remove_token(self)
end
end
##############
# Token Mech #
##############
module XRXS_ActionTemplate
map_id = XAS::ACTION_TEMPLATE_MAP_ID
map = load_data(sprintf("Data/Map%03d.rxdata", map_id))
@@events = map.events
end
class Token_Event < Game_Event
include XRXS_ActionTemplate
end
class Game_Temp
attr_accessor :active_token
end
module XAS_ACTION
attr_reader :action
attr_reader :erased
def shoot(action_id)
return if action_id == 0
item_id = XAS::ITEM_COST[action_id]
if item_id != nil and $game_party.item_number(item_id) == 0
$game_system.se_play($data_system.buzzer_se)
return
end
self.action_attachment(action_id)
n = 1
@action.prelag = n
skill_id = action_id
skill = skill_id == nil ? nil : $data_skills[skill_id]
sp_cost = skill.sp_cost
if self.battler.sp < sp_cost
m = 1
else
m = Database_Bullet::SUFLAGS[action_id].to_i
end
@action.duration = m
end
def action_attachment(action_id)
@action = Game_Action.new(self, action_id)
@action.attachment(action_id)
plan = Database_Bullet::SELF_ANIMATION_PLANS[action_id]
@self_animation_plan = plan.nil? ? nil : plan.dup
end
def action_update
return unless @action.is_a?(Game_Action)
if @self_motion != nil
self.character_name_suffix = @self_motion
@pattern = 0
@pattern_count = 0
@self_motion = nil
if self.is_a?(Game_Player)
@step_anime = true
end
end
if @self_animation_plan != nil
animation_id = @self_animation_plan[@action.now_count]
self.animation_id = animation_id unless animation_id.nil?
end
if @action.prelag > 0
@action.prelag -= 1
self.shoot_bullet(@action.id) if @action.prelag == 0
return
end
@action.update
end
def check_event_trigger_attack()
if $game_system.map_interpreter.running?
return
end
if @action.nil? or @action.attack_id == 0
return
end
hit_check = false
range = @action.attack_range
hit = []
targets = [$game_player] + (@action.player_damage ? [] : $game_map.events.values)
for event in targets
next if event == self or
@action.hit_events.include?(event) or
event.jumping? or event.erased
body_size = event.body_size
event_center_x = event.x
event_center_y = event.y - body_size
dx = event_center_x - self.x
dy = event_center_y - self.y
dx = (dx >= 0 ? [dx - body_size, 0].max : [dx + body_size, 0].min)
dy = (dy >= 0 ? [dy - body_size, 0].max : [dy + body_size, 0].min)
case @action.attack_range_type
when Map::RHOMBUS
hit_check = (dx.abs + dy.abs <= range)
when Map::SQUARE
hit_check = (dx.abs <= range and dy.abs <= range)
when Map::LINE
case self.direction
when 2
hit_check = (dx == 0 and dy >= 0 and dy <= range)
when 8
hit_check = (dx == 0 and dy <= 0 and dy >= -range)
when 6
hit_check = (dy == 0 and dx >= 0 and dx <= range)
when 4
hit_check = (dy == 0 and dx <= 0 and dx >= -range)
end
end
hit.push(event) if hit_check
hit_check = false
end
for event in hit
if event.action_effect(self, self.action.attack_id)
hit_check = true
end
@action.hit_events.push(event)
end
if hit_check
$game_temp.active_token = self
end
end
def action_effect(attacker, attack_id)
return false unless self.is_a?(Game_Event)
for page in @event.pages
if page.condition.variable_valid and
page.condition.variable_id == XAS::HIT_ID and
page.condition.variable_value == attack_id
self.reaction_valid_attack_id = attack_id
self.refresh
@trigger = 0
self.start
return true
end
end
return false
end
def shoot_bullet(action_id)
return false if action_id == 0
item_id = XAS::ITEM_COST[action_id]
if item_id != nil
$game_party.lose_item(item_id, 1)
$game_temp.item_refresh = true
if $mogscript["mpequip"] == true
$eref = true
end
end
bullet_token = Token_Bullet.new(self, action_id)
$game_map.add_token(bullet_token)
@self_motion = Database_Bullet::SELF_MOTIONS[action_id]
return bullet_token
end
def body_size
return 0
end
def action_clear
@action = nil
self.character_name_suffix = nil
end
end
class Game_Character
include XAS_ACTION
end
module XAS_Dispose
def update
action_update
super
if @action.is_a?(Game_Action) and @action.done?
self.action_clear
if self.is_a?(Game_Player)
@step_anime = false
end
end
end
end
class Game_Player < Game_Character
include XAS_Dispose
end
class Game_Event < Game_Character
include XAS_Dispose
end
module XAS_CharacterName_Suffix
def character_name
character_name = super
file_name = character_name + self.character_name_suffix.to_s
character_name = file_name if RPG_FileTest.character_exist?(file_name)
return character_name
end
attr_accessor :character_name_suffix
end
class Game_Player < Game_Character
include XAS_CharacterName_Suffix
end
class Game_Event < Game_Character
include XAS_CharacterName_Suffix
end
module XAS_StopToAction
def acting?
return self.action != nil
end
def moving?
return (super or self.acting?)
end
end
class Game_Player < Game_Character
include XAS_StopToAction
end
class Interpreter
alias xrxs64_command_end command_end
def command_end
@list = nil
event = $game_map.events[@event_id]
return if event == nil
if event.reaction_valid_attack_id
event.reaction_valid_attack_id = nil
event.refresh
end
xrxs64_command_end
end
end
class Game_Event < Game_Character
attr_accessor :reaction_valid_attack_id
def refresh
new_page = nil
unless @erased
for page in @event.pages.reverse
c = page.condition
if c.switch1_valid
if $game_switches[c.switch1_id] == false
next
end
end
if c.switch2_valid
if $game_switches[c.switch2_id] == false
next
end
end
if c.variable_valid
if c.variable_id == XAS::HIT_ID and
c.variable_value == self.reaction_valid_attack_id
elsif $game_variables[c.variable_id] < c.variable_value
next
end
end
if c.self_switch_valid
key = [@map_id, @event.id, c.self_switch_ch]
if $game_self_switches[key] != true
next
end
end
new_page = page
break
end
end
if new_page == @page
return
end
@page = new_page
clear_starting
if @page == nil
@tile_id = 0
@character_name = ""
@character_hue = 0
@move_type = 0
@through = true
@trigger = nil
@list = nil
@interpreter = nil
return
end
@tile_id = @page.graphic.tile_id
@character_name = @page.graphic.character_name
@character_hue = @page.graphic.character_hue
if @original_direction != @page.graphic.direction
@direction = @page.graphic.direction
@original_direction = @direction
@prelock_direction = 0
end
if @original_pattern != @page.graphic.pattern
@pattern = @page.graphic.pattern
@original_pattern = @pattern
end
@opacity = @page.graphic.opacity
@blend_type = @page.graphic.blend_type
@move_type = @page.move_type
@move_speed = @page.move_speed
@move_frequency = @page.move_frequency
@move_route = @page.move_route
@move_route_index = 0
@move_route_forcing = false
@walk_anime = @page.walk_anime
@step_anime = @page.step_anime
@direction_fix = @page.direction_fix
@through = @page.through
@always_on_top = @page.always_on_top
@trigger = @page.trigger
@list = @page.list
@interpreter = nil
if @trigger == 4
@interpreter = Interpreter.new
end
check_event_trigger_auto
end
end
class Game_Action
attr_reader :id
attr_accessor :prelag
attr_accessor :attack_id
attr_reader :attack_range
attr_reader :attack_range_type
attr_accessor :user
attr_reader :hit_events
attr_accessor :now_count
attr_reader :final_mark
attr_accessor :duration
attr_reader :blow_power
attr_reader :piercing
attr_reader :player_damage
attr_reader :ignore_invincible
def initialize(user, action_id)
@user = user
@id = action_id
@prelag = 0
@now_count = 0
@duration = nil
@attack_id = 0
@attack_range= 0
@hit_events = []
@blow_power = 0
end
def attachment(action_id)
@duration = Database_Bullet::DURATIONS[action_id]
power = Database_Bullet::BLOW_POWERS[action_id]
@blow_power = power == nil ? 1 : power
@attack_id_plan = Database_Bullet::ATTACK_ID_PLANS[action_id]
@attack_range_type = Database_Bullet::ATTACK_RANGE_TYPES[action_id]
plan = Database_Bullet::ATTACK_RANGE_PLANS[action_id]
@attack_range_plan = plan.nil? ? nil : plan.dup
@self_damage = Database_Bullet::SELF_DAMAGES[self.id]
@player_damage = Database_Bullet::PLAYER_DAMAGES[action_id]
@ignore_invincible = Database_Bullet::IGNORE_INVINCIBLES[action_id]
end
def update
if @attack_id_plan != nil
id = @attack_id_plan[@now_count]
unless id.nil?
@attack_id = id
@hit_events.clear
@hit_events.push(self.user) unless @self_damage
end
end
if @attack_range_plan != nil
range = @attack_range_plan[@now_count]
@attack_range = range unless range.nil?
end
@now_count += 1
end
def done?
return (self.duration.to_i > 0 and self.now_count >= self.duration)
end
end
class Token_Bullet < Token_Event
def initialize(user, action_id)
original_event = @@events[action_id]
return if original_event == nil
event = original_event.dup
event.x = user.x
event.y = user.y
event.pages[0].graphic.direction = user.direction
@character_name = event.pages[0].graphic
super($game_map.map_id, event)
self.action_attachment(action_id)
@action.user = user
@remain_for_an_act = @action.duration.is_a?(Numeric)
end
def update
super
erase if @action == nil and @remain_for_an_act
check_event_trigger_attack
end
end
module Map
RHOMBUS = 1
SQUARE = 2
LINE = 3
end
module Database_Bullet
include Map
EVENTS = []
EVENT_IDS = []
DURATIONS = []
PRELAGS = []
SUFLAGS = []
FINALIZE_MARKS = []
ATTACK_ID_PLANS = []
ATTACK_RANGE_TYPES = []
ATTACK_RANGE_PLANS = []
BLOW_POWERS = []
SELF_MOTIONS = []
SELF_ANIMATION_PLANS = []
PIERCINGS = []
SELF_DAMAGES = []
PLAYER_DAMAGES = []
IGNORE_INVINCIBLES = []
end
#===============================================================================
# XAS - Character damage pop mechanism
#===============================================================================
module XRXS_DAMAGE_OFFSET
def update
super
@damage_sprites = [] if @damage_sprites.nil?
for damage_sprite in @damage_sprites
damage_sprite.x = self.x
damage_sprite.y = self.y
end
end
end
class Sprite_Character < RPG::Sprite
include XRXS_DAMAGE_OFFSET
end
class Game_Character
attr_accessor :collapse_duration
attr_accessor :battler_visible
attr_writer :opacity
attr_accessor :collapse_done
end
module XRXS_CharacterDamagePop
def update
super
if @battler == nil
return
end
if @character.collapse_duration != nil
if @character.collapse_duration > 0
collapse
end
@_collapse_duration = @character.collapse_duration
end
@battler_visible = @character.battler_visible
@battler_visible = true if @battler_visible == nil
if @battler.damage_pop
damage(@battler.damage, @battler.critical)
@battler.damage = nil
@battler.critical = false
@battler.damage_pop = false
end
unless @battler_visible
if not @battler.hidden and not @battler.dead? and
(@battler.damage == nil or @battler.damage_pop)
appear
@battler_visible = true
end
end
if @battler_visible
if @battler.damage == nil and @battler.dead?
if @battler.is_a?(Game_Enemy)
$game_system.se_play($data_system.enemy_collapse_se)
else
$game_system.se_play($data_system.actor_collapse_se)
end
collapse
@battler_visible = false
end
else
if @_collapse_duration > 0
@_collapse_duration -= 1
@character.opacity = 256 - (48 - @_collapse_duration) * 6
if @_collapse_duration == 0
@character.collapse_done = true
end
end
end
@character.collapse_duration = @_collapse_duration
@character.battler_visible = @battler_visible
end
end
class Sprite_Character < RPG::Sprite
include XRXS_CharacterDamagePop
end
########################
# Action Battle System #
########################
class Game_Event < Game_Character
def enemy_defeat_process(enemy)
last_level = $game_player.battler.level
$game_party.gain_exp(enemy.exp)
$game_party.gain_gold(enemy.gold)
if last_level < $game_player.battler.level
$game_system.me_play(XAS_BA::LEVEL_UP_ME)
$game_player.battler.damage = "Level up!"
$game_player.battler.damage_pop = true
$game_player.need_refresh = true
end
id = XAS_BA::DEFEAT_NUMBER_ID
$game_variables[id] += 1 if id != 0
switch_id = XAS_BA_ENEMY::DEFEAT_SWITCH_IDS[self.enemy_id]
if switch_id != nil
$game_switches[switch_id] = true
$game_map.refresh
end
end
end
class Game_Party
def gain_exp(exp)
for i in 0...$game_party.actors.size
actor = $game_party.actors
if actor.cant_get_exp? == false
actor.exp += exp
end
end
end
end
class Game_Player < Game_Character
attr_accessor :need_refresh
end
module XAS_BA_BULLET_SP_COST
def shoot_bullet(action_id)
skill_id = action_id
skill = skill_id == nil ? nil : $data_skills[skill_id]
if skill != nil
sp_cost = skill.sp_cost
if self.battler.sp < sp_cost
$game_system.se_play($data_system.buzzer_se)
return false
end
self.battler.sp -= sp_cost
if self.battler.is_a?(Game_Actor)
$game_temp.skill_refresh = true
end
if $mogscript["mpstelen"] == true
$game_player.wref = true
end
self.need_refresh = true
end
return super
end
end
class Game_Player < Game_Character
include XAS_BA_BULLET_SP_COST
end
module XRXS_EnemySensor
def update_sensor
distance = ($game_player.x - self.x).abs + ($game_player.y - self.y).abs
enable = (distance <= $game_variables[XAS_BA::SENSOR_VAR])
key = [$game_map.map_id, self.id, XAS_BA::SENSOR_SELF_SWITCH]
last_enable = $game_self_switches[key]
last_enable = false if last_enable == nil
if enable != last_enable
$game_self_switches[key] = enable
$game_map.need_refresh = true
end
end
end
class Game_Event < Game_Character
include XRXS_EnemySensor
end
class Game_Character
attr_writer :opacity
end
module XRXS_BattlerAttachment
def attack_effect(attacker)
return super if self.battler.nil? or attacker.nil?
result = (not self.battler.dead? and self.battler.hiblink_duration.to_i <= 0)
if result
$game_temp.in_battle = true
self.battler.attack_effect(attacker.battler)
self.battler.damage_pop = true
$game_temp.in_battle = false
if self.battler.damage.to_i > 0
self.blow(attacker.direction, 1)
end
self.battler.hiblink_duration = self.damage_hiblink_duration
if self.is_a?(Game_Player)
self.need_refresh = true
end
end
@xrxs64c_defeat_done = false if @xrxs64c_defeat_done == nil
if not @xrxs64c_defeat_done and self.battler.dead?
defeat_process
@xrxs64c_defeat_done = true
end
end
def action_effect(bullet, action_id)
return super if self.battler.nil?
if self.battler.hiblink_duration.to_i > 0 and
not bullet.action.ignore_invincible
return false
end
skill_id = action_id
return if skill_id == nil
user = bullet.action.user
attacker = (user == nil ? nil : user.battler)
result = (user != nil and not self.battler.dead?)
skill_id = action_id
dirset = [2,6,8,4]
dir_index = (dirset.index(bullet.direction) + 2) % 4
shield = self.shield_actions.include?(action_id)
for direction in self.shield_directions
dir_index2 = (dirset.index(self.direction) + dirset.index(direction)) % 4
shield |= dirset[dir_index2] == dirset[dir_index]
end
if shield
if user.is_a?(Game_Player)
self.battler.damage = XAS_BA::SHIELD_TEXT
self.battler.damage_pop = true
$game_system.se_play(XAS_BA::SHIELD_SE)
user.blow(dirset[dir_index])
self.animation_id = XAS_BA::SHIELD_ANI
end
super
return true
end
if result
skill = $data_skills[skill_id]
if skill_id == 2 and $game_switches[120]
skill = skill.dup
skill.power = 8
end
$game_temp.in_battle = true
self.battler.skill_effect(attacker, skill)
self.battler.damage_pop = true
$game_temp.in_battle = false
if self.battler.damage.to_i > 0
if XAS_BA::ATTACK_SKILL_SHAKE.include?(skill_id)
$game_screen.start_shake(XAS_BA::SH_POWER,XAS_BA::SH_SPEED,XAS_BA::SH_DUR)
end
hit_skill_anime = XAS_BA::ATTACK_ANI_HIT[skill_id]
if hit_skill_anime != nil
self.animation_id = hit_skill_anime
else
self.animation_id = XAS_BA::DEFAULT_ATTACK_ANI_HIT
end
d = bullet.direction
p = bullet.action.blow_power.to_i
self.blow(d, p)
self.battler.hiblink_duration = self.damage_hiblink_duration
end
if self.is_a?(Game_Player)
self.need_refresh = true
end
end
if not @xrxs64c_defeat_done and self.battler.dead?
defeat_process
@xrxs64c_defeat_done = true
end
return (super or result)
end
def shield_directions
return []
end
def shield_actions
return []
end
def knock_back_disable
return false
end
def damage_hiblink_duration
actor = $game_party.actors[0]
if self.is_a?(Game_Player) and self.battler.damage.to_i > 0
if XAS_BA::JUMP_HIT_HERO == true
jump(0,0)
$game_system.se_play(XAS_BA::HERO_HIT_SE)
end
else
if self.battler.damage.to_i > 0
unless XAS_BA::JUMP_HIT_ENEMY_DISABLE.include?(self.enemy_id)
jump(0,0)
end
end
end
if self.is_a?(Game_Player)
return XAS_BA::INVICIBLE_DURATION_HERO
else
enemy_invicible_duration = XAS_BA::INVICIBLE_DURATION_ENEMY[enemy_id]
if enemy_invicible_duration != nil
return enemy_invicible_duration
else
return XAS_BA::DEFAULT_INVICIBLE_DURATION_ENEMY
end
end
end
def dead?
return self.battler == nil ? false : self.battler.dead?
end
def defeat_process
end
end
class Game_Player < Game_Character
include XRXS_BattlerAttachment
def battler
return $game_party.actors[0]
end
def defeat_process
super
if XAS_BA::AUTOGAMEOVER == true
$scene = Scene_Gameover.new rescue nil
else
$game_switches[XAS_BA::GAMEOVER_SWITCH_ID] = true
$game_map.refresh
end
end
alias xrxs64c_update update
def update
xrxs64c_update
self.battler.remove_states_auto if self.battler != nil
if self.collapse_done
self.collapse_done = false
@xrxs64c_defeat_done = false
end
end
end
class Game_Event < Game_Character
include XRXS_BattlerAttachment
def battler
return @battler
end
alias xrxs64c_refresh refresh
def refresh
xrxs64c_refresh
self.battler_recheck
end
def battler_recheck
return if @battler != nil
if @page == nil
return
end
@enemy_id = 0
for page in @event.pages.reverse
condition = page.condition
if condition.variable_valid and
condition.variable_id == XAS_BA::ENEMY_ID_VARIABLE_ID and
(!condition.switch1_valid or $game_switches[condition.switch1_id]) and
(!condition.switch2_valid or $game_switches[condition.switch2_id])
@enemy_id = condition.variable_value
break
end
end
if @enemy_id == 0
return
end
troop_id = -1
member_index = -1
for troop in $data_troops
next if troop == nil
for enemy in troop.members
if enemy.enemy_id == @enemy_id
troop_id = $data_troops.index(troop)
member_index = troop.members.index(enemy)
break
end
end
end
if troop_id != -1 and member_index != -1
@battler = Game_Enemy.new(troop_id, member_index)
end
end
def enemy_id
self.battler
return @enemy_id
end
alias xrxs64c_update update
def update
if @collapse_wait_count.to_i > 0
@collapse_wait_count -= 1
if @collapse_wait_count == 0
@collapse_wait_count = nil
$game_map.remove_token(self)
end
return
end
update_sensor
xrxs64c_update
if self.battler != nil
self.battler.remove_states_auto
end
if self.collapse_duration.to_i > 0
@through = true
end
if self.collapse_done
@opacity = 0
@collapse_wait_count = 32
return
end
end
def shield_enable!
@shield_disable = nil
end
def shield_disable!
@shield_disable = true
end
def shield_directions
set = @shield_disable ? [] : XAS_BA_ENEMY::SHILED_DIRECTIONS[self.enemy_id]
set = [] if set == nil
return set
end
def shield_actions
set = @shield_disable ? [] : XAS_BA_ENEMY::SHILED_ACTIONS[self.enemy_id]
set = [] if set == nil
return set
end
def knock_back_disable
return XAS_BA_ENEMY::KNOCK_BACK_DISABLES.include?(self.enemy_id)
end
def body_size
return XAS_BA_ENEMY::BODY_SQUARE[self.enemy_id].to_i
end
def defeat_process
super
enemy_defeat_process(self.battler)
enemy_defeat_animation = XAS_BA_ENEMY::DEF_ANI[enemy_id]
if XAS_BA_ENEMY::DEF_ANI[enemy_id] != nil
self.animation_id = enemy_defeat_animation
end
end
end
class Game_Event < Game_Character
attr_reader :collision_attack
def img_act_exist?
begin
RPG::Cache.character(@page.graphic.character_name + "_Act" , @page.graphic.character_hue)
rescue
return false
end
return true
end
def attack_on
@collision_attack = true
if img_act_exist?
@character_name = @page.graphic.character_name + "_Act"
end
end
def attack_off
@collision_attack = false
@character_name = @page.graphic.character_name
end
end
class Game_Player < Game_Character
alias xrxs64c_check_event_trigger_touch check_event_trigger_touch
def check_event_trigger_touch(x, y)
xrxs64c_check_event_trigger_touch(x, y)
if $game_system.map_interpreter.running?
return
end
for event in $game_map.events.values
next unless event.collision_attack
unless [1,2].include?(event.trigger)
&n