System
In this system, we'll be rolling only two custom d6s to determine the outcomes. Each d6 can show 3 types of symbols that we are calling A (bad outcome), B (good outcome), and C (null, but can be converted to either) for now. Some faces might have 2 different symbols, like A and C, or also a pair of the same symbols, like 2 Cs.
When you roll the dice, you apply both results. So let's say that I roll an A and a B, what happens is one bad outcome and one good outcome. Two As would give me 2 bad outcomes and so on. If I rolled an A and a C, only a bad outcome would happen, since Cs are worthless unless I have some way to convert it into B (special ability, resource, etc).
Program
function: convertc C:s LIMIT:n {
loop I over C {
if I <= LIMIT {
C: C - 1
result: 1
}
}
result: 0
}
function: outcome ROLL:s {
A: 0
B: 0
C: 0
\ FACES \
loop I over ROLL {
if I = 1 { A: A + 1 }
if I = 2 { B: B + 1 }
if I = 3 { C: C + 1 }
if I = 4 { C: C + 1 }
if I = 5 { C: C + 1 }
if I = 6 {
A: A + 1
C: C + 1
}
}
\ Conversion of Cs to Bs to represent bonuses \
if LIMIT > 0 {
B: B + [convertc C LIMIT]
}
\ Sorting outcomes \
if C = 0 {
if B = 0 { result: -100 } \ Only As rolled \
if A = 0 { result: 100 } \ Only Bs rolled \
if B >= (A * 2) { result: 100 }
if A >= (B * 2) { result: -100 }
if B = A { result: 0 }
}
if B > 0 {
if A = 0 { result: 100 }
if B >= (A * 2) { result: 100 }
}
if A > 0 {
if B = 0 { result: -100 }
if A >= (B * 2) { result: -100 }
}
if B = A { result: 0 }
result: 999 \ Default result \
}
output [outcome 2d6]
The program primarily keeps track of three variables: A, B, and C.
To emulate cases where the player would have a number of Cs converted into Bs, the program uses a function where Cs are deducted and added to Bs based on a manually specified LIMIT (ie. the maximum amount of conversions possible).
After that, the program applies sorting rules to narrow down the final result into 3 categories: -100 is mostly bad outcomes, 0 is a balance between good and bad, and 100 is mostly good outcomes. I'm narrowing down to those three just to achieve a solid balance before I can start opening up for more granularity.
Problem
After a long battle I've managed to make the program work somewhat as intended, but I feel like I reached to my limit (both in programming skills and energy). See, the problem is when I'm inputting a LIMIT of conversions over 2, in that case, the results don't change no matter how I setup the amount each C is worth in the dice symbol distribution. If for example I change
if I = 3 { C: C + 1 }
to
if I = 3 { C: C + 3 }
The output is the same for LIMIT = 3 than it is for LIMIT = 1. It's like it only converts a C only once, regardless if it is worth 2 or more.
Is it a problem on the function that converts the Cs into Bs? Or is it a logic problem? Does anyone knows how to fix this problem?