示例#1
0
        public static bool CanDoCombatHealSelf(BaseCreature creature)
        {
            if (creature.IsBarded())
            {
                return(false);
            }

            if (creature.DictCombatAction[CombatAction.CombatHealSelf] > 0)
            {
                if (DateTime.UtcNow > creature.NextCombatHealActionAllowed)
                {
                    Dictionary <CombatHealSelf, int> DictTemp = new Dictionary <CombatHealSelf, int>();

                    if (AICombatHealSelf.CanDoCombatHealSelfSpellHealSelf(creature, 100))
                    {
                        DictTemp.Add(CombatHealSelf.SpellHealSelf100, creature.DictCombatHealSelf[CombatHealSelf.SpellHealSelf100]);
                    }
                    if (AICombatHealSelf.CanDoCombatHealSelfSpellHealSelf(creature, 75))
                    {
                        DictTemp.Add(CombatHealSelf.SpellHealSelf75, creature.DictCombatHealSelf[CombatHealSelf.SpellHealSelf75]);
                    }
                    if (AICombatHealSelf.CanDoCombatHealSelfSpellHealSelf(creature, 50))
                    {
                        DictTemp.Add(CombatHealSelf.SpellHealSelf50, creature.DictCombatHealSelf[CombatHealSelf.SpellHealSelf50]);
                    }
                    if (AICombatHealSelf.CanDoCombatHealSelfSpellHealSelf(creature, 25))
                    {
                        DictTemp.Add(CombatHealSelf.SpellHealSelf25, creature.DictCombatHealSelf[CombatHealSelf.SpellHealSelf25]);
                    }
                    if (AICombatHealSelf.CanDoCombatHealSelfSpellCureSelf(creature))
                    {
                        DictTemp.Add(CombatHealSelf.SpellCureSelf, creature.DictCombatHealSelf[CombatHealSelf.SpellCureSelf]);
                    }
                    if (AICombatHealSelf.CanDoCombatHealSelfPotionHealSelf(creature, 100))
                    {
                        DictTemp.Add(CombatHealSelf.PotionHealSelf100, creature.DictCombatHealSelf[CombatHealSelf.PotionHealSelf100]);
                    }
                    if (AICombatHealSelf.CanDoCombatHealSelfPotionHealSelf(creature, 75))
                    {
                        DictTemp.Add(CombatHealSelf.PotionHealSelf75, creature.DictCombatHealSelf[CombatHealSelf.PotionHealSelf75]);
                    }
                    if (AICombatHealSelf.CanDoCombatHealSelfPotionHealSelf(creature, 50))
                    {
                        DictTemp.Add(CombatHealSelf.PotionHealSelf50, creature.DictCombatHealSelf[CombatHealSelf.PotionHealSelf50]);
                    }
                    if (AICombatHealSelf.CanDoCombatHealSelfPotionHealSelf(creature, 25))
                    {
                        DictTemp.Add(CombatHealSelf.PotionHealSelf25, creature.DictCombatHealSelf[CombatHealSelf.PotionHealSelf25]);
                    }
                    if (AICombatHealSelf.CanDoCombatHealSelfPotionCureSelf(creature))
                    {
                        DictTemp.Add(CombatHealSelf.PotionCureSelf, creature.DictCombatHealSelf[CombatHealSelf.PotionCureSelf]);
                    }
                    if (AICombatHealSelf.CanDoCombatHealSelfBandageHealSelf(creature, 100))
                    {
                        DictTemp.Add(CombatHealSelf.BandageHealSelf100, creature.DictCombatHealSelf[CombatHealSelf.BandageHealSelf100]);
                    }
                    if (AICombatHealSelf.CanDoCombatHealSelfBandageHealSelf(creature, 75))
                    {
                        DictTemp.Add(CombatHealSelf.BandageHealSelf75, creature.DictCombatHealSelf[CombatHealSelf.BandageHealSelf75]);
                    }
                    if (AICombatHealSelf.CanDoCombatHealSelfBandageHealSelf(creature, 50))
                    {
                        DictTemp.Add(CombatHealSelf.BandageHealSelf50, creature.DictCombatHealSelf[CombatHealSelf.BandageHealSelf50]);
                    }
                    if (AICombatHealSelf.CanDoCombatHealSelfBandageHealSelf(creature, 25))
                    {
                        DictTemp.Add(CombatHealSelf.BandageHealSelf25, creature.DictCombatHealSelf[CombatHealSelf.BandageHealSelf25]);
                    }
                    if (AICombatHealSelf.CanDoCombatHealSelfBandageCureSelf(creature))
                    {
                        DictTemp.Add(CombatHealSelf.BandageCureSelf, creature.DictCombatHealSelf[CombatHealSelf.BandageCureSelf]);
                    }

                    int TotalValues = 0;

                    //Calculate Total Values
                    foreach (KeyValuePair <CombatHealSelf, int> pair in DictTemp)
                    {
                        TotalValues += pair.Value;
                    }

                    if (TotalValues > 0)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
示例#2
0
        public static bool DoCombatHealSelf(BaseCreature creature)
        {
            CombatHealSelf healAction = CombatHealSelf.None;

            int TotalValues = 0;

            Dictionary <CombatHealSelf, int> DictTemp = new Dictionary <CombatHealSelf, int>();

            if (AICombatHealSelf.CanDoCombatHealSelfSpellHealSelf(creature, 100))
            {
                DictTemp.Add(CombatHealSelf.SpellHealSelf100, creature.DictCombatHealSelf[CombatHealSelf.SpellHealSelf100]);
            }
            if (AICombatHealSelf.CanDoCombatHealSelfSpellHealSelf(creature, 75))
            {
                DictTemp.Add(CombatHealSelf.SpellHealSelf75, creature.DictCombatHealSelf[CombatHealSelf.SpellHealSelf75]);
            }
            if (AICombatHealSelf.CanDoCombatHealSelfSpellHealSelf(creature, 50))
            {
                DictTemp.Add(CombatHealSelf.SpellHealSelf50, creature.DictCombatHealSelf[CombatHealSelf.SpellHealSelf50]);
            }
            if (AICombatHealSelf.CanDoCombatHealSelfSpellHealSelf(creature, 25))
            {
                DictTemp.Add(CombatHealSelf.SpellHealSelf25, creature.DictCombatHealSelf[CombatHealSelf.SpellHealSelf25]);
            }
            if (AICombatHealSelf.CanDoCombatHealSelfSpellCureSelf(creature))
            {
                DictTemp.Add(CombatHealSelf.SpellCureSelf, creature.DictCombatHealSelf[CombatHealSelf.SpellCureSelf]);
            }
            if (AICombatHealSelf.CanDoCombatHealSelfPotionHealSelf(creature, 100))
            {
                DictTemp.Add(CombatHealSelf.PotionHealSelf100, creature.DictCombatHealSelf[CombatHealSelf.PotionHealSelf100]);
            }
            if (AICombatHealSelf.CanDoCombatHealSelfPotionHealSelf(creature, 75))
            {
                DictTemp.Add(CombatHealSelf.PotionHealSelf75, creature.DictCombatHealSelf[CombatHealSelf.PotionHealSelf75]);
            }
            if (AICombatHealSelf.CanDoCombatHealSelfPotionHealSelf(creature, 50))
            {
                DictTemp.Add(CombatHealSelf.PotionHealSelf50, creature.DictCombatHealSelf[CombatHealSelf.PotionHealSelf50]);
            }
            if (AICombatHealSelf.CanDoCombatHealSelfPotionHealSelf(creature, 25))
            {
                DictTemp.Add(CombatHealSelf.PotionHealSelf25, creature.DictCombatHealSelf[CombatHealSelf.PotionHealSelf25]);
            }
            if (AICombatHealSelf.CanDoCombatHealSelfPotionCureSelf(creature))
            {
                DictTemp.Add(CombatHealSelf.PotionCureSelf, creature.DictCombatHealSelf[CombatHealSelf.PotionCureSelf]);
            }
            if (AICombatHealSelf.CanDoCombatHealSelfBandageHealSelf(creature, 100))
            {
                DictTemp.Add(CombatHealSelf.BandageHealSelf100, creature.DictCombatHealSelf[CombatHealSelf.BandageHealSelf100]);
            }
            if (AICombatHealSelf.CanDoCombatHealSelfBandageHealSelf(creature, 75))
            {
                DictTemp.Add(CombatHealSelf.BandageHealSelf75, creature.DictCombatHealSelf[CombatHealSelf.BandageHealSelf75]);
            }
            if (AICombatHealSelf.CanDoCombatHealSelfBandageHealSelf(creature, 50))
            {
                DictTemp.Add(CombatHealSelf.BandageHealSelf50, creature.DictCombatHealSelf[CombatHealSelf.BandageHealSelf50]);
            }
            if (AICombatHealSelf.CanDoCombatHealSelfBandageHealSelf(creature, 25))
            {
                DictTemp.Add(CombatHealSelf.BandageHealSelf25, creature.DictCombatHealSelf[CombatHealSelf.BandageHealSelf25]);
            }
            if (AICombatHealSelf.CanDoCombatHealSelfBandageCureSelf(creature))
            {
                DictTemp.Add(CombatHealSelf.BandageCureSelf, creature.DictCombatHealSelf[CombatHealSelf.BandageCureSelf]);
            }

            //Calculate Total Values
            foreach (KeyValuePair <CombatHealSelf, int> pair in DictTemp)
            {
                TotalValues += pair.Value;
            }

            double ActionCheck      = Utility.RandomDouble();
            double CumulativeAmount = 0.0;
            double AdditionalAmount = 0.0;

            //Determine CombatAction
            foreach (KeyValuePair <CombatHealSelf, int> pair in DictTemp)
            {
                AdditionalAmount = (double)pair.Value / (double)TotalValues;

                if (ActionCheck >= CumulativeAmount && ActionCheck < (CumulativeAmount + AdditionalAmount))
                {
                    healAction = pair.Key;

                    //Spell
                    if (healAction == CombatHealSelf.SpellHealSelf100 || healAction == CombatHealSelf.SpellHealSelf75 || healAction == CombatHealSelf.SpellHealSelf50 || healAction == CombatHealSelf.SpellHealSelf25)
                    {
                        AIHeal.DoSpellHeal(creature, creature);
                    }

                    if (healAction == CombatHealSelf.SpellCureSelf)
                    {
                        AIHeal.DoSpellCure(creature, creature);
                    }

                    //Potion
                    if (healAction == CombatHealSelf.PotionHealSelf100 || healAction == CombatHealSelf.PotionHealSelf75 || healAction == CombatHealSelf.PotionHealSelf50 || healAction == CombatHealSelf.PotionHealSelf25)
                    {
                        AIHeal.DoPotionHeal(creature);
                    }

                    if (healAction == CombatHealSelf.PotionCureSelf)
                    {
                        AIHeal.DoPotionCure(creature);
                    }

                    //Bandage
                    if (healAction == CombatHealSelf.BandageHealSelf100 || healAction == CombatHealSelf.BandageHealSelf75 || healAction == CombatHealSelf.BandageHealSelf50 || healAction == CombatHealSelf.BandageHealSelf25)
                    {
                        AIHeal.DoBandageHeal(creature, creature);
                    }

                    if (healAction == CombatHealSelf.BandageCureSelf)
                    {
                        AIHeal.DoBandageHeal(creature, creature);
                    }

                    creature.NextCombatHealActionAllowed = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(creature.CombatHealActionMinDelay, creature.CombatHealActionMaxDelay));

                    if (creature.AcquireNewTargetEveryCombatAction)
                    {
                        creature.m_NextAcquireTargetAllowed = DateTime.UtcNow;
                    }

                    return(true);
                }

                CumulativeAmount += AdditionalAmount;
            }

            return(false);
        }