OpenThrone / OpenThrone

Other
6 stars 3 forks source link

Incorrect Battle outcome when Off vs Def is close #220

Open camarao69 opened 3 months ago

camarao69 commented 3 months ago

Hello this it's not the first time that this hapens to me. Today I atacked 2 players and lost although I did more damage than the defender. This happend before when I was starting but I ignored it.

Battle

This was the first one ...

Screenshot_20240901-223546_Chrome

Screenshot_20240901-225255_Chrome

This was today .

Can you guys please check ? Thank you

uaktags commented 3 months ago

https://github.com/OpenThrone/OpenThrone/blob/5d102622ca285c6f31a62bd2bd01346c8e7368dc/src/utils/attackFunctions.ts#L555-L557

So we check if offense is greater than defense and apply a Win/Lose to the ordeal, but we call this at probably an incorrect time:

https://github.com/OpenThrone/OpenThrone/blob/5d102622ca285c6f31a62bd2bd01346c8e7368dc/src/utils/attackFunctions.ts#L495-L499

The idea was to capture how much XP you generated on a per Turn basis, but I tied the Win/Lose check in here.

Instead we should probably separate these two, check the Win/Lose in the beginning, before we mess with the perTurn stuff, then continue on to gather. The XP generated is too high for a perTurn basis as is, and was never fixed, so the whole placement/calculation could use some tweaks.

I think first order will be to move the Win/Lost factor, and then target the XP later. I'll jump in later if not taken up.

uaktags commented 3 months ago

Interestingly, https://openthrone.dev/api/attack/retest/4875 shows that the attacker should have won regardless. Still, this is leading me to think that the per-turn basis is causing a runon issue

camarao69 commented 3 months ago

I added some soldiers and armory and attacked again , but this time i won.

Screenshot_20240901-233213_Chrome Could it be the stength bonus or defense (in case of the defender) not kicking in on the calculations ?