forked from 0ad/0ad
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:
parent
851e863892
commit
c81f243b58
@ -345,7 +345,13 @@ Attack.prototype.GetBestAttackAgainst = function(target, allowCapture)
|
|||||||
var captureIndex = types.indexOf("Capture")
|
var captureIndex = types.indexOf("Capture")
|
||||||
if (captureIndex != -1)
|
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);
|
var cmpPlayer = QueryOwnerInterface(this.entity);
|
||||||
if (allowCapture && cmpPlayer && cmpCapturable && cmpCapturable.CanCapture(cmpPlayer.GetPlayerID()))
|
if (allowCapture && cmpPlayer && cmpCapturable && cmpCapturable.CanCapture(cmpPlayer.GetPlayerID()))
|
||||||
return "Capture";
|
return "Capture";
|
||||||
|
Loading…
Reference in New Issue
Block a user