If I reformulate, you don't understand why on one hand when Bat_B is the main target, the serpent Windroot take 55 damages and, on the other hand, when SerpentWindroot is the target, Bat_B take 172 damages. And for sure, the distance between Bat_B and SerpentWindroot is the same regardless of the target.

This phenomenon comes from the fact that Bat sprite and Plant sprite have different dimension.

Let's compute manually together the distance between those two sprites according to Yanfly

This is the sprite dimention of plant and bat :

name Height Width

Bat 198 px 128 px

Plant 138 px 152 px

let's assume that plant and bat are located at the following coordinates

Plant x = 0

Plant y = 0

Bat x = 100

Bat y = 100

### Targetting Bat ####

JavaScript:

```
if (mainX > targetX) {
targetX = Math.min(mainX, target.aoeX() + target.aoeWidth() / 2);
} else if (mainX < targetX) {
targetX = Math.max(mainX, target.aoeX() - target.aoeWidth() / 2);
}
```

the main refer to Bat (our target)

target refer to Plant (that is in the aoe)

mainX is Bat x = 100

targetX is Plant x = 0

condition is met

JavaScript:

`targetX = Math.min(mainX, target.aoeX() + target.aoeWidth() / 2);`

mainX is Bat x = 100

target.aoeX() is Plant x = 0

target.aoeWidth is Plant sprite width = 152

we take the minimal value between 100 and 0 + 152/2 = 76.

From now, we consider that targetX = 76 (Plant x = 76)

Hope you understand that from this point the script consider that, on the x axis, the distance between bat and plant is 24 px right ? (Bat x - Plant x = 100 - 76 = 24 px)

### Targetting Plant ###

JavaScript:

```
if (mainX > targetX) {
targetX = Math.min(mainX, target.aoeX() + target.aoeWidth() / 2);
} else if (mainX < targetX) {
targetX = Math.max(mainX, target.aoeX() - target.aoeWidth() / 2);
}
```

the main refer to Plant (our target)

target refer to Bat (that is in the aoe)

mainX is Pant x = 0

targetX is Bat x = 100

condition is not met

JavaScript:

```
} else if (mainX < targetX) {
targetX = Math.max(mainX, target.aoeX() - target.aoeWidth() / 2);
}
```

mainX is Pant x = 0

targetX is Bat x = 100

condition is met

JavaScript:

`targetX = Math.max(mainX, target.aoeX() - target.aoeWidth() / 2);`

mainX in Plant X = 0

target.aoeX() is Bat x = 100

target.aoeWidth is Bat sprite width = 128

we take the maximal value between 0 and 100 - 128/2 = 36.

From now, we consider that targetX = 36 (Bat x = 36)

Hope you understand that from this point the script consider that, on the x axis, the distance between bat and plant is now 36 px right ? (Bat x - Plant x = 36 - 0 = 36 px)

So, when we target the bat, the script estimate that the distance between the two battlers is 24 pixels on the x axis.

But, when we target the plant, the script now estimate that the distance between the two battlers is 36 pixels on the x axis.

Thus, it is normal that damages are not symmetrical according to which battler you are targeting.