Scripting battles: How to manipulate targeting and apply conditional states?

Hi, first post. 😀

So what I'm trying to do here is two different things, but both seem to be roughly along the same lines so they're both being asked in this thread--both are related to manipulating skill effects via script to accomplish things that don't seem to be possible otherwise:

1) The "Deck of Cards" effect, where one skill has a chance to trigger different effects at random. Now I'm aware of Yanfly's Shades of Black trick, but this particular approach only seems to work properly for single target abilities and does not adjust the scope to reflect the new ability. What I need to do is also change the scope, so that the base ability (what the player uses) starts at "none" (ideally) or "user" (less ideal) then, after the random effect is selected, the scope is changed to reflect the skill being invoked. So if I have an ability, "Chance" which has a 25% chance to cast a single-target heal on the user, a 25% chance to cast a regen effect on all allies, or a 50% chance to cast a fire spell on all enemies, each of these effects will be applied to the proper target instead of using whichever scope the Chance skill had.

2) Conditional states, or applying effects directly via script. This doesn't seem like it should be that difficult, but it is for some reason. I'd like to be able to apply a state (or damage) to a target directly with scripting for a few of my abilities. To give an example, I have a spell based on FF6's Ragnarok esper: It instantly kills an enemy and transforms it into an item (based on note tag), but rather than basing it on chance, I'm basing it on the enemy's current/max HP (the exact ratio also varies by enemy and is conveyed via note tag). Everything with this script works perfectly except for the "make the target actually die" part. As in: if (target.hp / target.mhp <= hpThresholdListedInTargetsNoteTag) target.plsDieAlready();

For reference, I'm mostly using Yanfly plugins, specifically YEP_SkillCore for access to the eval note tags. I'm also no stranger to javascript. While I could probably figure both of these out on my own with enough time (days/weeks later!), I figured I'd try asking here in case anyone already happens to know the answer. I've already tried searching, but to no avail.

Thanks for reading, and if there's any more information I can provide, feel free to say so. 🙂

Original thread: https://forums.rpgmakerweb.com/threads/scripting-battles-how-to-manipulate-targeting-and-apply-conditional-states.95166/