Commit graph

99 commits

Author SHA1 Message Date
Dunedan
93ce94655d
Use @stylistic/brace-style for eslint
Up to now `eslint-plugin-brace-rules` was used to enforce a common brace
style for JavaScript code. This plugin was however updated the last time
over 9 years ago and will be incompatible with ESLint v10, as that
[removes `context.getSourceCode()`][1], the plugin relies on.

To keep the eslint config working with ESLint v10, this replaces
`eslint-plugin-brace-rules` with the [`@stylistic/brace-style`][2] rule
from `@stylistic/eslint-plugin`, a package we already use.

While `@stylistic/brace-style` doesn't offer an option to format braces
in exactly the same way as before, the "allman" style seems to be the
one closest to the existing code.

[1]: https://eslint.org/blog/2025/11/eslint-v10.0.0-alpha.0-released/#removed-deprecated-rule-context-members
[2]: https://eslint.style/rules/brace-style
2026-01-12 21:33:52 +01:00
Stan
dc04f3f432
Fix autofixable eslint warnings for eqeqeq
Ref: #7812
Pull Request: #8129
2025-06-26 11:03:19 +02:00
Ralph Sennhauser
60fc382bd8
Fix eslint rule 'prefer-const' in maps/scripts
eslint --no-config-lookup --fix --rule '"prefer-const": 1' \
    binaries/data/mods/public/maps/scripts

Ref: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-05-09 19:46:31 +02:00
Ralph Sennhauser
b6df170303
Fix eslint indent rule
eslint --no-config-lookup --fix --rule 'indent:  ["warn", "tab", { "outerIIFEBody": 0, }]'

Ref: #7812
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
2025-05-03 09:39:58 +02:00
Dunedan
8482f25800
Fix a bunch of spelling mistakes
This fixes a bunch of spelling mistakes found in user facing strings.

Fixes #7716
2025-04-11 06:24:32 +02:00
marder
f544c6776b Turret walls on Jebel Barkal & outposts on Danubius again
After they had been broken in 21e866fcf0

Author / patch by: @lairkers

Troubleshooting / comments by @elexis @Freagarach

Fixes #6831

This was SVN commit r27937.
2023-11-18 16:10:58 +00:00
Freagarach
c917c39a0d Pull Diplomacy out of cmpPlayer.
Who says only players should be able to conduct diplomacy?
Also separation of concerns, more maintainable files.

Differential revision: https://code.wildfiregames.com/D4921
Comments by: @elexis, @Stan
Refs. #5894

This was SVN commit r27722.
2023-06-19 06:33:33 +00:00
Stan
91509290d6 Workaround TriggerHelper.js not being able to spawn units correctly because of promotion.
Avoid duplication by moving the function to Transform.js.
Add tests to Transform.js
Add tests to TurretHolder.js
Optimize slightly Trainer.js by removing some useless
Engine.QueryInterface calls.
Refs #6784 (symptoms in TriggerHelper.js are fixed underlying cause not)

`SkirmishReplacer` is called before the Modifier Manager so it does not
suffer the same fate.
Entities using `ChangeEntityTemplate` function are still affected.
Maps calling Engine.AddEntity directly are still affected.

Ideally this should be handled by hotloading components instead of
creating new entities each time. See =>
https://code.wildfiregames.com/D4991
Tested using:
908dd631d9

Differential Revision: https://code.wildfiregames.com/D4984
This was SVN commit r27636.
2023-05-10 15:13:52 +00:00
wraitii
b5abab5c79 Don't reset wonder victory timer on ally defeat.
Follows d86148defc.
Resetting the wonder time when an ally to the wonder-owner is defeated
seems like double-punishment, and should not happen.

Resetting on explicit diplomacy change remains in Allied victory mode.

Fixes #6527

Reported by: Langbart
Differential Revision: https://code.wildfiregames.com/D4661
This was SVN commit r26914.
2022-06-01 15:44:53 +00:00
Freagarach
13d701e3d0 Fix maps after ea72437739.
Correctly fetch the civ from the player's Identity.
Also remove the notions of the CivChanged message, since it was
effectively deleted already.

Differential revision: https://code.wildfiregames.com/D4486
Reviewed by: @wraitii
Comments by: @bb, @Silier, @smiley, @Stan, @vladislavbelov
Fixes #6444

This was SVN commit r26872.
2022-05-11 06:04:20 +00:00
Freagarach
02de932816 Remove redundant function in HasDealtWithTech in trigger helper.
The function was redundant for a long time, but made an error in
73f741d266.

