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

Battle fixes #949

Merged
merged 2 commits into from
Jun 17, 2024
Merged

Battle fixes #949

merged 2 commits into from
Jun 17, 2024

Conversation

credence0x
Copy link
Collaborator

  • force remove enemy from current battle if they lost. This prevents any error that doesnt allow a structure to be pillaged because their resources are locked in battle. even though theyve lost
  • remove "send home after pillage" feature

- remove "send home after pillage"
Copy link

vercel bot commented Jun 17, 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 Jun 17, 2024 7:28am

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.

The pull request introduces some good refactoring and attempts to streamline the battle logic. However, there are concerns about the conditions under which armies are allowed to leave battles and the handling of army states. It's crucial to ensure that these changes do not introduce new bugs or allow for unintended behaviors in the combat system.

Butler is in closed beta. Reply with feedback or to ask Butler to review other parts of the PR. Please give feedback with emoji reacts.

@@ -819,26 +767,21 @@ mod combat_systems {
claimer_army_position.assert_same_location(structure_position.into());

// ensure structure has no army protecting it
// or it has lost the battle it is currently in
let structure_army_id: u128 = get!(world, structure_id, Protector).army_id;
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems that the leave_battle function is being called without checking if the army has actually won the battle. This could potentially allow armies to leave battles prematurely. Consider adding a check to ensure that the army has won before allowing it to leave.

@@ -876,39 +819,17 @@ mod combat_systems {

let mut structure_army: Army = Default::default();
let mut structure_army_health: Health = Default::default();
let mut can_pillage_only_once = false;
if structure_army_id.is_non_zero() {
Copy link
Contributor

Choose a reason for hiding this comment

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

The logic to check if the structure's army is dead seems to be outside of the condition checking if the army is in battle. This could lead to incorrect behavior if the army is not in battle but is somehow still considered dead. It might be safer to include this check inside the if structure_army.is_in_battle() condition to ensure consistency.

@@ -819,26 +767,21 @@ mod combat_systems {
claimer_army_position.assert_same_location(structure_position.into());

// ensure structure has no army protecting it
// or it has lost the battle it is currently in
let structure_army_id: u128 = get!(world, structure_id, Protector).army_id;
Copy link
Contributor

Choose a reason for hiding this comment

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

The refactoring of battle and army updates into the update_battle_and_army function is a good improvement for modularity. However, ensure that all necessary state changes are being committed back to the world state to avoid any inconsistencies.

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 b153ab6 into main Jun 17, 2024
8 of 17 checks passed
@edisontim edisontim deleted the force-leave-battle branch June 17, 2024 11:00
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