New feature: Diseaes affect your mercenaries. They can be contracted in varíous ways and have varying effects.

For more info, see http://www.ja-galaxy-forum.com/ubbthreads.php/topics/334918#Post334918

Requires GameDir >= r2099.

Does not break savegame compatibility.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7384 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2014-08-10 13:45:11 +00:00
parent 09244c2369
commit 36e9d15edc
96 changed files with 5569 additions and 1573 deletions
+63 -60
View File
@@ -7072,78 +7072,81 @@ static int l_ACTION_ITEM_SEX (lua_State *L)
{
sGridNo = lua_tointeger(L, 1);
if ( ! (gTacticalStatus.uiFlags & INCOMBAT) )
{
UINT8 ubID;
OBJECTTYPE DoorCloser;
INT16 sTeleportSpot;
INT16 sDoorSpot;
UINT8 ubDirection;
//DBrot: More Rooms
//UINT8 ubRoom, ubOldRoom;
UINT16 usRoom, usOldRoom;
// Flugente: check for valid sGridNo
if ( TileIsOutOfBounds(sGridNo) )
return 0;
ubID = WhoIsThere2( sGridNo, 0 );
if ( (ubID != NOBODY) && (MercPtrs[ ubID ]->bTeam == gbPlayerNum) )
if ( ! (gTacticalStatus.uiFlags & INCOMBAT) )
{
if ( InARoom( sGridNo, &usRoom ) && InARoom( MercPtrs[ ubID ]->sOldGridNo, &usOldRoom ) && usOldRoom != usRoom )
UINT8 ubID;
OBJECTTYPE DoorCloser;
INT16 sTeleportSpot;
INT16 sDoorSpot;
UINT8 ubDirection;
//DBrot: More Rooms
//UINT8 ubRoom, ubOldRoom;
UINT16 usRoom, usOldRoom;
// Flugente: check for valid sGridNo
if ( TileIsOutOfBounds(sGridNo) )
return 0;
ubID = WhoIsThere2( sGridNo, 0 );
if ( (ubID != NOBODY) && (MercPtrs[ ubID ]->bTeam == gbPlayerNum) )
{
// also require there to be a miniskirt civ in the room
if ( HookerInRoom( usRoom ) )
if ( InARoom( sGridNo, &usRoom ) && InARoom( MercPtrs[ ubID ]->sOldGridNo, &usOldRoom ) && usOldRoom != usRoom )
{
// stop the merc...
MercPtrs[ ubID ]->EVENT_StopMerc( MercPtrs[ ubID ]->sGridNo, MercPtrs[ ubID ]->ubDirection );
// also require there to be a miniskirt civ in the room
if ( HookerInRoom( usRoom ) )
{
// stop the merc...
MercPtrs[ ubID ]->EVENT_StopMerc( MercPtrs[ ubID ]->sGridNo, MercPtrs[ ubID ]->ubDirection );
if ( sGridNo == gModSettings.iCarlaDoorGridNo +1 )
{
sDoorSpot = gModSettings.iCarlaDoorGridNo;
sTeleportSpot = gModSettings.iCarlaDoorGridNo;
}
else if ( sGridNo == gModSettings.iCindyDoorGridNo +1 )
{
sDoorSpot = gModSettings.iCindyDoorGridNo;
sTeleportSpot = gModSettings.iCindyDoorGridNo;
}
else if ( sGridNo == gModSettings.iBambiDoorGridNo )
{
sDoorSpot = gModSettings.iBambiDoorGridNo;
sTeleportSpot = gModSettings.iBambiDoorGridNo +1;
}
else
{
sDoorSpot = NOWHERE;
sTeleportSpot = NOWHERE;
}
if ( sGridNo == gModSettings.iCarlaDoorGridNo +1 )
{
sDoorSpot = gModSettings.iCarlaDoorGridNo;
sTeleportSpot = gModSettings.iCarlaDoorGridNo;
}
else if ( sGridNo == gModSettings.iCindyDoorGridNo +1 )
{
sDoorSpot = gModSettings.iCindyDoorGridNo;
sTeleportSpot = gModSettings.iCindyDoorGridNo;
}
else if ( sGridNo == gModSettings.iBambiDoorGridNo )
{
sDoorSpot = gModSettings.iBambiDoorGridNo;
sTeleportSpot = gModSettings.iBambiDoorGridNo +1;
}
else
{
sDoorSpot = NOWHERE;
sTeleportSpot = NOWHERE;
}
if (!TileIsOutOfBounds(sDoorSpot) && !TileIsOutOfBounds(sTeleportSpot) )
{
// close the door...
DoorCloser[0]->data.misc.bActionValue = ACTION_ITEM_CLOSE_DOOR;
PerformItemAction( sDoorSpot, &DoorCloser );
if (!TileIsOutOfBounds(sDoorSpot) && !TileIsOutOfBounds(sTeleportSpot) )
{
// close the door...
DoorCloser[0]->data.misc.bActionValue = ACTION_ITEM_CLOSE_DOOR;
PerformItemAction( sDoorSpot, &DoorCloser );
// have sex
HandleNPCDoAction( 0, NPC_ACTION_SEX, 0 );
// have sex
HandleNPCDoAction( 0, NPC_ACTION_SEX, 0 );
// move the merc outside of the room again
sTeleportSpot = FindGridNoFromSweetSpotWithStructData( MercPtrs[ ubID ], STANDING, sTeleportSpot, 2, &ubDirection, FALSE );
MercPtrs[ ubID ]->ChangeSoldierState( STANDING, 0, TRUE );
TeleportSoldier( MercPtrs[ ubID ], sTeleportSpot, FALSE );
// move the merc outside of the room again
sTeleportSpot = FindGridNoFromSweetSpotWithStructData( MercPtrs[ ubID ], STANDING, sTeleportSpot, 2, &ubDirection, FALSE );
MercPtrs[ ubID ]->ChangeSoldierState( STANDING, 0, TRUE );
TeleportSoldier( MercPtrs[ ubID ], sTeleportSpot, FALSE );
HandleMoraleEvent( MercPtrs[ ubID ], MORALE_SEX, gWorldSectorX, gWorldSectorY, gbWorldSectorZ );
FatigueCharacter( MercPtrs[ ubID ] );
FatigueCharacter( MercPtrs[ ubID ] );
FatigueCharacter( MercPtrs[ ubID ] );
FatigueCharacter( MercPtrs[ ubID ] );
DirtyMercPanelInterface( MercPtrs[ ubID ], DIRTYLEVEL1 );
HandleMoraleEvent( MercPtrs[ ubID ], MORALE_SEX, gWorldSectorX, gWorldSectorY, gbWorldSectorZ );
FatigueCharacter( MercPtrs[ ubID ] );
FatigueCharacter( MercPtrs[ ubID ] );
FatigueCharacter( MercPtrs[ ubID ] );
FatigueCharacter( MercPtrs[ ubID ] );
DirtyMercPanelInterface( MercPtrs[ ubID ], DIRTYLEVEL1 );
// Flugente: we might get a disease from this...
HandlePossibleInfection( MercPtrs[ubID], NULL, INFECTION_TYPE_SEX );
}
}
}
}
}
}
}
return 0;
}