Add rank, friends, fishing, and camp treasure with T2 studio models and skill presentation.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
#pragma once
|
||||
#include "json.hpp"
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// Deterministic combat kernel, shared by the original slice and authoritative battle adapter.
|
||||
// No wallet, HTTP, database, Unity or wall-clock dependency.
|
||||
// hp/attack: 1/1000; distance: mm; time: 50ms ticks; factors: 1/10000.
|
||||
namespace combat_slice {
|
||||
enum class Action { Damage, Shield, Heal, Slow };
|
||||
struct Effect { std::string id="main"; Action action=Action::Damage; int64_t value=0; int duration=0, bossScale=10000; };
|
||||
struct Skill {
|
||||
std::string id;
|
||||
Action action = Action::Damage;
|
||||
bool projectile = false, ability = false;
|
||||
int release = 0, recovery = 1, cooldown = 1, range = 2000, targets = 1, duration = 0;
|
||||
int64_t value = 0;
|
||||
int radius=0, bossScale=10000;
|
||||
std::string actionId="main";
|
||||
std::vector<Effect> actions;
|
||||
};
|
||||
struct Cast {
|
||||
int id=0, start=0, release=0, end=0;
|
||||
bool active=false, released=false;
|
||||
Skill skill;
|
||||
std::vector<int> targets;
|
||||
};
|
||||
struct Unit {
|
||||
int id=0, team=0, art=0, lane=0, z=0, speed=0, element=0;
|
||||
int basicReady=0, abilityReady=0, shieldExpiry=0;
|
||||
int64_t hp=0, maxHp=0, shield=0, defense=0, damage=0, absorbed=0;
|
||||
bool exited=false;
|
||||
Skill basic, ability;
|
||||
Cast cast;
|
||||
int slot=0, tier=1, spawnTick=0, leak=1, slow=10000, slowExpiry=0, skillCasts=0;
|
||||
int64_t healing=0;
|
||||
bool spawned=true, boss=false;
|
||||
bool alive() const { return spawned && hp>0 && !exited; }
|
||||
};
|
||||
struct Projectile { int cast=0, source=0, target=0, due=0; Skill skill; };
|
||||
struct Settings { int maxTicks=800, projectileSpeed=800, projectileLifetime=40; bool elements=false; int advantage=12500, disadvantage=8000; int durability=10; };
|
||||
class Battle {
|
||||
public:
|
||||
Battle(std::vector<Unit> units, Settings settings={});
|
||||
void step();
|
||||
nlohmann::json run();
|
||||
nlohmann::json trace() const;
|
||||
Unit& unit(int id);
|
||||
const std::vector<Unit>& units() const {return units_;}
|
||||
const nlohmann::json& events() const {return events_;}
|
||||
int tick() const {return tick_;}
|
||||
bool finished() const {return finished_;}
|
||||
private:
|
||||
std::vector<Unit> units_;
|
||||
std::vector<Projectile> projectiles_;
|
||||
Settings settings_;
|
||||
nlohmann::json initial_, events_=nlohmann::json::array();
|
||||
int tick_=-1, nextCast_=0;
|
||||
bool finished_=false, won_=false;
|
||||
int durability_=10, defeated_=0;
|
||||
int leaks_[3]={};
|
||||
std::vector<int> targets(const Unit&,const Skill&) const;
|
||||
void emit(nlohmann::json);
|
||||
void hit(int source,int target,int cast,const Skill&);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user