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
|
|
@ -18,15 +18,13 @@ public class LurkEnemy : Enemy {
|
|||
// private static readonly double CHANCE_DENOMINATOR = 2 + Math.Pow(1.5f, 10); // d10 Lurk will have a 100% chance to move
|
||||
// private double movementChance => (2 + Math.Pow(1.5f, Difficulty)) / CHANCE_DENOMINATOR; // chance scales exponentially using a constant multiplier
|
||||
|
||||
private MovementOpportunity movementOpportunity;
|
||||
|
||||
public ServerPlayer? Target{ get; set; }
|
||||
|
||||
public LurkEnemy(int difficulty) : base(difficulty) {
|
||||
public LurkEnemy(int difficulty) : base(difficulty, 5000) {
|
||||
pathfinder = new LurkPathfinder(this, 1);
|
||||
movementOpportunity = new MovementOpportunity(5000);
|
||||
// movementOpportunity = new MovementOpportunity(5000);
|
||||
Target = null;
|
||||
SetDifficulty(difficulty);
|
||||
// SetDifficulty(difficulty);
|
||||
}
|
||||
public override void Spawn(MapTile location) {
|
||||
base.Spawn(location);
|
||||
|
|
@ -37,20 +35,20 @@ public class LurkEnemy : Enemy {
|
|||
}
|
||||
|
||||
public override void Reset() {
|
||||
pathfinder.TakenPath.Clear();
|
||||
pathfinder.TakenPath.Add(Location);
|
||||
|
||||
Target.state.power -= 30;
|
||||
Target.state.power -= 80;
|
||||
|
||||
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);
|
||||
|
||||
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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue