aliens

Author Topic: hit angle and armor side  (Read 315 times)

Offline TrickyTriscene

  • Sergeant
  • **
  • Posts: 18
    • View Profile
hit angle and armor side
« on: October 05, 2021, 02:58:58 pm »
Maybe someone knows more about this, I don't know the mechanics.

But some naut was hit at 20 degrees or so and I expected front armor to kick in and save me. At 132/142 you should have no danger from blasta rifles. The naut was killed.

What about, if you hit an enemy and it retaliates, you should always enjoy front armor. Because during the shot you are not on 45 degree clicks but facing the alien straight.
And we need the angular rules explained somewhere.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 6968
  • OXCE developer
    • View Profile
    • My Wiki
Re: hit angle and armor side
« Reply #1 on: October 05, 2021, 03:04:53 pm »
Code: [Select]
if (!type->IgnoreDirection)
{
if (relative == Position(0, 0, 0))
{
side = SIDE_UNDER;
}
else
{
int relativeDirection;
const int abs_x = abs(relative.x);
const int abs_y = abs(relative.y);
if (abs_y > abs_x * 2)
relativeDirection = 8 + 4 * (relative.y > 0);
else if (abs_x > abs_y * 2)
relativeDirection = 10 + 4 * (relative.x < 0);
else
{
if (relative.x < 0)
{
if (relative.y > 0)
relativeDirection = 13;
else
relativeDirection = 15;
}
else
{
if (relative.y > 0)
relativeDirection = 11;
else
relativeDirection = 9;
}
}

switch((relativeDirection - _direction) % 8)
{
case 0: side = SIDE_FRONT; break;
case 1: side = RNG::generate(0,2) < 2 ? SIDE_FRONT:SIDE_RIGHT; break;
case 2: side = SIDE_RIGHT; break;
case 3: side = RNG::generate(0,2) < 2 ? SIDE_REAR:SIDE_RIGHT; break;
case 4: side = SIDE_REAR; break;
case 5: side = RNG::generate(0,2) < 2 ? SIDE_REAR:SIDE_LEFT; break;
case 6: side = SIDE_LEFT; break;
case 7: side = RNG::generate(0,2) < 2 ? SIDE_FRONT:SIDE_LEFT; break;
}
if (relative.z >= getHeight())
{
bodypart = BODYPART_HEAD;
}
else if (relative.z > 4)
{
switch(side)
{
case SIDE_LEFT: bodypart = BODYPART_LEFTARM; break;
case SIDE_RIGHT: bodypart = BODYPART_RIGHTARM; break;
default: bodypart = BODYPART_TORSO;
}
}
else
{
switch(side)
{
case SIDE_LEFT: bodypart = BODYPART_LEFTLEG; break;
case SIDE_RIGHT: bodypart = BODYPART_RIGHTLEG; break;
default:
bodypart = (UnitBodyPart) RNG::generate(BODYPART_RIGHTLEG,BODYPART_LEFTLEG);
}
}
}
}

Offline The Reaver of Darkness

  • Commander
  • *****
  • Posts: 1449
    • View Profile
Re: hit angle and armor side
« Reply #2 on: October 05, 2021, 06:33:11 pm »
If the aquanaut is facing the enemy, they will tend to get hit in the front, but will frequently get hit on either side. Only their back armor will not be hit-able. You can mod the armor facings if you don't like such weak sides making your front vulnerable.

The soldier's hitbox is a cylinder divided into four quadrants. If a soldier faces their diagonal toward the enemy, such that exactly two quadrants are visible to the enemy, then the odds of hitting either of the two far quadrants is drastically reduced if not eliminated entirely.

Some mods add a left-side shield to soldiers, so that they have especially high front and left armor. Those units will have very sturdy and reliable defense when properly facing the enemy, but it takes up the left-hand slot so that they cannot use a two-hand weapon with full accuracy.
I don't know all of the details, but you can harvest the work from other mods which have done it, listed here:
Re: [Q] Riot Shield mod for Open XCOM Extended?

- - -

Under armor only applies to explosive-type attacks (such as HE, freeze) which detonate either under or adjacent to the soldier. If the center of the blast is any farther than that, it will also hit side armor.
« Last Edit: October 05, 2021, 06:39:33 pm by The Reaver of Darkness »

Offline TrickyTriscene

  • Sergeant
  • **
  • Posts: 18
    • View Profile
Re: hit angle and armor side
« Reply #3 on: October 08, 2021, 01:17:03 pm »
So if you're straight under a Xarq or Tent you can hit their soft spot, the under armor. I don't know if an alien dropping on you is lethal or not.
And if the ratio x and y is sharper than 2, so angles sharper than 27 deg, the shot will meet the pure side (like the front). Other angles will give a 50/50 roll between the two concerning sides.
But I see >, not >= so you need 1 extra square above the 2:1 to make it sharp enough for 132/142.