AhFight API
Integration
Section titled “Integration”<!-- Add reference in project file (.csproj) --><Reference Include="AhFight"> <HintPath>..\..\AhFight\bin\Win64_Shipping_Client\AhFight.dll</HintPath> <Private>False</Private></Reference>
using AhFight;
API Overview
Section titled “API Overview”State Checking
Section titled “State Checking”Method | Description |
---|---|
GetAgentState(Agent agent) | Get current AH state of the agent |
IsAgentInState(Agent agent, AhFightState state) | Check if agent is in specified state |
HasAhFightData(Agent agent) | Check if agent has AH data initialized |
Data Retrieval
Section titled “Data Retrieval”Method | Description |
---|---|
GetCurrentAhFight(Agent agent) | Get current AH value of the agent |
GetMaxAhFight(Agent agent) | Get maximum AH value of the agent |
GetAhFightRegen(Agent agent) | Get AH regeneration rate of the agent |
GetStateDescription(AhFightState state) | Get description text of the state |
Data Modification
Section titled “Data Modification”Method | Description |
---|---|
ModifyAhFight(Agent agent, float amount) | Modify current AH value |
ModifyMaxAhFight(Agent agent, float amount) | Modify maximum AH value |
ModifyAhFightRegen(Agent agent, float amount) | Modify AH regeneration rate |
InitializeAhFightData(Agent agent) | Initialize AH data for an agent |
UI Interface
Section titled “UI Interface”Method | Description |
---|---|
IsDefaultUIEnabled() | Check if AhFight UI is enabled |
GetAhFightView() | Get AhFightView instance |
GetMainAgentAhFightUIValue() | Player’s current AH value (UI display value) |
GetMainAgentMaxAhFightUIValue() | Get Player’s maximum AH value (UI display value) |
GetMainAgentAhFightStateText() | Get Player’s current AH state text |
Code Examples
Section titled “Code Examples”Basic Usage
Section titled “Basic Usage”// Get agent stateAhFightState state = AhFightAPI.GetAgentState(agent);
// Perform actions based on stateif (AhFightAPI.IsAgentInState(agent, AhFightState.Powerless)) { // Handle powerless state...}
// Modify AH valuefloat newValue = AhFightAPI.ModifyAhFight(agent, -5f); // Decrease by 5
Damage Modification Example
Section titled “Damage Modification Example”public float ModifyDamageBasedOnAhFight(Agent agent, float damage) { if (!AhFightAPI.HasAhFightData(agent)) return damage;
switch (AhFightAPI.GetAgentState(agent)) { case AhFightState.Normal: return damage; case AhFightState.Weak: return damage * 0.85f; case AhFightState.Tired: return damage * 0.7f; case AhFightState.Powerless: return damage * 0.5f; default: return damage; }}
State Monitoring Example
Section titled “State Monitoring Example”private AhFightState _lastState;
public void OnTick(Agent agent, float dt) { if (!AhFightAPI.HasAhFightData(agent)) return;
AhFightState currentState = AhFightAPI.GetAgentState(agent); if (currentState != _lastState) { // Handle state change OnStateChanged(agent, _lastState, currentState); _lastState = currentState; }}
UI data acquisition (for making UI)
Section titled “UI data acquisition (for making UI)”// Get current player's AH values and stateint currentAhValue = AhFightAPI.GetMainAgentAhFightUIValue();int maxAhValue = AhFightAPI.GetMainAgentMaxAhFightUIValue();string stateText = AhFightAPI.GetMainAgentAhFightStateText();
// Check if default UI is enabledbool isDefaultUIEnabled = AhFightAPI.IsDefaultUIEnabled();
// Directly access the view modelAhFightView view = AhFightAPI.GetAhFightView();if (view != null) { bool isVisible = view.ShowPlayerAhFightStatus; // Access more properties...}
Support and Contact
Section titled “Support and Contact”Discord: https://discord.gg/cjyBzW3jbn