AccueilAccueil  PortailPortail  RechercherRechercher  Dernières imagesDernières images  S'enregistrerS'enregistrer  ConnexionConnexion  



Le Deal du moment :
LEGO Icons 10331 – Le martin-pêcheur
Voir le deal
35 €

Partagez
 

 [Abandon] Add-on Matéria

Voir le sujet précédent Voir le sujet suivant Aller en bas 
AuteurMessage
Doddy
Citadin Lv.7
Citadin Lv.7
Doddy


Masculin Age : 38
Inscrit le : 12/02/2010
Messages : 204

[Abandon] Add-on Matéria Empty
MessageSujet: [Abandon] Add-on Matéria   [Abandon] Add-on Matéria Icon_minitimeDim 11 Avr 2010 - 11:24

Bonjours,
Actuellement lorsque j'équipe la matéria All (Tout) avec la matéria feux, dans mes magie, la magie feux apparait elle cible tout les ennemis et je peut l'utiliser autant de fois que je veux du moment que j'ai des mp si je n'associe pas la matéria feu à la matéria tout elle cible uniquement un seul ennemi.
Voila pour le fonctionnement actuel.

J'aimerais, que lorsque j'associe la matéria Tout à la matéria Feu, dans mes magie apparraisse:
-Feu
-Feu Tout
Et que lorsque j'utilise la magie feu elle est une fonction normale (cible 1 seul ennemi et utilisable temps que j'ai des mp)
Par contre je souhaite que Feu Tout (qui cible tout les ennemis) soit utilisable qu'une fois (durant le même combat) si la matéria Tout est de niveau 1, 2 fois si la matéria tout est de niveau 2, etc...
Et autant de fois que l'on veut (tant qu'on a des mp) si la matéria Tout est a son niveau 4 (sachant que le niveau max de la matéria Tout est 5 et que ce sera pareil que pour 4), bien entendu si la matéria Tout n'est plus utilisable.dans les compétences durant le combat -Feu reste utilisable et -Feu Tout reste grisée.

Merci aux scripteurs de jeter un oeil sur ma demande.
Je reste entièrement disponible pour tester ou apporter mon aide.

Voici le script en deux partie:
Code:

#==============================================================================
# Materia System (FF:VII)
#==============================================================================
# Original script from XP by SephirothSpawn
# and Converted for VX by Atoa
#------------------------------------------------------------------------------
# Traslated by: Carbajosa... (Is this credit needed? lol)
#------------------------------------------------------------------------------
# Sorry if these translations are a bit messy, its because
# this is a direct translation but the instructions provided
# here is originaly made by Atoa (copied and pasted)
# So more thanks to Atoa for a great convertion! Yay!
#==============================================================================
=begin
===================================================
Materia Icons
===================================================

IMPORTANT:You must create an new folder named "Icons" on the Graphic folder

You can set individual icons for each materia, the icon must be on the Incon
folder.
The name of the icon must be the same of the Materia + "_m"

E.g
Cure materia icon must be named "Cure_m"
Ultima materia icon must be named "Ultima_m"

Materias without individual icons will have the default materia icon, the color
of defaut icon depends on the materia type

===================================================
Configurating Materias
===================================================

To configure the materias, look for lines like these in the "module
Materia_Config"

MATERIA_LIST << [ID, name, type, status, elements, status effects, price,
master price, ap, skill, special effect]

    * ID = Materia ID
    * name = materia Name
    * type = materia type (can be "Magic", "Command", "Summon", "Support"
    and "Independent", they arent translated in demo)
    * status = status change of the materia.[hp, sp, str, dex, agi, int] in
    XP, [hp, mp, atk, def, spi, agi] in VX
    * elements = element id of materia. used when paired with elemental
    spuport materia. must be an array
    * status effect = status effect id of materia. used when paired with
    added effect spuport materia must. be an array
    * price = Price of materia with 0 AP
    * master price = Price of an level max materia
    * ap = ap nedded to level up. must be an array. the first value is the
    ap to level 2. Here is the place where you set the max level of materia,
    depending on how many values yoi add on the array.

E.G
[1000, 2000 ,3000] = the materia will have 4 levels
[2500, 5000, 10000, 20000, 40000] = the materia will have 6 levels

    * skills = skills of the materia. must be an array. you can make an
    instace of this array = nil, so materia will "skip" this level

E.G
[2,7,20] = materia gain skill ID 2 in level 1, skill ID 7 in level 2, and
skill ID 20 in level 3.
[nil,6,nil,13] = materia gain no skill in level 1, skill ID in level 2, no
skill in level 3, and skill ID 13 in level 4.

    * special effects = special effects of materia. one of these: "All",
    "Elemental", "Added Effect", "HP Absorb", "MP Absorb", "MP Turbo",
    "MP Cost Cut", "EXP plus", "Gil Plus", "HP Plus", "MP Plus", "Strength Plus",
    "Defense Plus", "Magic Plus", "Speed Plus", "Flee Plus", "Critical Rate Plus",
    "Critical Damage Plus",  "Escape Plus", "HP <> MP"


===================================================   
Gain new Materia
===================================================

Use the script Call event and add this code:
$game_party.gain_materia(ID)
where ID = the ID of materia

===================================================
Materia Shop
===================================================

to open an materia shop use the script Call event and add this code:
materia_avaliable = [ X, Y, Z]
$scene = Scene_MateriaShop.new(materia_avaliable)

X,Y,Z = the ID of Materias
You can add how many IDs you want.

===================================================
Set Enemy AP
===================================================

to set enemy AP, look for lines like these in the "module Materia_Config"

ENEMY_AP[ID] = X

ID = Enemy ID
X = AP given by enemy

Enemys that don't have their IDs added to the list will give AP = their EXP/10

#==============================================================================
=end

module Materia_Config
 
  # Do not Erase the lines
  WEAPON_MATERIA_SLOTS = []
  ARMORS_MATERIA_SLOTS = []
  MATERIA_LIST = []
  ENEMY_AP = []
  # Do not Erase the lines
 
 # If true, when a materia reach a maximum level, you gain another
 # Stat in level 1, if false, nothing will happen
  Materia_Breeding = true
 
  # Configuration of attributes IDs with special effects
  Negate_Absorb_ID = 17 # ID attribute to the effect "Negate Absorption"
  Negate_Turbo_ID  = 18 # ID attribute to the effect "Negate MP Turbo"
  Negate_All_ID    = 19 # ID attribute to the effect "Negate All"

  # Materia Shop Message Configuration
  Shop_Message = 'How can I help you?'                  # ShoP Message
  Buy_Message = 'What Materia would you like to buy?' # Buy Message
  Sell_Message = 'Which materia you want to sell?' # Selling Message
  Buy_Command = 'Buy Materia' # Name of Option to purchase the store Materias
  Sell_Command = 'Sell Materia' # Name of Option to sell the store Materias
  Empty_Message = 'None'          # Message when Equiped...?
  Master_Text = 'Master'    # Text that indicates a Materia in High Level
  AP_Total = 'Total AP:'  # AP Attribute name (in the window of materials)

  Default_Icon = 'Materia Icon'              # Default Materia Icon
  Materia_Cursor = 'Materia Cursor'          # Cursor Graphic Icon
  Single_Slot = 'Materia Single'            # Single-Slot Icon
  Paired_Slot_Left = 'Materia Paired Left'  # Paired-Slot Icon (Left)
  Paired_Slot_Right = 'Materia Paired Right' # Paired-Slot Icon (Right)
  Materia_Level = 'Star - Icon'              # Level Icon

  # Index of the Chart icon when equiped.
  Empty_Weapon = 1
  Empty_Armor1 = 50
  Empty_Armor2 = 34
  Empty_Armor3 = 41
  Empty_Armor4 = 57
 
 
#===============================================================================
=begin
===================================================
Equipment Slots
===================================================

To set the slots of equipment, look for lines like these in the
"module Materia_Config"

WEAPON_MATERIA_SLOTS[ID] = [X , Y] for weapons
ARMORS_MATERIA_SLOTS[ID] = [X , Y] for armors

ID = Equipment ID
X = number of paired slots (count as 2 single slots)
Y = nuber of single slots

The total slots will never be greater than 8, if you set more than 8 slots,
the extra slots will be ignored

E.g
ARMORS_MATERIA_SLOTS[5] = [2, 2]
The armor ID 5 will have 6 slots
(2 * 2) + 2 = 6

WEAPON_MATERIA_SLOTS[3] = [1, 5]
The weapon ID 5 will have 7 slots
(1 * 2) + 5 = 7

