2021-05-15 18:22:44 +02:00
|
|
|
/*
|
|
|
|
* AILayerTransitionRule.h, part of VCMI engine
|
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../AINodeStorage.h"
|
2021-05-16 14:39:38 +02:00
|
|
|
#include "../../AIGateway.h"
|
2021-05-15 18:22:44 +02:00
|
|
|
#include "../Actions/BoatActions.h"
|
2023-09-16 11:33:02 +02:00
|
|
|
#include "../Actions/AdventureSpellCastMovementActions.h"
|
2021-05-15 18:22:44 +02:00
|
|
|
#include "../../../../CCallback.h"
|
|
|
|
#include "../../../../lib/mapObjects/MapObjects.h"
|
2023-06-21 12:46:09 +02:00
|
|
|
#include "../../../../lib/pathfinder/PathfindingRules.h"
|
2021-05-15 18:22:44 +02:00
|
|
|
|
2022-09-26 20:01:07 +02:00
|
|
|
namespace NKAI
|
|
|
|
{
|
2021-05-15 18:22:44 +02:00
|
|
|
namespace AIPathfinding
|
|
|
|
{
|
|
|
|
class AILayerTransitionRule : public LayerTransitionRule
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
CPlayerSpecificInfoCallback * cb;
|
2020-05-04 17:58:43 +02:00
|
|
|
Nullkiller * ai;
|
2021-05-15 18:22:44 +02:00
|
|
|
std::map<int3, std::shared_ptr<const BuildBoatAction>> virtualBoats;
|
|
|
|
std::shared_ptr<AINodeStorage> nodeStorage;
|
2021-05-15 18:22:49 +02:00
|
|
|
std::map<const CGHeroInstance *, std::shared_ptr<const SummonBoatAction>> summonableVirtualBoats;
|
2023-09-16 11:33:02 +02:00
|
|
|
std::map<const CGHeroInstance *, std::shared_ptr<const WaterWalkingAction>> waterWalkingActions;
|
|
|
|
std::map<const CGHeroInstance *, std::shared_ptr<const AirWalkingAction>> airWalkingActions;
|
2021-05-15 18:22:44 +02:00
|
|
|
|
|
|
|
public:
|
2024-03-28 13:39:15 +02:00
|
|
|
AILayerTransitionRule(
|
|
|
|
CPlayerSpecificInfoCallback * cb,
|
|
|
|
Nullkiller * ai,
|
2024-03-28 15:37:30 +02:00
|
|
|
std::shared_ptr<AINodeStorage> nodeStorage);
|
2021-05-15 18:22:44 +02:00
|
|
|
|
|
|
|
virtual void process(
|
|
|
|
const PathNodeInfo & source,
|
|
|
|
CDestinationNodeInfo & destination,
|
|
|
|
const PathfinderConfig * pathfinderConfig,
|
|
|
|
CPathfinderHelper * pathfinderHelper) const override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void setup();
|
2023-09-16 11:33:02 +02:00
|
|
|
void collectVirtualBoats();
|
2021-05-15 18:22:44 +02:00
|
|
|
|
|
|
|
std::shared_ptr<const VirtualBoatAction> findVirtualBoat(
|
|
|
|
CDestinationNodeInfo & destination,
|
|
|
|
const PathNodeInfo & source) const;
|
|
|
|
|
2023-09-16 11:33:02 +02:00
|
|
|
bool tryUseSpecialAction(
|
2021-05-15 18:22:44 +02:00
|
|
|
CDestinationNodeInfo & destination,
|
|
|
|
const PathNodeInfo & source,
|
2023-09-16 11:33:02 +02:00
|
|
|
std::shared_ptr<const SpecialAction> specialAction,
|
|
|
|
EPathNodeAction targetAction) const;
|
2021-05-15 18:22:44 +02:00
|
|
|
};
|
|
|
|
}
|
2022-09-26 20:01:07 +02:00
|
|
|
|
|
|
|
}
|