Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#3284 closed defect (fixed)

[PATCH] Stand ground units don't attack

Reported by: Karamel Owned by: mimo
Priority: Should Have Milestone: Alpha 19
Component: UI & Simulation Keywords: patch
Cc: Patch:

Description

On stand ground stance, units try to use Capture to hold position and will attack only when attacked.

This patch prevent GetBestAttack to pick Capture (the first declared).

Attachments (3)

attack_patch.diff (610 bytes ) - added by Karamel 9 years ago.
Static attack preference for best attack
attack_patch.2.diff (4.0 KB ) - added by Karamel 9 years ago.
GetBestAttack replacement patch
0001-GetBestAttack-replacement-stand-ground-response.patch (4.8 KB ) - added by Karamel 9 years ago.
Attack patch with code style review

Download all attachments as: .zip

Change History (13)

by Karamel, 9 years ago

Attachment: attack_patch.diff added

Static attack preference for best attack

comment:1 by Karamel, 9 years ago

Keywords: review added
Milestone: BacklogAlpha 19
Summary: [Patch] Stand ground units don't attack[PATCH] Stand ground units don't attack

comment:2 by Vladislav Belov, 9 years ago

You can replace this.GetAttackTypes().pop(); to types.pop();. And what's with line breaks?

Last edited 9 years ago by Vladislav Belov (previous) (diff)

comment:3 by leper, 9 years ago

Keywords: review removed

Should be solved by querying with the biggest range, or best attack against a target instead of hard-coding more things.

comment:4 by sanderd17, 9 years ago

There's a separate function to determine the best attack against a target. The overall best attack is hard to determine.

IMO, this function should be deleted, and the code that uses it should instead consider what might be the best attack.

comment:5 by Karamel, 9 years ago

Keywords: review added

GetBestAttack was only used to check range in standing ground and as a workaround for some formation versus formation while defending or standing ground.

I replaced it by GetFullAttackRange to get the full action range. The formation part is more complex and need a lot of more work in formation orders to be fixed (and it wasn't more elegant). It will be subject to more tickets and patches.

by Karamel, 9 years ago

Attachment: attack_patch.2.diff added

GetBestAttack replacement patch

by Karamel, 9 years ago

Attack patch with code style review

comment:6 by Karamel, 9 years ago

Here is the latest patch with code style review from Itms

comment:7 by Stan, 9 years ago

Milestone: Alpha 19Alpha 20

Pushing it as we are in FF

comment:8 by mimo, 9 years ago

Owner: set to mimo
Resolution: fixed
Status: newclosed

In 17109:

fix standGround units not attacking, patch by karamel, fixes #3284

comment:9 by Stan, 9 years ago

Milestone: Alpha 20Alpha 19

comment:10 by mimo, 9 years ago

Keywords: review removed

As all turrets are in standground, this bug was affecting the garrison on walls, so I've pushed it back to a19.

karamel, thanks for the patch. I nonetheless slightly modified it (main change is using "for of" instead of "for in" for arrays when you don't need the array indices).

Note: See TracTickets for help on using tickets.