Commit graph

74 commits

Author SHA1 Message Date
wraitii
db4fabcc4c Fix phase notification accidentally deleted in e16c4c4800
Reported By: elexis
Tested By: Freagarach
Differential Revision: https://code.wildfiregames.com/D2336
This was SVN commit r23014.
2019-09-29 08:53:28 +00:00
wraitii
db4637f73a Fix issue with D274/e16c4c4800 - modifications are a list of effects, not a single effect
D274 introduced a silent change that modifications would only have one
effect per value-path, which was an unnoticed regression.

Detected following the comments from SonarQube reported here:
e16c4c4800#inline-4214

Comments By: elexis
Differential Revision: https://code.wildfiregames.com/D2315
This was SVN commit r22967.
2019-09-22 12:05:04 +00: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
bb
3a77eb25d3 Fix ESLint semicolon-related warnings
Patch By: Krinkle
Differential Revision: https://code.wildfiregames.com/D2004
This was SVN commit r22419.
2019-07-01 11:09:19 +00:00
wraitii
f4babd9b34 Wrap damage types in a Damage element in XML templates to prepare for genericizing them.
Patch By: Freagarach
Reviewed By: Wraitii
Differential Revision: https://code.wildfiregames.com/D1950
This was SVN commit r22379.
2019-06-16 17:08:27 +00:00
elexis
d5af005a00 Expose INVALID_PLAYER to the JS simulation and use it instead of -1 for consistency with the C++ counterpart.
This was SVN commit r20953.
2018-01-22 01:02:29 +00:00
bb
c9295a0f59 Nuke missleading non-existing spearman/sword(s)man classname references.
Reviewed By: wraitii
Differential Revision: https://code.wildfiregames.com/D1173
This was SVN commit r20746.
2018-01-01 15:06:52 +00:00
elexis
c90d72deb5 Replace DataTemplateManager simulation component with a globalscript, refs #4868.
Removes the serialization of JSON files, shrinking savegame files and
rejoin states sent across the network, refs #3834, #4239, #3909,
f24523dc8f.
Removes the AI C++ code to read JSON files from e33d4a52e9 since the AI
can now use the globalscript.
Allows the AI to read Aura templates and removal of GUIInterface code to
improve performance.
Serialization of the JSON objects in other simulation components was
removed in 9c0e37f2c0 / D1109, a6f14f5631 / D1130.

Serialization removal planned by sanderd17
AI part proofread by mimo
Simulation part proofread by bb
Discussed with Itms on irc

Differential Revision: https://code.wildfiregames.com/D1108
This was SVN commit r20737.
2017-12-31 01:02:21 +00:00
elexis
2fd163a08a Remove TechnologyManager relict of 99d04e93bb following c1e86161b5.
This was SVN commit r20616.
2017-12-08 23:11:00 +00:00
elexis
5667de04c8 Use Map instead of Object in researchQueued of the TechnologyManager for code symmetry with the two previous commits, a6f14f5631 and dc72833040.
Comments in https://code.wildfiregames.com/D1130

This was SVN commit r20612.
2017-12-08 19:29:10 +00:00
elexis
dc72833040 Use Set instead of an Object with unused values in TechnologyManager.researchStarted.
Differential Revision: https://code.wildfiregames.com/D1129
Reviewed By: mimo
This was SVN commit r20611.
2017-12-08 18:47:07 +00:00
elexis
a6f14f5631 Remove unused serialized cache of technology templates in TechnologyManager.researchedTechs.
Refs #3834, #3909, #4239, #4868, D1108
Differential Revision: https://code.wildfiregames.com/D1130
Reviewed By: mimo
This was SVN commit r20610.
2017-12-08 18:35:04 +00:00
elexis
9c0e37f2c0 Don't serialize the templates of autoresearched technologies.
Refs #3834, #4239
Differential Revision: https://code.wildfiregames.com/D1109
Reviewed By: temple
Comments By: Itms
Proposed By: sanderd17
This was SVN commit r20606.
2017-12-07 23:26:29 +00:00
mimo
8a32deb5ca Fix tutorial stuck after building farm
Trac Tickets: #4696, #4697

