by NinjaMH » 13 Jul 2014, 18:09
Unsure how they code or what language is used, but to me it seems simple enough.
AffectionPoints = Some set number
GiveAll (NumberOfPresents)
CurrentAffection = CurrentAffection + (NumberOfPresents * AffectionPoints)
//The while loop should take care of putting a lot at once and leveling up multiple times
while CurrentAffection >= NeededAffection
//Increase level
CurrentAffection = CurrentAffection - NeededAffection
NeededAffection = //The Next Affection value needed
For example:
CurrentAffection = 0
NeededAffection = 400
AffectionPoints = 10
GiveAll (100)
CurrentAffection = 0+100*10 = 1000
//First loop iteration
1000 >= 400
CurrentAffection = 1000-400 = 600
NeededAffection = 500
//Second loop iteration
600 >= 500
CurrentAffection = 600-500 = 100
NeededAffection = 600
//Loop ends because 100 is not >= 600
//Leveled up twice
CurrentAffection is 100 out of 600
Something like that, again unsure how they code/language used.