Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- #
- # Pacman Advanced Creative (PAC) Engine - Battle Addons 1.7c
- # Last updated: 25/02/2012
- # Type: Battle
- # Installation: Requires: PAC Battle Addons Setup 1.7c or higher.
- # Level: Simple, Average, Difficult, Insane
- # With: Shanghai, Modern Algebra, MOG, Cozziekuns, LoganForrests, Minto
- #
- #===============================================================================
- #
- # Hello there. This script may seem a bit daunting at first, but it's actually
- # just a collection of a lot smaller scripts. Before we can begin, I'm
- # oblidged to inform you that this script REQUIRES PAC Battle Addons Setup 1.7
- # or higher. It must go above this script in the editor.
- # Now that that's out of the way, I'll tell you some important stuff about
- # the features.
- #
- #===============================================================================
- #
- # For the Enemy Stats feature, use the following notes in an enemy's notebox
- # to perform the coupled function.
- # UNKNOWN_STATUS - Nothing will be displayed.
- # UNKNOWN_NAME - The name will not be displayed.
- # UNKNOWN_HP - The HP will not be displayed.
- # UNKNOWN_MP - The MP will not be displayed.
- # UNKNOWN_STATE - The states will not be displayed.
- #
- #===============================================================================
- #
- # For the Death Events feature, use the tag:
- # <death event: x>
- # in an enemy's notebox to perform the common event ID x upon that enemy's
- # death.
- #
- #===============================================================================
- #
- # For the linked death feature, use the tag:
- # <linked death: x>
- # in an enemy's notebox to make the enemy/ies with the ID/IDs x die when the
- # enemy with the tag dies. Use:
- # <linked death all>
- # to make all other enemies die when this enemy dies, regardless of anything.
- #
- #===============================================================================
- #
- # For the Counterattack feature, use the tag:
- # <counterattack>
- # in a state's notebox to give it the counterattack function.
- #
- #===============================================================================
- #
- # For the friendly enemies feature, use the tag:
- # <friendly>
- # in an enemy's notebox to make it a friendly enemies (i.e. attacks other
- # enemies and is attacked by other enemies). Use the tags:
- # <friendly exp: x>
- # <friendly gold: x>
- # to, respectively, give the player x more exp and gold if the friendly enemy
- # is still alive at the end of the battle. Use:
- # <friendly i: x>
- # <friendly w: x>
- # <friendly a: x>
- # to give the player the item (i), weapon(w) or armour(a) with the ID x. You can
- # place multiples, like so:
- # <friendly w: x, x, x>
- #
- #===============================================================================
- #
- # For the overkill feature, use the tag:
- # <overkill require: x>
- # In an enemy's notebox to set the amount of damage you need to overkill the
- # enemy by to activate the overkill function.
- # <overkill exp: +x>
- # The extra amount of exp recieved when the enemy is overkilled.
- # <overkill gold: x>
- # The extra amount of gold recieved when the enemy is overkilled.
- # <overkill item: x>
- # <overkill weapon: x>
- # <overkill armor: x>
- # The IDs of item, weapon or armor recieved when enemy is overkilled. Use the
- # tag more than once if you want more stuff dropped. Do not put multiple values
- # in the tag. These drop %100 of the time if overkilled. All of these go in
- # the enemy notebox.
- #
- #===============================================================================
- #
- # For the auto-states function, put:
- # <autostate: x> or
- # <autostates: x, x, x>
- # in an enemy's notebox to give them the state ID/IDs x.
- #
- #===============================================================================
- #
- # For the Vampirism and Siphonism script, put:
- # <vampiric: x%>
- # in a weapon's notebox to give it vampiric properties (deals and absorbs x%
- # of the damage dealt), it also works with enemy noteboxes. Use:
- # <siphonic: x%>
- # into a weapon's notebox to make it siphonic: it will deal mp damage with
- # attacks, and the attacker will gain that damage back themselves. It also
- # works for enemies.
- #
- #===============================================================================
- #
- # For the Weapon Attack Replace function, use:
- # <attack skill: x>
- # <attack skill: x, x, x>
- # inside a weapon's notebox to make the skill with the ID x replace the default
- # attack. If more than one ID is placed, one will be randomly selected each
- # time a regular attack is made. Isn't that cool?
- #
- #===============================================================================
- #
- # For the Wereforms function, use:
- # <wereform: x>
- # in a skill or item notebox to transform the actor that it is being used on's
- # skillset to that of the enemy with the ID x. They will revert as soon as
- # battle is over or the revert function is called.
- # <wereimage: string, x>
- # If this tag is used in a skill or item notebox, the actor will also change
- # image. This is for CBSs. For this to work, you must use the following tag.
- # <wereface: string, x>
- # If this tag is used in a skill or item notebox, the actor will also change
- # face. This is for CBSs. For the to work, you must use the previous tag.
- # <wereform revert>
- # If this tag is used and the actor is currently in a wereform, the actor will
- # revert to their original skillset.
- #
- #===============================================================================
- #
- # For the Actor-Dependent Enemy Stats feature,
- # Use the following syntax in the enemy's notebox to alter their stats
- # accordingly.
- # HP=50
- # MP=50
- # ATK=50
- # DEF=50
- # SPI=50
- # AGI=50
- # Actor=1
- # In this example, all the enemy's stats would be 50% higher than those of the
- # Actor with ID 1. Note that the percentage applies to the actor's base stats,
- # not taking equipment into consideration. For any tag you don't enter, the
- # default editor value will be used. You may only enter one actor.
- #
- #===============================================================================
- #
- # For the Special Collapse function, the following tags in an enemy's notebox:
- # \collapse_anim[n] - n = ID of animation used upon collapse. If 0, no animation.
- # \collapse_type[n] - n = ID of collapse effect to use. Listing as follows:
- # 0 => Default Collapse Effect
- # 1 => Shrink
- # 2 => Horizontal Expansion
- # 3 => Vertical Expansion
- # 4 => Contract and Ascend
- # 5 => Rotate
- # 6 => Shake and Descend
- # 7 => Divides Vertically and Separates Vertically
- # 8 => Divides Horizontally and Separates Horizontally
- # 9 => Divides Vertically and Separates Horizontally
- # 10 => Divides Horizontally and Separates Vertically
- # 11 => Wave
- # 12 => Blur
- # 13 => Rotate Fast & Shrink
- # 14 => Eraser
- # 15 => Pixel Eraser
- # \collapse_type_random - the collapse effect will be chosen randomly.
- # \collapse_color[#hexcode] - #hexcode = the colour in hexadecimal code the
- # enemy will change to upon collapsing. Ex:
- # \collapse_color[#FFFFFF] = black
- # \collapse_color[#FF808080] = default
- # \collapse_blend[n] - n = the blend type: 0 => Normal, 1 => Addition,
- # 2 => Subraction. Default is 1.
- #
- #===============================================================================
- #
- # For the enemies swap feature,
- # <PACswap: x> or <PACswaps: x, x, x>
- # Place one of these into an enemy's notebox to swap it with enemy/ies with the
- # ID x. Example:
- # <PACswaps: 29, 25, 27>
- # Will make the enemy change into the enemies with the IDs 29, 25 and 27.
- #
- #===============================================================================
- #
- # For the damage popup feature, use the following script commands:
- # $game_system.battle_popup_size = x - Changes the popup size to x
- # $game_system.battle_popup_font = "name" - Changes the popup font to "name"
- # $game_system.battle_popup_colour = :tag - Changes the popup colour to :tag
- # $game_system.battle_popup_colour = [x, x, x]- Changes the popup colour to RGB
- # values [x, x, x]
- # For suitable tags for the colour, see the coupled setup script.
- #
- #===============================================================================
- #
- # For the battle count feature, use the following script commands.
- # reset_battle_count - Resets the battle counter
- # get_battle_count(ID) - Gets the battle count and stores it in variable ID.
- # get_victory_count(ID) - Gets the victory " ".
- # get_escape_count(ID) - Gets the escape " ".
- # get_lose_count(ID) - Gets the loss " ".
- # get_defeat_count(ID1, ID2) - Gets the number of times enemy ID1 has been
- # defeated and stores it in variable ID2.
- # get_total_defeat_count(ID) - Stores the defeat count of all enemies in
- # variable ID.
- # get_dead_count(ID1, ID2) - Gets the number of times actor ID1 has been
- # killed and stores it in variable ID2.
- # get_total_dead_count(ID) - Stores the dead count of all actors in variable
- # ID.
- #
- #===============================================================================
- #
- # For all other information, see the coupled Setup script.
- #
- #===============================================================================
- #
- # BEGIN PAC BATTLE ADDONS V1.7
- #
- #===============================================================================
- $pac ||= {}
- $pac["Battle Addons"] = [1.7, :c]
- #===============================================================================
- #
- # PAC Escape Bar Removal
- #
- #===============================================================================
- if PAC::BATTLE::REMOVE_ESCAPE_BAR
- #==============================================================================
- # ** Scene_Battle
- #------------------------------------------------------------------------------
- # This class performs battle screen processing.
- #==============================================================================
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- super
- update_basic(true)
- update_info_viewport # Update information viewport
- if $game_message.visible
- @info_viewport.visible = false
- @message_window.visible = true
- end
- unless $game_message.visible # Unless displaying a message
- return if judge_win_loss # Determine win/loss results
- update_scene_change
- if @target_enemy_window != nil
- update_target_enemy_selection # Select target enemy
- elsif @target_actor_window != nil
- update_target_actor_selection # Select target actor
- elsif @skill_window != nil
- update_skill_selection # Select skill
- elsif @item_window != nil
- update_item_selection # Select item
- elsif @actor_command_window.active
- update_actor_command_selection # Select actor command
- else
- process_battle_event # Battle event processing
- process_action # Battle action
- process_battle_event # Battle event processing
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Create Information Display Viewport
- #--------------------------------------------------------------------------
- def create_info_viewport
- @info_viewport = Viewport.new(0, 288, 544, 128)
- @info_viewport.z = 100
- @status_window = Window_BattleStatus.new
- @actor_command_window = Window_ActorCommand.new
- @status_window.viewport = @info_viewport
- @actor_command_window.viewport = @info_viewport
- @status_window.x = 0
- @actor_command_window.x = 416
- @info_viewport.visible = false
- end
- #--------------------------------------------------------------------------
- # * Dispose of Information Display Viewport
- #--------------------------------------------------------------------------
- def dispose_info_viewport
- @status_window.dispose
- @actor_command_window.dispose
- @info_viewport.dispose
- end
- #--------------------------------------------------------------------------
- # * Update Information Display Viewport
- #--------------------------------------------------------------------------
- def update_info_viewport
- @actor_command_window.update
- @status_window.update
- end
- #--------------------------------------------------------------------------
- # * Start Party Command Selection
- #--------------------------------------------------------------------------
- def start_party_command_selection
- if $game_temp.in_battle
- @status_window.refresh
- @status_window.index = @actor_index = -1
- @active_battler = nil
- @info_viewport.visible = true
- @message_window.visible = false
- $game_party.clear_actions
- if $game_troop.surprise or not $game_party.inputable?
- start_main
- end
- next_actor
- end
- end
- #--------------------------------------------------------------------------
- # * Start Actor Command Selection
- #--------------------------------------------------------------------------
- def start_actor_command_selection
- @actor_command_window.setup(@active_battler)
- @actor_command_window.active = true
- @actor_command_window.index = 0
- end
- #--------------------------------------------------------------------------
- # * Start Execution of Battle Processing
- #--------------------------------------------------------------------------
- def start_main
- $game_troop.increase_turn
- @info_viewport.visible = false
- @info_viewport.ox = 0
- @message_window.visible = true
- @actor_command_window.active = false
- @status_window.index = @actor_index = -1
- @active_battler = nil
- @message_window.clear
- $game_troop.make_actions
- make_action_orders
- wait(20)
- end
- end
- end
- #===============================================================================
- #
- # PAC Battle HUD
- #
- #===============================================================================
- if PAC::BATTLE::USE_PAC_HUD == true
- #===============================================================================
- # ** Window_BattleStatus
- #------------------------------------------------------------------------------
- # This window displays the status of all party members on the battle screen.
- #==============================================================================
- class Window_BattleStatus < Window_Selectable
- #----------------------------------------------------------------------------
- # alias listing
- #----------------------------------------------------------------------------
- alias pacman_WBS_ini initialize
- #----------------------------------------------------------------------------
- # * Object Initialization
- #----------------------------------------------------------------------------
- def initialize
- super(0, 0, 416, 128, 1)
- @column_max = $game_party.members.size
- refresh
- self.active = false
- self.opacity = 255
- self.cursor_rect.set(0, self.index * 96, 90, 90)
- end
- #----------------------------------------------------------------------------
- # * Draw Item
- #----------------------------------------------------------------------------
- def draw_item(index)
- rect = item_rect(index)
- rect.x += 4
- rect.width -= 8
- rect.height = 96
- self.contents.clear_rect(rect)
- self.contents.font.color = normal_color
- actor = $game_party.members[index]
- draw_actor_face2(actor, index * 96, 0, 80)
- self.contents.font.size = 14
- draw_actor_name(actor, index * 96 + 8, 0)
- draw_actor_state(actor, index * 96 + 4, 32, 20)
- draw_hp_and_mp(actor, index * 96, 50, 90)
- self.contents.font.size = 17
- end
- #----------------------------------------------------------------------------
- # * Update Cursor
- #----------------------------------------------------------------------------
- def update_cursor
- if @index < 0
- self.cursor_rect.empty
- else
- self.cursor_rect.set(index * 96, 0, 90, 96)
- end
- end
- end
- #==============================================================================
- # ** Window_Base
- #------------------------------------------------------------------------------
- # This is a superclass of all windows in the game.
- #==============================================================================
- class Window_Base < Window
- #----------------------------------------------------------------------------
- # * Draw Actor Face (2)
- #----------------------------------------------------------------------------
- def draw_actor_face2(actor, x, y, width = 96, height = 96)
- draw_face2(actor.face_name, actor.face_index, x, y, width, height)
- end # draw_actor_face2(actor, x, y, width = 96, height = 96)
- #----------------------------------------------------------------------------
- # * Draw Face (2)
- #----------------------------------------------------------------------------
- def draw_face2(face_name, face_index, x, y, width = 96, height = 96)
- bitmap = Cache.face(face_name)
- rect = Rect.new(0, 0, 0, 0)
- rect.x = face_index % 4 * 96 + (96 - width) / 2
- rect.y = face_index / 4 * 96 + (96 - height) / 2
- rect.width = width
- rect.height = height -10
- self.contents.blt(x+5, y+5, bitmap, rect, PAC::BATTLE::Face_Opacity)
- bitmap.dispose
- end # draw_face2(face_name, face_index, x, y, width = 96, height = 96)
- #----------------------------------------------------------------------------
- # * Draw Hp and Mp gauges
- #----------------------------------------------------------------------------
- def draw_hp_and_mp(actor, x, y, width)
- back_color = Color.new(39, 58, 83, 255)
- unless PAC::BATTLE::USE_DEFAULT_COLORS
- hp_color1 = Color.new(66, 114, 164, 255)
- hp_color2 = Color.new(122, 175, 229, 255)
- mp_color1 = Color.new(93, 50, 158, 255)
- mp_color2 = Color.new(145, 122, 229, 255)
- else
- hp_color1 = hp_gauge_color1
- hp_color2 = hp_gauge_color2
- mp_color1 = mp_gauge_color1
- mp_color2 = mp_gauge_color2
- end
- self.contents.fill_rect(x+5, y+15, width-10, 7, back_color)
- self.contents.gradient_fill_rect(x+7, y+17,
- (width-14) * actor.hp / actor.maxhp, 3, hp_color1, hp_color2)
- self.contents.draw_text(x+5, y, width-10, 20, Vocab::hp, 0)
- self.contents.draw_text(x+5, y, width-10, 20,
- actor.hp.to_s + "/" + actor.maxhp.to_s, 2)
- self.contents.fill_rect(x+5, y+35, width-10, 7, back_color)
- self.contents.gradient_fill_rect(x+7, y+37,
- (width-14) * actor.mp / actor.maxmp, 3, mp_color1, mp_color2)
- self.contents.draw_text(x+5, y+20, width-10, 20, Vocab::mp, 0)
- self.contents.draw_text(x+5, y+20, width-10, 20,
- actor.mp.to_s + "/" + actor.maxmp.to_s, 2)
- end # draw_hp_and_mp(actor,x,y,width)
- end # Window_Base < Window
- end
- #===============================================================================
- #
- # PAC Auto-Command
- #
- #===============================================================================
- if PAC::BATTLE::USE_AUTO
- #==============================================================================
- # ** Window_ActorCommand
- #------------------------------------------------------------------------------
- # This window is used to select actor commands, such as "Attack" or "Skill".
- #==============================================================================
- class Window_ActorCommand < Window_Command
- alias setup_pac_window_actorcommand setup unless $@
- def setup(actor)
- setup_pac_window_actorcommand(actor)
- @commands.insert(1, PAC::BATTLE::AUTOBATTLE_COMMAND)
- @item_max = @commands.size
- create_contents
- refresh
- self.index = 0
- end
- end
- #==============================================================================
- # ** Scene_Battle
- #------------------------------------------------------------------------------
- # This class performs battle screen processing.
- #==============================================================================
- class Scene_Battle < Scene_Base
- alias update_actor_command_selection_pac_ab update_actor_command_selection
- def update_actor_command_selection
- if Input.trigger?(Input::C)
- case @actor_command_window.index
- when 0 # Attack
- Sound.play_decision
- @active_battler.action.set_attack
- start_target_enemy_selection
- when 1 # Auto
- Sound.play_decision
- @active_battler.make_action
- next_actor
- when 2 # Skill
- Sound.play_decision
- start_skill_selection
- when 3 # Guard
- Sound.play_decision
- @active_battler.action.set_guard
- next_actor
- when 4 # Item
- Sound.play_decision
- start_item_selection
- end
- else
- update_actor_command_selection_pac_ab
- end
- end
- def make_auto_command
- @selected_battler.make_action
- @status_window.draw_item(@selected_battler.index)
- if $scene.dtb?
- next_actor if $game_switches[YEM::BATTLE_ENGINE::OPTIONS[:next_actor_sw]]
- elsif $scene.ptb?
- perform_instant_action
- elsif $scene.atb?
- make_action_orders
- if $game_switches[YEM::BATTLE_ENGINE::OPTIONS[:next_actor_sw]]
- @actor_index = -1 if @actor_index == $game_party.members.size - 1
- next_actor
- end
- elsif $scene.ctb?
- if @selected_battler.ctb_active?
- $game_troop.ctb_ready.shift
- $game_troop.clear_ctb_cache
- make_action_orders
- update_ctb_clockticks
- return
- end
- make_action_orders
- if $game_switches[YEM::BATTLE_ENGINE::OPTIONS[:next_actor_sw]]
- @actor_index = -1 if @actor_index == $game_party.members.size - 1
- next_actor
- end
- end
- end
- end
- end
- #===============================================================================
- #
- # PAC Enemy Stats
- #
- #===============================================================================
- if PAC::BATTLE::USE_ENSTATS
- #==============================================================================
- # ** Window_TargetEnemy
- #------------------------------------------------------------------------------
- # Window for selecting the enemy who is the action target on the battle
- # screen.
- #==============================================================================
- class Window_TargetEnemy < Window_Command
- #-----------------------------------------------------------------------------
- # rewrite method: initialize
- #-----------------------------------------------------------------------------
- def initialize
- @enemies = []
- commands = []
- $game_troop.members.each do |enemy|
- next unless enemy.exist?
- @enemies.push(enemy)
- commands.push(enemy.name)
- end
- super(416, commands)
- self.height = 128
- end
- #-----------------------------------------------------------------------------
- # rewrite method: enemy
- #-----------------------------------------------------------------------------
- def enemy
- return @enemies[@index]
- end
- #-----------------------------------------------------------------------------
- # write method: draw_item
- #-----------------------------------------------------------------------------
- def draw_item(index)
- rect = item_rect(index)
- rect.x += 4
- rect.width -= 8
- self.contents.clear_rect(rect)
- self.contents.font.color = normal_color
- actor = @enemies[index]
- unless actor.stat_note?('UNKNOWN_STATUS')
- draw_actor_name(actor, 4, rect.y) unless actor.stat_note?('UNKNOW_NAME')
- unless actor.stat_note?('UNKNOWN_STATUS')
- draw_actor_state(actor, 114, rect.y, 48)
- end
- unless actor.stat_note?('UNKNOWN_HP')
- draw_actor_hp(actor, 174, rect.y, 120)
- end
- unless actor.stat_note?('UNKNOWN_MP')
- draw_actor_mp(actor, 310, rect.y, 70)
- end
- end
- end
- end # Window_TargetEnemy
- #==============================================================================
- # ** Game_Enemy
- #------------------------------------------------------------------------------
- # This class handles enemy characters. It's used within the Game_Troop class
- # ($game_troop).
- #==============================================================================
- class Game_Enemy < Game_Battler
- attr_reader :status_note
- #-----------------------------------------------------------------------------
- # alias method: initialize
- #-----------------------------------------------------------------------------
- alias pac_unstat_ini initialize
- def initialize(*args)
- pac_unstat_ini(*args)
- @status_note = enemy.note
- end
- #-----------------------------------------------------------------------------
- # new method: state_note?
- #-----------------------------------------------------------------------------
- def stat_note?(note)
- return @status_note.include?(note)
- end
- end # Game_Enemy
- end
- #===============================================================================
- #
- # PAC Death Events
- #
- #===============================================================================
- #==============================================================================
- # ** RPG::Enemy
- #------------------------------------------------------------------------------
- # Data class for enemies.
- #==============================================================================
- class RPG::Enemy
- def death_event
- return @death_event if @death_event != nil
- @death_event = 0
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:DEATH_EVENT|death event):[ ](\d+)>/i
- @death_event = $1.to_i
- end
- }
- return @death_event
- end
- end
- #==============================================================================
- # ** Game_Actor
- #------------------------------------------------------------------------------
- # This class handles actors. It's used within the Game_Actors class
- # ($game_actors) and referenced by the Game_Party class ($game_party).
- #==============================================================================
- class Game_Actor < Game_Battler
- alias pac_de_perform_actor_collapse perform_collapse unless $@
- def perform_collapse
- pac_de_perform_actor_collapse
- if $game_temp.in_battle and dead?
- if PAC::BATTLE::ACTOR_DEATH_EVENTS.include?(@actor_id)
- $death_events.push(PAC::BATTLE::ACTOR_DEATH_EVENTS[@actor_id])
- elsif PAC::BATTLE::CLASS_DEATH_EVENTS.include(@actor_id)
- $death_events.push(PAC::BATLLE::CLASS_DEATH_EVENTS[@actor_id])
- end
- end
- end
- end
- #==============================================================================
- # ** Game_Enemy
- #------------------------------------------------------------------------------
- # This class handles enemy characters. It's used within the Game_Troop class
- # ($game_troop).
- #==============================================================================
- class Game_Enemy < Game_Battler
- alias pac_de_perform_enemy_collapse perform_collapse unless $@
- def perform_collapse
- pac_de_perform_enemy_collapse
- if $game_temp.in_battle and dead?
- $death_events.push(enemy.death_event) if enemy.death_event > 0
- end
- end
- end
- #==============================================================================
- # ** Scene_Title
- #------------------------------------------------------------------------------
- # This class performs the title screen processing.
- #==============================================================================
- class Scene_Title < Scene_Base
- alias pac_de_main main
- def main
- $death_events = []
- pac_de_main
- end
- end
- #==============================================================================
- # ** Scene_Battle
- #------------------------------------------------------------------------------
- # This class performs battle screen processing.
- #==============================================================================
- class Scene_Battle < Scene_Base
- alias pac_de_execute_action execute_action unless $@
- def execute_action
- pac_de_execute_action
- run_death_common_events
- end
- def run_death_common_events
- for common_event_id in $death_events
- next if $data_common_events[common_event_id].nil?
- $game_temp.common_event_id = common_event_id
- process_battle_event
- end
- $death_events = []
- end
- alias pac_de_battle_end battle_end unless $@
- def battle_end(result)
- $death_events = []
- pac_de_battle_end(result)
- end
- end
- #===============================================================================
- #
- # PAC Linked Deaths
- #
- #===============================================================================
- class RPG::Enemy # RPG::Enemy
- #--------------------------------------------------------------------------
- # linked_death
- #--------------------------------------------------------------------------
- def linked_death
- return @linked_death if @linked_death != nil
- @linked_death = []
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:LINKED DEATH|link death):[ ](\d+(?:\s*,\s*\d+)*)>/i
- $1.scan(/\d+/).each { |num|
- @linked_death.push(num.to_i) if num.to_i > 0 }
- end
- }
- return @linked_death
- end
- #--------------------------------------------------------------------------
- # linked_death_all
- #--------------------------------------------------------------------------
- def linked_death_all
- return @linked_death_all if @linked_death_all != nil
- @linked_death_all = false
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:LINKED DEATH ALL|link death everything)>/i
- @linked_death_all = true
- end
- }
- return @linked_death_all
- end
- end
- class Game_Enemy < Game_Battler
- #--------------------------------------------------------------------------
- # * Perform Collapse
- #--------------------------------------------------------------------------
- alias pac_linked_death_perform_collapse perform_collapse
- def perform_collapse
- pac_linked_death_perform_collapse
- perform_linked_deaths if $game_temp.in_battle and dead?
- end
- #--------------------------------------------------------------------------
- # * Perform Linked Deaths
- #--------------------------------------------------------------------------
- def perform_linked_deaths
- unless enemy.linked_death.empty?
- for member in $game_troop.existing_members
- next unless enemy.linked_death.include?(member.enemy_id)
- member.add_state(1)
- member.perform_collapse
- end
- end
- if enemy.linked_death_all
- for member in $game_troop.existing_members
- member.add_state(1)
- member.perform_collapse
- end
- end
- end
- end
- #===============================================================================
- #
- # PAC Counterattack
- #
- #===============================================================================
- #==============================================================================
- # ** RPG::State
- #------------------------------------------------------------------------------
- # Data class for State.
- #==============================================================================
- class RPG::State
- #-----------------------------------------------------------------------------
- # new method: ca (counterattack)
- #-----------------------------------------------------------------------------
- def ca
- return @ca unless @ca.nil?
- @ca = false
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:COUNTERATTACK|counter attack)>/i
- @ca = true
- end
- }
- return @ca
- end
- end
- #==============================================================================
- # ** Game_Battler
- #------------------------------------------------------------------------------
- # This class deals with battlers. It's used as a superclass of the Game_Actor
- # and Game_Enemy classes.
- #==============================================================================
- class Game_Battler
- #-----------------------------------------------------------------------------
- # Public Instance Varliables
- #-----------------------------------------------------------------------------
- attr_accessor :action
- attr_accessor :ca
- #-----------------------------------------------------------------------------
- # * Damage Reflection
- #-----------------------------------------------------------------------------
- alias execute_damage_pac_ca execute_damage unless $@
- def execute_damage(user)
- execute_damage_pac_ca(user)
- create_ca if @hp_damage > 0
- end
- #-----------------------------------------------------------------------------
- # * create_ca
- #-----------------------------------------------------------------------------
- def create_ca
- return if !$scene.is_a?(Scene_Battle)
- return if !exist?
- return if $scene.active_battler.actor? == self.actor?
- for state in states
- next if !state.ca
- @ca = true
- break
- end
- end
- end
- #==============================================================================
- # ** Scene_Battle
- #------------------------------------------------------------------------------
- # This class performs battle screen processing.
- #==============================================================================
- class Scene_Battle < Scene_Base
- #-----------------------------------------------------------------------------
- # public instance variables
- #-----------------------------------------------------------------------------
- attr_accessor :active_battler
- #-----------------------------------------------------------------------------
- # * Execute Battle Actions
- #-----------------------------------------------------------------------------
- alias execute_action_pac_ca execute_action unless $@
- def execute_action
- execute_action_pac_ca
- process_ca if !@process_ca
- end
- #-----------------------------------------------------------------------------
- # * process_ca
- #-----------------------------------------------------------------------------
- def process_ca
- @process_ca = true
- for member in ($game_party.existing_members + $game_troop.existing_members)
- break if !@active_battler.exist?
- next if member == nil
- next if !member.ca
- next unless rand(100) <= PAC::BATTLE::CA_CHANCE
- last_action = member.action.clone
- last_battler = @active_battler
- member.action.set_attack
- member.action.target_index = @active_battler.index
- @active_battler = member
- inside_performed_actors = false
- if @performed_actors != nil
- inside_performed_actors = true if @performed_actors.include?(member)
- end
- @message_window.clear
- execute_action
- if @performed_actors != nil and !inside_performed_actors
- @performed_actors.delete(@active_battler)
- end
- @active_battler = last_battler
- member.action = last_action
- member.ca = nil
- end
- @process_ca = false
- end
- end
- #===============================================================================
- #
- # PAC FRIENDLY ENEMIES
- #
- #===============================================================================
- #==============================================================================
- # RPG::Enemy
- #==============================================================================
- class RPG::Enemy
- #--------------------------------------------------------------------------
- # * Friendly Monster
- #--------------------------------------------------------------------------
- def friendly_monster
- return @friendly_monster if @friendly_monster != nil
- @friendly_monster = false
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:FRIENDLY|friendly monster)>/i
- @friendly_monster = true
- end
- }
- return @friendly_monster
- end
- #--------------------------------------------------------------------------
- # * Friendly EXP
- #--------------------------------------------------------------------------
- def friendly_exp
- return @friendly_exp if @friendly_exp != nil
- @friendly_exp = @exp * 2
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:FRIENDLY_EXP|friendly exp):[ ](\d+)>/i
- @friendly_exp = $1.to_i
- end
- }
- return @friendly_exp
- end
- #--------------------------------------------------------------------------
- # * Friendly Gold
- #--------------------------------------------------------------------------
- def friendly_gold
- return @friendly_gold if @friendly_gold != nil
- @friendly_gold = @gold * 2
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:FRIENDLY_GOLD|friendly gold):[ ](\d+)>/i
- @friendly_gold = $1.to_i
- end
- }
- return @friendly_gold
- end
- #--------------------------------------------------------------------------
- # * Friendly Drops
- #--------------------------------------------------------------------------
- def friendly_drops
- return @friendly_drops if @friendly_drops != nil
- @friendly_drops = []
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:FRIENDLY_ITEM|friendly item|friendly i):[ ]*(\d+)>/i
- @friendly_drops.push($data_items[$1.to_i])
- when /<(?:FRIENDLY_WEP|friendly wep|friendly w):[ ]*(\d+)>/i
- @friendly_drops.push($data_weapons[$1.to_i])
- when /<(?:FRIENDLY_ARM|friendly arm|friendly a):[ ]*(\d+)>/i
- @friendly_drops.push($data_armors[$1.to_i])
- end
- }
- return @friendly_drops.compact
- end
- end
- #==============================================================================
- # ** Game_Temp
- #==============================================================================
- class Game_Temp
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_accessor :friendly_monster
- end
- #==============================================================================
- # ** Game_Enemy
- #==============================================================================
- class Game_Enemy < Game_Battler
- #--------------------------------------------------------------------------
- # * states
- #--------------------------------------------------------------------------
- def friendly?
- return enemy.friendly_monster
- end
- #--------------------------------------------------------------------------
- # * Create Battle Action
- #--------------------------------------------------------------------------
- alias make_action_pac_friendly_monsters make_action unless $@
- def make_action
- $game_temp.friendly_monster = true
- make_action_pac_friendly_monsters
- $game_temp.friendly_monster = false
- end
- end
- #==============================================================================
- # ** Game_BattleAction
- #==============================================================================
- class Game_BattleAction
- #--------------------------------------------------------------------------
- # * Get Allied Units
- #--------------------------------------------------------------------------
- alias friends_unit_pac_friendly_monsters friends_unit unless $@
- def friends_unit
- if !battler.actor? and battler.friendly?
- return $game_party
- else
- return friends_unit_pac_friendly_monsters
- end
- end
- #--------------------------------------------------------------------------
- # * Get Enemy Units
- #--------------------------------------------------------------------------
- alias opponents_unit_pac_friendly_monsters opponents_unit unless $@
- def opponents_unit
- if !battler.actor? and battler.friendly?
- return $game_troop
- else
- return opponents_unit_pac_friendly_monsters
- end
- end
- #--------------------------------------------------------------------------
- # * Create Normal Attack Targets
- #--------------------------------------------------------------------------
- alias make_attack_targets_pac_friendly_monsters make_attack_targets unless $@
- def make_attack_targets
- $game_temp.friendly_monster = true if !battler.actor?
- result = make_attack_targets_pac_friendly_monsters
- $game_temp.friendly_monster = false
- return result
- end
- #--------------------------------------------------------------------------
- # * Create Normal Attack Targets
- #--------------------------------------------------------------------------
- alias make_obj_targets_pac_friendly_monsters make_obj_targets unless $@
- def make_obj_targets(obj)
- $game_temp.friendly_monster = true if !battler.actor?
- result = make_obj_targets_pac_friendly_monsters(obj)
- $game_temp.friendly_monster = false
- return result
- end
- end
- #==============================================================================
- # ** Game_Troop
- #==============================================================================
- class Game_Troop < Game_Unit
- #--------------------------------------------------------------------------
- # * Members
- #--------------------------------------------------------------------------
- alias members_troop_pac_friendly_monsters members unless $@
- def members
- result = members_troop_pac_friendly_monsters
- result -= $game_troop.friendlies if $game_temp.friendly_monster
- return result
- end
- #--------------------------------------------------------------------------
- # * Friendlies
- #--------------------------------------------------------------------------
- def friendlies
- result = []
- for member in members_troop_pac_friendly_monsters
- result.push(member) if member.friendly?
- end
- return result.compact
- end
- #--------------------------------------------------------------------------
- # * Friendlies Alive?
- #--------------------------------------------------------------------------
- def friendlies_alive?
- for member in friendlies
- return true unless member.dead?
- end
- return false
- end
- #--------------------------------------------------------------------------
- # * Determine Everyone is Dead
- #--------------------------------------------------------------------------
- def all_dead?
- n = existing_members
- n -= $game_troop.friendlies
- return n.empty?
- end
- #--------------------------------------------------------------------------
- # * Calculate Total Experience
- #--------------------------------------------------------------------------
- alias exp_total_pac_friendly_monsters exp_total unless $@
- def exp_total
- n = exp_total_pac_friendly_monsters
- for member in $game_troop.friendlies
- next if member.dead?
- n += member.enemy.friendly_exp
- end
- return n
- end
- #--------------------------------------------------------------------------
- # * Calculate Total Gold
- #--------------------------------------------------------------------------
- alias gold_total_pac_friendly_monsters gold_total unless $@
- def gold_total
- n = gold_total_pac_friendly_monsters
- for member in $game_troop.friendlies
- next if member.dead?
- n += member.enemy.friendly_exp
- end
- return n
- end
- #--------------------------------------------------------------------------
- # * Create Array of Dropped Items
- #--------------------------------------------------------------------------
- alias make_drop_items_pac_friendly_monsters make_drop_items unless $@
- def make_drop_items
- n = make_drop_items_pac_friendly_monsters
- for member in $game_troop.friendlies
- next if member.dead?
- n += member.enemy.friendly_drops
- end
- return n
- end
- end
- #==============================================================================
- # ** Game_Party
- #==============================================================================
- class Game_Party < Game_Unit
- #--------------------------------------------------------------------------
- # * Members
- #--------------------------------------------------------------------------
- alias members_party_pac_friendly_monsters members unless $@
- def members
- result = members_party_pac_friendly_monsters
- if $game_temp.friendly_monster and $game_troop.friendlies_alive?
- return $game_troop.friendlies
- end
- return result
- end
- end
- #===============================================================================
- #
- # PAC Large Troop
- #
- #===============================================================================
- class RPG::Troop # RPG::Troop
- #-----------------------------------------------------------------------------
- # rewrite method: members
- #-----------------------------------------------------------------------------
- def members
- return @members if @added_extra_members
- @added_extra_members = true
- return @members unless PAC::BATTLE::LARGE_TROOP.include?(@id)
- new_members = PAC::BATTLE::LARGE_TROOP[@id]
- for array in new_members
- new_member = RPG::Troop::Member.new
- new_member.enemy_id = array[0]
- new_member.x = array[1]
- new_member.y = array[2]
- new_member.hidden = array[3]
- new_member.immortal = array[4]
- @members.push(new_member)
- end
- return @members
- end
- end # RPG::Troop
- #==============================================================================
- # ** Window_TargetEnemy
- #------------------------------------------------------------------------------
- # Window for selecting the enemy who is the action target on the battle
- # screen.
- #==============================================================================
- class Window_TargetEnemy < Window_Command
- #-----------------------------------------------------------------------------
- # rewrite method: initialize
- #-----------------------------------------------------------------------------
- unless PAC::BATTLE::USE_ENSTATS
- def initialize
- commands = []
- @enemies = []
- for enemy in $game_troop.members
- next unless enemy.exist?
- commands.push(enemy.name)
- @enemies.push(enemy)
- end
- super(Graphics.width-128, commands, 2)
- self.height = 128
- end
- end
- end # Window_TargetEnemy
- #===============================================================================
- #
- # PAC Slip Damage
- #
- #===============================================================================
- #==============================================================================
- # ** Game_Battler
- #------------------------------------------------------------------------------
- # This class deals with battlers. It's used as a superclass of the Game_Actor
- # and Game_Enemy classes.
- #==============================================================================
- class Game_Battler
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_accessor :slip_damage_message # message for slip damage
- #--------------------------------------------------------------------------
- # * Application of Slip Damage Effects
- #--------------------------------------------------------------------------
- def slip_damage_effect
- if slip_damage? and @hp > 0
- @hp_damage = apply_variance(maxhp / 20, 10)
- @hp_damage = @hp - 1 if @hp_damage >= @hp
- self.hp -= @hp_damage
- ext_txt = PAC::BATTLE::SDAMAGE_TEXT # To save space.
- @slip_damage_message = "#{self.name} took #{self.hp_damage}" + ext_txt
- end
- end
- end
- #==============================================================================
- # ** Scene_Battle
- #------------------------------------------------------------------------------
- # This class performs battle screen processing.
- #==============================================================================
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # * End Turn
- #--------------------------------------------------------------------------
- def turn_end
- $game_troop.turn_ending = true
- $game_party.slip_damage_effect
- m = $game_party.members
- for i in 0...m.size
- for state in m[i].states
- if state.slip_damage
- unless m[i].dead?
- $game_troop.screen.start_shake(5, 5, 10)
- @message_window.replace_instant_text(m[i].slip_damage_message)
- Sound.play_actor_damage
- wait(PAC::BATTLE::WAIT)
- end
- end
- end
- end
- $game_troop.slip_damage_effect
- t = $game_troop.members
- for i in 0...t.size
- for state in t[i].states
- if state.slip_damage
- unless t[i].dead?
- t[i].blink = true
- @message_window.replace_instant_text(t[i].slip_damage_message)
- Sound.play_enemy_damage
- wait(PAC::BATTLE::WAIT)
- t[i].slip_damage_message = nil
- end
- end
- end
- end
- $game_party.do_auto_recovery
- $game_troop.preemptive = false
- $game_troop.surprise = false
- process_battle_event
- $game_troop.turn_ending = false
- start_party_command_selection
- end
- end
- #===============================================================================
- #
- # PAC Overkill
- #
- #===============================================================================
- #==============================================================================
- # ** RPG::Enemy
- #==============================================================================
- class RPG::Enemy
- #--------------------------------------------------------------------------
- # overkill_requirement
- #--------------------------------------------------------------------------
- def overkill_requirement
- return @overkill_requirement if @overkill_requirement != nil
- @overkill_requirement = @maxhp * 3 / 2
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:OVERKILL_REQUIRE|overkill_require):[ ](\d+)>/i
- @overkill_requirement = $1.to_i
- end
- }
- return @overkill_requirement
- end
- #--------------------------------------------------------------------------
- # overkill_exp
- #--------------------------------------------------------------------------
- def overkill_exp
- return @overkill_exp if @overkill_exp != nil
- @overkill_exp = @exp / 2
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:OVERKILL_EXP|overkill exp):[ ]([\+\-]\d+)>/i
- @overkill_exp = $1.to_i
- end
- }
- return @overkill_exp
- end
- #--------------------------------------------------------------------------
- # overkill_gold
- #--------------------------------------------------------------------------
- def overkill_gold
- return @overkill_gold if @overkill_gold != nil
- @overkill_gold = @exp / 2
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:OVERKILL_GOLD|overkill gold):[ ]([\+\-]\d+)>/i
- @overkill_gold = $1.to_i
- end
- }
- return @overkill_gold
- end
- #--------------------------------------------------------------------------
- # overkill_items
- #--------------------------------------------------------------------------
- def overkill_items
- return @overkill_items.compact if @overkill_items != nil
- @overkill_items = []
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:OVERKILL_ITEM|overkill item):[ ](\d+)>/i
- @overkill_items.push($data_items[$1.to_i])
- when /<(?:OVERKILL_WEAPON|overkill weapon):[ ](\d+)>/i
- @overkill_items.push($data_weapons[$1.to_i])
- when /<(?:OVERKILL_ARMOR|overkill armor):[ ](\d+)>/i
- @overkill_items.push($data_armors[$1.to_i])
- end
- }
- return @overkill_items.compact
- end
- end
- #==============================================================================
- # ** Game_Enemy
- #==============================================================================
- class Game_Enemy < Game_Battler
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_accessor :overkill
- #--------------------------------------------------------------------------
- # * Activate Overkill
- #--------------------------------------------------------------------------
- def activate_overkill
- return unless @hp_damage >= enemy.overkill_requirement
- return unless @hp_damage >= @hp
- return unless @hp == 0
- return if @overkill
- @overkill = true
- if $scene.is_a?(Scene_Battle) and not $scene.message_window.nil?
- text = sprintf(PAC::BATTLE::OVERKILL_MESSAGE, name)
- $scene.message_window.add_instant_text(text)
- end
- PAC::BATTLE::OVERKILL_SOUND.play
- end
- #--------------------------------------------------------------------------
- # * Get Experience
- #--------------------------------------------------------------------------
- alias exp_pac_overkill exp unless $@
- def exp
- n = exp_pac_overkill
- n += enemy.overkill_exp if @overkill
- return n
- end
- #--------------------------------------------------------------------------
- # * Get Gold
- #--------------------------------------------------------------------------
- alias gold_pac_overkill gold unless $@
- def gold
- n = gold_pac_overkill
- n += enemy.overkill_gold if @overkill
- return n
- end
- end
- #==============================================================================
- # ** Game_Battler
- #==============================================================================
- class Game_Battler
- #--------------------------------------------------------------------------
- # * Damage Reflection
- #--------------------------------------------------------------------------
- alias execute_damage_pac_overkill execute_damage unless $@
- def execute_damage(user)
- execute_damage_pac_overkill(user)
- return unless user.actor? and self.is_a?(Game_Enemy)
- activate_overkill
- end
- end
- #==============================================================================
- # ** Game_Troop
- #==============================================================================
- class Game_Troop < Game_Unit
- #--------------------------------------------------------------------------
- # * Create Array of Dropped Items
- #--------------------------------------------------------------------------
- alias make_drop_items_pac_overkill make_drop_items unless $@
- def make_drop_items
- n = make_drop_items_pac_overkill
- for member in dead_members
- next unless member.overkill
- n += member.enemy.overkill_items
- end
- return n
- end
- end
- #==============================================================================
- # ** Scene_Battle
- #==============================================================================
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_accessor :message_window
- end
- #===============================================================================
- #
- # PAC Autostates
- #
- #===============================================================================
- class RPG::Enemy
- #--------------------------------------------------------------------------
- # autostates
- #--------------------------------------------------------------------------
- def autostates
- return @autostates if @autostates != nil
- @autostates = []
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:AUTOSTATE|autostates):[ ](\d+(?:\s*,\s*\d+)*)>/i
- $1.scan(/\d+/).each { |num|
- @autostates.push($data_states[num.to_i]) if num.to_i > 0 }
- end
- }
- return @autostates
- end
- end
- #==============================================================================
- # ** Game_Enemy
- #==============================================================================
- class Game_Enemy < Game_Battler
- #--------------------------------------------------------------------------
- # * states
- #--------------------------------------------------------------------------
- def states
- st = super
- for state in enemy.autostates
- st.push(state) unless state.nil?
- end
- return st.uniq
- end
- end
- #===============================================================================
- #
- # PAC VAPMIRISM AND SIPHONISM
- #
- #===============================================================================
- #==============================================================================
- # RPG::Weapon
- #==============================================================================
- class RPG::Weapon < RPG::BaseItem
- #--------------------------------------------------------------------------
- # * Vampiric
- #--------------------------------------------------------------------------
- def vampiric
- return @vampiric if @vampiric != nil
- @vampiric = 0
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:VAMPIRIC|vampire):[ ]*(\d+)([%%])>/i
- @vampiric = $1.to_i
- end
- }
- return @vampiric
- end
- #--------------------------------------------------------------------------
- # * Siphonic
- #--------------------------------------------------------------------------
- def siphonic
- return @siphonic if @siphonic != nil
- @siphonic = 0
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:SIPHONIC|siphon):[ ]*(\d+)>/i
- @siphonic = $1.to_i
- end
- }
- return @siphonic
- end
- end
- #==============================================================================
- # RPG::Enemy
- #==============================================================================
- class RPG::Enemy
- #--------------------------------------------------------------------------
- # * Vampiric
- #--------------------------------------------------------------------------
- def vampiric
- return @vampiric if @vampiric != nil
- @vampiric = 0
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:VAMPIRIC|vampire):[ ]*(\d+)([%%])>/i
- @vampiric = $1.to_i
- end
- }
- return @vampiric
- end
- #--------------------------------------------------------------------------
- # * Siphonic
- #--------------------------------------------------------------------------
- def siphonic
- return @siphonic if @siphonic != nil
- @siphonic = 0
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:SIPHONIC|siphon):[ ]*(\d+)>/i
- @siphonic = $1.to_i
- end
- }
- return @siphonic
- end
- end
- #==============================================================================
- # ** Game_Battler
- #==============================================================================
- class Game_Battler
- #--------------------------------------------------------------------------
- # * Clear Variable for Storing Action Results
- #--------------------------------------------------------------------------
- alias clear_action_results_pac_vampire_weapons clear_action_results unless $@
- def clear_action_results
- clear_action_results_pac_vampire_weapons
- @vampiric = 0
- @siphonic = 0
- end
- #--------------------------------------------------------------------------
- # * Calculation of Damage From Normal Attack
- #--------------------------------------------------------------------------
- alias make_attack_damage_value_pac_vampire_weapons make_attack_damage_value
- def make_attack_damage_value(attacker)
- make_attack_damage_value_pac_vampire_weapons(attacker)
- @vampiric = [@hp_damage * attacker.vampiric_rate / 100, self.hp].min
- @mp_damage += attacker.siphonic_rate
- @siphonic = [@mp_damage, self.mp, attacker.siphonic_rate].min
- end
- #--------------------------------------------------------------------------
- # * Calculation of Damage Caused by Skills or Items
- #--------------------------------------------------------------------------
- alias make_obj_damage_value_pac_vampire_weapons make_obj_damage_value
- def make_obj_damage_value(user, obj)
- make_obj_damage_value_pac_vampire_weapons(user, obj)
- return if @absorbed
- return unless obj.physical_attack
- @vampiric = [@hp_damage * user.vampiric_rate / 100, self.hp].min
- @mp_damage += user.siphonic_rate
- @siphonic = [@mp_damage, self.mp, user.siphonic_rate].min
- end
- #--------------------------------------------------------------------------
- # * Damage Reflection
- #--------------------------------------------------------------------------
- alias execute_damage_pac_vampire_weapons execute_damage unless $@
- def execute_damage(user)
- execute_damage_pac_vampire_weapons(user)
- user.hp += @vampiric if @vampiric > 0
- user.mp += @siphonic if @siphonic > 0
- end
- end
- #==============================================================================
- # ** Game_Actor
- #==============================================================================
- class Game_Actor < Game_Battler
- #--------------------------------------------------------------------------
- # * Vampiric Rate
- #--------------------------------------------------------------------------
- def vampiric_rate
- result = 0
- for weapon in weapons.compact
- result += weapon.vampiric
- end
- return [result, 0].max
- end
- #--------------------------------------------------------------------------
- # * Siphonic Rate
- #--------------------------------------------------------------------------
- def siphonic_rate
- result = 0
- for weapon in weapons.compact
- result += weapon.siphonic
- end
- return [result, 0].max
- end
- end
- #==============================================================================
- # ** Game_Enemy
- #==============================================================================
- class Game_Enemy < Game_Battler
- #--------------------------------------------------------------------------
- # * Vampiric Rate
- #--------------------------------------------------------------------------
- def vampiric_rate
- return [enemy.vampiric, 0].max
- end
- #--------------------------------------------------------------------------
- # * Siphonic Rate
- #--------------------------------------------------------------------------
- def siphonic_rate
- return [enemy.siphonic, 0].max
- end
- end
- #===============================================================================
- #
- # PAC Weapon Attack Replace
- #
- #===============================================================================
- #==============================================================================
- # RPG::Weapon
- #==============================================================================
- class RPG::Weapon < RPG::BaseItem
- #--------------------------------------------------------------------------
- # # Attack Skills
- #--------------------------------------------------------------------------
- def attack_skills
- return @attack_skills if @attack_skills != nil
- @attack_skills = []
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:ATTACK_SKILL|attack skill):[ ](\d+(?:\s*,\s*\d+)*)>/i
- $1.scan(/\d+/).each { |num| @attack_skills.push(num.to_i) }
- end
- }
- return @attack_skills
- end
- end
- #==============================================================================
- # ** Game_Actor
- #==============================================================================
- class Game_Actor < Game_Battler
- #--------------------------------------------------------------------------
- # * Attack Skills
- #--------------------------------------------------------------------------
- def attack_skills
- n = []
- for weapon in weapons.compact do n += weapon.attack_skills end
- return n
- end
- end
- #==============================================================================
- # ** Scene_Battle
- #==============================================================================
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # * Execute Battle Action: Attack
- #--------------------------------------------------------------------------
- unless $@
- alias execute_action_attack_pac_weapon_replace execute_action_attack
- end
- def execute_action_attack
- if @active_battler.actor? and not @active_battler.attack_skills.empty?
- attack_skills = @active_battler.attack_skills
- skill_id = attack_skills[rand(attack_skills.size)]
- @active_battler.action.set_skill(skill_id)
- execute_action_skill
- else
- execute_action_attack_pac_weapon_replace
- end
- end
- end
- #===============================================================================
- #
- # PAC WEREFORMS
- #
- #===============================================================================
- #==============================================================================
- # RPG::UsableItem
- #==============================================================================
- class RPG::UsableItem < RPG::BaseItem
- #--------------------------------------------------------------------------
- # # Wereform
- #--------------------------------------------------------------------------
- def wereform
- return @wereform if @wereform != nil
- @wereform = 0
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:WEREFORM|metamorph):[ ](\d+)>/i
- @wereform = $1.to_i
- end
- }
- return @wereform
- end
- #--------------------------------------------------------------------------
- # # Wereform Image
- #--------------------------------------------------------------------------
- def wereform_image
- return @wereform_image if @wereform_image != nil
- @wereform_image = [nil, 0]
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:WEREIMAGE|morphimage):[ ](.*),[ ](\d+)>/i
- @wereform_image[0] = $1.to_s
- @wereform_image[1] = $2.to_i
- end
- }
- return @wereform_image
- end
- #--------------------------------------------------------------------------
- # # Wereform Face
- #--------------------------------------------------------------------------
- def wereform_face
- return @wereform_face if @wereform_face != nil
- @wereform_face = [nil, 0]
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:WEREFACE|morphface):[ ](.*),[ ](\d+)>/i
- @wereform_face[0] = $1.to_s
- @wereform_face[1] = $2.to_i
- end
- }
- return @wereform_face
- end
- #--------------------------------------------------------------------------
- # # Wereform Revert
- #--------------------------------------------------------------------------
- def wereform_revert
- return @wereform_revert if @wereform_revert != nil
- @wereform_revert = false
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:WEREFORM REVERT|metamorph revert)>/i
- @wereform_revert = true
- end
- }
- return @wereform_revert
- end
- end
- #==============================================================================
- # ** Game_Battler
- #==============================================================================
- class Game_Battler
- #--------------------------------------------------------------------------
- # * Apply Skill Effects
- #--------------------------------------------------------------------------
- alias skill_effect_pac_wereform skill_effect unless $@
- def skill_effect(user, skill)
- skill_effect_pac_wereform(user, skill)
- user.wereform_effect(skill)
- user.clear_wereforms if skill.wereform_revert
- end
- #--------------------------------------------------------------------------
- # * Apply Item Effects
- #--------------------------------------------------------------------------
- alias item_effect_pac_wereform item_effect unless $@
- def item_effect(user, item)
- item_effect_pac_wereform(user, item)
- user.wereform_effect(item)
- user.clear_wereforms if item.wereform_revert
- end
- #--------------------------------------------------------------------------
- # * Wereform Effect
- #--------------------------------------------------------------------------
- def wereform_effect(obj)
- return if obj.nil?
- return unless actor?
- return unless $game_temp.in_battle
- return unless obj.wereform > 0
- @wereform = obj.wereform
- if @wereimage.nil?
- @wereimage = @character_name
- @wereindex = @character_index
- @wereface = @face_name
- @werefndex = @face_index
- end
- if obj.wereform_image[0] != nil and obj.wereform_face[0] != nil
- a1 = obj.wereform_image[0]
- a2 = obj.wereform_image[1]
- b1 = obj.wereform_face[0]
- b2 = obj.wereform_face[1]
- set_graphic(a1, a2, b1, b2)
- end
- end
- #--------------------------------------------------------------------------
- # * Clear Wereforms
- #--------------------------------------------------------------------------
- def clear_wereforms
- return if @wereform.nil?
- @wereform = nil
- unless @wereimage.nil?
- set_graphic(@wereimage, @wereindex, @wereface, @werefndex)
- @wereimage = nil
- @wereindex = nil
- @wereface = nil
- @werefndex = nil
- $game_player.refresh
- end
- end
- end
- #==============================================================================
- # ** Game_Actor
- #==============================================================================
- class Game_Actor < Game_Battler
- #--------------------------------------------------------------------------
- # * Get Skill Object Array
- #--------------------------------------------------------------------------
- alias skills_pac_wereform skills unless $@
- def skills
- if @wereform != nil and @wereform > 0
- enemy = $data_enemies[@wereform]
- return skills_pac_wereform if enemy.nil?
- return enemy_skills(enemy)
- else
- return skills_pac_wereform
- end
- end
- #--------------------------------------------------------------------------
- # * Determine Usable Skills
- #--------------------------------------------------------------------------
- def skill_can_use?(skill)
- return super(skill)
- end
- #--------------------------------------------------------------------------
- # * Enemy Skills
- #--------------------------------------------------------------------------
- def enemy_skills(enemy)
- result = []
- for action in enemy.actions
- next unless action.kind == 1
- skill = $data_skills[action.skill_id]
- result.push(skill) unless result.include?(skill)
- end
- result.sort! { |a,b| a.id <=> b.id }
- return result.uniq
- end
- end
- #==============================================================================
- # ** Scene_Battle
- #==============================================================================
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # * Start processing
- #--------------------------------------------------------------------------
- alias start_pac_wereform start unless $@
- def start
- for member in $game_party.members do member.clear_wereforms end
- start_pac_wereform
- end
- #--------------------------------------------------------------------------
- # * End Battle
- #--------------------------------------------------------------------------
- alias battle_end_pac_wereform battle_end unless $@
- def battle_end(result)
- for member in $game_party.members do member.clear_wereforms end
- battle_end_pac_wereform(result)
- end
- end
- #===============================================================================
- #
- # PAC ACTOR-DEPENDENT STATS
- #
- #===============================================================================
- #==============================================================================
- # ** Game_Enemy
- #==============================================================================
- class Game_Enemy < Game_Battler
- #--------------------------------------------------------------------------
- # * Determine tags
- #--------------------------------------------------------------------------
- def tags
- return enemy.note.split("\r\n")
- end
- #--------------------------------------------------------------------------
- # * Get Basic Maximum HP
- #--------------------------------------------------------------------------
- def base_maxhp
- percent = actor_id = final_value = nil
- dynamic = false
- tags.each {|str|
- if str.include?('HP')
- dynamic = true
- percent = (str.gsub(/\D/,'').to_i/(str.include?('-')? -100.0 : 100.0))
- elsif str.include?('Actor')
- actor_id = (str.gsub(/\D/,'')).to_i
- end
- }
- if dynamic
- final_value = $game_actors[actor_id].base_maxhp
- final_value += ($game_actors[actor_id].base_maxhp * percent).round
- return final_value
- end
- return enemy.maxhp
- end
- #--------------------------------------------------------------------------
- # * Get Basic Maximum MP
- #--------------------------------------------------------------------------
- def base_maxmp
- percent = actor_id = final_value = nil
- dynamic = false
- tags.each {|str|
- if str.include?('MP')
- dynamic = true
- percent = (str.gsub(/\D/,'').to_i/(str.include?('-') ? -100.0 : 100.0))
- elsif str.include?('Actor')
- actor_id = (str.gsub(/\D/,'')).to_i
- end
- }
- if dynamic
- final_value = $game_actors[actor_id].base_maxmp
- final_value += ($game_actors[actor_id].base_maxmp * percent).round
- return final_value
- end
- return enemy.maxmp
- end
- #--------------------------------------------------------------------------
- # * Get Basic Maximum attack
- #--------------------------------------------------------------------------
- def base_atk
- percent = actor_id = final_value = nil
- dynamic = false
- tags.each {|str|
- if str.include?('ATK')
- dynamic = true
- percent = (str.gsub(/\D/,'').to_i/(str.include?('-') ? -100.0 : 100.0))
- elsif str.include?('Actor')
- actor_id = (str.gsub(/\D/,'')).to_i
- end
- }
- if dynamic
- final_value = $game_actors[actor_id].base_atk
- final_value += ($game_actors[actor_id].base_atk * percent).round
- return final_value
- end
- return enemy.atk
- end
- #--------------------------------------------------------------------------
- # * Get Basic defense
- #--------------------------------------------------------------------------
- def base_def
- percent = actor_id = final_value = nil
- dynamic = false
- tags.each {|str|
- if str.include?('DEF')
- dynamic = true
- percent = (str.gsub(/\D/,'').to_i/(str.include?('-') ? -100.0 : 100.0))
- elsif str.include?('Actor')
- actor_id = (str.gsub(/\D/,'')).to_i
- end
- }
- if dynamic
- final_value = $game_actors[actor_id].base_def
- final_value += ($game_actors[actor_id].base_def * percent).round
- return final_value
- end
- return enemy.def
- end
- #--------------------------------------------------------------------------
- # * Get Basic spirit
- #--------------------------------------------------------------------------
- def base_spi
- percent = actor_id = final_value = nil
- dynamic = false
- tags.each {|str|
- if str.include?('SPI')
- dynamic = true
- percent = (str.gsub(/\D/,'').to_i/(str.include?('-') ? -100.0 : 100.0))
- elsif str.include?('Actor')
- actor_id = (str.gsub(/\D/,'')).to_i
- end
- }
- if dynamic
- final_value = $game_actors[actor_id].base_spi
- final_value += ($game_actors[actor_id].base_spi * percent).round
- return final_value
- end
- return enemy.spi
- end
- #--------------------------------------------------------------------------
- # * Get Basic agility
- #--------------------------------------------------------------------------
- def base_agi
- percent = actor_id = final_value = nil
- dynamic = false
- tags.each {|str|
- if str.include?('AGI')
- dynamic = true
- percent = (str.gsub(/\D/,'').to_i/(str.include?('-') ? -100.0 : 100.0))
- elsif str.include?('Actor')
- actor_id = (str.gsub(/\D/,'')).to_i
- end
- }
- if dynamic
- final_value = $game_actors[actor_id].base_agi
- final_value += ($game_actors[actor_id].base_agi * percent).round
- return final_value
- end
- return enemy.agi
- end
- end
- #===============================================================================
- #
- # PAC FLASH ENEMY
- #
- #===============================================================================
- #==============================================================================
- # ** Game_Battler
- #------------------------------------------------------------------------------
- # This class deals with battlers. It's used as a superclass of the Game_Actor
- # and Game_Enemy classes.
- #==============================================================================
- class Game_Battler
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------
- attr_accessor :stop_effect # boolean to turn off any effect.
- #--------------------------------------------------------------------------
- # alias listing
- #--------------------------------------------------------------------------
- alias pac_fe_initialize initialize
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(*args)
- @stop_effect = false
- pac_fe_initialize
- end
- end
- #==============================================================================
- # ** Sprite_Battler
- #------------------------------------------------------------------------------
- # This sprite is used to display battlers. It observes a instance of the
- # Game_Battler class and automatically changes sprite conditions.
- #==============================================================================
- class Sprite_Battler
- #--------------------------------------------------------------------------
- # alias listing
- #--------------------------------------------------------------------------
- alias pac_fe_update_effect update_effect
- #--------------------------------------------------------------------------
- # * Update Effect
- #--------------------------------------------------------------------------
- def update_effect(*args)
- if @battler.stop_effect
- @effect_duration = 1
- @battler.stop_effect = false
- end
- pac_fe_update_effect(*args)
- end
- end
- #==============================================================================
- # ** Scene_Battle
- #------------------------------------------------------------------------------
- # This class performs battle screen processing.
- #==============================================================================
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # alias listing
- #--------------------------------------------------------------------------
- alias pac_fe_start_target_enemy_selection start_target_enemy_selection
- alias pac_fe_update_target_enemy_selection update_target_enemy_selection
- #--------------------------------------------------------------------------
- # * Start Target Enemy Selection
- #--------------------------------------------------------------------------
- def start_target_enemy_selection(*args)
- @fe_effect_frames = PAC::BATTLE::FLASH_TYPE == 1 ? 16 : 20
- @blink_frames = @fe_effect_frames + PAC::BATTLE::REST_FRAMES
- pac_fe_start_target_enemy_selection
- end
- #--------------------------------------------------------------------------
- # * Update Target Enemy Selection
- #--------------------------------------------------------------------------
- def update_target_enemy_selection
- old_enemy = @target_enemy_window.enemy
- pac_fe_update_target_enemy_selection
- if @target_enemy_window.nil? || old_enemy != @target_enemy_window.enemy
- old_enemy.stop_effect = true
- return if @target_enemy_window.nil?
- @blink_frames = @fe_effect_frames + PAC::BATTLE::REST_FRAMES
- end
- if @blink_frames >= @fe_effect_frames + PAC::BATTLE::REST_FRAMES
- @blink_frames = 0
- if PAC::BATTLE::FLASH_TYPE == 1
- @target_enemy_window.enemy.white_flash = true
- elsif PAC::BATTLE::FLASH_TYPE == 2
- @target_enemy_window.enemy.blink = true
- else
- p "PAC Flash Enemy: FLASH_TYPE not set to 1 or 2. Prepare for death."
- exit
- end
- end
- @blink_frames += 1
- end
- end
- #===============================================================================
- #
- # PAC VICTORY WINDOW
- #
- #===============================================================================
- if PAC::BATTLE::USE_VICTORY == true
- #==============================================================================
- # ** Window_Victory
- #------------------------------------------------------------------------------
- # This window displays the actors' status at the end of battle.
- #==============================================================================
- class Window_Victory < Window_Base
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(result)
- super(0, 0, 546, 32 + (WLH * ($game_party.members.size + 2)) )
- self.z = 10001
- self.contents.font.color = normal_color
- self.contents.draw_text(0, 0, self.contents.width, WLH, result[0])
- self.contents.draw_text(0, WLH, self.contents.width, WLH, result[1])
- $game_party.members.each_index do |i|
- actor = $game_party.members[i]
- ty = WLH * (i + 2)
- draw_actor_name(actor, 0, ty)
- draw_actor_hp(actor, 70, ty)
- draw_actor_mp(actor, 192, ty)
- text = sprintf(Vocab::ExpNext, Vocab::level)
- tw = contents.text_size(text).width
- self.contents.draw_text(320, ty, contents.width, WLH, text)
- self.contents.font.color = normal_color
- self.contents.draw_text(320 + tw + 16, ty,
- contents.width, WLH, actor.next_exp_s)
- end
- end
- end
- #==============================================================================
- # ** Scene_Battle
- #------------------------------------------------------------------------------
- # This class performs battle screen processing.
- #==============================================================================
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # alias listing
- #--------------------------------------------------------------------------
- alias pac_vicwindow_battle_end battle_end
- alias pac_vicwindow_display_exp_and_gold display_exp_and_gold
- #--------------------------------------------------------------------------
- # * End Battle
- # result : Results (0: win, 1: escape, 2: lose)
- #--------------------------------------------------------------------------
- def battle_end(result)
- @victory_window.dispose if result == 0
- pac_vicwindow_battle_end(result)
- end
- #--------------------------------------------------------------------------
- # * Display Gained Experince and Gold
- #--------------------------------------------------------------------------
- def display_exp_and_gold
- result = [sprintf(Vocab::ObtainExp, $game_troop.exp_total),
- sprintf(Vocab::ObtainGold, $game_troop.gold_total, Vocab::gold)]
- @victory_window = Window_Victory.new(result)
- pac_vicwindow_display_exp_and_gold
- end
- end
- end
- #===============================================================================
- #
- # PAC SPECIAL COLLAPSE
- #
- #===============================================================================
- #==============================================================================
- # ** RPG::Enemy
- #------------------------------------------------------------------------------
- # Data class for enemies.
- #==============================================================================
- class RPG::Enemy
- #--------------------------------------------------------------------------
- # * Collapse Animation
- #--------------------------------------------------------------------------
- def collapse_animation
- collapse_note = self.note[/\\COLLAPSE_ANIM\[(\d+)\]/i]
- @collapse_anim = collapse_note != nil ? $1.to_i : 0 if @collapse_anim.nil?
- return @collapse_anim
- end
- #--------------------------------------------------------------------------
- # * Collapse Type
- #--------------------------------------------------------------------------
- def collapse_type
- return $1.to_i if self.note[/\\COLLAPSE_TYPE\[(\d+)\]/i] != nil
- array = self.effect_ids
- if self.note[/\\COLLAPSE_TYPE_RANDOM/i] != nil
- return array[rand(array.size)]
- end
- return 0
- end
- #--------------------------------------------------------------------------
- # * Collapse Colour
- #--------------------------------------------------------------------------
- def collapse_color
- r, g, b, a = 255, 128, 128, 128
- if self.note[/\\COLLAPSE_COLOU?R\[#([\dABCDEF]+)\]/i] != nil
- r = $1[0, 2].to_i(16) if $1.size >= 2
- g = $1[2, 2].to_i(16) if $1.size >= 4
- b = $1[4, 2].to_i(16) if $1.size >= 6
- a = $1[6, 2].to_i(16) if $1.size >= 8
- end
- return r, g, b, a
- end
- #--------------------------------------------------------------------------
- # * Collapse Blend
- #--------------------------------------------------------------------------
- def collapse_blend
- return $1.to_i % 3 if self.note[/\\COLLAPSE_BLEND\[(\d+)\]/i] != nil
- return 1
- end
- #--------------------------------------------------------------------------
- # * Effect IDs
- #--------------------------------------------------------------------------
- def effect_ids
- effects = []
- for i in 0...16 do effects.push (i) end
- return effects
- end
- end
- #==============================================================================
- # ** Game_Enemy
- #------------------------------------------------------------------------------
- # This class handles enemy characters. It's used within the Game_Troop class
- # ($game_troop).
- #==============================================================================
- class Game_Enemy
- #--------------------------------------------------------------------------
- # * Public Instance Variable
- #--------------------------------------------------------------------------
- attr_reader :collapse_type
- #--------------------------------------------------------------------------
- # alias listing
- #--------------------------------------------------------------------------
- alias pac_spec_collapse_perform_collapse perform_collapse
- #--------------------------------------------------------------------------
- # * Perform Collapse
- #--------------------------------------------------------------------------
- def perform_collapse(*args)
- if enemy.collapse_animation > 0 and $game_temp.in_battle and dead?
- @collapse = true
- self.animation_id = enemy.collapse_animation
- else
- pac_spec_collapse_perform_collapse(*args)
- end
- @collapse_type = enemy.collapse_type
- end
- end
- #==============================================================================
- # ** Sprite_Battler
- #------------------------------------------------------------------------------
- # This sprite is used to display battlers. It observes a instance of the
- # Game_Battler class and automatically changes sprite conditions.
- #==============================================================================
- class Sprite_Battler
- #--------------------------------------------------------------------------
- # alias listing
- #--------------------------------------------------------------------------
- alias pac_spec_collapse_update_collapse update_collapse
- alias pac_spec_collapse_setx x= unless $@
- alias pac_spec_collapse_sety y= unless $@
- #--------------------------------------------------------------------------
- # * Update Collapse
- #--------------------------------------------------------------------------
- def update_collapse(*args)
- if @battler.actor?
- pac_spec_collapse_update_collapse(*args) # Run Original Method
- return
- end
- # If animation, hold off on executing collapse
- if self.animation?
- # Restore lost time
- @effect_duration += 1
- return
- end
- execute_special_collapse (@battler.collapse_type)
- pac_spec_collapse_update_collapse(*args) # Run Original Method
- self.color.set(*@battler.enemy.collapse_color)
- self.blend_type = @battler.enemy.collapse_blend
- # Update Duplicate Sprite Opacity
- @dup_sprite.opacity = self.opacity if @dup_sprite != nil
- # If Ending the effect
- if @effect_duration == 0
- # Restore Zoom
- self.zoom_x = 1
- self.zoom_y = 1
- # Free @dup_sprite (not dispose because of Cache)
- @dup_sprite = nil
- elsif @effect_duration == 47 && @battler.enemy.collapse_animation > 0
- # Play Collapse SE once animation has finished.
- Sound.play_enemy_collapse
- end
- end
- #--------------------------------------------------------------------------
- # * Set X
- #--------------------------------------------------------------------------
- def x=(n, *args)
- # Override general x setting when collapsing
- return if @effect_type == COLLAPSE and n == @battler.screen_x
- pac_spec_collapse_setx(n, *args)
- end
- #--------------------------------------------------------------------------
- # * Set Y
- #--------------------------------------------------------------------------
- def y=(n, *args)
- # Override general y setting when collapsing
- return if @effect_type == COLLAPSE and n == @battler.screen_y
- pac_spec_collapse_sety(n, *args)
- end
- #--------------------------------------------------------------------------
- # * Create Duplicate Sprite
- #--------------------------------------------------------------------------
- def create_dup_sprite (split_type = 0)
- # Create new sprite of the same class and set components
- @dup_sprite = self.class.new (self.viewport, @battler)
- @dup_sprite.x, @dup_sprite.y = self.x, self.y
- @dup_sprite.blend_type = 1
- @dup_sprite.color.set(255, 128, 128, 128)
- @dup_sprite.update
- if split_type == 0 # Vertical Split
- @dup_sprite.src_rect.width = @dup_sprite.ox
- self.src_rect.x = self.ox
- self.x += self.ox
- elsif split_type == 1 # Horizontal Split
- @dup_sprite.src_rect.height = @dup_sprite.oy / 2
- self.src_rect.y = self.oy / 2
- self.y += self.oy / 2
- end
- end
- #--------------------------------------------------------------------------
- # * Execute Special Collapse
- # collapse_type (type of collapse)
- #--------------------------------------------------------------------------
- def execute_special_collapse (collapse_type)
- case collapse_type
- when 1 # Shrink
- self.zoom_x -= 0.02
- self.zoom_y -= 0.02
- self.y -= (0.01*self.height)
- when 2 # Horizontal Expansion
- self.zoom_x += 0.05
- self.zoom_y -= 0.02
- when 3 # Vertical Expansion
- self.zoom_y += 0.05
- self.zoom_x -= 0.02
- when 4 # Spring Ascent
- if @effect_duration >= 24 then
- self.zoom_y = [self.zoom_y - 0.02, 0].max
- self.zoom_x = [self.zoom_x + 0.01, 1.24].min
- else
- self.zoom_x -= 0.115
- self.zoom_y += 0.6
- end
- when 5 # Rotate
- self.zoom_x -= 0.03
- self.zoom_y += 0.05
- self.angle += 7.5
- when 6 # Shake Descent
- if @effect_duration >= 44
- self.ox -= 1
- else
- self.ox += ((@effect_duration / 4) % 2) == 0 ? 2 : -2
- end
- self.src_rect.y -= self.bitmap.rect.height / 48
- when 7 # Vertical Division; Vertical Movement
- create_dup_sprite (0) if @effect_duration == 47 # Split Vertically
- self.y += [self.oy / 96, 1].max
- @dup_sprite.y -= [@dup_sprite.oy / 96, 1].max
- when 8 # Horizontal Division; Horizontal Movement
- create_dup_sprite (1) if @effect_duration == 47 # Split Horizontally
- self.x += [self.ox / 48, 1].max
- @dup_sprite.x -= [@dup_sprite.ox / 48, 1].max
- when 9 # Vertical Division; Horizontal Movement
- create_dup_sprite (0) if @effect_duration == 47 # Split Vertically
- self.x += [self.ox / 48, 1].max
- @dup_sprite.x -= [@dup_sprite.ox / 48, 1].max
- when 10 # Horizontal Division; Vertical Movement
- create_dup_sprite (1) if @effect_duration == 47 # Split Horizontally
- self.y += [self.oy / 96, 1].max
- @dup_sprite.y -= [@dup_sprite.oy / 96, 1].max
- when 11 # Wave
- self.wave_amp += 1
- when 12 # Blur
- self.bitmap = self.bitmap.dup if @effect_duration == 47
- self.bitmap.blur if @effect_duration % 4 == 0
- when 13 # Fast Rotate and Shrink
- self.angle += 48 - @effect_duration
- execute_special_collapse (1)
- when 14 # Eraser
- self.bush_opacity = 0
- self.bush_depth += (self.height / 48.0).ceil
- when 15 # Pixel Eraser
- if @effect_duration == 47
- self.bitmap = self.bitmap.dup
- @pixels_to_erase = []
- for i in 0...self.bitmap.width
- for j in 0...self.bitmap.height
- @pixels_to_erase.push ([i, j])
- end
- end
- @pixel_erase_rate = @pixels_to_erase.size / 48
- end
- erase_color = Color.new (255, 255, 255, 0)
- @pixel_erase_rate.times do
- x, y = @pixels_to_erase.delete_at (rand (@pixels_to_erase.size))
- self.bitmap.set_pixel (x, y, erase_color)
- end
- end
- end
- end
- #==============================================================================
- # ** RPG::Enemy
- #------------------------------------------------------------------------------
- # Data class for enemies.
- #==============================================================================
- class RPG::Enemy
- #--------------------------------------------------------------------------
- # public instance variables
- #--------------------------------------------------------------------------
- attr_accessor :swaps
- #--------------------------------------------------------------------------
- # common cache: pac_cache_enemy_ae
- #--------------------------------------------------------------------------
- def pac_cache_enemy_ae
- return if @cached_enemy_ae; @cached_enemy_ae = true
- @swaps = []
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:SWAP|PACswaps):[ ]*(\d+(?:\s*,\s*\d+)*)>/i
- $1.scan(/\d+/).each { |num| @swaps.push(num.to_i) if num.to_i > 0 }
- end
- }
- end
- end
- #==============================================================================
- # ** Scene_Title
- #------------------------------------------------------------------------------
- # This class performs the title screen processing.
- #==============================================================================
- class Scene_Title < Scene_Base
- #--------------------------------------------------------------------------
- # alias listing
- #--------------------------------------------------------------------------
- alias load_bt_database_ae load_bt_database unless $@
- alias load_database_ae load_database unless $@
- #--------------------------------------------------------------------------
- # * Load Battle Test Database
- #--------------------------------------------------------------------------
- def load_bt_database
- load_bt_database_ae
- load_ae_cache
- end
- #--------------------------------------------------------------------------
- # * Load Database
- #--------------------------------------------------------------------------
- def load_database
- load_database_ae
- load_ae_cache
- end
- #--------------------------------------------------------------------------
- # * Load Advanced Enemies Cache
- #--------------------------------------------------------------------------
- def load_ae_cache
- groups = [$data_enemies]
- for group in groups
- for obj in group
- next if obj == nil
- obj.pac_cache_enemy_ae if obj.is_a?(RPG::Enemy)
- end
- end
- end
- end
- #===============================================================================
- #
- # PAC DAMAGE POPUP
- #
- #===============================================================================
- if PAC::BATTLE::USE_POPUP
- #==============================================================================
- # ** Game_System
- #------------------------------------------------------------------------------
- # This class handles system-related data. Also manages vehicles and BGM, etc.
- # The instance of this class is referenced by $game_system.
- #==============================================================================
- class Game_System
- #--------------------------------------------------------------------------
- # Public Instance Variables
- #--------------------------------------------------------------------------
- attr_accessor :battle_popup_font
- attr_accessor :battle_popup_size
- attr_accessor :battle_popup_colour
- #--------------------------------------------------------------------------
- # Alias listing
- #--------------------------------------------------------------------------
- alias pac_damage_popup_initialize initialize
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- pac_damage_popup_initialize # Usual method
- @battle_popup_font = PAC::BATTLE::POPUP_FONT # Initialize font.
- @battle_popup_size = PAC::BATTLE::POPUP_SIZE # Initialize size.
- @battle_popup_colour = PAC::BATTLE::POPUP_COLOUR # Initialize colour.
- end
- end
- #==============================================================================
- # ** Sprite_Base
- #------------------------------------------------------------------------------
- # A sprite class with animation display processing added.
- #==============================================================================
- class Sprite_Base < Sprite
- #--------------------------------------------------------------------------
- # alias listing
- #--------------------------------------------------------------------------
- alias pac_popup_initialize initialize
- alias pac_popup_update update
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize(*args)
- pac_popup_initialize(*args)
- @_damage_duration = 0
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- pac_popup_update
- if @_damage_duration > 0
- @_damage_duration -= 1
- case @_damage_duration
- when 38..39
- @_damage_sprite.y -= 4
- when 36..37
- @_damage_sprite.y -= 2
- when 34..35
- @_damage_sprite.y += 2
- when 28..33
- @_damage_sprite.y += 4
- end
- @_damage_sprite.opacity = 256 - (12 - @_damage_duration) * 32
- if @_damage_duration == 0
- dispose_damage
- end
- end
- end
- #--------------------------------------------------------------------------
- # * Display Damage
- #--------------------------------------------------------------------------
- def damage(value)
- dispose_damage
- damage_string = value.is_a?(Numeric) ? value.abs.to_s : value.to_s
- bitmap = Bitmap.new(160, 48)
- bitmap.font.name = $game_system.battle_popup_font
- bitmap.font.size = $game_system.battle_popup_size
- bitmap.font.color.set(0, 0, 0)
- #--------------------------------------------------------------------------
- bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
- bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
- bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
- bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
- #--------------------------------------------------------------------------
- if value.is_a?(Numeric) and value < 0
- bitmap.font.color.set(176, 255, 144)
- else
- if $game_system.battle_popup_colour.is_a?(Array)
- a = $game_system.battle_popup_colour
- bitmap.font.color.set(*a)
- else
- case $game_system.battle_popup_colour
- when :red; bitmap.font.color.set(255, 0, 0)
- when :white; bitmap.font.color.set(255, 255, 255)
- when :black; bitmap.font.color.set(0, 0, 0)
- when :green; bitmap.font.color.set(0, 255, 0)
- when :blue; bitmap.font.color.set(0, 0, 255)
- when :grey; bitmap.font.color.set(125, 125, 125)
- when :brown; bitmap.font.color.set(128, 64, 32)
- when :orange; bitmap.font.color.set(255, 99, 20)
- when :yellow; bitmap.font.color.set(255, 255, 0)
- when :cyan; bitmap.font.color.set(0, 255, 255)
- when :turquoise; bitmap.font.color.set(0, 255, 128)
- when :purple; bitmap.font.color.set(128, 0, 255)
- when :pink; bitmap.font.color.set(255, 0, 255)
- else; bitmap.font.color.set(255, 255, 255)
- end
- end
- end
- #--------------------------------------------------------------------------
- bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
- #--------------------------------------------------------------------------
- @_damage_sprite = Sprite.new(self.viewport)
- @_damage_sprite.bitmap = bitmap
- @_damage_sprite.ox = 80
- @_damage_sprite.oy = 20
- @_damage_sprite.x = self.x + PAC::BATTLE::POPUP_XPLUS
- @_damage_sprite.y = (self.y - self.oy / 2) + PAC::BATTLE::POPUP_YPLUS
- @_damage_sprite.z = 3000
- @_damage_duration = 40
- end
- #--------------------------------------------------------------------------
- # * Dispose of Damage Sprite
- #--------------------------------------------------------------------------
- def dispose_damage
- if @_damage_sprite != nil
- @_damage_sprite.bitmap.dispose
- @_damage_sprite.dispose
- @_damage_sprite = nil
- @_damage_duration = 0
- end
- end
- end
- #==============================================================================
- # ** Game_Battler
- #------------------------------------------------------------------------------
- # This class deals with battlers. It's used as a superclass of the Game_Actor
- # and Game_Enemy classes.
- #==============================================================================
- class Game_Battler
- #--------------------------------------------------------------------------
- # Public Instance Variables
- #--------------------------------------------------------------------------
- attr_accessor :damage
- #--------------------------------------------------------------------------
- # alias listing
- #--------------------------------------------------------------------------
- alias pac_popup_clear_sprite_effects clear_sprite_effects
- #--------------------------------------------------------------------------
- # * Clear Variable Used for Sprite Communication
- #--------------------------------------------------------------------------
- def clear_sprite_effects
- @damage = 0
- pac_popup_clear_sprite_effects
- end
- end
- #==============================================================================
- # ** Sprite_Battler
- #------------------------------------------------------------------------------
- # This sprite is used to display battlers. It observes a instance of the
- # Game_Battler class and automatically changes sprite conditions.
- #==============================================================================
- class Sprite_Battler < Sprite_Base
- #--------------------------------------------------------------------------
- # Constants
- #--------------------------------------------------------------------------
- DAMAGE = 7
- #--------------------------------------------------------------------------
- # alias listing
- #--------------------------------------------------------------------------
- alias pac_popup_setup_new_effect setup_new_effect
- #--------------------------------------------------------------------------
- # * Set New Effect
- #--------------------------------------------------------------------------
- def setup_new_effect
- pac_popup_setup_new_effect
- if @battler.damage != 0
- damage(@battler.damage)
- @effect_type = DAMAGE
- @battler.damage = 0
- end
- end
- end
- #==============================================================================
- # ** Scene_Battle
- #------------------------------------------------------------------------------
- # This class performs battle screen processing.
- #==============================================================================
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # alias listing
- #--------------------------------------------------------------------------
- alias pac_popup_display_action_effects display_action_effects
- #--------------------------------------------------------------------------
- # * Show Action Results
- # target : Target
- # obj : Skill or item
- #--------------------------------------------------------------------------
- def display_action_effects(target, *args)
- unless target.skipped
- target.damage = target.hp_damage if target.is_a?(Game_Enemy)
- end
- pac_popup_display_action_effects(target, *args)
- end
- end
- end
- #===============================================================================
- #
- # PAC BATTLE COUNT
- #
- #===============================================================================
- #==============================================================================
- # ** Game_Interpreter
- #------------------------------------------------------------------------------
- # An interpreter for executing event commands. This class is used within the
- # Game_Map, Game_Troop, and Game_Event classes.
- #==============================================================================
- class Game_Interpreter
- #--------------------------------------------------------------------------
- # * Reset all battle counters
- #--------------------------------------------------------------------------
- def reset_battle_count
- $game_system.reset_battle_count
- end
- #--------------------------------------------------------------------------
- # * Simple Battle Count Commands
- #--------------------------------------------------------------------------
- battle_count_commands = ["battle", "victory", "escape", "lose",
- "total_defeat", "total_dead"]
- battle_count_commands.each { |command|
- battle_count_method = %Q(
- def get_#{command}_count(id = 0)
- n = $game_system.get_#{command}_count
- if id > 0
- $game_variables[id] = n
- $game_map.need_refresh = true
- end
- return n
- end
- )
- eval(battle_count_method)
- }
- #--------------------------------------------------------------------------
- # * Advanced Battle Count Commands
- #--------------------------------------------------------------------------
- advanced_count_commands = ["defeat", "dead"]
- advanced_count_commands.each { |command|
- advanced_count_method = %Q(
- def get_#{command}_count(id1, id2 = 0)
- n = $game_system.get_#{command}_count(id1)
- if id2 > 0
- $game_variables[id2] = n
- $game_map.need_refresh = true
- end
- return n
- end
- )
- eval(advanced_count_method)
- }
- end
- #==============================================================================
- # ** Game_System
- #------------------------------------------------------------------------------
- # This class handles system-related data. Also manages vehicles and BGM, etc.
- # The instance of this class is referenced by $game_system.
- #==============================================================================
- class Game_System
- #--------------------------------------------------------------------------
- # Public Instance Variables
- #--------------------------------------------------------------------------
- attr_accessor :battle_count
- attr_accessor :victory_count
- attr_accessor :escape_count
- attr_accessor :lose_count
- attr_accessor :defeat_count
- attr_accessor :dead_count
- #--------------------------------------------------------------------------
- # Alias listing
- #--------------------------------------------------------------------------
- alias pac_battle_counter_initialize initialize
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- pac_battle_counter_initialize
- reset_battle_counter
- end
- #--------------------------------------------------------------------------
- # * Clear all battle counters
- #--------------------------------------------------------------------------
- def reset_battle_counter
- @battle_count = 0
- @victory_count = 0
- @escape_count = 0
- @lose_count = 0
- @defeat_count = []
- @dead_count = []
- end
- #--------------------------------------------------------------------------
- # * Simple Battle Count Commands
- #--------------------------------------------------------------------------
- battle_count_commands = ["battle", "victory", "escape", "lose"]
- battle_count_commands.each { |command|
- battle_count_method = %Q(
- def get_#{command}_count
- reset_battle_counter if @#{command}_count == nil
- return @#{command}_count
- end
- )
- eval(battle_count_method)
- }
- #--------------------------------------------------------------------------
- # * Advanced Battle Count Commands
- #--------------------------------------------------------------------------
- advanced_count_commands = [["defeat", "enemies"], ["dead", "actors"]]
- advanced_count_commands.each { |command|
- advanced_count_methods = %Q(
- def get_#{command[0]}_count(id)
- reset_battle_counter if #{command[0]} == nil
- @#{command[0]}_count[id] = 0 if @#{command[0]}_count[id] == nil
- return @#{command[0]}_count[id]
- end
- def add_#{command[0]}_count(id)
- reset_battle_counter if @#{command[0]}_count[id] == nil
- @#{command[0]}_count[id] = 0 if @#{command[0]}_count[id] == nil
- @#{command[0]}_count[id] += 1
- end
- def total_#{command[0]}_count
- n = 0
- for i in 1...$data_#{command[1]}.size
- n += get_#{command[0]}_count(i)
- end
- return n
- end
- )
- eval(advanced_count_methods)
- }
- end
- #==============================================================================
- # ** Scene_Battle
- #------------------------------------------------------------------------------
- # This class performs battle screen processing.
- #==============================================================================
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # Alias listing
- #--------------------------------------------------------------------------
- alias pac_battle_counter_post_start post_start
- alias pac_battle_counter_battle_end battle_end
- alias pac_battle_counter_execute_action execute_action
- #--------------------------------------------------------------------------
- # * Post-Start Processing
- #--------------------------------------------------------------------------
- def post_start(*args)
- $game_system.battle_count += 1
- pac_battle_counter_post_start(*args)
- end
- #--------------------------------------------------------------------------
- # * End Battle
- # result : Results (0: win, 1: escape, 2:lose)
- #--------------------------------------------------------------------------
- def battle_end(result, *args)
- unless @battle_count_added
- case result
- when 0 # Victory
- $game_system.victory_count += 1
- when 1 # Escape
- $game_system.escape_count += 1
- when 2 # Defeat
- $game_system.lose_count += 1
- end
- $game_troop.dead_members.each { |enemy|
- $game_system.add_defeat_count(enemy.enemy.id)
- }
- @battle_count_added = true
- end
- pac_battle_counter_battle_end(result, *args)
- end
- #--------------------------------------------------------------------------
- # * Execute Battle Actions
- #--------------------------------------------------------------------------
- def execute_action(*args)
- last_exist_actors = $game_party.existing_members
- pac_battle_counter_execute_action(*args)
- dead_actors = last_exist_actors - $game_party.existing_members
- dead_actors.each { |actor|
- $game_system.add_dead_count(actor.id)
- }
- end
- end
- if !$pac["Battle Addons Setup"] || !$pac["Battle Addons Setup"].is_a?(Array) ||
- $pac["Battle Addons Setup"][0] < 1.7
- p "You require PAC Battle Addons Setup 1.7 or higher."
- exit
- end
- #===============================================================================
- #
- # END OF SCRIPT
- #
- #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement