Skip to content

Commit

Permalink
Merge branch 'eesast:dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
DreamEnderKing authored Apr 23, 2024
2 parents cc5d228 + d9f19da commit 0e47f28
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions logic/Gaming/AttackManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ private void BulletBomb(Bullet bullet, GameObj? objBeingShot)
{
if (objBeingShot == null)
{
shipManager.BackSwing((Ship)bullet.Parent!, bullet.SwingTime);
ShipManager.BackSwing((Ship)bullet.Parent!, bullet.SwingTime);
return;
}
BombObj(bullet, objBeingShot);
shipManager.BackSwing((Ship)bullet.Parent!, bullet.SwingTime);
ShipManager.BackSwing((Ship)bullet.Parent!, bullet.SwingTime);
return;
}
else
Expand All @@ -154,7 +154,7 @@ private void BulletBomb(Bullet bullet, GameObj? objBeingShot)
BombObj(bullet, beAttackedObj);
}
beAttackedList.Clear();
shipManager.BackSwing((Ship)bullet.Parent!, bullet.SwingTime);
ShipManager.BackSwing((Ship)bullet.Parent!, bullet.SwingTime);
}
}
public bool Attack(Ship ship, double angle)
Expand Down
4 changes: 2 additions & 2 deletions logic/Gaming/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public long ActivateShip(long teamID, ShipType shipType, int birthPointIndex = 0
birthPointIndex = teamList[(int)teamID].BirthPointList.Count - 1;
XY pos = teamList[(int)teamID].BirthPointList[birthPointIndex];
pos += new XY(((random.Next() & 2) - 1) * 1000, ((random.Next() & 2) - 1) * 1000);
if (shipManager.ActivateShip(ship, pos))
if (ShipManager.ActivateShip(ship, pos))
{
Debugger.Output($"Successfully activated: {teamID} {shipType} at {pos}");
return ship.PlayerID;
Expand Down Expand Up @@ -193,7 +193,7 @@ public bool Recover(long teamID, long shipID, long recover)
}
if (validRecoverPoint)
{
return shipManager.Recover(ship, recover);
return ShipManager.Recover(ship, recover);
}
}
return false;
Expand Down
11 changes: 5 additions & 6 deletions logic/Gaming/ShipManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,14 @@ private class ShipManager(Game game, Map gameMap)
);
return newShip;
}
public bool ActivateShip(Ship ship, XY pos)
public static bool ActivateShip(Ship ship, XY pos)
{
if (ship.ShipState != ShipStateType.Deceased)
{
return false;
}
ship.ReSetPos(pos);
long stateNum = ship.SetShipState(RunningStateType.RunningActively, ShipStateType.Null);
ship.ResetShipState(stateNum);
ship.SetShipState(RunningStateType.Null, ShipStateType.Null);
Debugger.Output(ship, " is activated!");
return true;
}
Expand Down Expand Up @@ -117,7 +116,7 @@ public static long BeStunned(Ship ship, int time)
{ IsBackground = true }.Start();
return stateNum;
}
public bool BackSwing(Ship ship, int time)
public static bool BackSwing(Ship ship, int time)
{
if (time <= 0)
{
Expand All @@ -139,13 +138,13 @@ public bool BackSwing(Ship ship, int time)
{ IsBackground = true }.Start();
return true;
}
public bool Recover(Ship ship, long recover)
public static bool Recover(Ship ship, long recover)
{
if (recover <= 0)
{
return false;
}
if (ship.MoneyPool.Money < (ship.HP.GetMaxV() - ship.HP.GetValue()) * 1.2)
if (ship.MoneyPool.Money < ship.HP.GetDifference() * 1.2)
{
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public T GetMaxV()
{
return ReadNeed(() => (v, maxV));
}
public T GetDifference() => ReadNeed(() => (maxV - v));
public double GetDivideValueByMaxV()
{
return ReadNeed(() => (v.ToDouble(null) / maxV.ToDouble(null)));
Expand Down

0 comments on commit 0e47f28

Please sign in to comment.