Commit Graph
336 Commits
Author SHA1 Message Date
Sevenfm b11957691c Fix for critical bug introduced in r9182: replace CoweringShockLevel check which calculates suppression tolerance every time, with IsCowering, which uses cowering animation check.
DrawBarsInUIBox: fix possible divide by zero.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9184 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-10-16 16:07:31 +00:00
Sevenfm 7978ad77f3 Morale changes for AI soldiers:
- GetMoraleModifier: use bMorale for both player and AI.
- CalcSuppressionTolerance: use morale as a base for tolerance for AI soldiers.
- HandleSuppressionFire: morale loss for AI soldiers.
- EVENT_BeginMercTurn: increase morale for AI soldiers.
- TacticalCreateSoldier: Set morale = 60 + 2 * bExpLevel + Random(20) when creating AI soldier.

NEW_SUPPRESSION_CODE: UseGun, UseGunNCTH: reduce shock when firing gun.
AI_NEW_MORALE: limit AI morale depending on morale and shock level.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9181 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-10-15 05:52:09 +00:00
Sevenfm 7a7f554908 Fix/change: the hospital now checks for mercs with damaged stats in addition to damaged health. in addition, the hospital now charges money to heal damaged stats (by rftr).
Minor fixes for quest debug log.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9180 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-10-15 04:49:17 +00:00
Sevenfm aa767c4355 Minor code improvements for quest logging.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9178 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-10-14 08:43:15 +00:00
Sevenfm 0a717c2697 Removed option AI_DECISION_INFO.
Added quest debug logging to Logs\QuestInfo.txt

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9177 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-10-14 08:35:32 +00:00
Sevenfm 95a810e382 AI flanking:
- avoid moving too far from noise spot, except for CUNNINGSOLO
- avoid moving too close to enemy vision range

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9167 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-09-23 18:20:49 +00:00
Flugente 6cad680b02 We can now use interactive actions to alter decals on walls, so it is possible to simulate taking off an object from the scenery and add it as an item.
For more info, see http://thepit.ja-galaxy-forum.com/index.php?t=msg&goto=363513&#msg_363513

Requires GameDir >= r2601

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9141 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-07-13 19:50:49 +00:00
Shadooow f779c0cb37 Major rework of getting captured quests and mechanics.
- new feature: added Tixa as another prison where capture mercs can be held (Alma is still primary choice though)
- fix: all mercs in the map will be taken POW when surrendered, however only 3 will appear in Alma/Tixa/N7, rest will be POW forever without chance of getting free
- fix: whenever player liberates any of the POW sectors (Alma, Tixa, N7) the respective quest/cutscene with POW will be disabled in that sector until enemy recapture the sector
- robot will be destroyed when surrendered as it makes no sense to inprison mechanical units
- externalized the GridNos for freeing POW mercs into Mod_Settings.ini

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9095 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-06-21 13:53:56 +00:00
Sevenfm 08ba4f9323 CancelAIAction: improved condition to allow cover check.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9081 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-06-13 17:46:21 +00:00
Sevenfm 2459f90412 Disabled clearing next AI action in CancelAIAction as it may interfere with scripted actions code.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9077 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-06-12 17:33:16 +00:00
Shadooow 6c1f5ed7ee corrected typo in previous commit
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9074 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-06-12 10:06:32 +00:00
Shadooow d46cbda2b6 new fix for endless clock issue in POW cutscene, was actually caused by Elliot trying to do the kick animation which doesn't exists for civilian body type
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9072 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-06-12 09:39:20 +00:00
Shadooow 5b24d136f2 fix for endless clock issue in POW cutscene
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9070 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-06-12 00:10:42 +00:00
Sevenfm cf7588cacd Only show "sniper" message when shooter uses sniper rifle.
Disabled "sniper" message for vehicles.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9014 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-05-09 03:54:41 +00:00
Sevenfm 09270c04f0 Fix Deidranna endless clock in cutscene.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8970 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-04-24 13:31:56 +00:00
Sevenfm b6f15b2347 Add robots to enemy groups (by rftr).
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8956 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-04-03 03:32:40 +00:00
Sevenfm 1abb292f8e New militia order: Move to (works in realtime only, switches militia soldier to DTATIONARY/DEFENSIVE).
Cancel current AI order when giving militia order.
Check if desired stance is possible here when ordering militia to crouch/prone.
Green AI: reworked climb code (only climb up, only at the start of the turn, disable for STATIONARY).

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8947 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-02-26 12:14:11 +00:00
Sevenfm 4471b8ef97 Improved code to check if militia options are available.
Start radio animation when giving orders to militia.
FindClosestClimbPointAvailableToAI: don't check roaming range when searching climb spot for AI.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8939 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-02-17 15:01:57 +00:00
Sevenfm 169e909b56 Minor code improvements.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8934 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-02-12 07:23:54 +00:00
Sevenfm f0693d4aad Black AI:
- fixed bug when AI soldier was ordered to move to his current spot when trying to get closer
- check if soldier can find cover before disabling the attack

