- 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
- 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
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
- 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
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
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
- 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
- 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
- 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
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
- 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
- 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
- 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
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
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
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
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