Game mechanics-story separation more like. You can't give a character with low initial Int minus Int.
//Grab the character's stats pre-Treatment
int preTreatedSmarts = pc.intelligence;
int preTreatedWill = pc.willpower;
//Smart characters lose less, dumb characters lose more
if(pc.intelligence > 0.8*pc.maxIntelligence) {
int smartsToLose = preTreatedSmarts * 0.2;
} else if(pc.intelligence > 0.5*pc.maxIntelligence) {
int smartsToLose = preTreatedSmarts * 0.5;
} else {
int smartsToLose = preTreatedSmarts * 0.8;
}
//Again for Willpower
if(pc.willpower > 0.8*pc.maxWillpower) {
int willToLose = preTreatedWill * 0.2;
} else if(pc.willpower > 0.5*pc.maxWillpower) {
int willToLose = preTreatedWill * 0.5;
} else {
int willToLose = preTreatedWill * 0.8;
}
//Sanity check: don't go below 1 in the stat
if(preTreatedSmarts - smartsToLose < 1) {
smartsToLose = preTreatedSmarts - 1;
}
if(preTreatedWill - willToLose < 1) {
willToLose = preTreatedWill - 1;
}
//Run additional sanity checks when actually inflicting the stat losses just in case the player does something else to make themselves stupid at the same time
Could do it like this.