gamerpuppy/sts_lightspeed

no nextActionDamage display in combat

Opened this issue · 0 comments

It seems that showing nextActiondamage needs BattleContext and GameContext, that is why you put space on it. I copy some code of incomingDamage from SimpleAgent.cpp::getIncomingDamage() and add it to BattleContext operator<< function(which has battlecontext variable). It is not perfect because it lacks the game context. The missed part might be

if (bc.player.hasRelic<R::RUNIC_DOME>()) {
    DamageInfo dInfo = {5*gc->act, 1};
}

I assume 5*gc->act is damage predicted in SimpleAgent when It can't access enemy's intent.
so this part is useless in game, showing damage only need battlecontext.
the code might be something like

if (bc.player.hasRelic<R::RUNIC_DOME>()) {
    os << "incomingDamage: unknown";
}

So I presume the missing nextactiondamage can be fixed by adding it to battlecontext.cpp instead of Monster.cpp

     ...code...
            << ", sum: " << bc.sum
            << ", seed: " << bc.seed
            << "\n";
        int incomingDamage = 0;
        for (int i = 0; i < bc.monsters.monsterCount; ++i) {
            const auto &m = bc.monsters.arr[i];
            if (m.isDeadOrEscaped() || m.isHalfDead()) {
                continue;
            }

            DamageInfo dInfo;
            dInfo = m.getMoveBaseDamage(bc);
            dInfo.damage = m.calculateDamageToPlayer(bc, dInfo.damage);
            incomingDamage += dInfo.damage * dInfo.attackCount;
        }
        if (bc.player.hasRelic<R::RUNIC_DOME>()) {
            os << "\tincomingDamage: Unknown";
        }else{
            os << "\tincomingDamage: " << incomingDamage;
        }
        os << "\n";
        os << bc.monsters;
        ...code...