Added more AI log info.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8933 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-02-12 07:15:03 +00:00
Sevenfm 18dcced82a Use TACTICAL_RANGE instead of DAY_VISION_RANGE for AI calculations.
Implemented Black cover advance code for AI: try to get closer to enemy using cover if soldier has low CTH or enemy too far for shooting or soldier has high morale or no cover at spot.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8931 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-02-11 19:11:54 +00:00
Sevenfm 1256639fe5 AI_ACTION_STOP_MEDIC: also check START_AID, START_AID_PRN animations to prevent AI endless clock when first aid has just started and AI decides to move somewhere.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8923 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-01-30 23:22:59 +00:00
Sevenfm 32e8f9d4ff EstimatePathCostToLocation: safety checks.
Main Red AI: fixed decision weight calculation.
Player mercs should avoid moving into gas/fire when in autobandage mode or under AI control.
IsLocationSittable, IsLocationSittableExcludingPeople: return FALSE if location on roof does not exist.
NWSS: play room effect for first shot only.
AI inventory choosing: more variety for mortar shells, improved hand/GL grenade choosing code.
Red AI: improved mortar use code: use next action to fire mortar after stepping back.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8920 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-01-14 15:45:11 +00:00
Sevenfm 87fc164f7a CalcMoraleNew (AI_NEW_MORALE option):
- more aggressive AI
- limit AI morale when soldier is under heavy fire

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8916 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-11-07 18:05:37 +00:00
Sevenfm bc7fe70fb7 CalcBestThrow: fixed bug ending throw search if one if the checked spots was too far for throw.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8915 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-11-01 16:44:37 +00:00
Sevenfm 80554bcde8 Hopefully improved AI code: don't try to resume movement after ActionDone was executed.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8911 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-10-26 17:37:44 +00:00
Sevenfm 59f91fc065 SoldierAI: exclude civilians.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8908 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-10-21 18:12:58 +00:00
Sevenfm b174d2a8ba Improved AI RPG use:
- check for friendly fire chance when using rocket launcher
- only enemy team will try to use rocket launcher against single opponent in a room
- set min chance to hit 80% when deciding to use rocket launcher, except tanks or when shooting at tank
- changed min chance to hit to use launcher/RPG so that experienced soldiers prefer higher chance to hit

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8907 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-10-21 06:52:43 +00:00
Sevenfm 2c2d8c9276 AI:
- improved civilian cower/run away code
- CancelAIAction: reset bNextAction and next action data
- clear next action data before making decisions
- militia always try to spare grenades unless under attack or using flares

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8905 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-10-20 21:20:26 +00:00
Sevenfm b45af3f575 FindNearestUngassedLand, FindNearbyDarkerSpot:
- optimization: don't check spots already checked in previous loop
- increase max distance to 35, reduce to 25 if complex AI not allowed, reduce to 15 in realtime
CanDragPerson: use world movement cost instead of LOS check.
Say TAUNT_RELOAD, TAUNT_OUT_OF_AMMO taunts if mag size > 4 or Chance (CHANCE_SAY_ANNOYING_PHRASE).
SpotDangerLevel: also check Water and CorpseWarning for danger level = 1.
ManSeesMan: only call SetNewSituation if location or level are different to reduce frequency of AI re-evaluation.
Only allow radio animation on initial red alert, if sector is not jammed.
Press ESC to stop dragging.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8904 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-10-17 06:30:23 +00:00
Sevenfm 43ab995ecd Only show "suppression fire" message if target soldier cannot be seen after turning.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8903 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-10-16 20:44:21 +00:00
Sevenfm b5cbc32261 EstimateStabDamage: updated code.
Black AI: 
- reduce stab attack attractiveness if target is not very close
- reduce stab attack attractiveness if soldier sees more than one opponent
- for HTH attacks, skills don't have effect on choosing attack type for boxers
- reduce HTH attack attractiveness if soldier sees more than one opponent
- allow to increase autofire bullets by reducing aim in NCTH if LIMIT_MAX_DEVIATION option is enabled

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8902 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-10-16 19:52:57 +00:00
Sevenfm 47c58e79d5 AI:
- new option AI_SAFE_SUPPRESSION adds additional checks for AI to avoid hitting friends when using suppression fire.
- chance to use suppression fire depends on actual chance to hit and SUPPRESSION_EFFECTIVENESS option
- reduced short burst to 2 bullets.
- improved code to use short burst

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8901 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-10-16 17:53:02 +00:00
Sevenfm e5f8518674 Red AI:
- set default bAimShotLocation when checking if shot is possible
- remove second CheckIfShotPossible() call
- only use reloading before suppression fire if weapon is autofire capable and can swap clips

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8896 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-09-28 07:32:09 +00:00
Sevenfm 8c8115e3f2 Red AI:
- reload before suppression fire less often in dangerous situation, also check AP_MINIMUM so we don't reload when really low on APs
- use CanNPCAttack() check only for sniper and suppression fire as only these actions need usable gun
- when trying to step back to deploy mortar, check if we can reach the spot and have enough APs

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8895 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-09-28 05:05:52 +00:00
Sevenfm 144cdc0131 FindAmmoToReload: added assert messages to indicate that searching attached weapon failed.
DecideAction: initialize bWeaponMode = WM_NORMAL to prevent FindAmmoToReload from crashing.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8892 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-08-31 16:35:56 +00:00
Sevenfm f5162b31d2 Fixed minor error in previous commit.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8890 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-08-18 08:28:25 +00:00
Sevenfm fa557a0dea New option AI_SHOOT_UNSEEN (disabled by default): allow AI to shoot at recently seen/heard enemies (targets that nobody from soldier's team sees currently).
CalcBestShot:
- improved hit rate calculation, take into account possible options INCREASE_AIMING_COSTS, FIRST_AIM_READY_COST_DIVISOR
- minor code improvements
New AI function LOS_Raised checks LOS with forced raised gun status, to get max view distance with scope

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8889 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-08-18 08:23:39 +00:00
Sevenfm 95a4bde357 CalcBestThrow:
- improved AI code to avoid hitting friends with grenades
- correctly set usGrenade for mortar attacks

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8887 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-08-16 04:20:31 +00:00
Sevenfm c7d1acff01 fix: climbing related AI deadlocks (by anv)
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8883 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-08-13 04:54:23 +00:00
Sevenfm 5903abee09 Various AI improvements.
FindThrowableGrenade: allows to specify type and damage of searched grenade.
New counter SOLDIER_COUNTER_RETREAT allows to set number of turns which soldier will try to retreat and take cover.
FindBestNearbyCover: use PrepareThreatlist as unified function to make list of all known opponents.

Militia Control:
- start retreating mode for 2 turns when ordering retreat
- replace AI_ACTION_RUN_AWAY with AI_ACTION_TAKE_COVER order so that militia do not retreat from sector

New AI behavior:
- soldier can use smoke grenade to cover himself when under fire
- soldier can use use smoke grenade on his friend to cover him
- if soldier used smoke, he starts retreat mode for 2 turns
- added retreat code to Red, Black AI
- improved Main Red AI for civilians (they only run away)

Improved suppression code:
- less chance of suppression when opponent has high shock level
- prefer using suppression fire when soldier is in cover

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8879 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-08-07 12:12:31 +00:00
Sevenfm 93c41f2f97 AI suppression fire improvements.
CalcBestShot:
- added standard check for valid opponent
- use standard knowledge functions
- blind soldier can only attack seen/heard personally
- determine suppression fire (shooting at target nobody sees currently)
- don't shoot if target location is seen and empty
- no fire on unseen opponents with throwing knives
- only enemy team can use blind suppression fire
- only try to suppress alive and conscious human targets
- additional check to limit shooting through walls
- alt weapon holding scope mode is used only when ubAllowAlternativeWeaponHolding == 3
- hip firing allowed only for human bodytypes
- take into account direction when checking stance
- shoot heavy guns in standing stance only when using hip fire
- penalize suppression fire

Red AI suppression fire:
- check valid target
- check weapon/ammo requirements
- check that soldier is not sniper
- check friendly fire chance
- reduce chance to shoot if target is beyond weapon range
- check that we have spare ammo

Improved code to prepare suppression fire:
- change stance first of needed
- allow shooting with aiming
- reserve APs to hide if no cover or enemy is close
- added debug messages

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8878 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-08-06 07:53:12 +00:00
Sevenfm e959d6893b Added new soldier flags: SOLDIER_BACK_ATTACK, SOLDIER_SNEAK_ATTACK (work for punch and stab attacks only).
ClosestKnownOpponent() now can return ID of closest opponent.
CalcCoverValue: improved code to avoid friendly fire.
EVENT_SoldierBeginPunchAttack: use supplied gridno as sTargetGridNo may not be set yet

Boxing:
- added possibility of counterattack after failed attack
- added possibility of opportunity attack a passing enemy
- bonus in CTH for boxers for attack from the back

Boxing AI:
- for boxers, always use high morale so that they attack
- cautious boxer approach, reserve AP for two attacks (only if not attacking from the back)
- try to avoid frontal attack
- sometimes boxer may decide to restore breath instead of moving and attacking
- boxer can step back to move away from opponent, if he is low on breath
- improved main boxer AI

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8876 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-08-02 16:35:10 +00:00
Sevenfm 5b71be4045 CalcCoverValue: improved friendly fire check.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8874 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-07-31 12:02:45 +00:00
Sevenfm 6b706f2747 Increased max possible soldiers stored for friendly fire check to 256.
Friendly fire chance code also checks for soldiers of the same side and optionally neutral civilians.
CalcCoverValue: check friendly fire chance for each position, penalize position if friendly fire chance is high (needs AI_BETTER_COVER = TRUE)

UnderFire::Add: 
- store friendly fire CTH for new added person
- use max value when replacing friendly fire CTH for existing person

CalcBestShot:
- check CTGT and friendly fire chance for every stance
- ignore possible shot if can hit friends in this stance

CalcMoraleNew: improved code to make enemy slightly more aggressive.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8873 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-07-31 10:26:07 +00:00
Flugente 098dc8e280 Disease update:
- <InfectionChance_WOUND_FIRE> can cause infections when taking fire damage
- <InfectionChance_WOUND_GAS> can cause infections when taking non-fire gas damage
- <fSpecialFlagLimitedUseArms> causes the infected to be unable to use one arm
- <fSpecialFlagLimitedUseLegs> causes the infected to be unable to run, and walk and travel slowly
- JA2_options.ini option DISEASE_SEVERE_LIMITATIONS controls whether <fSpecialFlagContractDisability>, <fSpecialFlagLimitedUseArms> and <fSpecialFlagLimitedUseLegs> are used

For more info, see http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=22099&goto=360451&#msg_360451

- Gas damage split up in fire and non-fire damage.
- Flamethrower projectile damaged is affected by fire resistance.

Requires GameDir >= r2553.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8828 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-06-25 22:42:44 +00:00
Sevenfm 9995b70ee9 CalcBestThrow:
- for mortars and grenade launchers, first try to find non smoke grenade/shell
- don't use mortar in building or underground
- don't use grenade launcher underground
- blinded soldier cannot use mortar/grenade launcher
- when calculating safety margin, correctly use BuddyItem defined for single shot RPG
- limit ubSafetyMargin to TACTICAL_RANGE / 2 in case radius set too high in XML
- use flares only at night
- use ValidOpponent() check to determine opponent
- use new knowledge functions
- allow attacking recently seen/heard opponents with mortar/grenade launcher
- improved code to spare grenade, don't spare: non lethal grenades, if some friends killed, when under attack, STATIONART/SNIPER, when on the roof, when there are friends under attack nearby
- increase possible distance from opponent when opponent in a building or when using gas grenade
- improved check for gas/smoke when using gas/smoke grenade
- don't use smoke grenade if there's already smoke nearby (it can spread to this tile later)
- improved code for AP to attack calculation
- when attacking enemy in a building with mortar, allow shooting on the roof above the enemy, hoping that roof will collapse
- limit RPG use, unless can hit several enemies, shooting at tank or opponent is in a room
- soldiers should use RPGs against tanks/jeeps more often
- modify smoke attack value depending on range (less effective if too far from opponent)

Red AI:
- improved code to prepare throw attack
- added code to change stance before throwing if needed

Black AI:
- simplified code to change stance before shooting, always change stance first if needed
- improved code to prepare attack, added code to change stance before throwing if needed

CalcBestShot:
- always change stance first, then turn
- don't allow going prone and turning at the same time

New AI functions:
- NightLight
- DuskLight
- InSmokeNearby
- CountTeamUnderAttack
- SectorCurfew
- TeamPercentKilled
- TeamHighPercentKilled
- ArmyPercentKilled
- ArmyPercentKilledTolerance
- Knowledge
- KnownLocation
- KnownLevel
- UsePersonalKnowledge
- PersonalKnowledge
- KnownPersonalLocation
- KnownPersonalLevel
- PublicKnowledge
- KnownPublicLocation
- KnownPublicLevel

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8791 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-04-23 02:54:36 +00:00
Sevenfm 32b6ffe70f Improved watched location AI code:
- check that we can see enemy if we raise weapon when considering using noise spot as watched location
- prefer hiding first when in dangerous place if hiding is possible

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8790 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-04-20 22:14:45 +00:00
Sevenfm 3fe13b9161 Increment watched location when soldier hears enemy and can possibly see noise location.
Suppression:
- when calculating suppression effectiveness for shotgun, modify damage for pellets.
- set attacker spot as watched location
- alert enemy soldier if he is under fire

Red AI:
- no Main Red AI for civilians
- set watched location to closest position where enemy can appear
- snipers and soldiers with scoped guns should decide watch more often

Improved Red AI watch code:
- crouch if not crouched
- raise weapon if not raised
- turn to watched location
- possibly go prone, if soldier has LOS to watched location

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8789 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-04-20 20:10:30 +00:00
Sevenfm 8840353c78 Improved code for AI tooltips.
RangeChangeDesire: improved code for better balance.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8785 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-04-11 12:17:53 +00:00