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

feat(content,port): AGGRO_CHARACTER flag for enemies #5846

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

shmakota
Copy link
Contributor

@shmakota shmakota commented Dec 28, 2024

Checklist

Required

Optional

please remove sections irrelevant to this PR.

  • This PR ports commits from DDA or other cataclysm forks.
    • I have attributed original authors in the commit messages adding Co-Authored-By in the commit message.
    • I have linked the URL of original PR(s) in the description.
  • This is a C++ PR that modifies JSON loading or behavior.
    • I have documented the changes in the appropriate location in the doc/ folder.

Purpose of change

ports change
CleverRaven/Cataclysm-DDA#59795

Add a (rudimentary) selection to monster hostility, optionally filtering out characters until a character actually trips an anger trigger.

Additionally, to allow for the creation of enemies with high aggression that wont attack player until triggered by a flag, which otherwise always would. Enemies which do not have AGGRO_CHARACTER set to false should behave the same as they did before. Monsters that have this tag, when fighting, should now focus on whatever enemy they were already fighting and redirect their anger to the player less often.

Describe the solution

Add aggro_character (default true) to monster and mtype. false means the monster will be passive towards characters.
Add some logic to anger triggers to allow flipping aggro_character when a character trips the trigger: attacking/killing a friendly critter, hurting the monster and threatening offspring will always do so, the other triggers will have a random chance for each time they trigger
Add a lot of debugmode messages to aggro changes
Add a chance to reset the aggro_character when the monster reached its baseline anger level.

Describe alternatives you've considered

Testing

  • Spawned a 5x5 grid of moose to fight a 5x5 grid of zombie dogs. They fought and the moose eventually started fleeing once enough friends died. They seem to behave exactly the same as they did before the change.

  • Spawned bee, beaver, and giant jumping spider. All seem to behave the same as before.

  • Created a civilian monster that has high aggression and a high melee attack. Spawned it in a city, and it fought zombies until dying but did not target the player. The civilian will not be included in the PR.

  • Changed "mongrel" to have 99 aggression. Mongrel instantly attacks player. When aggro_character is set to false, mongrel no longer attacks player, however follows the player around very closely for a long time. I don't think this following behavior is a result of this change, but rather how aggression already worked.

  • I spawned a group of civilians with 100 aggression in a city. They fought the zombies around until the zombies died. The civilians then attacked me. A group of civilians with 50 aggression do not attack. This is odd, as the DDA equivalent does not seem to have this issue. This should be fixed.

  • I spawned a group of civilians with 100 aggression in a field. Saved and reloaded. Civilians are now aggressive, and won't give up on killing the player. A group spawned with 50 aggression quickly loses interest and goes back to neutral and the expected behavior. This is probably related to the issue above.

As you can see, there is still some unexpected behavior that needs to be sorted out before being merged. These issues most likely wont affect the current player experience as (i think) there are no monsters that would get aggro_character = false and need 100 aggression for some reason, but would prevent a 1:1 port of certain monsters from DDA (namely the civilians) and should be fixed anyways.

Additional context

We probably need to apply this to more monsters as well, as I only ported what DDA animals had aggro_character set to false.

CleverRaven/Cataclysm-DDA#59565 is also relevant to DDA's version of this change

if implemented #1879 would be fixed

@github-actions github-actions bot added docs PRs releated to docs page src changes related to source code. JSON related to game datas in JSON format. labels Dec 28, 2024
Copy link
Contributor

autofix-ci bot commented Dec 28, 2024

Autofix has formatted code style violation in this PR.

I edit commits locally (e.g: git, github desktop) and want to keep autofix
  1. Run git pull. this will merge the automated commit into your local copy of the PR branch.
  2. Continue working.
I do not want the automated commit
  1. Format your code locally, then commit it.
  2. Run git push --force to force push your branch. This will overwrite the automated commit on remote with your local one.
  3. Continue working.

If you don't do this, your following commits will be based on the old commit, and cause MERGE CONFLICT.

@shmakota shmakota changed the title feat(content,port): AGGRO_CHARACTER flag for enemies feat(content,port): AGGRO_CHARACTER flag for enemies Dec 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs PRs releated to docs page JSON related to game datas in JSON format. src changes related to source code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant