Beispiel #1
0
        object CanBeTargeted(BaseCombatEntity target, MonoBehaviour turret)
        {
            if (target == null || turret == null)
            {
                return(null);
            }

            // Don't interfere with the helicopter.
            if (turret is HelicopterTurret)
            {
                return(null);
            }

            var player = target as BasePlayer;

            if (player == null)
            {
                return(null);
            }

            User defender = Users.Get(player);
            var  entity   = turret as BaseCombatEntity;

            if (defender == null || entity == null)
            {
                return(null);
            }

            return(Pvp.HandleTurretTarget(entity, defender));
        }
Beispiel #2
0
        public static async Task <bool> Combat()
        {
            await CombatBuff();

            if (Globals.InParty)
            {
                if (!AstrologianSettings.Instance.DoDamage)
                {
                    return(true);
                }

                if (Core.Me.CurrentManaPercent < AstrologianSettings.Instance.MinimumManaPercentToDoDamage && Core.Target.CombatTimeLeft() > AstrologianSettings.Instance.DoDamageIfTimeLeftLessThan)
                {
                    return(true);
                }
            }

            if (!GameSettingsManager.FaceTargetOnAction && !Core.Me.CurrentTarget.InView())
            {
                return(false);
            }

            if (BotManager.Current.IsAutonomous)
            {
                if (Core.Me.HasTarget)
                {
                    Movement.NavigateToUnitLos(Core.Me.CurrentTarget, 20);
                }
            }

            if (!Core.Me.HasTarget || !Core.Me.CurrentTarget.ThoroughCanAttack())
            {
                return(false);
            }

            if (Globals.OnPvpMap)
            {
                if (await Pvp.Disable())
                {
                    return(true);            //Damage
                }
                return(await Pvp.Malefic()); //Damage
            }

            if (await Aoe.Gravity())
            {
                return(true);
            }
            if (await SingleTarget.Combust())
            {
                return(true);
            }
            if (await SingleTarget.CombustMultipleTargets())
            {
                return(true);
            }
            return(await SingleTarget.Malefic());
        }
Beispiel #3
0
        object OnEntityTakeDamage(BaseCombatEntity entity, HitInfo hit)
        {
            if (entity == null || hit == null)
            {
                return(null);
            }

            object externalResult = Interface.CallHook("CanEntityTakeDamage", new object[] { entity, hit });

            if (externalResult != null)
            {
                if ((bool)externalResult == false)
                {
                    return(false);
                }

                return(null);
            }

            if (hit.damageTypes.Has(Rust.DamageType.Decay))
            {
                return(Decay.AlterDecayDamage(entity, hit));
            }

            User attacker = null;
            User defender = entity.GetComponent <User>();

            if (hit.InitiatorPlayer != null)
            {
                attacker = hit.InitiatorPlayer.GetComponent <User>();
            }

            // A player is being injured by something other than a player/NPC.
            if (attacker == null && defender != null)
            {
                return(Pvp.HandleIncidentalDamage(defender, hit));
            }

            // One player is damaging another player.
            if (attacker != null && defender != null)
            {
                return(Pvp.HandleDamageBetweenPlayers(attacker, defender, hit));
            }

            // A player is damaging a structure.
            if (attacker != null && defender == null)
            {
                return(Raiding.HandleDamageAgainstStructure(attacker, entity, hit));
            }

            // A structure is taking damage from something that isn't a player.
            return(Raiding.HandleIncidentalDamage(entity, hit));
        }
        public static async Task <bool> PvP()
        {
            if (Globals.OnPvpMap)
            {
                if (await Pvp.EssentialDignity())
                {
                    return(true);                              //Heal
                }
                if (await Pvp.Purify())
                {
                    return(true);                    //Dispel/Heal
                }
                if (await Pvp.Muse())
                {
                    return(true);                  //Self-Buff
                }
                if (await Pvp.Lightspeed())
                {
                    return(true);                        //CombatBuff
                }
                if (await Pvp.Synastry())
                {
                    return(true);                      //Heal
                }
                if (await Pvp.Deorbit())
                {
                    return(true);                     //Heal
                }
                if (await Pvp.EmpyreanRain())
                {
                    return(true);                          //Heal
                }
                if (await Pvp.Recuperate())
                {
                    return(true);                        //Self-Heal
                }
                if (await Pvp.Benefic2())
                {
                    return(true);                      //Heal
                }
                if (await Pvp.Benefic())
                {
                    return(true);                     //Heal
                }
                if (await Pvp.Concentrate())
                {
                    return(true);                         //CombatBuff/Heal
                }
                return(await Pvp.Safeguard());
            }

            return(false);
        }
Beispiel #5
0
        object OnTrapTrigger(BaseTrap trap, GameObject obj)
        {
            var player = obj.GetComponent <BasePlayer>();

            if (trap == null || player == null)
            {
                return(null);
            }

            User defender = Users.Get(player);

            return(Pvp.HandleTrapTrigger(trap, defender));
        }