Differential Revision: https://code.wildfiregames.com/D774
This was SVN commit r19998.
2017-08-19 09:38:52 +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
elexis
ec58e50a09 Remove a duplicate TechnologyManager getter introduced by e33d4a52e9.
Differential Revision: https://code.wildfiregames.com/D373
Patch By: Polakrity
This was SVN commit r19446.
2017-04-23 00:30:24 +00:00
elexis
51d189c767 Display a chat notification if an ally has reached a new phase, optionally also if started or aborted.
Remove the equivalent AI chat notifications.

Differential Revision: https://code.wildfiregames.com/D354
Patch By: Polakrity
Fixes #3512

This was SVN commit r19445.
2017-04-23 00:00:14 +00:00
wraitii
d15b35357e Show effects of game-start tech modifications in Structure Tree.
This also refactors code so that external callers will have an easier
time getting a template value as modified by technologies.

Patch by s0600204.

Reviewed by bb and wraitii.
Differential Revision: https://code.wildfiregames.com/D154
This was SVN commit r19410.
2017-04-11 14:36:30 +00:00
fatherbushido
9cf84c6800 Fix documentation of non system component.
Summary: -

Test Plan: -

Reviewers: Itms, leper

Reviewed By: leper
Subscribers: Vulcan, O1 C++ Simulation

Differential Revision: https://code.wildfiregames.com/D221
This was SVN commit r19337.
2017-03-24 07:09:28 +00:00
elexis
ad17e320be Rename the Female identity class to FemaleCitizen, because it is intended for female support units only.
Thus prevent template editors from adding that tag to female military
units and
allow modders to add a Female class for wider purposes.
Remove the FemaleCitizen training restriction category that was added
for debug purposes but forgotton to be removed in 7e21db08d5.

Differential Revision: https://code.wildfiregames.com/D244
Reviewed By: fatherbushido
Refs: #1432 #4490

This was SVN commit r19329.
2017-03-23 17:54:36 +00:00
mimo
2e636af9bc fix missing semicolons
This was SVN commit r19126.
2017-01-09 19:03:24 +00:00
fatherbushido
6c97d8118b Merge different logics of technology requirements and fix the related bugs. Create a global script which derive the technology requirements objects in a form usable for structure tree, gui, simulation and AI. Reviewed by mimo (for AI) and fatherbushido. Fixes #3993, #1646, #4263, #4217. Refs #4108.
This was SVN commit r19120.
2017-01-08 14:00:20 +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
25e637dcac Fix issue with undefined newValue while origValue is defined.
This was SVN commit r18262.
2016-05-29 18:10:57 +00:00
sanderd17
9368ffe345 Fix tech modifications calculations so we don't bump into stupid mistakes again (f.e. multiplying two positive numbers is now guaranteed to stay positive). See 7f300bbf3d and 0b8845eb4f
This was SVN commit r18207.
2016-05-20 11:20:51 +00:00
sanderd17
f24523dc8f Rename TechnologyTemplateManager to DataTemplateManager in order to reflect its new function. Fixes #3909. Disable serialisation of technology templates. Refs #3834
This was SVN commit r18100.
2016-04-27 08:25:47 +00:00
sanderd17
a69da3401f Completely hide techs that aren't researchable by the civ of the owner + cleanup of requirements checking. Patch by fatherbushido. Fixes #3899
This was SVN commit r18027.
2016-04-13 09:15:16 +00:00
sanderd17
e0cfcbd806 Enable technologies on captured buildings. Allow a negation on the civ selection in the technology json files. Patch by fatherbushido
This was SVN commit r18021.
2016-04-11 19:40:53 +00:00
mimo
a7743e95b9 cleanup of unused counters
This was SVN commit r17605.
2016-01-06 21:15:58 +00:00
mimo
0b86bbd424 another bunch of cleanup (mainly missing semicolon) signaled by jshint
This was SVN commit r17045.
2015-09-19 12:50:48 +00:00
mimo
00a51404c9 cleanup of some for ... in loops on arrays (replaced by for ... of)
This was SVN commit r16996.
2015-09-09 18:21:17 +00:00
sanderd17
cc4af6d2d4 Allies only share vision when researching a tech. Based on patch by niektb. Fixes #2055
This was SVN commit r16795.
2015-06-19 09:24:55 +00:00
mimo
4a7994a595 improve indentation in previous tag
This was SVN commit r16724.
2015-06-04 21:26:01 +00:00
mimo
f1f8479ffe fix entityLimits with replaced tech
This was SVN commit r16723.
2015-06-04 21:24:34 +00:00
sanderd17
6752389c98 Let technologies replace other technologies, and use this for the town and city phase. Main implementation by niektb, structree fix by s0600204. Fixes #3208
This was SVN commit r16678.
2015-05-25 15:52:02 +00:00
mimo
7ac837fb90 allow the removal of entity limits when some requirements are satisfied. This allows to have starting games without cc
This was SVN commit r16097.
2015-01-01 18:28:21 +00:00
leper
6e788fb15e Clean up JSON parsing code. Refs #1374.
Fix Engine.ReadJSONFile() which did throw a JS exception that was not
caught. Discovered by s0600204.
Expose Engine.ReadJSONFile() to the gui scripts.