If you don't add an equipment ID on the list, the equip of this ID will have
0 slots
=end
#================================================================================
  # Weapon SLots
  WEAPON_MATERIA_SLOTS[1] = [0 , 2]
  WEAPON_MATERIA_SLOTS[2] = [1 , 0]
  WEAPON_MATERIA_SLOTS[3] = [0 , 3]
  WEAPON_MATERIA_SLOTS[4] = [1 , 1]
  WEAPON_MATERIA_SLOTS[5] = [1 , 0]
  WEAPON_MATERIA_SLOTS[6] = [1 , 1]
  WEAPON_MATERIA_SLOTS[7] = [1 , 2]
  WEAPON_MATERIA_SLOTS[8] = [2 , 0]
  WEAPON_MATERIA_SLOTS[9] = [2 , 1]
  WEAPON_MATERIA_SLOTS[10] = [1 , 3]
  WEAPON_MATERIA_SLOTS[11] = [0 , 6]
  WEAPON_MATERIA_SLOTS[12] = [1 , 3]
  WEAPON_MATERIA_SLOTS[13] = [1 , 2]
  WEAPON_MATERIA_SLOTS[14] = [0 , 4]
  WEAPON_MATERIA_SLOTS[15] = [1 , 2]
  WEAPON_MATERIA_SLOTS[16] = [2 , 0]
  WEAPON_MATERIA_SLOTS[17] = [0 , 5]
  WEAPON_MATERIA_SLOTS[18] = [3 , 0]
  WEAPON_MATERIA_SLOTS[19] = [1 , 3]
  WEAPON_MATERIA_SLOTS[20] = [2 , 1]
  WEAPON_MATERIA_SLOTS[21] = [2 , 2]
  WEAPON_MATERIA_SLOTS[22] = [2 , 3]
  WEAPON_MATERIA_SLOTS[23] = [1 , 4]
  WEAPON_MATERIA_SLOTS[24] = [2 , 2]
  WEAPON_MATERIA_SLOTS[25] = [4 , 0]
  WEAPON_MATERIA_SLOTS[26] = [1 , 5]
  WEAPON_MATERIA_SLOTS[27] = [2 , 3]
  WEAPON_MATERIA_SLOTS[28] = [3 , 1]
  WEAPON_MATERIA_SLOTS[29] = [2 , 4]
  WEAPON_MATERIA_SLOTS[30] = [4 , 0]
 
  # Armor Slots
  ARMORS_MATERIA_SLOTS[1] = [0 , 2]
  ARMORS_MATERIA_SLOTS[2] = [1 , 2]
  ARMORS_MATERIA_SLOTS[3] = [1 , 3]
  ARMORS_MATERIA_SLOTS[4] = [1 , 3]
  ARMORS_MATERIA_SLOTS[5] = [2 , 2]
  ARMORS_MATERIA_SLOTS[6] = [3 , 0]
  ARMORS_MATERIA_SLOTS[7] = [0 , 1]
  ARMORS_MATERIA_SLOTS[8] = [1 , 1]
  ARMORS_MATERIA_SLOTS[9] = [1 , 3]
  ARMORS_MATERIA_SLOTS[10] = [2 , 2]
  ARMORS_MATERIA_SLOTS[11] = [1 , 3]
  ARMORS_MATERIA_SLOTS[12] = [1 , 5]
  ARMORS_MATERIA_SLOTS[13] = [1 , 0]
  ARMORS_MATERIA_SLOTS[14] = [0 , 2]
  ARMORS_MATERIA_SLOTS[15] = [1 , 1]
  ARMORS_MATERIA_SLOTS[16] = [2 , 0]
  ARMORS_MATERIA_SLOTS[17] = [1 , 2]
  ARMORS_MATERIA_SLOTS[18] = [2 , 2]
  ARMORS_MATERIA_SLOTS[19] = [1 , 4]
  ARMORS_MATERIA_SLOTS[20] = [3 , 2]
  ARMORS_MATERIA_SLOTS[21] = [0 , 7]
  ARMORS_MATERIA_SLOTS[22] = [2 , 4]
  ARMORS_MATERIA_SLOTS[23] = [1 , 2]
  ARMORS_MATERIA_SLOTS[24] = [1 , 2]
  ARMORS_MATERIA_SLOTS[25] = [1 , 2]
  ARMORS_MATERIA_SLOTS[26] = [1 , 2]
  ARMORS_MATERIA_SLOTS[27] = [1 , 2]
  ARMORS_MATERIA_SLOTS[28] = [1 , 2]
  ARMORS_MATERIA_SLOTS[29] = [0 , 8]
  ARMORS_MATERIA_SLOTS[30] = [4 , 0]
 
  #=#================================================================#=#
  #=#                          Enemy APs                            #=#
  #=#================================================================#=#
  #=# ENEMY_AP[ID] = x                                              #=#
  #=# where ID = Enemy ID in the database                            #=#
  #=# and                                                            #=#
  #=# X is the AP that you will get from them.                      #=#
  #=# ex: ENEMY_AP[1] = 2                                            #=#
  #=# You will get 2 AP from a slime[ID:001] in the database        #=#
  #=#================================================================#=#
  ENEMY_AP[1] = 2
  ENEMY_AP[2] = 3
  ENEMY_AP[3] = 5
  ENEMY_AP[4] = 9
  ENEMY_AP[5] = 11
  ENEMY_AP[6] = 16
  ENEMY_AP[7] = 21
  ENEMY_AP[8] = 28
  ENEMY_AP[9] = 32
  ENEMY_AP[10] = 37
  ENEMY_AP[11] = 42
  ENEMY_AP[12] = 46
  ENEMY_AP[13] = 51
  ENEMY_AP[14] = 57
  ENEMY_AP[15] = 64
  ENEMY_AP[16] = 72
  ENEMY_AP[17] = 80
  ENEMY_AP[18] = 93
  ENEMY_AP[19] = 175
  ENEMY_AP[20] = 214
  ENEMY_AP[21] = 126
  ENEMY_AP[22] = 153
  ENEMY_AP[23] = 344
  ENEMY_AP[24] = 198
  ENEMY_AP[25] = 415
  ENEMY_AP[26] = 530
  ENEMY_AP[27] = 725
  ENEMY_AP[28] = 986
  ENEMY_AP[29] = 1200
  ENEMY_AP[30] = 3000
 
  # List of Materias
  #[id, name, type, attribute = [], elements = [], effects = [],
  # AP needed = min.500, Mastered AP Needed = min.1000,
  # skills = [], exp = [], special = nil]
 
  # Magics
                  #ID  Name      Type    HP MP ATK DEF SPI AGI element Effect AP MasterAP          EXP              SKILLS
  MATERIA_LIST << [0, 'Cure',  'Magic', [ -5, 5, -3, 0, 3, 0 ], [], [],    1000, 10000, [1000, 3000, 6000, 10000], [33,34,35,41]]
  MATERIA_LIST << [1, 'Remedy', 'Magic', [ -4, 4, -3, 0, 3, 0 ], [], [],    750, 5000, [2000, 3000,5000], [39,40,48]]
  MATERIA_LIST << [2, 'Fire',  'Magic', [ -3, 3, -1, 0, 1, 0 ], [9], [],  1000, 7500, [1000, 2000, 3000,5000], [59,61,60,62]]
  MATERIA_LIST << [3, 'Ice',    'Magic', [ -3, 3, -1, 0, 1, 0 ], [10], [],  1000, 7500, [1000, 2000, 3000,5000], [63,65,64,66]]
  MATERIA_LIST << [4, 'Thunder','Magic', [ -3, 3, -1, 0, 1, 0 ], [11], [],  1000, 7500, [1000, 2000, 3000,5000], [67,69,68,70]]
  MATERIA_LIST << [5, 'Water',  'Magic', [ -4, 4, -2, 0, 2, 0 ], [12], [],  1000, 7500, [3000, 8000], [71,72]]
  MATERIA_LIST << [6, 'Earth',  'Magic', [ -4, 4, -2, 0, 2, 0 ], [13], [],  1000, 7500, [3000, 8000], [73,74]]
  MATERIA_LIST << [7, 'Wind',  'Magic', [ -4, 4, -2, 0, 2, 0 ], [14], [],  1000, 7500, [3000, 8000], [75,76]]
  MATERIA_LIST << [8, 'Light',  'Magic', [ -4, 4, -2, 0, 2, 0 ], [15], [],  1000, 7500, [3000, 8000], [77,78]]
  MATERIA_LIST << [9, 'Darkness','Magic', [ -4, 4, -2, 0, 2, 0 ], [16], [], 1000, 7500, [3000,8000], [79,80]]
  MATERIA_LIST << [10,'Ultima', 'Magic', [ -5, 5, -3, 0, 3, 0 ], [9,10,11,12,13,14,15], [], 10000,50000, [10000, 30000, 50000], [nil,81,82]]
  MATERIA_LIST << [11,'Poison', 'Magic', [ -2, 2, 0, 0, 0, 0 ], [], [2],    750, 4500, [1500, 4500], [15,16]]
  MATERIA_LIST << [12,'Blind',  'Magic', [ -2, 2, 0, 0, 0, 0 ], [], [3],    750, 4500, [1500, 4500], [17,18]]
  MATERIA_LIST << [13,'Silence','Magic', [ -2, 2, 0, 0, 0, 0 ], [], [4],    750, 4500, [1500, 4500], [19,20]]
  MATERIA_LIST << [14,'Confusion','Magic', [ -2, 2, 0, 0, 0, 0 ], [], [5],  750, 4500, [1500, 4500], [21,22]]
  MATERIA_LIST << [15,'Sono',  'Magic', [ -2, 2, 0, 0, 0, 0 ], [], [6],    750, 4500, [1500, 4500], [23,24]]
  MATERIA_LIST << [16,'Paralize','Magic', [ -2, 2, 0, 0, 0, 0 ], [], [7],  750, 4500, [1500, 4500], [25,26]]
  MATERIA_LIST << [17,'Weakness','Magic', [ -2, 2, 0, 0, 0, 0 ], [], [12],  750, 4500, [5000], [53]]
  MATERIA_LIST << [18,'Tiredness','Magic', [ -2, 2, 0, 0, 0, 0 ], [], [14], 750, 4500, [5000], [54]]
  MATERIA_LIST << [19,'Fever',  'Magic', [ -2, 2, 0, 0, 0, 0 ], [], [15],  750, 4500, [5000], [55]]
  MATERIA_LIST << [20,'Slow',  'Magic', [ -2, 2, 0, 0, 0, 0 ], [], [16],  750, 4500, [5000], [56]]
  MATERIA_LIST << [21,'Strength','Magic', [ -2, 2, 0, 0, 0, 0 ], [], [9],  750, 4500, [2000,4000], [nil, 49]]
  MATERIA_LIST << [22,'Protect','Magic', [ -2, 2, 0, 0, 0, 0 ], [], [10],  750, 4500, [2000,4000], [nil, 50]]
  MATERIA_LIST << [23,'Spirit', 'Magic', [ -2, 2, 0, 0, 0, 0 ], [], [11],  750, 4500, [2000,4000], [nil, 51]]
  MATERIA_LIST << [24,'Speed up','Magic', [ -2, 2, 0, 0, 0, 0 ], [], [12],  750, 4500, [2000,4000], [nil, 52]]
  # Command
  MATERIA_LIST << [25, 'Dual Combo', 'Command', [0, 0, 5, 3, - 5, - 3], [], [], 3000, 20000, [2500, 5000, 9000, 14000], [2]]
  MATERIA_LIST << [26, 'Death Blow', 'Command', [2, -2, 4, 4, -6, -2], [], [], 3000, 20000, [2500, 5000, 9000, 14000], [3]]
  MATERIA_LIST << [27, 'Venomous', 'Command', [4, -2, 6, 4, -8, -4], [], [], 3000, 20000, [2500, 5000, 9000, 14000], [4]]
  MATERIA_LIST << [28, 'Blindness', 'Command', [0, -2, 2, -2, -2, 8], [], [], 3000, 20000, [2500, 5000, 9000, 14000], [5]]
  MATERIA_LIST << [29, 'Sleep', 'Command', [-3, 2, -3, -2, 4, 4], [], [], 3000, 20000, [2500, 5000, 9000, 14000], [6]]
  MATERIA_LIST << [30, 'Shock', 'Command', [-2, 0, 3, -4, 2, 5], [], [], 3000, 20000, [2500, 5000, 9000, 14000], [7]]
  # Summon Materia
  MATERIA_LIST << [31, 'Invocation 1', 'Summon', [-10, 10, -5, -5, 0, 10], [], [], 5000, 25000, [6500, 15000, 25000, 50000], [83]]
  MATERIA_LIST << [32, 'Invocation 2', 'Summon', [-10, 10, -5, -5, 0, 10], [], [], 5000, 25000, [6500, 15000, 25000, 50000], [84]]
  MATERIA_LIST << [33, 'Invocation 3', 'Summon', [-10, 10, -5, -5, 0, 10], [], [], 5000, 25000, [6500, 15000, 25000, 50000], [85]]
  # Support Materia
  MATERIA_LIST << [34, 'All', 'Support', [0, 0, 0, 0, 0, 0], [], [], 2000, 10000, [2000, 4000, 7000, 11000], [], 'All']
  MATERIA_LIST << [35, 'Elemental', 'Support', [0, 0, 0, 0, 0, 0], [], [], 2000, 10000, [2000, 4000, 7000, 11000], [], 'Elemental']
  MATERIA_LIST << [36, 'Added Effect', 'Support', [0, 0, 0, 0, 0, 0], [], [], 2000, 10000, [2000, 4000, 7000, 11000], [], 'Added Effect']
  MATERIA_LIST << [37, 'Absorb HP', 'Support', [0, 0, 0, 0, 0, 0], [], [], 2000, 10000, [2000, 4000, 7000, 11000], [], 'Absorb HP']
  MATERIA_LIST << [38, 'Absorb MP', 'Support', [0, 0, 0, 0, 0, 0], [], [], 2000, 10000, [2000, 4000, 7000, 11000], [], 'Absorb MP']
  MATERIA_LIST << [39, 'MP Turbo', 'Support', [0, 0, 0, 0, 0, 0], [], [], 2000, 10000, [2000, 4000, 7000, 11000], [], 'MP Turbo']
  MATERIA_LIST << [40, 'Reduce Cost', 'Support', [0, 0, 0, 0, 0, 0], [], [], 2000, 10000, [2000, 4000, 7000, 11000], [], 'Reduce Cost']
  # Independent Materia
  MATERIA_LIST << [41, 'Exp Plus', 'Independent', [0, 0, 0, 0, 0, 0], [], [], 2000, 10000, [2000, 4000, 7000, 11000], [], 'Exp Plus']
  MATERIA_LIST << [42, 'Gil Plus', 'Independent', [0, 0, 0, 0, 0, 0], [], [], 2000, 10000, [2000, 4000, 7000, 11000], [], 'Gil Plus']
  MATERIA_LIST << [43, 'HP Plus', 'Independent', [0, 0, 0, 0, 0, 0], [], [], 2000, 10000, [2000, 4000, 7000, 11000], [], 'HP Plus']
  MATERIA_LIST << [44, 'MP Plus', 'Independent', [0, 0, 0, 0, 0, 0], [], [], 2000, 10000, [2000, 4000, 7000, 11000], [], 'MP Plus']
  MATERIA_LIST << [45, 'Strength Plus', 'Independent', [0, 0, 0, 0, 0, 0], [], [], 2000, 10000, [2000, 4000, 7000, 11000], [], 'Strength Plus']
  MATERIA_LIST << [46, 'Defense Plus', 'Independent', [0, 0, 0, 0, 0, 0], [], [], 2000, 10000, [2000, 4000, 7000, 11000], [], 'Defense Plus']
  MATERIA_LIST << [47, 'Magic Plus', 'Independent', [0, 0, 0, 0, 0, 0], [], [], 2000, 10000, [2000, 4000, 7000, 11000], [], 'Magic Plus']
  MATERIA_LIST << [48, 'Agility Plus', 'Independent', [0, 0, 0, 0, 0, 0], [], [], 2000, 10000, [2000, 4000, 7000, 11000], [], 'Agility Plus']
  MATERIA_LIST << [49, 'Evasion Plus', 'Independent', [0, 0, 0, 0, 0, 0], [], [], 2000, 10000, [2000, 4000, 7000, 11000], [], 'Evasion Plus']
  MATERIA_LIST << [50, 'Critical Chance Plus', 'Independent', [0, 0, 0, 0, 0, 0], [], [], 2000, 10000, [2000, 4000, 7000, 11000], [], 'Critical Chance Plus']
  MATERIA_LIST << [51, 'Critical Damage Plus', 'Independent', [0, 0, 0, 0, 0, 0], [], [], 2000, 10000, [2000, 4000, 7000, 11000], [], 'Critical Damage Plus']
  MATERIA_LIST << [52, 'Escape Plus', 'Independent', [0, 0, 0, 0, 0, 0], [], [], 2000, 10000, [2000, 4000, 7000, 11000], [], 'Escape Plus']
  MATERIA_LIST << [53, 'HP <> MP', 'Independent', [0, 0, 0, 0, 0, 0], [], [], 2000, 10000, [2000, 4000, 7000, 11000], [], 'HP <> MP']
