| 734 | } |
| 735 | |
| 736 | bool KeeperAI::repairRooms() |
| 737 | { |
| 738 | if(mCooldownRepairRooms > 0) |
| 739 | { |
| 740 | --mCooldownRepairRooms; |
| 741 | return false; |
| 742 | } |
| 743 | |
| 744 | mCooldownRepairRooms = Random::Int(20,60); |
| 745 | |
| 746 | Seat* seat = mPlayer.getSeat(); |
| 747 | for(Room* room : mGameMap.getRooms()) |
| 748 | { |
| 749 | if(room->getSeat() != seat) |
| 750 | continue; |
| 751 | |
| 752 | if(!room->canBeRepaired()) |
| 753 | continue; |
| 754 | |
| 755 | int goldRequired = room->getCostRepair(); |
| 756 | |
| 757 | if(!mGameMap.withdrawFromTreasuries(goldRequired, mPlayer.getSeat())) |
| 758 | return false; |
| 759 | |
| 760 | room->repairRoom(); |
| 761 | // We only repair one room at a time. Note that if we want to repair more than one room at a time, we should pay |
| 762 | // attention to not modify the room list (if room absorbed in RoomManager::buildRoom) while iterating it |
| 763 | break; |
| 764 | } |
| 765 | |
| 766 | return false; |
| 767 | } |
| 768 | |
| 769 | bool KeeperAI::handleTiredCreatures() |
| 770 | { |
nothing calls this directly
no test coverage detected