Materia System (FF:VII)
Страница 1 из 1
Materia System (FF:VII)
- Код:
#==============================================================================
# Materia System (FF:VII)
#==============================================================================
# Original Script from XP by SephirothSpawn
# && Converted for VXa by Atoa
#------------------------------------------------------------------------------
# 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 && pasted)
# So more thanks to Atoa for a great convertion! Yay!
#==============================================================================
=begin
===================================================
Materia Icons
===================================================
You can set individual icons for each materia, the icon must be on the
graphics/system 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"
&& "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, &&
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, && 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",
"Reduce Cost", "EXP plus", "Gil Plus", "Escape Plus", "HP <> MP"
You can also use one of the Parameters, Ex-Parameter or Sp-Parameter such
as MHP, ATK, DEF, HIT, EVA, TRG && all Parameters available on the trait
list using "[param] plus".
Ex: "STR Plus", "HIT Plus", "REC Plus"
===================================================
Gain new Materia
===================================================
Use the Script Call event && 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 && add this code:
$materia_shop_list = [X, Y, Z]
SceneManager.call(Scene_MateriaShop)
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
#==============================================================================
You can set individual icons for each materia, the icon must be on the System
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
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
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")
* status = materia status change. [hp, mp, atk, def, mat, mdf, agi, luk]
* 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, &&
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, && 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",
"Reduce Cost", "EXP plus", "Gil Plus", "Escape Plus", "HP <> MP"
You can also use one of the Parameters, Ex-Parameter or Sp-Parameter such
as MHP, ATK, DEF, HIT, EVA, TRG && all Parameters available on the trait
list using "[param] plus".
Ex: "STR Plus", "HIT Plus", "REC Plus"
Gain new Materia
Use the Script Call event && 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 && 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 skill that ignores special effects
Negate_Absorb = [] # Skills that ignore "HP/MP Absorb" effect
Negate_Turbo = [] # Skills that ignore "MP Turbo" effect
Negate_All = [] # Skills that ignore "All" effec
# 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' # Purchase Materias
Sell_Command = 'Sell Materia' # Sell Materias
Empty_Message = 'None' # Message when unequiped
Master_Text = 'Master' # Max level materia text
AP_Total = 'Total AP:' # AP Name
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
=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 #=#
#=# && #=#
#=# 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 MAT MDF AGI, LUK element Effect AP MasterAP EXP SKILLS
Materia_List << [0, 'Cure', 'Magic', [ -5, 5, -3, 0, 3, 0, 0, 0], [], [], 1000, 10000, [1000, 3000, 6000, 10000], [26,27,28]]
Materia_List << [1, 'Remedy', 'Magic', [ -4, 4, -3, 0, 3, 0, 0, 0], [], [], 750, 5000, [2000, 3000,5000], [31,32]]
Materia_List << [2, 'Fire', 'Magic', [ -3, 3, -1, 0, 1, 0, 0, 0], [9], [], 1000, 7500, [1000, 2000, 3000,5000], [51,53,52,54]]
Materia_List << [3, 'Ice', 'Magic', [ -3, 3, -1, 0, 1, 0, 0, 0], [10], [], 1000, 7500, [1000, 2000, 3000,5000], [63,65,64,66]]
Materia_List << [4, 'Thunder','Magic', [ -3, 3, -1, 0, 1, 0, 0, 0], [11], [], 1000, 7500, [1000, 2000, 3000,5000], [67,69,68,70]]
Materia_List << [5, 'Water', 'Magic', [ -4, 4, -2, 0, 2, 0, 0, 0], [12], [], 1000, 7500, [3000, 8000], [71,72]]
Materia_List << [6, 'Earth', 'Magic', [ -4, 4, -2, 0, 2, 0, 0, 0], [13], [], 1000, 7500, [3000, 8000], [73,74]]
Materia_List << [7, 'Wind', 'Magic', [ -4, 4, -2, 0, 2, 0, 0, 0], [14], [], 1000, 7500, [3000, 8000], [75,76]]
Materia_List << [8, 'Light', 'Magic', [ -4, 4, -2, 0, 2, 0, 0, 0], [15], [], 1000, 7500, [3000, 8000], [77,78]]
Materia_List << [9, 'Darkness','Magic', [ -4, 4, -2, 0, 2, 0, 0, 0], [16], [], 1000, 7500, [3000,8000], [79,80]]
Materia_List << [10,'Ultima', 'Magic', [ -5, 5, -3, 0, 3, 0, 0, 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, 0, 0], [], [2], 750, 4500, [1500, 4500], [15,16]]
Materia_List << [12,'Blind', 'Magic', [ -2, 2, 0, 0, 0, 0, 0, 0], [], [3], 750, 4500, [1500, 4500], [17,18]]
Materia_List << [13,'Silence','Magic', [ -2, 2, 0, 0, 0, 0, 0, 0], [], [4], 750, 4500, [1500, 4500], [19,20]]
Materia_List << [14,'Confusion','Magic', [ -2, 2, 0, 0, 0, 0, 0, 0], [], [5], 750, 4500, [1500, 4500], [21,22]]
Materia_List << [15,'Sono', 'Magic', [ -2, 2, 0, 0, 0, 0, 0, 0], [], [6], 750, 4500, [1500, 4500], [23,24]]
Materia_List << [16,'Paralize','Magic', [ -2, 2, 0, 0, 0, 0, 0, 0], [], [7], 750, 4500, [1500, 4500], [25,26]]
Materia_List << [17,'Weakness','Magic', [ -2, 2, 0, 0, 0, 0, 0, 0], [], [12], 750, 4500, [5000], [53]]
Materia_List << [18,'Tiredness','Magic', [ -2, 2, 0, 0, 0, 0, 0, 0], [], [14], 750, 4500, [5000], [54]]
Materia_List << [19,'Fever', 'Magic', [ -2, 2, 0, 0, 0, 0, 0, 0], [], [15], 750, 4500, [5000], [55]]
Materia_List << [20,'Slow', 'Magic', [ -2, 2, 0, 0, 0, 0, 0, 0], [], [16], 750, 4500, [5000], [56]]
Materia_List << [21,'Strength','Magic', [ -2, 2, 0, 0, 0, 0, 0, 0], [], [9], 750, 4500, [2000,4000], [nil, 49]]
Materia_List << [22,'Protect','Magic', [ -2, 2, 0, 0, 0, 0, 0, 0], [], [10], 750, 4500, [2000,4000], [nil, 50]]
Materia_List << [23,'Spirit', 'Magic', [ -2, 2, 0, 0, 0, 0, 0, 0], [], [11], 750, 4500, [2000,4000], [nil, 51]]
Materia_List << [24,'Speed up','Magic', [ -2, 2, 0, 0, 0, 0, 0, 0], [], [12], 750, 4500, [2000,4000], [nil, 52]]
# Command
Materia_List << [25, 'Dual Combo', 'Command', [0, 0, 5, 3, - 5, - 3, 0, 0, 0], [], [], 3000, 20000, [2500, 5000, 9000, 14000], [2]]
Materia_List << [26, 'Death Blow', 'Command', [2, -2, 4, 4, -6, -2, 0, 0, 0], [], [], 3000, 20000, [2500, 5000, 9000, 14000], [3]]
Materia_List << [27, 'Venomous', 'Command', [4, -2, 6, 4, -8, -4, 0, 0, 0], [], [], 3000, 20000, [2500, 5000, 9000, 14000], [4]]
Materia_List << [28, 'Blindness', 'Command', [0, -2, 2, -2, -2, 8, 0, 0, 0], [], [], 3000, 20000, [2500, 5000, 9000, 14000], [5]]
Materia_List << [29, 'Sleep', 'Command', [-3, 2, -3, -2, 4, 4, 0, 0, 0], [], [], 3000, 20000, [2500, 5000, 9000, 14000], [6]]
Materia_List << [30, 'Shock', 'Command', [-2, 0, 3, -4, 2, 5, 0, 0, 0], [], [], 3000, 20000, [2500, 5000, 9000, 14000], [7]]
# Summon Materia
Materia_List << [31, 'Summon 1', 'Summon', [-10, 10, -5, -5, 0, 10, 0, 0, 0], [], [], 5000, 25000, [6500, 15000, 25000, 50000], [83]]
Materia_List << [32, 'Summon 2', 'Summon', [-10, 10, -5, -5, 0, 10, 0, 0, 0], [], [], 5000, 25000, [6500, 15000, 25000, 50000], [84]]
Materia_List << [33, 'Summon 3', 'Summon', [-10, 10, -5, -5, 0, 10, 0, 0, 0], [], [], 5000, 25000, [6500, 15000, 25000, 50000], [85]]
# Support Materia
Materia_List << [34, 'All', 'Support', [0, 0, 0, 0, 0, 0, 0, 0], [], [], 2000, 10000, [2000, 4000, 7000, 11000], [], 'All']
Materia_List << [35, 'Elemental', 'Support', [0, 0, 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, 0, 0], [], [], 2000, 10000, [2000, 4000, 7000, 11000], [], 'Added Effect']
Materia_List << [37, 'Absorb HP', 'Support', [0, 0, 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, 0, 0], [], [], 2000, 10000, [2000, 4000, 7000, 11000], [], 'Absorb MP']
Materia_List << [39, 'MP Turbo', 'Support', [0, 0, 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, 0, 0], [], [], 2000, 10000, [2000, 4000, 7000, 11000], [], 'Reduce Cost']
# Independent Materia
Materia_List << [41, 'Exp Plus', 'Independent', [0, 0, 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, 0, 0], [], [], 2000, 10000, [2000, 4000, 7000, 11000], [], 'Gil Plus']
Materia_List << [43, 'HP Plus', 'Independent', [0, 0, 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, 0, 0], [], [], 2000, 10000, [2000, 4000, 7000, 11000], [], 'MP Plus']
Materia_List << [45, 'ATK Plus', 'Independent', [0, 0, 0, 0, 0, 0, 0, 0], [], [], 2000, 10000, [2000, 4000, 7000, 11000], [], 'ATK Plus']
Materia_List << [46, 'DEF Plus', 'Independent', [0, 0, 0, 0, 0, 0, 0, 0], [], [], 2000, 10000, [2000, 4000, 7000, 11000], [], 'DEF Plus']
Materia_List << [47, 'MAT Plus', 'Independent', [0, 0, 0, 0, 0, 0, 0, 0], [], [], 2000, 10000, [2000, 4000, 7000, 11000], [], 'MAT Plus']
Materia_List << [48, 'MDF Plus', 'Independent', [0, 0, 0, 0, 0, 0, 0, 0], [], [], 2000, 10000, [2000, 4000, 7000, 11000], [], 'MDF Plus']
Materia_List << [49, 'AGI Plus', 'Independent', [0, 0, 0, 0, 0, 0, 0, 0], [], [], 2000, 10000, [2000, 4000, 7000, 11000], [], 'AGI Plus']
Materia_List << [50, 'LUK Plus', 'Independent', [0, 0, 0, 0, 0, 0, 0, 0], [], [], 2000, 10000, [2000, 4000, 7000, 11000], [], 'LUK Plus']
Materia_List << [51, 'HIT Plus', 'Independent', [0, 0, 0, 0, 0, 0, 0, 0], [], [], 2000, 10000, [2000, 4000, 7000, 11000], [], 'HIT Plus']
Materia_List << [52, 'EVA Plus', 'Independent', [0, 0, 0, 0, 0, 0, 0, 0], [], [], 2000, 10000, [2000, 4000, 7000, 11000], [], 'EVA Plus']
Materia_List << [53, 'MEV Plus', 'Independent', [0, 0, 0, 0, 0, 0, 0, 0], [], [], 2000, 10000, [2000, 4000, 7000, 11000], [], 'MEV Plus']
Materia_List << [54, 'Escape Plus', 'Independent', [0, 0, 0, 0, 0, 0, 0, 0], [], [], 2000, 10000, [2000, 4000, 7000, 11000], [], 'Escape Plus']
Materia_List << [55, 'HP <> MP', 'Independent', [0, 0, 0, 0, 0, 0, 0, 0], [], [], 2000, 10000, [2000, 4000, 7000, 11000], [], 'HP <> MP']
end
$imported = {} if $imported.nil?
$imported["Materia_System"] = true
#==============================================================================
# ** RPG::EquipItem
#------------------------------------------------------------------------------
# This is the superclass of weapons && armor.
#==============================================================================
class RPG::EquipItem < RPG::BaseItem
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :paired_materia
attr_accessor :single_materia
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def set_materia_slots(slots)
@paired_materia, @single_materia = slots[0], slots[1]
end
end
#==============================================================================
# ** RPG::UsableItem::Damage
#------------------------------------------------------------------------------
# This is the data class for damage.
#==============================================================================
class RPG::UsableItem::Damage
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :materia_system_eval :eval
def eval(a, b, v)
result = materia_system_eval(a, b, v)
b.materia_damage(a, result)
end
end
#==============================================================================
# ** Materia
#------------------------------------------------------------------------------
# This class handles the materia info.
#==============================================================================
class Materia
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :id
attr_accessor :name
attr_accessor :all
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
reset_all
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def reset_all
@all = level
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' then hue = 130
when 'Command' then hue = 60
when 'Summon' then hue = 10
when 'Support' then hue = 180
when 'Independent' then hue = 300
end
hue
end
end
#==============================================================================
# ** Materia
#------------------------------------------------------------------------------
# This class handles the materia settings
#==============================================================================
class Materia_System
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
attr_accessor :set_up_materias
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def set_up_materias
materias = []
for m in Materia_Config::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
#==============================================================================
# ** BattleManager
#------------------------------------------------------------------------------
# This module manages battle progress.
#==============================================================================
class << BattleManager
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :materia_system_make_escape_ratio :make_escape_ratio
def make_escape_ratio
@escape_ratio = 1.5 - 1.0 * $game_troop.agi / $game_party.agi
for actor in $game_party.battle_members
@escape_ratio *= 1.0 + actor.escapeplus if actor.exist?
end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :materia_system_display_exp :display_exp
def display_exp
materia_system_display_exp
if $game_troop.ap_total > 0
text = sprintf("%s AP received!", $game_troop.ap_total)
$game_message.add('\.' + text)
$game_party.all_members.each {|actor| actor.ap += $game_troop.ap_total }
end
end
end
#==============================================================================
# ** Game_BattlerBase
#------------------------------------------------------------------------------
# This class handles battlers. It's used as a superclass of the Game_Battler
# classes.
#==============================================================================
class Game_BattlerBase
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
include Materia_Config
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def materia_damage(user, damage)
return damage if damage == 0
obj = user.current_action
if user.actor? && obj && obj.is_a?(RPG::Skill)
user.all_materias.compact.each do |materia|
if materia.type == 'Summon' && materia.skills.include?(obj.id)
damage += (damage * materia.level * 0.2).to_i
end
end
user.return_paired_materia.compact.each do |paired_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 || skill_id == nil
m_skill = $data_skills[skill_id]
if obj == m_skill && !Negate_Turbo.include?(obj.id)
damage += (damage * materia.level * 0.2).to_i if damage != 0
end
end
end
end
if materia.special_effect =='Absorb HP'
for skill_id in other_materia.skills
unless skill_id == 0 || skill_id == nil
m_skill = $data_skills[skill_id]
if obj == m_skill && $game_temp.in_battle &&
!Negate_Absorb.include?(obj.id) && damage > 0
drain = materia.level * 2
hp = (damage * drain / 100).to_i
user.hp += [hp, user.maxhp - hp].min
end
end
end
end
if materia.special_effect =='Absorb MP'
for skill_id in other_materia.skills
unless skill_id == 0 || skill_id == nil
m_skill = $data_skills[skill_id]
if obj == m_skill && $game_temp.in_battle &&
!Negate_Absorb.include?(obj.id) && damage > 0
drain = materia.level
mp = (damage * drain / 100).to_i
user.mp += [mp, user.maxmp - mp].min
end
end
end
end
end
end
damage
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :materia_system_skill_mp_cost :skill_mp_cost
def skill_mp_cost(skill)
cost = materia_system_skill_mp_cost(skill)
return cost unless actor?
return_paired_materia.compact.each do |paired_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 || skill_id == nil
m_skill = $data_skills[skill_id]
if skill == m_skill && !Negate_Turbo.include?(skill.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 || 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
p cost
cost
end
end
#==============================================================================
# ** Game_Action
#------------------------------------------------------------------------------
# This class handles battle actions. This class is used within the
# Game_Battler class.
#==============================================================================
class Game_Action
Re: Materia System (FF:VII)
- Код:
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
include Materia_Config
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :materia_system_targets_for_opponents :targets_for_opponents
def targets_for_opponents
if item.is_a?(RPG::Skill) && @subject.actor? && item.for_one?
@subject.return_paired_materia.compact.each do |paired_set|
materia = paired_set[2]
other_materia = paired_set[3]
if materia.special_effect == 'All' && materia.all > 0
for skill_id in other_materia.skills
if skill_id == item.id && !Negate_All.include?(item.id)
materia.all -= 1
return opponents_unit.alive_members
end
end
end
end
end
materia_system_targets_for_opponents
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :materia_system_targets_for_friends :targets_for_friends
def targets_for_friends
if item.is_a?(RPG::Skill) && @subject.actor? && item.for_friend? &&
item.for_one?
@subject.return_paired_materia.compact.each do |paired_set|
materia = paired_set[2]
other_materia = paired_set[3]
if materia.special_effect == 'All' && materia.all > 0
for skill_id in other_materia.skills
if skill_id == item.id && !Negate_All.include?(item.id)
materia.all -= 1
return friends_unit.alive_members
end
end
end
end
end
if item.is_a?(RPG::Skill) && @subject.actor? && item.for_dead_friend? &&
item.for_one?
@subject.return_paired_materia.compact.each do |paired_set|
materia = paired_set[2]
other_materia = paired_set[3]
if materia.special_effect == 'All' && materia.all > 0
for skill_id in other_materia.skills
if skill_id == item.id && !Negate_All.include?(item.id)
materia.all -= 1
return friends_unit.dead_members
end
end
end
end
end
materia_system_targets_for_friends
end
end
#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles actors. It's used within the Game_Actors class
# ($game_actors) and referenced by the Game_Party class ($game_party).
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
attr_accessor :materia_slots
attr_reader :ap
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :materia_system_setup :setup
def setup(actor_id)
@materia_slots = {}
materia_system_setup(actor_id)
equip_slots.size.times {|i| @materia_slots[i] = Array.new }
@materia_skills = []
setup_old_equips
equip_slots.size.times do |i|
type = equip_slots[i]
obj = equips[i]
sn = obj ? obj.paired_materia * 2 + obj.single_materia : nil
@materia_slots[i] = sn ? Array.new(sn, nil) : []
end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :materia_system_skills :skills
def skills
@materia_skills.compact.each {|skill_id| forget_skill(skill_id) }
@materia_skills.clear
all_materias.compact.each {|materia| learn_materia_skill(materia) }
materia_system_skills
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :materia_system_param_rate :param_rate
def param_rate(param_id)
result = materia_system_param_rate(param_id)
result + materia_param_plus(param_id)
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :materia_system_param :param
def param(param_id)
new_id = hp_mp_check(param_id)
materia_system_param(new_id)
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :materia_system_xparam :xparam
def xparam(param_id)
result = materia_system_xparam(param_id)
result + materia_xparam_plus(param_id)
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :materia_system_sparam :sparam
def sparam(param_id)
result = materia_system_sparam(param_id)
result + materia_sparam_plus(param_id)
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :materia_system_level_up :level_up
def level_up
@materia_skills.compact.each {|skill_id| self.forget_skill(skill_id) }
@materia_skills.clear
materia_system_level_up
all_materias.compact.each {|materia| self.learn_materia_skill(materia) }
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :materia_system_final_exp_rate :final_exp_rate
def final_exp_rate
result = materia_system_final_exp_rate
all_materias.compact.each do |materia|
result += (materia.level * 0.1) if materia.special_effect == 'Exp Plus'
end
result
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :materia_system_element_rate :element_rate
def element_rate(element_id)
result = materia_system_element_rate(element_id)
return_paired_materia.compact.each do |set|
if set[0] > 0
materia = set[2]
if materia.special_effect == 'Elemental'
other = set[3]
result -= (materia.level * 10) if other.elements.include?(element_id)
end
end
end
result
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :materia_system_state_rate :state_rate
def state_rate(state_id)
result = materia_system_state_rate(state_id)
return_paired_materia.compact.each do |set|
if set[0] > 0
materia = set[2]
if materia.special_effect == 'Added Effect'
other = set[3]
result -= (materia.level * 10) if other.states.include?(state_id)
end
end
end
result
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :materia_system_atk_elements :atk_elements
def atk_elements
result = materia_system_atk_elements
return_paired_materia.compact.each do |set|
if set[0] == 0
materia = set[2]
if materia.special_effect == 'Elemental'
other = set[3]
other.elements.each {|id| result.push(id) unless set.include?(id) }
end
end
end
result
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :materia_system_atk_states :atk_states
def atk_elements
result = materia_system_atk_states
return_paired_materia.compact.each do |set|
if set[0] == 0
materia = set[2]
if materia.special_effect == 'Added Effect'
other = set[3]
other.states.each {|id| result.push(id) unless set.include?(id) }
end
end
end
result
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def all_materias
list = []
@materia_slots.values.each {|materia| list += materia }
list
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def learn_materia_skill(materia)
if ['Magic', 'Command', 'Summon'].include?(materia.type)
materia_level = materia.level == materia.exp_levels.size + 1 ? materia.level - 1 : materia.level
materia_level.times do |i|
unless materia.skills[i] == nil || @skills.include?(materia.skills[i])
skill_id = materia.skills[i]
learn_skill(skill_id)
@materia_skills.push(skill_id)
end
end
end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def materia_param_plus(param_id)
result = 0
all_materias.compact.each do |materia|
result += materia.stat_effects[param_id]
result += (materia.level * 10) if materia_param_value(materia, param_id)
end
result / 100.0
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def materia_param_value(materia, param_id)
(param_id == 0 && materia.special_effect == 'HP Plus') ||
(param_id == 1 && materia.special_effect == 'MP Plus') ||
(param_id == 2 && materia.special_effect == 'ATK Plus') ||
(param_id == 3 && materia.special_effect == 'DEF Plus') ||
(param_id == 4 && materia.special_effect == 'MAT Plus') ||
(param_id == 5 && materia.special_effect == 'MDF Plus') ||
(param_id == 6 && materia.special_effect == 'AGI Plus') ||
(param_id == 7 && materia.special_effect == 'LUK Plus')
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def hp_mp_check(param_id)
return param_id if param_id > 1
all_materias.compact.each do |materia|
return 1 if materia.special_effect == 'HP <> MP' && param_id == 0
return 0 if materia.special_effect == 'HP <> MP' && param_id == 1
end
param_id
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def materia_xparam_plus(param_id)
result = 0
all_materias.compact.each do |materia|
result += (materia.level * 10) if materia_xparam_value(materia, param_id)
end
result
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def materia_xparam_value(materia, param_id)
(param_id == 0 && materia.special_effect == 'HIT Plus') ||
(param_id == 1 && materia.special_effect == 'EVA Plus') ||
(param_id == 2 && materia.special_effect == 'CRI Plus') ||
(param_id == 3 && materia.special_effect == 'CEV Plus') ||
(param_id == 4 && materia.special_effect == 'MEV Plus') ||
(param_id == 5 && materia.special_effect == 'MRF Plus') ||
(param_id == 6 && materia.special_effect == 'CNT Plus') ||
(param_id == 7 && materia.special_effect == 'HRG Plus') ||
(param_id == 8 && materia.special_effect == 'MRG Plus') ||
(param_id == 9 && materia.special_effect == 'TRG Plus')
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def materia_sparam_plus(param_id)
result = 0
all_materias.compact.each do |materia|
result += (materia.level * 10) if materia_sparam_value(materia, param_id)
end
result
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def materia_sparam_value(materia, param_id)
(param_id == 0 && materia.special_effect == 'TGR Plus') ||
(param_id == 1 && materia.special_effect == 'GRD Plus') ||
(param_id == 2 && materia.special_effect == 'REC Plus') ||
(param_id == 3 && materia.special_effect == 'PHA Plus') ||
(param_id == 4 && materia.special_effect == 'MCR Plus') ||
(param_id == 5 && materia.special_effect == 'TCR Plus') ||
(param_id == 6 && materia.special_effect == 'PDR Plus') ||
(param_id == 7 && materia.special_effect == 'MDR Plus') ||
(param_id == 8 && materia.special_effect == 'FDR Plus') ||
(param_id == 9 && materia.special_effect == 'EXR Plus')
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def escapeplus
result = 0
all_materias.compact.each do |materia|
result += (materia.level * 2) if materia.special_effect == 'Escape Plus'
end
result / 100.0
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def ap
@ap == nil ? 0 : @ap
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def ap=(ap)
@ap = ap
all_materias.compact.each do |materia|
unless materia.nil?
initial_level = materia.level
materia.experience += @ap
final_level = materia.level
if Materia_Breeding && initial_level < (materia.exp_levels.size + 1) &&
final_level == (materia.exp_levels.size + 1)
$game_party.gain_materia(materia.id)
end
end
end
@ap = 0
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def setup_old_equips
@old_equips = []
@equips.each {|item| @old_equips.push(item.clone) }
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def check_equip_change
equip_slots.size.times do |i|
if @equips[i].object != @old_equips[i].object
@materia_slots[i].compact.each {|m| $game_party.materia.push(m) }
type = equip_slots[i]
obj = equips[i]
sn = obj ? obj.paired_materia * 2 + obj.single_materia : nil
@materia_slots[i] = sn ? Array.new(sn, nil) : []
end
end
setup_old_equips
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def equip_materia(equip_type, slot_index, index)
new = $game_party.materia[index]
old = @materia_slots[equip_type][slot_index]
$game_party.materia.push(old) unless old.nil?
@materia_slots[equip_type][slot_index] = new
$game_party.materia.delete_at(index)
refresh
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def unequip_materia(equip_type, slot_index)
old = @materia_slots[equip_type][slot_index]
$game_party.materia.push(old) unless old.nil?
@materia_slots[equip_type][slot_index] = nil
refresh
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def return_paired_materia
paired = []
equip_slots.size.times do |i|
type = equip_slots[i]
obj = equips[i]
if obj && obj.paired_materia > 0
(obj.paired_materia * 2).times do |x|
materia = @materia_slots[i][x]
if materia && materia.type == 'Support'
y = x + ([0, 2, 4, 6].include?(x) ? 1 : - 1)
other = @materia_slots[i][y]
paired.push([0, [x, y].min, materia, other]) unless other.nil?
end
end
end
end
paired
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def return_paired_materia_type
equip_slots.size.times do |i|
@materia_slots[i].compact.each {|m| $game_party.materia.push(m) }
type = equip_slots[i]
obj = equips[i]
if obj && obj.paired_materia > 0
obj.paired_materia.times {|x| materia = @materia_slots[i][x] }
end
if obj && obj.single_materia > 0
obj.single_materia.times {|x| materia = @materia_slots[i][x] }
end
end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def skill_all(item)
if item.is_a?(RPG::Skill) && actor? && item.for_one?
return_paired_materia.compact.each do |paired_set|
materia = paired_set[2]
other_materia = paired_set[3]
if materia.special_effect == 'All' && materia.all > 0
for skill_id in other_materia.skills
if skill_id == item.id && !Negate_All.include?(item.id)
return true
end
end
end
end
end
return false
end
end
#==============================================================================
# ** Game_Enemy
#------------------------------------------------------------------------------
# This class handles enemies. It used within the Game_Troop class
# ($game_troop).
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
attr_reader :ap
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def ap
ap = Enemy_Ap[@enemy_id]
ap ? ap : (@enemy.exp / 10).to_i
end
end
#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
# This class handles parties. Information such as gold and items is included.
# Instances of this class are referenced by $game_party.
#==============================================================================
class Game_Party < Game_Unit
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
attr_accessor :materia
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :materia_system_initialize :initialize
def initialize
materia_system_initialize
@materia = []
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def gain_materia(materia_index)
@materia.push($data_materia[materia_index].dup)
end
end
#==============================================================================
# ** Game_Troop
#------------------------------------------------------------------------------
# This class handles enemy groups and battle-related data. Also performs
# battle events. The instance of this class is referenced by $game_troop.
#==============================================================================
class Game_Troop < Game_Unit
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :materia_system_gold_total :gold_total
def gold_total
result = materia_system_gold_total
gil_plus = 100.0
$game_party.members.each do |actor|
actor.all_materias.compact.each do |materia|
gil_plus += (materia.level * 5) if materia.special_effect == 'Gil Plus'
end
end
result *= gil_plus / 100.0
result.to_i
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def ap_total
dead_members.inject(0) {|r, enemy| r += enemy.ap }
end
end
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This is a super class of all windows within the game.
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
include Materia_Config
end
#==============================================================================
# ** Window_MenuCommand
#------------------------------------------------------------------------------
# This command window appears on the menu screen.
#==============================================================================
class Window_MenuCommand < Window_Command
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :materia_system_add_main_commands :add_main_commands
def add_main_commands
materia_system_add_main_commands
add_command("Materia", :materia, main_commands_enabled)
end
end
#==============================================================================
# ** Window_MenuCommand
#------------------------------------------------------------------------------
# This command window appears on the menu screen.
#==============================================================================
class Window_MateriaShopCommand < Window_HorzCommand
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def make_command_list
add_command(Vocab::ShopBuy, :buy)
add_command(Vocab::ShopSell, :sell)
add_command(Vocab::ShopCancel, :cancel)
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def col_max
return 3
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def window_width
return Graphics.width - 160
end
end
#==============================================================================
# ** Window_MenuActor
#------------------------------------------------------------------------------
# This window is for selecting actors that will be the target of item or
# skill use.
#==============================================================================
class Window_MenuActor < Window_MenuStatus
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def select_for_item(item, for_all = false)
@cursor_fix = item.for_user?
@cursor_all = for_all
if @cursor_fix
select($game_party.menu_actor.index)
elsif @cursor_all
select(0)
else
select_last
end
end
end
#==============================================================================
# ** Window_SkillList
#------------------------------------------------------------------------------
# This window is for displaying a list of available skills on the skill window.
#==============================================================================
class Window_SkillList < Window_Selectable
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :materia_system_draw_skill_cost :draw_skill_cost
def draw_skill_cost(rect, skill)
materia_system_draw_skill_cost(rect, skill)
change_color(text_color(18), enable?(skill))
rect.x += (32 + text_size(skill.name).width)
draw_text(rect, ">") if @actor.skill_all(skill)
end
end
#==============================================================================
# ** Window_MateriaBio
#------------------------------------------------------------------------------
#
#==============================================================================
class Window_MateriaBio < Window_Base
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def initialize
super(256, 96, 288 + [Graphics.width - 544, 0].max , 320 + [Graphics.height - 416, 0].max)
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.system(materia.name + "_m").dup
rescue
bitmap = Cache.system(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.system(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, 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 ? 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 == 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, Master_Text + ":#{materia.master_value}")
self.contents.font.color = system_color
base_y = 176
self.contents.draw_text(0, base_y, contents.width / 2, 14, 'Status:')
self.contents.font.color = normal_color
for i in 0...materia.stat_effects.size
self.contents.draw_text(0, base_y + (i + 1) * 14, contents.width / 2, 14, Vocab.param(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
Re: Materia System (FF:VII)
- Код:
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def initialize(width, height, buying, materia_list = nil, show_cost = true)
@materia = []
super(0, 96, width, height)
if buying
materia_list.each do |index|
$data_materia.each {|m| @materia.push(m) if index == m.id }
end
else
@materia = $game_party.materia
end
self.index = 0
self.visible = self.active = false
@buying, @show_cost = buying, show_cost
refresh
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def item_max
@materia.size
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def materia
@materia[self.index]
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def refresh
@materia.sort! {|a, b| a.id <=> b.id}
self.contents.clear if self.contents != nil
if item_max > 0
self.contents = Bitmap.new(width - 32, item_max * 24)
item_max.times {|i| draw_item(i) }
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.system(materia.name + "_m").dup
rescue
bitmap = Cache.system(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, Graphics.width, 140)
self.contents = Bitmap.new(width - 32, height - 32)
@actor = actor
@frame = 0
refresh
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def refresh(actor = @actor)
@actor = actor
self.contents.clear
draw_face(actor.face_name, actor.face_index, 4, 4)
draw_actor_name(actor, [Graphics.width - 544, 4].max, 0)
draw_actor_level(actor, [Graphics.width - 544, 4].max, 24)
draw_actor_hp(actor, [Graphics.width - 544, 4].max, 52)
draw_actor_mp(actor, [Graphics.width - 544, 4].max, 80)
end
end
#==============================================================================
# ** Window_MateriaActor
#------------------------------------------------------------------------------
#
#==============================================================================
class Window_MateriaActor < Window_Base
#------------------------------------------------------------------------------
# *
#------------------------------------------------------------------------------
def initialize(actor)
super(0, -6, Graphics.width, 152)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
@actor = actor
@frame = 0
refresh
end
#------------------------------------------------------------------------------
# *
#------------------------------------------------------------------------------
def refresh(actor = @actor)
@actor = actor
self.contents.clear
draw_equipments(132 + [Graphics.width - 544, 0].max, 0)
draw_actor_materia
end
#------------------------------------------------------------------------------
# *
#------------------------------------------------------------------------------
def draw_equipments(x, y)
@actor.equips.each_with_index do |item, i|
draw_item_name(item, x, y + line_height * i)
end
end
#------------------------------------------------------------------------------
# *
#------------------------------------------------------------------------------
def draw_actor_materia
base_x = 316 + [Graphics.width - 544, 0].max
self.contents.fill_rect(base_x, 0, 192, 120, Color.new(0, 0, 0, 0))
@actor.equip_slots.size.times do |i|
self.contents.fill_rect(base_x, i * 24 + 2, 192, 22, Color.new(0, 0, 0, 50))
end
@actor.equip_slots.size.times do |i|
slots_x, y = base_x - 24, i * 24
obj = @actor.equips[i]
if obj.nil?
p_times, s_times = 0, 0
else
p_times = obj.paired_materia
s_times = obj.single_materia
end
p_times.times do
bitmap = Cache.system(Paired_Slot_Left)
self.contents.blt(slots_x += 24, y, bitmap, Rect.new(0, 0, 24, 24))
bitmap = Cache.system(Paired_Slot_Right)
self.contents.blt(slots_x += 24, y, bitmap, Rect.new(0, 0, 24, 24))
end
s_times.times do
bitmap = Cache.system(Single_Slot)
self.contents.blt(slots_x += 24, y, bitmap, Rect.new(0, 0, 24, 24))
end
end
@actor.equip_slots.size.times do |i|
@actor.materia_slots[i].size.times do |y|
materia = @actor.materia_slots[i][y]
unless materia.nil?
hue = materia.get_hue
begin
bitmap = Cache.system(materia.name + "_m").dup
rescue
bitmap = Cache.system(Default_Icon).dup
bitmap.hue_change(hue)
end
self.contents.blt(base_x + y * 24, 24 * i, bitmap, Rect.new(0, 0, 24, 24))
end
end
end
end
end
#==============================================================================
# ** Window_MateriaEquipBio
#------------------------------------------------------------------------------
#
#==============================================================================
class Window_MateriaEquipBio < Window_Base
#------------------------------------------------------------------------------
# *
#------------------------------------------------------------------------------
def initialize
super(0, 140, 352 + [Graphics.width - 544, 0].max, 276 + [Graphics.height - 416, 0].max)
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.system(materia.name + "_m").dup
rescue
bitmap = Cache.system(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.system(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, 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 ? 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 == 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:')
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, Vocab.param(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
#==============================================================================
# ** Game_Interpreter
#------------------------------------------------------------------------------
# An interpreter for executing event commands. This class is used within the
# Game_Map, Game_Troop, and Game_Event classes.
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :materia_system_command_319 :command_319
def command_319
materia_system_command_319
$game_actors[@params[0]].check_equip_change if $game_actors[@params[0]]
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def materia_shop(list)
$materia_shop_list = list.dup
SceneManager.call(Scene_MateriaShop)
end
end
#==============================================================================
# ** Scene_Base
#------------------------------------------------------------------------------
# This is a super class of all scenes within the game.
#==============================================================================
class Scene_Base
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
include Materia_Config
end
#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
# This class performs the title screen processing.
#==============================================================================
class Scene_Title < Scene_Base
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :materia_system_main :main
def main
materia_system_main
materias = Materia_System.new
$data_materia = materias.set_up_materias
end
#------------------------------------------------------------------------------
# *
#------------------------------------------------------------------------------
alias :materia_system_command_new_game :command_new_game
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
materia_system_command_new_game
end
#------------------------------------------------------------------------------
# *
#------------------------------------------------------------------------------
alias :materia_system_command_continue :command_continue
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
materia_system_command_continue
end
end
#==============================================================================
# ** Scene_Equip
#------------------------------------------------------------------------------
# This class performs the equipment screen processing.
#==============================================================================
class Scene_Equip < Scene_MenuBase
#------------------------------------------------------------------------------
# *
#------------------------------------------------------------------------------
alias :materia_system_on_actor_change :on_actor_change
def on_actor_change
@actor.check_equip_change
materia_system_on_actor_change
end
#------------------------------------------------------------------------------
# *
#------------------------------------------------------------------------------
def terminate
super
@actor.check_equip_change
end
end
#==============================================================================
# ** Scene_MateriaShop
#------------------------------------------------------------------------------
#
#==============================================================================
class Scene_MateriaShop < Scene_MenuBase
#------------------------------------------------------------------------------
# *
#------------------------------------------------------------------------------
def start
super
@materia_avialable = $materia_shop_list
create_command_window
@help_window = Window_Help.new(1)
@help_window.set_text(Shop_Message)
@gold_window = Window_Gold.new
@gold_window.x = Graphics.width - 160
@gold_window.y = 48
@dummy_window = Window_Base.new(0, 96, Graphics.width, 320 + [Graphics.height - 416, 0].max)
@buy_items = Window_MateriaList.new(256, 320 + [Graphics.height - 416, 0].max, true, @materia_avialable)
@sell_items = Window_MateriaList.new(256, 320 + [Graphics.height - 416, 0].max, false)
@materia_bio = Window_MateriaBio.new
end
#------------------------------------------------------------------------------
# *
#------------------------------------------------------------------------------
def update
if @shop_options_window.active
update_shop_commands
elsif @buy_items.active
update_buy_materia
elsif @sell_items.active
update_sell_materia
end
super
end
#------------------------------------------------------------------------------
# *
#------------------------------------------------------------------------------
def create_command_window
@shop_options_window = Window_MateriaShopCommand.new(0, 48)
@shop_options_window.set_handler(:buy, method(:command_buy))
@shop_options_window.set_handler(:sell, method(:command_sell))
@shop_options_window.set_handler(:cancel, method(:return_scene))
end
#------------------------------------------------------------------------------
# *
#------------------------------------------------------------------------------
def command_buy
@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
end
#------------------------------------------------------------------------------
# *
#------------------------------------------------------------------------------
def command_sell
@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
end
#------------------------------------------------------------------------------
# *
#------------------------------------------------------------------------------
def update_shop_commands
@help_window.set_text(Shop_Message)
if Input.trigger?(:B)
Sound.play_cancel
return_scene
end
end
#------------------------------------------------------------------------------
# *
#------------------------------------------------------------------------------
def update_buy_materia
@help_window.set_text(Buy_Message)
if Input.trigger?(: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?(: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?(:UP) || Input.trigger?(:DOWN) ||
Input.press?(:UP) || Input.press?(:DOWN) ||
Input.trigger?(:R) || Input.trigger?(:L) ||
Input.press?(:R) || Input.press?(:L)
@materia_bio.refresh(@buy_items.materia)
end
end
#------------------------------------------------------------------------------
# *
#------------------------------------------------------------------------------
def update_sell_materia
@help_window.set_text(Sell_Message)
if Input.trigger?(: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?(: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?(:UP) || Input.trigger?(:DOWN) ||
Input.press?(:UP) || Input.press?(:DOWN) ||
Input.trigger?(:R) || Input.trigger?(:L) ||
Input.press?(:R) || Input.press?(:L)
@materia_bio.refresh(@sell_items.materia)
end
end
end
#==============================================================================
# ** Scene_MateriaEquip
#------------------------------------------------------------------------------
#
#==============================================================================
class Scene_MateriaEquip < Scene_MenuBase
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def start
super
@materia_index = 0
@equip_index = 0
@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 + [Graphics.height - 416, 0].max, false, $game_party.materia, false)
@materia_list_window.x = 352 + [Graphics.width - 544, 0].max
@materia_list_window.y = 140
@materia_list_window.visible = true
@materia_bio_window.z = @materia_list_window.z = 1000
@pointer_sprite = Sprite.new
@pointer_sprite.x = 316 + [Graphics.width - 544, 0].max + (@materia_index + 1) * 24 - 28
@pointer_sprite.y = 0 * 24 + 12
@pointer_sprite.z = 9999
@pointer_sprite.bitmap = Cache.system(Materia_Cursor)
@materia_list_window.refresh
update_materia_bio
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def update
super
!@materia_list_window.active ? update_weapon_select : update_materia_select
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def update_weapon_select
@pointer_sprite.x = 316 + [Graphics.width - 544, 0].max + (@materia_index + 1) * 24 - 28
@pointer_sprite.y = @equip_index * 24 + 12
if Input.trigger?(:UP)
Sound.play_cursor
@equip_index = @equip_index == 0 ? @equip_index = 4 : @equip_index -= 1
max = [@actor.materia_slots[@equip_index].size - 1, 0].max
@materia_index = [@materia_index, max].min
update_materia_bio
end
if Input.trigger?(:DOWN)
Sound.play_cursor
@equip_index = @equip_index == 4 ? @equip_index = 0 : @equip_index += 1
max = [@actor.materia_slots[@equip_index].size - 1, 0].max
@materia_index = [@materia_index, max].min
update_materia_bio
end
if Input.trigger?(:RIGHT)
Sound.play_cursor
max = @actor.materia_slots[@equip_index].size
return if max == 0
@materia_index = @materia_index == max - 1 ? @materia_index = 0 : @materia_index += 1
update_materia_bio
end
if Input.trigger?(:LEFT)
Sound.play_cursor
max = @actor.materia_slots[@equip_index].size
return if max == 0
@materia_index = @materia_index == 0 ? @materia_index = max - 1 : @materia_index -= 1
update_materia_bio
end
if Input.trigger?(:L)
Sound.play_cursor
next_actor
end
if Input.trigger?(:R)
Sound.play_cursor
prev_actor
end
if Input.trigger?(: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?(:B)
Sound.play_cancel
return_scene
end
if Input.trigger?(:C)
max = @actor.materia_slots[@equip_index].size
if max == 0
Sound.play_buzzer
return
else
Sound.play_ok
@materia_list_window.active = true
update_materia_bio
end
end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def update_materia_select
if Input.trigger?(:B)
Sound.play_cancel
@materia_list_window.active = false
update_materia_bio
end
if Input.trigger?(: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?(:UP) || Input.trigger?(:DOWN) ||
Input.press?(:UP) || Input.press?(:DOWN) ||
Input.trigger?(:R) || Input.trigger?(:L) ||
Input.press?(:R) || Input.press?(:L)
update_materia_bio
end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def update_materia_bio
if @materia_list_window.active
@materia_bio_window.refresh(@materia_list_window.materia)
else
item = @actor.materia_slots[@equip_index]
@materia_bio_window.refresh(item[@materia_index])
end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def on_actor_change
@status_bio_window.refresh(@actor)
@character_bio_window.refresh(@actor)
update_materia_bio
end
end
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs the menu screen processing.
#==============================================================================
class Scene_Menu < Scene_MenuBase
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :materia_system_create_command_window :create_command_window
def create_command_window
materia_system_create_command_window
@command_window.set_handler(:materia, method(:command_personal))
end
#--------------------------------------------------------------------------
# *
def command_materia
@status_window.select_last
@status_window.activate
@status_window.set_handler(:ok, method(:on_install_ok))
@status_window.set_handler(:cancel, method(:on_personal_cancel))
end
#--------------------------------------------------------------------------
# ● Validates the actor selection
#--------------------------------------------------------------------------
def on_install_ok
SceneManager.call(Scene_MateriaEquip)
end
#--------------------------------------------------------------------------
alias :materia_system_on_personal_ok :on_personal_ok
def on_personal_ok
materia_system_on_personal_ok
case @command_window.current_symbol
when :materia
SceneManager.call(Scene_MateriaEquip)
end
end
end
#==============================================================================
# ** Scene_ItemBase
#------------------------------------------------------------------------------
# This class performs common processing for the item screen and skill screen.
#==============================================================================
class Scene_ItemBase < Scene_MenuBase
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def determine_item
if item.for_friend?
show_sub_window(@actor_window)
for_all = item.for_all? || (@actor && @actor.skill_all(item))
@actor_window.select_for_item(item, for_all)
else
use_item
activate_item_window
end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def item_target_actors
if !item.for_friend?
[]
elsif item.for_all? || (@actor && @actor.skill_all(item))
$game_party.members
else
[$game_party.members[@actor_window.index]]
end
end
end
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
alias :materia_system_battle_start :battle_start
def battle_start
materia_system_battle_start
$game_party.members.each do |actor|
actor.all_materias.compact.each {|materia| materia.reset_all }
end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def on_skill_ok
@skill = @skill_window.item
BattleManager.actor.input.set_skill(@skill.id)
BattleManager.actor.last_skill.object = @skill
if !@skill.need_selection? || BattleManager.actor.skill_all(@skill)
@skill_window.hide
next_command
elsif @skill.for_opponent?
select_enemy_selection
else
select_actor_selection
end
end
end
Страница 1 из 1
Права доступа к этому форуму:
Вы не можете отвечать на сообщения