You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
82 lines
2.3 KiB
82 lines
2.3 KiB
2 years ago
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||
|
|
||
|
#pragma once
|
||
|
|
||
|
#include "CoreMinimal.h"
|
||
|
#include "Math/UnrealMathUtility.h"
|
||
|
#include "Containers/Array.h"
|
||
|
|
||
|
/**
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
namespace basic_api_classes {
|
||
|
|
||
|
struct base_ability {
|
||
|
const double cost;
|
||
|
const double damage;
|
||
|
const double splash_radius;
|
||
|
const double linear_width;
|
||
|
const double max_activation_radius;
|
||
|
base_ability(double cost_, double damage_, double max_activation_radius_, double splash_radius_, double linear_width_);
|
||
|
bool is_pers_hurt(double attacker_x, double attacker_y, double activation_x, double activation_y, double defender_x, double defender_y);
|
||
|
~base_ability();
|
||
|
};
|
||
|
|
||
|
|
||
|
struct base_personage {
|
||
|
private:
|
||
|
bool is_dead;
|
||
|
double x_coordinate;
|
||
|
double y_coordinate;
|
||
|
double hitpoints;
|
||
|
const double travel_cost;
|
||
|
public:
|
||
|
const TArray<base_ability*> abilities;
|
||
|
base_personage(double x_, double y_, double hp, double trav_cost, TArray<base_ability*>&& abils);
|
||
|
FVector2D get_personage_cords() const;
|
||
|
double get_hitpoints() const;
|
||
|
void move_to_position(double new_x, double new_y, double& rest_action_points);
|
||
|
void accept_damage(double damage);
|
||
|
bool is_attack_startable(size_t ability_number, double attack_pos_x, double attack_pos_y, double rest_action_points) const;
|
||
|
bool is_pers_dead() const;
|
||
|
~base_personage();
|
||
|
};
|
||
|
|
||
|
struct base_player {
|
||
|
const TArray<base_personage*> team;
|
||
|
base_player(TArray<base_personage*>&& team_);
|
||
|
~base_player();
|
||
|
};
|
||
|
|
||
|
|
||
|
struct BasicTurnManager
|
||
|
{
|
||
|
private:
|
||
|
bool first_player_motion;
|
||
|
const base_player* player1;
|
||
|
const base_player* player2;
|
||
|
int motion_number;
|
||
|
const double action_points;
|
||
|
double current_player_action_points;
|
||
|
size_t team1_alive;
|
||
|
size_t team2_alive;
|
||
|
const double x_min;
|
||
|
const double x_max;
|
||
|
const double y_min;
|
||
|
const double y_max;
|
||
|
bool check_correctness(double x, double y) const;
|
||
|
public:
|
||
|
BasicTurnManager(base_player* player1_, base_player* player2_, double points_per_move, double x_min_, double x_max_, double y_min_, double y_max_);
|
||
|
void move_command(size_t pers_num, double new_x, double new_y);
|
||
|
void attack_command(size_t pers_num, size_t abil_num, double attack_x, double attack_y);
|
||
|
void next_move();
|
||
|
int get_move_number() const;
|
||
|
bool is_first_player_move() const;
|
||
|
size_t first_team_alive() const;
|
||
|
size_t second_team_alive() const;
|
||
|
~BasicTurnManager();
|
||
|
};
|
||
|
|
||
|
}
|