Beispiel #1
0
    public override bool HandleHit(ref HitData data, ref HitResult inResult)
    {
        if (DebugCommandHandler.Instance.likeABossCommand.isActive)
        {
            return(true);                                                                // If LikeABoss active, allow invincible enemies to be hit with any attack
        }
        bool flag = this.state.hitTimer > 0f;

        if (!flag)
        {
            Vector3 attack = data.Point - this.owner.WorldPosition;
            attack.y = 0f;
            attack.Normalize();
            if (this.AngleBlocks(attack) || (this.AttackSrcBlock(data.SrcTag) ^ this._invertSrcTags))
            {
                EffectFactory.Instance.PlayQuickEffect(this._blockEffect, data.Point, data.Normal, this.owner.SoundContext);
                inResult.result = HitResult.ResultMode.Hard;
                flag            = true;
            }
        }
        if ((flag || this._elementImmunity) && this.BlockDamage(data.GetDamageData()))
        {
            return(!this._stopHitChain);
        }
        if (this._invulnerableTime > 0f && Invulnerable.TotalDmg(data.GetDamageData()) > 0f)
        {
            this.state.hitTimer = this._invulnerableTime;
            this.state.isHit    = true;
            base.enabled        = true;
        }
        return(true);
    }