コード例 #1
0
    public override int DamageEntity(DamageSource _damageSource, int _strength, bool _criticalHit, float _impulseScale)
    {
        if (EntityUtilities.IsAnAlly(entityId, _damageSource.getEntityId()))
        {
            return(0);
        }

        if (EntityUtilities.GetBoolValue(entityId, "Invulnerable"))
        {
            return(0);
        }

        if (Buffs.HasBuff("buffInvulnerable"))
        {
            return(0);
        }

        // If we are being attacked, let the state machine know it can fight back
        emodel.avatarController.SetBool("IsBusy", false);

        // Turn off the trader ID while it deals damage to the entity
        ToggleTraderID(false);
        int Damage = base.DamageEntity(_damageSource, _strength, _criticalHit, _impulseScale);

        ToggleTraderID(true);
        return(Damage);
    }
コード例 #2
0
    public override void ProcessDamageResponseLocal(DamageResponse _dmResponse)
    {
        if (EntityUtilities.GetBoolValue(entityId, "Invulnerable"))
        {
            return;
        }

        if (Buffs.HasBuff("buffInvulnerable"))
        {
            return;
        }

        if (!isEntityRemote)
        {
            // If we are being attacked, let the state machine know it can fight back
            emodel.avatarController.SetBool("IsBusy", false);

            // Turn off the trader ID while it deals damage to the entity
            ToggleTraderID(false);
            base.ProcessDamageResponseLocal(_dmResponse);
            ToggleTraderID(true);
        }
    }