Reported by: @marder
Differential revision: https://code.wildfiregames.com/D4541
Tested by: @marder
Fixes #6458

This was SVN commit r26656.
2022-03-15 06:38:46 +00:00
bb
412e870c55 Add defeat condition on civil centre loss
Somewhat obsoleting 171afdc7a6.

Reviewed By: Freagarach
Comments By: Stan, Nescio and wowgetoffyourcellphone
Differential Revision: D3530
This was SVN commit r25422.
2021-05-12 13:34:50 +00:00
Freagarach
48cb9a2d6f Allow triggers to spawn turreted entities.
After 21e866fcf0.

Differential revision: https://code.wildfiregames.com/D3872
Comments by: @Angen
This was SVN commit r25363.
2021-05-03 08:54:54 +00:00
wraitii
8d02102885 Fix triggerhelper for 59d0885d68
59d0885d68 made formation take "formation", not "name". This broke
TriggerHelper.

Reported by: Angen
Reviewed By: Angen
Differential Revision: https://code.wildfiregames.com/D3873
This was SVN commit r25293.
2021-04-20 09:36:33 +00:00
Freagarach
8cdfc107b7 Let garrisoned entities be IDLE.
The "GARRISONED"-state was quite strange, for entities being garrisoned
can just as well perform other tasks (see e.g. turrets).
Also, the need for keeping a "garrison" order on the stack is removed.

Fixes: #6022
Differential revision: D3656
Refs. #6081

This was SVN commit r25069.
2021-03-17 14:53:09 +00:00
Freagarach
e18001e897 Let entities garrison using cmpGarrisonable.
Followup to f4c9305eee.
Moves the logic for garrisoning from cmpGarrisonHolder to the entity
that is being garrisoned.
Also fixes
https://wildfiregames.com/forum/topic/36863-teleportation-feature-in-a24/?do=findComment&comment=418441
while at it (setting garrisoned before transferring orders on
transform).

Differential revision: D3280
Refs: #5906
Comments by: @Stan, @wraitii
This was SVN commit r24977.
2021-03-02 15:06:16 +00:00
wraitii
171afdc7a6 Make foundations not ConquestCritical
Foundations were originally made conquest critical in 722578fdcd.
However, it remains rather frustrating that a player can evade defeat by
placing an unbuilt, uncommitted foundation. While allies can revive a
player with only a foundation, that cannot happen in 1v1, where it is
simply undue frustration, and the inconvenience seems greater than the
feature.
This thus removes them again from the conquest critical list.