end

#==============================================================================
# ** RPG
#==============================================================================
module RPG
  #============================================================================
  # ** Weapon
  #============================================================================
  class Weapon   
    #--------------------------------------------------------------------------
    attr_accessor :paired_materia
    attr_accessor :single_materia
    #--------------------------------------------------------------------------
    def set_materia_slots(slots)
      @paired_materia, @single_materia = slots[0], slots[1]
    end
  end
  #============================================================================
  # ** Armor
  #============================================================================
  class Armor
    #--------------------------------------------------------------------------
    attr_accessor :paired_materia
    attr_accessor :single_materia
    #--------------------------------------------------------------------------
    def set_materia_slots(slots)
      @paired_materia, @single_materia = slots[0], slots[1]
    end
  end
end

#==============================================================================
# ** Cache
#==============================================================================
module Cache
  #--------------------------------------------------------------------------
  def self.icon(filename, hue = 0)
    load_bitmap("Graphics/Icons/", filename, hue)
  end
end

#==============================================================================
# ** Window_Base
#==============================================================================
class Window_Base
  #--------------------------------------------------------------------------
  def draw_face_materia(face_name, face_index, x, y, size = 96)
    bitmap = Cache.face(face_name)
    rect = Rect.new(0, 0, 0, 0)
    rect.x = face_index % 4 * 96 + (96 - size) / 2
    rect.y = face_index / 4 * 96 + (96 - size) / 2
    rect.width = size
    rect.height = size
    self.contents.blt(x, y, bitmap, rect, 128)
    bitmap.dispose
  end
end

#==============================================================================
# ** Materia
#==============================================================================
class Materia
  #--------------------------------------------------------------------------
  attr_reader    :id
  attr_accessor  :name
  attr_accessor  :type
  attr_accessor  :stat_effects
  attr_accessor  :elements
  attr_accessor  :states
  attr_accessor  :new_value
  attr_accessor  :master_value
  attr_accessor  :skills
  attr_accessor  :exp_levels
  attr_accessor  :special_effect
  #--------------------------------------------------------------------------
  def initialize(id, name, type, stat_effects = [], elements = [], states = [],
    n_value = 500, m_value = 1000, skills = [], exp_levels = [], s_effect = nil)
    @id, @name, @type, @stat_effects, @elements, @states,
    @new_value, @master_value, @exp_levels, @skills, @special_effect =
    id, name, type, stat_effects, elements, states,
    n_value, m_value, skills, exp_levels, s_effect
    @experience = 0
  end
  #--------------------------------------------------------------------------
  def experience
    return @experience
  end
  #--------------------------------------------------------------------------
  def experience=(num)
    @experience = [num, @exp_levels[@exp_levels.size - 1]].min
  end
  #--------------------------------------------------------------------------
  def level
    for i in 0...@exp_levels.size
      if @experience >= @exp_levels[@exp_levels.size - (1 + i)]
        return @exp_levels.size - i + 1
      end
    end
    return 1
  end
  #--------------------------------------------------------------------------
  def buy_value
    return @new_value
  end
  #--------------------------------------------------------------------------
  def base_sell_value
    return @new_value / 2
  end
  #--------------------------------------------------------------------------
  def sell_value
    variation = @master_value - (@new_value / 2)
    price_rate = [@experience * 100 / @exp_levels[@exp_levels.size - 1], 100].min
    return [((variation * price_rate) / 100) + (@new_value / 2) ,0].max
  end
  #--------------------------------------------------------------------------
  def get_hue
    case @type
    when 'Magic'
      hue = 130
    when 'Command'
      hue = 60
    when 'Summon'
      hue = 10
    when 'Support'
      hue = 180
    when 'Independent'
      hue = 300
    end
    return hue
  end
end

#==============================================================================
# ** Materia_System
#==============================================================================
class Materia_System
  #--------------------------------------------------------------------------
  include Materia_Config
  #--------------------------------------------------------------------------
  attr_accessor :set_up_materias
  #--------------------------------------------------------------------------
  def set_up_materias
    materias = []
    for m in MATERIA_LIST
      materias[m[0]] = Materia.new(m[0],m[1],m[2],m[3],m[4],m[5],m[6],m[7],m[8],m[9],m[10]) if m != nil
    end
    materias.sort! {|a, b| a.id <=> b.id}
    materias = materias.compact
    return materias
  end
end

#==============================================================================
# ** Game_Battler (part 3)
#==============================================================================
class Game_Battler
  #--------------------------------------------------------------------------
  def make_obj_damage_value(user, obj)
    damage = obj.base_damage
    if damage > 0
      damage += user.atk * 4 * obj.atk_f / 100
      damage += user.spi * 2 * obj.spi_f / 100
      unless obj.ignore_defense
        damage -= self.def * 2 * obj.atk_f / 100
        damage -= self.spi * 1 * obj.spi_f / 100
      end
      damage = 0 if damage < 0
    elsif damage < 0
      damage -= user.atk * 4 * obj.atk_f / 100
      damage -= user.spi * 2 * obj.spi_f / 100
    end
    damage *= elements_max_rate(obj.element_set)
    damage /= 100
    damage = apply_variance(damage, obj.variance)
    damage = apply_guard(damage)
    if user.actor? and obj.is_a?(RPG::Skill)
      for materia in user.weapon_materia + user.armor1_materia + user.armor2_materia + user.armor3_materia + user.armor4_materia
        unless materia.nil?
          if damage != 0 and materia.type == 'Summon' and materia.skills.include?(obj.id)
            damage += (damage * materia.level * 0.2).to_i
          end
        end
      end
      materia_set = user.return_paired_materia
      for paired_set in materia_set
        materia = paired_set[2]
        other_materia = paired_set[3]
        if materia.special_effect == 'MP Turbo'
          for skill_id in other_materia.skills
            unless skill_id == 0 or skill_id == nil
              m_skill = $data_skills[skill_id]
              if obj == m_skill
                unless obj.element_set.include?(Materia_Config::Negate_Turbo_ID)
                  damage += (damage * materia.level * 0.2).to_i if damage != 0
                end
              end
            end
          end
        end
        if materia.special_effect =='Absorb HP'
          for skill_id in other_materia.skills
            unless skill_id == 0 or skill_id == nil
              m_skill = $data_skills[skill_id]
              if obj == m_skill and $game_temp.in_battle
                unless obj.element_set.include?(Materia_Config::Negate_Absorb_ID)
                  if damage > 0
                    dreno = materia.level * 2
                    hp = (damage * dreno / 100).to_i
                    user.hp += [hp, user.maxhp - hp].min
                  end
                end
              end
            end
          end
        end
        if materia.special_effect  =='Absorb MP'
          for skill_id in other_materia.skills
            unless skill_id == 0 or skill_id == nil
              m_skill = $data_skills[skill_id]
              if obj == m_skill and $game_temp.in_battle
                unless obj.element_set.include?(Materia_Config::Negate_Absorb_ID)
                  if damage > 0
                    dreno = materia.level
                    mp = (damage * dreno / 100).to_i
                    user.mp += [mp, user.maxmp - mp].min
                  end
                end
              end
            end
          end
        end
      end
    end
    if obj.damage_to_mp 
      @mp_damage = damage
    else
      @hp_damage = damage
    end
  end
  #--------------------------------------------------------------------------
  def make_attack_damage_value(attacker)
    damage = attacker.atk * 4 - self.def * 2
    damage = 0 if damage < 0
    damage *= elements_max_rate(attacker.element_set)
    damage /= 100
    if damage == 0
      damage = rand(2)
    elsif damage > 0
      @critical = (rand(100) < attacker.cri + attacker.critrateplus)
      @critical = false if prevent_critical
      damage += ((damage * (200 + attacker.critdmgplus)) / 100) if @critical
    end
    damage = apply_variance(damage, 20)
    damage = apply_guard(damage)
    @hp_damage = damage
  end
  #--------------------------------------------------------------------------
  def calc_mp_cost(skill)
    if half_mp_cost
      cost = skill.mp_cost / 2
    else
      cost = skill.mp_cost
    end
    if self.actor?
      materia_set = self.return_paired_materia
      for paired_set in materia_set
        materia = paired_set[2]
        other_materia = paired_set[3]
        if materia.special_effect == 'MP Turbo'
          for skill_id in other_materia.skills
            unless skill_id == 0 or skill_id == nil
              m_skill = $data_skills[skill_id]
              if skill == m_skill and !skill.element_set.include?(Materia_Config::Negate_Turbo_ID)
                cost = (cost + (cost * materia.level * 0.2)).to_i
              end
            end
          end
        end
        if materia.special_effect == 'Reduce Cost'
          for skill_id in other_materia.skills
            unless skill_id == 0 or skill_id == nil
              m_skill = $data_skills[skill_id]
              if skill == m_skill
                cost = (cost - (cost * materia.level * 0.1)).to_i
              end
            end
          end
        end
      end
    end
    return cost
  end
end

#==============================================================================
# ** Game_BattleAction
#==============================================================================
class Game_BattleAction
  #--------------------------------------------------------------------------
  alias materia_make_targets make_targets
  def make_targets
    if skill? and @battler.actor?
      targets = []
      paired_materia_set = @battler.return_paired_materia
      for paired_set in paired_materia_set
        materia = paired_set[2]
        other_materia = paired_set[3]
        if materia.special_effect == 'All'
          for skill_id in other_materia.skills
            if skill_id == skill.id and !skill.element_set.include?(Materia_Config::Negate_All_ID)
              if  skill.for_opponent?
                for target in $game_troop.members do targets.push(target) if target.exist? end
              else
                for target in $game_party.members do targets.push(target) if target.exist? end
              end
            end
          end
        end
      end
      return targets unless targets.empty?
    end
    materia_make_targets
  end
end

