コード例 #1
0
ファイル: TrialOfTheChampion.cs プロジェクト: KKovs/SpellFire
            private List <BTNode> ConfessorPaletressBehaviour()
            {
                var nodes = new List <BTNode>();

                GameObject memoryMonster = null;

                var shaman = mbox.clients.FirstOrDefault(client =>
                                                         client.Player.UnitClass == UnitClass.Shaman);
                var pala = mbox.clients.FirstOrDefault(client =>
                                                       client.Player.UnitClass == UnitClass.Paladin);
                var priest = mbox.clients.FirstOrDefault(client =>
                                                         client.Player.UnitClass == UnitClass.Priest);

                var common = new LeafAction((() =>
                {
                    if (paletress == null)
                    {
                        paletress = mbox.me.ObjectManager.FirstOrDefault(obj =>
                                                                         obj.Type == GameObjectType.Unit && totch.GetName(mbox.me.ControlInterface, obj) == PaletressName);

                        if (paletress != null)
                        {
                            paletressGUID = paletress.GUID;
                        }
                    }

                    // ensure tremor totem
                    if (!mbox.me.ObjectManager.Any(obj => obj.EntryID == TremorTotem))
                    {
                        if (shaman != null && shaman.Player.HealthPct > 0)
                        {
                            shaman.EnqueuePrioritySpellCast(
                                new SpellCast
                            {
                                Coordinates = null,
                                SpellName = "Tremor Totem",
                                TargetGUID = 0
                            }
                                );
                            Thread.Sleep(1000);
                        }
                    }

                    // cleanse Paletress's debuffs
                    int lowPlayerCount = 0;
                    foreach (var player in mbox.clients.Select(cli => cli.Player).Where(pla => pla.HealthPct > 0))
                    {
                        if (player.HealthPct < 50)
                        {
                            lowPlayerCount++;
                        }

                        foreach (var aura in player.Auras)
                        {
                            if (PaletressDebuffIds.Contains(aura.auraID))
                            {
                                if (pala != null && pala.Player.HealthPct > 0)
                                {
                                    pala.EnqueuePrioritySpellCast(
                                        new SpellCast
                                    {
                                        Coordinates = null,
                                        SpellName = "Cleanse",
                                        TargetGUID = player.GUID
                                    }
                                        );
                                    break;
                                }
                            }
                        }
                    }

                    if (lowPlayerCount >= 2)
                    {
                        if (pala != null && pala.Player.HealthPct > 0)
                        {
                            if (!pala.IsOnCooldown("Divine Sacrifice"))
                            {
                                pala.EnqueuePrioritySpellCast(
                                    new SpellCast
                                {
                                    Coordinates = null,
                                    SpellName = "Divine Sacrifice",
                                    TargetGUID = 0
                                }
                                    );
                            }
                        }
                    }

                    return(BTStatus.Success);
                }));

                // Paletress disappeared - end condition
                var paletressGone =
                    new Decorator(
                        (() => { return(!mbox.me.ObjectManager.Any(obj => obj.GUID == paletressGUID)); }),
                        new LeafAction((() =>
                {
                    return(BTStatus.Success);
                })));

                var argentAdds =
                    new Decorator(
                        (() => { return(!totch.IsAttackableByTank(paletress)); }),
                        new LeafAction((() =>
                {
                    foreach (var argentAdd in ArgentAdds)
                    {
                        foreach (var unit in mbox.me.ObjectManager.Where(obj => obj.Type == GameObjectType.Unit && obj.IsInCombat()))
                        {
                            if (argentAdd == unit.EntryID)
                            {
                                mbox.GroupTargetGuids[0] = unit.GUID;
                                goto end;
                            }
                        }
                    }


                    end:
                    return(BTStatus.Failed);
                })));

                var memoryAsTarget = new Decorator((() =>
                {
                    return(paletress.Auras.Select(aura => aura.auraID).Contains(PaletressReflectiveShield));
                }), new LeafAction((() =>
                {
                    if (memoryMonster != null)
                    {
                        mbox.GroupTargetGuids[0] = memoryMonster.GUID;
                        mbox.me.ControlInterface.remoteControl.SelectUnit(memoryMonster.GUID);
                        mbox.me.CastSpellOnGuid(GenericGroupManager.GetTauntAbilityForTankClass(mbox.me.Player.UnitClass), memoryMonster.GUID);

                        foreach (var aura in memoryMonster.Auras)
                        {
                            if (PaletressRenewIds.Contains(aura.auraID))
                            {
                                if (priest != null && priest.Player.HealthPct > 0)
                                {
                                    priest.EnqueuePrioritySpellCast(
                                        new SpellCast
                                    {
                                        Coordinates = null,
                                        SpellName = "Dispel Magic",
                                        TargetGUID = memoryMonster.GUID
                                    }
                                        );
                                    break;
                                }
                            }
                        }

                        if (priest != null && priest.Player.HealthPct > 0)
                        {
                            if (!priest.IsOnCooldown("Power Infusion"))
                            {
                                priest.EnqueuePrioritySpellCast(
                                    new SpellCast
                                {
                                    Coordinates = null,
                                    SpellName = "Power Infusion",
                                    TargetGUID = priest.Player.GUID
                                }
                                    );
                            }
                        }

                        if (shaman != null && shaman.Player.HealthPct > 0)
                        {
                            if (!shaman.IsOnCooldown("Bloodlust"))
                            {
                                shaman.EnqueuePrioritySpellCast(
                                    new SpellCast
                                {
                                    Coordinates = null,
                                    SpellName = "Bloodlust",
                                    TargetGUID = 0
                                }
                                    );
                            }
                        }
                    }
                    else
                    {
                        mbox.GroupTargetGuids[0] = 0;
                        memoryMonster = mbox.me.ObjectManager.FirstOrDefault(obj =>
                                                                             obj.Type == GameObjectType.Unit && totch.GetName(mbox.me.ControlInterface, obj).Contains("Memory"));
                    }

                    return(BTStatus.Failed);
                })));


                var paletressAsTarget = new Decorator((() =>
                {
                    return(totch.IsAttackableByTank(paletress) && !paletress.Auras.Select(aura => aura.auraID).Contains(PaletressReflectiveShield));
                }), new LeafAction((() =>
                {
                    mbox.GroupTargetGuids[0] = paletress.GUID;
                    mbox.me.ControlInterface.remoteControl.SelectUnit(paletress.GUID);
                    mbox.me.CastSpellOnGuid(GenericGroupManager.GetTauntAbilityForTankClass(mbox.me.Player.UnitClass), paletress.GUID);

                    foreach (var aura in paletress.Auras)
                    {
                        if (PaletressRenewIds.Contains(aura.auraID))
                        {
                            var priest = mbox.clients.FirstOrDefault(client =>
                                                                     client.Player.UnitClass == UnitClass.Priest);
                            if (priest != null && priest.Player.HealthPct > 0)
                            {
                                priest.EnqueuePrioritySpellCast(
                                    new SpellCast
                                {
                                    Coordinates = null,
                                    SpellName = "Dispel Magic",
                                    TargetGUID = paletress.GUID
                                }
                                    );
                                break;
                            }
                        }
                    }

                    return(BTStatus.Failed);
                })));


                var select = new Selector(paletressGone, argentAdds, memoryAsTarget, paletressAsTarget);

                nodes.Add(common);
                nodes.Add(select);


                return(nodes);
            }
コード例 #2
0
ファイル: TrialOfTheChampion.cs プロジェクト: KKovs/SpellFire
            private List <GameObject> SelectThreateningUnitsForMountedCombat(ControlInterface ci, GameObjectManager gameObjMgr)
            {
                var threateners = new List <GameObject>();

                foreach (var gameObj in gameObjMgr)
                {
                    if (gameObj.Type == GameObjectType.Unit && gameObj.IsInCombat() && totch.IsAttackableByTank(gameObj) && gameObj.Health > 0)
                    {
                        var targetedPlayerGuid = squadData.Select(entry => entry.Value.warhorseGuid).FirstOrDefault(g => g == gameObj.TargetGUID);
                        if (targetedPlayerGuid != 0 && !totch.GetName(ci, gameObj).Contains("Mount"))
                        {
                            threateners.Add(gameObj);
                        }
                    }
                }

                return(threateners);
            }