To make a long story short,using yanflys autopassives and buffs and states plugins,I'm making a passive state for a trinket that makes the user repeat their last used skill at the end of each turn with the repeated action dealing 50% less damage and not costing any mp or tp (with the help of state number 298 as you can see in the notetag code down below), however to not make it too broken I've made some restrictions,For starters the used skill needs to be certain, physical and magical, secondly a repeated skill will not repeat at the end of the next turn on the condition that the user guards or uses the attack button or use an item as his last used action,it works fine except for one thing that being that the user's repeated skills still repeat even after using an item rather than not using a skill at all,I tried looking through the functions and labels and this is the best I've gotten so far in the notetag code is there something I'm writing wrong that's preventing the skill from being stopped when using an item ?
Code:
<Custom Turn End Effect>
if (user._lastBattleSkill && user._lastBattleSkill.isSkill()) {
var skill = user._lastBattleSkill;
var stype = $dataSkills[skill._itemId].stypeId;
if ([1, 2, 3].includes(stype)) {
if (user._lastTargetIndex >= 0 && $gameTroop.members()[user._lastTargetIndex] && $gameTroop.members()[user._lastTargetIndex].isAlive()) {
user.addState(298);
BattleManager.queueForceAction(user, skill._itemId, user._lastTargetIndex);
} else {
user.addState(298);
BattleManager.queueForceAction(user, skill._itemId, -1);
}
}
}
</Custom Turn End Effect>