Oprava spawnování monster, optimalizace v CommandProcessor a EventProcessor. Přesunutí některých tříd do vlastních namespaců, pročištění kódu, úpravy formátování, odstranění nepoužívaných souborů a zakomentovaného kódu
This commit is contained in:
parent
e5d746d597
commit
243f071a43
62 changed files with 873 additions and 1217 deletions
|
|
@ -1,5 +1,6 @@
|
|||
using GlobalClassLib;
|
||||
using ONDServer.Map;
|
||||
using ONDServer.Net;
|
||||
using PacketLib;
|
||||
|
||||
namespace ONDServer.Enemies;
|
||||
|
|
@ -8,17 +9,14 @@ public class SpotEnemy : Enemy {
|
|||
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);
|
||||
}
|
||||
|
||||
public override string Name{ get; } = "Spot";
|
||||
public override int TypeId{ get; } = (int)EnemyType.SPOT;
|
||||
public override EnemyType Type{ get; } = EnemyType.SPOT;
|
||||
public override bool BlocksTile{ get; set; } = false;
|
||||
|
||||
public bool Active{ get; set; } = false;
|
||||
|
||||
// private MovementOpportunity movementOpportunity;
|
||||
private MapTile[] path;
|
||||
private int pathId;
|
||||
|
||||
|
|
@ -27,42 +25,37 @@ public class SpotEnemy : Enemy {
|
|||
|
||||
public override void Reset() {
|
||||
if (Location.Owner != null){
|
||||
Location.Owner.state.power -= 200;
|
||||
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 Update() {
|
||||
if (GameLogic.NSecondUpdate){
|
||||
if(!movementOpportunity.Running)
|
||||
movementOpportunity.Start();
|
||||
if(!MovementOpportunity.Running)
|
||||
MovementOpportunity.Start();
|
||||
|
||||
if (Active){
|
||||
if (Server.P1.state.monitorUp && Server.P1.state.camera == Location.Id) p1WatchCounter++;
|
||||
if (Server.P2.state.monitorUp && Server.P2.state.camera == Location.Id) p2WatchCounter++;
|
||||
if (Server.P1.State.MonitorUp && Server.P1.State.Camera == Location.Id) p1WatchCounter++;
|
||||
if (Server.P2.State.MonitorUp && Server.P2.State.Camera == Location.Id) p2WatchCounter++;
|
||||
|
||||
Console.WriteLine($"P1: {p1WatchCounter} | P2: {p2WatchCounter}");
|
||||
}
|
||||
}
|
||||
|
||||
if (movementOpportunity.CheckAndRoll()){
|
||||
if (MovementOpportunity.CheckAndRoll()){
|
||||
if(!Active) {
|
||||
Active = true;
|
||||
movementOpportunity.Interval = 10_000;
|
||||
movementOpportunity.GuaranteeSuccess(true);
|
||||
MovementOpportunity.Interval = 10_000;
|
||||
MovementOpportunity.GuaranteeSuccess(true);
|
||||
Server.SendUpdateToAll([GameEvent.SPOT_SET_ACTIVE(Id, true)]);
|
||||
}
|
||||
else{
|
||||
movementOpportunity.Interval = 6000;
|
||||
movementOpportunity.GuaranteeSuccess(false);
|
||||
movementOpportunity.Stop();
|
||||
MovementOpportunity.Interval = 6000;
|
||||
MovementOpportunity.GuaranteeSuccess(false);
|
||||
MovementOpportunity.Stop();
|
||||
|
||||
if (p1WatchCounter > p2WatchCounter){
|
||||
pathId++;
|
||||
|
|
@ -94,7 +87,7 @@ public class SpotEnemy : Enemy {
|
|||
|
||||
public override void Spawn(MapTile location) {
|
||||
base.Spawn(location);
|
||||
Server.SendUpdateToAll([GameEvent.ENEMY_SPAWN(TypeId, Id, Difficulty, Location.Id)]);
|
||||
Server.SendUpdateToAll([GameEvent.ENEMY_SPAWN(Type, Id, Difficulty, Location.Id)]);
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue