Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
  • 0
Sign in to follow this  
Heretic86

Cursed Weapons (Unequippable) Script for RMXP?

Question

So yeah, I have googled and googled, and the only scripts that I find for Cursed Weapons (Unequippable and have other negative effects on characters fighting ability) are for VX. Does anyone know of one for RMXP?

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Add-On Collection by ForeverZer0 has the Cursed Weapon Script embedded within it:

 

 

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# Add-On Collection by ForeverZer0
# Type: Add-on Collection Control Script
# Date: 4.21.2010
# Version: v.2.5
# (Version History at bottom)
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
# Introduction:
#
#   This is my own personal Add-On Collection. All the scripts are my own 
#   original creation, unless otherwise noted. This will also be a work in
#   progress, I plan to continue to update the scripts with any improvements,
#   bug fixes (I'm sure there's gonna be a few), and add new scripts as I write
#   them.
#
#   This is primarily going to be used for smaller scripts that I feel, do not
#   merit their own release, though I am not sticking to that as a rule. Many
#   are short due to their simplicity, and others only because they are coded 
#   well. I am attempting to create scripts that I personally have never seen
#   among the forums, so you will find some are very unique and you love, and 
#   others cater only to selective needs.
#
#   For the sake of simplicity, this script will be in the same format and 
#   work exactly the same as Blizzard's Tons-of-Add-ons. The main controls
#   to enable/disable the scripts will be at the top, with the configuration
#   for the individual scripts within its respective section. I will post new
#   updates, if any, every Wednesday. New versions will increase by 0.1 for
#   every new script added.
#
#   As any other scripter can likely relate, its not always the scripts that are
#   difficult, it is coming up with the ideas for what to write. If you have any
#   ideas for scripts, or an idea of how to improve an existing one, don't
#   hesitate to give some feedback. If you are trying to learn to script, and 
#   have a question about something I did in a script, I'll be happy to explain
#   it, though my chances to check the forums are limited, so be patient.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
# Features:   (Total = 29)
#
#   1. Pickpocket Ability
#       - Press the a button to steal from NPCs (just like Star Ocean)
#   2. Code-to-Text-Box
#       - use \cd[sCRIPT] to output script variables to a text box in game
#   3. Ambient_SFX 
#       - Play bird calls, insect noises, etc. at random intervals
#   4. Down_Graphics 
#       - Will automatically display correct Down graphic for the lead actor
#   5. Party Split Experience
#       - Experience will be divided among active party members
#   6. Two-Handed Weapons/Gauntlets
#       - Will disallow shield if equipped (usually for more powerful weapons)
#       - Also includes "Gauntlets" script, which makes any weapon Two-Handed
#   7. Sprint Shoes 
#       - Increases move speed if any party members have them equipped
#   8. Encounter Rate Modifying Equipment 
#       - Name kinda says it all...
#   9. Experience Egg 
#       - Accessory that can give increased experience to equipped player
#  10. Gold Bonus Equipment
#       - Party recieves bonus gold after battle
#  11. Treasure Hunter Equipment
#       - Doubles enemy treasure drop chance if equipped
#  12. Coward's Equipment
#       - Guaranteed escape success if using this equipment
#  13. Terrain Speeds 
#       - Move speed changes depending on player's current terrain tag
#  14. Window Positioner 
#       - Player can change showing window position using L and R
#  15. Map Treasures
#       - Can have random treasures 'buried' around each map to be found
#  16. Auto Animate
#       - Use a comment to set up events whose animations cycle (smoke, etc.)
#  17. Easy Inn Event
#       - Takes care of all the 'Utility' aspects of Inn events 
#  18. Cursed Weapon
#       - (Just like the Paladin Shield from FFIV)
#  19. Blood Weapons
#       - Weapons that increase in power with the more enemies they kill
#  20. Revenge Weapons
#       - Attack power increases as HP goes down.
#  21. Def Up Armors
#       - Armors that increase defense as HP goes down
#  22. Hp1 Revive
#       - Dead actors automatically return to 1 HP after battle
#  23. Mixed Class Equipment
#       - Accessories that allow the wearer to equip other class's equipment.
#  24. Mapback Scene Converter
#       - Will alter any scene to use opaque windows and show the map behind
#  25. Scope Change in Battle
#       - Full control of targetting in battle (Single/All/Enemies/Allies)
#  26. Multi Attack Weapons
#       - Create equipment that allows basic attacks to target all enemies
#  27. Auto Enemy Stats
#       - Enemy's stats will automatically adjust to party's stats
#  28. Event 'Range' Conditions
#       - Various easy conditions based on event/player's X and Y, for eventing
#  29. Chemist Ability
#       - Create class who will have double effect when using items.
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
# Instructions:
#
#   - Configuration is below. Scripts can be enabled/disabled completely by
#     setting them to true/false
#   - If any configuration requires you to add data into [ ], make sure that
#     all values are seperated with commas.
#   - For any configuration that allows to set values to a float (decimal), 
#     include the 0.    ex.  (0.5)  NOT  (.5)
#   - For better performance, unless otherwise specified, any configuration that
#     is a string, use single quotes (''), not double ("").
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:

module Zer0_CFG
#-------------------------------------------------------------------------------
#  * BEGIN CONFIGURATION SECTION 1
#-------------------------------------------------------------------------------
#   Settings in this section cannot be altered in-game
#-------------------------------------------------------------------------------

   PICKPOCKET_ABILITY          = false
   CODE_TO_TEXT_BOX            = false
   DOWN_GRAPHICS               = true
   PARTY_SPLIT_EXP             = false
   TWO_HANDED_WEAPONS          = true
   EXPERIENCE_EGG              = true
   GOLD_BONUS_EQUIP            = true
   TREASURE_HUNTER             = true
   COWARD_EQUIPMENT            = false
   MAP_TREASURES               = true
   EASY_INN_EVENT              = false
   CURSED_WEAPON               = false
   BLOOD_WEAPONS               = false
   REVENGE_WEAPONS             = true
   DEF_UP_ARMORS               = true
   MIXED_CLASS_EQUIP           = false
   AUTO_ENEMY_STATS            = false

#-------------------------------------------------------------------------------
#  * END CONFIGURATION SECTION 1
#-------------------------------------------------------------------------------

end
class Game_System
 alias zer0_addon_collection_init initialize
 def initialize

#-------------------------------------------------------------------------------
#  * BEGIN CONFIGURATION SECTION 2
#-------------------------------------------------------------------------------
#  These can all be changed in-game with a script call using this syntax:
#
#               $game_system.NAME_OF_ADDON = true/false    
#-------------------------------------------------------------------------------

   @AMBIENT_SFX                = false
   @SPRINT_SHOES               = false
   @ENCOUNTER_EQUIPMENT        = false
   @TERRAIN_SPEEDS             = false
   @WINDOW_POSITIONER          = false
   @AUTO_ANIMATE               = false
   @HP1_REVIVE                 = false
   @MAPBACK_SCENES             = false
   @SCOPE_CHANGE               = false
   @MULTI_ATTACK               = true
   @RANGE_CONDITION            = false
   @CHEMIST_ABILITY            = false

#-------------------------------------------------------------------------------
#  * END CONFIGURATION SECTION 2
#-------------------------------------------------------------------------------

#●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
# * BEGIN DON'T TOUCH THIS SECTION 
#●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
#
#  Do not edit this section in any way. The only thing you will accomplish is
#  screwing up numerous other scripts. The majority of it is simply to create
#  arrays that hold the IDs of the current party's equipment and tell it when
#  to refresh the data.
#
#●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
   zer0_addon_collection_init
 end
 attr_accessor :AMBIENT_SFX
 attr_accessor :SPRINT_SHOES
 attr_accessor :ENCOUNTER_EQUIPMENT
 attr_accessor :TERRAIN_SPEEDS
 attr_accessor :WINDOW_POSITIONER
 attr_accessor :AUTO_ANIMATE
 attr_accessor :HP1_REVIVE
 attr_accessor :MAPBACK_SCENES
 attr_accessor :SCOPE_CHANGE
 attr_accessor :MULTI_ATTACK
 attr_accessor :RANGE_CONDITION
 attr_accessor :CHEMIST_ABILITY
end

$zer0_addons = 2.5
# Variable for recognition by other scripts.

class Game_Screen
 attr_accessor :tone
end

class Game_Party

 attr_accessor :armor_set
 attr_accessor :weapon_set

 alias zer0_party_equipment_init initialize
 def initialize
   zer0_party_equipment_init
   @weapon_set, @armor_set = [], []
 end

 def get_party_equipment
   # Empty the arrays before refreshing
   @weapon_set, @armor_set = [], []
   # Place all of active party's armor and weapons IDs into the arrays.
   @actors.each_index {|i|
     @weapon_set.push @actors[i].weapon_id
     @armor_set.push @actors[i].armor1_id
     @armor_set.push @actors[i].armor2_id
     @armor_set.push @actors[i].armor3_id
     @armor_set.push @actors[i].armor4_id
   }
 end

 alias zer0_refresh_party_equipment_add add_actor
 def add_actor(actor_id)
   zer0_refresh_party_equipment_add(actor_id)
   get_party_equipment 
   if Zer0_CFG::AUTO_ENEMY_STATS && $game_party.use_average
     Stats.adjust_enemy_stats
   end
 end

 alias zer0_refresh_party_equipment_remove remove_actor
 def remove_actor(actor_id) 
   zer0_refresh_party_equipment_remove(actor_id) 
   get_party_equipment 
   if Zer0_CFG::AUTO_ENEMY_STATS && $game_party.use_average
     Stats.adjust_enemy_stats
   end
 end

 alias zer0_refresh_party_equipment_setup setup_starting_members
 def setup_starting_members
   zer0_refresh_party_equipment_setup
   get_party_equipment 
 end
end

class Game_Actor < Game_Battler
 alias zer0_refresh_party_equipment equip
 def equip(equip_type, id)
   zer0_refresh_party_equipment(equip_type, id) 
   $game_party.get_party_equipment 
 end
end

 # Bug fixes for a couple scripts
if Zer0_CFG::TWO_HANDED_WEAPONS || Zer0_CFG::MIXED_CLASS_EQUIP

class Scene_Equip

 alias zer0_equip_screen_bug_fix update_right
 def update_right
   zer0_equip_screen_bug_fix
   if Input.trigger?(Input::UP) || Input.trigger?(Input::DOWN)
     if @item_window != nil && @right_window != nil
       @item_window.refresh
     end
   end
 end
end

end

#●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●
# * END DON'T TOUCH THIS SECTION 
#●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●

