Sorry, I'm not reading code to clearly at the moment, this looks a bit complicated. Might be because it's early though. My suggestion is to keep it simple. If advantages take away from the value then they should be a positive number (if you're adding all the costs up). This would mean disadvantages should be a negative value, since they subtract from the total spent.
You'll also want to keep a running tab of all the disadvantage points spent, which is probably best done using abs().
One other option is to do it like this when you declare cp as a trait.
var advantages as number
var disadvantages as number
var characterpoints as number
characterpoints = advantages - disadvantages
The code is a little off, but I think you get the point.
|