#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_ #_/ ◆ Slip Damage - KGC_SlipDamageExtension ◆ VX ◆ #_/ ◇ Last Update: 03/29/2008 #_/ ◆ Written by TOMY #_/ ◆ Translation by Mr. Anonymous #_/ ◆ KGC Site: #_/ ◆ http://ytomy.sakura.ne.jp/ #_/ ◆ Translator's Blog: #_/ ◆ http://mraprojects.wordpress.com #_/----------------------------------------------------------------------------- #_/ This script allows you to make states with "slip damage" or continual #_/ damage/recovery outside of battle. This effect is accompanied by a screen #_/ flash to indictate everytime the actor recieves damage/recovery. #_/ Recall the "Poisoned" state in Pokemon. #_/============================================================================= #_/ ◆ Instructions For Usage ◆ #_/ To make use of this function, you must insert the tag into the #_/ "Notes" box located in the States section of the database. #_/ #_/ Format: #_/ Where HP/MP: Designate HP or MP damage/recovery. #_/ Where Modifier: Use [ - ] or damage or [ + ] for recovery. #_/ Where Rate: The desired amount of damage/recovery. #_/ Where %: [Optional] You may insert % after rate for Max HP or Max MP. #_/ Where Steps: The amount of steps it takes for the effect to kick in. #_/ #_/ Ex: #_/ For every 5 steps, 5 percent of the actor's max hp is lost. #_/ #_/ Ex: #_/ For every 10 steps, 20 MP is recovered. #_/ #_/ Ex: #_/ After every turn in battle, 10 percent of MP is lost. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_ #==============================================================================# # ★ Customization ★ # #==============================================================================# module KGC module SlipDamageExtension # ◆ Damage Indictation Flash ◆ # This allows you to change the color of the flash that happens when the # actor loses or gains health due to the Slip Damage state. DAMAGE_FLASH_COLOR = Color.new(255, 0, 0, 64) # This allows you to change the duration (in frames) the flash remains # on-screen. DAMAGE_FLASH_DURATION = 4 end end #------------------------------------------------------------------------------# $imported = {} if $imported == nil $imported["SlipDamageExtension"] = true # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * # # Unless you know what you're doing, it's best not to alter anything beyond # # this point, as this only affects the tag used for "Notes" in database. # # * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * # # Whatever word(s) are after the separator ( | ) in the following lines are # what are used to determine what is searched for in the "Notes" section of a # skill to see if it is an Steal skill. # Default Slip Damage State tag is module KGC::SlipDamageExtension # Regular Expression Module module Regexp # State Module module State # Slip Damage tag string SLIP_DAMAGE = /<(?:SLIP|slip)\s*([HM]P)?\s*([\-\+]?\d+)([%%])? (?:\s*,\s*([\-\+]?\d+))?>/ix end end end #============================================================================== # ■ RPG::State #============================================================================== class RPG::State #-------------------------------------------------------------------------- # ○ 「スリップダメージ拡張」のキャッシュ生成 #-------------------------------------------------------------------------- def create_slip_damage_extension_cache @__slip_damage = false @__slip_damage_hp_rate = 0 @__slip_damage_hp_value = 0 @__slip_damage_hp_map = 0 @__slip_damage_mp_rate = 0 @__slip_damage_mp_value = 0 @__slip_damage_mp_map = 0 self.note.split(/[\r\n]+/).each { |line| case line when KGC::SlipDamageExtension::Regexp::State::SLIP_DAMAGE # スリップダメージ @__slip_damage = true analyse_slip_damage($~) end } # デフォルトのスリップダメージ量を設定 unless @__slip_damage @__slip_damage_hp_rate = 10 @__slip_damage_hp_map = 1 end end #-------------------------------------------------------------------------- # ○ スリップダメージの解析 #-------------------------------------------------------------------------- def analyse_slip_damage(match) # タイプ判定 if match[1] == nil type = :hp else if match[1] =~ /MP/i type = :mp else type = :hp end end # ダメージ量取得 n = match[2].to_i # 即値 or 割合判定 is_rate = (match[3] != nil) # マップダメージ取得 map_n = (match[4] != nil ? match[4].to_i : 0) # スリップダメージ値加算 case type when :hp if is_rate @__slip_damage_hp_rate -= n else @__slip_damage_hp_value -= n end @__slip_damage_hp_map -= map_n when :mp if is_rate @__slip_damage_mp_rate -= n else @__slip_damage_mp_value -= n end @__slip_damage_mp_map -= map_n end end #-------------------------------------------------------------------------- # ● スリップダメージ #-------------------------------------------------------------------------- unless $@ alias slip_damage_KGC_SlipDamageExtension slip_damage end def slip_damage create_slip_damage_extension_cache if @__slip_damage == nil return (@__slip_damage || slip_damage_KGC_SlipDamageExtension) end #-------------------------------------------------------------------------- # ○ HP スリップダメージ (割合) #-------------------------------------------------------------------------- def slip_damage_hp_rate create_slip_damage_extension_cache if @__slip_damage_hp_rate == nil return @__slip_damage_hp_rate end #-------------------------------------------------------------------------- # ○ HP スリップダメージ (即値) #-------------------------------------------------------------------------- def slip_damage_hp_value create_slip_damage_extension_cache if @__slip_damage_hp_value == nil return @__slip_damage_hp_value end #-------------------------------------------------------------------------- # ○ HP スリップダメージ (マップ) #-------------------------------------------------------------------------- def slip_damage_hp_map create_slip_damage_extension_cache if @__slip_damage_hp_map == nil return @__slip_damage_hp_map end #-------------------------------------------------------------------------- # ○ MP スリップダメージ (割合) #-------------------------------------------------------------------------- def slip_damage_mp_rate create_slip_damage_extension_cache if @__slip_damage_mp_rate == nil return @__slip_damage_mp_rate end #-------------------------------------------------------------------------- # ○ MP スリップダメージ (即値) #-------------------------------------------------------------------------- def slip_damage_mp_value create_slip_damage_extension_cache if @__slip_damage_mp_value == nil return @__slip_damage_mp_value end #-------------------------------------------------------------------------- # ○ MP スリップダメージ (マップ) #-------------------------------------------------------------------------- def slip_damage_mp_map create_slip_damage_extension_cache if @__slip_damage_mp_map == nil return @__slip_damage_mp_map end end #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★ #============================================================================== # ■ Game_Battler #============================================================================== class Game_Battler #-------------------------------------------------------------------------- # ● スリップダメージの効果適用 #-------------------------------------------------------------------------- def slip_damage_effect return unless slip_damage? slip_damage_effect_hp slip_damage_effect_mp end #-------------------------------------------------------------------------- # ○ HP スリップダメージの効果適用 #-------------------------------------------------------------------------- def slip_damage_effect_hp return if dead? n = 0 self.states.each { |state| next unless state.slip_damage n += self.maxhp * state.slip_damage_hp_rate / 100 n += state.slip_damage_hp_value } return if n == 0 @hp_damage = [n, self.hp - 1].min self.hp -= @hp_damage end #-------------------------------------------------------------------------- # ○ MP スリップダメージの効果適用 #-------------------------------------------------------------------------- def slip_damage_effect_mp return if dead? n = 0 self.states.each { |state| next unless state.slip_damage n += self.maxmp * state.slip_damage_mp_rate / 100 n += state.slip_damage_mp_value } return if n == 0 @mp_damage = [n, self.mp - 1].min self.mp -= @mp_damage end #-------------------------------------------------------------------------- # ○ 歩行時のスリップダメージの効果適用 #-------------------------------------------------------------------------- def slip_damage_effect_on_walk last_hp = self.hp last_mp = self.mp self.states.each { |state| next unless state.slip_damage self.hp -= state.slip_damage_hp_map self.mp -= state.slip_damage_mp_map } # ダメージを受けた場合はフラッシュ if self.hp < last_hp || self.mp < last_mp $game_map.screen.start_flash( KGC::SlipDamageExtension::DAMAGE_FLASH_COLOR, KGC::SlipDamageExtension::DAMAGE_FLASH_DURATION) end end #-------------------------------------------------------------------------- # ○ 歩行時の自動回復の実行 #-------------------------------------------------------------------------- def do_auto_recovery_on_walk return if dead? if auto_hp_recover self.hp += 1 end end end #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★ #============================================================================== # ■ Game_Party #============================================================================== class Game_Party < Game_Unit #-------------------------------------------------------------------------- # ● プレイヤーが 1 歩動いたときの処理 #-------------------------------------------------------------------------- def on_player_walk for actor in members if actor.slip_damage? actor.slip_damage_effect_on_walk end actor.do_auto_recovery_on_walk end end end