This was SVN commit r15959.
2014-11-13 01:26:22 +00:00
leper
7dad37c78f Some cleanup. Fix a comment.
This was SVN commit r15928.
2014-11-05 00:22:14 +00:00
sanderd17
68121f387c Don't cache (and serialise) all technology templates multiple times. It's still cached once in the TechnologyTemplateManager.
This was SVN commit r15545.
2014-07-22 16:18:37 +00:00
sanderd17
9f47ed536d Add engine support to triggers + a component to provide an easy interface and to be extended by triggers. Thanks to SpahBod for the biggest part of the code, and Yves for the review.
This was SVN commit r15421.
2014-06-23 13:42:59 +00:00
leper
58e628338c Also check if a technology was already researched when checking requirements. Fixes #2580.
This was SVN commit r15343.
2014-06-13 16:16:10 +00:00
sanderd17
a9d0a3bcae Fix how per tech modification affects work + fix the technologies that implement it. Fixes #2366
This was SVN commit r14930.
2014-04-14 16:33:00 +00:00
sanderd17
bb71823aee Make the actor tech-modifiable. Fixes #2243
This was SVN commit r14928.
2014-04-14 15:00:49 +00:00
sanderd17
132020f88e Fix some of the undefined warnings reported by the new SpiderMonkey. Initialize the player diplomacy arrays earlier in PlayerManager.
This was SVN commit r14882.
2014-03-29 11:03:00 +00:00
sanderd17
60619dbf3f Add technologies cheat. Fixes #2072. Patch by boeseRaupe
This was SVN commit r14712.
2014-01-31 15:30:16 +00:00
wraitii
9330975d54 Fix Athens not researching civ phase. Make the AI adapt automatically to changing the max gatherers on fields.
Fix auto-researched technologies not being properly researched on init.
Fix the tests (amazing!).
GarrisonHolder sends which entities were added or removed (mostly for AI
purposes but could benefit other things).
Streamline AIInterface events.

This was SVN commit r14612.
2014-01-18 20:26:52 +00:00
wraitii
c1e86161b5 AIs now properly receive aura and technology updates. Fixes #2377, Refs #1520 . Consequently reimplement repairing for AIs.
Fix a few style issues and a bug with the gatherer count.
Still need to fix the entity.js file to handle properly some things as
this uses raw templates values.
Cache the AIinterface in AIProxy.js, please report if this works
properly.

This was SVN commit r14588.
2014-01-16 20:32:44 +00:00
leper
3a24eab0f0 Cache technology modifiers based on original value. Patch from sanderd17 based on work by Spahbod. Fixes #2045.
This was SVN commit r14205.
2013-11-17 18:24:04 +00:00
sanderd17
c62cc3ee44 rename technology modifier 'multiplier' to 'multiply' for consistency with auras, and it looks better next to the existing 'add'
This was SVN commit r14079.
2013-11-03 14:09:32 +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