#==============================================================================
# ** Game_Actor
#==============================================================================
class Game_Actor
  #--------------------------------------------------------------------------
  attr_accessor :weapon_materia
  attr_accessor :armor1_materia
  attr_accessor :armor2_materia
  attr_accessor :armor3_materia
  attr_accessor :armor4_materia
  attr_accessor :old_weapon_id
  attr_accessor :old_armor1_id
  attr_accessor :old_armor2_id
  attr_accessor :old_armor3_id
  attr_accessor :old_armor4_id
  attr_reader  :ap
  #--------------------------------------------------------------------------
  alias seph_materiasystem_gameactor_init initialize
  alias seph_materiasystem_gameactor_setup setup
  alias seph_materiasystem_gameactor_skills skills
  alias seph_materiasystem_gameactor_equip change_equip
  alias seph_materiasystem_gameactor_elementrate element_rate
  alias seph_materiasystem_gameactor_stateguard? state_resist?
  alias seph_materiasystem_gameactor_elementset element_set
  alias seph_materiasystem_gameactor_plusstateset plus_state_set
  #--------------------------------------------------------------------------
  def initialize(actor_id)
    @weapon_materia = Array.new
    @armor1_materia = Array.new
    @armor2_materia = Array.new
    @armor3_materia = Array.new
    @armor4_materia = Array.new
    seph_materiasystem_gameactor_init(actor_id)
  end
  #--------------------------------------------------------------------------
  def setup(actor_id)
    seph_materiasystem_gameactor_setup(actor_id)
    @materia_skills = []
    sn = [$data_weapons[@weapon_id].paired_materia * 2 + $data_weapons[@weapon_id].single_materia, 8].min unless @weapon_id == 0
    @weapon_materia = @weapon_id == 0 ? [] : Array.new(sn, nil)
    if two_swords_style
      sn = [$data_weapons[@armor1_id].paired_materia * 2 + $data_weapons[@armor1_id].single_materia, 8].min  unless @armor1_id == 0
      @armor1_materia = @armor1_id == 0 ? [] : Array.new(sn, nil)
    else
      sn = [$data_armors[@armor1_id].paired_materia * 2 + $data_armors[@armor1_id].single_materia, 8].min  unless @armor1_id == 0
      @armor1_materia = @armor1_id == 0 ? [] : Array.new(sn, nil)
    end
    sn = [$data_armors[@armor2_id].paired_materia * 2 + $data_armors[@armor2_id].single_materia, 8].min  unless @armor2_id == 0
    @armor2_materia = @armor2_id == 0 ? [] : Array.new(sn, nil)
    sn = [$data_armors[@armor3_id].paired_materia * 2 + $data_armors[@armor3_id].single_materia, 8].min  unless @armor3_id == 0
    @armor3_materia = @armor3_id == 0 ? [] : Array.new(sn, nil)
    sn = [$data_armors[@armor4_id].paired_materia * 2 + $data_armors[@armor4_id].single_materia, 8].min  unless @armor4_id == 0
    @armor4_materia = @armor4_id == 0 ? [] : Array.new(sn, nil)
  end
  #--------------------------------------------------------------------------
  def skills
    for skill_id in @materia_skills
      forget_skill(skill_id)
    end
    @materia_skills = []
    for materia in @weapon_materia + @armor1_materia + @armor2_materia + @armor3_materia + @armor4_materia
      self.learn_materia_skill(materia) unless materia.nil?
    end
    result = seph_materiasystem_gameactor_skills
    return result
  end
  #--------------------------------------------------------------------------
  def learn_materia_skill(materia)
    if materia.type == 'Magic' || materia.type == 'Command' || materia.type == 'Summon'
      materia_level = materia.level == materia.exp_levels.size + 1 ? materia.level - 1 : materia.level
      for i in 0...materia_level
        unless materia.skills[i] == nil or @skills.include?(materia.skills[i])
          skill_id = materia.skills[i]
          learn_skill(skill_id)
          @materia_skills << skill_id
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  def base_maxhp
    n = actor.parameters[0, @level]
    variance = 0
    for materia in @weapon_materia + @armor1_materia + @armor2_materia + @armor3_materia + @armor4_materia
      unless materia.nil?
        variance += materia.stat_effects[0]
        variance += (materia.level * 10) if materia.special_effect == 'HP Plus'
        n = $data_actors[@actor_id].parameters[1, @level] if materia.special_effect == 'HP <> MP'
      end
    end
    n *= ((100 + variance) / 100.0)
    return n.to_i
  end
  #--------------------------------------------------------------------------
  def hp
    @hp = [@hp, maxhp].min
    return @hp
  end
  #--------------------------------------------------------------------------
  def base_maxmp
    n = actor.parameters[1, @level]
    variance = 0
    for materia in @weapon_materia + @armor1_materia + @armor2_materia + @armor3_materia + @armor4_materia
      unless materia.nil?
        variance += materia.stat_effects[1]
        variance += (materia.level * 10) if materia.special_effect == 'MP Plus'
        n = $data_actors[@actor_id].parameters[0, @level] if materia.special_effect == 'HP <> MP'
      end
    end
    n *= ((100 + variance) / 100.0)
    return n.to_i
  end
  #--------------------------------------------------------------------------
  def mp
    @mp = [@mp, maxmp].min
    return @mp
  end
  #--------------------------------------------------------------------------
  def base_atk
    n = actor.parameters[2, @level]
    for item in equips.compact do n += item.atk end
    variance = 0
    for materia in @weapon_materia + @armor1_materia + @armor2_materia + @armor3_materia + @armor4_materia
      unless materia.nil?
        variance += materia.stat_effects[2]
        variance += (materia.level * 5) if materia.special_effect == 'Strength Plus'
      end
    end
    n *= ((100 + variance) / 100.0)
    return n.to_i
  end
  #--------------------------------------------------------------------------
  def base_def
    n = actor.parameters[3, @level]
    for item in equips.compact do n += item.def end
    variance = 0
    for materia in @weapon_materia + @armor1_materia + @armor2_materia + @armor3_materia + @armor4_materia
      unless materia.nil?
        variance += materia.stat_effects[3]
        variance += (materia.level * 5) if materia.special_effect == 'Defense Plus'
      end
    end
    n *= ((100 + variance) / 100.0)
    return n.to_i
  end
  #--------------------------------------------------------------------------
  def base_spi
    n = actor.parameters[4, @level]
    for item in equips.compact do n += item.spi end
    variance = 0
    for materia in @weapon_materia + @armor1_materia + @armor2_materia + @armor3_materia + @armor4_materia
      unless materia.nil?
        variance += materia.stat_effects[4]
        variance += (materia.level * 5) if materia.special_effect == 'Magic Plus'
      end
    end
    n *= ((100 + variance) / 100.0)
    return n.to_i
  end
  #--------------------------------------------------------------------------
  def base_agi
    n = actor.parameters[5, @level]
    for item in equips.compact do n += item.agi end
    variance = 0
    for materia in @weapon_materia + @armor1_materia + @armor2_materia + @armor3_materia + @armor4_materia
      unless materia.nil?
        variance += materia.stat_effects[5]
        variance += (materia.level * 5) if materia.special_effect == 'Agility Plus'
      end
    end
    n *= ((100 + variance) / 100.0)
    return n.to_i
  end
  #--------------------------------------------------------------------------
  def base_eva
    n = 5
    for item in armors.compact do n += item.eva end
    for materia in @weapon_materia + @armor1_materia + @armor2_materia + @armor3_materia + @armor4_materia
      unless materia.nil?
        n += (materia.level * 2) if materia.special_effect == 'Evasion Plus'
      end
    end
    return n.to_i
  end
  #--------------------------------------------------------------------------
  def critrateplus
    variance = 0
    for materia in @weapon_materia + @armor1_materia + @armor2_materia + @armor3_materia + @armor4_materia
      unless materia.nil?
        variance += (materia.level * 5) if materia.special_effect == 'Critical Chance Plus'
      end
    end
    return variance
  end
  #--------------------------------------------------------------------------
  def critdmgplus
    variance = 0
    for materia in @weapon_materia + @armor1_materia + @armor2_materia + @armor3_materia + @armor4_materia
      unless materia.nil?
        variance += (materia.level * 20) if materia.special_effect == 'Critical Damage Plus'
      end
    end
    return variance
  end
  #--------------------------------------------------------------------------
  def escapeplus
    variance = 0
    for materia in @weapon_materia + @armor1_materia + @armor2_materia + @armor3_materia + @armor4_materia
      unless materia.nil?
        variance += (materia.level * 2) if materia.special_effect == 'Escape Plus'
      end
    end
    return variance
  end 
  #--------------------------------------------------------------------------
  def itemdropup
    variance = 0
    for materia in @weapon_materia + @armor1_materia + @armor2_materia + @armor3_materia + @armor4_materia
      unless materia.nil?
        variance += (materia.level * 2) if materia.special_effect == 'Sorte Extra'
      end
    end
    return variance
  end
  #--------------------------------------------------------------------------
  def level_up
    for skill_id in @materia_skills
      self.forget_skill(skill_id)
    end
    @materia_skills = []
    @level += 1
    for learning in self.class.learnings
      learn_skill(learning.skill_id) if learning.level == @level
    end
    for materia in @weapon_materia + @armor1_materia + @armor2_materia + @armor3_materia + @armor4_materia
      self.learn_materia_skill(materia) unless materia.nil?
    end
  end
  #--------------------------------------------------------------------------
  def gain_exp(exp, show)
    exp_plus = 0
    for materia in @weapon_materia + @armor1_materia + @armor2_materia + @armor3_materia + @armor4_materia
      unless materia.nil?
        if materia.special_effect == 'Exp Plus'
          exp_plus += (materia.level * 10)
        end
      end
    end
    exp *= ((100 + exp_plus) / 100)
    if double_exp_gain
      change_exp(@exp + exp * 2, show)
    else
      change_exp(@exp + exp, show)
    end
  end
  #--------------------------------------------------------------------------
  def ap
    return @ap == nil ? 0 : @ap
  end
  #--------------------------------------------------------------------------
  def ap=(ap)
    @ap = ap
    for materia in @weapon_materia + @armor1_materia + @armor2_materia + @armor3_materia + @armor4_materia
      unless materia.nil?
        initial_level = materia.level
        materia.experience += @ap
        final_level = materia.level
        if initial_level < (materia.exp_levels.size + 1) and final_level ==  (materia.exp_levels.size + 1)
          $game_party.gain_materia(materia.id)
        end
      end
    end
    @ap = 0
  end
  #--------------------------------------------------------------------------
  def element_rate(element_id)
    result = seph_materiasystem_gameactor_elementrate(element_id)
    paired = return_paired_materia
    for set in paired
      if set[0] > 0
        materia = set[2]
        if materia.special_effect == 'Elemental'
          other_materia = set[3]
          if other_materia.elements.include?(element_id)
            result /= 2
          end
        end
      end
    end
    return result
  end
  #--------------------------------------------------------------------------
  def state_resist?(state_id)
    result = seph_materiasystem_gameactor_stateguard?(state_id)
    unless result
      paired = return_paired_materia
      for set in paired
        if set[0] > 0
          materia = set[2]
          if materia.special_effect == 'Added Effect'
            other_materia = set[3]
            if other_materia.states.include?(state_id)
              result = true
            end
          end
        end
      end
    end
    return result
  end
  #--------------------------------------------------------------------------
  def element_set
    result = seph_materiasystem_gameactor_elementset
    paired = return_paired_materia
    for set in paired
      if set[0] == 0
        materia = set[2]
        if materia.special_effect == 'Elemental'
          other_materia = set[3]
          for elem_id in other_materia.elements
            result << elem_id unless set.include?(elem_id)
          end
        end
      end
    end
    return result
  end
  #--------------------------------------------------------------------------
  def plus_state_set
    result = seph_materiasystem_gameactor_plusstateset
    paired = return_paired_materia
    for set in paired
      if set[0] == 0
        materia = set[2]
        if materia.special_effect == 'Added Effect'
          other_materia = set[3]
          for state_id in other_materia.states
            result << state_id unless set.include?(state_id)
          end
        end
      end
    end
    return result
  end
  #------------------------------------------------------------------------------
  def check_old_equip
    @old_weapon_id = @weapon_id
    @old_armor1_id = @armor1_id
    @old_armor2_id = @armor2_id
    @old_armor3_id = @armor3_id
    @old_armor4_id = @armor4_id
  end
  #------------------------------------------------------------------------------
  def check_equip_change
    if  @old_weapon_id != @weapon_id
      for materia in @weapon_materia
        $game_party.materia << materia unless materia.nil?
      end
      sn = [$data_weapons[@weapon_id].paired_materia * 2 +  $data_weapons[@weapon_id].single_materia, 8].min  unless @weapon_id == 0
      @weapon_materia = @weapon_id == 0 ? [] : Array.new(sn, nil)
    end
    if  @old_armor1_id != @armor1_id
      for materia in @armor1_materia
        $game_party.materia << materia unless materia.nil?
      end
      if two_swords_style
        sn = [$data_weapons[@armor1_id].paired_materia * 2 +  $data_weapons[@armor1_id].single_materia, 8].min  unless @armor1_id == 0
        @armor1_materia = @armor1_id == 0 ? [] : Array.new(sn, nil)
      else
        sn = [$data_armors[@armor1_id].paired_materia * 2 +  $data_armors[@armor1_id].single_materia, 8].min  unless @armor1_id == 0
        @armor1_materia = @armor1_id == 0 ? [] : Array.new(sn, nil)
      end
    end
    if  @old_armor2_id != @armor2_id
      for materia in @armor2_materia
        $game_party.materia << materia unless materia.nil?
      end
      sn = [$data_armors[@armor2_id].paired_materia * 2 +  $data_armors[@armor2_id].single_materia, 8].min  unless @armor2_id == 0
      @armor2_materia = @armor2_id == 0 ? [] : Array.new(sn, nil)
    end
    if  @old_armor3_id != @armor3_id
      for materia in @armor3_materia
        $game_party.materia << materia unless materia.nil?
      end
      sn = [$data_armors[@armor3_id].paired_materia * 2 +  $data_armors[@armor3_id].single_materia, 8].min  unless @armor3_id == 0
      @armor3_materia = @armor3_id == 0 ? [] : Array.new(sn, nil)
    end
    if  @old_armor4_id != @armor4_id
      for materia in @armor4_materia
        $game_party.materia << materia unless materia.nil?
      end
      sn = [$data_armors[@armor4_id].paired_materia * 2 +  $data_armors[@armor4_id].single_materia, 8].min  unless @armor4_id == 0
      @armor4_materia = @armor4_id == 0 ? [] : Array.new(sn, nil)
    end
  end
  #--------------------------------------------------------------------------
  def equip_materia(equip_type, slot_index, index)
    new_materia = $game_party.materia[index]
    materia = equip_type == 0 ?  @weapon_materia[slot_index] : (eval "@armor#{equip_type}_materia")[slot_index]
    $game_party.materia << materia unless materia.nil?
    case equip_type
    when 0 
      return if @weapon_materia.size == 0
      @weapon_materia[slot_index] = new_materia
    when 1 
      return if @armor1_materia.size == 0
      @armor1_materia[slot_index] = new_materia
    when 2 
      return if @armor2_materia.size == 0
      @armor2_materia[slot_index] = new_materia
    when 3 
      return if @armor3_materia.size == 0
      @armor3_materia[slot_index] = new_materia
    when 4 
      return if @armor4_materia.size == 0
      @armor4_materia[slot_index] = new_materia
    end
    $game_party.materia.delete_at(index)
  end
  #--------------------------------------------------------------------------
  def unequip_materia(equip_type, slot_index)
    materia = equip_type == 0 ? @weapon_materia[slot_index] : (eval "@armor#{equip_type}_materia")[slot_index]
    $game_party.materia << materia unless materia.nil?
    equip_type == 0 ? @weapon_materia[slot_index] = nil : (eval "@armor#{equip_type}_materia")[slot_index] = nil
  end
  #--------------------------------------------------------------------------
  def return_paired_materia
    paired = []
    unless @weapon_id == 0
      if $data_weapons[@weapon_id].paired_materia > 0
        for i in 0...($data_weapons[@weapon_id].paired_materia * 2)
          materia = @weapon_materia[i]
          if materia.type == 'Support'
            o_i = i + ([0, 2, 4, 6].include?(i) ? 1 : - 1)
            other_materia = @weapon_materia[o_i]
            paired << [0, [i, o_i].min, materia, other_materia] unless other_materia.nil?
          end
        end
      end
    end
    for a in 1..4
      unless (eval "@armor#{a}_id") == 0
        if (eval "$data_armors[@armor#{a}_id].paired_materia") > 0
          for i in 0...((eval "$data_armors[@armor#{a}_id].paired_materia") * 2)
            materia = (eval "@armor#{a}_materia")[i]
            if materia.type == 'Support'
              o_i = i + ([0, 2, 4, 6].include?(i) ? 1 : - 1)
              other_materia = (eval "@armor#{a}_materia")[o_i]
              paired << [a, [i, o_i].min, materia, other_materia] unless other_materia.nil?
            end
          end
        end
      end
    end
    return paired
  end
  #--------------------------------------------------------------------------
  def return_paired_materia_type
    unless @weapon_id == 0
      if $data_weapons[@weapon_id].paired_materia > 0
        for i in 0...($data_weapons[@weapon_id].paired_materia)
          materia = @weapon_materia[i]
        end
      end
      if $data_weapons[@weapon_id].single_materia > 0
        for i in 0...($data_weapons[@weapon_id].single_materia)
          materia = @weapon_materia[i]
        end
      end
    end
    for a in 1..4
      unless (eval "@armor#{a}_id") == 0
        if (eval "$data_armors[@armor#{a}_id].paired_materia") > 0
          for i in 0...((eval "$data_armors[@armor#{a}_id].paired_materia"))
            materia = (eval "@armor#{a}_materia")[i]
          end
        end
        if (eval "$data_armors[@armor#{a}_id].single_materia") > 0
          for i in 0...((eval "$data_armors[@armor#{a}_id].single_materia"))
            materia = (eval "@armor#{a}_materia")[i]
          end
        end
      end
    end
    return
  end
