SupSuper/OpenXcom — pull request #358 by hmaon (2013-03-01 03:03:04+00:00)
Title: Artificial Stupidity--changes to AI, possibly improvements

the code for taking cover now evaluates tiles based on multiple factors with different weights assigned to different variables; probably the most important is the amount of soldiers which can see an alien at the given tile (see surveyXComThreatToTile() in TileEngine.cpp). The AI will also try not to stand in fire, smoke, directly next to soldiers, or next to windows. It should also prefer to stand somewhat close to other aliens but not close enough to make a really tempting grenade target.

The AI also tries to keep its state around for multiple actions for a bit more continuity. This was part of an effort to make reapers stop being bad and might be unnecessary.

There's a change to validMeleeRange() which was done to allow reapers to attack targets properly. When looking for a spot from which to bite humans, the could would test the attack in all directions. After approaching the target however, the reaper would face the target and the code would check the attack only in that direction. Sometimes it would fail. This change only made it so the code checks in all directions when it comes time to actually attack. A closer look at the code is needed, I guess.

There is still a problem with melee attacks between units at different heights, especially on mountain hills!

There is also an AI option, "sneakyAI," which causes the pahtfinding code to avoid visible tiles. Turn it on if you want the ailens to cheat like crazy, I guess. Note that it doesn't work well for 2x2 units yet.

In short, this is a lot of stuff for one pull request.