Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit army #1141

Merged
merged 6 commits into from
Jul 26, 2024
Merged

Limit army #1141

merged 6 commits into from
Jul 26, 2024

Conversation

credence0x
Copy link
Collaborator

  • limit armies a realm can have
  • combat bug fixes

Copy link

vercel bot commented Jul 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
eternum ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 26, 2024 10:40am

Copy link
Contributor

@mentatbot mentatbot bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pull request implements a limit on the number of armies a realm can have, based on the number of military buildings. It also includes some combat bug fixes and improvements. The changes look well-thought-out and properly implemented. The new army limit feature is a good addition that adds strategic depth to the game. The bug fixes, especially in the battle health calculation, should improve the overall stability of the combat system.

Thanks for using MentatBot. Give comments a 👍 or 👎 to help me improve!

contracts/src/models/combat.cairo Show resolved Hide resolved
contracts/src/models/config.cairo Show resolved Hide resolved
@@ -447,9 +453,33 @@ mod combat_systems {
army_id
}

fn army_delete(ref world: IWorldDispatcher, army_id: u128) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good implementation of the army deletion function. It checks important conditions like ensuring the army is dead and not a defensive army before deletion.

@@ -1203,8 +1239,44 @@ mod combat_systems {
fn create_base_army(
world: IWorldDispatcher, army_owner_id: u128, owner_address: starknet::ContractAddress
) -> u128 {
let mut army_id: u128 = world.uuid().into();
// ensure army owner is a structure
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The army creation logic now includes checks for military buildings and enforces limits based on the TroopConfig. This is a good way to implement the new army limit feature.

@@ -1242,6 +1314,68 @@ mod combat_systems {
set!(world, (army_quantity));
}

fn delete_army(world: IWorldDispatcher, ref entity_owner: EntityOwner, ref army: Army) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The delete_army function is well implemented, properly cleaning up all related components and decrementing the army count.

Copy link
Collaborator

@edisontim edisontim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@edisontim edisontim merged commit 30b3da6 into feat/combat-revamp Jul 26, 2024
19 of 20 checks passed
@edisontim edisontim deleted the limit-army branch July 26, 2024 11:54
edisontim pushed a commit that referenced this pull request Jul 26, 2024
* contract: limit armies and enable deletion

* contracts: delete army if merging kills troop

* contracts: bug fixes from v1 branch

* update test
bob0005 pushed a commit that referenced this pull request Jul 29, 2024
* Beginning of changes to UI/UX for battles

* Heavily modify battle systems

* Build and prettier

* Create util function to get percentage of remaining troops in battle

* Rename resources function

* Limit army (#1141)

* contract: limit armies and enable deletion

* contracts: delete army if merging kills troop

* contracts: bug fixes from v1 branch

* update test

* remove tooltip library

* Add function to delete armies and limit number of armies in UI

* prettier + remove unused imports

* address PR comments

* Fix "ennemy" typo

* Remove biome and add hintmodal in entity details panel

* Remove bigint casts

* Change sdk values back

* Fix small bugs in battleview + fix deposit of resources on structure in battle + small optimizations

* prettier

* Changes to army limit contracts/UI + way of selecting army in entity details

* Change ArmyQuantityTracker to AttackingArmyQuantityTracker

---------

Co-authored-by: Credence <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants