Steps taken and distance taken into account

This commit is contained in:
Niklas Ulf Anders Cullberg
2012-10-20 17:31:26 +02:00
parent 2fe63f51c0
commit 6f6ee2d340
3 changed files with 28 additions and 20 deletions
+8 -1
View File
@@ -26,6 +26,12 @@ namespace DepthsBelow.Component
set { weaponAccuracy = value; }
}
public int GetStep
{
get { return stepsTaken; }
set { stepsTaken = value; }
}
public int GetDodge
{
get { return enemyDodge; }
@@ -80,7 +86,8 @@ namespace DepthsBelow.Component
int penalty = 0;
if (distance >= penaltyRange * 3)
{
penalty = 100;
distance -= penaltyRange * 3;
penalty = penaltyRange + penaltyRange * 3 + penaltyRange * 5 + distance * 10;
}
else if (distance >= penaltyRange * 2)
{
+19 -18
View File
@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
using DepthsBelow.Component;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
@@ -33,7 +33,7 @@ namespace DepthsBelow
}
public int numberOfSteps = 14;
public int currentStep = 0;
int currentStep = 0;
public int step
{
@@ -41,10 +41,11 @@ namespace DepthsBelow
set
{
currentStep = value;
GetComponent<Component.Stat>().GetStep = currentStep;
}
}
public Soldier(EntityManager entityManager, ref List<Soldier> squad)
}
public Soldier(EntityManager entityManager, ref List<Soldier> squad)
: base(entityManager)
{
if (Texture == null)
@@ -62,16 +63,16 @@ namespace DepthsBelow
AddComponent(cc);
var pfc = new PathFinder(this);
AddComponent(pfc);
var stat = new Component.Stat(this)
{
Life = 10,
Defence = 10,
Strength = 10,
GetAim = 10,
GetDodge = 20
};
AddComponent(pfc);
var stat = new Component.Stat(this)
{
Life = 10,
Defence = 10,
Strength = 10,
GetAim = 40,
GetDodge = 20
};
AddComponent(stat);
}
@@ -145,9 +146,9 @@ namespace DepthsBelow
if (Transform.World == nodeWorldPos)
{
if (currentStep < numberOfSteps)
if (step < numberOfSteps)
{
currentStep++;
step++;
lastLastNode = lastNode;
lastNode = nextNode;
nextNode = GetComponent<PathFinder>().Next();
+1 -1
View File
@@ -30,7 +30,7 @@ namespace DepthsBelow
int baseHitChance = shooting.GetAim;
int baseDodgeChance = dodging.GetDodge;
int distance = (int)Vector2.Distance(attacker.GetComponent<Transform>().World.Position, defender.GetComponent<Transform>().World.Position);
int basePenalty = shooting.Penalty(distance / (Grid.TileSize / 2));
int basePenalty = shooting.Penalty(distance / (Grid.TileSize));
Console.WriteLine("Penalty = " + basePenalty);
int chanceToHit = baseHitChance - baseDodgeChance - basePenalty;
//Console.WriteLine(chanceToHit);