-
Notifications
You must be signed in to change notification settings - Fork 151
Fixed Guard Retaliation #2197
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
base: main
Are you sure you want to change the base?
Fixed Guard Retaliation #2197
Conversation
Greptile Overview
|
| Filename | Overview |
|---|---|
| GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp | Removed attackAggressors condition from AI_GUARD_INNER and AI_GUARD_RETURN states to prevent incorrect retaliation behavior |
| GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGuardRetaliate.cpp | Removed attackAggressors condition from AI_GUARD_RETALIATE_RETURN state to prevent incorrect retaliation behavior during return movement |
Sequence Diagram
sequenceDiagram
participant Unit as Guard Unit
participant Idle as IDLE State
participant Inner as INNER State
participant Return as RETURN State
participant AttackAgg as ATTACK_AGGRESSOR State
Note over Unit,AttackAgg: Before Fix
Unit->>Return: Move to guard position
Return-->>AttackAgg: Unit gets attacked (attackAggressors)
AttackAgg->>AttackAgg: Retaliate inappropriately
Note over Unit,AttackAgg: After Fix
Unit->>Return: Move to guard position
Note over Return: No retaliation while returning
Return->>Idle: Reach guard position
Idle-->>AttackAgg: Unit gets attacked (attackAggressors)
AttackAgg->>AttackAgg: Retaliate correctly
AttackAgg->>Inner: Return to guard
Note over Unit,AttackAgg: State Transition Logic
Idle->>Inner: Enemy detected in range
Inner->>Inner: Engage enemy
Inner->>Return: Combat complete
Return->>Idle: Reached guard position
| defineState( AI_GUARD_INNER, newInstance(AIGuardInnerState)( this ), AI_GUARD_OUTER, AI_GUARD_OUTER ); | ||
| defineState( AI_GUARD_RETURN, newInstance(AIGuardReturnState)( this ), AI_GUARD_IDLE, AI_GUARD_INNER ); |
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.
Needs to check RETAIL_COMPATIBLE_CRC to maintain retail compatibility.
| defineState( AI_GUARD_INNER, newInstance(AIGuardInnerState)( this ), AI_GUARD_OUTER, AI_GUARD_OUTER ); | |
| defineState( AI_GUARD_RETURN, newInstance(AIGuardReturnState)( this ), AI_GUARD_IDLE, AI_GUARD_INNER ); | |
| #if RETAIL_COMPATIBLE_CRC | |
| defineState( AI_GUARD_INNER, newInstance(AIGuardInnerState)( this ), AI_GUARD_OUTER, AI_GUARD_OUTER, attackAggressors ); | |
| defineState( AI_GUARD_RETURN, newInstance(AIGuardReturnState)( this ), AI_GUARD_IDLE, AI_GUARD_INNER, attackAggressors ); | |
| #else | |
| defineState( AI_GUARD_INNER, newInstance(AIGuardInnerState)( this ), AI_GUARD_OUTER, AI_GUARD_OUTER ); | |
| defineState( AI_GUARD_RETURN, newInstance(AIGuardReturnState)( this ), AI_GUARD_IDLE, AI_GUARD_INNER ); | |
| #endif |
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.
Also needs // TheSuperHackers @bugfix ... comment in the #else block.
| @@ -184,7 +184,7 @@ AIGuardRetaliateMachine::AIGuardRetaliateMachine( Object *owner ) : | |||
| // srj sez: I made "return" the start state, so that if ordered to guard a position | |||
| // that isn't the unit's current position, it moves to that position first. | |||
| defineState( AI_GUARD_RETALIATE_ATTACK_AGGRESSOR, newInstance(AIGuardRetaliateAttackAggressorState)( this ), AI_GUARD_RETALIATE_RETURN, AI_GUARD_RETALIATE_RETURN ); | |||
| defineState( AI_GUARD_RETALIATE_RETURN, newInstance(AIGuardRetaliateReturnState)( this ), AI_GUARD_RETALIATE_IDLE, AI_GUARD_RETALIATE_INNER, attackAggressors ); | |||
| defineState( AI_GUARD_RETALIATE_RETURN, newInstance(AIGuardRetaliateReturnState)( this ), AI_GUARD_RETALIATE_IDLE, AI_GUARD_RETALIATE_INNER ); | |||
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.
Needs to check RETAIL_COMPATIBLE_CRC to maintain retail compatibility.
| defineState( AI_GUARD_RETALIATE_RETURN, newInstance(AIGuardRetaliateReturnState)( this ), AI_GUARD_RETALIATE_IDLE, AI_GUARD_RETALIATE_INNER ); | |
| #if RETAIL_COMPATIBLE_CRC | |
| defineState( AI_GUARD_RETALIATE_RETURN, newInstance(AIGuardRetaliateReturnState)( this ), AI_GUARD_RETALIATE_IDLE, AI_GUARD_RETALIATE_INNER, attackAggressors ); | |
| #else | |
| defineState( AI_GUARD_RETALIATE_RETURN, newInstance(AIGuardRetaliateReturnState)( this ), AI_GUARD_RETALIATE_IDLE, AI_GUARD_RETALIATE_INNER ); | |
| #endif |
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.
Also needs // TheSuperHackers @bugfix ... comment in the #else block.
Made Guard do what its supposed to instead of retaliating when its not supposed to.
Fix for:
#2097