Brief: //dnl ch73

- Fixing bad APs deduction when using blade or blunt weapons and punching in general from different stances when need turn to your target.
Details:
- Fix wrong APs deduction and animation change when go to attack with knife or punch from prone.
- Fix no APs cost for martial artist when perform turning.
- When target was prone there was several problems in defining turnover and stance cost as range to them could vary depending of obstacles between, and as punch or stub in general use same logic put all stubbing and punching under one function MinAPsToPunch which should solve current problems with APs calculations.
- Still there are no turning cost when going to stub or punch from moving, but this problem is not related with MinAPsToAttack but with UIPlotPath which don't add turning cost, hope someone in the future will add this feature which never exist.


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6465 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Kriplo
2013-10-03 20:22:35 +00:00
parent 0668d04e1f
commit d83f23ce2b
6 changed files with 133 additions and 64 deletions
+32 -10
View File
@@ -702,9 +702,9 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa
if ( Item[ usHandItem ].usItemClass == IC_PUNCH )
{
//INT16 sCnt;
INT32 sSpot;
UINT8 ubGuyThere;
INT32 sGotLocation = NOWHERE;
INT32 sSpot;
UINT8 ubGuyThere;
INT32 sGotLocation = NOWHERE;
BOOLEAN fGotAdjacent = FALSE;
for ( INT8 sCnt = 0; sCnt < NUM_WORLD_DIRECTIONS; sCnt++ )
@@ -725,12 +725,12 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa
// We've got a guy here....
// Who is the one we want......
sGotLocation = sSpot;
sAdjustedGridNo = pTargetSoldier->sGridNo;
ubDirection = ( UINT8 )sCnt;
sAdjustedGridNo = pTargetSoldier->sGridNo;
ubDirection = ( UINT8 )sCnt;
break;
}
}
if (TileIsOutOfBounds(sGotLocation))
{
// See if we can get there to punch
@@ -1537,6 +1537,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa
//USING THE BLADE
if ( Item[ usHandItem ].usItemClass == IC_BLADE )
{
BOOLEAN fGotAdjacent = TRUE;//dnl ch73 290913
// See if we can get there to stab
if ( pSoldier->ubBodyType == BLOODCAT )
{
@@ -1552,15 +1553,37 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa
}
else
{
sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE );
//dnl ch73 290913
fGotAdjacent = FALSE;
sActionGridNo = NOWHERE;
if(pTargetSoldier)
for(INT8 sCnt=0; sCnt<NUM_WORLD_DIRECTIONS; sCnt++)
{
INT32 sSpot = NewGridNo(pSoldier->sGridNo, DirectionInc(sCnt));
if(gubWorldMovementCosts[sSpot][sCnt][bLevel] >= TRAVELCOST_BLOCKED)
continue;
if(WhoIsThere2(sSpot, pSoldier->pathing.bLevel) == pTargetSoldier->ubID)
{
sActionGridNo = sSpot;
sAdjustedGridNo = pTargetSoldier->sGridNo;
ubDirection = (UINT8)sCnt;
break;
}
}
if(TileIsOutOfBounds(sActionGridNo))
{
sActionGridNo = FindAdjacentGridEx(pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE);
if(sActionGridNo != NOWHERE)
fGotAdjacent = TRUE;
}
}
if ( sActionGridNo != -1 )
if ( sActionGridNo != NOWHERE )
{
pSoldier->aiData.usActionData = sActionGridNo;
// CHECK IF WE ARE AT THIS GRIDNO NOW
if ( pSoldier->sGridNo != sActionGridNo )
if ( pSoldier->sGridNo != sActionGridNo && fGotAdjacent )//dnl ch73 290913
{
// SEND PENDING ACTION
pSoldier->aiData.ubPendingAction = MERC_KNIFEATTACK;
@@ -1595,7 +1618,6 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa
}
}
if ( Item[ usHandItem ].usItemClass == IC_TENTACLES )
{
// See if we can get there to stab