Merge branch 'master' of github.com:sippeangelo/DepthsBelow
Conflicts: DepthsBelow/DepthsBelow/KeyboardInput.cs DepthsBelow/DepthsBelow/MouseInput.cs DepthsBelow/DepthsBelow/Soldier.cs DepthsBelow/DepthsBelow/Utility.cs
This commit is contained in:
@@ -42,7 +42,13 @@ namespace DepthsBelow.Component
|
|||||||
public int GetAim
|
public int GetAim
|
||||||
{
|
{
|
||||||
get { return soldierAim + weaponAccuracy; }
|
get { return soldierAim + weaponAccuracy; }
|
||||||
set { soldierAim = value; }
|
set { weaponAccuracy = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public int GetStep
|
||||||
|
{
|
||||||
|
get { return stepsTaken; }
|
||||||
|
set { stepsTaken = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetDodge
|
public int GetDodge
|
||||||
@@ -100,7 +106,8 @@ namespace DepthsBelow.Component
|
|||||||
int penalty = 0;
|
int penalty = 0;
|
||||||
if (distance >= penaltyRange * 3)
|
if (distance >= penaltyRange * 3)
|
||||||
{
|
{
|
||||||
penalty = 100;
|
distance -= penaltyRange * 3;
|
||||||
|
penalty = penaltyRange + penaltyRange * 3 + penaltyRange * 5 + distance * 10;
|
||||||
}
|
}
|
||||||
else if (distance >= penaltyRange * 2)
|
else if (distance >= penaltyRange * 2)
|
||||||
{
|
{
|
||||||
|
|||||||
Regular → Executable
+2
-2
@@ -184,7 +184,7 @@ namespace DepthsBelow
|
|||||||
{
|
{
|
||||||
if (soldier.Selected == true && soldier.Fired == false)
|
if (soldier.Selected == true && soldier.Fired == false)
|
||||||
{
|
{
|
||||||
core.Volley.Add(new Shot(core.EntityManager));
|
core.Volley.Add(new Shot(core.EntityManager, soldier.GetComponent<Component.Stat>()));
|
||||||
soldier.Fired = true;
|
soldier.Fired = true;
|
||||||
foreach (var shot in core.Volley)
|
foreach (var shot in core.Volley)
|
||||||
{
|
{
|
||||||
@@ -241,7 +241,7 @@ namespace DepthsBelow
|
|||||||
current = 0;
|
current = 0;
|
||||||
if (soldier.Selected == true && soldier.Fired == false && hit == true)
|
if (soldier.Selected == true && soldier.Fired == false && hit == true)
|
||||||
{
|
{
|
||||||
core.Volley.Add(new Shot(core.EntityManager));
|
core.Volley.Add(new Shot(core.EntityManager, soldier.GetComponent<Component.Stat>()));
|
||||||
soldier.Fired = true;
|
soldier.Fired = true;
|
||||||
foreach (var shot in core.Volley)
|
foreach (var shot in core.Volley)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -173,6 +173,21 @@ namespace DepthsBelow
|
|||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
//Calculating chance to hit if holding cursor over enemy
|
||||||
|
foreach (var unit in core.Squad)
|
||||||
|
{
|
||||||
|
if (unit.Selected == true && unit.Fired == false)
|
||||||
|
{
|
||||||
|
foreach (var enemy in core.Swarm)
|
||||||
|
{
|
||||||
|
if (gridRectangle.Intersects(enemy.GetComponent<Component.Collision>().Rectangle))
|
||||||
|
{
|
||||||
|
Console.WriteLine(Utility.CalculateHitChance(unit, enemy));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// When the mouse is released
|
// When the mouse is released
|
||||||
/*if (ms.LeftButton == ButtonState.Released && selectionRectangle != Rectangle.Empty)
|
/*if (ms.LeftButton == ButtonState.Released && selectionRectangle != Rectangle.Empty)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,6 +14,14 @@ namespace DepthsBelow
|
|||||||
public Color Color;
|
public Color Color;
|
||||||
public static Point Origin;
|
public static Point Origin;
|
||||||
|
|
||||||
|
Stat soldierStat;
|
||||||
|
|
||||||
|
public Stat Stat
|
||||||
|
{
|
||||||
|
get { return soldierStat; }
|
||||||
|
set { soldierStat = value; }
|
||||||
|
}
|
||||||
|
|
||||||
private bool _selected = false; //I guess as in "currently doing something"
|
private bool _selected = false; //I guess as in "currently doing something"
|
||||||
|
|
||||||
public bool select
|
public bool select
|
||||||
@@ -29,7 +37,7 @@ namespace DepthsBelow
|
|||||||
|
|
||||||
public Vector2 direction = Vector2.Zero;
|
public Vector2 direction = Vector2.Zero;
|
||||||
|
|
||||||
public Shot(EntityManager entityManager)
|
public Shot(EntityManager entityManager, Stat _soldierStat)
|
||||||
: base(entityManager)
|
: base(entityManager)
|
||||||
{
|
{
|
||||||
if (Texture == null)
|
if (Texture == null)
|
||||||
@@ -37,6 +45,8 @@ namespace DepthsBelow
|
|||||||
|
|
||||||
Transform.World.Origin = new Vector2(16, 16);
|
Transform.World.Origin = new Vector2(16, 16);
|
||||||
|
|
||||||
|
Stat = _soldierStat;
|
||||||
|
|
||||||
this.Color = Color.White;
|
this.Color = Color.White;
|
||||||
var rc = new SpriteRenderer(this) { Texture = Texture, Color = Color.White };
|
var rc = new SpriteRenderer(this) { Texture = Texture, Color = Color.White };
|
||||||
AddComponent(rc);
|
AddComponent(rc);
|
||||||
|
|||||||
Regular → Executable
+5
-4
@@ -33,7 +33,7 @@ namespace DepthsBelow
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int numberOfSteps = 14;
|
public int numberOfSteps = 14;
|
||||||
public int currentStep = 0;
|
int currentStep = 0;
|
||||||
|
|
||||||
public int step
|
public int step
|
||||||
{
|
{
|
||||||
@@ -41,6 +41,7 @@ namespace DepthsBelow
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
currentStep = value;
|
currentStep = value;
|
||||||
|
GetComponent<Component.Stat>().GetStep = currentStep;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,7 +71,7 @@ namespace DepthsBelow
|
|||||||
//Life = 10,
|
//Life = 10,
|
||||||
Defence = 10,
|
Defence = 10,
|
||||||
Strength = 10,
|
Strength = 10,
|
||||||
GetAim = 10,
|
GetAim = 40,
|
||||||
GetDodge = 20
|
GetDodge = 20
|
||||||
};
|
};
|
||||||
AddComponent(stat);
|
AddComponent(stat);
|
||||||
@@ -146,9 +147,9 @@ namespace DepthsBelow
|
|||||||
|
|
||||||
if (Transform.World == nodeWorldPos)
|
if (Transform.World == nodeWorldPos)
|
||||||
{
|
{
|
||||||
if (currentStep < numberOfSteps)
|
if (step < numberOfSteps)
|
||||||
{
|
{
|
||||||
currentStep++;
|
step++;
|
||||||
lastLastNode = lastNode;
|
lastLastNode = lastNode;
|
||||||
lastNode = nextNode;
|
lastNode = nextNode;
|
||||||
nextNode = GetComponent<PathFinder>().Next();
|
nextNode = GetComponent<PathFinder>().Next();
|
||||||
|
|||||||
Regular → Executable
+3
-1
@@ -29,7 +29,9 @@ namespace DepthsBelow
|
|||||||
}
|
}
|
||||||
int baseHitChance = shooting.GetAim;
|
int baseHitChance = shooting.GetAim;
|
||||||
int baseDodgeChance = dodging.GetDodge;
|
int baseDodgeChance = dodging.GetDodge;
|
||||||
int basePenalty = shooting.Penalty((int)Vector2.Distance(attacker.GetComponent<Transform>().World.Position, defender.GetComponent<Transform>().World.Position) / Grid.TileSize);
|
int distance = (int)Vector2.Distance(attacker.GetComponent<Transform>().World.Position, defender.GetComponent<Transform>().World.Position);
|
||||||
|
int basePenalty = shooting.Penalty(distance / (Grid.TileSize));
|
||||||
|
Console.WriteLine("Penalty = " + basePenalty);
|
||||||
int chanceToHit = baseHitChance - baseDodgeChance - basePenalty;
|
int chanceToHit = baseHitChance - baseDodgeChance - basePenalty;
|
||||||
//Console.WriteLine(chanceToHit);
|
//Console.WriteLine(chanceToHit);
|
||||||
return chanceToHit;
|
return chanceToHit;
|
||||||
|
|||||||
Reference in New Issue
Block a user