Thank You for your interest !
I have determined, that it is not about double calculations loop, but about next Pincher using previous Pinchers calculated statistics as its base, and so on. Here I am pasting code :
Pinchers ready :
func _ready():
$Stats.scalestats(lvl)
Leading to mentioned STATS class :
func scalestats(lvl):
#print(stablestatistics)
for key in stablestatistics.keys():
setstablestat(key,stablestatistics[key] *lvl)
get_parent().health = currenttotal["maxhealth"]
func setstablestat(stat,amount):
stablestatistics[stat] += amount
stabletotal[stat] += amount
setcurrentstat(stat,amount)
func setcurrentstat(stat,amount):
currentstatistics[stat] += amount
currenttotal[stat] += amount
#print(stat,amount)
updatecalc()
func updatecalc():
currenttotal["mindmg"] = int(stabletotal["mindmg"] *( (currentstatistics["strength"] + 100)/100))
currenttotal["maxdmg"] = int(stabletotal["maxdmg"] *( (currentstatistics["strength"] + 100)/100))
currenttotal["critchance"] = stabletotal["critchance"] + currentstatistics["dexterity"]/100.0 + currentstatistics["luck"]/100.0
currenttotal["maxhealth"] = stabletotal["maxhealth"] + currentstatistics["vitality"] * 5.0
Autoload.luck = currenttotal["luck"]
currenttotal["maxmana"] = stabletotal["maxmana"] + currentstatistics["intellect"]*5.0
if get_parent().has_method("currentfield"):
Autoload.emit_signal("statsupdated",stabletotal,currenttotal)
Looks intimidating but these are just hierarchized subroutines, calculations must be done in order, since statistics depend on each other on different levels. Problem lies in mentioned "stablestatistics", highest hierarchy diciotnary. Print in 2nd line shows that starting stablestatistics for every next instance come from former instance. Pinchers have in export{S:10,I:7,D:5}, they all are level 6. First pincher ends correctly with {S:70,I:49,D:35}, next one {S:490,I:340,D:240}, and so on.
The only differences between Pinchers are in exported stablestatistics. But error occured even if I made them have the same exported values. Maybe STATS onready caclculation will also be helpful, this happens before Pinchers are ready and call scalestats :
func _ready():
for dict in [currentstatistics,currentaffinities,currentmisc,currentresists,currentvarious,currentimmunities]:
for key in dict.keys():
currenttotal[key] = dict[key]
for dict in [stablestatistics,stableaffinities,stablemisc,stableresists,stablevarious,stableimmunities]:
for key in dict.keys():
stabletotal[key] = dict[key]
What this does is gather all exported values into compact dictionaries, stabletotal being base for calculations and currentotal being current values with applied calculations
What makes red and brown pinchers share their "stablestatistics" ? They share it only across scene, like - brown pinchers using brownpinchers stats, red pinchers using red pinchers stats. It is like this variable would reference one dictionary common for whole inherited scene, like something is wrong with property path. I tred using duplicates but it didn;t help.