Requiring Sword/Shield and 2 Combo Stacks (Modified Yanfly T&T)

Tl;Dr: Is it possible to and how do I change the code at the bottom of this post to check only the main hand slot and not all currently equipped weapons?

One of my classes is currently using a version of Yanflys Tips and Tricks Combo Attack. One of the attacks for this class I need to have the requirement: sword and shield + 2 combo points.

I have the skill set up to require a shield (I am currently using maldualwield to allow shields to be weapons). For all purposes the shield is being treated as a weapon. Now the code below works, just not as intended.

I basically spliced together two yanfly tips and tricks codes (Truthseeker and Combo Attack) to try and get what I wanted as I am still learning all these functions and calls.

How I wanted it to work: The shield requirement is on the skill in rpg maker mv. Then I check if currently equipped weapon is a sword type, then check if the user has 2 combo points then allow the skill to be used.

What it is doing: It is checking both weapons and returning false for if (weapon && weapon.wtypeId === swordTypeId) because I am using two weapons (1 sword and 1 shield).

What is working: The shield requirement, the weapon check itself, the skill, the cost all function properly with no errors and all of the plugins function as inteded.

What isn't working: The code needs to check only the main hand and not the off hand.

What is the question: How do I check only the weapon equipped in the main hand slot?


------------------------------------Custom Requirement Code-------------------
<Custom Requirement>

var swordTypeId = 2;

var weapons = user.weapons();

for (var i = 0; i < weapons.length; ++i) {

var weapon = weapons;

if (weapon && weapon.wtypeId === swordTypeId) {

user._comboStacks = user._comboStacks || 0;

value = user._comboStacks >= 2;

} else {

value = false;

}

}

</Custom Requirement>
------------------------------------------------------------------------------------------------
I made a function for my own project to determine weapon type placements for actors. I can update my dual weild plugin to add it on.

EDIT: Annnnnd done!
Go ahead and redownload the updated plugin.

Afterwards, you can try this as your code (I'm assuming the Sword type's weapon ID is 2)

Code:
<Custom Requirement>
if (user.isWeaponEquipped(2) == 0) {
user._comboStacks = user._comboStacks || 0;
value = user._comboStacks >= 2;
} else {
value = false;
}
</Custom Requirement>
Works perfectly, thanks for your help.

Original thread: https://forums.rpgmakerweb.com/threads/requiring-sword-shield-and-2-combo-stacks-modified-yanfly-t-t.88091/