end

#==============================================================================
# ** Game_Enemy
#==============================================================================
class Game_Enemy
  #------------------------------------------------------------------------------
  attr_accessor  :ap
  #------------------------------------------------------------------------------
  alias materia_initialize initialize
  def initialize(index, enemy_id)
    materia_initialize(index, enemy_id)
    @enemy = $data_enemies[@enemy_id]
    @ap = get_ap
  end
  #------------------------------------------------------------------------------
  def get_ap
    for i in 0...Materia_Config::ENEMY_AP.size
      ap = Materia_Config::ENEMY_AP[i] if @enemy_id == i
    end
    return ap == nil ? (@enemy.exp / 10).to_i : ap
  end
  #------------------------------------------------------------------------------
  def ap
    return @ap == nil ? (@enemy.exp / 10).to_i : @ap
  end
  #------------------------------------------------------------------------------
  def critrateplus
    return 0
  end
  #--------------------------------------------------------------------------
  def critdmgplus
    return 0
  end
end



Dernière édition par Doddy le Mar 11 Mai 2010 - 15:43, édité 2 fois
Revenir en haut Aller en bas
Doddy
Citadin Lv.7
Citadin Lv.7
Doddy


Masculin Age : 38
Inscrit le : 12/02/2010
Messages : 204

[Abandon] Add-on Matéria Empty
MessageSujet: Re: [Abandon] Add-on Matéria   [Abandon] Add-on Matéria Icon_minitimeDim 11 Avr 2010 - 11:25

La seconde partie :

Code:

#==============================================================================
# ** Game_Party
#==============================================================================
class Game_Party < Game_Unit
  #--------------------------------------------------------------------------
  attr_accessor  :materia
  #--------------------------------------------------------------------------
  alias seph_materiasystem_gameparty_init initialize
  alias seph_materiasystem_gameparty_gaingold gain_gold
  #--------------------------------------------------------------------------
  def initialize
    seph_materiasystem_gameparty_init
    @materia = []
  end
  #--------------------------------------------------------------------------
  def gain_materia(materia_index)
    @materia << $data_materia[materia_index].dup
  end
  #--------------------------------------------------------------------------
  def gain_gold(n)
    gil_plus = 0
    for actor in $game_party.members
      for materia in actor.weapon_materia + actor.armor1_materia + actor.armor2_materia + actor.armor3_materia + actor.armor4_materia
        unless materia.nil?
          if materia.special_effect == 'Gil Plus'
            gil_plus += (materia.level * 5)
          end
        end
      end
    end
    n *= (100 + gil_plus) / 100
    seph_materiasystem_gameparty_gaingold(n.to_i)
  end
end

#==============================================================================
# ** Window_MateriaBio
#==============================================================================
class Window_MateriaBio < Window_Base
  #--------------------------------------------------------------------------
  def initialize
    super(256, 112, 288, 304)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.visible = false
  end
  #--------------------------------------------------------------------------
  def refresh(materia)
    self.contents.clear
    return if materia.nil?
    hue = materia.get_hue
    begin
      bitmap = Cache.icon(materia.name + "_m").dup
    rescue
      bitmap = Cache.icon(Materia_Config::Default_Icon).dup
      bitmap.hue_change(hue)
    end
    self.contents.blt(0, 0, bitmap, Rect.new(0, 0, 24, 24))
    self.contents.font.size = 22
    self.contents.font.color = normal_color
    self.contents.font.bold = false
    self.contents.draw_text(28, 0, contents.width, 24, materia.name)
    bitmap = Cache.icon(Materia_Config::Materia_Level).dup
    bitmap.hue_change(hue)
    star_x = contents.width / 2 - 144
    materia.level.times do
      self.contents.blt(star_x += 24, 22, bitmap, Rect.new(0, 0, 24, 24))
    end
    (materia.exp_levels.size + 1 - materia.level).times do
      self.contents.blt(star_x += 24, 22, bitmap, Rect.new(0, 0, 24, 24), 100)
    end
    self.contents.font.size = 14
    self.contents.font.bold = true
    self.contents.font.color = system_color
    self.contents.draw_text(142, 44, 172, 16, 'Level:')
    self.contents.draw_text(142, 92, 172, 16, 'Next Level:')
    self.contents.draw_text(142, 60, 172, 16, Materia_Config::AP_Total)
    self.contents.draw_text(0, 44 , contents.width, 16, 'Skills:')
    self.contents.font.color = normal_color
    lev = materia.level == materia.exp_levels.size + 1 ? Materia_Config::Master_Text : materia.level.to_s
    self.contents.draw_text(196, 44, 172, 16, lev)
    self.contents.draw_text(82, 76, 172, 16, materia.experience.to_s, 2)
    nxt = lev == Materia_Config::Master_Text ? '----------' : materia.exp_levels[materia.level - 1] - materia.experience
    self.contents.draw_text(82, 108, 172, 16, nxt.to_s, 2)
    materia_y = 18
    for i in 0...(materia.level)
      self.contents.font.color.alpha = 255
      unless materia.skills[i].nil?
        self.contents.draw_text(16, 44 + materia_y, 112, 16, $data_skills[materia.skills[i]].name)
        materia_y += 14
      end
    end
    for i in (materia.level)...materia.skills.size
      self.contents.font.color.alpha = 128
      unless materia.skills[i].nil?
        self.contents.draw_text(16, 44 + materia_y, 112, 16, $data_skills[materia.skills[i]].name)
        materia_y += 14
      end
    end
    if materia.skills.size == 0
      self.contents.draw_text(8, 52, contents.width / 2 - 8, 24, '')
    end
    self.contents.font.color = normal_color
    self.contents.font.color.alpha = 255
    se = materia.special_effect.nil? ? '----------' : materia.special_effect
    self.contents.draw_text(0, 140, self.width - 48, 16, "Special Effect: ")
    txt_width = self.contents.text_size("Special Effect: ").width
    self.contents.draw_text(txt_width, 140, self.width - (48 + txt_width), 16, se)
    self.contents.font.bold = true
    self.contents.font.size = 12
    self.contents.draw_text(0, 158, 160, 16, "Buy:#{materia.new_value}")
    self.contents.draw_text(92, 158, 160, 16, "Sell:#{materia.base_sell_value}")
    self.contents.draw_text(172, 158, 160, 16, Materia_Config::Master_Text + ":#{materia.master_value}")
    self.contents.font.color = system_color
    base_y = 172
    self.contents.draw_text(0, base_y, contents.width / 2, 14, 'Status:')
    self.contents.font.color = normal_color
    stat_names = [Vocab::hp, Vocab::mp, Vocab::atk,Vocab::def, Vocab::spi, Vocab::agi]
    for i in 0...materia.stat_effects.size
      self.contents.draw_text(0,  base_y + (i + 1) * 14, contents.width / 2, 14, stat_names[i])
      self.contents.draw_text(- 8,  base_y + (i + 1)  * 14, contents.width / 2, 14, "#{materia.stat_effects[i]} %", 2)
    end
    x, y = contents.width / 2 + 4,  base_y
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, contents.width / 2, 14, 'Elements/Effects:')
    self.contents.font.color = normal_color
    if materia.elements.size + materia.states.size == 0
      self.contents.draw_text(x + 4, y + 14, contents.width / 2, 14, '')
    else
      total = 1
      for i in 0...materia.elements.size
        total += 1
        ox = 4 + total % 2 * (contents.width / 4)
        oy = total / 2 * 14
        self.contents.draw_text(x + ox, y + oy, contents.width / 2, 14, $data_system.elements[materia.elements[i]])
      end
      for i in 0...materia.states.size
        total += 1
        ox = 4 + total % 2 * (contents.width / 4)
        oy = total / 2 * 14
        self.contents.draw_text(x + ox, y + oy, contents.width / 2, 14, $data_states[materia.states[i]].name)
      end
    end
  end
