ZC7RMRAEGOJTHV4EZMR5MWIIRNT3BN4DXLXERJSAFRTNP5JUVAEQC
CBG5GWG7Z4CZRZ4MQLZF6CCPDO7B2BBEBCSXTAWXLAHUGHAHENGQC
WVILZZOZWLDB3W3WPJOMTB3Z2U3CJLHXHSEONFDZ762ZCS4P6UTAC
6GNTEDE4K6MYWCBF7YXRRJ6MD66QOTVW74QWNGBYJMNN37ABZJWAC
VHVL5HH44FNS7FRY53O7727TZ3OP26HDQQGGHQZ4JTJAYXMP27UAC
X4IR7ZAH5HH56FIYSSOUKOQDRLNKH5LOHQ5ZYQGQQLML67RLZGMQC
JSCVVDFDJPB44MYIIERF62A6R7G5I5NDGLXFTL43TP6T4OFREQHAC
MPALURGP7HNDFGGHAZ35E6FGMVJQ4IBQGY6BRKZUM5MI2IGYLE5AC
UA2L2WYU5OIVO5OYLOSTGSXLNHPWSSMDE6DDWUSWV5AOHSEUGIBQC
PeekHead = VisInfo.SourceTile;
`log("PeekTile:"@PeekHead.X@","@PeekHead.Y@","@PeekHead.Z, true, 'XCom_HitRolls');
PeekHead.Z += 1;
`log("PeekHead:"@PeekHead.X@","@PeekHead.Y@","@PeekHead.Z, true, 'XCom_HitRolls');
ShooterPeekTile = VisInfo.SourceTile;
ShooterPeekTile.Z += 1;
`log("ShooterPeekTile:"@ShooterPeekTile.X@","@ShooterPeekTile.Y@","@ShooterPeekTile.Z, true, 'XCom_HitRolls');
`log("Shooter floor:"@`XWORLD.GetFloorTileZ(ShooterTile));
for (i=ExistingCoverHeight; i<=TargetHeight; i++)
// FarCover to a tile which may already be granting cover
FarCover = 0;
NoLineOfSight = true;
ShooterPeekVec = `XWORLD.GetPositionFromTileCoordinates(ShooterPeekTile);
LosTile = TargetTile;
LosTile.Z = `XWORLD.GetFloorTileZ(TargetTile);
LosVec = `XWORLD.GetPositionFromTileCoordinates(LosTile);
Floor = LosVec.Z;
for (i = 16; i<TargetState.UnitHeight * 64; i += 16)
`log("LOS blocked by far cover:"@i@","@VisInfo.TargetCover, true, 'XCom_HitRolls');
`log("Blocking tile:"@RayTrace.BlockedTile.X@","@RayTrace.BlockedTile.Y@","@RayTrace.BlockedTile.Z, true, 'XCom_HitRolls');
FarCover += 1;
// Don't apply far cover to existing cover or above the target's head
if (i > ExistingCoverHeight*64 && i <= TargetHeight*64)
{
`log("LOS blocked by far cover vector:"@i@","@VisInfo.TargetCover, true, 'XCom_HitRolls');
FarCover += 1;
}
else if (i <= ExistingCoverHeight*64)
{
`log("Hit existing cover:"@RayTrace.BlockedTile.X@","@RayTrace.BlockedTile.Y@","@RayTrace.BlockedTile.Z, true, 'XCom_HitRolls');
}
}
else if (i <= TargetHeight*64)
{
NoLineOfSight = false;