#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#  
#  SECTION 2: THE ADD-ONS
#  
#      Main body. Configuration for each script is in its respective section.
#
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# Pickpocket Ability
# Version: 1.1
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
# Explanation:
#
#   - Anybody who played the PSX game Star Ocean will know exactly what this is.
#     It is basically a system that will allow you to pickpocket NPCs to recieve
#     various items, weapons, and armors if you have a certain accessory.
#
# Features:
#   
#   - Easy, quick configuration to setup each event
#   - Variables log all successes and failures for easy merging into an 
#     Affection System, Good & Evil System, etc.
#   - Nice, clean coding
#
# Instructions:
#
#   - Setup the few configurations below.   
#   - This script uses comments in the event's pages. Here's how to configure:
#     
#     First Comment:
#       Should simply say "Pickpocket", without the quotes. This will initialize
#       the system to recognize it as a pickpocketable event.
#
#     Second Comment:
#       [Chance = X]   - where X is equal to the percentage of
#                        a successful pickpocket. (0 - 100)
#     Third Comment:
#       [Type = Y]     - where Y is the type of item that will be recieved (0-2)
#                         0 = Item
#                         1 = Weapon
#                         2 = Armor
#     Fourth Comment:
#       [itemID = Z]   - where Z is equal to the database ID of the item, weapon,
#                        or armor (based off of the third comment).
#
#   That's it for setting up events. There are a few more configurations below.
#   For a player to use the ability, they have to have the "Bandit's Gloves" 
#   equipped, or whatever you want to call it (see below), and press the Z button
#   (configurable) while touching an event and a pickpocket attempt will be made.
#   Also, the last three comments MUST be within brackets. [ ]
#
# Compatibility:
#
#   - Compatible with SDK
#   - The mostly likely issue, in any, will be with the Scene_Map class. I had
#     to write an initialize method for it, but you may have another script
#     where someone else did the same. I couldn't alias because it doesn't exist
#     by default. If you do have another script that has an initialize method for
#     Scene_Map, within THIS script, do this:
#
#     Above the line "def initialize" in Scene_Map...
#     Add the line "alias zer0_pickpocket_map_init initialize"
#
#     And above the second "end" of the initialize method...
#     Add the line "zer0_pickpocket_map_init"
#
#                 (exclude all the quotation marks)
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:

 SUCCESS_SE = '055-Right01'
 # SE played when attempt is successful
 FAIL_SE    = '057-Wrong01'
 # SE played when attempt fails
 SUCCESS_VARIABLE = 1
 # In-game variable that will be equal to total successful pickpockets
 FAILURE_VARIABLE = 2
 # In-game variable that will be equal to total unsuccessful pickpockets
 # If you only need the total, just create a third variable that is the sum
 # of both variables
 BANDIT_GLOVE_IDS = [25]
 # This will be the ID(s) of the armor(s) in the database that will allow the
 # the player to use this ability. (Can use more than one item)
 USE_MODIFIER = false
 # If true, will apply a formula using the party's dexterity to get a
 # small bonus to the chance of success. (below)
 STEAL_BUTTON = Input::Z
 # This will be the button that is used to pickpocket events, mind you this the
 # the game button, not just the button on your keyboard.  

#-------------------------------------------------------------------------------
# * Modifier Formula
# 
#   (TOTAL_PARTY_DEX ÷ PARTY_SIZE) = X
#  
#   (Square Root of X) * 0.66 = MODIFIER 
#
#   The modifier is added to the chance. It's not much, but at higher levels,
#   it can add a different dynamic to pickpocketing. In a quick test using the
#   default curves, it's about a 5 point bonus at level 1, and with the same 
#   actors all at level 99, it is about a 16 point bonus. Even with the entire
#   party all having 999 dexterity, the bonus will not exceed 21 points, which 
#   I feel is an appropriate curve. Check out the method and fiddle around
#   with the '0.66' if you want to alter it. Just bust out a calculator and plug
#   the formula in real quick to see what values your getting.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=: 
if Zer0_CFG::PICKPOCKET_ABILITY
#-------------------------------------------------------------------------------
# * Game_System
#-------------------------------------------------------------------------------

class Game_System

 attr_accessor :steal_data   # Array of pickpocket events, remade for each map
 attr_accessor :attempted    # Logs all attempted steals for each map

 alias zer0_pickpocket_system_init initialize
 def initialize
   zer0_pickpocket_system_init
   @steal_data = []
   @attempted = {}
 end
end

#-------------------------------------------------------------------------------
# * Scene_Map
#-------------------------------------------------------------------------------

class Scene_Map

 def initialize
   # Creates a map_id key for the hash if it does not exist
   unless $game_system.attempted.has_key?($game_map.map_id)
     # Initializes an empty array for the value of the key
     $game_system.attempted[$game_map.map_id] = []
   end
   $game_system.steal_data = []
   $game_map.events.each_key {|i| $game_map.events[i].refresh_pickpocket}
 end

 # Same thing here
 alias zer0_refresh_pickpocket_transfer transfer_player
 def transfer_player
   zer0_refresh_pickpocket_transfer
   unless $game_system.attempted.has_key?($game_map.map_id)
     $game_system.attempted[$game_map.map_id] = []
   end
   $game_system.steal_data = []
   $game_map.events.each_key {|i| $game_map.events[i].refresh_pickpocket}
 end
end

#-------------------------------------------------------------------------------
# * Game_Event
#-------------------------------------------------------------------------------

