예제 #1
0
        private void ApplyToolEffectsPerTarget(Tool selectedTool, ApplyExtra extraFunc = null)
        {
            int    consecutiveActs = selectedTool.ConsecutiveActs;
            double decliningTimes  = (selectedTool.Scope != 1 ? selectedTool.RandomActs : 0) + 1.0;

            if (SelectedWeapon != null)
            {
                consecutiveActs *= SelectedWeapon.ConsecutiveActs;
                decliningTimes  *= (SelectedWeapon.Scope != 1 ? SelectedWeapon.RandomActs : 0) + 1.0;
            }
            for (int times = 1; times <= decliningTimes; times++)
            {
                if (!Chance(100 / times))
                {
                    continue;
                }
                double eMag  = 1.0 / times;
                double eMag0 = eMag / (selectedTool.Scope != 2 ? 1.0 : 2.0);
                for (int i = 0; i < consecutiveActs; i++)
                {
                    List <List <int> > resultForOneAct = new List <List <int> >();
                    int j = 0;
                    resultForOneAct.Add(ApplyToolEffects(SelectedTargets[j++], selectedTool, eMag, extraFunc));
                    while (j < SelectedTargets.Count)
                    {
                        resultForOneAct.Add(ApplyToolEffects(SelectedTargets[j++], selectedTool, eMag0, extraFunc));
                    }
                    TargetResults.Add(resultForOneAct);
                }
            }
        }
예제 #2
0
 public void ClearTurnChoices()
 {
     ComboPartners.Clear();
     SelectedSkill  = null;
     SelectedItem   = null;
     SelectedWeapon = null;
     SelectedTargets.Clear();
     MovingLocation   = -1;
     CriticalHitRatio = 1;
     TargetResults.Clear();
     EffectResults.Clear();
 }
예제 #3
0
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        /// -- Tool Actions --
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public Tool ExecuteTool()
        {
            TargetResults.Clear();
            if (SelectedSkill != null)
            {
                return(ExecuteSkill());
            }
            else if (SelectedItem != null)
            {
                return(ExecuteItem());
            }
            return(null);
        }
예제 #4
0
        public override void Execute()
        {
            var service = new EBusinessService(DB);

            try {
                var nFilter = TargetResults.LegalStatus.DontCare;

                switch (this.request.Filter.ToUpper())
                {
                case "L":
                    nFilter = TargetResults.LegalStatus.Limited;
                    break;

                case "N":
                    nFilter = TargetResults.LegalStatus.NonLimited;
                    break;
                }                 // switch

                TargetResults result = service.TargetBusiness(
                    this.request.CompanyName,
                    this.request.Postcode,
                    this.request.CustomerID,
                    nFilter, this.request.RefNum
                    );

                Response = result.Targets;
            } catch (WebException we) {
                Log.Debug(we, "WebException caught while executing company targeting.");

                Response = new List <CompanyInfo> {
                    new CompanyInfo {
                        BusName = "", BusRefNum = "exception"
                    }
                };
            } catch (Exception e) {
                if (this.request.CompanyName.ToLower() == "asd" && this.request.Postcode.ToLower() == "ab10 1ba")
                {
                    Response = GenerateFakeTargetingData(this.request.CompanyName, this.request.Postcode);
                }

                Log.Alert(e, "Target Business failed.");
            }     // try
        }         // Execute
예제 #5
0
 public override string ToString()
 {
     string[] targetResults = TargetResults.Select(r => r.Success ? $"{r.Target.TargetName} successful" : $"{r.Target.TargetName} failed").ToArray();
     return($"{Song?.Key}, Download Status: {DownloadResult?.Status}, Target Results: {(string.Join(" | ", targetResults))}");
 }