// Project Lab - NHTV Igad

#pragma once

#include "Creatures/NPCBase.h"
#include "EnemyBase.generated.h"

/**
 *
 */

UCLASS()
class UNREALPROJECT_API AEnemyBase : public ANPCBase
{
	GENERATED_BODY()
public:
	AEnemyBase();
	virtual void BeginPlay() override;
	virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
	virtual void Tick(float deltaTime) override;
	virtual int32 NativeDealDamage(class ANetworkCharacter* dealer, int32 damage, float armorPercentageIgnore, class UAbilityInfo* ability) override;
	
	void OffensiveBehavior();
	void RangedBehavior();
	void ChargeBehavior();
	void InformGeneral();
	void SwitchAgro();
	void ConfusionBehavior();
	void ResetConfusionTimer(float confusionTime);
    UPROPERTY(EditAnywhere, Category = Behavior)
    class UBehaviorTree* treeBehavior;
	UPROPERTY(EditAnywhere, Category = "Attack Settings")
	float informGeneralTime;
	UPROPERTY(EditAnywhere, Category = "Ability Settings")
	class UAbilityInfo* specialAbility;
	UPROPERTY(EditAnywhere, Category = "Ability Settings")
	class UAbilityInfo* meleeAbility;
	UPROPERTY(EditAnywhere, Category = "Ability Settings")
	class UAbilityInfo* rangedAbility;
	UPROPERTY(EditAnywhere, Category = "Ability Settings")
	float specialAbilityChance;
	FVector scatterLocation;
	bool hasGeneral;
	bool finnishedAttack;
	bool hasSpawned;
	UPROPERTY()
	class AEnemyAIController* enemycontroller;
	UPROPERTY()
	class AGeneralEnemy* general;
	UPROPERTY()
	ANetworkCharacter* m_tempTarget;
protected:
	float m_ReCalcChance(float chance);
	bool m_rotateToPlayer;
	float m_lastPercentage;
	class UAbilityInfo* m_tempAbility;
	float m_informGeneralTimer;
	float m_confusionTimer;

};