Beispiel #6
0
 public static async Task <bool> PvpRotation()
 {
     if (await Pvp.Benediction())
     {
         return(true);
     }
     if (await Pvp.FluidAura())
     {
         return(true);
     }
     if (await Pvp.Safeguard())
     {
         return(true);
     }
     if (await Pvp.Muse())
     {
         return(true);
     }
     if (await Pvp.DivineBenison())
     {
         return(true);
     }
     if (await Pvp.Assize())
     {
         return(true);
     }
     if (await Pvp.Cure2())
     {
         return(true);
     }
     if (await Pvp.Cure())
     {
         return(true);
     }
     if (await Pvp.Regen())
     {
         return(true);
     }
     return(await Pvp.Stone3());
 }
Beispiel #7
0
        public static async Task <bool> Execute()
        {
            if (await Chocobo.HandleChocobo())
            {
                return(true);
            }

            Group.UpdateAllies(Utilities.Routines.Astrologian.GroupExtension);
            Globals.HealTarget = Group.CastableAlliesWithin30.OrderBy(x => x.CurrentHealthPercent).FirstOrDefault();

            if (await Casting.TrackSpellCast())
            {
                return(true);
            }
            await Casting.CheckForSuccessfulCast();

            Casting.DoHealthChecks = false;

            Globals.InParty       = PartyManager.IsInParty || Globals.InGcInstance;
            Globals.PartyInCombat = Globals.InParty && Utilities.Combat.Enemies.Any(r => r.TaggerType == 2) || Core.Me.InCombat;
            Globals.OnPvpMap      = Core.Me.OnPvpMap();

            if (Duty.State() == Duty.States.Ended)
            {
                return(false);
            }

            if (await GambitLogic.Gambit())
            {
                return(true);
            }

            if (Globals.OnPvpMap)
            {
                if (await Pvp.EssentialDignity())
                {
                    return(true);                              //Heal
                }
                if (await Pvp.Purify())
                {
                    return(true);                    //Dispel/Heal
                }
                if (await Pvp.Muse())
                {
                    return(true);                  //Self-Buff
                }
                if (await Pvp.Lightspeed())
                {
                    return(true);                        //CombatBuff
                }
                if (await Pvp.Synastry())
                {
                    return(true);                      //Heal
                }
                if (await Pvp.Deorbit())
                {
                    return(true);                     //Heal
                }
                if (await Pvp.EmpyreanRain())
                {
                    return(true);                          //Heal
                }
                if (await Pvp.Recuperate())
                {
                    return(true);                        //Self-Heal
                }
                if (await Pvp.Benefic2())
                {
                    return(true);                      //Heal
                }
                if (await Pvp.Benefic())
                {
                    return(true);                     //Heal
                }
                if (await Pvp.Concentrate())
                {
                    return(true);                         //CombatBuff/Heal
                }
                if (await Pvp.Safeguard())
                {
                    return(true);                       //CombatBuff/Shield
                }
                if (await Card.Play())
                {
                    return(true);
                }
                return(await Card.Draw());
            }
            if (Globals.PartyInCombat && Globals.InParty)
            {
                if (await TankBusters.Execute())
                {
                    return(true);
                }
            }

            if (await Logic.Astrologian.Heal.Ascend())
            {
                return(true);
            }

            // Scalebound Extreme Rathalos
            if (Core.Me.HasAura(1495))
            {
                if (await Dispel.Execute())
                {
                    return(true);
                }
                return(false);
            }

            if (await Logic.Astrologian.Heal.EssentialDignity())
            {
                return(true);
            }
            if (await Dispel.Execute())
            {
                return(true);
            }
            if (await Buff.LucidDreaming())
            {
                return(true);
            }
            if (await Buff.Lightspeed())
            {
                return(true);
            }
            if (await Buff.Synastry())
            {
                return(true);
            }
            if (await Buff.CelestialOpposition())
            {
                return(true);
            }

            if (DutyManager.InInstance || Core.Me.InCombat)
            {
                if (Globals.InParty)
                {
                    if (await Logic.Astrologian.Heal.EssentialDignity())
                    {
                        return(true);
                    }
                    if (await Logic.Astrologian.Heal.AspectedHelios())
                    {
                        return(true);
                    }
                    if (await Logic.Astrologian.Heal.CollectiveUnconscious())
                    {
                        return(true);
                    }
                    if (await Logic.Astrologian.Heal.Helios())
                    {
                        return(true);
                    }
                    if (await Logic.Astrologian.Heal.LadyOfCrowns())
                    {
                        return(true);
                    }
                    if (await Logic.Astrologian.Heal.Benefic2())
                    {
                        return(true);
                    }
                }

                if (await Logic.Astrologian.Heal.Benefic())
                {
                    return(true);
                }
                if (await Logic.Astrologian.Heal.AspectedBenefic())
                {
                    return(true);
                }
                if (await Logic.Astrologian.Heal.EarthlyStar())
                {
                    return(true);
                }
            }

            if (await Logic.Astrologian.Heal.LadyOfCrowns())
            {
                return(true);
            }
            if (await Logic.Astrologian.Heal.Benefic())
            {
                return(true);
            }
            if (await Card.Play())
            {
                return(true);
            }
            return(await Card.Draw());
        }