Bugfixy, odstranění nepoužívaných tříd CameraSystem a ITargetingEnemy, přidání dedikované třídy ReturnToMenuElement, předělání pathfinding algoritmu z DFS na BFS, přesun správy obtížnosti do abstraktní třídy Enemy, přidání scriptů pro kompilaci na aplikaci nevyžadující dotnet

This commit is contained in:
Perry 2026-03-25 16:37:18 +01:00
parent ceac37920b
commit e5d746d597
24 changed files with 258 additions and 138 deletions

View file

@ -5,11 +5,11 @@ using PacketLib;
namespace ONDServer.Enemies;
public class SpotEnemy : Enemy {
public SpotEnemy(int difficulty) : base(difficulty) {
public SpotEnemy(int difficulty) : base(difficulty, 6000) {
path = [MapManager.Get(10), MapManager.Get(11), MapManager.Get(12), MapManager.Get(13), MapManager.Get(14)];
pathId = 2;
movementOpportunity = new(6000);
SetDifficulty(difficulty);
// movementOpportunity = new(6000);
// SetDifficulty(difficulty);
}
public override string Name{ get; } = "Spot";
@ -18,7 +18,7 @@ public class SpotEnemy : Enemy {
public bool Active{ get; set; } = false;
private MovementOpportunity movementOpportunity;
// private MovementOpportunity movementOpportunity;
private MapTile[] path;
private int pathId;
@ -26,15 +26,18 @@ public class SpotEnemy : Enemy {
private int p2WatchCounter = 0;
public override void Reset() {
if (Location.Owner != null){
Location.Owner.state.power -= 200;
}
pathId = 2;
Location = path[pathId];
Server.SendUpdateToAll([GameEvent.ENEMY_RESET(Id, Location.Id)]);
}
public override void SetDifficulty(int difficulty) {
Difficulty = difficulty;
movementOpportunity.MovementChance = (2 * Math.Sign(difficulty) + difficulty) / 12.0;
}
// public override void SetDifficulty(int difficulty) {
// Difficulty = difficulty;
// movementOpportunity.MovementChance = (2 * Math.Sign(difficulty) + difficulty) / 12.0;
// }
public override void Update() {
if (GameLogic.NSecondUpdate){
@ -52,7 +55,7 @@ public class SpotEnemy : Enemy {
if (movementOpportunity.CheckAndRoll()){
if(!Active) {
Active = true;
movementOpportunity.Interval = 12_000;
movementOpportunity.Interval = 10_000;
movementOpportunity.GuaranteeSuccess(true);
Server.SendUpdateToAll([GameEvent.SPOT_SET_ACTIVE(Id, true)]);
}