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,21 +1,19 @@
|
|||
using System.Net.Mime;
|
||||
using GlobalClassLib;
|
||||
using ONDServer.Map;
|
||||
using ONDServer.Net;
|
||||
using PacketLib;
|
||||
|
||||
namespace ONDServer.Enemies;
|
||||
|
||||
public class DashEnemy : Enemy {
|
||||
public DashEnemy(int difficulty) : base(difficulty, 5000) {
|
||||
movementOpportunity = new(5000);
|
||||
MovementOpportunity = new(5000);
|
||||
SetDifficulty(difficulty);
|
||||
}
|
||||
|
||||
public override string Name{ get; } = "Dash";
|
||||
public override int TypeId{ get; } = (int)EnemyType.DASH;
|
||||
public override EnemyType Type{ get; } = EnemyType.DASH;
|
||||
public override bool BlocksTile{ get; set; } = false;
|
||||
|
||||
// private MovementOpportunity movementOpportunity;
|
||||
|
||||
private readonly (MapTile tile, Direction p1AttackDir, Direction p2AttackDir)[] positions =[
|
||||
(MapManager.Get(7), Direction.EAST, Direction.WEST),
|
||||
|
|
@ -34,11 +32,6 @@ public class DashEnemy : Enemy {
|
|||
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 Spawn(MapTile location) {
|
||||
currentPosIndex = positions.ToList().FindIndex(p => p.tile == location);
|
||||
if (currentPosIndex == -1){
|
||||
|
|
@ -47,16 +40,16 @@ public class DashEnemy : Enemy {
|
|||
}
|
||||
base.Spawn(location);
|
||||
|
||||
movementOpportunity.Start();
|
||||
Server.SendUpdateToAll([GameEvent.ENEMY_SPAWN(TypeId, Id, Difficulty, Location.Id)]);
|
||||
MovementOpportunity.Start();
|
||||
Server.SendUpdateToAll([GameEvent.ENEMY_SPAWN(Type, Id, Difficulty, Location!.Id)]);
|
||||
}
|
||||
|
||||
public override void Update() {
|
||||
base.Update();
|
||||
|
||||
if (movementOpportunity.CheckAndRoll()){
|
||||
bool attackP1 = !Server.P1.state.doorStates[(int)positions[currentPosIndex].p1AttackDir];
|
||||
bool attackP2 = !Server.P2.state.doorStates[(int)positions[currentPosIndex].p2AttackDir];
|
||||
if (MovementOpportunity.CheckAndRoll()){
|
||||
bool attackP1 = !Server.P1.State.DoorStates[(int)positions[currentPosIndex].p1AttackDir];
|
||||
bool attackP2 = !Server.P2.State.DoorStates[(int)positions[currentPosIndex].p2AttackDir];
|
||||
|
||||
if (attackP1 != attackP2){
|
||||
if(attackP1) Attack(Server.P1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue