think i finally solved movement going into enemy territory
This commit is contained in:
@@ -48,7 +48,9 @@ public partial class BasicMovement : PegAction
|
||||
public override bool MeetsCriteria(Peg PEG)
|
||||
{
|
||||
List<MapCell> bestPath = PEG.GetBestPath(true);
|
||||
return base.MeetsCriteria(PEG) && bestPath.Count > 0;
|
||||
return base.MeetsCriteria(PEG)
|
||||
&& bestPath.Count > 0
|
||||
&& PEG._map.GetCellDisposition(bestPath[0]._address) != -(int)PEG._disposition;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -25,16 +25,11 @@ public partial class ShootShortbow : PegAction
|
||||
subtween.TweenProperty(_image, "global_position", target.GlobalPosition, 0.5f);
|
||||
subtween.TweenCallback(Callable.From(() =>
|
||||
{
|
||||
((Peg)target._occupant)._pegController._playerController.ChangeHealth(-2, this);
|
||||
PEG._pegController._playerController.ChangeHealth(-2, this);
|
||||
Position = Vector2.Zero;
|
||||
Visible = false;
|
||||
}));
|
||||
return subtween;
|
||||
}
|
||||
|
||||
public override MapCell Target(Peg PEG)
|
||||
{
|
||||
return PEG.Goal();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,16 +26,10 @@ public partial class SwingShortsword : PegAction
|
||||
subtween.TweenProperty(_image, "global_position", target.GlobalPosition, 0.5f);
|
||||
subtween.TweenCallback(Callable.From(() =>
|
||||
{
|
||||
((Peg)target._occupant)._pegController._playerController.ChangeHealth(-2, this);
|
||||
PEG._pegController._playerController.ChangeHealth(-2, this);
|
||||
_image.Position = Vector2.Zero;
|
||||
_image.Visible = false;
|
||||
}));
|
||||
return subtween;
|
||||
}
|
||||
|
||||
public override MapCell Target(Peg PEG)
|
||||
{
|
||||
return PEG.Goal();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public partial class ThrustSpear : PegAction
|
||||
subtween.TweenProperty(_image, "global_position", target.GlobalPosition, 0.5f);
|
||||
subtween.TweenCallback(Callable.From(() =>
|
||||
{
|
||||
((Peg)target._occupant).ChangeHealth(-1);
|
||||
((Peg)target?._occupant)?.ChangeHealth(-1);
|
||||
_image.Position = Vector2.Zero;
|
||||
_image.Visible = false;
|
||||
}));
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ public partial class HostilePeg : Peg
|
||||
{
|
||||
base._Ready();
|
||||
|
||||
_disposition = Disposition.FRIENDLY;
|
||||
_disposition = Disposition.HOSTILE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+3
-2
@@ -25,9 +25,10 @@ public partial class PegAction : Node2D
|
||||
|
||||
public virtual bool MeetsCriteria(Peg PEG)
|
||||
{
|
||||
MapCell target = Target(PEG);
|
||||
return PEG._staminaRemaining >= _cost
|
||||
&& _usesRemaining > 0
|
||||
&& (PEG._address - Target(PEG)._address).Length() <= _range;
|
||||
&& (PEG._address - target._address).Length() <= _range;
|
||||
}
|
||||
|
||||
public virtual void Reset()
|
||||
@@ -37,6 +38,6 @@ public partial class PegAction : Node2D
|
||||
|
||||
public virtual MapCell Target(Peg PEG)
|
||||
{
|
||||
return PEG._cell;
|
||||
return PEG.Goal();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user