MantisBT

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0003065VCMIAI - Battlespublic2019-05-28 20:232019-05-30 10:57
Reportermpech 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusnewResolutionopen 
PlatformUbuntu 16.04.6 LTSOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0003065: battle hangs if no shot left from ballista
Descriptionai attacks defended castle by me
catapult is destroyed, ai does not want to move creature
ai tries to shoot with ballista but ballista has no shots left.
infinite loop
Steps To Reproduceas red, go into castle. end turn
//blue attacks castle
as red, magic arrow to destroy the catapult
then always defend with tower arrow and golems.
ai consumes its ballista shots, then
battle hangs when shots left is O
Additional Informationmodules used are hota, preserve, retreat, death valley, whitchiking artifacts
TagsNo tags attached.
Attached Files? file icon zzballista.vmap [^] (3,207 bytes) 2019-05-28 20:23
zip file icon VCMI_Client_log.zip [^] (185,086 bytes) 2019-05-28 20:24
zip file icon zzbalista2.zip [^] (626,952 bytes) 2019-05-30 10:48

- Relationships

-  Notes
(0007802)
mpech (reporter)
2019-05-29 09:27
edited on: 2019-05-29 09:27

when looping (blue does not end its turn)
```
TRACE network [7f2c45d84700] - Applied on gs: 20BattleSetActiveStack
TRACE global [7f2c45d84700] - Making action: {BattleAction: side '0', stackNumber '0', actionType 'Shoot', actionSubtype '-1', target {[email protected]{BattleHex: x '15', y '5', hex '100'},}}
TRACE global [7f2c45d84700] - CGameHandler::makeBattleAction, shoot type
TRACE global [7f2c45d84700] - CBattleInfoCallback::battleCanShoot 24
TRACE network [7f2c45d84700] - Sending to all clients: 13SystemMessage
TRACE network [7f2c45d84700] - Sending a pack of type 13SystemMessage
==>ERROR global [7f2c45d84700] - Cannot shoot!
TRACE global [7f2c45d84700] - CGameHandler::runBattle, getnextstack
TRACE global [7f2c45d84700] - CGameHandler::runBattle, aim
TRACE network [7f2c45d84700] - Sending to all clients: 20BattleSetActiveStack
TRACE network [7f2c45d84700] - Sending a pack of type 20BattleSetActiveStack
TRACE network [7f2c45d84700] - Applied on gs: 20BattleSetActiveStack
TRACE global [7f2c45d84700] - Making action: {BattleAction: side '0', stackNumber '0', actionType 'Shoot', actionSubtype '-1', target {[email protected]{BattleHex: x '15', y '5', hex '100'},}}
```

when ok (that is round before 23)
```
TRACE global [7f2c45d84700] - Making action: {BattleAction: side '0', stackNumber '0', actionType 'Shoot', actionSubtype '-1', target {[email protected]{BattleHex: x '15', y '5', hex '100'},}}
TRACE global [7f2c45d84700] - CGameHandler::makeBattleAction, shoot type
TRACE global [7f2c45d84700] - CBattleInfoCallback::battleCanShoot 23
TRACE network [7f2c45d84700] - Sending to all clients: 11StartAction
TRACE network [7f2c45d84700] - Sending a pack of type 11StartAction
TRACE network [7f2c45d84700] - Applied on gs: 11StartAction
TRACE network [7f2c45d84700] - Sending to all clients: 12BattleAttack
TRACE network [7f2c45d84700] - Sending a pack of type 12BattleAttack
TRACE network [7f2c45d84700] - Applied on gs: 12BattleAttack
TRACE network [7f2c45d84700] - Sending to all clients: 9EndAction
TRACE network [7f2c45d84700] - Sending a pack of type 9EndAction
```

I guess if canShoot, makeAttack triggers some stuff (in particular StartAction/EndAction) so getNextStack() rolls out to behe.
If !canShoot no action is taken and getNextStack does not move to next stack

by dumbly applying the wrapAction if case of !canShoot, round can end even if ballista does not shoot

```
    case EActionType::SHOOT:
        {
            //...
            auto destination = target.at(0).hexValue;

            const CStack * destinationStack = gs->curB->battleGetStackByPos(destination);
            if (!gs->curB->battleCanShoot(stack, destination))
            {
                logGlobal->trace("CGameHandler::makeBattleAction, cannot shoot bbrrrrr");
                if(stack->creatureIndex() == CreatureID::BALLISTA){
                    logGlobal->trace("CGameHandler::makeBattleAction, isballista");
                    auto wrapper = wrapAction(ba);
                }else{
                    complain("Cannot shoot!");
                }
                break;
            }
```

```
TRACE global [7f1da53bc700] - CGameHandler::makeBattleAction, cannot shoot bbrrrrr
TRACE global [7f1da53bc700] - CGameHandler::makeBattleAction, isballista
TRACE network [7f1da53bc700] - Sending to all clients: 11StartAction
TRACE network [7f1da53bc700] - Sending a pack of type 11StartAction
TRACE network [7f1da53bc700] - Applied on gs: 11StartAction
TRACE network [7f1da53bc700] - Sending to all clients: 9EndAction
TRACE network [7f1da53bc700] - Sending a pack of type 9EndAction
TRACE network [7f1da53bc700] - Applied on gs: 9EndAction
TRACE global [7f1da53bc700] - CGameHandler::makeBattleAction, battlemadeactionistrue
TRACE global [7f1da53bc700] - CGameHandler::runBattle, getnextstack
TRACE global [7f1da53bc700] - Activating blue battle stack [2]: 100 of Behemoths from slot 0 of armyobj=1
```

I don't think this is a proper fix (because what about other complain from EActionType::SHOOT case?)
I am not sure either makeBattleAction purpose is to be only called from automatic ia (and not human)

(0007803)
Povelitel (updater)
2019-05-29 14:33

2453 2719 2799 related?
(0007806)
mpech (reporter)
2019-05-30 10:57

@polivetel i don't think so, 2453,2799 involves fortress, here we are in castle
2719 is seems to be a strategic "fail" (round can end but no action taken in round, here round does not end)

in added zzbalista2, attacking hero has now artillery.
We can see that _without_ fix, ballista with no ammunition chose to defend.

so bug only occurs if ballista has no ammunition AND hero has no artillery skill

- Issue History
Date Modified Username Field Change
2019-05-28 20:23 mpech New Issue
2019-05-28 20:23 mpech File Added: zzballista.vmap
2019-05-28 20:24 mpech File Added: VCMI_Client_log.zip
2019-05-29 09:27 mpech Note Added: 0007802
2019-05-29 09:27 mpech Note Edited: 0007802 View Revisions
2019-05-29 14:33 Povelitel Note Added: 0007803
2019-05-30 10:48 mpech File Added: zzbalista2.zip
2019-05-30 10:57 mpech Note Added: 0007806

Site | Forums | Wiki | Slack | GitHub


Copyright © 2000 - 2019 MantisBT Team
Hosting provided by DigitalOcean