mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
- Prisoner system can now be correctly turned off.
- improved handcuffing checks git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5712 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -5477,6 +5477,9 @@ extern INT32 giReinforcementPool;
|
||||
// handle processing of prisoners
|
||||
void HandlePrisonerProcessingInSector( INT16 sMapX, INT16 sMapY, INT8 bZ )
|
||||
{
|
||||
if ( !gGameExternalOptions.fAllowPrisonerSystem )
|
||||
return;
|
||||
|
||||
// Is there a prison in this sector?
|
||||
UINT16 prisonerbaselimit = 0;
|
||||
for (UINT16 cnt = 0; cnt < NUM_FACILITY_TYPES; ++cnt)
|
||||
@@ -5698,6 +5701,9 @@ void HandlePrisonerProcessingInSector( INT16 sMapX, INT16 sMapY, INT8 bZ )
|
||||
// Flugente: prisons can riot if there aren't enough guards around
|
||||
void HandlePrison( INT16 sMapX, INT16 sMapY, INT8 bZ )
|
||||
{
|
||||
if ( !gGameExternalOptions.fAllowPrisonerSystem )
|
||||
return;
|
||||
|
||||
BOOLEAN fBeginRiot = FALSE;
|
||||
|
||||
// Is there a prison in this sector?
|
||||
|
||||
@@ -1216,7 +1216,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa
|
||||
}
|
||||
|
||||
// Flugente: handcuffing people
|
||||
if ( HasItemFlag(usHandItem, HANDCUFFS ) )
|
||||
if ( gGameExternalOptions.fAllowPrisonerSystem && HasItemFlag(usHandItem, HANDCUFFS ) )
|
||||
{
|
||||
// ATE: AI CANNOT GO THROUGH HERE!
|
||||
INT32 usMapPos;
|
||||
|
||||
@@ -5776,22 +5776,15 @@ void SOLDIERTYPE::EVENT_SoldierGotHit( UINT16 usWeaponIndex, INT16 sDamage, INT1
|
||||
// Flugente: if the weapon is a taser and has enough batteries, the damage will be 0, but the breathdamage will knock out anyone
|
||||
if ( HasItemFlag(usWeaponIndex, TASER) )
|
||||
{
|
||||
if ( !Item[usWeaponIndex].needsbatteries )
|
||||
{
|
||||
// a taser without batteries is odd, but why not, perhaps the thing has a 1000 pund battery or sth
|
||||
sDamage = 0;
|
||||
sBreathLoss = 20000;
|
||||
ubReason = TAKE_DAMAGE_ELECTRICITY;
|
||||
}
|
||||
// if we need batteries, lets see if we can find some...
|
||||
else
|
||||
// tasers need batteries, because I say so
|
||||
if ( Item[usWeaponIndex].needsbatteries )
|
||||
{
|
||||
// check for batteries
|
||||
OBJECTTYPE* pBatteries = FindAttachedBatteries( &(MercPtrs[ubAttackerID]->inv[HANDPOS]) );
|
||||
if ( pBatteries )
|
||||
{
|
||||
sDamage = 0;
|
||||
sBreathLoss = 20000;
|
||||
sBreathLoss = 30000;
|
||||
ubReason = TAKE_DAMAGE_ELECTRICITY;
|
||||
|
||||
// use up 8-12 percent of batteries
|
||||
@@ -16222,6 +16215,9 @@ void SOLDIERTYPE::EVENT_SoldierBuildStructure( INT32 sGridNo, UINT8 ubDirection
|
||||
|
||||
void SOLDIERTYPE::EVENT_SoldierHandcuffPerson( INT32 sGridNo, UINT8 ubDirection )
|
||||
{
|
||||
if ( !gGameExternalOptions.fAllowPrisonerSystem )
|
||||
return;
|
||||
|
||||
UINT8 ubPerson = WhoIsThere2( sGridNo, this->pathing.bLevel );
|
||||
|
||||
if ( ubPerson != NOBODY && MercPtrs[ ubPerson ]->bTeam == ENEMY_TEAM && !(MercPtrs[ ubPerson ]->bSoldierFlagMask & SOLDIER_POW) )
|
||||
@@ -16237,12 +16233,23 @@ void SOLDIERTYPE::EVENT_SoldierHandcuffPerson( INT32 sGridNo, UINT8 ubDirection
|
||||
{
|
||||
// check wether we can forcefully handcuff the other soldier, but this will be hard
|
||||
UINT32 attackrating = 10 * EffectiveExpLevel( this ) + EffectiveStrength( this, FALSE ) + 2 * EffectiveDexterity( this, FALSE ) + EffectiveAgility( this, FALSE );
|
||||
UINT32 defenserating = 10 * EffectiveExpLevel( pSoldier ) + 2 * EffectiveStrength( pSoldier, FALSE ) + EffectiveDexterity( pSoldier, FALSE ) + 2 * EffectiveAgility( pSoldier, FALSE );
|
||||
UINT32 defenserating = 10 * EffectiveExpLevel( pSoldier ) + 2 * EffectiveStrength( pSoldier, FALSE ) + 2 * EffectiveDexterity( pSoldier, FALSE ) + 2 * EffectiveAgility( pSoldier, FALSE );
|
||||
|
||||
if (gGameOptions.fNewTraitSystem)
|
||||
{
|
||||
attackrating += 25 * NUM_SKILL_TRAITS( this, MARTIAL_ARTS_NT ) + 10 * HAS_SKILL_TRAIT( this, MELEE_NT );
|
||||
defenserating += 25 * NUM_SKILL_TRAITS( pSoldier, MARTIAL_ARTS_NT ) + 10 * HAS_SKILL_TRAIT( pSoldier, MELEE_NT );
|
||||
}
|
||||
else
|
||||
{
|
||||
attackrating += 25 * NUM_SKILL_TRAITS( this, MARTIALARTS_OT ) + 25 * NUM_SKILL_TRAITS( this, HANDTOHAND_OT ) + 10 * HAS_SKILL_TRAIT( this, KNIFING_OT );
|
||||
defenserating += 25 * NUM_SKILL_TRAITS( pSoldier, MARTIALARTS_OT ) + 25 * NUM_SKILL_TRAITS( pSoldier, HANDTOHAND_OT ) + 10 * HAS_SKILL_TRAIT( pSoldier, KNIFING_OT );
|
||||
}
|
||||
|
||||
ReducePointsForFatigue( this, &attackrating );
|
||||
ReducePointsForFatigue( pSoldier, &defenserating );
|
||||
|
||||
if ( Random(attackrating) > Random(defenserating) + 50 )
|
||||
if ( Random(attackrating) > Random(defenserating) + 100 )
|
||||
success = TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -2711,7 +2711,7 @@ UINT8 GetActionModeCursor( SOLDIERTYPE *pSoldier )
|
||||
ubCursor = FORTICURS;
|
||||
|
||||
// Flugente: cursor for handcuffs
|
||||
if ( HasItemFlag(usInHand, HANDCUFFS) )
|
||||
if ( gGameExternalOptions.fAllowPrisonerSystem && HasItemFlag(usInHand, HANDCUFFS) )
|
||||
ubCursor = HANDCUFFCURS;
|
||||
|
||||
// Now check our terrain to see if we cannot do the action now...
|
||||
|
||||
@@ -899,7 +899,7 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier)
|
||||
}
|
||||
|
||||
// Flugente: if we see one of our buddies in handcuffs, its a clear sign of enemy activity!
|
||||
if ( pSoldier->bTeam == ENEMY_TEAM )
|
||||
if ( gGameExternalOptions.fAllowPrisonerSystem && pSoldier->bTeam == ENEMY_TEAM )
|
||||
{
|
||||
UINT8 ubPerson = GetClosestFlaggedSoldierID( pSoldier, 10, ENEMY_TEAM, SOLDIER_POW );
|
||||
|
||||
@@ -1473,7 +1473,7 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier)
|
||||
}
|
||||
|
||||
// Flugente: if we see one of our buddies in handcuffs, its a clear sign of enemy activity!
|
||||
if ( pSoldier->bTeam == ENEMY_TEAM )
|
||||
if ( gGameExternalOptions.fAllowPrisonerSystem && pSoldier->bTeam == ENEMY_TEAM )
|
||||
{
|
||||
UINT8 ubPerson = GetClosestFlaggedSoldierID( pSoldier, 10, ENEMY_TEAM, SOLDIER_POW );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user