Help with probability for a complicated dice pool mechanic

I'm putting together a system with experimental dice mechanics. I want to know the probabilities involved, preferably in a way such as anyDice where I can easily change all variables and get the probability results without having to have a degree in maths to figure it out.

This is the simple part.

The core mechanic would be that a player puts together a pool of dice and rolls them against a target number from 2-6. Every die that equals or exceeds the target number is a hit.

Where it gets complex

In that pool are positive dice equal to the skill of the player and negative dice equal to skill of an NPC opponent. Hits on negative dice cancel out positive hits of equal or lower value. Any remaining hits are counted and used to determine results.

• Example: a player has a skill of 5 and is performing an action with a TN of 4 against an opponent with a skill of 3. This creates a pool of 5 positive dice which come up 1,2,4,4,6 and 3 negative dice that come up 2,4,5. The 1 and 2 on the positive dice are set aside as well as the 2 on the negative dice leaving 3 positive hits (4,4,6) and 2 negative hits (4,5). The negative 4 cancels out one of the positive 4s and the negative 5 cancels out the other negative 4 leaving the positive 6 for a net total of 1 positive hit.

I'm looking for the probability of getting X number of net positive hits given various numbers of positive dice, negative dice, and target numbers.

As a separate mechanic that could be layered onto the core mechanic I am considering the ability to "boost" or "drain" a pool by adding a number of dice to the positive dice (or I suppose the negative too) before the roll and then subtracting the same number of either the lowest/highest results before determining hits.

For example: if the positive dice pool of 5 was boosted by 2 you would roll 7 positive dice and drop the two lowest results before determining hits. I'm curious how much of a statistical difference this would make given different sized pools compared to changing the target number or simply adding/subtracting dice from the pool straight up.

Why do I need this?

The mechanic is actually the starting point on this one. I'm trying to see if it can be made into something functional but without solid probability data I'm mostly just playing things by ear.

Here you have it on AnyDice to test it.

Here the code. You can subsitute the "difficulty", "myroll" and "hisroll" to test different situations. Also, if you know a bit about AnyDice, can create different outputs to test how change a variation in skills or difficulty.

function: difficulty X:n myroll A:s hisroll B:s {
RESULT: 0
loop V over {X..6} {
RESULT: RESULT + (V = A) - (V = B)
}
result: RESULT
}

output [difficulty 3 myroll 3d6 hisroll 3d6]


I'll be happy to implement the Boost or Drain if you could be more specific about how it works.