Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DamageHandler"/> class.
 /// </summary>
 /// <param name="target">The target to be set.</param>
 /// <param name="baseHandler"><inheritdoc cref="DamageHandlerBase.Base"/></param>
 public DamageHandler(Player target, BaseHandler baseHandler)
     : base(baseHandler)
 {
     Target            = target;
     Attacker          = baseHandler is PlayerStatsSystem.AttackerDamageHandler handler ? Player.Get(handler.Attacker.Hub) : null;
     TargetFootprint   = target.Footprint;
     AttackerFootprint = Attacker?.Footprint ?? default;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CustomDamageHandler"/> class.
 /// </summary>
 /// <param name="target">The target to be set.</param>
 /// <param name="baseHandler">The base <see cref="BaseHandler"/>.</param>
 public CustomDamageHandler(Player target, BaseHandler baseHandler)
     : base(target, baseHandler)
 {
     if (Attacker is not null)
     {
         if (Attacker.IsScp)
         {
             CustomBase = new ScpDamageHandler(target, baseHandler);
         }
         else if (Attacker.CurrentItem is not null && Attacker.CurrentItem.IsWeapon &&
                  baseHandler is BaseFirearmHandler)
         {
             CustomBase = new FirearmDamageHandler(Attacker.CurrentItem, target, baseHandler);
         }
         else
         {
             CustomBase = new DamageHandler(target, Attacker);
         }
     }
Ejemplo n.º 3
0
        private static bool Damage(PlayableScps.Scp096 __instance, PlayerStatsSystem.DamageHandlerBase handler)
        {
            try
            {
                AttackerDamageHandler attackerDamageHandler = handler as AttackerDamageHandler;
                if (attackerDamageHandler == null || attackerDamageHandler.Attacker.Hub == null || !__instance.CanEnrage)
                {
                    return(false);
                }

                var player = attackerDamageHandler.Attacker.Hub.GetPlayer();

                if (player.Invisible || Server.Get.Configs.synapseConfiguration.CantRage096.Contains(player.RoleID))
                {
                    return(false);
                }

                if (player.RealTeam == Team.SCP && !Server.Get.Configs.synapseConfiguration.ScpTrigger096)
                {
                    return(false);
                }

                Server.Get.Events.Scp.Scp096.InvokeScpTargetEvent(player, __instance.GetPlayer(), __instance.PlayerState, out var allow);

                if (allow)
                {
                    __instance.AddTarget(attackerDamageHandler.Attacker.Hub.gameObject);
                    __instance.Windup(false);
                }
                return(allow);
            }
            catch (Exception e)
            {
                Synapse.Api.Logger.Get.Error($"Synapse-Event: Scp096AddTargetEvent failed!!\n{e}");
                return(true);
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DamageHandlerBase"/> class.
 /// </summary>
 /// <param name="baseHandler">The base <see cref="BaseHandler"/>.</param>
 protected DamageHandlerBase(BaseHandler baseHandler) => Base = baseHandler;
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ScpDamageHandler"/> class.
 /// </summary>
 /// <param name="target">The target to be set.</param>
 /// <param name="baseHandler"><inheritdoc cref="DamageHandlerBase.Base"/></param>
 public ScpDamageHandler(Player target, BaseHandler baseHandler)
     : base(target, baseHandler)
 {
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FirearmDamageHandler"/> class.
 /// </summary>
 /// <param name="baseHandler"><inheritdoc cref="DamageHandlerBase.Base"/></param>
 /// <param name="item">The <see cref="Items.Item"/> to be set.</param>
 /// <param name="target">The target to be set.</param>
 public FirearmDamageHandler(Item item, Player target, BaseHandler baseHandler)
     : base(target, baseHandler) => Item = item;