예제 #1
0
        public UOCharacter IVMAutoB(int maxdistance, int hits)
        {
            UOCharacter             result   = null;
            List <CharHealPriority> chhpList = GetCharHealPriorityList(maxdistance, false, Game.MergeLists <UOCharacter>(Game.CurrentGame.Alies, Game.CurrentGame.HealAlies));
            var sortedList = chhpList.Where(c => !skip.Contains(c.Char.Serial)).ToList();

            if (sortedList.Count == 0)
            {
                skip.Clear();
                sortedList = chhpList;
            }

            if (sortedList.Count > 0)
            {
                foreach (CharHealPriority c in sortedList)
                {
                    UOCharacter ch = result = c.Char;
                    //if (ch.Serial != World.Player.Serial)
                    //  LastCharacter = ch;

                    if (String.IsNullOrEmpty(ch.Name))
                    {
                        ch.Click();
                        Game.Wait(150);
                    }

                    CastResultInfo info          = new CastResultInfo();
                    string         spellShortCut = "";

                    double dhits    = (double)hits;
                    double dmg      = ch.MaxHits - ch.Hits;
                    double dmgRel   = dmg / dhits;
                    double mHitsRel = (double)ch.MaxHits / dhits;

                    double dmgHitsRel = mHitsRel - dmgRel;

                    UOItem scrools = World.Player.Backpack.AllItems.FindType(Magery.SpellScrool[StandardSpell.GreaterHeal]);

                    if (dmgRel > 0.75 && dmgHitsRel <= 2.25 && scrools.Exist)
                    {
                        spellShortCut = "IVM";

                        info = Bishop.CastBishopGreaterHeal(true, ch.Serial, true);
                        if (info.Spell == StandardSpell.Heal)
                        {
                            spellShortCut = "IM";
                        }
                    }
                    else if (dmg > 30)
                    {
                        spellShortCut = "IVM";
                        info          = Magery.Current.CastSpell(StandardSpell.GreaterHeal, ch, true, false, true);
                    }
                    else
                    {
                        spellShortCut = "IM";
                        info          = Magery.Current.CastSpell(StandardSpell.Heal, ch, true, false, true);
                    }

                    if (info.NoInLineOfSight)
                    {
                        skip.Add(ch.Serial);
                    }
                    else
                    {
                        ushort color = CalStatusMessage.Val_InfoColor;
                        if (info.Usage == CastUsage.Scrool)
                        {
                            color = Game.Val_Green;
                        }

                        ch.PrintMessage("[" + spellShortCut + "...]", Game.GetAlieColorByHits(ch.Serial));

                        bool reset = sortedList.Count == 1;

                        if (!reset)
                        {
                            int skipCount = 0;
                            foreach (CharHealPriority chp in sortedList)
                            {
                                if (skip.Contains(chp.Char.Serial))
                                {
                                    skipCount++;
                                }
                            }

                            reset = skipCount == sortedList.Count;
                        }

                        if (reset)
                        {
                            skip = new List <Serial>();
                        }
                    }

                    break;
                }
            }
            else
            {
                Game.PrintMessage("IVMA: " + Game.MergeLists <UOCharacter>(Game.CurrentGame.Alies, Game.CurrentGame.HealAlies).Count + " OK");
            }

            return(result);
        }