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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...