// constant namespace holds the required constants
// that are used in various game mechanics' formulas
// there are different constants that belong to different parts of the game mechanics
// they are grouped under different name spaces

#pragma once
#include "../Basic.h"
#include <Resource/DataArray.h>
#include <string>
#include <vector>

namespace assets
{
	namespace constants
	{
		static const float timeConst = 0.2f;

		namespace general
		{
			extern float TBCapDenominator;
			extern float wildlingDaySight;
			extern float wildlingNightSight;
			extern float wildlingWanderRangeDenominator;
			extern float wildlingWanderRangeMultiplier;
			extern float retryDelay;
			extern std::string maleTitle;
			extern std::string femaleTitle;
			extern Range wanderRange;
			extern float townCenterSight;
			extern float buildRange;
			extern float denRange;
			extern float pathingLimitMargin;

			void load(gge::resource::DataArray &dataArray);
		}

		namespace stats
		{
			extern int   minStat;
			extern int   maxStat;
			extern int   maxLvl;
			extern float walkingStaminaDrainRate;
			extern float joggingStaminaDrainRate;
			extern float runningStaminaDrainRate;

			void load(gge::resource::DataArray &dataArray);
		}

		namespace crafting
		{
			extern float base;
			extern float strMultiplier;
			extern float dexMultiplier;
			extern float intlMultiplier;
			extern float lvlMultiplier;

			void load(gge::resource::DataArray &dataArray);
		}

		namespace gold
		{
			extern float base;
			extern float lvlMultiplier;
			extern float lvlSqrMultiplier;
			extern float soldierGoldCost;
			extern float artisanGoldCost;

			void load(gge::resource::DataArray &dataArray);
		}

		namespace happiness
		{
			extern float base;
			extern float taxRateMultiplier;
			extern float populationMultiplier;
			extern float differenceDenominator;
			extern float timeMultiplier1;
			extern float timeMultiplier2;
			extern float populationLim;
			extern float currentHappinessModifier;
			extern float currentHappinessMultiplier;

			//
			extern float happinesDeathModifier;


			void load(gge::resource::DataArray &dataArray);
		}

		namespace combat
		{
			extern float dodgeChanceModifier;
			extern float parryCDModifier;
			extern float blockChanceModifier;
			extern float staggerStrDenominator;
			extern float staggerVitDenominator;
			extern float staggerMultiplier;
			extern float staggerStaminaDenominator;
			extern float staggerAtckCDDenominator;
			extern float staggerEffectivenessModifier;
			extern float armorPierceEffectivenessModifier;
			extern float overshootTimeMultiplier;
			extern int   archerMinRange; // tile based range
			extern float rangedAttackEffectivenessModifier;
			extern float rangedMissChanceDenominator;
			extern float rangedMissChanceAccMultiplier;
			extern float rangedMissChanceLvlMultiplier;

			void load(gge::resource::DataArray &dataArray);
		}

		namespace human
		{
			extern float HPBase;
			extern float HPVitMultiplier;
			extern float HPLvlMultiplier;
			extern float staminaBase;
			extern float staminaVitMultiplier;
			extern float staminaStrMultiplier;
			extern float staminaLvlMultiplier;
			extern float movementBase;
			extern float movementSpeMultiplier;
			extern float movementLvlMultiplier;
			extern float daySightBase;
			extern float daySightVitMultiplier;
			extern float daySightIntlMultiplier;
			extern float daySightLvlMultiplier;
			extern float nightSightBase;
			extern float nightSightVitMultiplier;
			extern float nightSightIntlMultiplier;
			extern float nightSightLvlMultiplier;
			extern Stat  femaleStats;
			extern Stat  maleStats;
			extern float statDenominator;
			extern std::vector<std::string> maleNames;
			extern std::vector<std::string> femaleNames;
			extern std::vector<std::string> surnames;
			//
			extern float dogdgeBase;
			extern float dodgeAccMultiplier;
			extern float dodgeIntlMultiplier;
			extern float dodgeLvlMultiplier;
			

			void load(gge::resource::DataArray &dataArray);
			void readAndWriteNames(const std::ifstream &data);
		}

		namespace leveling
		{
			extern float XPIntlModifier;
			extern float XPIntlDenominator;
			extern int   soldierLvlCap;
			extern int   artisanLvlCap;
			extern float nextLvlBase;
			extern float nextLvlIncrement;
			extern float nextLvlMultiplier;
			//
			extern float XPMultiplier;

			void load(gge::resource::DataArray &dataArray);
		}
	}
}