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)
{
+5 -4
View File
@@ -33,7 +33,7 @@ namespace DepthsBelow
}
public int numberOfSteps = 14;
public int currentStep = 0;
int currentStep = 0;
public int step
{
@@ -41,6 +41,7 @@ namespace DepthsBelow
set
{
currentStep = value;
GetComponent<Component.Stat>().GetStep = currentStep;
}
}
@@ -69,7 +70,7 @@ namespace DepthsBelow
Life = 10,
Defence = 10,
Strength = 10,
GetAim = 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);