

#pragma once

#include <iostream>
#include <cstring>
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include "PublicFun.h"
#include "FightMap.h"
#include "FightHero.h"
#include "Menu.h"
#include "Head.h"

class Fight
{

public:

	void PubInit(int choice);
	void InitData(int heronumber,int zujiang,int cityto,int foods);
	int KeyDown(WPARAM KeyCode);
	void Show(int g);
	void ShowWeather();
	int ShowDay();
	void ShowBar();
	void ShowWeatherBar();
	void ShowGround();
	void GameEnd(int result);
	//void InitWujiangData();
	void ShowUpName(int x);
	void ShowArmyNumber(int x);
	void ShowAllOf();
	int CanArrive();
	void SetArrive(int xx,int yy,int x);
	int DayEvent();
	void SetAt(int xx,int yy,int x);
	void GetLifeSkillAtDf();
	void ShowInformation(int x,int tpheroat);
	void SetAtSkill(int xx,int yy,int x,int y);
	int CanAt(int t);
	int WeatherOK(int x);
	int LandOK(int x,int flag);
	int SkillForceOK(int x);
	void SubSkillPower(int x);
	void CountAtkHurt();
	int CountSklHurt();
	int FightEvent();
	void ShowHurt(int hurt,int exp);
	void ShowSkillHurt(int hurt,int exp);
	int GetExp(int hurt);
	int GetSkill();
	void ChangeStatue(int x);
	void ShowLevelUp();
	void ShowDeath();
	int TestWinLose();
	int AIRun();
	void AIShowMoveArrange();
	void AIMoveHero();
	int AIAtEnable();
	int AISkillEnable();
	void AISleepyHero();
	int AIGetRange(int type ,int id);
	int AICountAtHurtBefore(int aimat);//用于一个个计算伤害
	int AICountSkillHurtBefore(int aimat,int id);//用于一个个计算伤害
	void AICountAtHurt();
	int AICountSkillHurt(int id);
	int AICanUseSkill(int id);
	int AILandOK(int x);
	int AISkillOK(int x);
	void AIShowSkillHurt(int hurt,int exp,int id,int tpheroat);
	void AIShowAtHurt(int hurt,int exp,int tpheroat);
	void AIGetAtDf(int ox,int oy,int xx,int yy,int tpheroat);
	void AIShowLevelUp();
	void AIShowDeath(int tpheroat);
	void AIShowArrowAt(int tpheroat);
	void CheckForceBefore();
	void ShowHurt2(int x,int hurt);
	int DelTimeEvent();
	int CheckNoFlag();
	int UseSkill(WPARAM KeyCode);
	int SetIfShowFight(WPARAM KeyCode);
	int SetMoveSpeed(WPARAM KeyCode);
	int SetIfShowMove(WPARAM KeyCode);
	int DelHero(WPARAM KeyCode);
	int SysMenu(WPARAM KeyCode);
	int HeroStatusDel(WPARAM KeyCode);
	int DynamicShow();
	int BattlefieldStatusShow(int flagstat);
	int HeroStatusShow(int flagstat);
	int TerrainStatusShow();
	int ArrowRangeShow(int type);
	int SpyResultShow();
	int WeatherChangeSkillShow();
	int HeroShow();
	int InitAffact();
	int InitMapStyle();
	int InitSkill();

	//private:
	int day;
	int foods;
	int allbingli;
	int allbinglito;
	int zujiang;
	int heronumber;
	//int otherwj[9];
	int citynumber;

	int owner;//我方君主
	int ownerto;//敌方君主

	int weather;
	int gongfang;//0-攻，1防

	int foodsto;
	int zujiangto;
	int heronumberto;

	int starty;//显示武将兵力时开始的值
	int starty1;
	int citynumfrom;

	FightMap fightmap;
	FightHero fighthero[20];
	Menu menufight;
	Menu menushow;
	Menu menuspeed;
	Menu menumove;
	Menu menuhero;
	Head headfight;

	int uchoice;
	int num;
	int flagmenu;
	int flagstat;

	int flaggetfoodamount;
	int flagmenuhero;
	int flagarrowmov;
	int flagarrowat;
	int flagshowskill;
	int flagarrowskill;

	int flagmenushow;
	int flagmenumov;
	int flagmenuspeed;

	int warstyle;//0-进攻 1-防守

	double atfact[LANDSTYLEMAX][HEROTYPEMAX];
	double dffact[LANDSTYLEMAX][HEROTYPEMAX];
	int movecaculate[LANDSTYLEMAX+1][HEROTYPEMAX];
	double SubduModu[HEROTYPEMAX][HEROTYPEMAX];
	int c_of[MAPMAX][MAPMAX];
	int to[MAPMAX][MAPMAX];
	int skilltp[SKILLMAX][SKILLLEN];

	int tmpposflag;
};
