Beispiel #1
0
        public override void Execute(ScriptingContext context)
        {
            var scriptName = this.Accessory["script/@name"];
            var domain     = scriptName.Substring(0, 1).ToLower() + scriptName.Substring(1);

            if (domain == "staticFactorDevice" || domain == "staticAdditiveDevice")
            {
                double value;
                if (double.TryParse(this.Accessory["script/factor"],
                                    NumberStyles.Float | NumberStyles.AllowThousands,
                                    CultureInfo.InvariantCulture,
                                    out value))
                {
                    var name = this.Accessory["script/attribute"].Replace('/', '_');
                    context.SetValue(domain, name, value);
                }
            }
            else
            {
                foreach (var attribute in this.Accessory.QueryMany("script/*"))
                {
                    double value;
                    if (double.TryParse(attribute.Value,
                                        NumberStyles.Float | NumberStyles.AllowThousands,
                                        CultureInfo.InvariantCulture,
                                        out value))
                    {
                        context.SetValue(domain, attribute.Name, value);
                    }
                }
            }
        }
Beispiel #2
0
        public override void Execute(ScriptingContext context)
        {
            var currentLevel = this.LevelGetter();
            var levels       = new List <double>();

            levels.Add(currentLevel);

            var i = 0;

            for (; ; ++i)
            {
                var level = context.GetValue(this.Domain, string.Format("__level{0}", i));
                if (level == null)
                {
                    break;
                }
                else
                {
                    levels.Add(level.Value);
                }
            }

            context.SetValue(this.Domain, string.Format("__level{0}", i), currentLevel);

            var crewCount = context.GetCrewCount(this.Role);

            for (++i; i < crewCount; ++i)
            {
                levels.Add(0);
            }

            double actualValue;

            switch (this.DuplicatedSkillPolicy)
            {
            case DuplicatedSkillPolicy.Average:
                actualValue = levels.AotSafeAverage();
                break;

            case DuplicatedSkillPolicy.Highest:
                actualValue = levels.AotSafeMax();
                break;

            case DuplicatedSkillPolicy.Lowest:
                actualValue = levels.AotSafeMin();
                break;

            default:
                throw new NotSupportedException();
            }

            if (this.SkillType == SkillType.Skill || (this.SkillType == SkillType.Perk && actualValue >= 100))
            {
                this.Execute(context, actualValue);
            }
            else
            {
                this.Clear(context);
            }
        }
 protected override void Clear(ScriptingContext context)
 {
     foreach (var parameter in this.Parameters)
     {
         context.SetValue(this.Domain, parameter.Key, 0.0);
     }
 }
        protected override void Execute(ScriptingContext context, double level)
        {
            var viewRangeFactor = BasicSkillScript.GetIncrementalSkillFactor(level);

            context.SetValue(this.Domain, ViewRangeFactorSkillKey, viewRangeFactor);
            var crewTrainingLevelBuff = level / 10;

            context.SetValue(this.Domain, CrewTrainingLevelBuffSkillKey, crewTrainingLevelBuff);
        }
        protected override void Execute(ScriptingContext context, double level)
        {
            var decrementalFactor = BasicSkillScript.GetDecrementalSkillFactor(level);

            context.SetValue(this.Domain, AccuracyFactorSkillKey, decrementalFactor);
            context.SetValue(this.Domain, AimingTimeFactorSkillKey, decrementalFactor);
            context.SetValue(this.Domain, ShotDispersionFactorSkillKey, decrementalFactor);

            var incrementalFactor = BasicSkillScript.GetIncrementalSkillFactor(level);

            context.SetValue(this.Domain, TurretRotationSpeedSkillKey, incrementalFactor);
        }
Beispiel #6
0
        public override void Execute(ScriptingContext context)
        {
            double value;

            if (double.TryParse(this.Camouflage["invisibilityFactor"],
                                NumberStyles.Float | NumberStyles.AllowThousands,
                                CultureInfo.InvariantCulture,
                                out value))
            {
                context.SetValue("camouflage", "camouflagePaintFactor", value);
            }
        }
 protected override void Execute(ScriptingContext context, double level)
 {
     if (this.SkillType == SkillType.Perk)
     {
         foreach (var parameter in this.Parameters)
         {
             context.SetValue(this.Domain, parameter.Key, parameter.Value);
         }
     }
     else
     {
         foreach (var parameter in this.Parameters)
         {
             var key = parameter.Key;
             key = key.Replace("FactorPerLevel", "Factor");
             context.SetValue(this.Domain, key, parameter.Value * level);
         }
     }
 }
 protected override void Clear(ScriptingContext context)
 {
 }
Beispiel #9
0
 protected abstract void Clear(ScriptingContext context);
Beispiel #10
0
 protected abstract void Execute(ScriptingContext context, double level);
 protected override void Execute(ScriptingContext context, double level)
 {
     var loadTimeFactor = BasicSkillScript.GetDecrementalSkillFactor(level);
     context.SetValue(this.Domain, LoadTimeFactorSkillKey, loadTimeFactor);
 }
Beispiel #12
0
 protected override void Clear(ScriptingContext context)
 {
     context.SetValue(this.Domain, CamouflageFactorSkillKey, 1.0);
 }
Beispiel #13
0
 protected override void Execute(ScriptingContext context, double level)
 {
     context.SetValue(this.Domain, CamouflageFactorSkillKey, 1.0 + 0.0075 * level);
 }
        protected override void Execute(ScriptingContext context, double level)
        {
            var terrainResistanceFactor = BasicSkillScript.GetDecrementalSkillFactor(level);

            context.SetValue(this.Domain, TerrainResistanceFactorSkillKey, terrainResistanceFactor);
        }
 public override void Execute(ScriptingContext context)
 {
     base.Execute(context);
     context.SetValue(this.Accessory["script/@name"], "invisibilityIncrementFactor", 1);
 }
Beispiel #16
0
        protected override void Execute(ScriptingContext context, double level)
        {
            var signalRangeFactor = BasicSkillScript.GetIncrementalSkillFactor(level);

            context.SetValue(this.Domain, SignalRangeFactorSkillKey, signalRangeFactor);
        }