C7-Game / Prototype

An early-stage, open-source 4X strategy game
https://c7-game.github.io/
MIT License
34 stars 9 forks source link

286 - Naval Units No Longer Defend Cities/Barb Camps #321

Closed QuintillusCFC closed 2 years ago

QuintillusCFC commented 2 years ago

(See PR #322 first, as this builds upon that one)

286 - Naval units (or other units of non-matching unit category) will no longer be able to defend tiles. In practice, this means they won't defend cities or barbarian camps as for now those are the only tiles that can have units of a different category.

The solution should be generally applicable to land/sea units on water, once we get to transport boats/carriers.

This does not attempt to add mechanics for capturing units; workers and catapults will still try to defend themselves with their 0 defense stat, just like they always have.

Note that the unit.OnEnterTile(newLoc); method is called earlier because it now clears out remaining units on the tile, and in the old order the unit moved onto the tile before that happened (and thus would get cleared out). Also note that OnEnterTile is modified, but GitHub did a poor job of hiding irrelevant code; it starts on line 289 of MapUnitExtensions.cs (but GitHub starts showing the code from 290).

Closes #286

QuintillusCFC commented 2 years ago

Closes #286

QuintillusCFC commented 2 years ago

Odd, the Closes keyword didn't work. Maybe because it is currently set to merge into another branch, not Development? Or maybe it just doesn't work if you forget it when you open the PR.

QuintillusCFC commented 2 years ago

Merging after 7-day window and self-review not finding any bugs.