Patch By: nephele
Differential Revision: https://code.wildfiregames.com/D2674
This was SVN commit r24624.
2021-01-15 10:02:31 +00:00
Freagarach
2e79c0a177 Remove health component from relics.
Since relics ought to be undestroyable, a health component makes no
sense. This makes that the Invulnerability-flag can be removed and
relics can be captured again (after 0f91c5ac61#inline-5236).

Differential Revision: D1268
Original patch by: @temple
Reviewed by: @wraitii
Comments by: @bb, @elexis
Fixes #5007, #5847, 0f91c5ac61#inline-5236

This was SVN commit r24327.
2020-12-06 07:22:51 +00:00
bb
31df44673a Add safeguards for all queryOwnerInterface calls
Comments By: Angen, wraitii
Reviewed By: Freagarach
Differential Revision: D2973
This was SVN commit r24050.
2020-09-19 17:55:34 +00:00
bb
0a26c55513 Fix more JsDocs numbers/bools/strings
This was SVN commit r23992.
2020-08-24 11:50:31 +00:00
Freagarach
24e0e50a9d Javelinist -> Javelineer in templates.
Follow up to f489ab3a16.

Patch by: @Nescio.
Differential Revision: D2914
This was SVN commit r23956.
2020-08-10 05:59:56 +00:00
bb
db90b7add8 Defeat players on conquestStructures nomad who don't build anything.
Differential Revision: D1469
Reviewed By: Angen
Comments By: temple, elexis
Reported By: petherfile, hannibal barca
fixes: #3749

This was SVN commit r23874.
2020-07-23 13:40:04 +00:00
wraitii
16b452cf91 Generalise Attack effects. All attacks, including death damage and splash, can deal any number of attack effects (damaging, capture, giving status effects.)
This moves most of what was in the Damage system component to a helper,
and renames that component DelayedDamage.
It also introduces a new global script with all possible attack effects.

Comments Taken From: Freagarach, Stan, bb

Differential Revision: https://code.wildfiregames.com/D2092
This was SVN commit r22754.
2019-08-22 18:00:33 +00:00
bb
0b1593e268 recieve -> receive
Reported by Stan in 13288df4f4

This was SVN commit r22169.
2019-04-07 16:06:10 +00:00
bb
13288df4f4 Update the wonder victory timer in case the wonder renames.
Reviewed By: smiley
Comment By: elexis
Differential Revision: https://code.wildfiregames.com/D1732
This was SVN commit r22165.
2019-04-06 21:58:20 +00:00
bb
b3487dfb60 Handle entity renames in regicide
This allows heroes to be upgraded

Patch By: smiley
Comments By: elexis
Differential Revision: https://code.wildfiregames.com/D1694
This was SVN commit r22019.
2019-01-04 20:09:28 +00:00
Stan
9442c927fc Fix imperative of choose
Differential Revision: https://code.wildfiregames.com/D1528
This was SVN commit r21986.
2018-12-29 18:15:09 +00:00
elexis
76d648349d Fix gaia units ignoring players without CCs.
As demonstrated by Dizaka, it allowed players to win a game by deleting
all buildings, sending one unit across the map and having the enemy get
defeated by the double gaia count.
It also means that players that still have buildings but no CCs/Wonders
are targetted by elephants.

This was SVN commit r21777.
2018-04-24 12:46:59 +00:00
elexis
2bc068aa41 Add some missing IsInWorld checks to Danubius for cases where all targets are garrisoned, promoted, upgraded, transformed, becoming packed or undergoing any special treatment by some mod, refs D1449.
This was SVN commit r21766.
2018-04-23 11:22:46 +00:00
elexis
a74352b100 Spawn proportionately less gaia attackers when players become defeated.
This also reduces the attackercount slightly, because gaia is now
excluded when counting players.
PlayerManager.GetActivePlayers helper function.

This was SVN commit r21730.
2018-04-15 16:47:51 +00:00
elexis
dc0da7c430 Allow TriggerHelper SpawnGarrisonedUnits to spawn units on visible garrison points / walls, refs D1146 / e29dfb7000.
This was SVN commit r21564.
2018-03-16 15:49:08 +00:00
elexis
a3e5e0fef8 Common TriggerHelper functions to set formations on units, get the mapsize and current time, refs #5040.
This was SVN commit r21484.
2018-03-10 17:16:39 +00:00
bb
6d54ab4c1f Implement combine victory conditions
Excluding the changes to scenario and skirmisch maps
Transform gameType string to victoryCondition array in load/replaymenu
Adapt the gamesetup to use checkboxes for every victory condition and an
array for storing them
Allow multiple queries in conquestCommon
Remove conquest from regicide, wonder and capture the relic
Move the endless gamedescription from settings to gamedescription
Fixing wrong tabulation from a8a29271ce

This commit will break all scenario and skirmisch maps, their "Gametype"
string needs to be transformed in a "VictoryCondition" array as is done
in the tutorial map (counting endless as an empty array). This counts
for mods too!
Old svn replays and savegame will throw warnings/errors as they are
incompatible after this commit. So svn users will need to delete all
those.

Comments on ai and autostart games By: mimo
Comments on Atlas By: Vladislav
Reviewed By: elexis
Differential Revision: https://code.wildfiregames.com/D1240
fixes: #4014

This was SVN commit r21474.
2018-03-09 21:51:18 +00:00
elexis
adb84c50fb Fix oversight in 14da2f841f.
This was SVN commit r21463.
2018-03-08 14:06:41 +00:00
elexis
14da2f841f TriggerHelper functions to retrieve entities by player and by class.
Removes repetitive RangeManager and Identity component querying from
triggerscripts.
It means that mostly map specific logic remains in the triggerscript.
This should bring TriggerScript coding a bit closer to map authors who
aren't exactly software developers.
Call the RangeManager entity getters on Danubius and Survival multiple
times on init to further simplify code, as these microseconds on init
are irrelevant.

This was SVN commit r21459.
2018-03-07 13:54:58 +00:00
elexis
3f7ea11059 TriggerHelper SetUnitStance helper function for a very frequent triggerscript order.
This was SVN commit r21458.
2018-03-07 12:36:45 +00:00
elexis
2a1929d378 Fix a typo (ritualIdx / heroIdx) in the Danubius OwnershipChange in 026dcf10eb / D204.
Simplify that function by tracking entities using Sets instead of
Arrays, even though it costs two Set-to-Array conversions.

This was SVN commit r21457.
2018-03-07 12:21:09 +00:00
elexis
6113edd746 Refactor and move random template composition triggerscript code used for gaia attacker waves from Danubius (026dcf10eb / D204) and Survival Of The Fittest (18e7d8a518 / D145) to the TriggerHelper.
Eases implementation of new maps with diverse scripted attackers, refs
#5040, D11 and  map difficulties, refs #4963, D1189.
Replaces hardcoded templatenames with calls to a new TriggerHelper
function to query template names, given Classes, Civ, Rank or Packed
state.
Removes the duplicated template counting logic, that was intertwined
with map specific unit classes balancing logic, refs #4805.

Use mimos garrison function from e29dfb7000 / D1146 to support
doubleclicking on garrisoned gaia heroes on Danubius, fixing the bug
described in comment:10 of #4291.
Fix wrong (Trigger) prototype reference in ce65af8dcb.

This was SVN commit r21445.
2018-03-06 13:31:34 +00:00
elexis
d8b5439956 Small map cleanup and performance improvements.
This was SVN commit r21444.
2018-03-06 11:44:20 +00:00
bb
d86148defc Create winning teams for relic and wonder victory instead of letting all allies of a player win.
Create a getNonGaia function
Reset counters on playerDefeat
MarkPlayersAsWon function
Rename MarkPlayerAsWon to MarkPlayerAndAlliesAsWon
Stop letting winningplayers in relic depend on PlayerID

Comments By and Discussion With: elexis
Reviewed By: temple
Differential Revision: https://code.wildfiregames.com/D972
fixes #4648

This was SVN commit r21441.
2018-03-05 18:02:27 +00:00
elexis
ce65af8dcb Move Danubius triggerscript function to compose random templates and garrison all entities of a given identity class to TriggerHelper.
Delete the copy thereof in Elephantine, refs #4805, #5040.
Use absolute paths for template names.

This was SVN commit r21416.
2018-03-02 16:32:10 +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
elexis
36400458bf Add randomAngle helper function to abbreviate calls.
This was SVN commit r20874.
2018-01-15 14:20:57 +00:00
bb
7f4edf1926 Add support for diplomacy changes for wonder victory, make notifications more correct, add behaviour string to the gamedescription panel and on the fly cleanup
Reviewed By: elexis
Differential Revision: https://code.wildfiregames.com/D881
This was SVN commit r20687.
2017-12-26 12:59:27 +00:00
mimo
e29dfb7000 Provide a TriggerHelper function to spawn garrisoned entities
Differential Revision: https://code.wildfiregames.com/D1146
This was SVN commit r20659.
2017-12-17 17:17:00 +00:00
bb
dfa66fbc12 Cleanup getNumPlayers() calls
Do not check for system components,
Do not inline in loops for performance
Use QueryPlayerIDInterface instead of querying the playerEnt

Patch By: temple
Differential Revision: https://code.wildfiregames.com/D1137
This was SVN commit r20652.
2017-12-13 20:41:41 +00:00
elexis
84e88edd36 Remove pairwise annihilating array constructor and spread operator in e4a5d5b4dd.
Differential Revision: https://code.wildfiregames.com/D1134
Reviewed By: bb
This was SVN commit r20619.
2017-12-09 20:25:23 +00:00
bb
722578fdcd Cleanup the conquest code
Stop listening to OnTrainingFinished and OnStructureBuild messages but
use OnOwnershipChanged messages. This fixes the defeat when only
promoted/upgrades/regi-hero units remain.
Add foundations to the conquest lists and make them visible on the
minimap.

Patch By: temple
Differential Revision: https://code.wildfiregames.com/D1022
This was SVN commit r20471.
2017-11-17 11:38:51 +00:00
bb
ae74075a22 Rename TriggerHelper.EntityHasClass to TriggerHelper.EntityMatchesClassList
and so making that function much more general by using MatchesClassList.

Some suggestion and checking by leper
Patch By: temple
Differential Revision: https://code.wildfiregames.com/D1020
This was SVN commit r20432.
2017-11-10 12:14:16 +00:00
elexis
a19aaed550 Move catafalque relic templates from the "other" directory to the regular units directory.
Differential Revision: https://code.wildfiregames.com/D994
Refs #4770, D152, D269
Patch By: Nescio
Some comments by fatherbushido

This was SVN commit r20385.
2017-10-31 11:44:24 +00:00