#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
#_/ ◆ Recover on Guard - KGC_GuardRecover ◆ VX ◆
#_/ ◇ Last Update: 2008/08/10 ◇
#_/ ◇ Translated by Mr. Anonymous ◇
# Modified by SaburoX on 4/10/2015
#_/-----------------------------------------------------------------------------
#_/ This script allows you to add HP/MP Recovery percentiles to the battle
#_/ guard/defend command.
#_/ * Note from the translator: I had previously ported this script myself,
#_/ this official KGC port however, is a bit more cleanly coded.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
#==============================================================================#
# ★ Customization ★ #
#==============================================================================#
module KGC
module GuardRecover
# KGC Skill CP Compatibiltiy - These are the Skill IDS the player needs to
# equip via the CP system to get the effects.
MEDIGUARD_ID = 132 # Recover HP when defending
MANAGUARD_ID = 133 # Recover MP when defending
# ◆ Default Recovery Rate [In Percentile]
HP_DEFAULT_RATE = 0
MP_DEFAULT_RATE = 0
# ◆ HP Recovery Rate [In Percentile]
HP_RATE_ACTOR = 5
# ◆ MP Recovery Rate [In Percentile]
MP_RATE_ACTOR = 5
end
end
#=================================End Module===================================#
$imported = {} if $imported == nil
$imported["GuardRecover"] = true
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ○ Defending Recovery Calculation
# hp_rate : HP Recovery Rate
# mp_rate : MP Recovery Rate
#--------------------------------------------------------------------------
def make_guard_recover_value(hp_rate, mp_rate)
recover_hp = maxhp * hp_rate / 100
if hp_rate > 0
recover_hp = [1, recover_hp].max
elsif hp_rate < 0
recover_hp = [-1, recover_hp].min
end
recover_mp = maxmp * mp_rate / 100
if mp_rate > 0
recover_mp = [1, recover_mp].max
elsif mp_rate < 0
recover_mp = [-1, recover_mp].min
end
@hp_damage -= recover_hp
@mp_damage -= recover_mp
end
end
#==================================End Class===================================#
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ○ Apply Recovery Effect
#--------------------------------------------------------------------------
def guard_recover_effect
clear_action_results
if battle_skill_ids.include?(KGC::GuardRecover::MEDIGUARD_ID) #If the HP Recover skill is equipped
if battle_skill_ids.include?(KGC::GuardRecover::MANAGUARD_ID) #If the MP Recover skill is equipped
make_guard_recover_value(
KGC::GuardRecover::HP_RATE_ACTOR, # If both skills are equipped,
KGC::GuardRecover::MP_RATE_ACTOR) # recover both.
else
make_guard_recover_value(
KGC::GuardRecover::HP_RATE_ACTOR, # If Just HP Recover skill is equipped,
KGC::GuardRecover::MP_DEFAULT_RATE) # recover only HP.
end
else
if battle_skill_ids.include?(KGC::GuardRecover::MANAGUARD_ID) #If only the MP Recover skill is equipped
make_guard_recover_value(
KGC::GuardRecover::HP_DEFAULT_RATE, # Do not recover HP
KGC::GuardRecover::MP_RATE_ACTOR) # Recover MP
else
make_guard_recover_value( # If neither HP or MP skill is equipped
KGC::GuardRecover::HP_DEFAULT_RATE,
KGC::GuardRecover::MP_DEFAULT_RATE) # Use the default recovery rates for HP and MP
end
end
execute_damage(nil)
end
end
#==================================End Class===================================#
# Enemy Content Removed
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ● Execute Battle Action: Guard
#--------------------------------------------------------------------------
alias execute_action_guard_KGC_GuardRecover execute_action_guard
def execute_action_guard
execute_action_guard_KGC_GuardRecover
@active_battler.guard_recover_effect
if @active_battler.hp_damage != 0
display_damage(@active_battler) # Pretty sure this is where HP recovery goes.
elsif @active_battler.mp_damage != 0
display_mp_damage(@active_battler) # And same with MP
end
end
end