end

#==============================================================================
# ** Window_MateriaList
#==============================================================================
class Window_MateriaList < Window_Selectable
  #--------------------------------------------------------------------------
  def initialize(width, height, buying, materia_list = nil, show_cost = true)
    super(0, 112, width, height)
    self.visible = self.active = false
    if buying
      @materia = []
      for index in materia_list
        for materia in $data_materia
          @materia << materia if index == materia.id
        end
      end
    else
      @materia = $game_party.materia
    end
    @buying, @show_cost = buying, show_cost
    refresh
    self.index = 0
  end
  #--------------------------------------------------------------------------
  def materia
    return @materia[self.index]
  end
  #--------------------------------------------------------------------------
  def refresh
    @materia.sort! {|a, b| a.id <=> b.id}
    @item_max = @materia.size
    self.contents.clear if self.contents != nil
    if @item_max > 0
      self.contents = Bitmap.new(width - 32, row_max * 24)
      for i in 0...@item_max
        draw_item(i)
      end
    end
  end
  #--------------------------------------------------------------------------
  def draw_item(index)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    materia = @materia[index]
    hue = materia.get_hue
    begin
      bitmap = Cache.icon(materia.name + "_m").dup
    rescue
      bitmap = Cache.icon(Materia_Config::Default_Icon).dup
      bitmap.hue_change(hue)
    end
    self.contents.blt(0, index * 24, bitmap, Rect.new(0, 0, 24, 24))
    self.contents.font.color.alpha = materia.buy_value <= $game_party.gold ? 255 : 128 if @buying
    self.contents.draw_text(28, index * 24 - 4, 128, 32, materia.name)
    if @show_cost
      value = @buying ? materia.buy_value : materia.sell_value
      self.contents.draw_text(148, index * 24 - 4, 72, 32, ":#{value}", 2)
    end
  end
end

#==============================================================================
# ** Window_MateriaActor
#==============================================================================
class Window_MateriaStatus < Window_Base
  #--------------------------------------------------------------------------
  def initialize(actor)
    super(0, 0, 544, 140)
    self.contents = Bitmap.new(width - 32, height - 32)
    @actor = actor
    @frame = 0
    refresh
  end
  #--------------------------------------------------------------------------
  def refresh(actor = @actor)
    self.contents.clear
    draw_face_materia(actor.face_name, actor.face_index, 4, 4)
    draw_actor_name(actor, 4, 0)
    draw_actor_level(actor, 4, 24)
    draw_actor_hp(actor, 4, 52)
    draw_actor_mp(actor, 4, 80)
  end
  #--------------------------------------------------------------------------
  def update
    super
  end
end

#==============================================================================
# ** Window_MateriaActor
#==============================================================================
class Window_MateriaActor < Window_Base
  #--------------------------------------------------------------------------
  def initialize(actor)
    super(0, -6, 544, 152)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    @actor = actor
    @frame = 0
    refresh
  end
  #--------------------------------------------------------------------------
  def refresh(actor = @actor)
    self.contents.clear
    draw_actor_equipment
    draw_actor_materia
  end
  #--------------------------------------------------------------------------
  def draw_actor_equipment
    base_x = 132
    draw_equipment(base_x, 0, $data_weapons[@actor.weapon_id], 0)
    if @actor.two_swords_style
      draw_equipment(base_x, 24, $data_weapons[@actor.armor1_id], 1)
    else
      draw_equipment(base_x, 24, $data_armors[@actor.armor1_id], 1)
    end
    draw_equipment(base_x, 48, $data_armors[@actor.armor2_id], 2)
    draw_equipment(base_x, 72, $data_armors[@actor.armor3_id], 3)
    draw_equipment(base_x, 96, $data_armors[@actor.armor4_id], 4)
  end
  #--------------------------------------------------------------------------
  def draw_actor_materia
    base_x = 316
    self.contents.fill_rect(base_x, 0, 192, 120, Color.new(0, 0, 0, 0))
    for i in 0..4
      self.contents.fill_rect(base_x, i * 24 + 2, 192, 22, Color.new(0, 0, 0, 50))
    end
    for i in 0..4
      slots_x, y = base_x - 24, i * 24
      if i == 0
        if @actor.weapon_id == 0
          p_times, s_times = 0, 0
        else
          p_times = $data_weapons[@actor.weapon_id].paired_materia
          s_times = $data_weapons[@actor.weapon_id].single_materia
        end
      else
        if (eval "@actor.armor#{i}_id") == 0
          p_times, s_times = 0, 0
        else
          p_times = eval "$data_armors[@actor.armor#{i}_id].paired_materia"
          s_times = eval "$data_armors[@actor.armor#{i}_id].single_materia"
        end
      end
      p_times.times do
        bitmap = Cache.icon(Materia_Config::Paired_Slot_Left)
        self.contents.blt(slots_x += 24, y, bitmap, Rect.new(0, 0, 24, 24))
        bitmap = Cache.icon(Materia_Config::Paired_Slot_Right)
        self.contents.blt(slots_x += 24, y, bitmap, Rect.new(0, 0, 24, 24))
      end
      s_times.times do
        bitmap = Cache.icon(Materia_Config::Single_Slot)
        self.contents.blt(slots_x += 24, y, bitmap, Rect.new(0, 0, 24, 24))
      end
    end
    for i in 0...@actor.weapon_materia.size
      materia = @actor.weapon_materia[i]
      unless materia.nil?
        hue = materia.get_hue
        begin
          bitmap = Cache.icon(materia.name + "_m").dup
        rescue
          bitmap = Cache.icon(Materia_Config::Default_Icon).dup
          bitmap.hue_change(hue)
        end
        self.contents.blt(base_x + i * 24, 0, bitmap, Rect.new(0, 0, 24, 24))
      end
    end
    for h in 1..4
      size = eval "@actor.armor#{h}_materia.size"
      for i in 0...size
        list = eval "@actor.armor#{h}_materia"
        materia = list[i]
        unless materia.nil?
          hue = materia.get_hue
          begin
            bitmap = Cache.icon(materia.name + "_m").dup
          rescue
            bitmap = Cache.icon(Materia_Config::Default_Icon).dup
            bitmap.hue_change(hue)
          end
          self.contents.blt(base_x + i * 24, 24 * h, bitmap, Rect.new(0, 0, 24, 24))
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  def update
    super
  end
  #--------------------------------------------------------------------------
  def draw_equipment(x, y, item, type)
    if item.nil?
      case type
      when 0 
        bitmap = Materia_Config::Empty_Weapon
      when 1
        if @actor.two_swords_style
          bitmap = Materia_Config::Empty_Weapon
        else
          bitmap = Materia_Config::Empty_Armor1
        end
      when 2
        bitmap = Materia_Config::Empty_Armor2
      when 3
        bitmap = Materia_Config::Empty_Armor3
      when 4
        bitmap = Materia_Config::Empty_Armor4
      end
      text, enabled = Materia_Config::Empty_Message, false
    else
      bitmap = item.icon_index
      text, enabled = item.name, true
    end
    draw_icon(bitmap, x, y, enabled)
    self.contents.font.color = normal_color
    self.contents.font.color.alpha = enabled ? 255 : 128
    self.contents.draw_text(x + 24, y, 160, 24, text, 1)
  end
end

