Combat log inverts the order of attacks vs. status effects
Posted: Mon Dec 23, 2019 7:41 am
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:
I did a quick read-through of the code to confirm the behavior. The flow of logic looks something like this:
Ideally, we can concoct some way of enqueuing the status effect log lines without publishing them until handling the end of the attack.
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!
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