Fix Mob Spawn
This commit is contained in:
@@ -163,6 +163,7 @@ public class ViewModel : AdminPageModel
|
|||||||
return new JsonResult(new { error = "Mob definition not found" }) { StatusCode = 404 };
|
return new JsonResult(new { error = "Mob definition not found" }) { StatusCode = 404 };
|
||||||
int mobId = dungeon.Simulation.Mobs.Count + 1;
|
int mobId = dungeon.Simulation.Mobs.Count + 1;
|
||||||
var stats = mobDef.GetStatsForBracket(dungeon.LevelBracketMin);
|
var stats = mobDef.GetStatsForBracket(dungeon.LevelBracketMin);
|
||||||
|
var rng = new Random(dungeon.LayoutV2.Seed);
|
||||||
// Create a new mob instance
|
// Create a new mob instance
|
||||||
var mob = new MobInstance
|
var mob = new MobInstance
|
||||||
{
|
{
|
||||||
@@ -172,12 +173,15 @@ public class ViewModel : AdminPageModel
|
|||||||
Type = mobDef.Type,
|
Type = mobDef.Type,
|
||||||
X = x,
|
X = x,
|
||||||
Y = y,
|
Y = y,
|
||||||
|
SpawnX = x,
|
||||||
|
SpawnY = y,
|
||||||
Health = stats.MaxHealth,
|
Health = stats.MaxHealth,
|
||||||
MaxHealth = stats.MaxHealth,
|
MaxHealth = stats.MaxHealth,
|
||||||
Mana = mobDef.BaseMana,
|
Mana = mobDef.BaseMana,
|
||||||
MaxMana = mobDef.BaseMana,
|
MaxMana = mobDef.BaseMana,
|
||||||
Stats = stats,
|
Stats = stats,
|
||||||
State = MobState.Idle,
|
State = MobState.Idle,
|
||||||
|
StateTime = (float)(rng.NextDouble() * 3f),
|
||||||
SpriteConfigJson = mobDef.SpriteConfigJson,
|
SpriteConfigJson = mobDef.SpriteConfigJson,
|
||||||
TintColor = mobDef.TintColor,
|
TintColor = mobDef.TintColor,
|
||||||
Scale = mobDef.Scale,
|
Scale = mobDef.Scale,
|
||||||
|
|||||||
Reference in New Issue
Block a user