Exemple #1
0
    /// <summary>
    /// Attacks the target by the player with the specified skill.
    /// </summary>
    /// <param name="player">The player who is performing the skill.</param>
    /// <param name="target">The target.</param>
    /// <param name="skill">The skill.</param>
    public async ValueTask AttackTargetAsync(Player player, IAttackable target, SkillEntry skill)
    {
        if (skill.Skill?.SkillType != SkillType.AreaSkillExplicitHits ||
            target is null ||
            !target.IsAlive ||
            target.IsAtSafezone())
        {
            return;
        }

        if (player.IsAtSafezone())
        {
            // It's possible, when the player did some area skill (Evil Spirit), and walked into the safezone.
            // We don't log it as hacker attempt, since the AreaSkillAttackAction already does handle this.
        }

        if (target.CheckSkillTargetRestrictions(player, skill.Skill))
        {
            await target.AttackByAsync(player, skill).ConfigureAwait(false);

            await target.TryApplyElementalEffectsAsync(player, skill).ConfigureAwait(false);
        }
    }