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,25 +1,25 @@
|
|||
using GlobalClassLib;
|
||||
using ONDServer.Map;
|
||||
using ONDServer.Net;
|
||||
using PacketLib;
|
||||
|
||||
namespace ONDServer.Enemies;
|
||||
|
||||
public abstract class Enemy : GlobalEnemy<MapTile, TileConnector> {
|
||||
public int Difficulty { get; protected set; }
|
||||
|
||||
protected MovementOpportunity movementOpportunity;
|
||||
|
||||
|
||||
protected Enemy(int difficulty, int movementInterval) {
|
||||
movementOpportunity = new(movementInterval);
|
||||
SetDifficulty(difficulty);
|
||||
}
|
||||
|
||||
public abstract bool BlocksTile { get; set; }
|
||||
public bool Spawned { get; set; }
|
||||
|
||||
protected OpportunityTimer MovementOpportunity;
|
||||
|
||||
protected Enemy(int difficulty, int movementInterval) {
|
||||
MovementOpportunity = new(movementInterval);
|
||||
SetDifficulty(difficulty);
|
||||
}
|
||||
|
||||
// unused
|
||||
public virtual void SpawnSilent(MapTile location) {
|
||||
Console.WriteLine($"!!! Silent spawn not implemented for enemy {TypeId} ({Name}), reverting to regular spawn");
|
||||
Console.WriteLine($"!!! Silent spawn not implemented for enemy {Type} ({Name}), reverting to regular spawn");
|
||||
Spawn(location);
|
||||
}
|
||||
|
||||
|
|
@ -31,12 +31,13 @@ public abstract class Enemy : GlobalEnemy<MapTile, TileConnector> {
|
|||
public abstract void Reset();
|
||||
|
||||
public virtual void Attack(ServerPlayer player) {
|
||||
Server.SendUpdateToAll([GameEvent.ENEMY_ATTACK(Id, player.state.pid)]);
|
||||
Server.SendUpdateToAll([GameEvent.ENEMY_ATTACK(Id, player.State.Pid)]);
|
||||
GameLogic.DeclareWinner(Server.OtherPlayer(player));
|
||||
}
|
||||
|
||||
public virtual void SetDifficulty(int difficulty) {
|
||||
if (difficulty > 10) return;
|
||||
Difficulty = difficulty;
|
||||
movementOpportunity.MovementChance = ((5 + Math.Pow(1.5f, Difficulty)) * Math.Sign(Difficulty)) / (5 + Math.Pow(1.5f, 10));
|
||||
MovementOpportunity.MovementChance = ((5 + Math.Pow(1.5f, Difficulty)) * Math.Sign(Difficulty)) / (5 + Math.Pow(1.5f, 10));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue