=begin #============================================================================== ** Effect: Win Recovery Author: Hime Date: Nov 3, 2012 ------------------------------------------------------------------------------ ** Change log Nov 3, 2012 - initial release ------------------------------------------------------------------------------ ** Terms of Use * Free to use in non-commercial projects * Contact me for commercial use * No real support. The script is provided as-is * Will do bug fixes, but no compatibility patches * Features may be requested but no guarantees, especially if it is non-trivial * Preserve this header ------------------------------------------------------------------------------ ** Required -Effect Manager (http://himeworks.com/2012/10/05/effects-manager) ------------------------------------------------------------------------------ This script allows you to restore a certain percentage of HP or MP after winning a battle. Tag effect objects with Where percent is a float, eg: 0.2 for 20%, 1 for 100%. #============================================================================== =end $imported = {} if $imported.nil? $imported["Effect_WinRecovery"] = true #============================================================================== # ** Configuration #============================================================================== module Effects module Win_Recovery Effect_Manager.register_effect(:win_recover, 2.1) end end #============================================================================== # ** Rest of the script #============================================================================== class RPG::BaseItem # Check whether the operator is valid def add_effect_win_recover(code, data_id, args) case args[0].downcase when "hp" data_id = 0 when "mp" data_id = 1 else data_id = -1 end args[1] = args[1].to_f add_effect(code, data_id, args[1]) end end class Game_Battler def state_effect_win_recover_battle_end(state, effect) if effect.data_id == 0 amount = (self.mhp * effect.value1).to_i self.hp += amount elsif effect.data_id == 1 amount = (self.mmp * effect.value1).to_i self.mp += amount end end end