All Monsters now move
This commit is contained in:
@@ -89,7 +89,7 @@ namespace DepthsBelow.Component
|
|||||||
|
|
||||||
public int Penalty(int distance)
|
public int Penalty(int distance)
|
||||||
{
|
{
|
||||||
return panic + GetPenalty(stepsTaken) + (int)(GetPenalty(distance) / 2);
|
return panic/* + GetPenalty(stepsTaken)*/ + (int)(GetPenalty(distance));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Stat(Entity parent)
|
public Stat(Entity parent)
|
||||||
|
|||||||
@@ -146,13 +146,15 @@ namespace DepthsBelow
|
|||||||
|
|
||||||
if (core.TurnManager.CurrentTurn == core.TurnManager["Computer"])
|
if (core.TurnManager.CurrentTurn == core.TurnManager["Computer"])
|
||||||
{
|
{
|
||||||
core.TestMonster.step = 0;
|
foreach (var enemy in core.Swarm)
|
||||||
|
{
|
||||||
|
enemy.step = 0;
|
||||||
Point target = Point.Zero;
|
Point target = Point.Zero;
|
||||||
float distance = 7000;
|
float distance = 7000;
|
||||||
foreach (var unit in core.Squad)
|
foreach (var unit in core.Squad)
|
||||||
{
|
{
|
||||||
Vector2 soldier = new Vector2(unit.Transform.Grid.X, unit.Transform.Grid.Y);
|
Vector2 soldier = new Vector2(unit.Transform.Grid.X, unit.Transform.Grid.Y);
|
||||||
Vector2 monster = new Vector2(core.TestMonster.Transform.Grid.X, core.TestMonster.Transform.Grid.Y);
|
Vector2 monster = new Vector2(enemy.Transform.Grid.X, enemy.Transform.Grid.Y);
|
||||||
|
|
||||||
float newDistance = Vector2.Distance(soldier, monster);
|
float newDistance = Vector2.Distance(soldier, monster);
|
||||||
|
|
||||||
@@ -162,9 +164,30 @@ namespace DepthsBelow
|
|||||||
distance = newDistance;
|
distance = newDistance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
core.TestMonster.GetComponent<Component.PathFinder>().Goal = target;
|
enemy.GetComponent<Component.PathFinder>().Goal = target;
|
||||||
distance = 7000;
|
distance = 7000;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
core.TestMonster.step = 0;
|
||||||
|
Point testTarget = Point.Zero;
|
||||||
|
float testDistance = 7000;
|
||||||
|
foreach (var unit in core.Squad)
|
||||||
|
{
|
||||||
|
Vector2 soldier = new Vector2(unit.Transform.Grid.X, unit.Transform.Grid.Y);
|
||||||
|
Vector2 monster = new Vector2(core.TestMonster.Transform.Grid.X, core.TestMonster.Transform.Grid.Y);
|
||||||
|
|
||||||
|
float newDistance = Vector2.Distance(soldier, monster);
|
||||||
|
|
||||||
|
if (newDistance < testDistance)
|
||||||
|
{
|
||||||
|
testTarget = unit.Transform.Grid;
|
||||||
|
testDistance = newDistance;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
core.TestMonster.GetComponent<Component.PathFinder>().Goal = testTarget;
|
||||||
|
testDistance = 7000;
|
||||||
|
|
||||||
core.TurnManager.EndTurn();
|
core.TurnManager.EndTurn();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,6 +69,17 @@ namespace DepthsBelow
|
|||||||
// HACK: Make this work properly with other speeds...
|
// HACK: Make this work properly with other speeds...
|
||||||
float speed = 4f;
|
float speed = 4f;
|
||||||
Transform.World.Position += speed * direction;
|
Transform.World.Position += speed * direction;
|
||||||
|
|
||||||
|
foreach (var entity in entityManager.Entities)
|
||||||
|
{
|
||||||
|
if (entity is SmallEnemy)
|
||||||
|
{
|
||||||
|
if (this.GetComponent<Component.Collision>().Rectangle.Intersects(entity.GetComponent<Component.Collision>().Rectangle))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -36,7 +36,7 @@ namespace DepthsBelow
|
|||||||
//Console.WriteLine(chanceToHit);
|
//Console.WriteLine(chanceToHit);
|
||||||
return chanceToHit;
|
return chanceToHit;
|
||||||
}
|
}
|
||||||
/*public static bool HitTest(Entity attacker, Entity defender, int chanceToHit)
|
public static bool HitTest(Entity attacker, Entity defender, int chanceToHit)
|
||||||
{
|
{
|
||||||
Component.Stat shooting = attacker.GetComponent<Component.Stat>();
|
Component.Stat shooting = attacker.GetComponent<Component.Stat>();
|
||||||
Component.Stat dodging = defender.GetComponent<Component.Stat>();
|
Component.Stat dodging = defender.GetComponent<Component.Stat>();
|
||||||
@@ -47,7 +47,7 @@ namespace DepthsBelow
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}*/
|
}
|
||||||
private static Texture2D blank;
|
private static Texture2D blank;
|
||||||
|
|
||||||
public static void DrawLine(SpriteBatch batch, Color color, float width, Vector2 start, Vector2 end)
|
public static void DrawLine(SpriteBatch batch, Color color, float width, Vector2 start, Vector2 end)
|
||||||
|
|||||||
Reference in New Issue
Block a user