Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using BattleTech;
- using BattleTech.AttackDirectorHelpers;
- using fastJSON;
- using HBS.Logging;
- using Localize;
- using UnityEngine;
- // Token: 0x02000CDB RID: 3291
- public class AttackSequence
- {
- // Token: 0x17000D6D RID: 3437
- // (get) Token: 0x06006014 RID: 24596 RVA: 0x001A1B05 File Offset: 0x0019FD05
- // (set) Token: 0x06006015 RID: 24597 RVA: 0x001A1B0D File Offset: 0x0019FD0D
- public AttackDirector Director { get; private set; }
- // Token: 0x17000D6E RID: 3438
- // (get) Token: 0x06006016 RID: 24598 RVA: 0x001A1B16 File Offset: 0x0019FD16
- public int weaponGroupCount
- {
- get
- {
- return this.sortedWeapons.Count;
- }
- }
- // Token: 0x17000D6F RID: 3439
- // (get) Token: 0x06006017 RID: 24599 RVA: 0x001A1B23 File Offset: 0x0019FD23
- public bool HasWeapons
- {
- get
- {
- return this.allSelectedWeapons.Count > 0;
- }
- }
- // Token: 0x17000D70 RID: 3440
- // (get) Token: 0x06006018 RID: 24600 RVA: 0x001A1B33 File Offset: 0x0019FD33
- public int TotalWeaponCount
- {
- get
- {
- return this.allSelectedWeapons.Count;
- }
- }
- // Token: 0x17000D71 RID: 3441
- // (get) Token: 0x06006019 RID: 24601 RVA: 0x001A1B40 File Offset: 0x0019FD40
- // (set) Token: 0x0600601A RID: 24602 RVA: 0x001A1B48 File Offset: 0x0019FD48
- public List<string> allAffectedTargetIds { get; private set; }
- // Token: 0x17000D72 RID: 3442
- // (get) Token: 0x0600601B RID: 24603 RVA: 0x001A1B51 File Offset: 0x0019FD51
- // (set) Token: 0x0600601C RID: 24604 RVA: 0x001A1B59 File Offset: 0x0019FD59
- public bool attackCompletelyMissed { get; private set; }
- // Token: 0x17000D73 RID: 3443
- // (get) Token: 0x0600601D RID: 24605 RVA: 0x001A1B62 File Offset: 0x0019FD62
- // (set) Token: 0x0600601E RID: 24606 RVA: 0x001A1B6A File Offset: 0x0019FD6A
- public bool attackDestroyedAttackerLeg { get; private set; }
- // Token: 0x17000D74 RID: 3444
- // (get) Token: 0x0600601F RID: 24607 RVA: 0x001A1B73 File Offset: 0x0019FD73
- // (set) Token: 0x06006020 RID: 24608 RVA: 0x001A1B7B File Offset: 0x0019FD7B
- public int attackTotalShotsFired { get; private set; }
- // Token: 0x17000D75 RID: 3445
- // (get) Token: 0x06006021 RID: 24609 RVA: 0x001A1B84 File Offset: 0x0019FD84
- // (set) Token: 0x06006022 RID: 24610 RVA: 0x001A1B8C File Offset: 0x0019FD8C
- public int attackTotalShotsHit { get; private set; }
- // Token: 0x17000D76 RID: 3446
- // (get) Token: 0x06006023 RID: 24611 RVA: 0x001A1B95 File Offset: 0x0019FD95
- public float RatioSuccessfulHits
- {
- get
- {
- return (float)this.attackTotalShotsHit / (float)this.attackTotalShotsFired;
- }
- }
- // Token: 0x17000D77 RID: 3447
- // (get) Token: 0x06006024 RID: 24612 RVA: 0x001A1BA6 File Offset: 0x0019FDA6
- // (set) Token: 0x06006025 RID: 24613 RVA: 0x001A1BAE File Offset: 0x0019FDAE
- public bool CoordinatedMesssagesSuccessful { get; private set; }
- // Token: 0x06006026 RID: 24614 RVA: 0x001A1BB8 File Offset: 0x0019FDB8
- public void RecordMechDamage(string mechGUID, int originalHitLocation, WeaponHitInfo hitInfo, ArmorLocation armorLocation, Weapon weapon, float totalDamage, int hitIndex, AttackImpactQuality impactQuality)
- {
- if (this.Director == null || !this.Director.recordStats)
- {
- return;
- }
- AttackDirector.AttackSequence.MechDamage mechDamage = new AttackDirector.AttackSequence.MechDamage();
- mechDamage.mechGUID = mechGUID;
- mechDamage.index = this.recordedMechDamage.Count;
- mechDamage.originalHitLocation = originalHitLocation;
- mechDamage.weaponGroupIndex = hitInfo.attackGroupIndex;
- mechDamage.weaponIndex = hitInfo.attackWeaponIndex;
- mechDamage.hitIndex = hitIndex;
- mechDamage.weaponName = ((weapon != null) ? weapon.Name : "null");
- mechDamage.hitLocation = armorLocation;
- mechDamage.impactQuality = impactQuality;
- mechDamage.totalDamage = totalDamage;
- this.recordedMechDamage.Add(mechDamage);
- }
- // Token: 0x06006027 RID: 24615 RVA: 0x001A1C5C File Offset: 0x0019FE5C
- public Dictionary<string, string> GetRecordedMechDamageDictionary()
- {
- this.damageStatsGatherer.Clear();
- for (int i = 0; i < this.recordedMechDamage.Count; i++)
- {
- this.recordedMechDamage[i].AppendToStatsGatherer(this.damageStatsGatherer);
- }
- return this.damageStatsGatherer.GetDictionary();
- }
- // Token: 0x06006028 RID: 24616 RVA: 0x001A1CAC File Offset: 0x0019FEAC
- public AttackSequence(AttackDirector director, AbstractActor attacker, ICombatant target, Vector3 attackPosition, Quaternion attackRotation, int attackSequenceIdx, List<Weapon> selectedWeapons, MeleeAttackType meleeAttackType, int calledShotLocation, bool isMoraleAttack, int id, int stackItemUID)
- {
- this.Director = director;
- this.attacker = attacker;
- this.chosenTarget = target;
- this.attackPosition = attackPosition;
- this.attackRotation = attackRotation;
- this.attackSequenceIdx = attackSequenceIdx;
- this.calledShotLocation = calledShotLocation;
- this.allSelectedWeapons = selectedWeapons;
- this.isMoraleAttack = isMoraleAttack;
- this.id = id;
- this.stackItemUID = stackItemUID;
- this.currentFiringGroup = 0;
- this.cumulativeDamage = 0f;
- this.numTargets = 1;
- if (attacker.team.GUID == director.Combat.LocalPlayerTeamGuid)
- {
- this.previousTeamHealthDifference = attacker.team.CompareTeamHealthPercentages(target.team);
- }
- else
- {
- this.previousTeamHealthDifference = target.team.CompareTeamHealthPercentages(attacker.team);
- }
- this.allWeaponIds = new List<string>();
- for (int i = 0; i < selectedWeapons.Count; i++)
- {
- this.allWeaponIds.Add(selectedWeapons[i].uid);
- if (!selectedWeapons[i].WillFireAtTargetFromPosition(target, attackPosition, attackRotation))
- {
- AttackDirector.AttackSequence.logger.LogWarning(string.Format("AttackSequence: Weapon {0} is firing at target {1}, but technically cannot fire at that target.", selectedWeapons[i].Name, target.DisplayName));
- }
- }
- this.indirectFire = attacker.HasIndirectLOFToTargetUnit(attackPosition, attackRotation, target, true);
- if (meleeAttackType != MeleeAttackType.NotSet)
- {
- this.isMelee = true;
- this.meleeAttackType = meleeAttackType;
- }
- if (target.GameRep != null)
- {
- target.GameRep.SetVFXColliderEnabled(true);
- }
- this.attackDestroyedWeapon = new Dictionary<string, bool>();
- this.attackDestroyedWeapon.Add(target.GUID, false);
- this.attackCausedAmmoExplosion = new Dictionary<string, bool>();
- this.attackCausedAmmoExplosion.Add(target.GUID, false);
- this.attackContainsDodge = new Dictionary<string, bool>();
- this.attackContainsDodge.Add(target.GUID, false);
- this.attackCrits = new Dictionary<string, int>();
- this.attackCrits.Add(target.GUID, 0);
- this.attackWeaponCrits = new Dictionary<string, List<Weapon>>();
- this.attackWeaponCrits.Add(target.GUID, new List<Weapon>());
- this.attackAmmoCrits = new Dictionary<string, List<AmmunitionBox>>();
- this.attackAmmoCrits.Add(target.GUID, new List<AmmunitionBox>());
- this.attackDidDamage = new Dictionary<string, bool>();
- this.attackDidDamage.Add(target.GUID, false);
- this.attackArmorDamage = new Dictionary<string, float>();
- this.attackArmorDamage.Add(target.GUID, 0f);
- this.lowArmorStruck = new Dictionary<string, bool>();
- this.lowArmorStruck.Add(target.GUID, false);
- this.attackStructureDamage = new Dictionary<string, float>();
- this.attackStructureDamage.Add(target.GUID, 0f);
- this.attackDestroyedLeg = new Dictionary<string, bool>();
- this.attackDestroyedLeg.Add(target.GUID, false);
- this.attackDestroyedAnyLocation = new Dictionary<string, bool>();
- this.attackDestroyedAnyLocation.Add(target.GUID, false);
- this.attackDealtHeatDamage = new Dictionary<string, bool>();
- this.attackDealtHeatDamage.Add(target.GUID, false);
- this.attackCausedKnockdown = new Dictionary<string, bool>();
- this.attackCausedKnockdown.Add(target.GUID, false);
- this.attackCompletelyMissed = true;
- this.attackDestroyedAttackerLeg = false;
- this.attackTotalShotsFired = 0;
- this.attackTotalShotsHit = 0;
- this.allAffectedTargetIds = new List<string>();
- this.AddAffectedTarget(target.GUID);
- this.Init();
- }
- // Token: 0x06006029 RID: 24617 RVA: 0x001A202C File Offset: 0x001A022C
- private void Init()
- {
- MessageCenter messageCenter = this.Director.Combat.MessageCenter;
- messageCenter.AddSubscriber(MessageCenterMessageType.OnAttackSequenceGroupBegin, new ReceiveMessageCenterMessage(this.OnAttackSequenceGroupBegin));
- messageCenter.AddSubscriber(MessageCenterMessageType.OnAttackSequenceFire, new ReceiveMessageCenterMessage(this.OnAttackSequenceFire));
- messageCenter.AddSubscriber(MessageCenterMessageType.OnAttackSequenceWeaponPreFireComplete, new ReceiveMessageCenterMessage(this.OnAttackSequenceWeaponPreFireComplete));
- messageCenter.AddSubscriber(MessageCenterMessageType.OnAttackSequenceImpact, new ReceiveMessageCenterMessage(this.OnAttackSequenceImpact));
- messageCenter.AddSubscriber(MessageCenterMessageType.OnAttackSequenceResolveDamage, new ReceiveMessageCenterMessage(this.OnAttackSequenceResolveDamage));
- messageCenter.AddSubscriber(MessageCenterMessageType.OnAttackSequenceWeaponComplete, new ReceiveMessageCenterMessage(this.OnAttackSequenceWeaponComplete));
- messageCenter.AddSubscriber(MessageCenterMessageType.OnAttackSequenceGroupEnd, new ReceiveMessageCenterMessage(this.OnAttackSequenceGroupEnd));
- this.SortSelectedWeapons();
- this.GenerateRandomCache();
- this.GenerateNumberOfShots();
- this.GenerateToHitInfo();
- this.messageCoordinator.Initialize(this, this.weaponHitInfo);
- }
- // Token: 0x0600602A RID: 24618 RVA: 0x001A20FE File Offset: 0x001A02FE
- private int[] GetMinFudgeCache(int size)
- {
- return this.GetForcedFudgeCache(size, -1);
- }
- // Token: 0x0600602B RID: 24619 RVA: 0x001A2108 File Offset: 0x001A0308
- private int[] GetMaxFudgeCache(int size)
- {
- return this.GetForcedFudgeCache(size, 1);
- }
- // Token: 0x0600602C RID: 24620 RVA: 0x001A2114 File Offset: 0x001A0314
- private int[] GetForcedFudgeCache(int size, int value)
- {
- int[] array = new int[size];
- for (int i = 0; i < size; i++)
- {
- array[i] = value;
- }
- return array;
- }
- // Token: 0x0600602D RID: 24621 RVA: 0x001A213C File Offset: 0x001A033C
- private void GenerateRandomCache()
- {
- int count = this.sortedWeapons.Count;
- this.randomCache = new float[count][][];
- this.randomCacheValuesUsed = new int[count][];
- for (int i = 0; i < count; i++)
- {
- List<Weapon> list = this.sortedWeapons[i];
- int count2 = list.Count;
- float[][] array = new float[count2][];
- int[] array2 = new int[count2];
- for (int j = 0; j < count2; j++)
- {
- int shotsWhenFired = list[j].ShotsWhenFired;
- int num = 6 * shotsWhenFired + 2 + 5;
- array[j] = this.Director.Combat.NetworkRandom.GetRandomCache(num);
- array2[j] = 0;
- }
- this.randomCache[i] = array;
- this.randomCacheValuesUsed[i] = array2;
- }
- this.varianceCache = new int[count][][];
- this.varianceCacheValuesUsed = new int[count][];
- for (int k = 0; k < count; k++)
- {
- List<Weapon> list2 = this.sortedWeapons[k];
- int count3 = list2.Count;
- int[][] array3 = new int[count3][];
- int[] array4 = new int[count3];
- for (int l = 0; l < count3; l++)
- {
- Weapon weapon = list2[l];
- int shotsWhenFired2 = weapon.ShotsWhenFired;
- int damageVariance = weapon.DamageVariance;
- int[] array5 = new int[shotsWhenFired2];
- for (int m = 0; m < shotsWhenFired2; m++)
- {
- int[] fudgeCache = this.Director.Combat.NetworkRandom.GetFudgeCache(damageVariance);
- int num2 = 0;
- for (int n = 0; n < damageVariance; n++)
- {
- num2 += fudgeCache[n];
- }
- array5[m] = num2;
- }
- array3[l] = array5;
- array4[l] = 0;
- }
- this.varianceCache[k] = array3;
- this.varianceCacheValuesUsed[k] = array4;
- }
- }
- // Token: 0x0600602E RID: 24622 RVA: 0x001A2304 File Offset: 0x001A0504
- public float GetRandomNumber(int groupIndex, int weaponIndex)
- {
- float num = 0f;
- float[] array = this.randomCache[groupIndex][weaponIndex];
- int num2 = this.randomCacheValuesUsed[groupIndex][weaponIndex];
- if (num2 >= array.Length)
- {
- if (AttackDirector.hitLogger.IsLogEnabled)
- {
- AttackDirector.hitLogger.Log(string.Format("???????? Random Values Used for Weapon Group: {0} // Weapon: {1}: {2} / {3} | Returning: {4}", new object[] { groupIndex, weaponIndex, num2, array.Length, num }));
- }
- return num;
- }
- num = array[num2];
- num2++;
- this.randomCacheValuesUsed[groupIndex][weaponIndex] = num2;
- if (AttackDirector.hitLogger.IsLogEnabled)
- {
- AttackDirector.hitLogger.Log(string.Format("???????? Random Value Grabbed for Weapon Group: {0} // Weapon: {1}: [[ {2} ]] | {3} / {4} Values Used", new object[] { groupIndex, weaponIndex, num, num2, array.Length }));
- }
- return num;
- }
- // Token: 0x0600602F RID: 24623 RVA: 0x001A23F4 File Offset: 0x001A05F4
- public float[] GetRandomNumbers(int groupIndex, int weaponIndex, int amount)
- {
- float[] array = new float[amount];
- for (int i = 0; i < amount; i++)
- {
- array[i] = this.GetRandomNumber(groupIndex, weaponIndex);
- }
- return array;
- }
- // Token: 0x06006030 RID: 24624 RVA: 0x001A2420 File Offset: 0x001A0620
- public int GetVarianceValue(int groupIndex, int weaponIndex, Weapon weapon)
- {
- int num = 0;
- int[] array = this.varianceCache[groupIndex][weaponIndex];
- int num2 = this.varianceCacheValuesUsed[groupIndex][weaponIndex];
- if (num2 >= array.Length)
- {
- if (AttackDirector.damageLogger.IsLogEnabled)
- {
- AttackDirector.damageLogger.Log(string.Format("Variance values for weapon group {0} weapon {1} are all used! Only {2} were created. Returning {3}", new object[] { groupIndex, weaponIndex, array.Length, num }));
- }
- return num;
- }
- num = array[num2];
- num2++;
- this.varianceCacheValuesUsed[groupIndex][weaponIndex] = num2;
- return num;
- }
- // Token: 0x06006031 RID: 24625 RVA: 0x001A24B0 File Offset: 0x001A06B0
- public int[] GetVarianceSums(int groupIndex, int weaponIndex, int amount, Weapon weapon)
- {
- if (AttackDirector.damageLogger.IsLogEnabled)
- {
- AttackDirector.damageLogger.Log(string.Format("------------------------------------------------------------- Creating an array of {0} Variance value(s) for {1} (ID {2})", amount, weapon.Name, weaponIndex));
- }
- int[] array = new int[amount];
- for (int i = 0; i < amount; i++)
- {
- array[i] = this.GetVarianceValue(groupIndex, weaponIndex, weapon);
- }
- if (AttackDirector.damageLogger.IsLogEnabled)
- {
- string text = "Variance values:";
- for (int j = 0; j < amount; j++)
- {
- text = string.Format("{0} {1}", text, array[j]);
- }
- AttackDirector.damageLogger.Log(text);
- }
- return array;
- }
- // Token: 0x06006032 RID: 24626 RVA: 0x001A2550 File Offset: 0x001A0750
- private void GenerateNumberOfShots()
- {
- int count = this.sortedWeapons.Count;
- this.numberOfShots = new int[count][];
- for (int i = 0; i < count; i++)
- {
- List<Weapon> list = this.sortedWeapons[i];
- int count2 = list.Count;
- int[] array = new int[count2];
- for (int j = 0; j < count2; j++)
- {
- Weapon weapon = list[j];
- array[j] = -1;
- if (weapon.WillFire)
- {
- array[j] = 0;
- int num = weapon.PreFireWeapon(this.stackItemUID);
- if (num >= 1)
- {
- array[j] = num;
- }
- }
- }
- this.numberOfShots[i] = array;
- }
- }
- // Token: 0x06006033 RID: 24627 RVA: 0x001A25F4 File Offset: 0x001A07F4
- private void GenerateToHitInfo()
- {
- int count = this.sortedWeapons.Count;
- this.weaponHitInfo = new WeaponHitInfo?[count][];
- float num = 0f;
- for (int i = 0; i < count; i++)
- {
- List<Weapon> list = this.sortedWeapons[i];
- int count2 = list.Count;
- WeaponHitInfo?[] array = new WeaponHitInfo?[count2];
- int[] array2 = this.numberOfShots[i];
- for (int j = 0; j < count2; j++)
- {
- Weapon weapon = list[j];
- array[j] = null;
- int num2 = array2[j];
- if (num2 != -1 && num2 != 0)
- {
- WeaponHitInfo weaponHitInfo = this.GenerateHitInfo(weapon, i, j, num2, this.indirectFire, num);
- this.AddAllAffectedTargets(weaponHitInfo);
- array[j] = new WeaponHitInfo?(weaponHitInfo);
- }
- }
- this.weaponHitInfo[i] = array;
- }
- }
- // Token: 0x06006034 RID: 24628 RVA: 0x001A26CC File Offset: 0x001A08CC
- public void Cleanup()
- {
- MessageCenter messageCenter = this.Director.Combat.MessageCenter;
- messageCenter.RemoveSubscriber(MessageCenterMessageType.OnAttackSequenceGroupBegin, new ReceiveMessageCenterMessage(this.OnAttackSequenceGroupBegin));
- messageCenter.RemoveSubscriber(MessageCenterMessageType.OnAttackSequenceFire, new ReceiveMessageCenterMessage(this.OnAttackSequenceFire));
- messageCenter.RemoveSubscriber(MessageCenterMessageType.OnAttackSequenceWeaponPreFireComplete, new ReceiveMessageCenterMessage(this.OnAttackSequenceWeaponPreFireComplete));
- messageCenter.RemoveSubscriber(MessageCenterMessageType.OnAttackSequenceImpact, new ReceiveMessageCenterMessage(this.OnAttackSequenceImpact));
- messageCenter.RemoveSubscriber(MessageCenterMessageType.OnAttackSequenceResolveDamage, new ReceiveMessageCenterMessage(this.OnAttackSequenceResolveDamage));
- messageCenter.RemoveSubscriber(MessageCenterMessageType.OnAttackSequenceWeaponComplete, new ReceiveMessageCenterMessage(this.OnAttackSequenceWeaponComplete));
- messageCenter.RemoveSubscriber(MessageCenterMessageType.OnAttackSequenceGroupEnd, new ReceiveMessageCenterMessage(this.OnAttackSequenceGroupEnd));
- }
- // Token: 0x06006035 RID: 24629 RVA: 0x001A2774 File Offset: 0x001A0974
- public void FlagAttackDestroyedWeapon(string id)
- {
- this.AddAffectedTarget(id);
- this.attackDestroyedWeapon[id] = true;
- }
- // Token: 0x06006036 RID: 24630 RVA: 0x001A278C File Offset: 0x001A098C
- public bool GetAttackDestroyedWeapon(string id)
- {
- bool flag = false;
- this.attackDestroyedWeapon.TryGetValue(id, out flag);
- return flag;
- }
- // Token: 0x06006037 RID: 24631 RVA: 0x001A27AB File Offset: 0x001A09AB
- public void FlagAttackCausedAmmoExplosion(string id)
- {
- this.AddAffectedTarget(id);
- this.attackCausedAmmoExplosion[id] = true;
- }
- // Token: 0x06006038 RID: 24632 RVA: 0x001A27C4 File Offset: 0x001A09C4
- public bool GetAttackCausedAmmoExplosion(string id)
- {
- bool flag = false;
- this.attackCausedAmmoExplosion.TryGetValue(id, out flag);
- return flag;
- }
- // Token: 0x06006039 RID: 24633 RVA: 0x001A27E3 File Offset: 0x001A09E3
- public void FlagAttackContainsDodge(string id)
- {
- this.AddAffectedTarget(id);
- this.attackContainsDodge[id] = true;
- }
- // Token: 0x0600603A RID: 24634 RVA: 0x001A27FC File Offset: 0x001A09FC
- public bool GetAttackContainsDodge(string id)
- {
- bool flag = false;
- this.attackContainsDodge.TryGetValue(id, out flag);
- return flag;
- }
- // Token: 0x0600603B RID: 24635 RVA: 0x001A281B File Offset: 0x001A0A1B
- public void FlagAttackDestroyedLeg(string id)
- {
- this.AddAffectedTarget(id);
- this.attackDestroyedLeg[id] = true;
- }
- // Token: 0x0600603C RID: 24636 RVA: 0x001A2834 File Offset: 0x001A0A34
- public bool GetAttackDestroyedLeg(string id)
- {
- bool flag = false;
- this.attackDestroyedLeg.TryGetValue(id, out flag);
- return flag;
- }
- // Token: 0x0600603D RID: 24637 RVA: 0x001A2853 File Offset: 0x001A0A53
- public void FlagAttackDestroyedAttackerLeg()
- {
- this.attackDestroyedAttackerLeg = true;
- }
- // Token: 0x0600603E RID: 24638 RVA: 0x001A285C File Offset: 0x001A0A5C
- public void FlagAttackDestroyedAnyLocation(string id)
- {
- this.AddAffectedTarget(id);
- this.attackDestroyedAnyLocation[id] = true;
- }
- // Token: 0x0600603F RID: 24639 RVA: 0x001A2874 File Offset: 0x001A0A74
- public bool GetAttackDestroyedAnyLocation(string id)
- {
- bool flag = false;
- this.attackDestroyedAnyLocation.TryGetValue(id, out flag);
- return flag;
- }
- // Token: 0x06006040 RID: 24640 RVA: 0x001A2893 File Offset: 0x001A0A93
- public void FlagAttackDidDamage(string id)
- {
- this.AddAffectedTarget(id);
- this.attackDidDamage[id] = true;
- }
- // Token: 0x06006041 RID: 24641 RVA: 0x001A28AC File Offset: 0x001A0AAC
- public bool GetAttackDidDamage(string id)
- {
- bool flag = false;
- this.attackDidDamage.TryGetValue(id, out flag);
- return flag;
- }
- // Token: 0x06006042 RID: 24642 RVA: 0x001A28CC File Offset: 0x001A0ACC
- public void FlagArmorDamage(string id, float amount)
- {
- this.AddAffectedTarget(id);
- if (!this.attackArmorDamage.ContainsKey(id))
- {
- this.attackArmorDamage.Add(id, 0f);
- }
- float num = this.attackArmorDamage[id] + amount;
- this.attackArmorDamage[id] = num;
- }
- // Token: 0x06006043 RID: 24643 RVA: 0x001A291C File Offset: 0x001A0B1C
- public float GetArmorDamageDealt(string id)
- {
- float num = 0f;
- this.attackArmorDamage.TryGetValue(id, out num);
- return num;
- }
- // Token: 0x06006044 RID: 24644 RVA: 0x001A293F File Offset: 0x001A0B3F
- public void FlagLowArmorStruck(string id)
- {
- this.AddAffectedTarget(id);
- this.lowArmorStruck[id] = true;
- }
- // Token: 0x06006045 RID: 24645 RVA: 0x001A2958 File Offset: 0x001A0B58
- public bool GetLowArmorStruck(string id)
- {
- bool flag = false;
- this.lowArmorStruck.TryGetValue(id, out flag);
- return flag;
- }
- // Token: 0x06006046 RID: 24646 RVA: 0x001A2978 File Offset: 0x001A0B78
- public void FlagStructureDamage(string id, float amount)
- {
- this.AddAffectedTarget(id);
- if (!this.attackStructureDamage.ContainsKey(id))
- {
- this.attackStructureDamage.Add(id, 0f);
- }
- float num = this.attackStructureDamage[id] + amount;
- this.attackStructureDamage[id] = num;
- }
- // Token: 0x06006047 RID: 24647 RVA: 0x001A29C8 File Offset: 0x001A0BC8
- public float GetStructureDamageDealt(string id)
- {
- float num = 0f;
- this.attackStructureDamage.TryGetValue(id, out num);
- return num;
- }
- // Token: 0x06006048 RID: 24648 RVA: 0x001A29EB File Offset: 0x001A0BEB
- public void FlagAttackDidHeatDamage(string id)
- {
- this.AddAffectedTarget(id);
- this.attackDealtHeatDamage[id] = true;
- }
- // Token: 0x06006049 RID: 24649 RVA: 0x001A2A04 File Offset: 0x001A0C04
- public bool GetAttackDidHeatDamage(string id)
- {
- bool flag = false;
- this.attackDealtHeatDamage.TryGetValue(id, out flag);
- return flag;
- }
- // Token: 0x0600604A RID: 24650 RVA: 0x001A2A23 File Offset: 0x001A0C23
- public void FlagAttackCausedKnockdown(string id)
- {
- this.AddAffectedTarget(id);
- this.attackCausedKnockdown[id] = true;
- }
- // Token: 0x0600604B RID: 24651 RVA: 0x001A2A3C File Offset: 0x001A0C3C
- public bool GetAttackCausedKnockdown(string id)
- {
- bool flag = false;
- this.attackCausedKnockdown.TryGetValue(id, out flag);
- return flag;
- }
- // Token: 0x0600604C RID: 24652 RVA: 0x001A2A5C File Offset: 0x001A0C5C
- public void FlagShotHit()
- {
- int num = this.attackTotalShotsFired + 1;
- this.attackTotalShotsFired = num;
- num = this.attackTotalShotsHit + 1;
- this.attackTotalShotsHit = num;
- }
- // Token: 0x0600604D RID: 24653 RVA: 0x001A2A8C File Offset: 0x001A0C8C
- public void FlagShotMissed()
- {
- int num = this.attackTotalShotsFired + 1;
- this.attackTotalShotsFired = num;
- }
- // Token: 0x0600604E RID: 24654 RVA: 0x001A2AAC File Offset: 0x001A0CAC
- public void FlagAttackScoredCrit(string id, Weapon weapon, AmmunitionBox ammoBox)
- {
- this.AddAffectedTarget(id);
- if (!this.attackCrits.ContainsKey(id))
- {
- this.attackCrits.Add(id, 0);
- }
- int num = this.attackCrits[id] + 1;
- this.attackCrits[id] = num;
- if (weapon != null)
- {
- if (!this.attackWeaponCrits.ContainsKey(id))
- {
- this.attackWeaponCrits.Add(id, new List<Weapon>());
- }
- List<Weapon> list = this.attackWeaponCrits[id];
- if (!list.Contains(weapon))
- {
- list.Add(weapon);
- }
- this.attackWeaponCrits[id] = list;
- }
- if (ammoBox != null)
- {
- if (!this.attackAmmoCrits.ContainsKey(id))
- {
- this.attackAmmoCrits.Add(id, new List<AmmunitionBox>());
- }
- List<AmmunitionBox> list2 = this.attackAmmoCrits[id];
- if (!list2.Contains(ammoBox))
- {
- list2.Add(ammoBox);
- }
- this.attackAmmoCrits[id] = list2;
- }
- }
- // Token: 0x0600604F RID: 24655 RVA: 0x001A2B90 File Offset: 0x001A0D90
- public int GetAttackCritsCount(string id)
- {
- int num = 0;
- this.attackCrits.TryGetValue(id, out num);
- return num;
- }
- // Token: 0x06006050 RID: 24656 RVA: 0x001A2BB0 File Offset: 0x001A0DB0
- public List<Weapon> GetAttackWeaponCrits(string id)
- {
- List<Weapon> list = new List<Weapon>();
- if (this.attackWeaponCrits.TryGetValue(id, out list))
- {
- return list;
- }
- return new List<Weapon>();
- }
- // Token: 0x06006051 RID: 24657 RVA: 0x001A2BDC File Offset: 0x001A0DDC
- public List<AmmunitionBox> GetAttackAmmoCrits(string id)
- {
- List<AmmunitionBox> list = new List<AmmunitionBox>();
- if (this.attackAmmoCrits.TryGetValue(id, out list))
- {
- return list;
- }
- return new List<AmmunitionBox>();
- }
- // Token: 0x06006052 RID: 24658 RVA: 0x001A2C06 File Offset: 0x001A0E06
- public void AddAffectedTarget(string id)
- {
- if (!string.IsNullOrEmpty(id) && !this.allAffectedTargetIds.Contains(id))
- {
- this.allAffectedTargetIds.Add(id);
- }
- }
- // Token: 0x06006053 RID: 24659 RVA: 0x001A2C2C File Offset: 0x001A0E2C
- public void AddAllAffectedTargets(WeaponHitInfo hitInfo)
- {
- if (hitInfo.secondaryTargetIds == null)
- {
- return;
- }
- foreach (string text in hitInfo.secondaryTargetIds)
- {
- this.AddAffectedTarget(text);
- }
- }
- // Token: 0x06006054 RID: 24660 RVA: 0x001A2C62 File Offset: 0x001A0E62
- public Weapon GetWeapon(int groupIdx, int weaponIdx)
- {
- return this.sortedWeapons[groupIdx][weaponIdx];
- }
- // Token: 0x06006055 RID: 24661 RVA: 0x001A2C78 File Offset: 0x001A0E78
- private WeaponHitInfo GenerateHitInfo(Weapon weapon, int groupIdx, int weaponIdx, int numberOfShots, bool indirectFire, float dodgedDamage)
- {
- WeaponHitInfo weaponHitInfo = default(WeaponHitInfo);
- weaponHitInfo.attackerId = this.attacker.GUID;
- weaponHitInfo.targetId = this.chosenTarget.GUID;
- weaponHitInfo.numberOfShots = numberOfShots;
- weaponHitInfo.stackItemUID = this.stackItemUID;
- weaponHitInfo.attackSequenceId = this.id;
- weaponHitInfo.attackGroupIndex = groupIdx;
- weaponHitInfo.attackWeaponIndex = weaponIdx;
- weaponHitInfo.toHitRolls = new float[numberOfShots];
- weaponHitInfo.locationRolls = new float[numberOfShots];
- weaponHitInfo.dodgeRolls = new float[numberOfShots];
- weaponHitInfo.dodgeSuccesses = new bool[numberOfShots];
- weaponHitInfo.hitLocations = new int[numberOfShots];
- weaponHitInfo.hitPositions = new Vector3[numberOfShots];
- weaponHitInfo.hitVariance = new int[numberOfShots];
- weaponHitInfo.hitQualities = new AttackImpactQuality[numberOfShots];
- weaponHitInfo.secondaryTargetIds = new string[numberOfShots];
- weaponHitInfo.secondaryHitLocations = new int[numberOfShots];
- weaponHitInfo.attackDirections = new AttackDirection[numberOfShots];
- if (AttackDirector.hitLogger.IsLogEnabled)
- {
- Vector3 vector;
- LineOfFireLevel lineOfFire = this.Director.Combat.LOS.GetLineOfFire(this.attacker, this.attackPosition, this.chosenTarget, this.chosenTarget.CurrentPosition, this.chosenTarget.CurrentRotation, out vector);
- float allModifiers = this.Director.Combat.ToHit.GetAllModifiers(this.attacker, weapon, this.chosenTarget, this.attackPosition + this.attacker.HighestLOSPosition, this.chosenTarget.TargetPosition, lineOfFire, this.isMoraleAttack);
- string allModifiersDescription = this.Director.Combat.ToHit.GetAllModifiersDescription(this.attacker, weapon, this.chosenTarget, this.attackPosition + this.attacker.HighestLOSPosition, this.chosenTarget.TargetPosition, lineOfFire, this.isMoraleAttack);
- bool pilot = this.attacker.GetPilot() != null;
- AttackDirector.hitLogger.Log(string.Format("======================================== Unit Firing: {0} | Weapon: {1} | Shots: {2}", this.attacker.DisplayName, weapon.Name, numberOfShots));
- AttackDirector.hitLogger.Log(string.Format("======================================== Hit Info: GROUP {0} | ID {1}", groupIdx, weaponIdx));
- AttackDirector.hitLogger.Log(string.Format("======================================== MODIFIERS: {0}... FINAL: [[ {1} ]] ", allModifiersDescription, allModifiers));
- if (pilot)
- {
- AttackDirector.hitLogger.Log(this.Director.Combat.ToHit.GetBaseToHitChanceDesc(this.attacker));
- }
- else
- {
- AttackDirector.hitLogger.Log(string.Format("======================================== Gunnery Check: NO PILOT", Array.Empty<object>()));
- }
- }
- float num = this.Director.Combat.ToHit.GetToHitChance(this.attacker, weapon, this.chosenTarget, this.attackPosition, this.chosenTarget.CurrentPosition, this.numTargets, this.meleeAttackType, this.isMoraleAttack);
- if (Mech.TEST_KNOCKDOWN)
- {
- num = 1f;
- }
- if (AttackDirector.hitLogger.IsLogEnabled)
- {
- AttackDirector.hitLogger.Log(string.Format("======================================== HIT CHANCE: [[ {0:P2} ]]", num));
- }
- switch (weapon.Type)
- {
- case WeaponType.Autocannon:
- case WeaponType.Gauss:
- case WeaponType.Laser:
- case WeaponType.PPC:
- case WeaponType.Flamer:
- case WeaponType.Melee:
- case WeaponType.COIL:
- this.GetIndividualHits(ref weaponHitInfo, groupIdx, weaponIdx, weapon, num, dodgedDamage);
- return weaponHitInfo;
- case WeaponType.LRM:
- this.GetClusteredHits(ref weaponHitInfo, groupIdx, weaponIdx, weapon, num, dodgedDamage);
- return weaponHitInfo;
- case WeaponType.SRM:
- this.GetIndividualHits(ref weaponHitInfo, groupIdx, weaponIdx, weapon, num, dodgedDamage);
- return weaponHitInfo;
- case WeaponType.MachineGun:
- this.GetIndividualHits(ref weaponHitInfo, groupIdx, weaponIdx, weapon, num, dodgedDamage);
- return weaponHitInfo;
- }
- AttackDirector.attackLogger.LogError(string.Format("GenerateHitInfo found invalid weapon type: {0}, using basic hit info", weapon.Type));
- this.GetIndividualHits(ref weaponHitInfo, groupIdx, weaponIdx, weapon, num, dodgedDamage);
- return weaponHitInfo;
- }
- // Token: 0x17000D78 RID: 3448
- // (get) Token: 0x06006056 RID: 24662 RVA: 0x001A3041 File Offset: 0x001A1241
- public bool IsBreachingShot
- {
- get
- {
- return this.attacker.HasBreachingShotAbility && this.TotalWeaponCount == 1 && this.allSelectedWeapons[0].Type != WeaponType.Melee;
- }
- }
- // Token: 0x06006057 RID: 24663 RVA: 0x001A3074 File Offset: 0x001A1274
- private float GetCorrectedRoll(float roll, Team team)
- {
- float num = roll;
- if (AttackDirector.AttackSequence.UseWeightedHitNumbers)
- {
- float num2 = roll * 1.6f - 0.8f;
- num = (num2 * num2 * num2 + 0.5f) / 2f + roll / 2f;
- }
- if (AttackDirector.AttackSequence.PrintDebugInfo)
- {
- AttackDirector.attackLogger.Log(string.Format("Roll correction: {0}/{1}", roll, num));
- }
- if (team != null)
- {
- num -= team.StreakBreakingValue;
- }
- return num;
- }
- // Token: 0x06006058 RID: 24664 RVA: 0x001A30E8 File Offset: 0x001A12E8
- private void GetIndividualHits(ref WeaponHitInfo hitInfo, int groupIdx, int weaponIdx, Weapon weapon, float toHitChance, float prevDodgedDamage)
- {
- if (AttackDirector.hitLogger.IsLogEnabled)
- {
- AttackDirector.hitLogger.Log(string.Format("???????? RANDOM HIT ROLLS (GetIndividualHits): Weapon Group: {0} // Weapon: {1}", groupIdx, weaponIdx));
- }
- hitInfo.toHitRolls = this.GetRandomNumbers(groupIdx, weaponIdx, hitInfo.numberOfShots);
- if (AttackDirector.hitLogger.IsLogEnabled)
- {
- AttackDirector.hitLogger.Log(string.Format("???????? RANDOM LOCATION ROLLS (GetIndividualHits): Weapon Group: {0} // Weapon: {1}", groupIdx, weaponIdx));
- }
- hitInfo.locationRolls = this.GetRandomNumbers(groupIdx, weaponIdx, hitInfo.numberOfShots);
- if (AttackDirector.hitLogger.IsLogEnabled)
- {
- AttackDirector.hitLogger.Log(string.Format("???????? DODGE ROLLS (GetIndividualHits): Weapon Group: {0} // Weapon: {1}", groupIdx, weaponIdx));
- }
- hitInfo.dodgeRolls = this.GetRandomNumbers(groupIdx, weaponIdx, hitInfo.numberOfShots);
- hitInfo.hitVariance = this.GetVarianceSums(groupIdx, weaponIdx, hitInfo.numberOfShots, weapon);
- AbstractActor abstractActor = this.chosenTarget as AbstractActor;
- Team team = ((weapon != null && weapon.parent != null && weapon.parent.team != null) ? weapon.parent.team : null);
- float num = this.attacker.CalledShotBonusMultiplier;
- for (int i = 0; i < hitInfo.numberOfShots; i++)
- {
- float correctedRoll = this.GetCorrectedRoll(hitInfo.toHitRolls[i], team);
- bool flag = correctedRoll <= toHitChance;
- if (team != null)
- {
- team.ProcessRandomRoll(toHitChance, flag);
- }
- bool flag2 = false;
- if (abstractActor != null)
- {
- flag2 = abstractActor.CheckDodge(this.attacker, weapon, hitInfo, i, this.IsBreachingShot);
- }
- if (flag && flag2)
- {
- hitInfo.dodgeSuccesses[i] = true;
- this.FlagAttackContainsDodge(abstractActor.GUID);
- }
- else
- {
- hitInfo.dodgeSuccesses[i] = false;
- }
- if (AttackDirector.attackLogger.IsLogEnabled)
- {
- string text = string.Format("SEQ:{0}: WEAP:{1} SHOT:{2} Roll Value: {3}", new object[] { this.id, weaponIdx, i, correctedRoll });
- AttackDirector.attackLogger.Log(text);
- }
- if (flag && !flag2)
- {
- hitInfo.hitLocations[i] = this.chosenTarget.GetHitLocation(this.attacker, this.attackPosition, hitInfo.locationRolls[i], this.calledShotLocation, num);
- num = Mathf.Lerp(num, 1f, this.Director.Combat.Constants.HitTables.CalledShotBonusDegradeLerpFactor);
- if (AttackDirector.attackLogger.IsLogEnabled)
- {
- AttackDirector.attackLogger.Log(string.Format("SEQ:{0}: WEAP:{1} SHOT:{2} Hit! Location: {3}", new object[]
- {
- this.id,
- weaponIdx,
- i,
- hitInfo.hitLocations[i]
- }));
- }
- if (AttackDirector.hitminLogger.IsLogEnabled)
- {
- AttackDirector.hitminLogger.Log(string.Format("WEAPON: {0} - SHOT: {1} Hits! ////// HEX VAL {2}", weapon.Name, i, hitInfo.hitLocations[i]));
- }
- hitInfo.hitQualities[i] = this.Director.Combat.ToHit.GetBlowQuality(this.attacker, this.attackPosition, weapon, this.chosenTarget, this.meleeAttackType, this.IsBreachingShot);
- this.FlagShotHit();
- }
- else
- {
- hitInfo.hitLocations[i] = 0;
- if (AttackDirector.attackLogger.IsLogEnabled)
- {
- AttackDirector.attackLogger.Log(string.Format("SEQ:{0}: WEAP:{1} SHOT:{2} Miss!", this.id, weaponIdx, i));
- }
- if (AttackDirector.hitminLogger.IsLogEnabled)
- {
- AttackDirector.hitminLogger.Log(string.Format("WEAPON: {0} - SHOT: {1} Misses!", weapon.Name, i));
- }
- this.FlagShotMissed();
- }
- hitInfo.hitPositions[i] = this.chosenTarget.GetImpactPosition(this.attacker, this.attackPosition, weapon, ref hitInfo.hitLocations[i], ref hitInfo.attackDirections[i], ref hitInfo.secondaryTargetIds[i], ref hitInfo.secondaryHitLocations[i]);
- this.RefreshHitQualitiesForSecondaryTargets(ref hitInfo, weapon, i);
- }
- }
- // Token: 0x06006059 RID: 24665 RVA: 0x001A34F8 File Offset: 0x001A16F8
- private void GetClusteredHits(ref WeaponHitInfo hitInfo, int groupIdx, int weaponIdx, Weapon weapon, float toHitChance, float prevDodgedDamage)
- {
- if (AttackDirector.hitLogger.IsLogEnabled)
- {
- AttackDirector.hitLogger.Log(string.Format("???????? RANDOM HIT ROLLS (GetClusteredHits): Weapon Group: {0} // Weapon: {1}", groupIdx, weaponIdx));
- }
- hitInfo.toHitRolls = this.GetRandomNumbers(groupIdx, weaponIdx, hitInfo.numberOfShots);
- if (AttackDirector.hitLogger.IsLogEnabled)
- {
- AttackDirector.hitLogger.Log(string.Format("???????? RANDOM LOCATION ROLLS (GetClusteredHits): Weapon Group: {0} // Weapon: {1}", groupIdx, weaponIdx));
- }
- hitInfo.locationRolls = this.GetRandomNumbers(groupIdx, weaponIdx, hitInfo.numberOfShots);
- if (AttackDirector.hitLogger.IsLogEnabled)
- {
- AttackDirector.hitLogger.Log(string.Format("???????? DODGE ROLLS (GetClusteredHits): Weapon Group: {0} // Weapon: {1}", groupIdx, weaponIdx));
- }
- hitInfo.dodgeRolls = this.GetRandomNumbers(groupIdx, weaponIdx, hitInfo.numberOfShots);
- hitInfo.hitVariance = this.GetVarianceSums(groupIdx, weaponIdx, hitInfo.numberOfShots, weapon);
- int num = 0;
- float num2 = 1f + weapon.ClusteringModifier;
- float num3 = 1f;
- AbstractActor abstractActor = this.chosenTarget as AbstractActor;
- Team team = ((weapon != null && weapon.parent != null && weapon.parent.team != null) ? weapon.parent.team : null);
- for (int i = 0; i < hitInfo.numberOfShots; i++)
- {
- bool flag = this.GetCorrectedRoll(hitInfo.toHitRolls[i], team) <= toHitChance;
- if (team != null)
- {
- team.ProcessRandomRoll(toHitChance, flag);
- }
- bool flag2 = false;
- if (abstractActor != null)
- {
- flag2 = abstractActor.CheckDodge(this.attacker, weapon, hitInfo, i, this.IsBreachingShot);
- }
- if (flag && flag2)
- {
- hitInfo.dodgeSuccesses[i] = true;
- this.FlagAttackContainsDodge(abstractActor.GUID);
- }
- else
- {
- hitInfo.dodgeSuccesses[i] = false;
- }
- if (flag && !flag2)
- {
- if (num == 0)
- {
- num = this.chosenTarget.GetHitLocation(this.attacker, this.attackPosition, hitInfo.locationRolls[i], this.calledShotLocation, this.attacker.CalledShotBonusMultiplier);
- hitInfo.hitLocations[i] = num;
- if (AttackDirector.attackLogger.IsLogEnabled)
- {
- AttackDirector.attackLogger.Log(string.Format("SEQ:{0}: WEAP:{1} SHOT:{2} Initial clustered hit! Location: {3}", new object[]
- {
- this.id,
- weaponIdx,
- i,
- hitInfo.hitLocations[i]
- }));
- }
- if (AttackDirector.hitminLogger.IsLogEnabled)
- {
- AttackDirector.hitminLogger.Log(string.Format("WEAPON: {0} - SHOT: {1} Hits! ////// INITIAL HIT - HEX VAL {2}", weapon.Name, i, hitInfo.hitLocations[i]));
- }
- }
- else
- {
- hitInfo.hitLocations[i] = this.chosenTarget.GetAdjacentHitLocation(this.attackPosition, hitInfo.locationRolls[i], num, num2, num3);
- if (AttackDirector.attackLogger.IsLogEnabled)
- {
- AttackDirector.attackLogger.Log(string.Format("SEQ:{0}: WEAP:{1} SHOT:{2} Clustered hit! Location: {3}", new object[]
- {
- this.id,
- weaponIdx,
- i,
- hitInfo.hitLocations[i]
- }));
- }
- if (AttackDirector.hitminLogger.IsLogEnabled)
- {
- AttackDirector.hitminLogger.Log(string.Format("WEAPON: {0} - SHOT: {1} Hits! ////// CLUSTER HIT - HEX VAL {2}", weapon.Name, i, hitInfo.hitLocations[i]));
- }
- }
- hitInfo.hitQualities[i] = this.Director.Combat.ToHit.GetBlowQuality(this.attacker, this.attackPosition, weapon, this.chosenTarget, this.meleeAttackType, this.IsBreachingShot);
- this.FlagShotHit();
- }
- else
- {
- hitInfo.hitLocations[i] = 0;
- if (AttackDirector.attackLogger.IsLogEnabled)
- {
- AttackDirector.attackLogger.Log(string.Format("SEQ:{0}: WEAP:{1} SHOT:{2} Miss!", new object[]
- {
- this.id,
- weaponIdx,
- i,
- hitInfo.hitLocations[i]
- }));
- }
- if (AttackDirector.hitminLogger.IsLogEnabled)
- {
- AttackDirector.hitminLogger.Log(string.Format("WEAPON: {0} - SHOT: {1} Misses!", weapon.Name, i));
- }
- this.FlagShotMissed();
- }
- hitInfo.hitPositions[i] = this.chosenTarget.GetImpactPosition(this.attacker, this.attackPosition, weapon, ref hitInfo.hitLocations[i], ref hitInfo.attackDirections[i], ref hitInfo.secondaryTargetIds[i], ref hitInfo.secondaryHitLocations[i]);
- this.RefreshHitQualitiesForSecondaryTargets(ref hitInfo, weapon, i);
- }
- }
- // Token: 0x0600605A RID: 24666 RVA: 0x001A39A4 File Offset: 0x001A1BA4
- private void GetSingleClusteredHit(ref WeaponHitInfo hitInfo, int groupIdx, int weaponIdx, Weapon weapon, float toHitChance, float originalMultiplier = 1f, float adjacentMultiplier = 1f)
- {
- float randomNumber = this.GetRandomNumber(groupIdx, weaponIdx);
- for (int i = 0; i < hitInfo.numberOfShots; i++)
- {
- hitInfo.toHitRolls[i] = randomNumber;
- }
- if (AttackDirector.hitLogger.IsLogEnabled)
- {
- AttackDirector.hitLogger.Log(string.Format("???????? RANDOM LOCATION ROLLS (GetSingleClusteredHit): Weapon Group: {0} // Weapon: {1}", groupIdx, weaponIdx));
- }
- hitInfo.locationRolls = this.GetRandomNumbers(groupIdx, weaponIdx, hitInfo.numberOfShots);
- if (AttackDirector.hitLogger.IsLogEnabled)
- {
- AttackDirector.hitLogger.Log(string.Format("???????? DODGE ROLLS (GetSingleClusteredHit): Weapon Group: {0} // Weapon: {1}", groupIdx, weaponIdx));
- }
- hitInfo.dodgeRolls = this.GetRandomNumbers(groupIdx, weaponIdx, hitInfo.numberOfShots);
- hitInfo.hitVariance = this.GetVarianceSums(groupIdx, weaponIdx, hitInfo.numberOfShots, weapon);
- int num = 0;
- AbstractActor abstractActor = this.chosenTarget as AbstractActor;
- for (int j = 0; j < hitInfo.numberOfShots; j++)
- {
- bool flag = hitInfo.toHitRolls[j] <= toHitChance;
- bool flag2 = abstractActor != null && abstractActor.CheckDodge(this.attacker, weapon, hitInfo, j, this.IsBreachingShot);
- if (flag && flag2)
- {
- hitInfo.dodgeSuccesses[j] = true;
- this.FlagAttackContainsDodge(abstractActor.GUID);
- }
- else
- {
- hitInfo.dodgeSuccesses[j] = false;
- }
- if (flag && !flag2)
- {
- if (num == 0)
- {
- num = this.chosenTarget.GetHitLocation(this.attacker, this.attackPosition, hitInfo.locationRolls[j], this.calledShotLocation, this.attacker.CalledShotBonusMultiplier);
- hitInfo.hitLocations[j] = num;
- if (AttackDirector.attackLogger.IsLogEnabled)
- {
- AttackDirector.attackLogger.Log(string.Format("SEQ:{0}: WEAP:{1} SHOT:{2} Initial single clustered hit! Location: {3}", new object[]
- {
- this.id,
- weaponIdx,
- j,
- hitInfo.hitLocations[j]
- }));
- }
- if (AttackDirector.hitminLogger.IsLogEnabled)
- {
- AttackDirector.hitminLogger.Log(string.Format("WEAPON: {0} - SHOT: {1} Hits! ////// INITIAL HIT - HEX VAL {2}", weapon.Name, j, hitInfo.hitLocations[j]));
- }
- }
- else
- {
- this.chosenTarget.GetAdjacentHitLocation(this.attackPosition, hitInfo.locationRolls[j], num, originalMultiplier, adjacentMultiplier);
- if (AttackDirector.attackLogger.IsLogEnabled)
- {
- AttackDirector.attackLogger.Log(string.Format("SEQ:{0}: WEAP:{1} SHOT:{2} Single clustered hit! Location: {3}", new object[]
- {
- this.id,
- weaponIdx,
- j,
- hitInfo.hitLocations[j]
- }));
- }
- if (AttackDirector.hitminLogger.IsLogEnabled)
- {
- AttackDirector.hitminLogger.Log(string.Format("WEAPON: {0} - SHOT: {1} Hits! ////// CLUSTER HIT - HEX VAL {2}", weapon.Name, j, hitInfo.hitLocations[j]));
- }
- }
- hitInfo.hitQualities[j] = this.Director.Combat.ToHit.GetBlowQuality(this.attacker, this.attackPosition, weapon, this.chosenTarget, this.meleeAttackType, this.IsBreachingShot);
- this.FlagShotHit();
- }
- else
- {
- hitInfo.hitLocations[j] = 0;
- if (AttackDirector.attackLogger.IsLogEnabled)
- {
- AttackDirector.attackLogger.Log(string.Format("SEQ:{0}: WEAP:{1} SHOT:{2} Single clustered miss!", this.id, weaponIdx, j));
- }
- if (AttackDirector.hitminLogger.IsLogEnabled)
- {
- AttackDirector.hitminLogger.Log(string.Format("WEAPON: {0} - SHOT: {1} Misses!", weapon.Name, j));
- }
- this.FlagShotMissed();
- }
- hitInfo.hitPositions[j] = this.chosenTarget.GetImpactPosition(this.attacker, this.attackPosition, weapon, ref hitInfo.hitLocations[j], ref hitInfo.attackDirections[j], ref hitInfo.secondaryTargetIds[j], ref hitInfo.secondaryHitLocations[j]);
- this.RefreshHitQualitiesForSecondaryTargets(ref hitInfo, weapon, j);
- }
- }
- // Token: 0x0600605B RID: 24667 RVA: 0x001A3DB0 File Offset: 0x001A1FB0
- private void RefreshHitQualitiesForSecondaryTargets(ref WeaponHitInfo hitInfo, Weapon weapon, int hitIdx)
- {
- if (!string.IsNullOrEmpty(hitInfo.secondaryTargetIds[hitIdx]))
- {
- ICombatant combatant = this.Director.Combat.FindCombatantByGUID(hitInfo.secondaryTargetIds[hitIdx], false);
- hitInfo.hitQualities[hitIdx] = this.Director.Combat.ToHit.GetBlowQuality(this.attacker, this.attackPosition, weapon, combatant, this.meleeAttackType, this.IsBreachingShot);
- }
- }
- // Token: 0x0600605C RID: 24668 RVA: 0x001A3E20 File Offset: 0x001A2020
- private void SortSelectedWeapons()
- {
- this.sortedWeapons = new List<List<Weapon>>();
- for (int i = 0; i < this.allSelectedWeapons.Count; i++)
- {
- if (this.allSelectedWeapons[i].HasFired)
- {
- AttackDirector.attackLogger.LogError(string.Format("Weapon {0} has already fired! This is Very Bad(tm)", this.allSelectedWeapons[i].Name));
- }
- }
- if (this.allSelectedWeapons.Count < 1)
- {
- return;
- }
- this.allSelectedWeapons.Sort((Weapon x, Weapon y) => x.uid.CompareTo(y.uid));
- for (int j = this.allSelectedWeapons.Count - 1; j >= 0; j--)
- {
- Weapon weapon = this.allSelectedWeapons[j];
- if (weapon.WeaponCategoryValue.IsMelee)
- {
- List<Weapon> list = new List<Weapon>();
- list.Add(weapon);
- this.sortedWeapons.Add(list);
- }
- }
- this.allSelectedWeapons.Sort((Weapon x, Weapon y) => (y.DamagePerShotAdjusted(y.parent.occupiedDesignMask) * (1f + y.HeatDamagePerShot)).CompareTo(x.DamagePerShotAdjusted(x.parent.occupiedDesignMask) * (1f + x.HeatDamagePerShot)));
- List<Weapon> list2 = new List<Weapon>();
- for (int k = 0; k < this.allSelectedWeapons.Count; k++)
- {
- if (!this.allSelectedWeapons[k].WeaponCategoryValue.IsMelee)
- {
- list2.Add(this.allSelectedWeapons[k]);
- }
- }
- if (list2.Count > 0)
- {
- this.sortedWeapons.Add(list2);
- if (AttackDirector.attackLogger.IsDebugEnabled)
- {
- AttackDirector.attackLogger.LogDebug("sorted weapons");
- for (int l = 0; l < list2.Count; l++)
- {
- AttackDirector.attackLogger.Log(string.Format("Weapon {0} index {1} sort value {2}", list2[l].Name, l, list2[l].DamagePerShotAdjusted(list2[l].parent.occupiedDesignMask)));
- }
- }
- }
- }
- // Token: 0x0600605D RID: 24669 RVA: 0x001A4018 File Offset: 0x001A2218
- private bool CheckAllWeaponsComplete(int group)
- {
- List<Weapon> list = this.sortedWeapons[group];
- for (int i = 0; i < list.Count; i++)
- {
- if (!list[i].FiringComplete)
- {
- return false;
- }
- }
- return true;
- }
- // Token: 0x0600605E RID: 24670 RVA: 0x001A4054 File Offset: 0x001A2254
- private bool CheckAllGroupsComplete()
- {
- for (int i = 0; i < this.sortedWeapons.Count; i++)
- {
- if (!this.CheckAllWeaponsComplete(i))
- {
- return false;
- }
- }
- return true;
- }
- // Token: 0x0600605F RID: 24671 RVA: 0x001A4084 File Offset: 0x001A2284
- public void ResetWeapons()
- {
- for (int i = 0; i < this.allSelectedWeapons.Count; i++)
- {
- this.allSelectedWeapons[i].ResetWeapon();
- }
- }
- // Token: 0x06006060 RID: 24672 RVA: 0x001A40B8 File Offset: 0x001A22B8
- public void OnAttackSequenceGroupBegin(MessageCenterMessage message)
- {
- AttackSequenceGroupBeginMessage attackSequenceGroupBeginMessage = (AttackSequenceGroupBeginMessage)message;
- if (attackSequenceGroupBeginMessage.sequenceId != this.id)
- {
- return;
- }
- int groupIdx = attackSequenceGroupBeginMessage.groupIdx;
- this.currentFiringGroup = groupIdx;
- if (AttackDirector.AttackSequence.logger.IsLogEnabled)
- {
- AttackDirector.AttackSequence.logger.Log(string.Format("[OnAttackSequenceGroupBegin] ID {0}, Group {1}", this.id, groupIdx));
- }
- List<Weapon> list = this.sortedWeapons[this.currentFiringGroup];
- if (list.Count > 0)
- {
- AttackSequenceFireMessage attackSequenceFireMessage = new AttackSequenceFireMessage(this.stackItemUID, this.id, groupIdx, 0);
- this.Director.Combat.MessageCenter.PublishMessage(attackSequenceFireMessage);
- }
- WeaponHitInfo? weaponHitInfo = this.weaponHitInfo[groupIdx][0];
- if (weaponHitInfo != null)
- {
- WeaponHitInfo value = weaponHitInfo.Value;
- this.AddAllAffectedTargets(value);
- List<WeaponCategoryValue> list2 = new List<WeaponCategoryValue>();
- for (int i = 0; i < list.Count; i++)
- {
- Weapon weapon = list[i];
- if (!list2.Contains(weapon.WeaponCategoryValue))
- {
- list2.Add(weapon.WeaponCategoryValue);
- }
- foreach (EffectData effectData in weapon.weaponDef.statusEffects)
- {
- if (effectData.targetingData.effectTriggerType == EffectTriggerType.OnWeaponFire)
- {
- string text = string.Format("{0}Effect_{1}_{2}", effectData.targetingData.effectTriggerType.ToString(), weapon.parent.GUID, value.attackSequenceId);
- foreach (ICombatant combatant in this.Director.Combat.EffectManager.GetTargetCombatantForEffect(effectData, weapon.parent, this.chosenTarget))
- {
- this.Director.Combat.EffectManager.CreateEffect(effectData, text, this.stackItemUID, weapon.parent, combatant, value, i, false);
- if (!effectData.targetingData.hideApplicationFloatie)
- {
- this.Director.Combat.MessageCenter.PublishMessage(new FloatieMessage(weapon.parent.GUID, weapon.parent.GUID, effectData.Description.Name, FloatieMessage.MessageNature.Buff));
- }
- if (!effectData.targetingData.hideApplicationFloatie)
- {
- this.Director.Combat.MessageCenter.PublishMessage(new FloatieMessage(weapon.parent.GUID, combatant.GUID, effectData.Description.Name, FloatieMessage.MessageNature.Buff));
- }
- }
- }
- }
- }
- List<EffectData> componentStatusEffectsForTriggerType = this.attacker.GetComponentStatusEffectsForTriggerType(EffectTriggerType.OnWeaponFire, ComponentType.Upgrade);
- for (int k = 0; k < componentStatusEffectsForTriggerType.Count; k++)
- {
- EffectData effectData2 = componentStatusEffectsForTriggerType[k];
- if (effectData2.effectType != EffectType.StatisticEffect || effectData2.statisticData.targetCollection != StatisticEffectData.TargetCollection.Weapon || list2.Contains(effectData2.statisticData.TargetWeaponCategoryValue))
- {
- string text2 = string.Format("{0}Effect_{1}_{2}", effectData2.targetingData.effectTriggerType.ToString(), this.attacker.GUID, value.attackSequenceId);
- foreach (ICombatant combatant2 in this.Director.Combat.EffectManager.GetTargetCombatantForEffect(effectData2, this.attacker, this.chosenTarget))
- {
- this.Director.Combat.EffectManager.CreateEffect(effectData2, text2, this.stackItemUID, this.attacker, combatant2, value, 0, false);
- if (!effectData2.targetingData.hideApplicationFloatie)
- {
- this.Director.Combat.MessageCenter.PublishMessage(new FloatieMessage(this.attacker.GUID, combatant2.GUID, effectData2.Description.Name, FloatieMessage.MessageNature.Debuff));
- }
- }
- }
- }
- List<EffectData> abilityStatusEffectsForTriggerType = this.attacker.GetPilot().GetAbilityStatusEffectsForTriggerType(EffectTriggerType.OnWeaponFire);
- for (int l = 0; l < abilityStatusEffectsForTriggerType.Count; l++)
- {
- EffectData effectData3 = abilityStatusEffectsForTriggerType[l];
- if (effectData3.effectType != EffectType.StatisticEffect || effectData3.statisticData.targetCollection != StatisticEffectData.TargetCollection.Weapon || list2.Contains(effectData3.statisticData.TargetWeaponCategoryValue))
- {
- string text3 = string.Format("{0}Effect_{1}_{2}", effectData3.targetingData.effectTriggerType.ToString(), this.attacker.GUID, value.attackSequenceId);
- foreach (ICombatant combatant3 in this.Director.Combat.EffectManager.GetTargetCombatantForEffect(effectData3, this.attacker, this.chosenTarget))
- {
- this.Director.Combat.EffectManager.CreateEffect(effectData3, text3, this.stackItemUID, this.attacker, combatant3, value, 0, false);
- if (!effectData3.targetingData.hideApplicationFloatie)
- {
- this.Director.Combat.MessageCenter.PublishMessage(new FloatieMessage(this.attacker.GUID, combatant3.GUID, effectData3.Description.Name, FloatieMessage.MessageNature.Debuff));
- }
- }
- }
- }
- return;
- }
- AttackDirector.AttackSequence.logger.LogError("[OnAttackSequenceFire] had to generate hit info because pre-calculated hit info was not available!");
- }
- // Token: 0x06006061 RID: 24673 RVA: 0x001A4670 File Offset: 0x001A2870
- public void OnAttackSequenceWeaponPreFireComplete(MessageCenterMessage message)
- {
- AttackSequenceWeaponPreFireCompleteMessage attackSequenceWeaponPreFireCompleteMessage = (AttackSequenceWeaponPreFireCompleteMessage)message;
- if (attackSequenceWeaponPreFireCompleteMessage.sequenceId != this.id)
- {
- return;
- }
- int groupIdx = attackSequenceWeaponPreFireCompleteMessage.groupIdx;
- int num = attackSequenceWeaponPreFireCompleteMessage.weaponIdx;
- if (AttackDirector.AttackSequence.logger.IsLogEnabled)
- {
- AttackDirector.AttackSequence.logger.Log(string.Format("[OnAttackSequenceWeaponPreFireComplete] ID {0}, Group {1}, Weapon {2}", this.id, groupIdx, num));
- }
- List<Weapon> list = this.sortedWeapons[groupIdx];
- num++;
- if (num < list.Count)
- {
- AttackSequenceFireMessage attackSequenceFireMessage = new AttackSequenceFireMessage(this.stackItemUID, this.id, groupIdx, num);
- this.Director.Combat.MessageCenter.PublishMessage(attackSequenceFireMessage);
- }
- }
- // Token: 0x06006062 RID: 24674 RVA: 0x0000D184 File Offset: 0x0000B384
- private void PlayAttackVO()
- {
- }
- // Token: 0x06006063 RID: 24675 RVA: 0x001A4720 File Offset: 0x001A2920
- public void OnAttackSequenceFire(MessageCenterMessage message)
- {
- AttackSequenceFireMessage attackSequenceFireMessage = (AttackSequenceFireMessage)message;
- if (attackSequenceFireMessage.sequenceId != this.id)
- {
- return;
- }
- int groupIdx = attackSequenceFireMessage.groupIdx;
- int weaponIdx = attackSequenceFireMessage.weaponIdx;
- Weapon weapon = this.sortedWeapons[groupIdx][weaponIdx];
- if (AttackDirector.attackLogger.IsDebugEnabled)
- {
- AttackDirector.attackLogger.LogDebug("MeleeType = " + this.meleeAttackType.ToString());
- }
- if (AttackDirector.AttackSequence.logger.IsLogEnabled)
- {
- AttackDirector.AttackSequence.logger.Log(string.Format("[OnAttackSequenceFire] ID {0}, Group {1}, Weapon {2}, Weapon Name {3}", new object[] { this.id, groupIdx, weaponIdx, weapon.Name }));
- }
- if (AttackDirector.hitminLogger.IsLogEnabled)
- {
- AttackDirector.hitminLogger.Log(string.Format("============================================================= STARTING NEW ATTACK SEQUENCE FOR {0} (ID {1}):", weapon.Name, weaponIdx));
- }
- int num = this.numberOfShots[groupIdx][weaponIdx];
- if (num == -1)
- {
- if (weapon.HasPreFired)
- {
- AttackDirector.AttackSequence.logger.LogError(string.Format("[OnAttackSequenceFire] Weapon {0} should not have prefired if it wasn't going to fire!", weapon.Name));
- }
- AttackDirector.AttackSequence.logger.LogWarning(string.Format("Weapon {0} can't fire, skipping", weapon.Description.Name));
- AttackSequenceWeaponPreFireCompleteMessage attackSequenceWeaponPreFireCompleteMessage = new AttackSequenceWeaponPreFireCompleteMessage(this.stackItemUID, this.id, groupIdx, weaponIdx);
- this.Director.Combat.MessageCenter.PublishMessage(attackSequenceWeaponPreFireCompleteMessage);
- AttackSequenceWeaponCompleteMessage attackSequenceWeaponCompleteMessage = new AttackSequenceWeaponCompleteMessage(this.stackItemUID, this.id, groupIdx, weaponIdx);
- this.Director.Combat.MessageCenter.PublishMessage(attackSequenceWeaponCompleteMessage);
- return;
- }
- weapon.FireWeapon();
- if (num == 0)
- {
- AttackDirector.AttackSequence.logger.LogError(string.Format("[OnAttackSequenceFire] Weapon {0} tried to fire 0 shots (this should not happen!), skipping", weapon.Description.Name));
- AttackSequenceWeaponPreFireCompleteMessage attackSequenceWeaponPreFireCompleteMessage2 = new AttackSequenceWeaponPreFireCompleteMessage(this.stackItemUID, this.id, groupIdx, weaponIdx);
- this.Director.Combat.MessageCenter.PublishMessage(attackSequenceWeaponPreFireCompleteMessage2);
- AttackSequenceWeaponCompleteMessage attackSequenceWeaponCompleteMessage2 = new AttackSequenceWeaponCompleteMessage(this.stackItemUID, this.id, groupIdx, weaponIdx);
- this.Director.Combat.MessageCenter.PublishMessage(attackSequenceWeaponCompleteMessage2);
- return;
- }
- WeaponHitInfo? weaponHitInfo = this.weaponHitInfo[groupIdx][weaponIdx];
- WeaponHitInfo weaponHitInfo2;
- if (weaponHitInfo != null)
- {
- weaponHitInfo2 = weaponHitInfo.Value;
- this.AddAllAffectedTargets(weaponHitInfo2);
- }
- else
- {
- AttackDirector.AttackSequence.logger.LogError("[OnAttackSequenceFire] had to generate hit info because pre-calculated hit info was not available!");
- weaponHitInfo2 = this.GenerateHitInfo(weapon, groupIdx, weaponIdx, num, this.indirectFire, 0f);
- this.AddAllAffectedTargets(weaponHitInfo2);
- }
- weapon.CompleteFiring();
- foreach (EffectData effectData in weapon.weaponDef.statusEffects)
- {
- if (effectData.targetingData.effectTriggerType == EffectTriggerType.OnActivation)
- {
- string text = string.Format("{0}Effect_{1}_{2}", effectData.targetingData.effectTriggerType.ToString(), weapon.parent.GUID, weaponHitInfo2.attackSequenceId);
- foreach (ICombatant combatant in this.Director.Combat.EffectManager.GetTargetCombatantForEffect(effectData, weapon.parent, this.chosenTarget))
- {
- this.Director.Combat.EffectManager.CreateEffect(effectData, text, this.stackItemUID, weapon.parent, combatant, weaponHitInfo2, weaponIdx, false);
- if (!effectData.targetingData.hideApplicationFloatie)
- {
- this.Director.Combat.MessageCenter.PublishMessage(new FloatieMessage(weapon.parent.GUID, weapon.parent.GUID, effectData.Description.Name, FloatieMessage.MessageNature.Buff));
- }
- if (!effectData.targetingData.hideApplicationFloatie)
- {
- this.Director.Combat.MessageCenter.PublishMessage(new FloatieMessage(weapon.parent.GUID, combatant.GUID, effectData.Description.Name, FloatieMessage.MessageNature.Buff));
- }
- }
- }
- }
- bool flag = weapon.weaponRep != null && weapon.weaponRep.HasWeaponEffect;
- if (DebugBridge.TestToolsEnabled)
- {
- flag = flag && !DebugBridge.DisableWeaponEffectDrivenAttacks;
- }
- if (flag)
- {
- weapon.weaponRep.PlayWeaponEffect(weaponHitInfo2);
- return;
- }
- if (DebugBridge.TestToolsEnabled || !DebugBridge.DisableWeaponEffectDrivenAttacks)
- {
- AttackDirector.attackLogger.LogError("NO WEAPONEFFECT for " + weapon.Description.Name + ", skipping straight to resolving damage.");
- }
- AttackSequenceWeaponPreFireCompleteMessage attackSequenceWeaponPreFireCompleteMessage3 = new AttackSequenceWeaponPreFireCompleteMessage(this.stackItemUID, this.id, groupIdx, weaponIdx);
- this.Director.Combat.MessageCenter.PublishMessage(attackSequenceWeaponPreFireCompleteMessage3);
- for (int j = 0; j < num; j++)
- {
- float num2 = weapon.DamagePerShotAdjusted(weapon.parent.occupiedDesignMask);
- float num3 = weapon.StructureDamagePerShotAdjusted(weapon.parent.occupiedDesignMask);
- AttackSequenceImpactMessage attackSequenceImpactMessage = new AttackSequenceImpactMessage(weaponHitInfo2, j, num2, num3);
- this.Director.Combat.MessageCenter.PublishMessage(attackSequenceImpactMessage);
- }
- AttackSequenceResolveDamageMessage attackSequenceResolveDamageMessage = new AttackSequenceResolveDamageMessage(weaponHitInfo2);
- this.Director.Combat.MessageCenter.PublishMessage(attackSequenceResolveDamageMessage);
- AttackSequenceWeaponCompleteMessage attackSequenceWeaponCompleteMessage3 = new AttackSequenceWeaponCompleteMessage(this.stackItemUID, this.id, groupIdx, weaponIdx);
- this.Director.Combat.MessageCenter.PublishMessage(attackSequenceWeaponCompleteMessage3);
- }
- // Token: 0x06006064 RID: 24676 RVA: 0x001A4C8C File Offset: 0x001A2E8C
- public void OnAttackSequenceImpact(MessageCenterMessage message)
- {
- AttackSequenceImpactMessage attackSequenceImpactMessage = (AttackSequenceImpactMessage)message;
- if (attackSequenceImpactMessage.hitInfo.attackSequenceId != this.id)
- {
- return;
- }
- int attackGroupIndex = attackSequenceImpactMessage.hitInfo.attackGroupIndex;
- int attackWeaponIndex = attackSequenceImpactMessage.hitInfo.attackWeaponIndex;
- int hitIndex = attackSequenceImpactMessage.hitIndex;
- Weapon weapon = this.GetWeapon(attackGroupIndex, attackWeaponIndex);
- int num = attackSequenceImpactMessage.hitInfo.ShotHitLocation(hitIndex);
- Vector3 vector = attackSequenceImpactMessage.hitInfo.hitPositions[hitIndex];
- float hitDamage = attackSequenceImpactMessage.hitDamage;
- float structureDamage = attackSequenceImpactMessage.structureDamage;
- float blowQualityMultiplier = this.Director.Combat.ToHit.GetBlowQualityMultiplier(attackSequenceImpactMessage.hitInfo.hitQualities[hitIndex]);
- float num2 = hitDamage * blowQualityMultiplier;
- float num3 = structureDamage * blowQualityMultiplier;
- bool flag = !string.IsNullOrEmpty(attackSequenceImpactMessage.hitInfo.secondaryTargetIds[hitIndex]);
- ICombatant combatant = null;
- if (flag)
- {
- combatant = this.Director.Combat.FindCombatantByGUID(attackSequenceImpactMessage.hitInfo.secondaryTargetIds[hitIndex], false);
- }
- AbstractActor abstractActor = this.chosenTarget as AbstractActor;
- if (abstractActor != null)
- {
- LineOfFireLevel lineOfFireLevel = this.attacker.VisibilityCache.VisibilityToTarget(abstractActor).LineOfFireLevel;
- num2 = abstractActor.GetAdjustedDamage(num2, weapon.WeaponCategoryValue, abstractActor.occupiedDesignMask, lineOfFireLevel, true);
- num2 = abstractActor.GetAdjustedDamageForMelee(num2, weapon.WeaponCategoryValue);
- num3 = abstractActor.GetAdjustedDamage(num3, weapon.WeaponCategoryValue, abstractActor.occupiedDesignMask, lineOfFireLevel, true);
- num3 = abstractActor.GetAdjustedDamageForMelee(num3, weapon.WeaponCategoryValue);
- }
- if (num2 <= 0f)
- {
- AttackDirector.attackLogger.LogWarning(string.Format("OnAttackSequenceImpact is dealing <= 0 damage: base dmg: {0}, total: {1}", hitDamage, num2));
- num2 = 0f;
- }
- if (num3 <= 0f)
- {
- num3 = 0f;
- }
- bool flag2 = this.messageCoordinator.CanProcessMessage(attackSequenceImpactMessage);
- bool flag3 = attackSequenceImpactMessage.hitInfo.DidShotHitChosenTarget(hitIndex);
- if (!attackSequenceImpactMessage.hasPlayedImpact)
- {
- if (AttackDirector.AttackSequence.logger.IsDebugEnabled)
- {
- AttackDirector.AttackSequence.logger.LogDebug(string.Format("[OnAttackSequenceImpact] playing impact \"visuals\" for ID {0}, Group {1}, Weapon {2}, Hit {3}. Will process during this call? {4}", new object[] { this.id, attackGroupIndex, attackWeaponIndex, hitIndex, flag2 }));
- }
- attackSequenceImpactMessage.hasPlayedImpact = true;
- if (this.chosenTarget.GameRep != null)
- {
- if (flag3)
- {
- this.chosenTarget.GameRep.PlayImpactAnim(attackSequenceImpactMessage.hitInfo, hitIndex, weapon, this.meleeAttackType, this.cumulativeDamage);
- Vector3 vector2 = vector;
- if (this.chosenTarget.ArmorForLocation(num) < num2)
- {
- FloatieMessage floatieMessage = new FloatieMessage(attackSequenceImpactMessage.hitInfo.attackerId, this.chosenTarget.GUID, new Text("{0}", new object[] { (int)Mathf.Max(1f, num2) }), this.Director.Combat.Constants.CombatUIConstants.floatieSizeMedium, FloatieMessage.MessageNature.StructureDamage, vector2.x, vector2.y, vector2.z);
- this.Director.Combat.MessageCenter.PublishMessage(floatieMessage);
- }
- else
- {
- FloatieMessage floatieMessage2 = new FloatieMessage(attackSequenceImpactMessage.hitInfo.attackerId, this.chosenTarget.GUID, new Text("{0}", new object[] { (int)Mathf.Max(1f, num2) }), this.Director.Combat.Constants.CombatUIConstants.floatieSizeMedium, FloatieMessage.MessageNature.ArmorDamage, vector2.x, vector2.y, vector2.z);
- this.Director.Combat.MessageCenter.PublishMessage(floatieMessage2);
- }
- if (num3 > 0f)
- {
- FloatieMessage floatieMessage3 = new FloatieMessage(attackSequenceImpactMessage.hitInfo.attackerId, this.chosenTarget.GUID, new Text("{0}", new object[] { (int)Mathf.Max(1f, num3) }), this.Director.Combat.Constants.CombatUIConstants.floatieSizeMedium, FloatieMessage.MessageNature.StructureDamage, vector2.x, vector2.y, vector2.z);
- this.Director.Combat.MessageCenter.PublishMessage(floatieMessage3);
- }
- }
- else
- {
- Vector3 vector3 = this.chosenTarget.TargetPosition + Random.insideUnitSphere * 5f;
- if (attackSequenceImpactMessage.hitInfo.dodgeSuccesses[hitIndex])
- {
- this.chosenTarget.GameRep.PlayImpactAnim(attackSequenceImpactMessage.hitInfo, hitIndex, weapon, this.meleeAttackType, this.cumulativeDamage);
- FloatieMessage floatieMessage4 = new FloatieMessage(attackSequenceImpactMessage.hitInfo.attackerId, this.chosenTarget.GUID, new Text("EVADE", Array.Empty<object>()), this.Director.Combat.Constants.CombatUIConstants.floatieSizeMedium, FloatieMessage.MessageNature.Dodge, vector3.x, vector3.y, vector3.z);
- this.Director.Combat.MessageCenter.PublishMessage(floatieMessage4);
- }
- else if (this.meleeAttackType != MeleeAttackType.NotSet)
- {
- this.chosenTarget.GameRep.PlayImpactAnim(attackSequenceImpactMessage.hitInfo, hitIndex, weapon, this.meleeAttackType, this.cumulativeDamage);
- FloatieMessage floatieMessage5 = new FloatieMessage(attackSequenceImpactMessage.hitInfo.attackerId, attackSequenceImpactMessage.hitInfo.targetId, new Text("MISS!", Array.Empty<object>()), this.Director.Combat.Constants.CombatUIConstants.floatieSizeMedium, FloatieMessage.MessageNature.MeleeMiss, vector3.x, vector3.y, vector3.z);
- this.Director.Combat.MessageCenter.PublishMessage(floatieMessage5);
- }
- else
- {
- FloatieMessage.MessageNature messageNature = ((weapon.ShotsWhenFired > 1) ? FloatieMessage.MessageNature.Miss : FloatieMessage.MessageNature.MeleeMiss);
- FloatieMessage floatieMessage6 = new FloatieMessage(attackSequenceImpactMessage.hitInfo.attackerId, attackSequenceImpactMessage.hitInfo.targetId, new Text("MISS!", Array.Empty<object>()), this.Director.Combat.Constants.CombatUIConstants.floatieSizeMedium, messageNature, vector3.x, vector3.y, vector3.z);
- this.Director.Combat.MessageCenter.PublishMessage(floatieMessage6);
- }
- if (flag)
- {
- FloatieMessage floatieMessage7 = new FloatieMessage(attackSequenceImpactMessage.hitInfo.attackerId, attackSequenceImpactMessage.hitInfo.targetId, new Text("STRAY SHOT", Array.Empty<object>()), this.Director.Combat.Constants.CombatUIConstants.floatieSizeLarge, FloatieMessage.MessageNature.MeleeMiss, vector.x, vector.y, vector.z);
- this.Director.Combat.MessageCenter.PublishMessage(floatieMessage7);
- if (combatant != null && combatant.GameRep != null)
- {
- combatant.GameRep.PlayImpactAnim(attackSequenceImpactMessage.hitInfo, hitIndex, weapon, this.meleeAttackType, this.cumulativeDamage);
- }
- }
- }
- }
- if (weapon.Type != WeaponType.Laser && weapon.Type != WeaponType.Flamer)
- {
- CameraControl.Instance.AddCameraShake((num2 + num3) * this.Director.Combat.Constants.CombatUIConstants.ScreenShakeRangedDamageRelativeMod + this.Director.Combat.Constants.CombatUIConstants.ScreenShakeRangedDamageAbsoluteMod, 1f, vector);
- }
- }
- if (!flag2)
- {
- this.messageCoordinator.StoreMessage(attackSequenceImpactMessage);
- return;
- }
- if (AttackDirector.AttackSequence.logger.IsLogEnabled)
- {
- AttackDirector.AttackSequence.logger.Log(string.Format("[OnAttackSequenceImpact] ID {0}, Group {1}, Weapon {2}, Hit {3}.", new object[] { this.id, attackGroupIndex, attackWeaponIndex, hitIndex }));
- if (AttackDirector.AttackSequence.logger.IsDebugEnabled)
- {
- AttackDirector.AttackSequence.logger.LogDebug(string.Format("\t WeaponName {0}, MeleeType {1}, HitLocation {2}", weapon.Name, this.meleeAttackType.ToString(), num.ToString()));
- }
- }
- if (flag3)
- {
- this.cumulativeDamage += num2;
- this.cumulativeDamage += num3;
- this.chosenTarget.TakeWeaponDamage(attackSequenceImpactMessage.hitInfo, num, weapon, num2, num3, hitIndex, DamageType.Weapon);
- this.chosenTarget.HandleDeath(this.attacker.GUID);
- }
- else if (flag && combatant != null)
- {
- num2 = hitDamage * blowQualityMultiplier;
- num3 = structureDamage * blowQualityMultiplier;
- AbstractActor abstractActor2 = combatant as AbstractActor;
- if (abstractActor2 != null)
- {
- LineOfFireLevel lineOfFireLevel2 = this.attacker.VisibilityCache.VisibilityToTarget(abstractActor2).LineOfFireLevel;
- num2 = abstractActor2.GetAdjustedDamage(num2, weapon.WeaponCategoryValue, abstractActor2.occupiedDesignMask, lineOfFireLevel2, true);
- num2 = abstractActor2.GetAdjustedDamageForMelee(num2, weapon.WeaponCategoryValue);
- num3 = abstractActor2.GetAdjustedDamage(num3, weapon.WeaponCategoryValue, abstractActor2.occupiedDesignMask, lineOfFireLevel2, true);
- num3 = abstractActor2.GetAdjustedDamageForMelee(num3, weapon.WeaponCategoryValue);
- }
- if (combatant.ArmorForLocation(num) < num2)
- {
- FloatieMessage floatieMessage8 = new FloatieMessage(attackSequenceImpactMessage.hitInfo.attackerId, combatant.GUID, new Text("{0}", new object[] { (int)Mathf.Max(1f, num2) }), this.Director.Combat.Constants.CombatUIConstants.floatieSizeMedium, FloatieMessage.MessageNature.StructureDamage, vector.x, vector.y, vector.z);
- this.Director.Combat.MessageCenter.PublishMessage(floatieMessage8);
- }
- else
- {
- FloatieMessage floatieMessage9 = new FloatieMessage(attackSequenceImpactMessage.hitInfo.attackerId, combatant.GUID, new Text("{0}", new object[] { (int)Mathf.Max(1f, num2) }), this.Director.Combat.Constants.CombatUIConstants.floatieSizeMedium, FloatieMessage.MessageNature.ArmorDamage, vector.x, vector.y, vector.z);
- this.Director.Combat.MessageCenter.PublishMessage(floatieMessage9);
- }
- if (num3 > 0f)
- {
- FloatieMessage floatieMessage10 = new FloatieMessage(attackSequenceImpactMessage.hitInfo.attackerId, combatant.GUID, new Text("{0}", new object[] { (int)Mathf.Max(1f, num3) }), this.Director.Combat.Constants.CombatUIConstants.floatieSizeMedium, FloatieMessage.MessageNature.StructureDamage, vector.x, vector.y, vector.z);
- this.Director.Combat.MessageCenter.PublishMessage(floatieMessage10);
- }
- combatant.TakeWeaponDamage(attackSequenceImpactMessage.hitInfo, attackSequenceImpactMessage.hitInfo.ShotHitLocation(hitIndex), weapon, num2, num3, hitIndex, DamageType.Weapon);
- combatant.HandleDeath(this.attacker.GUID);
- }
- this.messageCoordinator.MessageComplete(attackSequenceImpactMessage);
- }
- // Token: 0x06006065 RID: 24677 RVA: 0x001A577C File Offset: 0x001A397C
- public void OnAttackSequenceResolveDamage(MessageCenterMessage message)
- {
- AttackSequenceResolveDamageMessage attackSequenceResolveDamageMessage = (AttackSequenceResolveDamageMessage)message;
- WeaponHitInfo hitInfo = attackSequenceResolveDamageMessage.hitInfo;
- if (hitInfo.attackSequenceId != this.id)
- {
- return;
- }
- if (!this.messageCoordinator.CanProcessMessage(attackSequenceResolveDamageMessage))
- {
- this.messageCoordinator.StoreMessage(attackSequenceResolveDamageMessage);
- return;
- }
- if (AttackDirector.AttackSequence.logger.IsLogEnabled)
- {
- AttackDirector.AttackSequence.logger.Log(string.Format("[OnAttackSequenceResolveDamage] ID {0}, Group {1}, Weapon {2}, AttackerId [{3}], TargetId [{4}]", new object[] { this.id, hitInfo.attackGroupIndex, hitInfo.attackWeaponIndex, hitInfo.attackerId, hitInfo.targetId }));
- }
- int attackGroupIndex = attackSequenceResolveDamageMessage.hitInfo.attackGroupIndex;
- int attackWeaponIndex = attackSequenceResolveDamageMessage.hitInfo.attackWeaponIndex;
- Weapon weapon = this.GetWeapon(attackGroupIndex, attackWeaponIndex);
- if (this.meleeAttackType == MeleeAttackType.DFA)
- {
- float num = Mathf.Max(0f, this.attacker.StatCollection.GetValue<float>("DFASelfDamage"));
- this.attacker.TakeWeaponDamage(attackSequenceResolveDamageMessage.hitInfo, 64, weapon, num, 0f, 0, DamageType.DFASelf);
- this.attacker.TakeWeaponDamage(attackSequenceResolveDamageMessage.hitInfo, 128, weapon, num, 0f, 0, DamageType.DFASelf);
- if (AttackDirector.damageLogger.IsLogEnabled)
- {
- AttackDirector.damageLogger.Log(string.Format("@@@@@@@@ {0} takes {1} damage to its legs from the DFA attack!", this.attacker.DisplayName, num));
- }
- }
- List<ICombatant> list = new List<ICombatant>();
- this.chosenTarget.ResolveWeaponDamage(attackSequenceResolveDamageMessage.hitInfo);
- list.Add(this.chosenTarget);
- if (hitInfo.GetFirstHitLocationForTarget(this.chosenTarget.GUID) >= 0)
- {
- this.attackCompletelyMissed = false;
- }
- for (int i = 0; i < attackSequenceResolveDamageMessage.hitInfo.secondaryTargetIds.Length; i++)
- {
- ICombatant combatant = this.Director.Combat.FindCombatantByGUID(attackSequenceResolveDamageMessage.hitInfo.secondaryTargetIds[i], false);
- if (combatant != null && !list.Contains(combatant))
- {
- list.Add(combatant);
- combatant.ResolveWeaponDamage(attackSequenceResolveDamageMessage.hitInfo);
- }
- }
- AttackDirector.AttackSequence attackSequence = this.Director.GetAttackSequence(hitInfo.attackSequenceId);
- for (int j = 0; j < attackSequence.allAffectedTargetIds.Count; j++)
- {
- AbstractActor abstractActor = this.Director.Combat.FindActorByGUID(attackSequence.allAffectedTargetIds[j]);
- if (abstractActor != null)
- {
- int firstHitLocationForTarget = hitInfo.GetFirstHitLocationForTarget(abstractActor.GUID);
- if (firstHitLocationForTarget >= 0 && !abstractActor.IsDead)
- {
- foreach (EffectData effectData in weapon.weaponDef.statusEffects)
- {
- if (effectData.targetingData.effectTriggerType == EffectTriggerType.OnHit)
- {
- string text = string.Format("{0}Effect_{1}_{2}", effectData.targetingData.effectTriggerType.ToString(), this.attacker.GUID, attackSequenceResolveDamageMessage.hitInfo.attackSequenceId);
- foreach (ICombatant combatant2 in this.Director.Combat.EffectManager.GetTargetCombatantForEffect(effectData, this.attacker, abstractActor))
- {
- this.Director.Combat.EffectManager.CreateEffect(effectData, text, this.stackItemUID, this.attacker, combatant2, hitInfo, firstHitLocationForTarget, false);
- if (effectData.durationData.activeTrackedEffect)
- {
- weapon.AddCreatedEffectID(text);
- }
- if (!effectData.targetingData.hideApplicationFloatie)
- {
- this.Director.Combat.MessageCenter.PublishMessage(new FloatieMessage(this.attacker.GUID, combatant2.GUID, effectData.Description.Name, FloatieMessage.MessageNature.Debuff));
- }
- }
- }
- }
- List<EffectData> componentStatusEffectsForTriggerType = this.attacker.GetComponentStatusEffectsForTriggerType(EffectTriggerType.OnHit, ComponentType.Upgrade);
- for (int l = 0; l < componentStatusEffectsForTriggerType.Count; l++)
- {
- EffectData effectData2 = componentStatusEffectsForTriggerType[l];
- if (effectData2.effectType != EffectType.StatisticEffect || effectData2.statisticData.targetCollection != StatisticEffectData.TargetCollection.Weapon || effectData2.statisticData.TargetWeaponCategoryValue.Equals(weapon.WeaponCategoryValue))
- {
- string text2 = string.Format("{0}Effect_{1}_{2}", effectData2.targetingData.effectTriggerType.ToString(), this.attacker.GUID, attackSequenceResolveDamageMessage.hitInfo.attackSequenceId);
- foreach (ICombatant combatant3 in this.Director.Combat.EffectManager.GetTargetCombatantForEffect(effectData2, this.attacker, abstractActor))
- {
- this.Director.Combat.EffectManager.CreateEffect(effectData2, text2, this.stackItemUID, this.attacker, combatant3, hitInfo, firstHitLocationForTarget, false);
- if (!effectData2.targetingData.hideApplicationFloatie)
- {
- this.Director.Combat.MessageCenter.PublishMessage(new FloatieMessage(this.attacker.GUID, combatant3.GUID, effectData2.Description.Name, FloatieMessage.MessageNature.Debuff));
- }
- }
- }
- }
- List<EffectData> abilityStatusEffectsForTriggerType = this.attacker.GetPilot().GetAbilityStatusEffectsForTriggerType(EffectTriggerType.OnHit);
- for (int m = 0; m < abilityStatusEffectsForTriggerType.Count; m++)
- {
- EffectData effectData3 = abilityStatusEffectsForTriggerType[m];
- if (effectData3.effectType != EffectType.StatisticEffect || effectData3.statisticData.targetCollection != StatisticEffectData.TargetCollection.Weapon || effectData3.statisticData.TargetWeaponCategoryValue.Equals(weapon.WeaponCategoryValue))
- {
- string text3 = string.Format("{0}Effect_{1}_{2}", effectData3.targetingData.effectTriggerType.ToString(), this.attacker.GUID, attackSequenceResolveDamageMessage.hitInfo.attackSequenceId);
- foreach (ICombatant combatant4 in this.Director.Combat.EffectManager.GetTargetCombatantForEffect(effectData3, this.attacker, abstractActor))
- {
- this.Director.Combat.EffectManager.CreateEffect(effectData3, text3, this.stackItemUID, this.attacker, combatant4, hitInfo, firstHitLocationForTarget, false);
- if (!effectData3.targetingData.hideApplicationFloatie)
- {
- this.Director.Combat.MessageCenter.PublishMessage(new FloatieMessage(this.attacker.GUID, combatant4.GUID, effectData3.Description.Name, FloatieMessage.MessageNature.Debuff));
- }
- }
- }
- }
- List<EffectData> componentStatusEffectsForTriggerType2 = abstractActor.GetComponentStatusEffectsForTriggerType(EffectTriggerType.OnDamaged, ComponentType.NotSet);
- for (int n = 0; n < componentStatusEffectsForTriggerType2.Count; n++)
- {
- EffectData effectData4 = componentStatusEffectsForTriggerType2[n];
- foreach (ICombatant combatant5 in this.Director.Combat.EffectManager.GetTargetCombatantForEffect(effectData4, abstractActor, this.attacker))
- {
- string text4 = string.Format("OnDamagedEffect_{0}_{1}", abstractActor.GUID, attackSequenceResolveDamageMessage.hitInfo.attackSequenceId);
- this.Director.Combat.EffectManager.CreateEffect(effectData4, text4, this.stackItemUID, abstractActor, combatant5, hitInfo, firstHitLocationForTarget, false);
- }
- }
- }
- }
- }
- this.attacker.HandleDeath(this.attacker.GUID);
- this.messageCoordinator.MessageComplete(attackSequenceResolveDamageMessage);
- }
- // Token: 0x06006066 RID: 24678 RVA: 0x001A5F54 File Offset: 0x001A4154
- public void OnAttackSequenceWeaponComplete(MessageCenterMessage message)
- {
- AttackSequenceWeaponCompleteMessage attackSequenceWeaponCompleteMessage = (AttackSequenceWeaponCompleteMessage)message;
- if (attackSequenceWeaponCompleteMessage.sequenceId != this.id)
- {
- return;
- }
- int groupIdx = attackSequenceWeaponCompleteMessage.groupIdx;
- int weaponIdx = attackSequenceWeaponCompleteMessage.weaponIdx;
- this.sortedWeapons[groupIdx][weaponIdx].FlagAsComplete();
- if (AttackDirector.AttackSequence.logger.IsLogEnabled)
- {
- AttackDirector.AttackSequence.logger.Log(string.Format("[OnAttackSequenceWeaponComplete] ID {0}, Group {1}, Weapon {2}.", this.id, groupIdx, weaponIdx));
- }
- if (this.CheckAllWeaponsComplete(this.currentFiringGroup))
- {
- AttackSequenceGroupEndMessage attackSequenceGroupEndMessage = new AttackSequenceGroupEndMessage(this.stackItemUID, this.id, groupIdx);
- this.Director.Combat.MessageCenter.PublishMessage(attackSequenceGroupEndMessage);
- }
- }
- // Token: 0x06006067 RID: 24679 RVA: 0x001A600C File Offset: 0x001A420C
- public void OnAttackSequenceGroupEnd(MessageCenterMessage message)
- {
- AttackSequenceGroupEndMessage attackSequenceGroupEndMessage = (AttackSequenceGroupEndMessage)message;
- if (attackSequenceGroupEndMessage.sequenceId != this.id)
- {
- return;
- }
- if (AttackDirector.AttackSequence.logger.IsLogEnabled)
- {
- int groupIdx = attackSequenceGroupEndMessage.groupIdx;
- AttackDirector.AttackSequence.logger.Log(string.Format("[OnAttackSequenceGroupEnd] ID {0}, Group {1}.", this.id, groupIdx));
- }
- this.currentFiringGroup++;
- if (this.currentFiringGroup < this.weaponGroupCount)
- {
- AttackSequenceGroupBeginMessage attackSequenceGroupBeginMessage = new AttackSequenceGroupBeginMessage(this.stackItemUID, this.id, this.currentFiringGroup);
- this.Director.Combat.MessageCenter.PublishMessage(attackSequenceGroupBeginMessage);
- return;
- }
- this.CoordinatedMesssagesSuccessful = this.messageCoordinator.VerifyAllMessagesComplete();
- AttackSequenceEndMessage attackSequenceEndMessage = new AttackSequenceEndMessage(this.stackItemUID, this.id);
- AttackDirector.AttackSequence attackSequence = this.Director.GetAttackSequence(this.id);
- for (int i = 0; i < attackSequence.allAffectedTargetIds.Count; i++)
- {
- ICombatant combatant = this.Director.Combat.FindCombatantByGUID(attackSequence.allAffectedTargetIds[i], false);
- if (combatant != null)
- {
- combatant.ResolveAttackSequence(attackSequence.attacker.GUID, this.id, attackSequence.stackItemUID, this.Director.Combat.HitLocation.GetAttackDirection(attackSequence.attackPosition, combatant));
- }
- }
- this.Director.Combat.MessageCenter.PublishMessage(attackSequenceEndMessage);
- this.messageCoordinator.VerifyAllMessagesComplete();
- }
- // Token: 0x04003E0A RID: 15882
- [JsonIgnore]
- [NonSerialized]
- public static readonly ILog logger = HBS.Logging.Logger.GetLogger("CombatLog.AttackSequence", LogLevel.Log);
- // Token: 0x04003E0C RID: 15884
- public int id;
- // Token: 0x04003E0D RID: 15885
- public int stackItemUID;
- // Token: 0x04003E0E RID: 15886
- public AbstractActor attacker;
- // Token: 0x04003E0F RID: 15887
- public ICombatant chosenTarget;
- // Token: 0x04003E10 RID: 15888
- public Vector3 attackPosition;
- // Token: 0x04003E11 RID: 15889
- public Quaternion attackRotation;
- // Token: 0x04003E12 RID: 15890
- public int attackSequenceIdx;
- // Token: 0x04003E13 RID: 15891
- public int calledShotLocation;
- // Token: 0x04003E14 RID: 15892
- public bool isMoraleAttack;
- // Token: 0x04003E15 RID: 15893
- public bool isMelee;
- // Token: 0x04003E16 RID: 15894
- public MeleeAttackType meleeAttackType;
- // Token: 0x04003E17 RID: 15895
- public bool isParentMelee;
- // Token: 0x04003E18 RID: 15896
- public bool indirectFire;
- // Token: 0x04003E19 RID: 15897
- public int numTargets;
- // Token: 0x04003E1A RID: 15898
- private List<string> allWeaponIds;
- // Token: 0x04003E1B RID: 15899
- private int[][] randomCacheValuesUsed;
- // Token: 0x04003E1C RID: 15900
- private float[][][] randomCache;
- // Token: 0x04003E1D RID: 15901
- private int[][] varianceCacheValuesUsed;
- // Token: 0x04003E1E RID: 15902
- private int[][][] varianceCache;
- // Token: 0x04003E1F RID: 15903
- private WeaponHitInfo?[][] weaponHitInfo;
- // Token: 0x04003E20 RID: 15904
- private int[][] numberOfShots;
- // Token: 0x04003E21 RID: 15905
- private MessageCoordinator messageCoordinator = new MessageCoordinator();
- // Token: 0x04003E22 RID: 15906
- public List<Weapon> allSelectedWeapons;
- // Token: 0x04003E23 RID: 15907
- private List<List<Weapon>> sortedWeapons;
- // Token: 0x04003E24 RID: 15908
- public float cumulativeDamage;
- // Token: 0x04003E25 RID: 15909
- public int currentFiringGroup;
- // Token: 0x04003E26 RID: 15910
- private Dictionary<string, bool> attackDestroyedWeapon;
- // Token: 0x04003E27 RID: 15911
- private Dictionary<string, bool> attackCausedAmmoExplosion;
- // Token: 0x04003E28 RID: 15912
- private Dictionary<string, bool> attackContainsDodge;
- // Token: 0x04003E29 RID: 15913
- private Dictionary<string, int> attackCrits;
- // Token: 0x04003E2A RID: 15914
- private Dictionary<string, List<Weapon>> attackWeaponCrits;
- // Token: 0x04003E2B RID: 15915
- private Dictionary<string, List<AmmunitionBox>> attackAmmoCrits;
- // Token: 0x04003E2C RID: 15916
- private Dictionary<string, bool> attackDidDamage;
- // Token: 0x04003E2D RID: 15917
- private Dictionary<string, float> attackArmorDamage;
- // Token: 0x04003E2E RID: 15918
- private Dictionary<string, bool> lowArmorStruck;
- // Token: 0x04003E2F RID: 15919
- private Dictionary<string, float> attackStructureDamage;
- // Token: 0x04003E30 RID: 15920
- private Dictionary<string, bool> attackDestroyedLeg;
- // Token: 0x04003E31 RID: 15921
- private Dictionary<string, bool> attackDestroyedAnyLocation;
- // Token: 0x04003E32 RID: 15922
- private Dictionary<string, bool> attackDealtHeatDamage;
- // Token: 0x04003E33 RID: 15923
- private Dictionary<string, bool> attackCausedKnockdown;
- // Token: 0x04003E3A RID: 15930
- public float previousTeamHealthDifference;
- // Token: 0x04003E3B RID: 15931
- private List<AttackDirector.AttackSequence.MechDamage> recordedMechDamage = new List<AttackDirector.AttackSequence.MechDamage>();
- // Token: 0x04003E3C RID: 15932
- private StatsGatherer damageStatsGatherer = new StatsGatherer();
- // Token: 0x04003E3D RID: 15933
- private const int RANDOM_ROLLS_PER_SHOT_PER_WEAPON = 6;
- // Token: 0x04003E3E RID: 15934
- private const int RANDOM_PILOT_ROLLS_PER_WEAPON = 2;
- // Token: 0x04003E3F RID: 15935
- private const int RANDOM_BUFFER_PER_WEAPON = 5;
- // Token: 0x04003E40 RID: 15936
- private const int WONT_FIRE_SHOT_COUNT = -1;
- // Token: 0x04003E41 RID: 15937
- private const int NO_AMMO_SHOT_COUNT = 0;
- // Token: 0x04003E42 RID: 15938
- private static bool UseWeightedHitNumbers = true;
- // Token: 0x04003E43 RID: 15939
- private static bool PrintDebugInfo = false;
- // Token: 0x02000CDC RID: 3292
- private class MechDamage
- {
- // Token: 0x06006069 RID: 24681 RVA: 0x001A61A8 File Offset: 0x001A43A8
- public void AppendToStatsGatherer(StatsGatherer statsGatherer)
- {
- this.statsGatherer = statsGatherer;
- this.Add("Damaged GUID", this.mechGUID);
- this.Add("Weapon Group Index", this.weaponGroupIndex);
- this.Add("Weapon Index", this.weaponIndex);
- this.Add("Hit Index", this.hitIndex);
- this.Add("Weapon Name", this.weaponName);
- this.Add("Original Hit Location", (ArmorLocation)this.originalHitLocation);
- this.Add("Hit Location", this.hitLocation);
- this.Add("Impact Quality", this.impactQuality);
- this.Add("Remaining Damage", this.totalDamage);
- this.statsGatherer = null;
- }
- // Token: 0x0600606A RID: 24682 RVA: 0x001A6280 File Offset: 0x001A4480
- private void Add(string key, object value)
- {
- string text = string.Format("Impact {0} {1}", this.index, key);
- this.statsGatherer.Add(text, value);
- }
- // Token: 0x04003E44 RID: 15940
- public string mechGUID;
- // Token: 0x04003E45 RID: 15941
- public int weaponGroupIndex;
- // Token: 0x04003E46 RID: 15942
- public int weaponIndex;
- // Token: 0x04003E47 RID: 15943
- public int hitIndex;
- // Token: 0x04003E48 RID: 15944
- public string weaponName;
- // Token: 0x04003E49 RID: 15945
- public int originalHitLocation;
- // Token: 0x04003E4A RID: 15946
- public ArmorLocation hitLocation;
- // Token: 0x04003E4B RID: 15947
- public AttackImpactQuality impactQuality;
- // Token: 0x04003E4C RID: 15948
- public float totalDamage;
- // Token: 0x04003E4D RID: 15949
- public int index;
- // Token: 0x04003E4E RID: 15950
- private StatsGatherer statsGatherer;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement