Combat log inverts the order of attacks vs. status effects

A place to submit bugs to the Andor's Trail Development Team.
Post Reply
QQkp
Posts: 9
Joined: Sat Dec 21, 2019 4:33 am
android_version: 7.1 - Nougat

Combat log inverts the order of attacks vs. status effects

Post by QQkp »

Minor cosmetic bug. When an attack triggers a status effect, the combat log shows the status effect before the attack itself. However, in the game logic, the attack is applied before the status effect occurs.

For example, my character has a damage resistance of 5. The Guynmart shield has a chance of giving a 2-round bark skin x2 effect (+2 to damage resistance). When I fight a mist of the crypt (damage potential 1-7), I've observed sequences in the combat log like:
  • You are affected by Bark skin x2 (2 rounds).
  • Mist of the crypt hits you for 1 hp!
If bark skin had truly kicked in before the enemy attack, the damage received should have been 0, since the enemy wouldn't be able to overcome the increased damage resistance.

I did a quick read-through of the code to confirm the behavior. The flow of logic looks something like this:

Code: Select all

CombatController::attackWithCurrentMonster
  CombatController::monsterAttacks
    CombatController::attack
      ActorStatsController::removeActorHealth // DAMAGE CAUSED BY ATTACK IS APPLIED HERE
      CombatController::applyAttackHitStatusEffects
        ActorStatsController::applyUseEffect
          ActorStatsController::rollForConditionEffect
            CombatActionListeners::onPlayerReceviesActorCondition
              MainActivity::onPlayerReceviesActorCondition
                MainActivity::message
                  CombatLog::append // PLAYER STATUS EFFECT IS ADDED TO THE LOG HERE
            CombatActionListeners::onMonsterReceivesActorCondition
              MainActivity::onMonsterReceivesActorCondition
                MainActivity::message
                  CombatLog::append // MONSTER STATUS EFFECT IS ADDED TO THE LOG HERE
            ActorStatsController::applyActorCondition // STATUS EFFECT IS APPLIED TO STATS HERE
  CombatActionListeners::onMonsterAttackSuccess
    MainActivity::onMonsterAttackSuccess
      MainActivity::message
        CombatLog::append // DAMAGE CAUSED BY ATTACK IS ADDED TO THE LOG HERE
Ideally, we can concoct some way of enqueuing the status effect log lines without publishing them until handling the end of the attack.

Gonk
Posts: 92
Joined: Mon Mar 04, 2019 8:45 pm
android_version: 8.1 - Oreo

Re: Combat log inverts the order of attacks vs. status effects

Post by Gonk »

Thank you. That is a nice find.

Do you want to fix it yourself? I could help you with the build if that is needed.

Could you otherwise open an issue on github?
https://github.com/Zukero/andors-trail/issues

I will work on it when other things are done.

QQkp
Posts: 9
Joined: Sat Dec 21, 2019 4:33 am
android_version: 7.1 - Nougat

Re: Combat log inverts the order of attacks vs. status effects

Post by QQkp »

I could try, but it may take me a while to get things set up.

Do you have an opinion on what the fix should be? Maybe moving applyAttackHitStatusEffects to occur after onMonsterAttackSuccess/onPlayerAttackSuccess, just before skill effects are applied?

Gonk
Posts: 92
Joined: Mon Mar 04, 2019 8:45 pm
android_version: 8.1 - Oreo

Re: Combat log inverts the order of attacks vs. status effects

Post by Gonk »

Changing the order in which things happen may have unwanted sideeffects. So it could be more attractive to move the log entry to the time when the hit was received.

An OnPlayerReceivedHit that is triggered before CombatController::applyAttackHitStatusEffects might do the trick.

Who fixes it would have to take a deeper look at the code to find the best solution.

Post Reply