Commit graph

14 commits

Author SHA1 Message Date
Ralph Sennhauser
5a9968f88d Fix eslint rule 'prefer-const' in simulation/helpers
eslint --no-config-lookup --fix --rule '"prefer-const": 1' \
    binaries/data/mods/public/simulation/helpers

Ref: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-05-11 08:50:27 +02:00
wraitii
e16c4c4800 Add a system component to handle stat modifiers, make technologies and auras use this common interface.
The ModifiersManager system component provides an interface to add and
remove modifiers, and get modified stats.
The goal is to merge all the different stat-modifying systems 0 A.D. has
implemented over the years.
This commit makes technologies and auras use ModifiersManager. Some
cheats and AI bonuses also have a similar stat-modifying effect that
have not yet been updated.

Further, this system component makes it possible for e.g. triggers to
easily add modifiers, enabling the writing of Castle Blood Automatic,
RPG or Tower Defense maps without the need for mods or hacks.

The 'Modifier' name was preferred over 'Modification' as it is shorter
and more readable, along with the logic that 'modifiers' store
'modifications' and this stores modifiers. Renaming of other functions
and classes has been left for future work for now.

Internally, this uses a JS data structure. If performance issues arise
with it in the future, this data structure or the whole component could
be moved to C++.
The performance has been tested to be about as fast as the current
implementations (and specifically much faster for global auras with no
icons). Testing showed that sending value modification messages was by
far the slowest part.

Comments by: leper, Stan, elexis
Differential Revision: https://code.wildfiregames.com/D274
This was SVN commit r22767.
2019-08-24 07:37:07 +00:00
fatherbushido
4a81397537 Remove the ApplyValueModifiationsToPlayer helper function which is redundant. Reviewed by bb.
Differential Revision: ​https://code.wildfiregames.com/D543
This was SVN commit r19924.
2017-07-29 17:04:01 +00:00
fatherbushido
f83897d4b2 Fix an issue with technology modifications. Modifications for the player entity were handle by auras but not by technologies. Reviewed by mimo.
Differential Revision: https://code.wildfiregames.com/D504
This was SVN commit r19637.
2017-05-22 05:21:40 +00:00
fatherbushido
38a30ea563 Remove useless TemplateManager existence check and extend the related test
Summary: cf c9b0db7f5f

Test Plan: -

Reviewers: vladislavbelov, elexis

Reviewed By: vladislavbelov, elexis
Subscribers: Vulcan

Differential Revision: https://code.wildfiregames.com/D279
This was SVN commit r19363.
2017-03-30 19:53:25 +00:00
elexis
6149dd3841 Actually remove trailing whitespace for non-header files as well.
This was SVN commit r18989.
2016-11-23 13:02:58 +00:00
sanderd17
46ead523b8 Cleanup of the Auras code in preparation of stackable auras. Implements auras being enabled by techs. Refs #3792. Patch by fatherbushido
This was SVN commit r17974.
2016-04-04 18:55:44 +00:00
elexis
fc0f496e3d Fix indentation, refs #3803.
This was SVN commit r17840.
2016-03-07 11:44:03 +00:00
elexis
b1cacacff1 Fix the test of the Player-component following c9b0db7f5f. Patch by fatherbushido, fixes #3803, refs #3522.
This was SVN commit r17834.
2016-03-06 14:02:34 +00:00
mimo
c9b0db7f5f Techs can now modify an aura
Wonder population bonus is now an aura (reverted when the wonder is
destroyed) with 10 pop (wonder) with an additionnal +40 with the tech
patch by fatherbushido

This was SVN commit r17809.
2016-03-01 17:10:42 +00:00
leper
f8ff206169 Recreate some tech modified values upon deserialization. Fixes #3055.
Also check for some possible null pointers.

This was SVN commit r16364.
2015-02-21 01:41:24 +00:00
Itms
04343a8407 Fix a comment written too quickly
This was SVN commit r16005.
2014-11-23 21:47:15 +00:00
leper
7dad37c78f Some cleanup. Fix a comment.
This was SVN commit r15928.
2014-11-05 00:22:14 +00:00
sanderd17
5f5eedc513 Rename technology related files, methods and messages so their names represent the shared data flow between technologies and auras (and maybe future components). Implement the C++ part of auras through these generalised files. Fixes #2154
This was SVN commit r14001.
2013-10-15 10:05:08 +00:00
Renamed from binaries/data/mods/public/simulation/helpers/Technology.js (Browse further)