#==============================================================================
# ** Window_MateriaEquipBio
#==============================================================================
class Window_MateriaEquipBio < Window_Base
  #--------------------------------------------------------------------------
  def initialize
    super(0, 140, 352, 276)
    self.contents = Bitmap.new(width - 32, height - 32)
  end
  #--------------------------------------------------------------------------
  def refresh(materia)
    self.contents.clear
    return if materia.nil?
    hue = materia.get_hue
    begin
      bitmap = Cache.icon(materia.name + "_m").dup
    rescue
      bitmap = Cache.icon(Materia_Config::Default_Icon).dup
      bitmap.hue_change(hue)
    end
    self.contents.blt(0, 0, bitmap, Rect.new(0, 0, 24, 24))
    self.contents.font.color = normal_color
    self.contents.font.size = 22
    self.contents.font.bold = false
    self.contents.draw_text(32, 0, contents.width, 24, materia.name)
    bitmap = Cache.icon(Materia_Config::Materia_Level).dup
    bitmap.hue_change(hue)
    star_x = contents.width / 2 - 180
    materia.level.times do
      self.contents.blt(star_x += 24, 22, bitmap, Rect.new(0, 0, 24, 24))
    end
    (materia.exp_levels.size + 1 - materia.level).times do
      self.contents.blt(star_x += 24, 22, bitmap, Rect.new(0, 0, 24, 24), 100)
    end
    self.contents.font.size = 14
    self.contents.font.bold = true
    self.contents.font.color = system_color
    self.contents.draw_text(164, 44, 172, 16, 'Level:')
    self.contents.draw_text(164, 92, 172, 16, 'Next Level:')
    self.contents.draw_text(164, 60, 172, 16, Materia_Config::AP_Total)
    self.contents.draw_text(4, 44, contents.width, 16, 'Skills:')
    self.contents.font.color = normal_color
    materia_y = 18
    for i in 0...(materia.level)
      self.contents.font.color.alpha = 255
      unless materia.skills[i].nil?
        self.contents.draw_text(16, 44 + materia_y, 128, 16, $data_skills[materia.skills[i]].name)
        materia_y += 14
      end
    end
    for i in (materia.level)...materia.skills.size
      self.contents.font.color.alpha = 128
      unless materia.skills[i].nil?
        self.contents.draw_text(16, 44 + materia_y, 128, 16, $data_skills[materia.skills[i]].name)
        materia_y += 14
      end
    end
    self.contents.font.color = normal_color
    lev = materia.level == materia.exp_levels.size + 1 ? Materia_Config::Master_Text : materia.level.to_s
    self.contents.draw_text(216, 44, 172, 16, lev)
    self.contents.draw_text(102, 76, 172, 16, materia.experience.to_s, 2)
    nxt = lev == Materia_Config::Master_Text ? '----------' : materia.exp_levels[materia.level - 1] - materia.experience
    self.contents.draw_text(102,108, 172, 16, nxt.to_s, 2)
    self.contents.font.color = normal_color
    self.contents.font.color.alpha = 255
    se = materia.special_effect.nil? ? '----------' : materia.special_effect
    self.contents.draw_text(4, 132, self.width - 48, 16, "Special Effect: ")
    txt_width = self.contents.text_size("Special Effect: ").width
    self.contents.draw_text(txt_width, 132, self.width - (48 + txt_width), 16, se)   
    self.contents.font.bold = true
    self.contents.font.size = 12
    self.contents.font.color = system_color
    base_y = 146
    self.contents.draw_text(4, base_y, contents.width / 2, 16, 'Status:')
    stat_names = [Vocab::hp, Vocab::mp, Vocab::atk,Vocab::def, Vocab::spi, Vocab::agi]
    self.contents.font.color = normal_color
    for i in 0...materia.stat_effects.size
      self.contents.draw_text(4, base_y + (i + 1) * 14, contents.width / 2, 16, stat_names[i])
      self.contents.draw_text(- 8, base_y + (i + 1)  * 14, contents.width / 2, 16, "#{materia.stat_effects[i]} %", 2)
    end
    x, y = contents.width / 2 + 4, base_y
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, contents.width / 2, 16, 'Elements/Effects')
    self.contents.font.color = normal_color
    if materia.elements.size + materia.states.size == 0
      self.contents.draw_text(x + 4, y + 14, contents.width / 2, 16, '')
    else
      total = 1
      for i in 0...materia.elements.size
        total += 1
        ox = 4 + total % 2 * (contents.width / 4)
        oy = total / 2 * 16
        self.contents.draw_text(x + ox, y + oy, contents.width / 2, 16, $data_system.elements[materia.elements[i]])
      end
      for i in 0...materia.states.size
        total += 1
        ox = 4 + total % 2 * (contents.width / 4)
        oy = total / 2 * 16
        self.contents.draw_text(x + ox, y + oy, contents.width / 2, 16, $data_states[materia.states[i]].name)
      end
    end
  end
end

