2016-10-28 16:16:46 +02:00
|
|
|
/*
|
|
|
|
* AttackPossibility.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
|
2017-03-17 17:48:44 +02:00
|
|
|
#include "../../lib/CStack.h"
|
2016-11-01 20:53:46 +02:00
|
|
|
#include "../../CCallback.h"
|
2016-10-28 16:16:46 +02:00
|
|
|
#include "common.h"
|
|
|
|
|
|
|
|
|
|
|
|
struct HypotheticChangesToBattleState
|
|
|
|
{
|
|
|
|
std::map<const CStack *, const IBonusBearer *> bonusesOfStacks;
|
|
|
|
std::map<const CStack *, int> counterAttacksLeft;
|
|
|
|
};
|
|
|
|
|
|
|
|
class Priorities
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
std::vector<double> resourceTypeBaseValues;
|
|
|
|
std::function<double(const CStack *)> stackEvaluator;
|
|
|
|
Priorities()
|
|
|
|
{
|
|
|
|
// range::copy(VLC->objh->resVals, std::back_inserter(resourceTypeBaseValues));
|
|
|
|
stackEvaluator = [](const CStack*){ return 1.0; };
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class AttackPossibility
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
const CStack *enemy; //redundant (to attack.defender) but looks nice
|
|
|
|
BattleHex tile; //tile from which we attack
|
|
|
|
BattleAttackInfo attack;
|
|
|
|
|
|
|
|
int damageDealt;
|
|
|
|
int damageReceived; //usually by counter-attack
|
|
|
|
int tacticImpact;
|
|
|
|
|
|
|
|
int damageDiff() const;
|
|
|
|
int attackValue() const;
|
|
|
|
|
|
|
|
static AttackPossibility evaluate(const BattleAttackInfo &AttackInfo, const HypotheticChangesToBattleState &state, BattleHex hex);
|
|
|
|
static Priorities * priorities;
|
|
|
|
};
|