- bugfix: Wrong APs deduction from stealing

- bugfix: Prevent Nada objects from stealing

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@622 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2006-11-07 21:25:26 +00:00
parent b53eec588d
commit 099ce17225
11 changed files with 88 additions and 32 deletions
BIN
View File
Binary file not shown.
+4
View File
@@ -7022,6 +7022,8 @@ void ItemPickMenuMouseMoveCallback( MOUSE_REGION * pRegion, INT32 iReason )
if ( !bChecked )
{
// WANNE: There is a big bug in the stealing routine.
/*
// Show compatible ammo...
pTempItemPool = gItemPickupMenu.ItemPoolSlots[ gItemPickupMenu.bCurSelect - gItemPickupMenu.ubScrollAnchor ];
@@ -7041,6 +7043,8 @@ void ItemPickMenuMouseMoveCallback( MOUSE_REGION * pRegion, INT32 iReason )
// Nonomori: Fix crash caused by stealing ammo in a sector with no items loaded.
// HandleAnyMercInSquadHasCompatibleStuff( (INT8)CurrentSquad( ), &(gWorldItems[ pTempItemPool->iItemIndex ].o ), FALSE );
HandleAnyMercInSquadHasCompatibleStuff( (INT8)CurrentSquad( ), pCompAmmoObject, FALSE );
*/
SetItemPickupMenuDirty( DIRTYLEVEL2 );
+4 -1
View File
@@ -2243,7 +2243,10 @@ INT8 GetAPsToStealItem( SOLDIERTYPE *pSoldier, INT16 usMapPos )
{
UINT16 sAPCost = 0;
sAPCost = PlotPath( pSoldier, usMapPos, NO_COPYROUTE, NO_PLOT, TEMPORARY, (UINT16)pSoldier->usUIMovementMode, NOT_STEALTH, FORWARD, pSoldier->bActionPoints );
if (usMapPos != -1)
{
sAPCost = PlotPath( pSoldier, usMapPos, NO_COPYROUTE, NO_PLOT, TEMPORARY, (UINT16)pSoldier->usUIMovementMode, NOT_STEALTH, FORWARD, pSoldier->bActionPoints );
}
// ADD APS TO PICKUP
sAPCost += AP_STEAL_ITEM;
+73 -24
View File
@@ -2164,16 +2164,22 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo, BOOLEAN fStea
UINT16 usOldItem;
UINT8 ubExpGain;
UINT8 ubIndexRet;
BOOLEAN fFailure;
BOOLEAN fFailure; // no stealing occured
BOOLEAN fNoMoreItems; // The enemy has no more items to steal!
// Deduct points!
// August 13 2002: unless stealing - APs already deducted elsewhere
// if (!fStealing)
// Punch the enemy
if (!fStealing)
{
sAPCost = CalcTotalAPsToAttack( pSoldier, sTargetGridNo, FALSE, pSoldier->bAimTime );
DeductPoints( pSoldier, sAPCost, 0 );
}
// Steal from the enemy
else
{
// APs were already reduced!
}
// See if a guy is here!
pTargetSoldier = SimpleFindSoldier( sTargetGridNo, pSoldier->bTargetLevel );
@@ -2188,6 +2194,7 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo, BOOLEAN fStea
if (fStealing)
{
// Calculate the possible chance to steal!
if ( AM_A_ROBOT( pTargetSoldier ) || TANK( pTargetSoldier ) || CREATURE_OR_BLOODCAT( pTargetSoldier ) || TANK( pTargetSoldier ) )
{
iHitChance = 0;
@@ -2232,28 +2239,41 @@ BOOLEAN UseHandToHand( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo, BOOLEAN fStea
// GET TARGET XY VALUES
ConvertGridNoToCenterCellXY( sTargetGridNo, &sXMapPos, &sYMapPos );
if (fStealing )
// -----------------------------------
// Steal from the Enemy
// -----------------------------------
if (fStealing )
{
fFailure=FALSE;
if ( iDiceRoll <= iHitChance )
// Do we have luck on stealing?
if ( iDiceRoll <= iHitChance && iHitChance > 0 )
{
if ( pSoldier->bTeam == gbPlayerNum && pTargetSoldier->bTeam != gbPlayerNum && !(pTargetSoldier->uiStatusFlags & SOLDIER_VEHICLE) && !AM_A_ROBOT( pTargetSoldier ) && !TANK( pTargetSoldier ) )
{
// made a steal; give experience
StatChange( pSoldier, STRAMT, 8, FALSE );
StatChange( pSoldier, DEXTAMT, 3, FALSE );
StatChange( pSoldier, AGILAMT, 3, FALSE );
}
// Do we have the chance to steal more than 1 item?
if (( iDiceRoll <= iHitChance * 2 / 3) || (pTargetSoldier->bCollapsed))
{
if (StealItems(pSoldier, pTargetSoldier,&ubIndexRet) == 1)
INT16 sNumStolenItems = StealItems(pSoldier, pTargetSoldier,&ubIndexRet);
// We have only stolen 1 item, because the enemy has not more than one item.
if ( sNumStolenItems == 1)
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, Message[ STR_STOLE_SOMETHING ], pSoldier->name, ShortItemNames[ pTargetSoldier->inv[ubIndexRet].usItem ] );
// Try to place the item in the merc inventory
if (!AutoPlaceObject( pSoldier, &(pTargetSoldier->inv[ubIndexRet]), TRUE ))
{
// Place the item on the ground
AddItemToPool( pSoldier->sGridNo, &(pTargetSoldier->inv[HANDPOS]), 1, pSoldier->bLevel, 0, -1 );
}
DeleteObj( &(pTargetSoldier->inv[ubIndexRet]) );
}
// The enemy has no more items to steal
else if (sNumStolenItems == 0)
{
fNoMoreItems = TRUE;
}
}
// We had not much luck, so we can only steal 1 item.
else if ( pTargetSoldier->inv[HANDPOS].usItem != NOTHING )
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, Message[ STR_STOLE_SOMETHING ], pSoldier->name, ShortItemNames[ pTargetSoldier->inv[HANDPOS].usItem ] );
@@ -2279,46 +2299,75 @@ if (fStealing )
// Reload buddy's animation...
ReLoadSoldierAnimationDueToHandItemChange( pTargetSoldier, usOldItem, NOTHING );
}
// Steal was successfull, but the enemy had nothing to steal (we had stolen the Nada item)
else
{
fFailure=TRUE;
fNoMoreItems = TRUE;
//fFailure=TRUE;
}
// Reload buddy's animation...
//ReLoadSoldierAnimationDueToHandItemChange( pTargetSoldier, usOldItem, NOTHING );
}
// We could not steal from the enemy, we had no luck
else
{
fFailure=TRUE;
}
// We failed to steal something!
if (fFailure)
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE,
Message[ STR_FAILED_TO_STEAL_SOMETHING ],
pSoldier->name, ShortItemNames[ pTargetSoldier->inv[HANDPOS].usItem ] );
if ( pSoldier->bTeam == gbPlayerNum )
// Only report if it was not the Nada item!
if (pTargetSoldier->inv[HANDPOS].usItem != NOTHING)
{
DoMercBattleSound( pSoldier, BATTLE_SOUND_CURSE1 );
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE,
Message[ STR_FAILED_TO_STEAL_SOMETHING ],
pSoldier->name, ShortItemNames[ pTargetSoldier->inv[HANDPOS].usItem ] );
if ( pSoldier->bTeam == gbPlayerNum )
{
DoMercBattleSound( pSoldier, BATTLE_SOUND_CURSE1 );
}
}
}
// The enemy had no more items to steal, or we had stolen the Nada item
if (fNoMoreItems == TRUE)
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE,
Message[ STR_NO_MORE_ITEMS_TO_STEAL ],
pSoldier->name, ShortItemNames[ pTargetSoldier->inv[HANDPOS].usItem ] );
}
if ( iHitChance > 0 && pSoldier->bTeam == gbPlayerNum && pTargetSoldier->bTeam != gbPlayerNum && !(pTargetSoldier->uiStatusFlags & SOLDIER_VEHICLE) && !AM_A_ROBOT( pTargetSoldier ) && !TANK( pTargetSoldier ) )
{
// Give some experience
if ( iHitChance > 0 && pSoldier->bTeam == gbPlayerNum && pTargetSoldier->bTeam != gbPlayerNum && !(pTargetSoldier->uiStatusFlags & SOLDIER_VEHICLE) && !AM_A_ROBOT( pTargetSoldier ) && !TANK( pTargetSoldier ) )
{
if (fFailure == FALSE)
{
// We were successfull in stealing. Give some experience
StatChange( pSoldier, STRAMT, 8, FALSE );
StatChange( pSoldier, DEXTAMT, 3, FALSE );
StatChange( pSoldier, AGILAMT, 3, FALSE );
}
else
{
// failed a steal; give some experience
StatChange( pSoldier, STRAMT, 4, FROM_FAILURE );
StatChange( pSoldier, DEXTAMT, 1, FROM_FAILURE );
StatChange( pSoldier, AGILAMT, 1, FROM_FAILURE );
}
}
#ifdef JA2BETAVERSION
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("@@@@@@@ Freeing up attacker - steal") );
#endif
FreeUpAttacker( (UINT8) pSoldier->ubID );
}
// -----------------------------------
// Punch, Kick the Enemy
// -----------------------------------
else
{
// ATE/CC: if doing ninja spin kick (only), automatically make it a hit
if ( pSoldier->usAnimState == NINJA_SPINKICK)
{
+1 -1
View File
@@ -285,7 +285,7 @@ UINT16 Message[][STRING_LENGTH] =
L"Beurt bloodcats",
L"automatic",
L"no full auto",
L"No more items to steal!",
L"The enemy has no more items to steal!", // WANNE
};
+1 -1
View File
@@ -300,7 +300,7 @@ UINT16 Message[][STRING_LENGTH] =
L"accurate",
L"inaccurate",
L"no semi auto",
L"No more items to steal!", // WANNE
L"The enemy has no more items to steal!", // WANNE
};
+1 -1
View File
@@ -291,7 +291,7 @@ UINT16 Message[][STRING_LENGTH] =
L"Tour des chats sauvages",
L"automatic",
L"no full auto",
L"No more items to steal!",
L"The enemy has no more items to steal!", // WANNE
};
+1 -1
View File
@@ -293,7 +293,7 @@ UINT16 Message[][STRING_LENGTH] =
L"genau",
L"ungenau",
L"kein Einzelschuss",
L"Es sind keine Gegenstände mehr zum Stehlen vorhanden!",
L"Der Gegner besitzt keine Gegenstände mehr zum Stehlen!",
};
CHAR16 pTownNames[MAX_TOWNS][MAX_TOWN_NAME_LENGHT] =
+1 -1
View File
@@ -284,7 +284,7 @@ UINT16 Message[][STRING_LENGTH] =
L"Turno dei Bloodcat",
L"automatic",
L"no full auto",
L"No more items to steal!",
L"The enemy has no more items to steal!", // WANNE
};
+1 -1
View File
@@ -285,7 +285,7 @@ UINT16 Message[][STRING_LENGTH] =
L"Tura dzikich kotów",
L"automatic",
L"no full auto",
L"No more items to steal!",
L"The enemy has no more items to steal!", // WANNE
};
+1 -1
View File
@@ -292,7 +292,7 @@ UINT16 Message[][STRING_LENGTH] =
L"accurate",
L"inaccurate",
L"no semi auto",
L"No more items to steal!",
L"The enemy has no more items to steal!", // WANNE
};