Files
systemrevivalserver/Game/Dungeon/ProjectileInstance.cs
T
2026-01-19 11:07:24 -05:00

122 lines
3.4 KiB
C#

namespace GameServer.Dungeon;
public enum ProjectileSource
{
Mob,
Player
}
/// <summary>
/// A projectile in flight
/// </summary>
public class ProjectileInstance
{
public int Id { get; set; }
// Source tracking
public ProjectileSource SourceType { get; set; }
public int SourceMobId { get; set; } // Used when SourceType = Mob
public ulong SourcePlayerId { get; set; } // Used when SourceType = Player
public int AbilityId { get; set; } // For mob abilities
public float X { get; set; }
public float Y { get; set; }
public float VelocityX { get; set; }
public float VelocityY { get; set; }
public float Speed { get; set; }
public float TargetX { get; set; }
public float TargetY { get; set; }
public int Damage { get; set; }
public string DamageTypeKey { get; set; } = "physical";
public float AoeRadius { get; set; }
public float DistanceTraveled { get; set; }
public float MaxRange { get; set; } = 500f;
public string SpriteKey { get; set; } = "projectile_default";
/// <summary>
/// Whether projectile uses linear rendering (front/back coordinates) or spins
/// </summary>
public bool IsLinear { get; set; } = false;
/// <summary>
/// X coordinate of arrow tip (front) in sprite
/// </summary>
public int FrontX { get; set; } = 0;
/// <summary>
/// Y coordinate of arrow tip (front) in sprite
/// </summary>
public int FrontY { get; set; } = 0;
/// <summary>
/// X coordinate of arrow tail (back) in sprite
/// </summary>
public int BackX { get; set; } = 0;
/// <summary>
/// Y coordinate of arrow tail (back) in sprite
/// </summary>
public int BackY { get; set; } = 0;
// Player projectile properties
/// <summary>
/// Item definition ID of the ammunition used (for recovery)
/// Null if not recoverable (mob projectiles, throwables that don't recover)
/// </summary>
public int? AmmunitionItemDefinitionId { get; set; }
/// <summary>
/// Recovery chance (0.0 to 1.0) for this specific projectile
/// </summary>
public float RecoveryChance { get; set; } = 0.05f;
/// <summary>
/// Whether this projectile can hit players (for PvP)
/// </summary>
public bool CanHitPlayers { get; set; } = false;
/// <summary>
/// Whether this projectile can hit mobs
/// </summary>
public bool CanHitMobs { get; set; } = true;
}
/// <summary>
/// A persistent damage zone on the ground
/// </summary>
public class HazardZone
{
public int Id { get; set; }
public int SourceMobId { get; set; }
public float X { get; set; }
public float Y { get; set; }
public float Radius { get; set; }
public int DamagePerTick { get; set; }
public float TickInterval { get; set; }
public float NextTickIn { get; set; }
public float Duration { get; set; }
public string DamageTypeKey { get; set; } = "fire";
public string VisualKey { get; set; } = "hazard_default";
}
/// <summary>
/// Event when an ability is used (for client animations)
/// </summary>
public class AbilityEvent
{
public EntityType SourceType { get; set; }
public int SourceId { get; set; }
public string AbilityKey { get; set; } = "";
public string AnimationKey { get; set; } = "attack";
public float TargetX { get; set; }
public float TargetY { get; set; }
public int? TargetId { get; set; }
}