First, the counterattack system needs to be removed completely. Changing the invoke item will do the work.
Code:
def tsbs_invoke_item(target, item, subj = @subject)
return if item.nil?
if rand < target.item_mrf(subj, item)
tsbs_invoke_mreflect(target, item)
else
tsbs_apply_item(tsbs_apply_substitute(target, item, subj), item, subj)
end
end
Based on the sequence phases I put above, how would you put each of them?
Is the evasion calculated before the main sequence is played? or right before the item is applied?
Likewise, I think I have put the "lunatic object after effect after" the sequence. If it wasn't in the right place, idk where else I should put the compatibility.
For counterattack, you can try to make your own formula. But your order of wording seems contradictive. Here, you first want to clear the action data, then counterattack. But in the first sentence is the opposite. Regardless, here are what you need and how if you want to proc a reaction skill.
Determine :
> Who is the subject that will do the action sequence
> What is the item/skill they will use?
> Who is the target?
For fun, I just try to modify the post-main sequence.
Code:
class Scene_Battle
def tsbs_action_post(targets, item, subj)
# Proc an action (Hardcoded)
battler = $game_troop.members[0] # Who? Troop member index 1
battler.item_in_use = copy($data_skills[1]) # What to use? skill ID 1
battler.target = subj # Who is the target?
battler.battle_phase = :skill # Settled? now go action!
wait_for_sequence # Let's watch the sequence
battler.battle_phase = :return # If done, returning to the original position
# Determine if item has no return sequence
subj.break_action = false if subj.break_action
unless item.no_return? || subj.battle_phase == :forced
subj.battle_phase = :return
else
subj.battle_phase = :idle
end
wait_for_sequence
end
end
Of course, the who can be anyone, and depends on how you executed it.
You can do something like this as well. So that everyone will react to you
Code:
class Scene_Battle
def tsbs_action_post(targets, item, subj)
# Proc an action
$game_troop.members.each do |battler|
battler.item_in_use = copy($data_skills[1])
battler.target = subj
battler.battle_phase = :skill
end
wait_for_sequence
$game_troop.members.each do |battler|
battler.battle_phase = :return
end
# Determine if item has no return sequence
subj.break_action = false if subj.break_action
unless item.no_return? || subj.battle_phase == :forced
subj.battle_phase = :return
else
subj.battle_phase = :idle
end
wait_for_sequence
end
end
The downside is that the damage counter will also need to rework because the damage counter will add all of them as well.
The upside is, maybe you can also use this to create a followup skill?
I'm not sure by the attack strike, you mean proc the skill 2.25 times, i.e, it has 2 instances of attack or it's basically a single attack but hits 2 times. If it's the latter, it's as easy as making a custom sequence conditional branch like.
Code:
[:if, "rand <0.25", "ExtraActionCode"]
EDIT:
If I'm going to be honest, I don't really get/agree to the whole Game_Action code in the default script and how they're being used. I used it merely because the targeting algorithm is there (and maybe for compatibility).