Commit Graph

67 Commits

Author SHA1 Message Date
evanpelle d35d0f38cb refactor & update warships (#796)
## Description:
1. Refactor WarshipExecution so that it takes either attrs or a warship
unit. This makes testing much simpler as the unit test can construct a
warship and then pass it into a warship execution
2. Have MoveWarshipExecution set the patrol tile, not the move tile so
warships stay in new location instead of moving back to original
location.
3. Warships no longer target trade ships outside of its patrol range.
this prevents warships from wandering
4. Refactored & simplified WarshipExecution
5. Added more tests for warships
6. Move health modification from PlayerExecution to WarshipExecution
since Warships are the only unit that have health
7. Move fields from WarshipExecution to the Warship unit itself, this
allows other executions & components to see more data about the warship.



## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

## Please put your Discord username so you can be contacted if a bug or
regression is found:

<DISCORD USERNAME>
2025-05-24 13:42:56 -07:00
Scott Anderson 5aa8356513 Record player stats during the game (#784)
## Description:

Record player stats for the analytics worker to import in to to
postgres. This changes defines a new Analytics schema version, `v0.0.2`,
containing additional metadata about each player.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors
2025-05-21 00:10:29 -04:00
Vivacious Box 1f6642888b Fix capturing isolated clusters (#761)
## Description:
Current behavior:
TerraNullius tiles are taken into account for capturing isolated
clusters
Also isolated clusters can be captured by allies

It might be intended behavior but in case it is not, here is a quick fix


Before:

![capturenuke](https://github.com/user-attachments/assets/d2df37ea-cc35-496e-a7f2-0980c7af29f6)

After:

![capturenuke2](https://github.com/user-attachments/assets/55694e84-ceb3-47b9-96b7-61c9a7b51d3b)


⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
### This will also change capturing isolated clusters while attacking as
long as there is TerraNullius as a neighbor so if it is intended
behavior, please discard.
⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️


## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

## Please put your Discord username so you can be contacted if a bug or
regression is found:

Vivacious Box
2025-05-16 14:33:41 -07:00
Scott Anderson 70745faac4 Enable strictNullChecks, eqeqeq (#436)
## Description:

Improve type safety and runtime correctness by:
1. Enabling TypeScript's
[strictNullChecks](https://www.typescriptlang.org/tsconfig/#strictNullChecks)
compiler option.
2. Replacing all loose equality operators (`==` and `!=`) with strict
equality operators (`===` and `!==`).
3. Cleaning up of type declarations, null handling logic, and equality
expressions throughout the project.

Currently, the code allows implicit assumptions that `null` and
`undefined` are interchangeable, and relies on type-coercing equality
checks that can introduce subtle bugs. These practices make it difficult
to reason about when values may be absent and hinder the effectiveness
of static analysis.

Migrating to strict null checks and enforcing strict equality
comparisons will clarify intent, reduce bugs, and make the codebase
safer and easier to maintain.

Fixes #466 

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

---------

Co-authored-by: Scott Anderson <662325+scottanderson@users.noreply.github.com>
Co-authored-by: evanpelle <openfrontio@gmail.com>
2025-05-15 16:39:40 -07:00
Léo Kosman 1b286f5518 Feat : Auto remove embargoes that were automatically created (#707)
## Description:

Adds two fields to an Embargo : 
- `createdAt` : the tick at which it was created
- `willExpire` : whether the embargo will expire on its own

An embargo will remove itself only if the player didn't intentionally
set it. It expires either when an alliance is made, or if enough time
has passed (according to the `embargoDuration` config entry).

I put 5 minutes for `embargoDuration` by default, which seems reasonable
to me.

closes #702 

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

## Please put your Discord username so you can be contacted if a bug or
regression is found:

leo21_
2025-05-15 10:09:27 -07:00
Evan 8b6895d745 add prettier import plugin 2025-03-31 13:09:27 -07:00
PilkeySEK 9434d82d78 Add gold for encircling someone + display message (#369)
## Please complete the following:

- [X] I have added screenshots for all UI updates
- [X] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [X] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

## Please put your Discord username so you can be contacted if a bug or
regression is found:
PilkeySEK
2025-03-29 13:56:17 -07:00
evanpelle d8fe41de7a teams (#349) 2025-03-27 20:43:56 -07:00
Ilan Schemoul 6ad4ac86f4 feat: when player has no port warship do not capture trade or heal anymore (#280) 2025-03-18 12:07:51 -07:00
Evan c4381a9ad3 encirclement bug: ensure player is inscribed before losing territory 2025-03-16 20:39:20 -07:00
evanpelle 4281095666 update maps: remove small lakes as it breaks encirclement. More money… (#188)
… more frequent trade ships, lakes prevent encirclement, warships start
at full health
2025-03-08 16:45:23 -08:00
Evan 673a7a400c largest attacker gets cluster 2025-03-07 10:22:46 -08:00
BeGj 619891741f linting 2025-03-07 16:53:10 +00:00
Evan c1383d76f1 allow boating on lakes 2025-03-03 19:19:16 -08:00
Evan d726fd66b5 store values as bigints to prevent floating point drift 2025-03-02 09:39:51 -08:00
Evan ee56d68748 get eaten if surrounded by same player while on lake 2025-02-20 15:14:29 -08:00
Evan 5e6f8f5d91 validate all intent input 2025-02-18 16:26:49 -08:00
Evan 01a98c03e8 add back bugfix from 2760b11 2025-02-18 09:12:32 -08:00
Evan 49ff20ce9a don't lose territory if surrounded at edge of map 2025-02-17 19:58:57 -08:00
Evan 6a66d0c52d load archived game if not found 2025-02-17 19:30:30 -08:00
Evan b643a6357b implement mirv 2025-02-04 11:53:41 -08:00
Evan 4ee37323f9 format codebase with prettier 2025-02-01 12:05:11 -08:00
Evan 87c45853ba remove mode is not player warning 2025-02-01 12:05:11 -08:00
evanpelle de1dbff570 combine Game & MutableGame 2025-02-01 12:05:11 -08:00
evanpelle 7d15c0c065 combine Player & MutablePlayer interfaces 2025-02-01 12:05:11 -08:00
evanpelle f7a0619347 reduce cluster check to every 20 ticks 2025-02-01 12:05:11 -08:00
Evan e4f0d76733 made name rendering more efficient 2025-02-01 12:05:11 -08:00
Evan 70a5b8883e make calculate clusters more efficient 2025-02-01 12:05:11 -08:00
Evan b91d9d4148 fix bugs from using tilerefs 2025-02-01 12:05:11 -08:00
Evan f0f5bae79f thread_split: convert all tile to tileref 2025-02-01 12:05:11 -08:00
evanpelle c42cc2a9b4 have Game delegate to GameMap for cleaner API 2025-02-01 12:05:11 -08:00
evanpelle a17ae48cd3 use TileRef instead of tile 2025-02-01 12:05:11 -08:00
Evan dab427d614 put methods onto terraintile 2025-02-01 12:05:11 -08:00
Evan 2760b1110f fix calculate cluster conquering itself because removeCluster changed tile ownership 2025-01-04 13:51:12 -08:00
Evan ac1d0c0378 Add relations, NPCs attack enemies using relation, NPCs attack targeted players 2024-12-27 16:53:56 -08:00
Evan fa3b3478b7 don't delete nukes when player dies. was creating a an error because nukeexecution tried deleting inactive unit. 2024-12-26 09:56:12 -08:00
Evan 5307285d8b give Battleships & Destroyers health, make shells more frequent & larger 2024-12-20 20:31:41 -08:00
evanpelle ff02d9d8b6 have core/ directory use consolex for remote logging 2024-12-18 12:00:00 -08:00
Evan 939761fc76 bugfix: when checking last tile update in calculate clusters and name layer 2024-12-12 20:31:08 -08:00
evanpelle b97ef32adb only calculate cluster when tile changes 2024-12-10 20:28:39 -08:00
Evan 2d2df14ae3 add GameConfig to Game 2024-12-07 09:45:39 -08:00
Evan 3a2f8c9538 have playerexecution check & delete units on death. fixes bug where units weren't being captured when player dies 2024-11-23 10:13:03 -08:00
evanpelle 108fad8096 create territoryBound, have player execution check units for capture
fix bug where PortExecution tries to get random element from empty list and crashes
2024-11-17 19:56:54 -08:00
Evan 60751150bf added gold, troops, workers slider 2024-11-03 20:11:04 -08:00
Evan 713393f4d4 use max troops instead of manpower for addition rate 2024-11-03 12:39:04 -08:00
Evan e20cd96df4 make manpower addition rate function of total manpower 2024-11-03 12:38:53 -08:00
Evan 7068758ae3 growth determined by manpower reserves 2024-11-03 12:38:40 -08:00
Evan 2afecf0f39 create troop slider 2024-11-03 12:37:56 -08:00
evanpelle 08672f68a9 alliances expire after 1000 ticks (~1.5 minutes) 2024-09-22 19:54:12 -07:00
evanpelle d874392467 refactored alliance 2024-09-22 13:38:43 -07:00