# ▼▲▼ XRXS17. スリップダメージ防御/効果量詳細化 ver.1.9 ▼▲▼ built101021 # by 桜雅 在土 #============================================================================== # --- XRXS. スリップダメージ詳細化 --- #============================================================================== module XRXS17 #-------------------------------------------------------------------------- # △ カスタマイズポイント #-------------------------------------------------------------------------- SLIP_NAME = "スリップ" # スリップステート名称 SLIP_VARY = 0 # スリップダメージ乱数幅(0推奨) BASE_SLIP_DAMAGE = "15%" # 指定しない時のスリップダメージ FLASH_SET = Color.new(160, 34, 34, 128) # フラッシュの色 DEAD_OK = true # 戦闘不能になり得るか BATTLE = "戦闘中" # 戦闘中名称 MAP = "移動中" # 移動中名称 #-------------------------------------------------------------------------- # ○ 指定バトラーのスリップダメージの効果量の取得 #-------------------------------------------------------------------------- def self.slip_amount(battler, scene) # 数値の初期化 slip_damage_percent = 0 slip_damage_plus = 0 slip_spdamage_percent = 0 slip_spdamage_plus = 0 # バトラーのステートを取得 for state_id in battler.states # ステートの取得 state = $data_states[state_id] # スリップダメージ有りの場合 if state.slip_damage # そのステートが持っているスリップダメージの # LvプラスステートまたはLvマイナスステートを判定。 for j in state.plus_state_set # プラスステートの取得 plus_state = $data_states[j] if plus_state != nil if plus_state.name =~ /^(#{scene})?(#{$data_system.words.sp})?#{self::SLIP_NAME}([+-]?([1-9]\d*|0)\.?\d*)[%%]?$/ if scene == $1 or $1 == "" if $1 == "" and scene == XRXS17::MAP slip = ($3.to_i / 4.0) else slip = $3.to_i end if $2 != "" if $5 != "" slip_spdamage_percent += slip else slip_spdamage_plus += slip end else if $5 != "" slip_damage_percent += slip else slip_damage_plus += slip end end end end end end for j in state.minus_state_set # マイナスステートの取得 minus_state = $data_states[j] if minus_state != nil if minus_state.name =~ /^(#{scene})?(#{$data_system.words.sp})?#{self::SLIP_NAME}(\d[1-9]+?\.?\d+?)(%|%)?$/ if scene == $1 or $1 == "" if $1 == "" and scene == XRXS17::MAP slip = ($3.to_i / 4.0) else slip = $3.to_i end if $2 != "" if $5 != "" slip_spdamage_percent -= slip else slip_spdamage_plus -= slip end else if $5 != "" slip_damage_percent -= slip else slip_damage_plus -= slip end end end end end end end end # ダメージを計算(軽減無しで0の場合、都合上nilにする) damage = (battler.maxhp * slip_damage_percent / 100 + slip_damage_plus) damage = nil if damage == 0 spdamage = (battler.maxsp * slip_spdamage_percent / 100 + slip_spdamage_plus) spdamage = nil if spdamage == 0 # 防具がスリップ防御がある場合を判定(競合対策に仕様を改変) wakaran = guard_check(damage.abs, spdamage.abs) if damage < 0 wakaran[0] = -wakaran[0] end if spdamage < 0 wakaran[1] = -wakaran[1] end return wakaran end def guard_check(damage = nil, spdamage = nil) if self.method_defined?("armor_ids") for i in self.armor_ids # 防具の取得 armor = $data_armors[i] # 防具が無い場合は次へ next if armor == nil # 防御属性を検索 for j in armor.guard_state_set if $data_states[j] != nil if $data_states[j].name =~ /^#{self.SLIP_NAME}([+-]?\d[1-9]*\.?\d*)([%%])?$/ if $2 != nil if slip_damage_percent > 0 if damage != nil damage = damage * (100 + $1.to_i) / 100 end if spdamage != nil spdamage = spdamage * (100 + $1.to_i) / 100 end end else if slip_damage_plus > 0 if damage != nil damage -= $1.to_i end if spdamage != nil spdamage -= $1.to_i end end end end end end end end damage = [damage, 0].max spdamage = [spdamage, 0].max return [damage.round, spdamage.round] end end #============================================================================== # ■ Game_Battler #============================================================================== class Game_Battler #-------------------------------------------------------------------------- # ● スリップダメージの効果適用 [完全再定義] #-------------------------------------------------------------------------- def slip_damage_effect # スリップ効果量の取得 slip_damage = XRXS17.slip_amount(self, XRXS17::BATTLE) # スリップダメージが指定されていなかった場合 if slip_damage == [nil, nil] # ダメージを設定 if XRXS17::BASE_SLIP_DAMAGE =~ /^(\d[1-9]+?\.?\d+?)(%|%)$/ damage = (self.maxhp * $1.to_i / 100).round elsif plus_state.name =~ /^(\d[1-9]+?\.?\d+?)$/ damage = $1.to_i.round else return end self.damage = guard_check(damage.abs)[0] if damage < 0 self.damage = -self.damage end if self.damage != 0 # 分散 if self.damage.abs > 0 amp = [self.damage.abs * XRXS17::SLIP_VARY / 100, 0].max self.damage += rand(amp * 2 + 1) - amp end else self.damage = "Guard" end # HP からダメージを減算 self.hp -= self.damage else if slip_damage[0] != nil if slip_damage[0] != 0 # ダメージを設定 self.damage = slip_damage[0] # 分散 if self.damage.abs > 0 amp = [self.damage.abs * XRXS17::SLIP_VARY / 100, 0].max self.damage += rand(amp * 2 + 1) - amp end else self.damage = "Guard" end end # HP からダメージを減算 self.hp -= self.damage end if self.class_method_defined?("sp_damage") and slip_damage[1] != nil if slip_damage[1] != 0 # SPダメージを設定 self.sp_damage = slip_damage[1] # 分散 if self.sp_damage.abs > 0 amp = [self.sp_damage.abs * XRXS17::SLIP_VARY / 100, 0].max self.damage += rand(amp * 2 + 1) - amp end # SP からダメージを減算 self.sp -= self.sp_damage else self.sp_damage = "Guard" end end # メソッド終了 return end #-------------------------------------------------------------------------- # ○ 回復スリップをスリップダメージ判定から一時的に除外 #-------------------------------------------------------------------------- def xrxs17_minus_slip_check_ban=(b) @xrxs17_minus_slip_check_ban = b end end #============================================================================== # ■ Game_Party #============================================================================== class Game_Party #-------------------------------------------------------------------------- # ● スリップダメージチェック (マップ用) #-------------------------------------------------------------------------- def check_map_slip_damage # 回復スリップをスリップダメージ判定から一時的に除外 @actors.each {|actor| actor.xrxs17_minus_slip_check_ban = true} for actor in @actors # もしかして不備があった? if actor.hp > 0 and actor.slip_damage? slip_damage = XRXS17.slip_amount(actor, XRXS17::MAP)[0] if XRXS17::DEAD_OK actor.hp -= slip_damage else actor.hp -= [slip_damage, (actor.hp - 1)].min end unless actor.xrxs17_minus_slip_check_ban and slip_damage > 0 $game_screen.start_flash(XRXS17::FLASH_SET, 4) end $game_temp.gameover = $game_party.all_dead? end if actor.sp > 0 and actor.slip_damage? slip_spdamage = XRXS17.slip_amount(actor, XRXS17::MAP)[1] actor.sp -= slip_spdamage unless actor.xrxs17_minus_slip_check_ban and slip_spdamage > 0 $game_screen.start_flash(XRXS17::FLASH_SET, 4) end end end $game_temp.gameover = $game_party.all_dead? # 回復スリップをスリップダメージ判定へ復帰 @actors.each {|actor| actor.xrxs17_minus_slip_check_ban = nil} end end #============================================================================== # ■ Game_Player #============================================================================== class Game_Player < Game_Character #-------------------------------------------------------------------------- # ● 歩数増加 #-------------------------------------------------------------------------- alias :xrxs17_increase_steps :increase_steps def increase_steps xrxs17_increase_steps unless and $game_party.steps % 2 == 1 # スリップダメージチェック $game_party.check_map_slip_damage end end end end