class Game_Event

 def refresh_pickpocket
   # Looks through events' pages for the string 'Pickpocket'
   unless @erased
     @event.pages.reverse.each {|page|
     page.list.each_index {|i|
       if page.list[i].code == 108 && 
         page.list[i].parameters[0] == 'Pickpocket'
         $game_system.steal_data[@id] = [] if $game_system.steal_data[@id] == nil
       end
       # These will only be searched for if 'Pickpocket' was found
       if $game_system.steal_data[@id] != nil
         if page.list[i].code == 108 && 
           page.list[i].parameters[0] =~ /\[#{'Chance = '}(?:ECT)?(.*?)\]/
           chance = $1.to_i
           $game_system.steal_data[@id] << chance
         end
         if page.list[i].code == 108 && 
           page.list[i].parameters[0] =~ /\[#{'Type = '}(?:ECT)?(.*?)\]/
           type = $1.to_i
           $game_system.steal_data[@id] << type
         end
         if page.list[i].code == 108 && 
           page.list[i].parameters[0] =~ /\[#{'ItemID = '}(?:ECT)?(.*?)\]/
           itemID = $1.to_i
           $game_system.steal_data[@id] << itemID
         end
       end
       } 
     }
   end
 end
end

#-------------------------------------------------------------------------------
# * Game_Player
#-------------------------------------------------------------------------------

class Game_Player

 alias zer0_pickpocket_map update
 def update
   zer0_pickpocket_map
   if Input.trigger?(STEAL_BUTTON) && !$game_temp.message_window_showing &&
     # Checks if the Bandit's Gloves are equipped
     $game_party.armor_set.any? {|armor| BANDIT_GLOVE_IDS.include?(armor)}
     # Get coordinates/direction in relation to event
     dir_x = @x + (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
     dir_y = @y + (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
     $game_system.steal_data.each_index {|i|
       if $game_system.steal_data[i] != nil
         if $game_map.events[i].x == dir_x && $game_map.events[i].y == dir_y
           # If all criteria is met, initiate the steal, with the event's
           # ID being used as the argument
           pickpocket(i)
         end
       end
     }
   end
 end

 def pickpocket(event)
   # Check if the player has already attempted to pickpocket this event
   unless $game_system.attempted[$game_map.map_id].include?(event)
     # If not, get a random number between 0 - 100
     r = rand(100)
     # Initialize modifier (remains at 0 unless USE_MODIFIER is true)
     @modifier = 0
     if USE_MODIFIER
       $game_party.actors.each_index {|i|
         @modifier += $game_party.actors[i].base_dex
       }
       @modifier = (@modifier / $game_party.actors.size)
       @modifier = (Math.sqrt(@modifier)) * 0.66
     end
     # Gather the event's pickpocket data from the steal_data list
     chance = ($game_system.steal_data[event][0] + @modifier.round)
     item_type = $game_system.steal_data[event][1]
     item_id = $game_system.steal_data[event][2]
     # If the random number is less than the chance, SUCCESS!
     if chance >= r 
       Audio.se_play('Audio/SE/' + SUCCESS_SE, 80, 100)
       case item_type
       when 0
         $game_party.gain_item(item_id, 1)
         name = $data_items[item_id].name
       when 1
         $game_party.gain_weapon(item_id, 1)
         name = $data_weapons[item_id].name
       when 2
         $game_party.gain_armor(item_id, 1)
         name = $data_armors[item_id].name
       end
       $game_variables[sUCCESS_VARIABLE] += 1
       # Set the result of the pickpocket to the screen
       $game_temp.message_text = ('You received a ' + name + '!')
     else
       Audio.se_play('Audio/SE/' + FAIL_SE, 80, 100)
       $game_variables[FAILURE_VARIABLE] += 1
     end
     # Add event's ID to the hash of attempted pickpockets
     $game_system.attempted[$game_map.map_id].push(event)
   end
 end
end
end


#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# Code-to-Text-Box
# Version: 1.0
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
# Explanation:
#
#   Adds an added function to events' "Show Text" command. Along with the normal
#   \c[color], \v[VARIABLE], \n[NAME], etc. commands, you can now use the this
#   command:
#                            \cd[sCRIPT]
#
#   The code written in the [] will be evaluated and output as text in the normal
#   in-game text box. For example, if you wanted an event to tell you the party's
#   step count, just use this in their text:
#
#                       \cd[$game_party.steps]
#
#       The step count of the party will be output to the text box.
#
#   This is really only good for numbers or strings. Arrays will just output a 
#   string of numbers containing all the values; not very useful for using in a 
#   game. I have included a few rescue modifiers that will prevent the game
#   from crashing for incorrect code. The incorrect code will output the name
#   of the error it is throwing.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:

if Zer0_CFG::CODE_TO_TEXT_BOX

 class Window_Message < Window_Selectable

   alias zer0_code_to_text_box refresh
   def refresh    
     if $game_temp.message_text != nil
       begin
         text = $game_temp.message_text
         # If \cd[script] is found in the message text...
         if (/\\[Cc][Dd]\[(.+?)\]/.match(text)) != nil
           # ...evaluate the code and...
           code = eval($1)
           # ...inserts the value as a string.
           text.gsub!(/\\[Cc][Dd]\[(.*?)\]/) { code }
         end
       rescue NoMethodError 
         text.gsub!(/\\[Cc][Dd]\[(.*?)\]/) { '*NoMethodError*' }
       rescue NameError
         text.gsub!(/\\[Cc][Dd]\[(.*?)\]/) { '*NameError*' }
       end 
     end
     zer0_code_to_text_box
   end
 end 
end


#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# Ambient SFX 
# Version: 1.0
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
# Explanation:
#   This system will play SE at intervals in addition to the BGM/BGS. You can
#   configure each map separately with its own array of SE to play. The SE
#   will played randomly and will be played at random intervals (configurable).
#   
# Features:
#   - Each map can be configured separately
#   - Can use as many different SFX as you want for each map
#   - Provides a more 'random' effect than a simple looping BGM/BGS
#   - Temporary changes or enabling/disabling with script calls
#   - Perfect for bird chirps, insect SFX, etc.
#
# Instructions:
#   - Set your maps up using this syntax:
#
#   when MAP_ID then [['SE_NAME', 'ANOTHER_SE_NAME', etc, etc], DELAY]
#
# The system will choose a random number between 0 - DELAY each frame (that
# is 40 times per second for those who don't know), and if that number is equal 
# to 0, a random SE in the array will be played. You don't need to set up any 
# maps if you are not using this system for it.  
#
# The system can be temporarily turned off with the script call:
#
#                   $game_map.ambient_SE = nil
#
# It can also be temporarily added or changed with the script call:
#
#   $game_map.ambient_SE = [['SE_NAME', 'ANOTHER_SE_NAME', etc, etc], DELAY]
#
# These will only work on a temporary basis for the current map, everything will
# return to normal once the player moves to a different map. Disable the add-on
# completely if you don't want it to persist.
#
# Author's Notes:
#   Try to avoid using WAV files for the SFX. I have found that this can cause
#   lag occasionally when the SE is played. Use OGG or MIDI.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:

class Game_Map

 attr_accessor :ambient_SE

 alias zer0_ambient_se_setup setup
 def setup(map_id)
   @ambient_SE = case map_id
#-------------------------------------------------------------------------------
# BEGIN CONFIGURATION
#-------------------------------------------------------------------------------
   # You can add more than 1 map_id per case.     ex. (when 1, 8, 32)
   when 1
     [['Bird1', 'Bird2', 'Bird3', 'Bird4', 'Bird5'], 150]
   when 2 
     [['Frog1', 'Frog2', 'Cricket1', 'Cricket2', 'Howl'], 150]
#-------------------------------------------------------------------------------
# END CONFIGURATION
#-------------------------------------------------------------------------------
   end
   zer0_ambient_se_setup(map_id)
 end

 alias zer0_ambient_se_upd update
 def update
   if $game_system.AMBIENT_SFX && @ambient_SE != nil
     delay = rand(@ambient_SE[1])
     if delay == 0
       r = rand(@ambient_SE[0].size)
       Audio.se_play('Audio/SE/' + @ambient_SE[0][r], 80, 100)
     end
   end
   zer0_ambient_se_upd
 end
end    


if Zer0_CFG::DOWN_GRAPHICS
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# Sleep/Down Graphic Character Graphics 
# Version: 1.0
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
# Explanation:
#   - Will automatically change the lead character's graphic to their respective
#     'Down' graphic when a switch is flipped. Character's graphic will return 
#     to normal when the flip is turned back off.
#   
# Features:
#   - Does not matter which character is being used or which direction the 
#     player is facing, the 'Down' graphic will always be correct.
#   - Perfect for Inn events, Game Over, or any game with a Party Switcher 
#     or selectable lead character.
#   - Not confined to only use it for 'Down' graphics, could be used for any
#     charset, although character animation will not be shown
#
# Instructions:
#   - Set ID of game switch to use (below)
#   - See Character Setup below to see how to configure your characters
#   
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:

 DOWN_SWITCH = 4
 # ID of the game switch to change the character's graphic

class Sprite_Character < RPG::Sprite

 alias zer0_sleep_graphic_upd update
 def update
   # This is needed here to prevent a flicker when reverting back
   self.bitmap = RPG::Cache.character(@character.character_name,
     @character.character_hue)

   zer0_sleep_graphic_upd # Normal method

   if $game_switches[DOWN_SWITCH] && character.is_a?(Game_Player) 
     @down_data = case $game_party.actors[0].id 

#-------------------------------------------------------------------------------
# BEGIN CHARACTER SETUP
#-------------------------------------------------------------------------------
# Set your characters up as follows:
#
#   when ACTOR_ID then ['FILENAME', X, Y]
#
#   ACTOR_ID = The ID number of the actor in your database
#   FILENAME = The name of the character file the needed graphic is on
#   X = The x-coordinate of the correct picture on the charset (1 - 4)
#   Y = The y-coordinate of the correct picture on the charset (1 - 4)
#
#           ← X →             Ex.   If the needed graphic was in the bottom
#         1  2  3  4                left corner:   X = 1    Y = 4 
#       ┌──┬──┬──┬──┐                    
#     1 │  │  │  │  │
#       ├──┼──┼──┼──┤
#  ↑  2 │  │  │  │  │
#  Y    ├──┼──┼──┼──┤
#  ↓  3 │  │  │  │  │
#       ├──┼──┼──┼──┤
#     4 │  │  │  │  │
#       └──┴──┴──┴──┘
#-------------------------------------------------------------------------------

     when 3 then ['189-Down01', 1, 1]  # Fighter01
     when 4 then ['189-Down01', 4, 4]  # Thief01
     when 5 then ['189-Down01', 1, 3]  # Lancer01
     when 6 then ['189-Down01', 2, 3]  # Lancer02
     when 7 then ['192-Down01', 1, 1]  # Soldier01
     when 8 then ['192-Down01', 1, 1]  # Soldier01
     when 10 then ['189-Down01', 1, 4]  # Warrrior01
     when 11 then ['190-Down01', 2, 4]  # Gunner02
     when 13 then ['189-Down01', 1, 1]  # Fighter01
     when 14 then ['189-Down01', 4, 4]  # Thief01
     when 15 then ['190-Down01', 2, 3]  # Gunner01
     when 16 then ['191-Down01', 2, 4]  # Mage08
     when 17 then ['189-Down01', 1, 3]  # Lancer01
     #when 18 then ['189-Down01', 1, 4]  # 
     when 19 then ['189-Down01', 2, 2]  # Fighter06
     when 20 then ['189-Down01', 2, 3]  # Lancer02
     when 21 then ['191-Down01', 2, 3]  # King01
     when 22 then ['192-Down01', 1, 2]  # Soldier02
     #when 23 then ['189-Down01', 1, 4]  # 
     #when 24 then ['189-Down01', 1, 4]  # 
     #when 25 then ['189-Down01', 1, 4]  # 
     when 26 then ['189-Down01', 3, 4]  # Warrior03
     when 27 then ['189-Down01', 2, 1]  # Fighter02
     when 28 then ['191-Down01', 2, 2]  # Mage06

#-------------------------------------------------------------------------------
# END CHARACTER SETUP
#-------------------------------------------------------------------------------
     end
     if @down_data != nil
       # Change player's charset to the correct 'down' charset
       self.bitmap =  RPG::Cache.character(@down_data[0], @character.character_hue)
       width = self.bitmap.width / 4
       height = self.bitmap.height / 4
       # Use above coordinates to get correct down graphic by index
       x_index = width * (@down_data[1] - 1)
       y_index = height * (@down_data[2] - 1) 
       # Set source rectangle of sprite's bitmap
       self.src_rect.set(x_index, y_index, width, height)
       self.ox = width / 2
       self.oy = height
     end
   end
 end
end
end


#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# Split Party Experience 
# Version: 1.0
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
# Explanation:
#
#   This adds a feature that I'm not sure why it is not default. It will divide
#   the total experience for the battle among the participating battlers, and
#   not just giving every battler the same experience, regardless of how many
#   there are. Now if you fight a battle alone, or only have one survivor, they
#   will receive extra experience. The system simply applies this formula:
#
#     PLAYER_EXPERIENCE = (TOTAL_EXPERIENCE / ACTIVE_PARTY_SIZE)
#
#   You will have to adjust the experience points given by enemies accordingly.
#   Since decimals are not permitted, you may occasionally notice subtle
#   differences in the total experience points for a battle if different party
#   sizes are used (no more than the size of the party). I have designed it so
#   all decimal values round up, but it can still occur.
#
#   Another note, do not make troops where the total experience after battle 
#   will be less than the party size, because it will only result in everybody
#   getting 0 experience.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
if Zer0_CFG::PARTY_SPLIT_EXP

 class Game_Enemy < Game_Battler

   def exp
     # Simply redefine enemy experience values
     exp = $data_enemies[@enemy_id].exp / $game_party.actors.size
     return exp.ceil # <-- Always rounds up to next whole integer
   end
 end
end


#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# Two-Handed Weapons + Gauntlets
# Version: 1.1
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
# Explanation:
#   
#   Allows you set up certain weapons as Two-Handed. If a two-handed weapon is
#   equipped, it will not allow for a shield to be equipped. Good for balancing
#   out powerful weapons like axes, hammers, etc. like you see in other
#   popular RPGs.
#
#   Also includes Gauntlets script merged in. It is a Final Fantasy VI remake,
#   which will allow you to create accessories that, if equipped, will make any
#   weapon Two-Handed and give a power a increase to it.
#
# Issues:
#
#   * BUG fixed for default CMS, or any CMS that uses the same labels
#
#   One bug I haven't fixed yet is if a shield is equipped when a Two-Handed
#   weapon is equipped, the shield disappears, the stats change as if it is not
#   equipped, but it is technically still equipped until the actor exits the 
#   that screen. You can actually click on the blank slot for the shield and
#   then on a blank slot in the inventory, and it will return. This little bug
#   actually doesn't do anything bad, since if you exit and reenter, everything 
#   will be as it should be, but it looks unprofessional to me. 
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:

 TWO_HANDED_IDS = []
 # Include IDs of all weapons that are 'Two-Handed'
 GAUNTLET_IDS = []
 # Include IDs of any accessory that will allow the user to make any
 # weapon Two-Handed. MUST BE ACCESSORY!
 POWER_INCREASE = 1.5
 # Attack power increase given if Gauntlet is being used

if Zer0_CFG::TWO_HANDED_WEAPONS  

class Game_Actor < Game_Battler

 alias zer0_two_handed_weapons_setup setup
 def setup(actor_id)
   zer0_two_handed_weapons_setup(actor_id)
   if TWO_HANDED_IDS.include?($data_actors[actor_id].weapon_id) ||
     GAUNTLET_IDS.include?($data_actors[actor_id].armor4_id)
     equip(1, 0)
     return
   end
 end

 alias zer0_two_handed_weapons_equip equip
 def equip(equip_type, id)
   zer0_two_handed_weapons_equip(equip_type, id)
   if (TWO_HANDED_IDS.include?(@weapon_id) || GAUNTLET_IDS.include?(@armor4_id)) &&
       @armor1_id != 0
     equip(1, 0)
     return
   end
 end

 alias zer0_two_handed_weapons_base_atk base_atk
 def base_atk
   # Change attack power of weapon if Gauntlet is equipped
   weapon = $data_weapons[@weapon_id]
   if GAUNTLET_IDS.include?(@armor4_id)
     return weapon != nil ? (weapon.atk * POWER_INCREASE).to_i : 0
   end
   zer0_two_handed_weapons_base_atk
 end    
end
end


#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# Sprint Shoes 
# Version: 1.0
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
# Explanation:
#
#   This script will increase the player's move speed if a particular
#   armor is equipped (same as FF6). Create an armor in your database and
#   name it 'Sprint Shoes' or whatever you prefer and set up the desired sprint
#   speed, normal speed, and the database ID(s) of the armor(s) you just made
#   to provide this ability. If any character in the active party has the
#   armor equipped, the ability will be enabled.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:


 SPRINT_IDS = []
 # ID(s) of armor(s) in database that will permit sprinting if equipped
 SPRINT_SPEED = 5        
 # Move speed with sprinting armor(s) equipped
 NORMAL_SPEED = 4        
 # Move speed without sprinting armor(s) equipped

#-------------------------------------------------------------------------------
class Game_Character 

 alias zer0_sprint_shoes_upd update 
 def update
   zer0_sprint_shoes_upd
   # If any of the armor ids match the SPRINT_ID's, move speed is increased
   if $game_system.SPRINT_SHOES
     if $game_party.armor_set.any?{|armor| SPRINT_IDS.include?(armor)}
       @move_speed = SPRINT_SPEED
     else
       @move_speed = NORMAL_SPEED
     end
   end
 end
end


#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# Encounter Rate Modifying Equipment
# Version: 1.0
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
#  Explanation:
#
#     You can have equipment that reduces the encounter rate of maps if an
#     active party member has it equipped. Kinda like the "Charm Bangle" or 
#     "Moogle Charm" in Final Fantasy VI. 
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:

 ENC_ARMOR_IDS = []
 # Include the IDs of any armor you would like to provide this ability.
 ENC_RATE = 2
 # The encounter rate will be multiplied by this number, so 2 will double the
 # average steps between attacks. You can make this less than 1, but that will
 # increase the encounter rate. 

class Game_Player

 alias zer0_altered_encounters_equipment make_encounter_count
 def make_encounter_count
   zer0_altered_encounters_equipment
   if $game_system.ENCOUNTER_EQUIPMENT
     if $game_party.armor_set.any?{|armor| ENC_ARMOR_IDS.include?(armor)}
       @encounter_count = (@encounter_count * ENC_RATE).to_i
     end
   end
 end
end


#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# Experience Egg
# Version: 1.0
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
#   Explanation:
#
#     Another Final Fantasy VI remake, any player equipped with the Experience
#     Egg will recieve bonus experience at the end of battle. If you are using
#     the Split Party Experience script (above), it will automatically
#     compensate for that.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:

 EXP_EGG_ACCESSORY_IDS = [127]
 # Database IDs of armor that gives ability. Must be an accessory.
 PERCENT_INCREASE = 100
 # Percentage of bonus experience points the accessory will give.

class Scene_Battle

 if Zer0_CFG::EXPERIENCE_EGG
 alias zer0_exp_egg_battle_results start_phase5
 def start_phase5
   zer0_exp_egg_battle_results
   exp = 0
   # Tally up all exp that would normally be gained
   $game_troop.enemies.each {|enemy| exp += enemy.exp}
   exp = (exp / $game_party.actors.size).ceil if Zer0_CFG::PARTY_SPLIT_EXP
   $game_party.actors.each_index {|i| 
     actor = $game_party.actors[i]
     if EXP_EGG_ACCESSORY_IDS.include?(actor.armor4_id)
       unless actor.cant_get_exp?
         # Add only the bonus to the actor who has Egg equipped
         actor.exp += (exp * (PERCENT_INCREASE * 0.01)).to_i
       end
     end
    }
  end
 end
end


#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# Gold Modifying Equipment
# Version: 1.1
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
# Explanation:
#   
#   If a party member is equipped with this equipment, an increased amount of
#   of gold will be received at the end of battle. Effect will not be increased 
#   if multiple ability giving equipment is used.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:

 GOLD_MOD_WEAPONS = []
 # Database IDs of weapons that give ability
 GOLD_MOD_ARMORS = [153]
 # Database IDs of armors that give ability
 GOLD_MULTIPLIER = 2
 # Multiplication rate of gold bonus

if Zer0_CFG::GOLD_BONUS_EQUIP  

class Game_Enemy < Game_Battler

 alias zer0_gold_mod_equipment gold
 def gold
   if ($game_party.weapon_set.any?{|weapon| GOLD_MOD_WEAPONS.include?(weapon)}) ||
     ($game_party.armor_set.any?{|armor| GOLD_MOD_ARMORS.include?(armor)}) 
     return ($data_enemies[@enemy_id].gold * GOLD_MULTIPLIER).to_i
   end
   zer0_gold_mod_equipment
 end
end
end

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# Treasure Hunter
# Version: 1.1
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
# Explanation:
#   
#   Doubles chance of enemies dropping treasure if any party member is using any
#   of the equipment. Effect will not be increased if multiple ability giving
#   equipment is used.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:

 TREASURE_WEAPONS = []
 # Database Ids of weapons that give Treasure Hunter ability
 TREASURE_ARMORS = []
 # Database Ids of armors that give Treasure Hunter ability
 PROB_MULTIPLIER = 2
 # Probability will be multiplied by this number

if Zer0_CFG::TREASURE_HUNTER  

class Game_Enemy < Game_Battler

 alias zer0_treasure_hunter treasure_prob
 def treasure_prob
   if ($game_party.weapon_set.any?{|weapon| TREASURE_WEAPONS.include?(weapon)}) ||
      ($game_party.armor_set.any?{|armor| TREASURE_ARMORS.include?(armor)})
      # Simply multiplies enemy's drop chance
     return ($data_enemies[@enemy_id].treasure_prob * PROB_MULTIPLIER)
   end
   zer0_treasure_hunter
 end
end
end

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# Coward's Equipment
# Version: 1.0
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
# Explanation:
#   
#   Guarnteed success rate of escaping if any of this equipment is currently 
#   being used by a party member. Will not allow player to escape if the battle
#   is "Cannot Escape" because it only runs after the normal escape method and
#   if it was unsuccessful.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:

 COWARD_WEAPONS = []
 # Database weapon IDs that have this ability
 COWARD_ARMORS = []
 # Database armor IDs that have this ability

class Scene_Battle

 alias zer0_always_escape_success update_phase2_escape
 def update_phase2_escape
   zer0_always_escape_success
   if Zer0_CFG::COWARD_EQUIPMENT &&
     ($game_party.weapon_set.any?{|weapon| COWARD_WEAPONS.include?(weapon)}) ||
     ($game_party.armor_set.any?{|armor| COWARD_ARMORS.include?(armor)})
     # Runs at the end of normal method, only if attempt was unsuccessful
     $game_system.se_play($data_system.escape_se)
     $game_system.bgm_play($game_temp.map_bgm)
     battle_end(1)
   end
 end
end


#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# Terrain Speed Modifier
# Version: 1.1
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# 
#   Player speed will be changed according to the current terrain tag of
#   the tile they are standing on. Can be modified as desired. 
#
#   Using this with the Sprint Shoes Script may cause the two scripts to work
#   unpredictibly. It is likely this feature will not be needed on most maps,
#   so if you are using Sprint Shoes, keep this disabled and only enable it
#   with script calls as needed per map. You would be better off just not to
#   use both scripts. If this is an issue, let me know and I'll make them
#   compatible, but I just don't see both scripts being THAT popular. 
#   
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

 DEFAULT_MOVE_SPEED = 4

class Game_Player
 attr_accessor :move_speed
end

class Game_Map

 alias zer0_terrain_speed_upd update
 def update
   zer0_terrain_speed_upd
   if $game_system.TERRAIN_SPEEDS
     $game_player.move_speed = case $game_player.terrain_tag 
#-------------------------------------------------------------------------------
#     BEGIN CONFIGURATION
#-------------------------------------------------------------------------------
   # when TERRAIN_TAG then MOVE_SPEED

     when 6 then 3
     when 7 then 2
     else
       DEFAULT_MOVE_SPEED
#-------------------------------------------------------------------------------
#     END CONFIGURATION
#-------------------------------------------------------------------------------
     end
   end
 end
end


#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# Window Positioner
# Version: 1.0
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
#   Explanation:
#
#     Will allow the player to move the window position to its three preset
#     positions by pressing L and R. Not much more to it than that.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:

class Scene_Map

 alias zer0_window_reposition_upd update
 def update
   zer0_window_reposition_upd
   if $game_system.WINDOW_POSITIONER && $game_temp.message_window_showing &&
       @message_window != nil # <-- Probably not needed, but just in case...
     if Input.trigger?(Input::L)
       @message_window.y = (@message_window.y += 144) % 432
     elsif Input.trigger?(Input::R)
       @message_window.y = (@message_window.y -= 144) % 432
     end
   end
 end
end


#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# Map Treasures
# Version: 1.1
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
#   Explanation:
#
#     I saw an evented system made by (Hexamin) just like this and it gave me 
#     the idea to make a scripted version of it. It will allow the player to 
#     find hidden or 'buried' treasures around the game map if they press the
#     action button at certain locations. There is also an option to require the 
#     player to have a specific item in order to find items.
#
#   Instructions:
#
#     - Configure your maps follwing this pattern:
#
#  when MAP_ID then return [[iTEM_ID, TYPE, X, Y], [iTEM_ID, TYPE, X, Y], etc.]
#
#     MAP_ID = ...do I really need to explain?
#    ITEM_ID = the ID of the item/weapon/armor in the database
#       TYPE = type of item that will be received
#               0 = Item
#               1 = Weapon
#               2 = Armor
#       X, Y = the coordinates on the map where the item is
#
#     - You can use as many items per map as you like, just make sure each item
#       is within [ ] and seperated by commas. You can break to a new line if you
#       need room, but just make sure it is directly after a comma.
#     - Make sure that all the arrays collectively per map are within a [ ] 
#
#   Credits/Thanks:
#     - I'd like to think (Hexamin) for making the evented system that gave me 
#       the idea
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:

#-------------------------------------------------------------------------------
#     BEGIN CONFIGURATION
#-------------------------------------------------------------------------------

   DISCOVER_SE = '056-Right02'
   # SE played when the player discovers an item
   ITEM_REQUIRE = false
   # If true, player will need an item in the inventory to unlock ability. 
   SEARCH_ITEM_ID = 25
   # ID of the item that will give ability (only if ITEM_REQUIRE is true)
   EX_ANIMATION_ID = 98
   # The ID of the animation that is shown when the player nears a treasure
   RADIUS = 2
   # The radius, in tiles, the player must be within to set off the alert

module Zer0_CFG

 def self.map_treasures(map_id)
   case map_id
   when 6 then return [[1, 1, 12, 4]]
   when 2 then return [[1, 0, 2, 3], [2, 0, 10, 10]]
   end
 end
end

#-------------------------------------------------------------------------------
#     END CONFIGURATION
#-------------------------------------------------------------------------------
if Zer0_CFG::MAP_TREASURES

class Game_Map

 attr_accessor :map_treasures  # Stores the treasure data, deletes found items

 alias zer0_map_treasures_init initialize
 def initialize
   zer0_map_treasures_init
   @map_treasures = {}
 end

 alias zer0_map_treasures_setup setup
 def setup(map_id)
   zer0_map_treasures_setup(map_id)
   @alerted = []
   unless @map_treasures.has_key?(map_id)
     if Zer0_CFG.map_treasures(map_id) != nil
       @map_treasures[map_id] = Zer0_CFG.map_treasures(map_id)
     end
   end
   if @map_treasures[map_id] != nil
     @map_treasures[map_id].compact!
     @treasures = @map_treasures[map_id]
     @treasures.each_index {|i| @alerted[i] = false}
   end
 end

 alias zer0_map_treasures_upd update
 def update
   zer0_map_treasures_upd
   if @treasures != nil 
     if !ITEM_REQUIRE || (ITEM_REQUIRE && 
       $game_party.item_number(SEARCH_ITEM_ID) > 0)
       @treasures.each_index {|i|
       if @treasures[i] != nil 
         tx, ty = @treasures[i][2], @treasures[i][3]
         px, py = $game_player.x, $game_player.y
         unless @alerted[i]
           if Math.hypot(tx - px, ty - py).abs <= RADIUS
             $game_player.animation_id = EX_ANIMATION_ID
             @alerted[i] = true
           end
         end
         if Input.trigger?(Input::C) && (px == tx) && (py == ty)
           Audio.se_play('Audio/SE/' + DISCOVER_SE, 80, 100)
           case @treasures[i][1]
           when 0 then $game_party.gain_item(@treasures[i][0], 1)
             name = $data_items[@treasures[i][0]].name
           when 1 then $game_party.gain_weapon(@treasures[i][0], 1)
             name = $data_weapons[@treasures[i][0]].name
           when 2 then $game_party.gain_armor(@treasures[i][0], 1)
             name = $data_armors[@treasures[i][0]].name
           end
           @map_treasures[@map_id][i] = nil
           $game_temp.message_text = ('You found a ' + name + '!')
         end
       end 
       }
     end
   end
 end
end
end

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# Auto Animate
# Version: 1.0
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
#   Explanation:
#
#     This is just to make setting up certain events slightly easier. If you are
#     using an event that just keeps cycling through different patterns, such as
#     smoke, fountains, 'save' crystals, etc., you longer have to set up a move
#     route that looks like this:
#
#                       - wait 3 frames
#                       - Change Graphic
#                       - wait 3 frames
#                       - Change Graphic
#                       - wait 3 frames
#                       - Change Graphic
#                       - wait 3 frames
#                       - Change Graphic
#                       - Repeat
#
#     With this little script, you can simply use a single comment at the top
#     of the first page that looks like this:
#
#                           [Animate-3]
#
#     The 3 is for the amount of frames to wait before it uses the next graphic,
#     you can use a number you like. Try to use a number above 2, it seems to
#     'miss' sometimes when the number is too low.
#     Very simple, and quite worthless, but it makes things easier. ;)
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:

class Game_Character
 attr_accessor:original_pattern
end

class Sprite_Character < RPG::Sprite

 alias zer0_auto_animate_upd update
 def update
   if $game_system.AUTO_ANIMATE
     if @character.is_a?(Game_Event) && @character.list != nil
       if @character.list[0].code == 108 && 
         @character.list[0].parameters[0] =~ /\[#{'Animate-'}(?:ECT)?(.*?)\]/
         @delay = $1.to_i
         @frame = 0 if @frame == nil
         @frame += 1
         if @frame == @delay
           @character.original_pattern = (@character.original_pattern + 1) % 4
           @frame = 0
         end
       end
     end
   end
   zer0_auto_animate_upd
 end
end

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# Easy Inn Event
# Version: 1.0
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
# Explanation:
#
#   I've seen tons of Inn scripts that are either one dimensional (no custom
#   greetings for each inn, etc), or way to complicated for all the more they 
#   are. This system is less complicated. You set up the map event as normal 
#   with the usual greetings, choices, prices, etc., and this system will take
#   care of everything that is the same every time.
#
#       - Memorizes current screen tone and fades screen to black
#       - Memorizes BGM/BGS
#       - Fades out BGM/BGS  
#       - Plays ME
#       - Transfers player (optional)
#       - Recovers entire party and removes states
#       - Restores screen to memorized tone
#       - Restores BGM/BGS
#
#   Now you just have to set up all the text for the Innkeeper, and when the
#   the player chooses to stay, use this script call:
#
#                     $scene.inn_event = true
#
#   You technically don't have to use 'true', anything other than 'nil' will
#   start the event. If you would like the player to wake up in a different
#   location, use this script call:
#
#                  $scene.inn_event = [MAP_ID, X, Y]
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:

 INN_ME = '014-Inn01'
 # ME that plays after the screen fades out
 USE_DOWN_GRAPHIC = false
 # If true, and you are using the 'Down Graphic Changer' (above), will briefly
 # show the player sleeping as the screen fades back in. Really only useful if
 # you have player transfer to a bed or something...

#-------------------------------------------------------------------------------
if Zer0_CFG::EASY_INN_EVENT

class Scene_Map

 attr_accessor :inn_event

 alias zer0_inn_upd update
 def update
   zer0_inn_upd
   if @inn_event != nil
     start_sleeping
   end
 end

 def start_sleeping
   if @inn_event.is_a?(Array) && @inn_event.size == 3
     @map_id = @inn_event[0]
     $game_temp.player_new_x = @inn_event[1]
     $game_temp.player_new_y = @inn_event[2]
     $game_temp.player_new_direction = 2
   end
   @inn_event = nil
   r, g = $game_screen.tone.red, $game_screen.tone.green
   b, gr = $game_screen.tone.blue, $game_screen.tone.gray
   $game_system.bgm_memorize
   $game_system.bgs_memorize
   $game_system.bgm_fade(1.5)
   $game_system.bgs_fade(1.5)
   $game_screen.start_tone_change(Tone.new(-255, -255, -255, gr), 80)
   100.times {Graphics.update; update}
   Audio.me_play('Audio/ME/' + INN_ME, 80, 100)
   $game_switches[DOWN_SWITCH] = true if USE_DOWN_GRAPHIC
   if @map_id != nil
     $game_temp.player_transferring = true
     $game_temp.player_new_map_id = @map_id
   end
   160.times {Graphics.update; update}
   $game_screen.start_tone_change(Tone.new(r, g, b, gr), 80)
   50.times {Graphics.update; update}
   $game_system.bgm_restore
   $game_system.bgs_restore
   $game_party.actors.each_index {|i| $game_party.actors[i].recover_all}
   30.times {Graphics.update; update}
   $game_switches[DOWN_SWITCH] = false if USE_DOWN_GRAPHIC
 end
end
end

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# Cursed Weapon
# Version: 1.0
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
# Explanation:
#
#   Allow you to set up a weapon that is 'cursed' (weak, adds negative state,
#   etc.), but if the player uses the weapon along with a specific armor
#   piece in enough battles, the weapon will be transformed (usually something
#   bad-ass). If you have ever played FF6, this works exactly the same as
#   the Paladin Shield. In that game, if you equipped the Cursed Shield and 
#   the Ribbon for 255 battles, the shield became the Paladin Shield.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
if Zer0_CFG::CURSED_WEAPON

 CURSED_WEAPON = 1
 # The ID of the 'cursed' weapon in the database (only have 1 of these)
 CURSED_COUNT = 255
 # Number of battles before the weapon is transformed (must have both the
 # weapon and the CURSE_BREAKER equipped)
 TRANSFORMED_ID = 2
 # ID of the weapon it transforms into. Make sure that any actor that can
 # equip the cursed weapon can also equip this weapon
 CURSE_BREAKER = 25
 # Armor ID that breaks the curse
 SHOW_CURSE_MESSAGE = true 
 # If true, will display a message on screen when the curse is broken.

class Game_System

 attr_accessor :curse_counter

 alias zer0_cursed_weapons_init initialize
 def initialize
   zer0_cursed_weapons_init
   @curse_counter = 0
 end
end

class Scene_Battle

 alias zer0_cursed_weapon battle_end
 def battle_end(result)
   zer0_cursed_weapon(result)
   $game_party.actors.each_index {|i|
     a = $game_party.actors[i]
     if a.hp > 0 && a.weapon_id == CURSED_WEAPON && [a.armor1_id, 
       a.armor2_id, a.armor3_id, a.armor4_id].any? {|eq| eq == CURSE_BREAKER}
       $game_system.curse_counter += 1
       if $game_system.curse_counter == CURSED_COUNT
         $game_party.gain_weapon(TRANSFORMED_ID, 1)
         a.equip(0, TRANSFORMED_ID)
         $game_party.lose_weapon(CURSED_WEAPON, 1)
       end
     end
   }
 end
end

class Scene_Map

 alias zer0_broken_curse_upd update
 def update
   zer0_broken_curse_upd
   if SHOW_CURSE_MESSAGE && $game_system.curse_counter == CURSED_COUNT
     old = $data_weapons[CURSED_WEAPON].name
     new = $data_weapons[TRANSFORMED_ID].name
     text1 = 'The curse on the ' + old + ' is broken!'  
     text2 = 'It has become the ' + new + '!'
     $game_temp.message_text = (text1 + "\n" + text2) 
     $game_system.curse_counter = 0
   end
 end
end
end

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# Blood Weapons
# Version: 1.0
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
# Explanation:
#
#   Allows you create weapons that will increase in power as they are used to 
#   kill more and more enemies. Setup is below. I would suggest using a decimal
#   for the KILL_INCREASE to keep the weapon balanced. The bonus will not be 
#   applied until after the value is above the next whole integer.
#
#     ex. After 10 kills, a weapon with a KILL_INCREASE of 0.1 will have a
#         1 point increase to its attack power.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
if Zer0_CFG::BLOOD_WEAPONS

 BLOOD_IDS = [8, 31]
 # The ID(s) of the weapon(s) that have this ability 
 KILL_INCREASE = 0.05
 # Increase given to attack power per kill with weapon(s).
 BLOOD_MAX = 999
 # Max allowed attack power the weapon(s) can aquire using this power

class Game_System

 attr_accessor :blood_power

 alias zer0_blood_power_init initialize
 def initialize
   zer0_blood_power_init
   @blood_power = []
   BLOOD_IDS.each_index {|i| 
     @blood_power.push([bLOOD_IDS[i], $data_weapons[bLOOD_IDS[i]].atk.to_f])} 
 end
end

class Game_Battler

 alias zer0_blood_weapons attack_effect
 def attack_effect(attacker)
   zer0_blood_weapons(attacker)
   if self.is_a?(Game_Enemy) && self.hp <= 0 && attacker.is_a?(Game_Actor)
     blood = $game_system.blood_power
     blood.each_index {|i|
       if blood[i][0] == attacker.weapon_id
         if blood[i][1] < BLOOD_MAX 
           blood[i][1] += KILL_INCREASE
           $data_weapons[blood[i][0]].atk = blood[i][1].floor
         end
       end
     }
   end
 end
end

class Scene_Load < Scene_File

 alias zer0_load_blood_weapons read_save_data
 def read_save_data(file)
   zer0_load_blood_weapons(file)
   $game_system.blood_power.each_index {|i|
     blood = $game_system.blood_power
     $data_weapons[blood[i][0]].atk = blood[i][1].floor
   }
 end
end
end

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# Revenge Weapons
# Version: 1.0
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
# Explanation:
#
#   Somewhat like Revenge Skills from Tons, this will allow you to create
#   weapons that grow more powerful the lower the user's HP is from their
#   Max HP. At full health, the weapon will be at its base attack, at 1 HP
#   the weapon will be double the base attack power. Everything in between
#   is based off the ratio between HP and MaxHP. The stat for ATK will not
#   be changed in the status screen, but its effect can be seen in battle.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
if Zer0_CFG::REVENGE_WEAPONS

 REVENGE_WEAPON_IDS = [10,32,50,81,87,98,104]
 # Include any weapon ID(s) that possess this ability

class Game_Actor  

 alias zer0_revenge_power base_atk 
 def base_atk
   if $game_temp.in_battle
     if REVENGE_WEAPON_IDS.include?(@weapon_id)
       weapon = $data_weapons[@weapon_id]
       revenge = weapon.atk * (1 - (self.hp / self.maxhp))
       return weapon != nil ? (weapon.atk + revenge).to_i : 0
     end
   end
   zer0_revenge_power
 end
end
end

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# Defense Up Armors
# Version: 1.0
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
# Explanation:
#
#   Works exactly the same as the Revenge Weapons script (above), except it 
#   works with armors to increase the DEF and MDEF. The effect will be applied
#   to the total PDEF and MDEF, not just that particular armor.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
if Zer0_CFG::DEF_UP_ARMORS

 DEFENSE_UP_ARMORS = [56,59,67,74,154]
 # ID(s) of any armor(s) that provide this ability.

class Game_Actor 

 alias zer0_defense_up_armors_pdef base_pdef
 def base_pdef
   if $game_temp.in_battle
     [@armor1_id, @armor_2_id, @armor_3_id, @armor4_id].each {|armor|
       if DEFENSE_UP_ARMORS.any? {|i| DEFENSE_UP_ARMORS[i] == armor}
         weapon = $data_weapons[@weapon_id]
         armor1 = $data_armors[@armor1_id]
         armor2 = $data_armors[@armor2_id]
         armor3 = $data_armors[@armor3_id]
         armor4 = $data_armors[@armor4_id]
         pdef1 = weapon != nil ? weapon.pdef : 0
         pdef2 = armor1 != nil ? armor1.pdef : 0
         pdef3 = armor2 != nil ? armor2.pdef : 0
         pdef4 = armor3 != nil ? armor3.pdef : 0
         pdef5 = armor4 != nil ? armor4.pdef : 0
         total = (pdef1 + pdef2 + pdef3 + pdef4 + pdef5)
         increase = total * (1 - (self.hp / self.maxhp))
         return (total + increase).to_i
       end
     }
   end
   zer0_defense_up_armors_pdef
 end

 alias zer0_defense_up_armors_mdef base_mdef 
 def base_mdef
   if $game_temp.in_battle
     [@armor1_id, @armor_2_id, @armor_3_id, @armor4_id].each {|armor|
       if DEFENSE_UP_ARMORS.any? {|i| DEFENSE_UP_ARMORS[i] == armor}
         weapon = $data_weapons[@weapon_id]
         armor1 = $data_armors[@armor1_id]
         armor2 = $data_armors[@armor2_id]
         armor3 = $data_armors[@armor3_id]
         armor4 = $data_armors[@armor4_id]
         mdef1 = weapon != nil ? weapon.mdef : 0
         mdef2 = armor1 != nil ? armor1.mdef : 0
         mdef3 = armor2 != nil ? armor2.mdef : 0
         mdef4 = armor3 != nil ? armor3.mdef : 0
         mdef5 = armor4 != nil ? armor4.mdef : 0
         total = (mdef1 + mdef2 + mdef3 + mdef4 + mdef5)
         increase = total * (1 - (self.hp / self.maxhp))
         return (total + increase).to_i
       end
     }
   end
   zer0_defense_up_armors_mdef
 end
end
end


#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# HP1 Revive
# Version: 1.0
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
# Explanation:
#
#   You may have seen a few RPGs where dead actors are returned to 1 HP after
#   battle. This script does that. Not much more to explain. 
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:

class Scene_Battle

 alias zer0_hp1_revive_upd battle_end
 def battle_end(result)
   zer0_hp1_revive_upd(result)
   if $game_system.HP1_REVIVE && $game_party.actors.any? {|actor| actor.dead?}
     $game_party.actors.each_index {|i|
       if $game_party.actors[i].dead?
         $game_party.actors[i].hp = 1
       end
     }
   end
 end
end


#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# Mixed Class Equipment
# Version: 1.0
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
# Explanation:
#
#   Lets you to create accessories that will allow the equipped character to use
#   equipment from outside their class, without actually changing their class.
#   If you would like for the accessory to let the player equip anything, just
#   create a dummy class that can, and set an accessory to share equipment with
#   that class.
#
# Instructions:
#
#   Set each accessory (MUST BE ACCESSORY!) up like this:
#
#                     [ACCESSORY_ID, CLASS_ID]
#
#   You can make as many different item like this as you please, just make sure
#   they are seperated by commas, each on is in its own set of [ ], and that
#   all of them as a collective are in [ ]. The CLASS_ID is the class whose
#   equipment will be mixed in with the class of the actor wearing the accessory.
#
# Issues/Bugs:
#   
#   Has the same issue that the Gauntlets script has: the item window doesn't
#   refresh until after the player exits and re-enters or tries to equip another
#   item. It's because the normal refresh is a frame BEFORE the change is made,
#   therefore none of the changes are applied to the screen. With some minor
#   editing to the equip scene, this can be taken care of, but it is impossible
#   for me to include the fixes for every CMS out there. I HAVE included a bug
#   fix that will work with the default CMS, but it will likely not work with 
#   custom CMSs unless they use the same names for the scene, windows, etc.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
if Zer0_CFG::MIXED_CLASS_EQUIP


 CLASS_MIX_ACC = [[25, 2], [26,5]]


class Game_Actor < Game_Battler

 alias zer0_class_mix_equipment equip
 def equip(equip_type, id)
   if equip_type == 4 && CLASS_MIX_ACC.any? {|arm4| arm4[0] == @armor4_id &&
       arm4[0] != id} && Input.trigger?(Input::C) # The trigger fixes a bug
     return_original_equipment(@class_id)
   end
   zer0_class_mix_equipment(equip_type, id) # Original Method
   if equip_type == 4 && CLASS_MIX_ACC.any? {|arm4| arm4[0] == id}
     CLASS_MIX_ACC.each_index {|i|
       if @armor4_id == CLASS_MIX_ACC[i][0]
         $game_party.mix_class_equipment(@class_id, CLASS_MIX_ACC[i][1])
       end
     }
   end
 end

 def return_original_equipment(class_id)
   $data_classes[class_id].weapon_set = $game_system.class_sets[class_id][0]
   $data_classes[class_id].armor_set = $game_system.class_sets[class_id][1]
   # This will effectively enquip items that can no longer be equipped
   self.class_id=(class_id)
 end

end

class Game_Party

 def mix_class_equipment(original_class, new_class)
   n_weapons = $data_classes[new_class].weapon_set
   n_armors = $data_classes[new_class].armor_set
   o_weapons = $game_system.class_sets[original_class][0]
   o_armors = $game_system.class_sets[original_class][1]
   mix_weapons = o_weapons | n_weapons
   mix_armors = o_armors | n_armors
   [mix_armors, mix_weapons].each {|array| array.sort!}
   $data_classes[original_class].weapon_set = mix_weapons
   $data_classes[original_class].armor_set = mix_armors 
 end
end

class Scene_Load < Scene_File

 # This refreshes the data on load, since it is not saved
 alias zer0_load_game_fix read_save_data 
 def read_save_data(file)
   zer0_load_game_fix(file)
   CLASS_MIX_ACC.each_index {|i|
     $game_party.actors.each_index {|j|
       if CLASS_MIX_ACC[i][0] == $game_party.actors[j].armor4_id
         old = $game_party.actors[j].class_id
         new = CLASS_MIX_ACC[i][1]
         $game_party.mix_class_equipment(old, new)
       end
     }
   }
 end
end

class Game_System

 attr_accessor :class_sets  

 alias zer0_multi_class_equip_init initialize
 def initialize
   zer0_multi_class_equip_init
   # Creates copies of the original classes' equipment data and retains it
   @class_sets = {}
   (1...$data_classes.size).each {|i|
     weapons = $data_classes[i].weapon_set
     armors = $data_classes[i].armor_set
     equipment = [weapons, armors]
     @class_sets[i] = equipment
   }
 end
end
end

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# Mapback Scene Converter
# Version: 1.0
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
# Explanation:
#
#   With this script, you can alter any scene to use opaque windows and show
#   the game map in the background. Just add the the name of any scene into the
#   array below, configure the desired opacity, and it will be applied to that
#   scene.
#
#   For example, lets say you just a got a nice new shiny Shop script, but you
#   like having "see-through" screens. Normally you would have to go through
#   the script setting the opacity for every window, create a sprite for the
#   map sprite, and add that sprite to the little dispose section. With this
#   script you just add the scene's name to the array and that is all taken
#   care of for you.
#
# Compatibility:
#
# - Do not use it for a scene if it already uses a map back with opaque windows
# - DO NOT add Scene_Map to the array
# - It may not work with a custom CMS, etc. Just experiment to find out.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:

 # Add any scenes that will use opaque windows and a mapback here.
 SCENES = [scene_Menu, Scene_Item, Scene_Skill, Scene_Equip, Scene_Status, 
           Scene_File, Scene_Shop]

 SCENE_OPACITY = 160 
 # The opacity of all the windows used in the above scenes.

#-------------------------------------------------------------------------------

 $map_exist = false
 # DO NOT change this. It is needed to let one window know that another 
 # already created the map sprite, otherwise a scene with 6 windows would
 # create 6 different map sprites. (i.e. lots of lag)

class Window_Base

 alias zer0_scene_mapback_init initialize
 def initialize(x, y, width, height)
   zer0_scene_mapback_init(x, y, width, height)
   if $game_system.MAPBACK_SCENES
     SCENES.each_index {|i|
       if $scene.is_a?(SCENES[i])
         self.back_opacity = SCENE_OPACITY
         unless $map_exist
           @map_back = Spriteset_Map.new
           $map_exist = true
         end
         @scene = SCENES[i]
       end
     }
   end
 end

 alias zer0_scene_mapback_dispose dispose
 def dispose
   zer0_scene_mapback_dispose
   if $game_system.MAPBACK_SCENES && $map_exist
     # Checks if map needs disposed every time a window is disposed
     if @scene != nil && @map_back != nil && $scene != @scene
       @map_back.dispose
       $map_exist = false
     end
   end
 end
end

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# Custom Targetting
# Version: 1.0
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
# Explanation:
#
#   This script will allow you to target either allies or enemies. Most other
#   RPGs allow this, but RMXP does not have a scope that will allow for it.
#   To use, all you have to do is press UP and DOWN during target selection to
#   toggle between enemies and your allies. Pressing L and R, if it is a skill,
#   will toggle between single and all targetting. Pressing L and R does not
#   effect items.
#   
#   You can configure below any skill or item that you do not want these 
#   abilities to apply to. The ability will only work on basic attacks, and  
#   skills and items whose scope is set to "One Ally" or "One Enemy".
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:

 # Any item/skill in the arrays below will behave normally.

 SCOPE_ITEM = []
 # Include any IDs of items that you do NOT want this to apply to.
 SCOPE_SKILL = []
 # Include any IDs of skills that you do NOT want this to apply to.

#-------------------------------------------------------------------------------

class Scene_Battle

 alias zer0_scope_change_enemy update_phase3_enemy_select
 def update_phase3_enemy_select
   zer0_scope_change_enemy
   if $game_system.SCOPE_CHANGE && @active_battler.is_a?(Game_Actor)
     if @active_battler.current_action.kind == 1 && @skill.scope == 2
       @help_window.set_text('All Enemies', 1)
     end
     if Input.trigger?(Input::L) || Input.trigger?(Input::R)
       if @active_battler.current_action.kind == 1
         unless SCOPE_SKILL.include?(@skill.id)
           @skill.scope == 1 ? @skill.scope = 2 : @skill.scope = 1
         end
         @enemy_arrow.visible = (@skill.scope == 2 ? false : true)
       end
     end
     if Input.trigger?(Input::UP) || Input.trigger?(Input::DOWN)
       if @active_battler.current_action.kind == 1
         SCOPE_SKILL.include?(@skill.id) == false ? @skill.scope = 3 : return
       elsif @active_battler.current_action.kind == 2
         SCOPE_ITEM.include?(@item.id) == false ? @item.scope = 3 : return
       elsif @active_battler.current_action.kind == 0 &&
         @active_battler.current_action.basic == 0
         @active_battler.current_action.basic = 6
       end
       end_enemy_select
       start_actor_select
     end
   end
 end

 alias zer0_scope_change_actor update_phase3_actor_select
 def update_phase3_actor_select
   zer0_scope_change_actor
   if $game_system.SCOPE_CHANGE && @active_battler.is_a?(Game_Actor)
     if @active_battler.current_action.kind == 1 && @skill.scope == 4
       @help_window.set_text('All Allies', 1)
     end
     if Input.trigger?(Input::L) || Input.trigger?(Input::R)
       if @active_battler.current_action.kind == 1
         unless SCOPE_SKILL.include?(@skill.id)
           @skill.scope == 3 ? @skill.scope = 4 : @skill.scope = 3
         end
       @actor_arrow.visible = (@skill.scope == 4 ? false : true)
       end
     end
     if Input.trigger?(Input::UP) || Input.trigger?(Input::DOWN)
       if @active_battler.current_action.kind == 1
         SCOPE_SKILL.include?(@skill.id) == false ? @skill.scope = 1 : return
       elsif @active_battler.current_action.kind == 2
         SCOPE_ITEM.include?(@item.id) == false ? @item.scope = 1 : return
       elsif @active_battler.current_action.kind == 0 &&
         @active_battler.current_action.basic == 6
         @active_battler.current_action.basic = 0
       end
       end_actor_select
       start_enemy_select
     end
   end
 end

 # This will allow basic attacks to be performed on your own party members
 alias zer0_basic_attack_ally make_basic_action_result
 def make_basic_action_result
   if $game_system.SCOPE_CHANGE &&
     @active_battler.current_action.kind == 0 && 
     @active_battler.is_a?(Game_Actor) &&
     @active_battler.restriction != 3 &&  @active_battler.restriction != 2 &&
     @active_battler.current_action.basic == 6
       index = @active_battler.current_action.target_index
       target = $game_party.smooth_target_actor(index)
       @target_battlers = [target]
       target.attack_effect(@active_battler)
   end
   zer0_basic_attack_ally
 end

 # This is to memorize the default scopes and reset them after battle.
 alias zer0_memorize_original_scopes main
 def main
   if $game_system.SCOPE_CHANGE
     @skill_scopes, @item_scopes = [], []
     (1...$data_skills.size).each {|i| @skill_scopes[i] = $data_skills[i].scope}
     (1...$data_items.size).each {|i| @item_scopes[i] = $data_items[i].scope}
   end
   zer0_memorize_original_scopes
 end

 alias zer0_reset_scopes battle_end
 def battle_end(result)
   if $game_system.SCOPE_CHANGE
     (1...$data_skills.size).each {|i| $data_skills[i].scope = @skill_scopes[i]}
     (1...$data_items.size).each {|i| $data_items[i].scope = @item_scopes[i]}
   end
   zer0_reset_scopes(result)
 end
end

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# Multi-Attack Weapons
# Version: 1.0
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
# Explanation:
#
#   Allows you to create weapons that target all enemies in a single attack.
#   You can also create accessories that give this power to any weapon.
#   Has added feature to dilute the attack power for each additional enemy it
#   targets after the first to help keep it balanced.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:

 MULTI_ATTACK_WEAPONS = [13]
 # Include IDs of any weapon that attacks all enemies
 MULTI_ATTACK_ACCESSORIES = [77]
 # Include IDs of any ACCESSORY that will give this power.
 MULTI_DILUTE = true
 # Will decrease attack power in relation to total enemies being attacked

#-------------------------------------------------------------------------------

class Scene_Battle

 alias zer0_basic_attack_all_upd update_phase3_enemy_select
 def update_phase3_enemy_select
   if $game_system.MULTI_ATTACK && @active_battler.is_a?(Game_Actor) && 
      @active_battler.current_action.basic == 0 &&
      @active_battler.current_action.kind == 0 &&
      (MULTI_ATTACK_WEAPONS.include?(@active_battler.weapon_id) ||
       MULTI_ATTACK_ACCESSORIES.include?(@active_battler.armor4_id))
     @active_battler.current_action.basic = 8
     @enemy_arrow.visible = false
   end
   zer0_basic_attack_all_upd
   if @active_battler != nil && @enemy_arrow != nil &&
     @active_battler.current_action.basic == 8 &&
     @active_battler.current_action.kind == 0
     @enemy_arrow.help_window.set_text('All Enemies', 1)
   end  
 end

 alias zer0_basic_attack_all_result make_basic_action_result
 def make_basic_action_result
   if $game_system.MULTI_ATTACK && @active_battler.current_action.basic == 8 &&
       @active_battler.current_action.kind == 0 &&
       @active_battler.restriction != 3 &&  @active_battler.restriction != 2 
     $game_troop.enemies.each {|en| @target_battlers.push(en) if en.exist?}
     @target_battlers.each {|target| target.attack_effect(@active_battler)}
   end
   zer0_basic_attack_all_result
 end
end

class Game_Battler

 # Dilution is set before the attack formula is applied. This should improve
 # compatibility, and requires about a 100 lines less of code. It equals out to
 # be about a 10% decrease in power for every enemy after the first.

 alias zer0_multi_attack_dilute atk
 def atk
   if $game_system.MULTI_ATTACK
     if MULTI_DILUTE && $game_temp.in_battle && @current_action.basic == 8
       n = base_atk
       @states.each {|i| n *= $data_states[i].atk_rate / 100.0}
       dilute = -0.1
       $game_troop.enemies.each {|enemy| dilute += 0.1 if enemy.exist?}
       dilute = 0.4 if dilute > 0.4
       n = n * (1 - dilute)
       return n.ceil
     end
   end
   zer0_multi_attack_dilute
 end
end

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# Automatic Enemy Stat Growth
# Version: 1.0
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
# Explanation:
#
#   This system will take a lot of the guesswork out of setting up your database
#   for enemies. It will automatically adjust enemy stats to the party's stats.
#   The system can be turned on/off with simple script calls. When it is OFF,
#   the info in the database will be used, but when it is ON, the enemies stats
#   will be re-calculated to match the current party's strength. This is done
#   by finding the ratio of the party's current stats compared to their 
#   starting stats. For example:
#
#     At the beginning of the game, our party's average HP is 700, and our
#     little Ghost's average HP is 500. Now, here we are at level 20, and our
#     party's average HP is 1900.
#
#                             1900 / 700 = 2.7
#
#     Since the ratio is 2.7, our Ghost's HP is multiplied by 2.7 and his new
#     HP is 1350. This is applied to all stats of all enemies. Since this
#     feature will be inconvenient for some applications (bosses, etc.), they
#     can all be set back with a script call (see below).
#
#  Instructions:
#
#    SCRIPT CALLS:
#
#      Stats.adjust_enemy_stats  - will apply average to all enemies
#      Stats.use_database        - resets all stats to database configuration
#
#   You will have to be remember to set up your database as needed. Do not set
#   enemy stats as the constant you want them to be. Create your actors first
#   and decide what your initial party is going to be. The average of these
#   stats will be the base-line used for finding the ratios. 
#
#   From there, configure enemy's stats in relation to how powerful they are
#   to the party, because the difficulty of an enemy at level 1 will be equal
#   difficulty at level 99 if this system is ON.
#
#   Side Notes:
#     - Experience and Gold levels will be based off the average of the all
#       the ratios
#     - Evasion, or whatever you choose to call it in your game, will NOT be
#       altered by this system.
#     - When the system is ON, the data will be refreshed at the end of every
#       battle, and any time the party members are changed.
#     - No configuration is required for this script. Make sure you know what
#       what you are doing before changing anything.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
if Zer0_CFG::AUTO_ENEMY_STATS
#-------------------------------------------------------------------------------
module Stats

 def self.party_average
   maxhp = maxsp = str = dex = agi = int = atk = pdef = mdef = 0.0
   $game_party.actors.each_index {|i|
     maxhp += $game_party.actors[i].maxhp
     maxsp += $game_party.actors[i].maxsp
     str += $game_party.actors[i].str
     dex += $game_party.actors[i].dex
     agi += $game_party.actors[i].agi
     int += $game_party.actors[i].int
     atk += $game_party.actors[i].atk
     pdef += $game_party.actors[i].pdef
     mdef += $game_party.actors[i].mdef
   }
   stats = [maxhp, maxsp, str, dex, agi, int, atk, pdef, mdef]
   stats.each_index {|i| stats[i] = (stats[i] / $game_party.actors.size)}
   return stats
 end

 def self.adjust_enemy_stats
   avg_stats = self.party_average
   avg_stats.each_index {|i| (avg_stats[i] /= $game_party.initial_stats[i])}
   exp_gold = 0.0
   avg_stats.each_index {|i| exp_gold += avg_stats[i]}
   exp_gold = (exp_gold / avg_stats.size)
   $data_enemies = load_data('Data/Enemies.rxdata')
   (1...$data_enemies.size).each {|i|  
     enemy = $data_enemies[i]
     enemy.maxhp = (enemy.maxhp * avg_stats[0]).round
     enemy.maxsp = (enemy.maxsp * avg_stats[1]).round
     enemy.str = (enemy.str * avg_stats[2]).round
     enemy.dex = (enemy.dex * avg_stats[3]).round
     enemy.agi = (enemy.agi * avg_stats[4]).round
     enemy.int = (enemy.int * avg_stats[5]).round
     enemy.atk = (enemy.atk * avg_stats[6]).round
     enemy.pdef = (enemy.pdef * avg_stats[7]).round
     enemy.mdef = (enemy.mdef * avg_stats[8]).round
     enemy.exp = (enemy.exp * exp_gold).round
     enemy.gold = (enemy.gold * exp_gold).round
   }
   $game_party.use_average = true
 end

 def self.use_database
   $data_enemies = load_data('Data/Enemies.rxdata')
   $game_party.use_average = false
   # The 'return' is for those who don't have Interpreter command_355 fixed
   return
 end 

end
#-------------------------------------------------------------------------------
class Scene_Load < Scene_File
 # Refresh on load, if system was on when the game was saved
 alias zer0_load_stat_data read_save_data
 def read_save_data(file)
   zer0_load_stat_data(file)
   if $game_party.use_average
     Stats.adjust_enemy_stats
   end
 end
end
#-------------------------------------------------------------------------------
class Scene_Battle
 # Refresh at end of battle
 alias zer0_refresh_enemy_data battle_end
 def battle_end(result)
   zer0_refresh_enemy_data(result)
   if $game_party.use_average
     Stats.adjust_enemy_stats
   end
 end
end
#-------------------------------------------------------------------------------
class Game_Party

 attr_reader   :initial_stats
 attr_accessor :use_average

 alias zer0_auto_stats_adjust_init setup_starting_members
 def setup_starting_members
   zer0_auto_stats_adjust_init
   @initial_stats = Stats.party_average
   @use_average = true
 end
end
#-------------------------------------------------------------------------------
end


#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# Event Range Conditions
# Version: 1.0
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
# Explanation:
#
#   Allows you to set up conditional branches in events that will be based off
#   the event's coordinates in relation to the player's coordinates without 
#   having to create any variables for the X and Y of each.
#
#   Here are the new features you can use a conditional branch. Just type these
#   into the script box for the branch.
#
#   range?(RANGE, EVENT_ID) - Will be true if player is anywhere in the radius
#                             defined by RANGE from the event with EVENT_ID
#
#   on_screen?(EVENT_ID)    - Will be true if the event with EVENT_ID is within
#                             the visible screen
#
#   x_dist?(DIST, EVENT_ID) - Returns true if the player's x/y is within DIST
#            OR               of event's x/y with EVENT_ID. These are absolute
#   y_dist?(DIST, EVENT_ID)   values, meaning it doesn't matter which direction,
#                             it just uses the total distance in tiles for that
#                             axis. Use a DIST of 0 to check if that axis is 
#                             equal.
#
#   player_above?(EVENT_ID) - Returns true when player is above event.
#   player_below?(EVENT_ID) - Returns true when player is below event.
#   player_right?(EVENT_ID) - Returns true when player is right of the event.
#   player_left?(EVENT_ID)  - Returns true when player is left of the event.
#
#   For all of these, if the conditional branch that is using them is within
#   the event that it applies to, you do not have to include the EVENT_ID, it
#   is assumed to be that event's ID unless otherwise defined. 
#
#   You can use these as a condition for just about anything, such as having
#   an event say something, run away, or run toward the player if it is within a
#   specific distance, and it's much easier than using multiple branches and
#   game variables to set it up.
#
#   Remember that if you use a range condition with a parallel trigger, it will
#   continue to execute as long as the condition is met and if the player cannot
#   move during the event's code, the game will effectively be stuck.
#
# Compatability:
#
#   - You may encounter issues if using a Pixel Movement script, though it
#     should still work fine with an 8-Way Movement script. (Not tested)
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:

class Interpreter

 def range?(range = 4, id = @event_id)
   if $game_system.RANGE_CONDITION
     e = $game_map.events[id]
     radius = (Math.hypot((e.x - $game_player.x), (e.y - $game_player.y))).abs
     return (radius <= range)
   end
 end

 def on_screen?(id = @event_id)
   if $game_system.RANGE_CONDITION
     x, y = $game_map.events[id].real_x, $game_map.events[id].real_y
     if ((x - $game_map.display_x + 64) / 4).between?(0, 640) && 
        ((y - $game_map.display_y) / 4).between?(0, 480)
       return true
     end
     return false
   end
 end

 def x_dist?(distance = 0, id = @event_id)
   if $game_system.RANGE_CONDITION
     x_dif = ($game_map.events[id].x - $game_player.x).abs
     return (x_dif <= distance)
   end
 end

 def y_dist?(distance = 0, id = @event_id)
   if $game_system.RANGE_CONDITION
     y_dif = ($game_map.events[id].y - $game_player.y).abs
     return (y_dif <= distance)
   end
 end

 def player_above?(id = @event_id)
   return ($game_map.events[id].y > $game_player.y) if $game_system.RANGE_CONDITION
 end

 def player_below?(id = @event_id)
   return ($game_map.events[id].y < $game_player.y) if $game_system.RANGE_CONDITION
 end

 def player_right?(id = @event_id)
   return ($game_map.events[id].x < $game_player.x) if $game_system.RANGE_CONDITION
 end

 def player_left?(id = @event_id)
   return ($game_map.events[id].x > $game_player.x) if $game_system.RANGE_CONDITION
 end

end

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# Chemist Class
# Version: 1.0
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#
# Explanation:
#
#   Create classes that will have increased item ability. The effects when they 
#   use items will be double the strength of a normal user's items.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:

 CHEMIST_CLASS_IDS = []
 # Include IDs of any class that has the Chemist Ability

class Game_Battler

 alias zer0_chemist_class_item_effect item_effect
 def item_effect(item)
   if $game_system.CHEMIST_ABILITY && CHEMIST_CLASS_IDS.include?(self.class_id)
     (1...$data_items.size).each {|i|
       $data_items[i].recover_hp_rate *= 2 
       $data_items[i].recover_hp *= 2
       $data_items[i].recover_sp_rate *= 2 
       $data_items[i].recover_sp *= 2
     }
   end
   zer0_chemist_class_item_effect(item)
   if $game_system.CHEMIST_ABILITY && CHEMIST_CLASS_IDS.include?(self.class_id)
     $data_items = load_data('Data/Items.rxdata')
   end
 end
end

#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
#                            VERSION HISTORY
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
# 
#  v.1.0  4.14.2010  (Original Release)
#
#     -> Pickpocket Ability   v.1.0
#     -> Code-to-Text-Box     v.1.0
#     -> Ambient SFX          v.1.0
#     -> Down Graphics        v.1.0
#     -> Party Split Exp      v.1.0
#     -> Two-Handed Weapons   v.1.0
#     -> Sprint Shoes         v.1.0
#     -> Enc. Rate Mod        v.1.0
#     -> Experience Egg       v.1.0
#     -> Gold Bonus Equip.    v.1.0
#     -> Treasure Hunter      v.1.0
#     -> Cowards Equipment    v.1.0
#     -> Terrain Speeds       v.1.1 (Improved Coding)
#     -> Window Positioner    v.1.0
#   
#  v.2.3  4.21.2010 
#     
#  -> Updated Scripts:
#     -> Two-Handed Weapons   v.1.1
#         - aliased a method for improved compatibility
#         - fixed a bug
#     -> Gold Bonus Equip.    v.1.1 
#         - aliased a method for improved compatibility
#     -> Treasure Hunter      v.1.1 
#         - aliased a method for improved compatibility
#
#  -> New Additions:
#     -> Map Treasures        v.1.0
#     -> Auto-Animate         v.1.0
#     -> Easy Inn Event       v.1.0
#     -> Cursed Weapon        v.1.0
#     -> Blood Weapons        v.1.0
#     -> Revenge Weapons      v.1.0
#     -> Def Up Armors        v.1.0
#     -> HP1 Revive           v.1.0
#     -> Mixed Class Equip    v.1.0
#     -> Mapback Scenes       v.1.0
#     -> Scope Change         v.1.0
#     -> Multi Attack         v.1.0
#     -> Auto Enemy Stats     v.1.0
#
#  v.2.5  4.28.2010 
#
#  -> Updated Scripts
#     -> Bug Fixed in the 'Do Not Edit' section that would cause a crash when
#        you removed an actor from the party.
#     -> Pickpocket Ability   v.1.1
#         - Added easier configuration to change the 'Pickpocket' button 
#     -> Map Treasure         v.1.1
#         - Improved coding. Better calculation for player/treasure distance
#
#  -> New Additions:
#     -> Range Conditions     v.1.0
#     -> Chemist Ability      v.1.0
#
#
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:

 

 

The Cursed Weapon script is on line 1506, but you have to turn it on at line 134 by changing false to true.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...