// Fill out your copyright notice in the Description page of Project Settings.


#include "TurnBaseCombat.h"
#include "Kismet/GameplayStatics.h"

void ATurnBaseCombat::BeginPlay()
{
	Super::BeginPlay();
	TArray<AActor*> AllCharacterActorsInScene;
	UGameplayStatics::GetAllActorsOfClassWithTag(GetWorld(), AActor::StaticClass(), FName("Character"), AllCharacterActorsInScene);
	activeActionPoints = defaultActionPoints;
}

void ATurnBaseCombat::useActionPoint()
{
	activeActionPoints -= 1;
	activeActionPoints = FMath::Clamp(activeActionPoints, 0, defaultActionPoints);
}

void ATurnBaseCombat::reuseActionPoint()
{
	activeActionPoints += 1;
	activeActionPoints = FMath::Clamp(activeActionPoints, 0, defaultActionPoints);
}

void ATurnBaseCombat::revertActionPoints()
{
	activeActionPoints = defaultActionPoints;
}

void ATurnBaseCombat::switchTurn()
{
	activeActor = (isPlayerTurn) ? enemyActor : playerActor;
}