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:
parent
ceac37920b
commit
e5d746d597
24 changed files with 258 additions and 138 deletions
|
|
@ -5,13 +5,13 @@ using PacketLib;
|
|||
namespace ONDServer.Enemies;
|
||||
|
||||
public class NekoEnemy : Enemy {
|
||||
private MovementOpportunity movementOpportunity;
|
||||
// private MovementOpportunity movementOpportunity;
|
||||
private RoamingPathfinder pathfinder;
|
||||
|
||||
public NekoEnemy(int difficulty) : base(difficulty) {
|
||||
public NekoEnemy(int difficulty) : base(difficulty, 4000) {
|
||||
pathfinder = new RoamingPathfinder(this, 1){AdditionalTileFilter = t => Aggressive || t.Owner == null || !t.Lit};
|
||||
movementOpportunity = new MovementOpportunity(5000);
|
||||
SetDifficulty(difficulty);
|
||||
// movementOpportunity = new MovementOpportunity(5000);
|
||||
// SetDifficulty(difficulty);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -33,19 +33,20 @@ public class NekoEnemy : Enemy {
|
|||
}
|
||||
|
||||
public override void Reset() {
|
||||
pathfinder.TakenPath.Clear();
|
||||
MapTile[] resetLocations = new[]{MapManager.Get(7), MapManager.Get(12), MapManager.Get(17)}.Where(t => EnemyManager.GetByLocation(t).Length == 0).ToArray();
|
||||
Location = resetLocations[new Random().Next(resetLocations.Length)];
|
||||
pathfinder.TakenPath.Clear();
|
||||
pathfinder.TakenPath.Add(Location);
|
||||
Aggressive = false;
|
||||
Target = Server.OtherPlayer(Target);
|
||||
Server.SendUpdateToAll([GameEvent.ENEMY_RESET(Id, Location.Id)]);
|
||||
}
|
||||
|
||||
public override void SetDifficulty(int difficulty) {
|
||||
Difficulty = difficulty;
|
||||
movementOpportunity.MovementChance =
|
||||
((5 + Math.Pow(1.5f, Difficulty)) * Math.Sign(Difficulty)) / (5 + Math.Pow(1.5f, 10));
|
||||
}
|
||||
// public override void SetDifficulty(int difficulty) {
|
||||
// Difficulty = difficulty;
|
||||
// movementOpportunity.MovementChance =
|
||||
// ((5 + Math.Pow(1.5f, Difficulty)) * Math.Sign(Difficulty)) / (5 + Math.Pow(1.5f, 10));
|
||||
// }
|
||||
|
||||
public override void Update() {
|
||||
base.Update();
|
||||
|
|
@ -70,7 +71,8 @@ public class NekoEnemy : Enemy {
|
|||
}
|
||||
}
|
||||
|
||||
if (Target != null && (movementOpportunity.CheckAndRoll() || (Aggressive && GameLogic.NSecondUpdate))){
|
||||
bool succeed = movementOpportunity.CheckAndRoll();
|
||||
if (Target != null && (succeed || (Aggressive && GameLogic.NSecondUpdate))){
|
||||
Pathfinder.Decision decision = pathfinder.DecideNext(MapManager.Get(Target.state.officeTileId));
|
||||
switch (decision.type){
|
||||
case Pathfinder.Decision.MoveType:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue