-
-
Notifications
You must be signed in to change notification settings - Fork 83
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
Action scripts - AngerNodes manipulation #442
base: develop
Are you sure you want to change the base?
Action scripts - AngerNodes manipulation #442
Conversation
in SetTheMostHatedHouse() & GetTheMostHatedHouse()
Nightly build for this pull request:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, review your code for properly formatted "if" long statement separation (most of them I highlighted) and "switch" statements (availability of the required blank lines). And also break up long log lines.
Co-authored-by: YRIDZE <78161538+YRIDZE@users.noreply.github.com>
Co-authored-by: YRIDZE <78161538+YRIDZE@users.noreply.github.com>
Co-authored-by: YRIDZE <78161538+YRIDZE@users.noreply.github.com>
Co-authored-by: YRIDZE <78161538+YRIDZE@users.noreply.github.com>
Co-authored-by: YRIDZE <78161538+YRIDZE@users.noreply.github.com>
Co-authored-by: YRIDZE <78161538+YRIDZE@users.noreply.github.com>
When using ObjectInfo or the AngerNode Action is executed successfuly some debug lines will be written in debug.log with the current AngerNode values of each house.
For the testing of the PR I added some new debug lines that will appear in debug.log each time the action is executed successfuly or ObjectInfo is used. Data will look like this:
How interpret each House's line?: |
c3d0a52
to
1abda28
Compare
- Observers should be ignored. - small tweaks.
aae92fd
to
a32076e
Compare
Nightly build for this pull request:
This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build. |
Warning Rate Limit Exceeded@FS-21 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 29 minutes and 40 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some code style nitpicks, maybe try to reduce replicated code where possible.
// Invalid team | ||
if (!pTeam) | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this will ever be nullptr
unless something is seriously wrong, and in that case this code not working is least of your worries so I don't think this check is necessary.
if (!pTeam) | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto with the nullptr
check here.
auto pTeamData = TeamExt::ExtMap.Find(pTeam); | ||
if (!pTeamData) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add empty line before the if statement.
if (!pTeam) | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto with the nullptr
check here.
auto pTeamData = TeamExt::ExtMap.Find(pTeam); | ||
if (!pTeamData) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto with if statement and spacing.
auto pTeamData = TeamExt::ExtMap.Find(pTeam); | ||
if (!pTeamData || pTeamData->AngerNodeModifier == 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto with if statement and spacing.
if (!pTeam) | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto with the nullptr
check here.
auto pTeamData = TeamExt::ExtMap.Find(pTeam); | ||
if (!pTeamData) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto with if statement and spacing.
ScriptExt::UpdateEnemyHouseIndex(pHouse); | ||
} | ||
|
||
ScriptExt::DebugAngerNodesData(); // Remove this line before merging into develop branch! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About time to do it, right?
void ScriptExt::DebugAngerNodesData() | ||
{ | ||
ScriptExt::Log("Updated AngerNodes lists of every playable House:\n"); | ||
|
||
for (auto pHouse : *HouseClass::Array) | ||
{ | ||
if (pHouse->IsObserver()) | ||
ScriptExt::Log("Player %d [Observer] ", pHouse->ArrayIndex); | ||
else | ||
ScriptExt::Log("Player %d [%s]: ", pHouse->ArrayIndex, pHouse->Type->ID); | ||
|
||
int i = 0; | ||
|
||
for (auto& angerNode : pHouse->AngerNodes) | ||
{ | ||
if (!pHouse->IsObserver()) | ||
ScriptExt::Log("%d:%d", angerNode.House->ArrayIndex, angerNode.AngerLevel); | ||
|
||
if (i < HouseClass::Array->Count - 2 && !pHouse->IsObserver()) | ||
ScriptExt::Log(", "); | ||
|
||
i++; | ||
} | ||
|
||
if (!pHouse->IsObserver()) | ||
ScriptExt::Log(" -> Main Enemy House: %d\n", pHouse->EnemyHouseIndex); | ||
else | ||
ScriptExt::Log("\n"); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably no longer needed then either.
This pack of actions manipulates the hate of the houses towards other houses. This don't replace the game function "make_enemies()" but helps the AI to pick the one with highest value for being the most hated (the main enemy of the house used in the AI trigger tag called "OnlyTargetHouseEnemy").
The hate table values of all Houses increase quickly depending of how much time another house is attacking by another house & decreases very slow in moments of peace.
Curiosity note: this can be used for overriding the known MP bug of allied AI with the human player at the beginning of the games that they start as pacifists until they get attacked by others (because their only hated player is the 1º human player and that one is "ally" so they can't attack him).
The same reason explains why initially in the MP battle all AI houses attacks the player.
No official documentation yet but I'll copy here all the details & possible values of each action: