#==============================================================================
# 
# ▼ Yanfly Engine Ace - Save Engine Add-On: New Game+ v1.00
# -- Last Updated: 2011.12.26
# -- Level: Normal
# -- Requires: YEA - Ace Save Engine v1.01+
# 
#==============================================================================

$imported = {} if $imported.nil?
$imported["YEA-NewGame+"] = true

#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2011.12.26 - Started Script and Finished.
# 
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# New Game+ is a great way to provide replay value for your game. It lets the
# player re-experience the game in a different way with either carried over
# items, to carried over party members, to carried over skills, switches, and
# variables even. There exists many options to change how New Game+ will work
# for your game.
# 
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
# 
# -----------------------------------------------------------------------------
# Item Notetags - These notetags go in the items notebox in the database.
# -----------------------------------------------------------------------------
# 
# This will cause this specific item to not carry over in New Game+ if the item
# can be carried over. This does not affect any items that actors may have
# equipped.
# 
# -----------------------------------------------------------------------------
# Weapon Notetags - These notetags go in the weapons notebox in the database.
# -----------------------------------------------------------------------------
# 
# This will cause this specific item to not carry over in New Game+ if the item
# can be carried over. This does not affect any items that actors may have
# equipped.
# 
# -----------------------------------------------------------------------------
# Armour Notetags - These notetags go in the armours notebox in the database.
# -----------------------------------------------------------------------------
# 
# This will cause this specific item to not carry over in New Game+ if the item
# can be carried over. This does not affect any items that actors may have
# equipped.
# 
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
# 
# This script requires Yanfly Engine Ace - Ace Save Engine v1.01+ and the
# script must be placed under Ace Save Engine in the script listing.
# 
#==============================================================================

module YEA
  module NEW_GAME_PLUS
    
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - General Settings -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # Description
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    NGP_SWITCH = 203           # If Switch ON, the game file has NG+ flag.
    NGP_TEXT   = "周目"   # Text used to show New Game+.
    
    # This is the help window text used for New Game+ when the New Game+
    # option is highlighted.
    NGP_HELP   = "继承新存档."
    
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Carry Over Settings -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # These settings adjust what carries over and what doesn't. These settings
    # are very specific so adjust them carefully.
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # This array contains all of the switches that you want carried over to
    # be maintained. Any switches that aren't here will be set false.
    CARRY_OVER_SWITCHES = [3, 6, 7,12,15,16,17,18]
    
    # This array contains all of the variables that you want carried over to
    # be maintained. Any variables that aren't here will be set to 0.
    CARRY_OVER_VARIABLES = [1,2,3,4,5]
    
    # If this is set to false, then actors will be completely reset back to
    # their original starting states. If it's set to true, then actors will
    # be kept exactly as they are.
    CARRY_OVER_ACTORS = true
    
    # These settings are only used if actors will be carried over. With this,
    # you can limit what specifics will be carried over for actors from levels
    # to equips to skills.
    CARRY_OVER_LEVELS = true
    CARRY_OVER_EQUIPS = true
    CARRY_OVER_SKILLS = true
    
    # If this is set to false, then the party members will revert back to the
    # original starting party members. If it's true, then the party setup will
    # remain exactly the same.
    CARRY_OVER_PARTY_MEMBERS = true
    
    # If any of these are set to false, then no items, weapons, or armours will
    # be carried over. If it's set to true, then the respective items will be
    # carried over to the newer game.
    CARRY_OVER_GOLD    = true
    CARRY_OVER_ITEMS   = true
    CARRY_OVER_WEAPONS = true
    CARRY_OVER_ARMOURS = true
    
  end # NEW_GAME_PLUS
end # YEA

#==============================================================================
# ▼ Editting anything past this point may potentially result in causing
# computer damage, incontinence, explosion of user's head, coma, death, and/or
# halitosis so edit at your own risk.
#==============================================================================

if $imported["YEA-SaveEngine"]

module YEA
  module NEW_GAME_PLUS
    module_function
    #--------------------------------------------------------------------------
    # convert_integer_array
    #--------------------------------------------------------------------------
    def convert_integer_array(array)
      result = []
      array.each { |i|
        case i
        when Range; result |= i.to_a
        when Integer; result |= [i]
        end }
      return result
    end
    #--------------------------------------------------------------------------
    # converted_contants
    #--------------------------------------------------------------------------
    CARRY_OVER_SWITCHES = convert_integer_array(CARRY_OVER_SWITCHES)
    CARRY_OVER_VARIABLES = convert_integer_array(CARRY_OVER_VARIABLES)
  end # NEW_GAME_PLUS
  module REGEXP
  module BASEITEM
    
    NO_CARRY_OVER = /<(?:NO_CARRY_OVER|no carry over)>/i
    
  end # BASEITEM
  end # REGEXP
end # YEA

#==============================================================================
# ■ DataManager
#==============================================================================

module DataManager
  
  #--------------------------------------------------------------------------
  # alias method: load_database
  #--------------------------------------------------------------------------
  class <