Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- #
- # Shanghai Simple Script - Temporary Stat Boosts
- # Last Date Updated: 2010.05.22
- # Level: Normal
- #
- # Temporary stat boosts only last during battle. After battle, they're cleared
- # and everything returns back to normal.
- #===============================================================================
- # 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.
- #
- # These are for items and skills.
- #
- # <target temp stat: +x>
- # <target temp stat: -x>
- # Gives a temporary boost of x for the stat to target of skill. Replace "stat"
- # maxhp, maxmp, atk, def, spi, agi, hit, eva, cri, odds, dex, or res
- #
- # <user temp stat: +x>
- # <user temp stat: -x>
- # Gives a temporary boost of x for the stat to user of skill. Replace "stat"
- # maxhp, maxmp, atk, def, spi, agi, hit, eva, cri, odds, dex, or res
- #
- # <clear temp stats: user>
- # <clear temp stats: target>
- # Will clear the temp stats for the user or target.
- #===============================================================================
- $imported = {} if $imported == nil
- $imported["TemporaryStatBoosts"] = true
- #==============================================================================
- # RPG::BaseItem
- #==============================================================================
- class RPG::BaseItem
- #--------------------------------------------------------------------------
- # target_temp_boost
- #--------------------------------------------------------------------------
- def target_temp_boost
- return @target_temp_boost if @target_temp_boost != nil
- @target_temp_boost = {:maxhp => 0, :maxmp => 0, :atk => 0, :def => 0,
- :spi => 0, :agi => 0, :hit => 0, :eva => 0, :cri => 0, :odds => 0,
- :dex => 0, :res => 0}
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:TARGET TEMPORARY|target temp)[ ](.*):[ ]([\+\-]\d+)>/i
- case $1.upcase
- when "MAXHP"
- @target_temp_boost[:maxhp] = $2.to_i
- when "MAXMP"
- @target_temp_boost[:maxmp] = $2.to_i
- when "ATK"
- @target_temp_boost[:atk] = $2.to_i
- when "DEF"
- @target_temp_boost[:def] = $2.to_i
- when "SPI"
- @target_temp_boost[:spi] = $2.to_i
- when "AGI"
- @target_temp_boost[:agi] = $2.to_i
- when "HIT"
- @target_temp_boost[:hit] = $2.to_i
- when "EVA"
- @target_temp_boost[:eva] = $2.to_i
- when "CRI"
- @target_temp_boost[:cri] = $2.to_i
- when "ODDS"
- @target_temp_boost[:odds] = $2.to_i
- when "DEX"
- @target_temp_boost[:dex] = $2.to_i
- when "RES"
- @target_temp_boost[:res] = $2.to_i
- end
- end
- }
- return @target_temp_boost
- end
- #--------------------------------------------------------------------------
- # user_temp_boost
- #--------------------------------------------------------------------------
- def user_temp_boost
- return @user_temp_boost if @user_temp_boost != nil
- @user_temp_boost = {:maxhp => 0, :maxmp => 0, :atk => 0, :def => 0,
- :spi => 0, :agi => 0, :hit => 0, :eva => 0, :cri => 0, :odds => 0,
- :dex => 0, :res => 0}
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:USER TEMPORARY|user temp)[ ](.*):[ ]([\+\-]\d+)>/i
- case $1.upcase
- when "MAXHP"
- @user_temp_boost[:maxhp] = $2.to_i
- when "MAXMP"
- @user_temp_boost[:maxmp] = $2.to_i
- when "ATK"
- @user_temp_boost[:atk] = $2.to_i
- when "DEF"
- @user_temp_boost[:def] = $2.to_i
- when "SPI"
- @user_temp_boost[:spi] = $2.to_i
- when "AGI"
- @user_temp_boost[:agi] = $2.to_i
- when "HIT"
- @user_temp_boost[:hit] = $2.to_i
- when "EVA"
- @user_temp_boost[:eva] = $2.to_i
- when "CRI"
- @user_temp_boost[:cri] = $2.to_i
- when "ODDS"
- @user_temp_boost[:odds] = $2.to_i
- when "DEX"
- @user_temp_boost[:dex] = $2.to_i
- when "RES"
- @user_temp_boost[:res] = $2.to_i
- end
- end
- }
- return @user_temp_boost
- end
- #--------------------------------------------------------------------------
- # clear_temp_stats
- #--------------------------------------------------------------------------
- def clear_temp_stats
- return @clear_temp_stats if @clear_temp_stats != nil
- @clear_temp_stats = {:user => false, :target => false}
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:CLEAR TEMP STATS|clear temp boosts)[ ](.*)>/i
- case $1.upcase
- when "USER"
- @clear_temp_stats[:user] = true
- when "TARGET", "TARGETS"
- @clear_temp_stats[:target] = true
- end
- end
- }
- return @clear_temp_stats
- end
- end
- #==============================================================================
- # ** Game_Battler
- #==============================================================================
- class Game_Battler
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- alias initialize_sss_temp_stat_boosts initialize unless $@
- def initialize
- initialize_sss_temp_stat_boosts
- clear_temp_stat_boosts
- end
- #--------------------------------------------------------------------------
- # * Clear Temp Stat Boosts
- #--------------------------------------------------------------------------
- def clear_temp_stat_boosts
- @temp_maxhp_boost = 0
- @temp_maxmp_boost = 0
- @temp_atk_boost = 0
- @temp_def_boost = 0
- @temp_spi_boost = 0
- @temp_agi_boost = 0
- @temp_hit_boost = 0
- @temp_eva_boost = 0
- @temp_cri_boost = 0
- @temp_odds_boost = 0
- @temp_dex_boost = 0
- @temp_res_boost = 0
- end
- #--------------------------------------------------------------------------
- # * Apply Temp Boost
- #--------------------------------------------------------------------------
- def apply_temp_boost(hash)
- @temp_maxhp_boost += hash[:maxhp]
- @temp_maxmp_boost += hash[:maxmp]
- @temp_atk_boost += hash[:atk]
- @temp_def_boost += hash[:def]
- @temp_spi_boost += hash[:spi]
- @temp_agi_boost += hash[:agi]
- @temp_hit_boost += hash[:hit]
- @temp_eva_boost += hash[:eva]
- @temp_cri_boost += hash[:cri]
- @temp_odds_boost += hash[:odds]
- @temp_dex_boost += hash[:dex]
- @temp_res_boost += hash[:res]
- end
- #--------------------------------------------------------------------------
- # * Apply Skill Effects
- #--------------------------------------------------------------------------
- alias skill_effect_sss_temp_boosts skill_effect unless $@
- def skill_effect(user, skill)
- skill_effect_sss_temp_boosts(user, skill)
- return unless $game_temp.in_battle
- return if @skipped or @missed or @evaded
- clear_temp_stat_boosts if skill.clear_temp_stats[:target]
- user.clear_temp_stat_boosts if skill.clear_temp_stats[:user]
- apply_temp_boost(skill.target_temp_boost)
- user.apply_temp_boost(skill.user_temp_boost)
- end
- #--------------------------------------------------------------------------
- # * Apply Item Effects
- #--------------------------------------------------------------------------
- alias item_effect_sss_temp_boosts item_effect unless $@
- def item_effect(user, item)
- item_effect_sss_temp_boosts(user, item)
- return unless $game_temp.in_battle
- return if @skipped or @missed or @evaded
- clear_temp_stat_boosts if item.clear_temp_stats[:target]
- user.clear_temp_stat_boosts if item.clear_temp_stats[:user]
- apply_temp_boost(item.target_temp_boost)
- user.apply_temp_boost(item.user_temp_boost)
- end
- #--------------------------------------------------------------------------
- # * Maxmp Limit
- #--------------------------------------------------------------------------
- unless method_defined?(:maxmp_limit)
- def maxmp_limit; return 9999; end
- end
- #--------------------------------------------------------------------------
- # * Parameter Limit
- #--------------------------------------------------------------------------
- unless method_defined?(:parameter_limit)
- def parameter_limit; return 999; end
- end
- #--------------------------------------------------------------------------
- # * Get Maximum HP
- #--------------------------------------------------------------------------
- alias maxhp_sss_temp_boosts maxhp unless $@
- def maxhp
- clear_temp_stat_boosts if @temp_maxhp_boost.nil?
- return [[maxhp_sss_temp_boosts + @temp_maxhp_boost, 1].max, maxhp_limit].min
- end
- #--------------------------------------------------------------------------
- # * Get Maximum MP
- #--------------------------------------------------------------------------
- alias maxmp_sss_temp_boosts maxmp unless $@
- def maxmp
- clear_temp_stat_boosts if @temp_maxmp_boost.nil?
- return [[maxmp_sss_temp_boosts + @temp_maxmp_boost, 0].max, maxmp_limit].min
- end
- #--------------------------------------------------------------------------
- # * Get Attack
- #--------------------------------------------------------------------------
- alias atk_sss_temp_boosts atk unless $@
- def atk
- clear_temp_stat_boosts if @temp_atk_boost.nil?
- return [[atk_sss_temp_boosts + @temp_atk_boost, 1].max, parameter_limit].min
- end
- #--------------------------------------------------------------------------
- # * Get Defense
- #--------------------------------------------------------------------------
- alias def_sss_temp_boosts def unless $@
- def def
- clear_temp_stat_boosts if @temp_def_boost.nil?
- return [[def_sss_temp_boosts + @temp_def_boost, 1].max, parameter_limit].min
- end
- #--------------------------------------------------------------------------
- # * Get Spirit
- #--------------------------------------------------------------------------
- alias spi_sss_temp_boosts spi unless $@
- def spi
- clear_temp_stat_boosts if @temp_spi_boost.nil?
- return [[spi_sss_temp_boosts + @temp_spi_boost, 1].max, parameter_limit].min
- end
- #--------------------------------------------------------------------------
- # * Get Agility
- #--------------------------------------------------------------------------
- alias agi_sss_temp_boosts agi unless $@
- def agi
- clear_temp_stat_boosts if @temp_agi_boost.nil?
- return [[agi_sss_temp_boosts + @temp_agi_boost, 1].max, parameter_limit].min
- end
- #--------------------------------------------------------------------------
- # * Get Dexterity
- #--------------------------------------------------------------------------
- if $imported["DEX Stat"]
- alias dex_sss_temp_boosts dex unless $@
- def dex
- clear_temp_stat_boosts if @temp_dex_boost.nil?
- return [[dex_sss_temp_boosts + @temp_dex_boost, 1].max, parameter_limit].min
- end
- end
- #--------------------------------------------------------------------------
- # * Get Resist
- #--------------------------------------------------------------------------
- if $imported["RES Stat"]
- alias res_sss_temp_boosts res unless $@
- def res
- clear_temp_stat_boosts if @temp_res_boost.nil?
- return [[res_sss_temp_boosts + @temp_res_boost, 1].max, parameter_limit].min
- end
- end
- end
- #==============================================================================
- # ** Game_Actor
- #==============================================================================
- class Game_Actor < Game_Battler
- #--------------------------------------------------------------------------
- # * Get Hit Rate
- #--------------------------------------------------------------------------
- alias hit_sss_temp_boosts_actor hit unless $@
- def hit
- clear_temp_stat_boosts if @temp_hit_boost.nil?
- return [hit_sss_temp_boosts_actor + @temp_hit_boost, 0].max
- end
- #--------------------------------------------------------------------------
- # * Get Evasion Rate
- #--------------------------------------------------------------------------
- alias eva_sss_temp_boosts_actor eva unless $@
- def eva
- clear_temp_stat_boosts if @temp_eva_boost.nil?
- return [eva_sss_temp_boosts_actor + @temp_eva_boost, 0].max
- end
- #--------------------------------------------------------------------------
- # * Get Critical Ratio
- #--------------------------------------------------------------------------
- alias cri_sss_temp_boosts_actor cri unless $@
- def cri
- clear_temp_stat_boosts if @temp_cri_boost.nil?
- return [cri_sss_temp_boosts_actor + @temp_cri_boost, 0].max
- end
- #--------------------------------------------------------------------------
- # * Get Ease of Hitting
- #--------------------------------------------------------------------------
- alias odds_sss_temp_boosts_actor odds unless $@
- def odds
- clear_temp_stat_boosts if @temp_odds_boost.nil?
- return [odds_sss_temp_boosts_actor + @temp_odds_boost, 0].max
- end
- end
- #==============================================================================
- # ** Game_Enemy
- #==============================================================================
- class Game_Enemy < Game_Battler
- #--------------------------------------------------------------------------
- # * Get Hit Rate
- #--------------------------------------------------------------------------
- alias hit_sss_temp_boosts_enemy hit unless $@
- def hit
- clear_temp_stat_boosts if @temp_hit_boost.nil?
- return [hit_sss_temp_boosts_enemy + @temp_hit_boost, 0].max
- end
- #--------------------------------------------------------------------------
- # * Get Evasion Rate
- #--------------------------------------------------------------------------
- alias eva_sss_temp_boosts_enemy eva unless $@
- def eva
- clear_temp_stat_boosts if @temp_eva_boost.nil?
- return [eva_sss_temp_boosts_enemy + @temp_eva_boost, 0].max
- end
- #--------------------------------------------------------------------------
- # * Get Critical Ratio
- #--------------------------------------------------------------------------
- alias cri_sss_temp_boosts_enemy cri unless $@
- def cri
- clear_temp_stat_boosts if @temp_cri_boost.nil?
- return [cri_sss_temp_boosts_enemy + @temp_cri_boost, 0].max
- end
- #--------------------------------------------------------------------------
- # * Get Ease of Hitting
- #--------------------------------------------------------------------------
- alias odds_sss_temp_boosts_enemy odds unless $@
- def odds
- clear_temp_stat_boosts if @temp_odds_boost.nil?
- return [odds_sss_temp_boosts_enemy + @temp_odds_boost, 0].max
- end
- end
- #==============================================================================
- # ** Scene_Battle
- #==============================================================================
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # * Battle Start Processing
- #--------------------------------------------------------------------------
- alias process_battle_start_sss_temp_boosts process_battle_start unless $@
- def process_battle_start
- for member in $game_party.members
- member.clear_temp_stat_boosts
- end
- process_battle_start_sss_temp_boosts
- end
- #--------------------------------------------------------------------------
- # * End Battle
- #--------------------------------------------------------------------------
- alias battle_end_sss_temp_boosts battle_end unless $@
- def battle_end(result)
- battle_end_sss_temp_boosts(result)
- for member in $game_party.members
- member.clear_temp_stat_boosts
- end
- end
- end
- #===============================================================================
- #
- # END OF FILE
- #
- #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement