Sujet: [Abandon] Add-on Matéria Dim 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
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.
# 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)
#============================================================================== # ** 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
#============================================================================== # ** 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
#============================================================================== # ** 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