EDIT: I fixed my little mistake.
Yes, programming the AI would be the difficult part. There is always that unexpected and unpredictable element.
Once again, programming the AI to overcome a set random factor doesn't make any sense. Unless you mean 'let's feed it the random numbers for the next battle'
What would we call the new parameter? The combat chaos factor? And what would the units of measure be? Degrees of chaos in percent? Would we have totally random battle at one end, and total predictability at the other?
1) Chaos factor is fine with me. Units of measure = percent.
2) Yes.
Disregarding all my previous posts on the subject so as to avoid contradiction, A new and improved system would function accordingly:
Function Agamemnsian Random Factor (ARF)
Arf Arf!
Given modded stat A and D, decide if fChaosFactor(A/D) is either smaller, bigger, or equal to 1. (with the random factors R1A and R1D, Chaos Factor C, and final value V)
If V > 1, attacker wins.
If V < 1, defender wins.
If V = 1, draw. (either both parties lose hitpoints or none, or just reroll)
Case 1
no random factor.
V = (A / D)
Case 2
Maximum random factor that can factor in A/D.
R1A = INT(RND * 100)
R1D = INT(RND * 100)
V = (A * R1D / D * R1D)
Case 3
Random factor that is limited to a certain scope.
Effectively, R2 set to 100 creates no random factor, R2 set to 95 sets a 5% random factor, etc.
R1A = INT(RND * [100-C]) + C
R1D = INT(RND * [100-C]) + C
V = (A * R1A / D * R1D)
Final function:
fChaosFactor(A/D) = [(A/D) * INT(RND * [100-C]) + C] / [INT(RND * [100-C])+ C]
------------------------------------------------------------------
Reference for those of you who don't know QBASIC:
i = INT(RND * n)
i = output random variable
n = choose variable from 0 to n.
This is all INTEGER RANDOM NUMBERS, of course, so:
i = INT(RND * 1) gives you either a 1 or a 0, not something like .35735635.