Noble Lv.8
Inscrit le : 03/11/2012 Messages : 290
| Sujet: [VX] Compétence passive Jeu 7 Mar 2013 - 20:42 | |
| Shanghai Simple Script - Passive SkillsIntroductionPermets de créer des compétences qui auront des effets permanents, on peut aussi faire en sorte qu'un actor bénéficie d'un état spécifique permanent. CompatibilitéCe script est compatible avec les gens qui savent lire uniquement. auteur: Shanghai screenscript - Code:
-
#=============================================================================== # # Shanghai Simple Script - Passive Skills # Last Date Updated: 2010.05.19 # Level: Normal # # Skills learned by actors can now give stat bonuses or apply autostates. #=============================================================================== # Instructions # ----------------------------------------------------------------------------- # To install this script, open up your script editor and copy/paste this script # to an open slot below ▼ Materials but above ▼ Main. Remember to save. # # <passive param: +x> # <passive param: -x> # <passive param: x%> # Replace param with hp, mp, atk, def, spi, agi, dex, res, hit, eva, cri, or # odds, and this tag will increase or decrease the base stat by that much. % # will increase by a percent. # # <passive state: x> # <passive state: x, x, x> # Gives the skill with state x always applied. Unremovable until the skill has # been forgotten. # # Insert multiple of these tags if you want more than one passive effect # applied for a single skill. #===============================================================================
$imported = {} if $imported == nil $imported["PassiveSkills"] = true
#============================================================================== # RPG::BaseItem #==============================================================================
class RPG::BaseItem
#-------------------------------------------------------------------------- # passive_traits #-------------------------------------------------------------------------- def passive_traits return @passive_traits if @passive_traits != nil @passive_traits = { :maxhp => 0, :maxmp => 0, :atk => 0, :def => 0, :spi => 0, :agi => 0, :dex => 0, :res => 0, :hit => 0, :eva => 0, :cri => 0, :odds => 0, :maxhpp => 100, :maxmpp => 100, :atkp => 100, :defp => 100, :spip => 100, :agip => 100, :dexp => 100, :resp => 100, :hitp => 100, :evap => 100, :crip => 100, :oddsp => 100, :states => []} self.note.split(/[\r\n]+/).each { |line| case line when /<(?:PASSIVE|pas)[ ](.*):[ ]([\+\-]\d+)>/i case $1.upcase when "MAXHP", "HP" @passive_traits[:maxhp] = $2.to_i when "MAXMP", "MP" @passive_traits[:maxmp] = $2.to_i when "ATK" @passive_traits[:atk] = $2.to_i when "DEF" @passive_traits[:def] = $2.to_i when "SPI" @passive_traits[:spi] = $2.to_i when "AGI" @passive_traits[:agi] = $2.to_i when "DEX" @passive_traits[:dex] = $2.to_i when "RES" @passive_traits[:res] = $2.to_i when "HIT" @passive_traits[:hit] = $2.to_i when "EVA" @passive_traits[:eva] = $2.to_i when "CRI" @passive_traits[:cri] = $2.to_i when "ODDS" @passive_traits[:odds] = $2.to_i end when /<(?:PASSIVE|pas)[ ](.*):[ ](\d+)([%%])>/i case $1.upcase when "MAXHP", "HP" @passive_traits[:maxhpp] = $2.to_i when "MAXMP", "MP" @passive_traits[:maxmpp] = $2.to_i when "ATK" @passive_traits[:atkp] = $2.to_i when "DEF" @passive_traits[:defp] = $2.to_i when "SPI" @passive_traits[:spip] = $2.to_i when "AGI" @passive_traits[:agip] = $2.to_i when "DEX" @passive_traits[:dexp] = $2.to_i when "RES" @passive_traits[:resp] = $2.to_i when "HIT" @passive_traits[:hitp] = $2.to_i when "EVA" @passive_traits[:evap] = $2.to_i when "CRI" @passive_traits[:crip] = $2.to_i when "ODDS" @passive_traits[:oddsp] = $2.to_i end when /<(?:PASSIVE_STATE|passive state):[ ](\d+(?:\s*,\s*\d+)*)>/i $1.scan(/\d+/).each { |num| @passive_traits[:states].push($data_states[num.to_i]) if num.to_i > 0 } end } return @passive_traits end end
#============================================================================== # ** Game_Battler #==============================================================================
class Game_Battler #-------------------------------------------------------------------------- # * Get Current States as an Object Array #-------------------------------------------------------------------------- alias states_sss_passive_skills states unless $@ def states array = states_sss_passive_skills if actor? for skill in skills do array |= skill.passive_traits[:states] end end return array.compact end end
#============================================================================== # Game Actor #==============================================================================
class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # * Get Basic Maximum HP #-------------------------------------------------------------------------- alias base_maxhp_sss_passive_skills base_maxhp unless $@ def base_maxhp n = base_maxhp_sss_passive_skills for skill in skills do n = n * skill.passive_traits[:maxhpp] / 100.0 end for skill in skills do n += skill.passive_traits[:maxhp] end return Integer(n) end #-------------------------------------------------------------------------- # * Get Basic Maximum MP #-------------------------------------------------------------------------- alias base_maxmp_sss_passive_skills base_maxmp unless $@ def base_maxmp n = base_maxmp_sss_passive_skills for skill in skills do n = n * skill.passive_traits[:maxmpp] / 100.0 end for skill in skills do n += skill.passive_traits[:maxmp] end return Integer(n) end #-------------------------------------------------------------------------- # * Get Basic Attack #-------------------------------------------------------------------------- alias base_atk_sss_passive_skills base_atk unless $@ def base_atk n = base_atk_sss_passive_skills for skill in skills do n = n * skill.passive_traits[:atkp] / 100.0 end for skill in skills do n += skill.passive_traits[:atk] end return Integer(n) end #-------------------------------------------------------------------------- # * Get Basic Defense #-------------------------------------------------------------------------- alias base_def_sss_passive_skills base_def unless $@ def base_def n = base_def_sss_passive_skills for skill in skills do n = n * skill.passive_traits[:defp] / 100.0 end for skill in skills do n += skill.passive_traits[:def] end return Integer(n) end #-------------------------------------------------------------------------- # * Get Basic Spirit #-------------------------------------------------------------------------- alias base_spi_sss_passive_skills base_spi unless $@ def base_spi n = base_spi_sss_passive_skills for skill in skills do n = n * skill.passive_traits[:spip] / 100.0 end for skill in skills do n += skill.passive_traits[:spi] end return Integer(n) end #-------------------------------------------------------------------------- # * Get Basic Agility #-------------------------------------------------------------------------- alias base_agi_sss_passive_skills base_agi unless $@ def base_agi n = base_agi_sss_passive_skills for skill in skills do n = n * skill.passive_traits[:agip] / 100.0 end for skill in skills do n += skill.passive_traits[:agi] end return Integer(n) end #-------------------------------------------------------------------------- # * Get Basic Dexterity #-------------------------------------------------------------------------- if $imported["DEX Stat"] alias base_dex_sss_passive_skills base_dex unless $@ def base_dex n = base_dex_sss_passive_skills for skill in skills do n = n * skill.passive_traits[:dexp] / 100.0 end for skill in skills do n += skill.passive_traits[:dex] end return Integer(n) end end #-------------------------------------------------------------------------- # * Get Basic Resist #-------------------------------------------------------------------------- if $imported["RES Stat"] alias base_res_sss_passive_skills base_res unless $@ def base_res n = base_res_sss_passive_skills for skill in skills do n = n * skill.passive_traits[:resp] / 100.0 end for skill in skills do n += skill.passive_traits[:res] end return Integer(n) end end #-------------------------------------------------------------------------- # * Get Hit Rate #-------------------------------------------------------------------------- alias hit_sss_passive_skills hit unless $@ def hit n = hit_sss_passive_skills for skill in skills do n = n * skill.passive_traits[:hitp] / 100.0 end for skill in skills do n += skill.passive_traits[:hit] end return [Integer(n), 0].max end #-------------------------------------------------------------------------- # * Get Evasion Rate #-------------------------------------------------------------------------- alias eva_sss_passive_skills eva unless $@ def eva n = eva_sss_passive_skills for skill in skills do n = n * skill.passive_traits[:evap] / 100.0 end for skill in skills do n += skill.passive_traits[:eva] end return [Integer(n), 0].max end #-------------------------------------------------------------------------- # * Get Critical Rate #-------------------------------------------------------------------------- alias cri_sss_passive_skills cri unless $@ def cri n = cri_sss_passive_skills for skill in skills do n = n * skill.passive_traits[:crip] / 100.0 end for skill in skills do n += skill.passive_traits[:cri] end return [Integer(n), 0].max end #-------------------------------------------------------------------------- # * Get Get Ease of Hitting #-------------------------------------------------------------------------- alias odds_sss_passive_skills odds unless $@ def odds n = odds_sss_passive_skills for skill in skills do n = n * skill.passive_traits[:oddsp] / 100.0 end for skill in skills do n += skill.passive_traits[:odds] end return [Integer(n), 1].max end end
#=============================================================================== # # END OF FILE # #=============================================================================== - Code:
-
<passive param: +x> <passive param: -x> - Code:
-
<passive state: x> <passive state: x, x, x> |
|