Jump to content

code for tech and aura modifications


Recommended Posts

Not sure if this is the right subforum (perhaps the mod subforum is suited better).

AFAIK currently techs allow the modifications "add", "multiply" and "replace" and auras "add" and "multiply". The problem with "multiply" for techs is that it is calculated on base stats, not on current stats (as I explained here). I would like to differentiate between e.g. "multiply-base" and "multiply-current", but either I couldn't find the right place in the code or I'm a bigger noob than I thought. I looked in simulation/components/TechnologyManager.js and simulation/helpers/ValueModification.js as well as some C++ source files, but couldn't find similar code like this (taken from AuraManager.js):

	if (data.add)
		cache.get(classes).get(key).add += data.add;
	if (data.multiply)
		cache.get(classes).get(key).multiply *= data.multiply;

My C++ and JS skills are quite limited but I would try to change the multiply operation for technologies if I knew where to look for it...

Edited by Palaxin
Link to comment
Share on other sites

I think I finally found it in globalscripts/Technologies.js :)

			if (modification.multiply)
				retValue += (modification.multiply - 1) * propertyValue;
			else if (modification.add)
				retValue += modification.add;
			else if (modification.replace !== undefined) // This will depend on ordering because there is no choice
				retValue = modification.replace;

 

Link to comment
Share on other sites

Auras work on tech-modified values, but they do change their own values similarly to techs.

Auras always do (value * multiply + add), which is basically the same as the tech modifications, except that the tech modifications get calculated per tech, while the aura modifications are just reduced to one multiplier and one adder per changed value.

It is important that you have a defined order in your code, so two different computers don't calculate a different value because they use a different order of techs. It doesn't really matter whether you first add and then multiply, or the other way around, but it matters that you have a defined order of operations.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...