#==============================================================================
# ** Window_BattleResult
#==============================================================================
class Window_BattleResult < Window_Base
  #------------------------------------------------------------------------------
  def initialize(exp, gold, treasures, ap=0)
    @ap = ap
    @exp = exp
    @gold = gold
    @treasures = treasures
    super(140, 0, 360, @treasures.size * 32 + 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $fontface
    self.contents.font.size = $fontsize
    self.y = 160 - height / 2
    self.back_opacity = 160
    self.visible = false
    refresh
  end
  #------------------------------------------------------------------------------
  def refresh
    self.contents.clear
    x = 4
    self.contents.font.color = normal_color
    cx = contents.text_size(@exp.to_s).width
    self.contents.draw_text(x, 0, cx, 32, @exp.to_s)
    x += cx + 4
    self.contents.font.color = system_color
    cx = contents.text_size("EXP").width
    self.contents.draw_text(x, 0, 64, 32, "EXP")
    x += cx + 16
    self.contents.font.color = normal_color
    cx = contents.text_size(@gold.to_s).width
    self.contents.draw_text(x, 0, cx, 32, @gold.to_s)
    x += cx + 4
    self.contents.font.color = system_color
    self.contents.draw_text(x, 0, 128, 32, $data_system.words.gold)
    x += cx + 16
    self.contents.font.color = normal_color
    cx = contents.text_size(@ap.to_s).width
    self.contents.draw_text(x, 0, cx, 32, @ap.to_s)
    x += cx + 4
    self.contents.font.color = system_color
    cx = contents.text_size(Materia_Config::AP_Name).width
    self.contents.draw_text(x, 0, 64, 32, Materia_Config::AP_Name)
    y = 32
    for item in @treasures
      draw_item_name(item, 4, y)
      y += 32
    end
  end
end

#==============================================================================
# ** Interpreter
#==============================================================================
class Game_Interpreter
  #------------------------------------------------------------------------------
  def command_319
    actor = $game_actors[@params[0]]
    actor.check_old_equip
    if actor != nil
      actor.change_equip_by_id(@params[1], @params[2])
    end
    actor.check_equip_change
    return true
  end
end

#==============================================================================
# ** Scene_Title
#==============================================================================
class Scene_Title
  #--------------------------------------------------------------------------
  include Materia_Config
  #--------------------------------------------------------------------------
  alias seph_materiasystem_scenetitle_main main
  alias seph_materiasystem_scenetitle_newgame command_new_game
  alias seph_materiasystem_scenetitle_continue command_continue
  #--------------------------------------------------------------------------
  def main
    seph_materiasystem_scenetitle_main
    materias = Materia_System.new
    $data_materia = materias.set_up_materias
  end
  #--------------------------------------------------------------------------
  def command_new_game
    materias = Materia_System.new
    $data_materia = materias.set_up_materias
    for i in 1...$data_weapons.size
      if WEAPON_MATERIA_SLOTS[i] != nil
        $data_weapons[i].set_materia_slots(WEAPON_MATERIA_SLOTS[i])
      else
        $data_weapons[i].set_materia_slots([0,0])
      end
    end
    for i in 1...$data_armors.size
      if ARMORS_MATERIA_SLOTS[i] != nil
        $data_armors[i].set_materia_slots(ARMORS_MATERIA_SLOTS[i])
      else
        $data_armors[i].set_materia_slots([0,0])
      end
    end
    seph_materiasystem_scenetitle_newgame
  end
  #--------------------------------------------------------------------------
  def command_continue
    materias = Materia_System.new
    $data_materia = materias.set_up_materias
    for i in 1...$data_weapons.size
      if WEAPON_MATERIA_SLOTS[i] != nil
        $data_weapons[i].set_materia_slots(WEAPON_MATERIA_SLOTS[i])
      else
        $data_weapons[i].set_materia_slots([0,0])
      end
    end
    for i in 1...$data_armors.size
      if ARMORS_MATERIA_SLOTS[i] != nil
        $data_armors[i].set_materia_slots(ARMORS_MATERIA_SLOTS[i])
      else
        $data_armors[i].set_materia_slots([0,0])
      end
    end
    seph_materiasystem_scenetitle_continue
  end
end

#==============================================================================
# ** Scene_Equip
#==============================================================================
class Scene_Equip
  #------------------------------------------------------------------------------
  alias  seph_materiasystem_sceneequip_main main
  def main
    @actor = $game_party.members[@actor_index]
    @actor.check_old_equip
    seph_materiasystem_sceneequip_main
    @actor.check_equip_change
  end
end

#==============================================================================
# ** Scene_MateriaShop
#==============================================================================
class Scene_MateriaShop < Scene_Base
  #--------------------------------------------------------------------------
  def initialize(materia_avialable = [])
    @materia_avialable = materia_avialable
  end
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background
    create_command_window
    @help_window = Window_Help.new
    @help_window.set_text(Materia_Config::Shop_Message)
    @gold_window = Window_Gold.new(384, 56)
    @dummy_window = Window_Base.new(0, 112, 544, 304)
    @buy_items = Window_MateriaList.new(256, 304, true, @materia_avialable)
    @sell_items = Window_MateriaList.new(256, 304, false)
    @materia_bio = Window_MateriaBio.new
    @objects = [@help_window, @shop_options_window, @gold_window, @buy_items, @sell_items, @dummy_window, @materia_bio]
  end
  #--------------------------------------------------------------------------
  def terminate
    super
    @objects.each {|x| x.dispose}
  end
  #--------------------------------------------------------------------------
  def update
    super
    @objects.each {|x| x.update}
    if @shop_options_window.active
      update_shop_commands
    elsif @buy_items.active
      update_buy_materia
    elsif @sell_items.active
      update_sell_materia
    end
  end
  #--------------------------------------------------------------------------
  def create_command_window
    s1 = Vocab::ShopBuy
    s2 = Vocab::ShopSell
    s3 = Vocab::ShopCancel
    @shop_options_window = Window_Command.new(384, [s1, s2, s3], 3)
    @shop_options_window .y = 56
  end
  #--------------------------------------------------------------------------
  def update_shop_commands
    @help_window.set_text(Materia_Config::Shop_Message)
    if Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = Scene_Map.new
    end
    if Input.trigger?(Input::C)
      Sound.play_decision
      case @shop_options_window.index
      when 0
        @shop_options_window.active = false
        @dummy_window.visible = false
        @materia_bio.visible = true
        @materia_bio.refresh(@buy_items.materia)
        @buy_items.visible = @buy_items.active = true
      when 1
        @shop_options_window.active = false
        @dummy_window.visible = false
        @materia_bio.visible = true
        @materia_bio.refresh(@sell_items.materia)
        @sell_items.visible = @sell_items.active = true
      when 2
        $scene = Scene_Map.new
      end
    end
  end
  #--------------------------------------------------------------------------
  def update_buy_materia
    @help_window.set_text(Materia_Config::Buy_Message)
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @buy_items.visible = @buy_items.active = false
      @buy_items.index = 0
      @materia_bio.visible = false
      @shop_options_window.active = true
      @dummy_window.visible = true
    end
    if Input.trigger?(Input::C)
      materia = @buy_items.materia
      if $game_party.gold < materia.buy_value
        Sound.play_buzzer
        return
      end
      Sound.play_shop
      $game_party.gain_materia(materia.id)
      $game_party.lose_gold(materia.buy_value)
      @gold_window.refresh
      @buy_items.refresh
      @sell_items.refresh
      @materia_bio.refresh(@buy_items.materia)
    end
    if Input.trigger?(Input::UP) || Input.trigger?(Input::DOWN) ||
      Input.press?(Input::UP) || Input.press?(Input::DOWN) ||
      Input.trigger?(Input::R) || Input.trigger?(Input::L) ||
      Input.press?(Input::R) || Input.press?(Input::L)
      @materia_bio.refresh(@buy_items.materia)
    end
  end
  #--------------------------------------------------------------------------
  def update_sell_materia
    @help_window.set_text(Materia_Config::Sell_Message)
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @sell_items.visible = @sell_items.active = false
      @sell_items.index = 0
      @materia_bio.visible = false
      @shop_options_window.active = true
      @dummy_window.visible = true
    end
    if Input.trigger?(Input::C)
      if @sell_items.materia.nil?
        Sound.play_buzzer
        return
      end
      Sound.play_shop
      $game_party.gain_gold(@sell_items.materia.sell_value)
      @gold_window.refresh
      $game_party.materia.delete_at(@sell_items.index)
      @sell_items.refresh
      @sell_items.index = 0
      @materia_bio.refresh(@sell_items.materia)
    end
    if Input.trigger?(Input::UP) || Input.trigger?(Input::DOWN) ||
      Input.press?(Input::UP) || Input.press?(Input::DOWN) ||
      Input.trigger?(Input::R) || Input.trigger?(Input::L) ||
      Input.press?(Input::R) || Input.press?(Input::L)
      @materia_bio.refresh(@sell_items.materia)
    end
  end
end

#==============================================================================
# ** Scene_MateriaEquip
#==============================================================================
class Scene_MateriaEquip < Scene_Base
  #--------------------------------------------------------------------------
  def initialize(actor_index = 0, equip_index = 0)
    @actor_index = actor_index
    @equip_index = equip_index
    @materia_index = 0
    @actor = $game_party.members[@actor_index]
  end
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background
    @status_bio_window = Window_MateriaStatus.new(@actor)
    @character_bio_window = Window_MateriaActor.new(@actor)
    @materia_bio_window = Window_MateriaEquipBio.new
    @materia_list_window = Window_MateriaList.new(192, 276, false, $game_party.materia, false)
    @materia_list_window.x, @materia_list_window.y = 352, 140
    @materia_list_window.visible = true
    @materia_bio_window.z = @materia_list_window.z = 1000
    @pointer_sprite = Sprite.new
    @pointer_sprite.x = 316 + (@materia_index + 1) * 24 - 28
    @pointer_sprite.y = @equip_index * 24 + 12
    @pointer_sprite.z = 9999
    @pointer_sprite.bitmap = Cache.icon(Materia_Config::Materia_Cursor)
    @materia_list_window.refresh
    update_materia_bio
    @objects = [@status_bio_window, @character_bio_window, @materia_bio_window, @materia_list_window, @pointer_sprite]
  end
  #--------------------------------------------------------------------------
  def terminate
    super
    @objects.each {|x| x.dispose}
  end
  #--------------------------------------------------------------------------
  def update
    super
    @objects.each {|x| x.update}
    !@materia_list_window.active ? update_weapon_select : update_materia_select
  end
  #--------------------------------------------------------------------------
  def return_scene
    $scene = Scene_Menu.new(4)
  end
  #--------------------------------------------------------------------------
  def update_weapon_select
    @pointer_sprite.x = 316 + (@materia_index + 1) * 24 - 28
    @pointer_sprite.y = @equip_index * 24 + 12
    if Input.trigger?(Input::UP)
      Sound.play_cursor
      @equip_index = @equip_index == 0 ? @equip_index = 4 : @equip_index -= 1
      case @equip_index
      when 0
        max = [@actor.weapon_materia.size - 1, 0].max
      when 1
        max = [@actor.armor1_materia.size - 1, 0].max
      when 2
        max = [@actor.armor2_materia.size - 1, 0].max
      when 3
        max = [@actor.armor3_materia.size - 1, 0].max
      when 4
        max = [@actor.armor4_materia.size - 1, 0].max
      end
      @materia_index = [@materia_index, max].min
      update_materia_bio
    end
    if Input.trigger?(Input::DOWN)
      Sound.play_cursor
      @equip_index = @equip_index == 4 ? @equip_index = 0 : @equip_index += 1
      case @equip_index
      when 0
        max = [@actor.weapon_materia.size - 1, 0].max
      when 1
        max = [@actor.armor1_materia.size - 1, 0].max
      when 2
        max = [@actor.armor2_materia.size - 1, 0].max
      when 3
        max = [@actor.armor3_materia.size - 1, 0].max
      when 4
        max = [@actor.armor4_materia.size - 1, 0].max
      end
      @materia_index = [@materia_index, max].min
      update_materia_bio
    end
    if Input.trigger?(Input::RIGHT)
      Sound.play_cursor
      case @equip_index
      when 0
        max = @actor.weapon_materia.size
      when 1
        max = @actor.armor1_materia.size
      when 2
        max = @actor.armor2_materia.size
      when 3
        max = @actor.armor3_materia.size
      when 4
        max = @actor.armor4_materia.size
      end
      return if max == 0
      @materia_index = @materia_index == max - 1 ? @materia_index = 0 : @materia_index += 1
      update_materia_bio
    end
    if Input.trigger?(Input::LEFT)
      Sound.play_cursor
      case @equip_index
      when 0
        max = @actor.weapon_materia.size
      when 1
        max = @actor.armor1_materia.size
      when 2
        max = @actor.armor2_materia.size
      when 3
        max = @actor.armor3_materia.size
      when 4
        max = @actor.armor4_materia.size
      end
      return if max == 0
      @materia_index = @materia_index == 0 ? @materia_index = max - 1 : @materia_index -= 1
      update_materia_bio
    end
    if Input.trigger?(Input::L)
      @actor_index = @actor_index == 0 ?
        @actor_index = $game_party.members.size - 1 : @actor_index -= 1
      $scene = Scene_MateriaEquip.new(@actor_index, @equip_index)
    end
    if Input.trigger?(Input::R)
      @materia_list_window.refresh
      @actor_index = @actor_index == $game_party.members.size - 1 ?
        @actor_index =  0: @actor_index += 1
      $scene = Scene_MateriaEquip.new(@actor_index, @equip_index)
    end
    if Input.trigger?(Input::A)
      Sound.play_equip
      @actor.unequip_materia(@equip_index, @materia_index)
      @materia_list_window.refresh
      @status_bio_window.refresh
      @character_bio_window.draw_actor_materia
      update_materia_bio
    end
    if Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
    end
    if Input.trigger?(Input::C)
      case @equip_index
      when 0
        max = @actor.weapon_materia.size
      when 1
        max = @actor.armor1_materia.size
      when 2
        max = @actor.armor2_materia.size
      when 3
        max = @actor.armor3_materia.size
      when 4
        max = @actor.armor4_materia.size
      end
      if max == 0
        Sound.play_buzzer
        return
      else
        Sound.play_decision
        @materia_list_window.active = true
        update_materia_bio
      end
    end
  end
  #--------------------------------------------------------------------------
  def update_materia_select
    if Input.trigger?(Input::B)
      Sound.play_cancel
      @materia_list_window.active = false
      update_materia_bio
    end
    if Input.trigger?(Input::C)
      if @materia_list_window.materia.nil?
        Sound.play_buzzer
        return
      end
      Sound.play_equip
      @actor.equip_materia(@equip_index, @materia_index,
        @materia_list_window.index)
      @materia_list_window.refresh
      @status_bio_window.refresh
      @character_bio_window.draw_actor_materia
      @materia_list_window.active = false
    end
    if Input.trigger?(Input::UP) || Input.trigger?(Input::DOWN) ||
      Input.press?(Input::UP) || Input.press?(Input::DOWN) ||
      Input.trigger?(Input::R) || Input.trigger?(Input::L) ||
      Input.press?(Input::R) || Input.press?(Input::L)
      update_materia_bio
    end
  end
  #--------------------------------------------------------------------------
  def update_materia_bio
    if @materia_list_window.active
      @materia_bio_window.refresh(@materia_list_window.materia)
    else
      case @equip_index
      when 0
        item = @actor.weapon_materia
      when 1
        item = @actor.armor1_materia
      when 2
        item = @actor.armor2_materia
      when 3
        item = @actor.armor3_materia
      when 4
        item = @actor.armor4_materia
      end
      @materia_bio_window.refresh(item[@materia_index])
    end
  end
end

#==============================================================================
# ** Scene_Battle
#==============================================================================
class Scene_Battle
  #------------------------------------------------------------------------------
  alias seph_materiasystem_scenebattle_determineskill determine_skill
  def determine_skill
    paired_materia_set = @active_battler.return_paired_materia
    for paired_set in paired_materia_set
      materia = paired_set[2]
      other_materia = paired_set[3]
      if materia.special_effect == 'All'
        for skill_id in other_materia.skills
          if skill_id == @skill.id and !@skill.element_set.include?(Materia_Config::Negate_All_ID)
            @active_battler.action.set_skill(@skill.id)
            @skill_window.active = false
            end_skill_selection
            next_actor
            return
          end
        end
      end
    end
    seph_materiasystem_scenebattle_determineskill
  end
  #------------------------------------------------------------------------------
  def display_exp_and_gold
    ap = 0
    for enemy in $game_troop.members
      ap += enemy.ap
    end
    exp = $game_troop.exp_total
    gold = $game_troop.gold_total
    $game_party.gain_gold(gold)
    for actor in $game_party.existing_members
      actor.ap =+ ap
    end
    text = sprintf(Vocab::Victory, $game_party.name)
    $game_message.texts.push('\|' + text)
    if exp > 0
      text = sprintf(Vocab::ObtainExp, exp)
      $game_message.texts.push('\.' + text)
    end
    if ap > 0
      text = sprintf("Gained %s Ap!", ap)
      $game_message.texts.push('\.' + text)
    end
    if gold > 0
      text = sprintf(Vocab::ObtainGold, gold, Vocab::gold)
      $game_message.texts.push('\.' + text)
    end
    wait_for_message
  end
  #------------------------------------------------------------------------------
  def process_escape
    @info_viewport.visible = false
    @message_window.visible = true
    text = sprintf(Vocab::EscapeStart, $game_party.name)
    $game_message.texts.push(text)
    escapeplus = 0
    for actor in $game_party.members
      escapeplus += actor.escapeplus if actor.exist?
    end
    if $game_troop.preemptive
      success = true
    else
      success = (rand(100) < @escape_ratio + escapeplus)
    end
    Sound.play_escape
    if success
      wait_for_message
      battle_end(1)
    else
      @escape_ratio += 10
      $game_message.texts.push('\.' + Vocab::EscapeFailure)
      wait_for_message
      $game_party.clear_actions
      start_main
    end
  end
end

#==============================================================================
# Scene_Menu
#==============================================================================
class Scene_Menu < Scene_Base
  #--------------------------------------------------------------------------
  def create_command_window
    s1 = Vocab::item
    s2 = Vocab::skill
    s3 = Vocab::equip
    s4 = Vocab::status
    s5 = "Materia"
    s6 = Vocab::save
    s7 = Vocab::game_end
    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
    @command_window.index = @menu_index
    if $game_party.members.size == 0
      @command_window.draw_item(0, false)
      @command_window.draw_item(1, false)
      @command_window.draw_item(2, false)
      @command_window.draw_item(3, false)
      @command_window.draw_item(4, false)
    end
    if $game_system.save_disabled
      @command_window.draw_item(5, false)
    end
  end
  #--------------------------------------------------------------------------
  def update_command_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = Scene_Map.new
    elsif Input.trigger?(Input::C)
      if $game_party.members.size == 0 and @command_window.index < 4
        Sound.play_buzzer
        return
      elsif $game_system.save_disabled and @command_window.index == 4
        Sound.play_buzzer
        return
      end
      Sound.play_decision
      case @command_window.index
      when 0
        $scene = Scene_Item.new
      when 1,2,3,4
        start_actor_selection
      when 5
        $scene = Scene_File.new(true, false, false)
      when 6
        $scene = Scene_End.new
      end
    end
  end
  #--------------------------------------------------------------------------
  def update_actor_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      end_actor_selection
    elsif Input.trigger?(Input::C)
      $game_party.last_actor_index = @status_window.index
      Sound.play_decision
      case @command_window.index
      when 1
        $scene = Scene_Skill.new(@status_window.index)
      when 2
        $scene = Scene_Equip.new(@status_window.index)
      when 3
        $scene = Scene_Status.new(@status_window.index)
      when 4
        $scene = Scene_MateriaEquip.new(@status_window.index)
      end
    end
  end
end

#==============================================================================
# Scene_File
#==============================================================================
class Scene_File < Scene_Base
  #--------------------------------------------------------------------------
  def return_scene
    if @from_title
      $scene = Scene_Title.new
    elsif @from_event
      $scene = Scene_Map.new
    else
      $scene = Scene_Menu.new(5)
    end
  end
end

#==============================================================================
# Scene_End
#==============================================================================
class Scene_End < Scene_Base
  #--------------------------------------------------------------------------
  def return_scene
    $scene = Scene_Menu.new(6)
  end
end
Revenir en haut Aller en bas
 

[Abandon] Add-on Matéria

Voir le sujet précédent Voir le sujet suivant Revenir en haut 
Page 1 sur 1

 Sujets similaires

-
» [ Abandon] Système de matéria lvl 99= bug
» Problème sur script de matéria
» Problème d'event de quête (Abandon)
» [abandon] Probleme de fleche qui se transforme en carre
» materia systeme

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
RPG Maker VX :: Entraide :: Problèmes et Solutions :: Abandonné-
Créer un forum | ©phpBB | Forum gratuit d'entraide | Signaler un abus | Cookies | Forum gratuit