std::vector<BattleHex>knownAccessible;//hexes that will be treated as accessible, even if they're occupied by stack (by default - tiles occupied by stack we do reachability for, so it doesn't block itself)
std::vector<shared_ptr<constCObstacleInstance>>battleGetAllObstacles(boost::optional<BattlePerspective::BattlePerspective>perspective=boost::none)const;//returns all obstacles on the battlefield
TStacksbattleGetAllStacks()const;//returns all stacks, alive or dead or undead or mechanical :)
boolbattleHasNativeStack(ui8side)const;
ui8battleGetWallState(intpartOfWall)const;//for determining state of a part of the wall; format: parameter [0] - keep, [1] - bottom tower, [2] - bottom wall, [3] - below gate, [4] - over gate, [5] - upper wall, [6] - uppert tower, [7] - gate; returned value: 1 - intact, 2 - damaged, 3 - destroyed; 0 - no battle
intbattleGetMoatDmg()const;//what dmg unit will suffer if ending turn in the moat
constCGTownInstance*battleGetDefendedTown()const;//returns defended town if current battle is a siege, NULL instead
constCStack*battleActiveStack()const;
si8battleTacticDist()const;//returns tactic distance in current tactics phase; 0 if not in tactics phase
si8battleGetTacticsSide()const;//returns which side is in tactics phase, undefined if none (?)
boolbattleCanFlee(intplayer)const;
boolbattleCanSurrender(intplayer)const;
ui8playerToSide(intplayer)const;
ui8battleGetSiegeLevel()const;//returns 0 when there is no siege, 1 if fort, 2 is citadel, 3 is castle
boolbattleHasHero(ui8side)const;
intbattleCastSpells(ui8side)const;//how many spells has given side casted
//ESpellCastProblem::ESpellCastProblem battleCanCastSpell(int player, ECastingMode::ECastingMode mode) const; //Checks if player is able to cast spells (at all) at the moment
shared_ptr<constCObstacleInstance>battleGetObstacleOnPos(BattleHextile,boolonlyBlocking=true)const;//blocking obstacles makes tile inaccessible, others cause special effects (like Land Mines, Moat, Quicksands)
constCStack*battleGetStackByPos(BattleHexpos,boolonlyAlive=true)const;//returns stack info by given pos
std::vector<BattleHex>battleGetAvailableHexes(constCStack*stack,booladdOccupiable,std::vector<BattleHex>*attackable=NULL)const;//returns hexes reachable by creature with id ID (valid movement destinations), DOES contain stack current position
intbattleGetSurrenderCost(intPlayer)const;//returns cost of surrendering battle, -1 if surrendering is not possible
ReachabilityInfo::TDistancesbattleGetDistances(constCStack*stack,BattleHexhex=BattleHex::INVALID,BattleHex*predecessors=NULL)const;//returns vector of distances to [dest hex number]
TDmgRangecalculateDmgRange(constBattleAttackInfo&info)const;//charge - number of hexes travelled before attack (for champion's jousting); returns pair <min dmg, max dmg>
TDmgRangecalculateDmgRange(constCStack*attacker,constCStack*defender,TQuantityattackerCount,boolshooting,ui8charge,boollucky,booldeathBlow,boolballistaDoubleDmg)const;//charge - number of hexes travelled before attack (for champion's jousting); returns pair <min dmg, max dmg>
TDmgRangecalculateDmgRange(constCStack*attacker,constCStack*defender,boolshooting,ui8charge,boollucky,booldeathBlow,boolballistaDoubleDmg)const;//charge - number of hexes travelled before attack (for champion's jousting); returns pair <min dmg, max dmg>
//hextowallpart //int battleGetWallUnderHex(BattleHex hex) const; //returns part of destructible wall / gate / keep under given hex or -1 if not found
std::pair<ui32,ui32>battleEstimateDamage(constBattleAttackInfo&bai,std::pair<ui32,ui32>*retaliationDmg=NULL)const;//estimates damage dealt by attacker to defender; it may be not precise especially when stack has randomly working bonuses; returns pair <min dmg, max dmg>
std::pair<ui32,ui32>battleEstimateDamage(constCStack*attacker,constCStack*defender,std::pair<ui32,ui32>*retaliationDmg=NULL)const;//estimates damage dealt by attacker to defender; it may be not precise especially when stack has randomly working bonuses; returns pair <min dmg, max dmg>
EWallParts::EWallPartsbattleHexToWallPart(BattleHexhex)const;//returns part of destructible wall / gate / keep under given hex or -1 if not found
//*** MAGIC
si8battleMaxSpellLevel()const;//calculates minimum spell level possible to be cast on battlefield - takes into account artifacts of both heroes; if no effects are set, 0 is returned
ui32battleGetSpellCost(constCSpell*sp,constCGHeroInstance*caster)const;//returns cost of given spell
ESpellCastProblem::ESpellCastProblembattleCanCastSpell(intplayer,ECastingMode::ECastingModemode)const;//returns true if there are no general issues preventing from casting a spell
ESpellCastProblem::ESpellCastProblembattleCanCastThisSpell(intplayer,constCSpell*spell,ECastingMode::ECastingModemode)const;//checks if given player can cast given spell
ESpellCastProblem::ESpellCastProblembattleCanCastThisSpellHere(intplayer,constCSpell*spell,ECastingMode::ECastingModemode,BattleHexdest)const;//checks if given player can cast given spell at given tile in given mode
ESpellCastProblem::ESpellCastProblembattleCanCreatureCastThisSpell(constCSpell*spell,BattleHexdestination)const;//determines if creature can cast a spell here
ui32calculateSpellDmg(constCSpell*sp,constCGHeroInstance*caster,constCStack*affectedCreature,intspellSchoolLevel,intusedSpellPower)const;//calculates damage inflicted by spell
std::set<constCStack*>getAffectedCreatures(constCSpell*s,intskillLevel,ui8attackerOwner,BattleHexdestinationTile);//calculates stack affected by given spell
TSpellgetRandomCastedSpell(constCStack*caster)const;//called at the beginning of turn for Faerie Dragon
//checks for creature immunity / anything that prevent casting *at given hex* - doesn't take into acount general problems such as not having spellbook or mana points etc.
si8battleCanTeleportTo(constCStack*stack,BattleHexdestHex,inttelportLevel)const;//checks if teleportation of given stack to given position can take place
//convenience methods using the ones above
boolisInTacticRange(BattleHexdest)const;
si8battleGetTacticDist()const;//returns tactic distance for calling player or 0 if this player is not in tactic phase (for ALL_KNOWING actual distance for tactic side)
std::set<constCStack*>getAttackedCreatures(constCStack*attacker,BattleHexdestinationTile,BattleHexattackerPos=BattleHex::INVALID)const;//calculates range of multi-hex attacks
boolisToReverse(BattleHexhexFrom,BattleHexhexTo,boolcurDir/*if true, creature is in attacker's direction*/,booltoDoubleWide,booltoDir)const;//determines if creature should be reversed (it stands on hexFrom and should 'see' hexTo)
boolisToReverseHlp(BattleHexhexFrom,BattleHexhexTo,boolcurDir)const;//helper for isToReverse
boolbattleCanFlee()const;//returns true if caller can flee from the battle
TStacksbattleGetStacks(EStackOwnershipwhose=MINE_AND_ENEMY,boolonlyAlive=true)const;//returns stacks on battlefield
ESpellCastProblem::ESpellCastProblembattleCanCastThisSpell(constCSpell*spell)const;//determines if given spell can be casted (and returns problem description)
ESpellCastProblem::ESpellCastProblembattleCanCastThisSpell(constCSpell*spell,BattleHexdestination)const;//if hero can cast spell here
ESpellCastProblem::ESpellCastProblembattleCanCreatureCastThisSpell(constCSpell*spell,BattleHexdestination)const;//determines if creature can cast a spell here
intbattleGetSurrenderCost()const;//returns cost of surrendering battle, -1 if surrendering is not possible
boolbattleCanCastSpell(ESpellCastProblem::ESpellCastProblem*outProblem=nullptr)const;//returns true, if caller can cast a spell. If not, if pointer is given via arg, the reason will be written.