| 601 | } |
| 602 | |
| 603 | void KeeperAI::saveWoundedCreatures() |
| 604 | { |
| 605 | if(mCooldownSaveWoundedCreatures > 0) |
| 606 | { |
| 607 | --mCooldownSaveWoundedCreatures; |
| 608 | return; |
| 609 | } |
| 610 | mCooldownSaveWoundedCreatures = Random::Int(mCooldownSaveWoundedCreaturesMin, mCooldownSaveWoundedCreaturesMax); |
| 611 | |
| 612 | Tile* dungeonTempleTile = getDungeonTemple()->getCentralTile(); |
| 613 | if(dungeonTempleTile == nullptr) |
| 614 | { |
| 615 | OD_LOG_ERR("keeperAi=" + mPlayer.getNick()); |
| 616 | return; |
| 617 | } |
| 618 | |
| 619 | Seat* seat = mPlayer.getSeat(); |
| 620 | std::vector<Creature*> creatures = mGameMap.getCreaturesBySeat(seat); |
| 621 | for(Creature* creature : creatures) |
| 622 | { |
| 623 | // We take away fleeing creatures not too near our dungeon heart |
| 624 | if(!creature->isActionInList(CreatureActionType::flee)) |
| 625 | continue; |
| 626 | Tile* tile = creature->getPositionTile(); |
| 627 | if(tile == nullptr) |
| 628 | continue; |
| 629 | |
| 630 | if((std::abs(dungeonTempleTile->getX() - tile->getX()) <= 5) && |
| 631 | (std::abs(dungeonTempleTile->getY() - tile->getY()) <= 5)) |
| 632 | { |
| 633 | // We are too close from our dungeon heart to be picked up |
| 634 | continue; |
| 635 | } |
| 636 | |
| 637 | if(!creature->tryPickup(seat)) |
| 638 | continue; |
| 639 | |
| 640 | mPlayer.pickUpEntity(creature); |
| 641 | |
| 642 | mPlayer.dropHand(dungeonTempleTile); |
| 643 | } |
| 644 | } |
| 645 | |
| 646 | void KeeperAI::handleDefense() |
| 647 | { |
nothing calls this directly
no test coverage detected