Exemple #1
0
        public void DrawLokaiSkill()
        {
            for (int i = 0; i < m_BuildItem.LokaiSkills.Count; i++)
            {
                BuildLokaiSkill lokaiSkill = m_BuildItem.LokaiSkills.GetAt(i);
                double          minLokaiSkill = lokaiSkill.MinLokaiSkill, maxLokaiSkill = lokaiSkill.MaxLokaiSkill;

                if (minLokaiSkill < 0)
                {
                    minLokaiSkill = 0;
                }

                AddHtmlLocalized(170, 132 + (i * 20), 200, 18, 1070722, lokaiSkill.LokaiSkillToMake.ToString(), LabelColor, false, false);
                AddLabel(430, 132 + (i * 20), LabelHue, String.Format("{0:F1}", minLokaiSkill));
            }

            BuildSubResCol res      = (m_BuildItem.UseSubRes2 ? m_BuildSystem.BuildSubRes2 : m_BuildSystem.BuildSubRes);
            int            resIndex = -1;

            BuildContext context = m_BuildSystem.GetContext(m_From);

            if (context != null)
            {
                resIndex = (m_BuildItem.UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex);
            }

            bool   allRequiredLokaiSkills = true;
            double chance      = m_BuildItem.GetSuccessChance(m_From, resIndex > -1 ? res.GetAt(resIndex).ItemType : null, m_BuildSystem, false, ref allRequiredLokaiSkills);
            double excepChance = m_BuildItem.GetExceptionalChance(m_BuildSystem, chance, m_From);

            if (chance < 0.0)
            {
                chance = 0.0;
            }
            else if (chance > 1.0)
            {
                chance = 1.0;
            }

            AddHtmlLocalized(170, 80, 250, 18, 1044057, LabelColor, false, false);               // Success Chance:
            AddLabel(430, 80, LabelHue, String.Format("{0:F1}%", chance * 100));

            if (m_ShowExceptionalChance)
            {
                if (excepChance < 0.0)
                {
                    excepChance = 0.0;
                }
                else if (excepChance > 1.0)
                {
                    excepChance = 1.0;
                }

                AddHtmlLocalized(170, 100, 250, 18, 1044058, 32767, false, false);                   // Exceptional Chance:
                AddLabel(430, 100, LabelHue, String.Format("{0:F1}%", excepChance * 100));
            }
        }
        public double GetSuccessChance(Mobile from, Type typeRes, BuildSystem buildSystem, bool gainLokaiSkills, ref bool allRequiredLokaiSkills)
        {
            double minMainLokaiSkill = 0.0;
            double maxMainLokaiSkill = 0.0;
            double valMainLokaiSkill = 0.0;

            allRequiredLokaiSkills = true;

            LokaiSkills skills = LokaiSkillUtilities.XMLGetSkills(from);

            for (int i = 0; i < m_arBuildLokaiSkill.Count; i++)
            {
                BuildLokaiSkill buildLokaiSkill = m_arBuildLokaiSkill.GetAt(i);

                double minLokaiSkill = buildLokaiSkill.MinLokaiSkill;
                double maxLokaiSkill = buildLokaiSkill.MaxLokaiSkill;
                double valLokaiSkill = skills[buildLokaiSkill.LokaiSkillToMake].Value;

                if (valLokaiSkill < minLokaiSkill)
                {
                    allRequiredLokaiSkills = false;
                }

                if (buildLokaiSkill.LokaiSkillToMake == buildSystem.MainLokaiSkill)
                {
                    minMainLokaiSkill = minLokaiSkill;
                    maxMainLokaiSkill = maxLokaiSkill;
                    valMainLokaiSkill = valLokaiSkill;
                }

                if (gainLokaiSkills)                   // This is a passive check. Success chance is entirely dependant on the main lokaiSkill
                {
                    LokaiSkillUtilities.CheckLokaiSkill(from, skills[buildLokaiSkill.LokaiSkillToMake], minLokaiSkill, maxLokaiSkill);
                }
            }

            double chance;

            if (allRequiredLokaiSkills)
            {
                chance = buildSystem.GetChanceAtMin(this) + ((valMainLokaiSkill - minMainLokaiSkill) / (maxMainLokaiSkill - minMainLokaiSkill) * (1.0 - buildSystem.GetChanceAtMin(this)));
            }
            else
            {
                chance = 0.0;
            }

            if (allRequiredLokaiSkills && valMainLokaiSkill == maxMainLokaiSkill)
            {
                chance = 1.0;
            }

            return(chance);
        }
        public void AddLokaiSkill(LokaiSkillName lokaiSkillToMake, double minLokaiSkill, double maxLokaiSkill)
        {
            BuildLokaiSkill buildLokaiSkill = new BuildLokaiSkill(lokaiSkillToMake, minLokaiSkill, maxLokaiSkill);

            m_arBuildLokaiSkill.Add(buildLokaiSkill);
        }
Exemple #4
0
 public void Add(BuildLokaiSkill buildLokaiSkill)
 {
     List.Add(buildLokaiSkill);
 }