Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WeaponStat" /> struct.
 /// </summary>
 /// <param name="name">The name of the weapon.</param>
 /// <param name="imageAtlasID">The image atlas identifier.</param>
 /// <param name="imageFilename">The image filename.</param>
 /// <param name="description">The description.</param>
 /// <param name="size">The physical size of the weapon.</param>
 /// <param name="mass">The mass.</param>
 /// <param name="pwrRqmt">The power required to operate the weapon.</param>
 /// <param name="expense">The expense.</param>
 /// <param name="rangeCat">The range category of the weapon.</param>
 /// <param name="deliveryVehicleStrength">The delivery strength.</param>
 /// <param name="reloadPeriod">The time it takes to reload the weapon in hours.</param>
 /// <param name="damagePotential">The damage potential.</param>
 public AWeaponStat(string name, AtlasID imageAtlasID, string imageFilename, string description, float size, float mass, float pwrRqmt,
     float expense, RangeCategory rangeCat, WDVStrength deliveryVehicleStrength, float reloadPeriod,
     DamageStrength damagePotential)
     : base(name, imageAtlasID, imageFilename, description, size, mass, pwrRqmt, expense, rangeCat) {
     DeliveryVehicleStrength = deliveryVehicleStrength;
     ReloadPeriod = reloadPeriod;
     DamagePotential = damagePotential;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ShieldGeneratorStat"/> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="imageAtlasID">The image atlas identifier.</param>
 /// <param name="imageFilename">The image filename.</param>
 /// <param name="description">The description.</param>
 /// <param name="size">The size.</param>
 /// <param name="mass">The mass.</param>
 /// <param name="pwrRqmt">The PWR RQMT.</param>
 /// <param name="expense">The expense.</param>
 /// <param name="rangeCat">The range cat.</param>
 /// <param name="maximumCharge">The maximum charge.</param>
 /// <param name="trickleChargeRate">The trickle charge rate.</param>
 /// <param name="reloadPeriod">The reload period.</param>
 /// <param name="damageMitigation">The damage mitigation.</param>
 public ShieldGeneratorStat(string name, AtlasID imageAtlasID, string imageFilename, string description, float size, float mass,
     float pwrRqmt, float expense, RangeCategory rangeCat, float maximumCharge, float trickleChargeRate, float reloadPeriod, DamageStrength damageMitigation)
     : base(name, imageAtlasID, imageFilename, description, size, mass, pwrRqmt, expense, rangeCat) {
     MaximumCharge = maximumCharge;
     TrickleChargeRate = trickleChargeRate;
     ReloadPeriod = reloadPeriod;
     DamageMitigation = damageMitigation;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProjectileWeaponStat" /> struct.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="imageAtlasID">The image atlas identifier.</param>
        /// <param name="imageFilename">The image filename.</param>
        /// <param name="description">The description.</param>
        /// <param name="size">The physical size of the weapon.</param>
        /// <param name="mass">The mass of the weapon.</param>
        /// <param name="pwrRqmt">The power required to operate the weapon.</param>
        /// <param name="expense">The expense.</param>
        /// <param name="rangeCat">The range category of the weapon.</param>
        /// <param name="deliveryVehicleStrength">The delivery strength.</param>
        /// <param name="reloadPeriod">The time it takes to reload the weapon in hours.</param>
        /// <param name="damagePotential">The damage potential.</param>
        /// <param name="ordnanceMaxSpeed">The maximum speed of the ordnance in units per hour in Topography.OpenSpace.</param>
        /// <param name="ordnanceMass">The mass of the ordnance.</param>
        /// <param name="ordnanceDrag">The drag of the ordnance in Topography.OpenSpace.</param>
        /// <param name="maxLaunchInaccuracy">The maximum launch inaccuracy in degrees.</param>

        public ProjectileWeaponStat(string name, AtlasID imageAtlasID, string imageFilename, string description, float size, float mass, float pwrRqmt,
            float expense, RangeCategory rangeCat, WDVStrength deliveryVehicleStrength, float reloadPeriod, DamageStrength damagePotential,
            float ordnanceMaxSpeed, float ordnanceMass, float ordnanceDrag, float maxLaunchInaccuracy)
            : base(name, imageAtlasID, imageFilename, description, size, mass, pwrRqmt, expense, rangeCat, deliveryVehicleStrength, reloadPeriod, damagePotential, ordnanceMaxSpeed, ordnanceMass, ordnanceDrag) {
            if (maxLaunchInaccuracy > 5F) {
                D.Warn("{0} MaxLaunchInaccuracy of {1:0.#} is very high.", DebugName, maxLaunchInaccuracy);
            }
            MaxLaunchInaccuracy = maxLaunchInaccuracy;
        }
Ejemplo n.º 4
0
        public void HandleDetectionBy(Player detectingPlayer, IUnitCmd_Ltd cmdItem, RangeCategory sensorRange) {
            if (!_item.IsOperational) {
                D.Error("{0} should not be detected by {1} when dead!", _item.DebugName, cmdItem.DebugName);
            }
            //D.Log(ShowDebugLog, "{0}.HandleDetectionBy called. Detecting Cmd: {1}, SensorRange: {2}.", DebugName, cmdItem.DebugName, sensorRange.GetValueName());

            IDictionary<RangeCategory, IList<IUnitCmd_Ltd>> rangeLookup;
            if (!_detectionLookup.TryGetValue(detectingPlayer, out rangeLookup)) {

                Profiler.BeginSample("Proper Dictionary allocation", (_item as Component).gameObject);
                rangeLookup = new Dictionary<RangeCategory, IList<IUnitCmd_Ltd>>(3, RangeCategoryEqualityComparer.Default); // OPTIMIZE check size
                Profiler.EndSample();

                _detectionLookup.Add(detectingPlayer, rangeLookup);
            }

            IList<IUnitCmd_Ltd> cmds;
            if (!rangeLookup.TryGetValue(sensorRange, out cmds)) {

                Profiler.BeginSample("Proper List allocation", (_item as Component).gameObject);
                cmds = new List<IUnitCmd_Ltd>();
                Profiler.EndSample();

                rangeLookup.Add(sensorRange, cmds);
            }
            D.Assert(!cmds.Contains(cmdItem), cmdItem.DebugName);
            cmds.Add(cmdItem);

            // The following returns can not move earlier in method as detection state must be kept current to support Reset
            if (_debugControls.IsAllIntelCoverageComprehensive) {
                // Should already be set to comprehensive during game startup
                __ValidatePlayerIntelCoverageOfItemIsComprehensive(detectingPlayer);
                // Note: this debug setting DOES NOT pre-populate all player's knowledge
                if (_item.Owner.IsRelationshipWith(detectingPlayer, DiplomaticRelationship.Alliance, DiplomaticRelationship.Self)) {
                    // even with DebugSettings all coverage comprehensive, still no reason to update if Alliance or Self
                    __ValidatePlayerIntelCoverageOfItemIsComprehensive(detectingPlayer);    // UNCLEAR why called again?
                    __ValidatePlayerKnowledgeOfItem(detectingPlayer);
                    return;
                }
                UpdatePlayerKnowledge(detectingPlayer);
                return; // continuing could regress coverage on items that allow it
            }

            if (_item.Owner.IsRelationshipWith(detectingPlayer, DiplomaticRelationship.Alliance, DiplomaticRelationship.Self)) {
                // Should already be set to comprehensive when became self or alliance took place
                __ValidatePlayerIntelCoverageOfItemIsComprehensive(detectingPlayer);
                __ValidatePlayerKnowledgeOfItem(detectingPlayer);
                return; // continuing could regress coverage on items that allow it
            }

            Profiler.BeginSample("AssignDetectingPlayerIntelCoverage", (_item as Component).gameObject);
            AssignDetectingPlayerIntelCoverage(detectingPlayer);
            Profiler.EndSample();
            Profiler.BeginSample("UpdatePlayerKnowledge", (_item as Component).gameObject);
            UpdatePlayerKnowledge(detectingPlayer);
            Profiler.EndSample();
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AProjectileWeaponStat" /> struct.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="imageAtlasID">The image atlas identifier.</param>
 /// <param name="imageFilename">The image filename.</param>
 /// <param name="description">The description.</param>
 /// <param name="size">The physical size of the weapon.</param>
 /// <param name="mass">The mass of the weapon.</param>
 /// <param name="pwrRqmt">The power required to operate the weapon.</param>
 /// <param name="expense">The expense.</param>
 /// <param name="rangeCat">The range category of the weapon.</param>
 /// <param name="deliveryVehicleStrength">The delivery strength.</param>
 /// <param name="reloadPeriod">The time it takes to reload the weapon in hours.</param>
 /// <param name="damagePotential">The damage potential.</param>
 /// <param name="ordnanceMaxSpeed">The maximum speed of the ordnance in units per hour in Topography.OpenSpace.</param>
 /// <param name="ordnanceMass">The mass of the ordnance.</param>
 /// <param name="ordnanceDrag">The drag of the ordnance in Topography.OpenSpace.</param>
 public AProjectileWeaponStat(string name, AtlasID imageAtlasID, string imageFilename, string description, float size, float mass, float pwrRqmt,
     float expense, RangeCategory rangeCat, WDVStrength deliveryVehicleStrength, float reloadPeriod, DamageStrength damagePotential, float ordnanceMaxSpeed, float ordnanceMass, float ordnanceDrag)
     : base(name, imageAtlasID, imageFilename, description, size, mass, pwrRqmt, expense, rangeCat, deliveryVehicleStrength, reloadPeriod, damagePotential) {
     D.Assert(ordnanceMaxSpeed > Constants.ZeroF);
     D.Assert(ordnanceMass > Constants.ZeroF);
     D.Assert(ordnanceDrag > Constants.ZeroF);
     MaxSpeed = ordnanceMaxSpeed;
     OrdnanceMass = ordnanceMass;
     OrdnanceDrag = ordnanceDrag;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WeaponStat" /> struct.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="imageAtlasID">The image atlas identifier.</param>
 /// <param name="imageFilename">The image filename.</param>
 /// <param name="description">The description.</param>
 /// <param name="size">The physical size of the weapon.</param>
 /// <param name="mass">The mass.</param>
 /// <param name="pwrRqmt">The power required to operate the weapon.</param>
 /// <param name="expense">The expense.</param>
 /// <param name="rangeCat">The range category of the weapon.</param>
 /// <param name="baseRangeDistance">The base (no owner multiplier applied) range distance in units.</param>
 /// <param name="deliveryVehicleStrength">The delivery strength.</param>
 /// <param name="accuracy">The accuracy of the weapon. Range 0...1.0</param>
 /// <param name="reloadPeriod">The time it takes to reload the weapon in hours.</param>
 /// <param name="damagePotential">The damage potential.</param>
 /// <param name="duration">The firing duration in hours. Applicable only to Beams.</param>
 public WeaponStat(string name, AtlasID imageAtlasID, string imageFilename, string description, float size, float mass, float pwrRqmt,
     float expense, RangeCategory rangeCat, float baseRangeDistance, WDVStrength deliveryVehicleStrength, float accuracy,
     float reloadPeriod, DamageStrength damagePotential, float duration = Constants.ZeroF)
     : base(name, imageAtlasID, imageFilename, description, size, mass, pwrRqmt, expense, rangeCat, baseRangeDistance) {
     DeliveryVehicleStrength = deliveryVehicleStrength;
     Accuracy = accuracy;
     ReloadPeriod = reloadPeriod;
     DamagePotential = damagePotential;
     Duration = duration;
     Validate();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ActiveCountermeasureStat" /> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="imageAtlasID">The image atlas identifier.</param>
 /// <param name="imageFilename">The image filename.</param>
 /// <param name="description">The description.</param>
 /// <param name="size">The size.</param>
 /// <param name="mass">The mass.</param>
 /// <param name="pwrRqmt">The PWR RQMT.</param>
 /// <param name="expense">The expense.</param>
 /// <param name="rangeCat">The range cat.</param>
 /// <param name="interceptStrengths">The intercept strengths.</param>
 /// <param name="interceptAccuracy">The intercept accuracy.</param>
 /// <param name="reloadPeriod">The reload period.</param>
 /// <param name="damageMitigation">The damage mitigation.</param>
 public ActiveCountermeasureStat(string name, AtlasID imageAtlasID, string imageFilename, string description, float size, float mass,
     float pwrRqmt, float expense, RangeCategory rangeCat, WDVStrength[] interceptStrengths, float interceptAccuracy, float reloadPeriod,
     DamageStrength damageMitigation)
     : base(name, imageAtlasID, imageFilename, description, size, mass, pwrRqmt, expense, rangeCat) {
     // confirm if more than one interceptStrength, that they each contain a unique WDVCategory
     D.AssertEqual(interceptStrengths.Length, interceptStrengths.Select(intS => intS.Category).Distinct().Count(), "Duplicate Categories found.");
     InterceptStrengths = interceptStrengths;
     InterceptAccuracy = interceptAccuracy;
     ReloadPeriod = reloadPeriod;
     DamageMitigation = damageMitigation;
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WeaponStat" /> struct.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="imageAtlasID">The image atlas identifier.</param>
 /// <param name="imageFilename">The image filename.</param>
 /// <param name="description">The description.</param>
 /// <param name="size">The physical size of the weapon.</param>
 /// <param name="mass">The mass.</param>
 /// <param name="pwrRqmt">The power required to operate the weapon.</param>
 /// <param name="expense">The expense.</param>
 /// <param name="rangeCat">The range category of the weapon.</param>
 /// <param name="deliveryVehicleStrength">The delivery strength.</param>
 /// <param name="reloadPeriod">The time it takes to reload the weapon in hours.</param>
 /// <param name="damagePotential">The damage potential.</param>
 /// <param name="duration">The firing duration in hours.</param>
 /// <param name="maxLaunchInaccuracy">The maximum launch inaccuracy in degrees.</param>
 public BeamWeaponStat(string name, AtlasID imageAtlasID, string imageFilename, string description, float size, float mass,
     float pwrRqmt, float expense, RangeCategory rangeCat, WDVStrength deliveryVehicleStrength,
     float reloadPeriod, DamageStrength damagePotential, float duration, float maxLaunchInaccuracy)
     : base(name, imageAtlasID, imageFilename, description, size, mass, pwrRqmt, expense, rangeCat, deliveryVehicleStrength, reloadPeriod, damagePotential) {
     D.Assert(duration > Constants.ZeroF);
     if (maxLaunchInaccuracy > 5F) {
         D.Warn("{0} MaxLaunchInaccuracy of {1:0.#} is very high.", DebugName, MaxLaunchInaccuracy);
     }
     Duration = duration;
     MaxLaunchInaccuracy = maxLaunchInaccuracy;
 }
 private float AdjustedAccuracy(RangeCategory cat, Thing equipment)
 {
     if (equipment == null)
     {
         return(cat switch
         {
             RangeCategory.Touch => accuracyTouch,
             RangeCategory.Short => accuracyShort,
             RangeCategory.Medium => accuracyMedium,
             RangeCategory.Long => accuracyLong,
             _ => throw new InvalidOperationException(),
         });
Ejemplo n.º 10
0
        /// <summary>
        /// The steering accuracy of the missile. Range 0...1.0. Each 1% (0.01) of
        /// inaccuracy introduces up to 1 degree of steering inaccuracy.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="imageAtlasID">The image atlas identifier.</param>
        /// <param name="imageFilename">The image filename.</param>
        /// <param name="description">The description.</param>
        /// <param name="size">The physical size of the weapon.</param>
        /// <param name="mass">The mass of the weapon.</param>
        /// <param name="pwrRqmt">The power required to operate the weapon.</param>
        /// <param name="expense">The expense.</param>
        /// <param name="rangeCat">The range category of the weapon.</param>
        /// <param name="deliveryVehicleStrength">The delivery strength.</param>
        /// <param name="reloadPeriod">The time it takes to reload the weapon in hours.</param>
        /// <param name="damagePotential">The damage potential.</param>
        /// <param name="ordnanceMaxSpeed">The maximum speed of the ordnance in units per hour in Topography.OpenSpace.</param>
        /// <param name="ordnanceMass">The mass of the ordnance.</param>
        /// <param name="ordnanceDrag">The drag of the ordnance in Topography.OpenSpace.</param>
        /// <param name="turnRate">The turn rate of the ordnance in degrees per hour .</param>
        /// <param name="courseUpdateFreq">How often the ordnance's course is updated in updates per hour.</param>
        /// <param name="maxSteeringInaccuracy">The maximum steering inaccuracy in degrees.</param>

        public MissileWeaponStat(string name, AtlasID imageAtlasID, string imageFilename, string description, float size, float mass, float pwrRqmt,
            float expense, RangeCategory rangeCat, WDVStrength deliveryVehicleStrength, float reloadPeriod, DamageStrength damagePotential,
            float ordnanceMaxSpeed, float ordnanceMass, float ordnanceDrag, float turnRate, float courseUpdateFreq, float maxSteeringInaccuracy)
            : base(name, imageAtlasID, imageFilename, description, size, mass, pwrRqmt, expense, rangeCat, deliveryVehicleStrength, reloadPeriod, damagePotential, ordnanceMaxSpeed, ordnanceMass, ordnanceDrag) {
            D.Assert(turnRate > Constants.ZeroF);
            D.Assert(courseUpdateFreq > Constants.ZeroF);
            if (maxSteeringInaccuracy > 5F) {
                D.Warn("{0} MaxSteeringInaccuracy of {1:0.#} is very high.", DebugName, MaxSteeringInaccuracy);
            }
            TurnRate = turnRate;
            CourseUpdateFrequency = courseUpdateFreq;
            MaxSteeringInaccuracy = maxSteeringInaccuracy;
        }
Ejemplo n.º 11
0
 public static void AdjustedAccuracyPostfix(VerbProperties __instance, ref float __result, RangeCategory cat)
 {
     if (__instance is VerbProperties_Custom)
     {
         __result += cat switch
         {
             RangeCategory.Touch => __instance.accuracyTouch,
             RangeCategory.Short => __instance.accuracyShort,
             RangeCategory.Medium => __instance.accuracyMedium,
             RangeCategory.Long => __instance.accuracyLong,
             _ => throw new InvalidOperationException(),
         };
     }
 }
        // Token: 0x0600055E RID: 1374 RVA: 0x0001AE90 File Offset: 0x00019090
        public new float AdjustedAccuracy(RangeCategory cat, Thing equipment)
        {
            if (equipment != null)
            {
                StatDef stat = null;
                float   mult = 1f;
                switch (cat)
                {
                case RangeCategory.Touch:
                    stat = StatDefOf.AccuracyTouch;
                    mult = this.accuracyTouch;
                    break;

                case RangeCategory.Short:
                    stat = StatDefOf.AccuracyShort;
                    mult = this.accuracyShort;
                    break;

                case RangeCategory.Medium:
                    stat = StatDefOf.AccuracyMedium;
                    mult = this.accuracyMedium;
                    break;

                case RangeCategory.Long:
                    stat = StatDefOf.AccuracyLong;
                    mult = this.accuracyLong;
                    break;
                }
                return(equipment.GetStatValue(stat, true) * mult);
            }
            switch (cat)
            {
            case RangeCategory.Touch:
                return(this.accuracyTouch);

            case RangeCategory.Short:
                return(this.accuracyShort);

            case RangeCategory.Medium:
                return(this.accuracyMedium);

            case RangeCategory.Long:
                return(this.accuracyLong);

            default:
                throw new InvalidOperationException();
            }
        }
Ejemplo n.º 13
0
        private float AdjustedAccuracy(RangeCategory cat, Thing equipment)
        {
            if (equipment == null)
            {
                switch (cat)
                {
                case RangeCategory.Touch:
                    return(accuracyTouch);

                case RangeCategory.Short:
                    return(accuracyShort);

                case RangeCategory.Medium:
                    return(accuracyMedium);

                case RangeCategory.Long:
                    return(accuracyLong);

                default:
                    throw new InvalidOperationException();
                }
            }
            StatDef stat = null;

            switch (cat)
            {
            case RangeCategory.Touch:
                stat = StatDefOf.AccuracyTouch;
                break;

            case RangeCategory.Short:
                stat = StatDefOf.AccuracyShort;
                break;

            case RangeCategory.Medium:
                stat = StatDefOf.AccuracyMedium;
                break;

            case RangeCategory.Long:
                stat = StatDefOf.AccuracyLong;
                break;
            }
            return(equipment.GetStatValue(stat));
        }
Ejemplo n.º 14
0
        internal static float AdjustedAccuracy(VerbProperties props, RangeCategory cat, Thing equipment)
        {
            if (equipment != null)
            {
                StatDef stat = null;
                switch (cat)
                {
                case RangeCategory.Touch:
                    stat = StatDefOf.AccuracyTouch;
                    break;

                case RangeCategory.Short:
                    stat = StatDefOf.AccuracyShort;
                    break;

                case RangeCategory.Medium:
                    stat = StatDefOf.AccuracyMedium;
                    break;

                case RangeCategory.Long:
                    stat = StatDefOf.AccuracyLong;
                    break;
                }
                return(equipment.GetStatValue(stat, true));
            }
            switch (cat)
            {
            case RangeCategory.Touch:
                return(props.accuracyTouch);

            case RangeCategory.Short:
                return(props.accuracyShort);

            case RangeCategory.Medium:
                return(props.accuracyMedium);

            case RangeCategory.Long:
                return(props.accuracyLong);

            default:
                throw new InvalidOperationException();
            }
        }
Ejemplo n.º 15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WeaponStat" /> struct.
 /// </summary>
 /// <param name="category">The ArmamentCategory this weapon belongs too.</param>
 /// <param name="strength">The combat strength of the weapon.</param>
 /// <param name="range">The range of the weapon.</param>
 /// <param name="accuracy">The accuracy of the weapon. Range 0...1.0</param>
 /// <param name="reloadPeriod">The time it takes to reload the weapon in hours.</param>
 /// <param name="size">The physical size of the weapon.</param>
 /// <param name="pwrRqmt">The power required to operate the weapon.</param>
 /// <param name="duration">The firing duration in hours.</param>
 /// <param name="rootName">The root name to use for this weapon before adding supplemental attributes.</param>
 public BeamWeaponStat(WDVCategory category, CombatStrength strength, RangeCategory range, float accuracy, float reloadPeriod, float size, float pwrRqmt, float duration = Constants.ZeroF, string rootName = Constants.Empty)
     : base(category, strength, range, accuracy, reloadPeriod, size, pwrRqmt, rootName) {
     Duration = duration;
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SensorStat" /> struct.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="imageAtlasID">The image atlas identifier.</param>
 /// <param name="imageFilename">The image filename.</param>
 /// <param name="description">The description.</param>
 /// <param name="size">The physical size of the sensor.</param>
 /// <param name="mass">The mass.</param>
 /// <param name="pwrRqmt">The power required to operate the sensor.</param>
 /// <param name="expense">The expense.</param>
 /// <param name="rangeCat">The range category of the sensor.</param>
 public SensorStat(string name, AtlasID imageAtlasID, string imageFilename, string description, float size, float mass, float pwrRqmt,
     float expense, RangeCategory rangeCat)
     : base(name, imageAtlasID, imageFilename, description, size, mass, pwrRqmt, expense, rangeCat) { }
Ejemplo n.º 17
0
        public void HandleDetectionLostBy(Player detectingPlayer, IUnitCmd_Ltd cmdItem, RangeCategory sensorRange) {
            D.AssertNotDefault((int)sensorRange);
            if (!_item.IsOperational) {    // 7.20.16 detected items no longer notified of lost detection when they die
                D.Error("{0} should not be notified by {1} of detection lost when dead!", DebugName, cmdItem.DebugName);
            }
            //D.Log(ShowDebugLog, "{0}.HandleDetectionLostBy called. Detecting Cmd: {1}, SensorRange: {2}.", DebugName, cmdItem.DebugName, sensorRange.GetValueName());

            IDictionary<RangeCategory, IList<IUnitCmd_Ltd>> rangeLookup;
            if (!_detectionLookup.TryGetValue(detectingPlayer, out rangeLookup)) {
                D.Error("{0} found no Sensor Range lookup. Detecting Cmd: {1}.", DebugName, cmdItem.DebugName);
                return;
            }

            IList<IUnitCmd_Ltd> cmds;
            if (!rangeLookup.TryGetValue(sensorRange, out cmds)) {
                D.Error("{0} found no List of Commands. Detecting Cmd: {1}, SensorRange: {2}.", DebugName, cmdItem.DebugName, sensorRange.GetValueName());
                return;
            }

            bool isRemoved = cmds.Remove(cmdItem);
            D.Assert(isRemoved, cmdItem.DebugName);
            if (cmds.Count == Constants.Zero) {
                rangeLookup.Remove(sensorRange);
                if (rangeLookup.Count == Constants.Zero) {
                    _detectionLookup.Remove(detectingPlayer);
                }
            }

            // The following returns can not move earlier in method as detection state must be kept current to support Reset
            if (_debugControls.IsAllIntelCoverageComprehensive) {
                // Should already be set to comprehensive during game startup
                __ValidatePlayerIntelCoverageOfItemIsComprehensive(detectingPlayer);
                __ValidatePlayerKnowledgeOfItem(detectingPlayer);   // must have already detected item to have lost it
                return; // continuing could regress coverage on items that allow it
            }

            if (_item.Owner.IsRelationshipWith(detectingPlayer, DiplomaticRelationship.Alliance, DiplomaticRelationship.Self)) {
                // Should already be set to comprehensive when became self or alliance took place
                __ValidatePlayerIntelCoverageOfItemIsComprehensive(detectingPlayer);
                __ValidatePlayerKnowledgeOfItem(detectingPlayer);
                return; // continuing could regress coverage on items that allow it
            }

            AssignDetectingPlayerIntelCoverage(detectingPlayer);
            UpdatePlayerKnowledge(detectingPlayer);
        }
Ejemplo n.º 18
0
        public static void AdjustedAccuracyPostfix(VerbProperties __instance, ref float __result, RangeCategory cat)
        {
            if (__instance is VerbProperties_Custom)
            {
                switch (cat)
                {
                case RangeCategory.Touch:
                    __result += __instance.accuracyTouch;
                    break;

                case RangeCategory.Short:
                    __result += __instance.accuracyShort;
                    break;

                case RangeCategory.Medium:
                    __result += __instance.accuracyMedium;
                    break;

                case RangeCategory.Long:
                    __result += __instance.accuracyLong;
                    break;

                default:
                    throw new InvalidOperationException();
                }
            }
        }
Ejemplo n.º 19
0
 public void HandleDetectionLostBy(Player detectingPlayer, IUnitCmd_Ltd cmdItem, RangeCategory sensorRangeCat) {
     _detectionHandler.HandleDetectionLostBy(detectingPlayer, cmdItem, sensorRangeCat);
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ARangedEquipmentStat" /> class.
 /// </summary>
 /// <param name="name">The name of the RangedEquipment.</param>
 /// <param name="imageAtlasID">The image atlas identifier.</param>
 /// <param name="imageFilename">The image filename.</param>
 /// <param name="description">The description.</param>
 /// <param name="size">The size.</param>
 /// <param name="mass">The mass.</param>
 /// <param name="pwrRqmt">The power needed to operate this equipment.</param>
 /// <param name="expense">The expense.</param>
 /// <param name="rangeCat">The range category.</param>
 public ARangedEquipmentStat(string name, AtlasID imageAtlasID, string imageFilename, string description, float size, float mass,
     float pwrRqmt, float expense, RangeCategory rangeCat)
     : base(name, imageAtlasID, imageFilename, description, size, mass, pwrRqmt, expense) {
     RangeCategory = rangeCat;
 }