# 1224Deko - Hamedo miniscript v1.00
#
# This script overrides Scene_Battle and def invoke_item in it.
# No credits needed.
# Inspired from this thread:
#
http://www.rpgmakervxace.net/topic/16995-taking-damage-when-counterattacking/
# So it would be nice if you credit xShinryu and P Bevans.
#
# Setup:
# Each State must have Ex. Param. CNT +100% in Features to Working.
# Exchange ID States in module Hamedo to your owns.
#
# Add 3 ways of counter-attack mechanism
#
# Evade and Counter: Default mechanism. Probably no-needed. Add only for priority.
# Hamedo: Character Deals damage before taking damage.
# Counter Attack: Both deals damage.
#
# If you use only another ID state with CNT ratio, will be working like default mechanism.
$imported = {} if $imported.nil?
$imported["HamedoState"] = true
module Hamedo
# Setup Evade and Counter state ID
EAC = 74
# Setup Hamedo state ID
HAMEDO_STATE = 75
# Setup Counter Attack State ID - Damage taken before Countering
CNT_ATK = 18
end
class Scene_Battle < Scene_Base
def invoke_item(target, item)
# Evade and Counter damage
if rand < target.item_cnt(@subject, item) && target.state?(Hamedo::EAC)
# apply_item_effects(apply_substitute(target, item), item)
if target.hp > 0
invoke_counter_attack(target, item)
end
# Hamedo Status
elsif rand < target.item_cnt(@subject, item) && target.state?(Hamedo::HAMEDO_STATE)
# apply_item_effects(apply_substitute(target, item), item)
if target.hp > 0
invoke_counter_attack(target, item)
end
if subject.hp > 0
apply_item_effects(apply_substitute(target, item), item)
end
# Counter Attack section
elsif rand < target.item_cnt(@subject, item) && target.state?(Hamedo::CNT_ATK)
apply_item_effects(apply_substitute(target, item), item)
if target.hp > 0
invoke_counter_attack(target, item)
end
# Original Counter-Attack Mechanism
# Original invoke_item
elsif rand < target.item_cnt(@subject, item)
invoke_counter_attack(target, item)
elsif rand < target.item_mrf(@subject, item)
invoke_magic_reflection(target, item)
else
apply_item_effects(apply_substitute(target, item), item)
end
@subject.last_target_index = target.index
end
end