diff --git a/JA2.suo b/JA2.suo index 06ec7029..e3b58049 100644 Binary files a/JA2.suo and b/JA2.suo differ diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index cdc41082..f59ae822 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -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 ); diff --git a/Tactical/Points.cpp b/Tactical/Points.cpp index 279ef2f6..d4338a1d 100644 --- a/Tactical/Points.cpp +++ b/Tactical/Points.cpp @@ -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; diff --git a/Tactical/Weapons.cpp b/Tactical/Weapons.cpp index 073fafc6..b32368fd 100644 --- a/Tactical/Weapons.cpp +++ b/Tactical/Weapons.cpp @@ -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) { diff --git a/Utils/_DutchText.cpp b/Utils/_DutchText.cpp index c0bd24c2..90c296cb 100644 --- a/Utils/_DutchText.cpp +++ b/Utils/_DutchText.cpp @@ -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 }; diff --git a/Utils/_EnglishText.cpp b/Utils/_EnglishText.cpp index 41b8ba3d..a3bf280a 100644 --- a/Utils/_EnglishText.cpp +++ b/Utils/_EnglishText.cpp @@ -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 }; diff --git a/Utils/_FrenchText.cpp b/Utils/_FrenchText.cpp index 5c1d1c17..bb0dcd7d 100644 --- a/Utils/_FrenchText.cpp +++ b/Utils/_FrenchText.cpp @@ -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 }; diff --git a/Utils/_GermanText.cpp b/Utils/_GermanText.cpp index e6f3f9c1..2d47c221 100644 --- a/Utils/_GermanText.cpp +++ b/Utils/_GermanText.cpp @@ -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] = diff --git a/Utils/_ItalianText.cpp b/Utils/_ItalianText.cpp index 1db603d1..61777e40 100644 --- a/Utils/_ItalianText.cpp +++ b/Utils/_ItalianText.cpp @@ -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 }; diff --git a/Utils/_PolishText.cpp b/Utils/_PolishText.cpp index 61e20f51..0588ad16 100644 --- a/Utils/_PolishText.cpp +++ b/Utils/_PolishText.cpp @@ -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 }; diff --git a/Utils/_RussianText.cpp b/Utils/_RussianText.cpp index 3bface50..2f534166 100644 --- a/Utils/_RussianText.cpp +++ b/Utils/_RussianText.cpp @@ -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 };