# MDamager

## Overview

&#x20;This component is the core class to affect character stats, react and interact with other character and objects in a scene.&#x20;

It uses the **IMDamager** and **IInteractor** interfaces.

[**MAttackTrigger**](https://malbersanimations.gitbook.io/animal-controller/secondary-components/mdamager/mattack-trigger), MMelee, MProjectile ,MShooteable, MExplosion and MBow inherit from **MDamager**.

{% hint style="info" %}

### This component is not meant to be used on its own

### Use MAttack Trigger or MProjectile instead&#x20;

{% endhint %}

&#x20;E.g. If an animal is affected any of the **Damager** components The Health Stat will be reduced and the Animal will react by doing a Damage Mode animation.

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-MSeIPLnXvzlm1uO9V7J%2F-MSeIi9q8eW-jWAt6uKq%2Fimage.png?alt=media\&token=dff47b3a-a2fd-46e5-953f-3194009e8cd8)

{% hint style="success" %}

## All these Parameters are found in all the child components. plus some extra new parameters

{% endhint %}

## General

### Active

Enable/Disable the Damager.

### Index

Index of the Damager. Often used by the Animator know which damager to enable/disable via an Animation.

{% hint style="success" %}
Usually, the Animals have more than one Attack Trigger: Horns, Mouth, Claws, Feet, Swords... Each Attack can use this index to activate the proper Damager while making the animation.
{% endhint %}

### Hit Layer

&#x20;Layers to interact with objects. By default, the layer is set that affects only the Animal Layer.

### Trigger Interaction

Set the Interaction that the Damager will have with Triggers.

### Don't hit Owner

When the Damager is using **Raycast** or **OnTriggerEnter**, sometimes it can register colliders inside the same hierarchy the Damager is. When this option is enabled, these colliders will be ignored.

### Owner

By default, the Owner is the Root of the hierarchy. But it can be set Manually to another gameobject. If this value is set to null, it will be set again to the Root of the hierarchy.

## Damage

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-MSe3aYXbUniJhgxlvbZ%2F-MSe8oGt-luOWbr1M8qV%2Fimage.png?alt=media\&token=7e6afe96-e0e4-471e-afe9-fceb734c959f)

When a Damager register a collider, it will find a Stats Component on its hierarchy and it will apply the modification to a Stat.

### Stat Modifier

Stat modification to apply on the Damager receiver. for more Info see [**Modify Stat**](https://malbersanimations.gitbook.io/animal-controller/global-components/stats/modify-stat-component)

### Pure Damage

If this parameter is set to true the Damager Receiver ([**MDamageable**](https://malbersanimations.gitbook.io/animal-controller/secondary-components/mdamageable)) will ignore its default multiplier. Resulting in pure damage.

## Critical Damage

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-MSeKJ-fh-veoiyFbDIU%2F-MSeKZ5BF7wNRFw5l5Fe%2Fimage.png?alt=media\&token=103143ef-d4b9-40bb-80b3-f5a357b49701)

The critical damage will apply a chance to increase or decrease the final value of the Stat modifier

### Chance

Probability of making a critical damage

### Multiplier

The Stat Modifier value will be multiplied by this value if the critical chance is true.

## Physics

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-MSe3aYXbUniJhgxlvbZ%2F-MSe611haX9fm6AYA-KI%2Fimage.png?alt=media\&token=c4e5d65c-88ef-410d-a0e8-455f4de1d71d)

When a Damager register a collider, it will  apply a force to the attached rigidbody.

### &#x20;Force

Amount of force applied

### Force Type

Type of force to apply on the ApplyForce() method.

## Miscellaneous

![](https://963537199-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lzhr1XSMzMqNXjRnNlb%2F-MSeKJ-fh-veoiyFbDIU%2F-MSeL6tELp1ZmJh6Re2g%2Fimage.png?alt=media\&token=fbb678d4-e11b-4a77-b27a-4804d90d0bb8)

### React

The Damager receiver will apply its default Animal Reaction

### Interact

If the Damage Receiver has any [**Interactable** ](https://malbersanimations.gitbook.io/animal-controller/global-components/interactable)component it interact with it sending the InteractorID  value.

### InteractorID

Index to send to the Interactable

&#x20;

&#x20;
