Use the mirage data to determine the best attack in case of capture attack. Fixes #3329

This was SVN commit r16885.
This commit is contained in:
Nicolas Auvray 2015-07-27 19:54:40 +00:00
parent 851e863892
commit c81f243b58

View File

@ -345,7 +345,13 @@ Attack.prototype.GetBestAttackAgainst = function(target, allowCapture)
var captureIndex = types.indexOf("Capture")
if (captureIndex != -1)
{
var cmpCapturable = Engine.QueryInterface(target, IID_Capturable);
let cmpMirage = Engine.QueryInterface(target, IID_Mirage);
let cmpCapturable;
if (cmpMirage)
cmpCapturable = cmpMirage;
else
cmpCapturable = Engine.QueryInterface(target, IID_Capturable);
var cmpPlayer = QueryOwnerInterface(this.entity);
if (allowCapture && cmpPlayer && cmpCapturable && cmpCapturable.CanCapture(cmpPlayer.GetPlayerID()))
return "Capture";