Using stat calcs and a rule would be something like:
stat calc for heroes (this will count how many heroes there are):
Unique ID: scTotHero
Scope: unit
Test expression: tagGroup.hero
Tally expression: @value = @value + 1
stat calc for fighters (this works out how many points spent on fighters):
Unique ID: scTotFight
Scope: unit
Test expression: tagGroup.fighters
Tally expression: @value = @value + this.cost[total]
Rule:
Message: You can only take one Hero for every 100 points spent on Fighters
Summary: 1 Hero per 100 points
Script:
~ define variables
var totHero as number
var totFighter as number
var upperLim as number
~ get values
totHero = statcalc[scTotHero]
totFighter = statcalc[scTotFight]
upperLim = round(totFighter/100, 0, 1)
~ check values
if (totHero <= upperLim) then
@valid = 1
endif
I've tested this and it does work, it does assume that you need Fighters to take a Hero so no Fighters = no Hero and also it works on the basis of:
0 - 100 points = 1 Hero
101 - 199 points = 2 Heroes
etc, if this assumption is wrong you can adjust the round statement so it rounds down instead
I'll put the minmax script for a profile up later on, off out now for family time
