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
shangfengh authored Apr 11, 2024
2 parents 4bf71f6 + d5ab5e4 commit d78c934
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 56 deletions.
2 changes: 1 addition & 1 deletion logic/Client/ViewModel/GeneralViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -809,8 +809,8 @@ Show the error message
ConnectToServer(new string[]{
"localhost",
"8888",
"0",
"1",
"0",
"1"
});

Expand Down
2 changes: 1 addition & 1 deletion logic/GameClass/GameObj/Areas/WormholeCell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace GameClass.GameObj.Areas;
public class WormholeCell(XY initPos, Wormhole wormhole)
: Immovable(initPos, GameData.NumOfPosGridPerCell / 2, GameObjType.Wormhole)
{
public override bool IsRigid => Wormhole.HP > GameData.WormholeHP / 2;
public override bool IsRigid => Wormhole.HP < GameData.WormholeHP / 2;
public override ShapeType Shape => ShapeType.Square;
public readonly Wormhole Wormhole = wormhole;
}
5 changes: 2 additions & 3 deletions logic/GameClass/GameObj/Team.cs → logic/GameClass/GameObj/Base.cs
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace GameClass.GameObj
{
public class Team : IPlayer
public class Base : IPlayer
{
public AtomicLong TeamID { get; }
public AtomicLong PlayerID { get; } = new(0);
Expand All @@ -18,7 +18,7 @@ public class Team : IPlayer
public MoneyPool MoneyPool { get; } = new();
public AtomicInt FactoryNum { get; } = new(0);
public int MoneyAddPerSecond => GameData.ScoreHomePerSecond + FactoryNum * GameData.ScoreFactoryPerSecond;
public Team(Home home)
public Base(Home home)
{
TeamID = new(home.TeamID);
Home = home;
Expand All @@ -45,7 +45,6 @@ public Team(Home home)
public void AddMoney(long add)
{
MoneyPool.Money.Add(add);
MoneyPool.Score.Add(add);
}
public void SubMoney(long sub)
{
Expand Down
7 changes: 4 additions & 3 deletions logic/Gaming/ActionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ public bool Construct(Ship ship, ConstructionType constructionType)
return true;
}
var ship = ships[random.Next(ships.Count)];
shipManager.BeAttacked(ship, GameData.FortDamage,
shipManager.BeAttacked(ship,
GameData.FortDamage / GameData.NumOfStepPerSecond,
construction.TeamID);
return true;
},
Expand Down Expand Up @@ -297,7 +298,7 @@ public bool Repair(Ship ship)
{ IsBackground = true }.Start();
return false;
}
public bool AddMoneyNaturally(Team team)
public bool AddMoneyNaturally(Base team)
{
new Thread
(
Expand All @@ -309,7 +310,7 @@ public bool AddMoneyNaturally(Team team)
loopCondition: () => gameMap.Timer.IsGaming,
loopToDo: () =>
{
team.AddMoney(team.MoneyAddPerSecond);
team.AddMoney(team.MoneyAddPerSecond / GameData.NumOfStepPerSecond);
return true;
},
timeInterval: GameData.CheckInterval,
Expand Down
6 changes: 3 additions & 3 deletions logic/Gaming/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ public struct PlayerInitInfo(long teamID, long playerID, ShipType shipType)
public long playerID = playerID;
public ShipType shipType = shipType;
}
private readonly List<Team> teamList;
public List<Team> TeamList => teamList;
private readonly List<Base> teamList;
public List<Base> TeamList => teamList;
private readonly Map gameMap;
public Map GameMap => gameMap;
private readonly Random random = new();
Expand Down Expand Up @@ -324,7 +324,7 @@ public Game(MapStruct mapResource, int numOfTeam)
{
if (gameObj.Type == GameObjType.Home)
{
teamList.Add(new Team((Home)gameObj));
teamList.Add(new Base((Home)gameObj));
teamList.Last().BirthPointList.Add(gameObj.Position);
teamList.Last().AddMoney(GameData.InitialMoney);
}
Expand Down
78 changes: 39 additions & 39 deletions logic/Preparation/Utility/GameData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static class GameData
public const int MapRows = 50; // 行数
public const int MapCols = 50; // 列数

public const int InitialMoney = 500; // 初始金钱
public const int InitialMoney = 5000; // 初始金钱

public static bool IsGameObjMap(GameObjType gameObjType) => (uint)gameObjType > 3;
public static bool NeedCopy(GameObjType gameObjType)
Expand Down Expand Up @@ -71,7 +71,7 @@ public static bool IsInTheRange(XY pos1, XY pos2, int range)
public const int ShipRadius = 400;
public static readonly XY PosNotInGame = new(1, 1);

public const int BulletRadius = 200; // 子弹半径
public const int BulletRadius = 200; // 子弹半径
public const int LaserRange = 4000; // 激光射程
public const int LaserDamage = 1200; // 激光伤害
public const double LaserArmorModifier = 1.5; // 激光装甲修正
Expand Down Expand Up @@ -109,65 +109,65 @@ public static bool IsInTheRange(XY pos1, XY pos2, int range)
public const int ArcCastTime = 600; // 电弧前摇时间
public const int ArcSwingTime = 600; // 电弧后摇时间

public const int CivilShipCost = 400;
public const int CivilShipCost = 4000;
public const int CivilShipMaxHP = 3000;
public const int CivilShipMoveSpeed = 3000;
public const int CivilShipViewRange = 8000;
public const int CivilShipBaseArmor = 0;
public const int CivilShipBaseShield = 0;
public const int CivilShipProducer1Cost = 0;
public const int CivilShipProducer2Cost = 400;
public const int CivilShipProducer3Cost = 800;
public const int CivilShipProducer2Cost = 4000;
public const int CivilShipProducer3Cost = 8000;
public const int CivilShipConstructor1Cost = 0;
public const int CivilShipConstructor2Cost = 400;
public const int CivilShipConstructor3Cost = 800;
public const int CivilShipArmor1Cost = 600;
public const int CivilShipShield1Cost = 600;
public const int CivilShipLaserGunCost = 1000;
public const int CivilShipConstructor2Cost = 4000;
public const int CivilShipConstructor3Cost = 8000;
public const int CivilShipArmor1Cost = 6000;
public const int CivilShipShield1Cost = 6000;
public const int CivilShipLaserGunCost = 10000;

public const int WarShipCost = 1200;
public const int WarShipCost = 12000;
public const int WarShipMaxHP = 4000;
public const int WarShipMoveSpeed = 2800;
public const int WarShipViewRange = 8000;
public const int WarShipBaseArmor = 400;
public const int WarShipBaseShield = 400;
public const int WarShipArmor1Cost = 600;
public const int WarShipArmor2Cost = 1200;
public const int WarShipArmor3Cost = 1800;
public const int WarShipShield1Cost = 600;
public const int WarShipShield2Cost = 1200;
public const int WarShipShield3Cost = 1800;
public const int WarShipArmor1Cost = 6000;
public const int WarShipArmor2Cost = 12000;
public const int WarShipArmor3Cost = 18000;
public const int WarShipShield1Cost = 6000;
public const int WarShipShield2Cost = 12000;
public const int WarShipShield3Cost = 18000;
public const int WarShipLaserGunCost = 0;
public const int WarShipPlasmaGunCost = 1200;
public const int WarShipShellGunCost = 1300;
public const int WarShipMissileGunCost = 1800;
public const int WarShipArcGunCost = 2400;
public const int WarShipPlasmaGunCost = 12000;
public const int WarShipShellGunCost = 13000;
public const int WarShipMissileGunCost = 18000;
public const int WarShipArcGunCost = 24000;

public const int FlagShipCost = 5000;
public const int FlagShipCost = 40000;
public const int FlagShipMaxHP = 12000;
public const int FlagShipMoveSpeed = 2700;
public const int FlagShipViewRange = 8000;
public const int FlagShipBaseArmor = 800;
public const int FlagShipBaseShield = 800;
public const int FlagShipProducer1Cost = 400;
public const int FlagShipConstructor1Cost = 400;
public const int FlagShipArmor1Cost = 600;
public const int FlagShipArmor2Cost = 1200;
public const int FlagShipArmor3Cost = 1800;
public const int FlagShipShield1Cost = 600;
public const int FlagShipShield2Cost = 1200;
public const int FlagShipShield3Cost = 1800;
public const int FlagShipArmor1Cost = 6000;
public const int FlagShipArmor2Cost = 12000;
public const int FlagShipArmor3Cost = 18000;
public const int FlagShipShield1Cost = 6000;
public const int FlagShipShield2Cost = 12000;
public const int FlagShipShield3Cost = 18000;
public const int FlagShipLaserGunCost = 0;
public const int FlagShipPlasmaGunCost = 1200;
public const int FlagShipShellGunCost = 1300;
public const int FlagShipMissileGunCost = 1800;
public const int FlagShipArcGunCost = 2400;

public const int ScoreHomePerSecond = 20;
public const int ScoreFactoryPerSecond = 50;
public const int ScoreProducer1PerSecond = 20;
public const int ScoreProducer2PerSecond = 30;
public const int ScoreProducer3PerSecond = 40;
public const int FlagShipPlasmaGunCost = 12000;
public const int FlagShipShellGunCost = 13000;
public const int FlagShipMissileGunCost = 18000;
public const int FlagShipArcGunCost = 24000;

public const int ScoreHomePerSecond = 100;
public const int ScoreFactoryPerSecond = 300;
public const int ScoreProducer1PerSecond = 100;
public const int ScoreProducer2PerSecond = 200;
public const int ScoreProducer3PerSecond = 300;
public const int ScoreConstructionDamaged = 200;
public static int ScoreShipKilled(int totalScore) => totalScore / 5;
public static int ScoreShipRecovered(int totalRecovery) => totalRecovery * 6 / 5;
Expand All @@ -191,6 +191,6 @@ public static bool IsInTheRange(XY pos1, XY pos2, int range)
public const int HomeHP = 24000;

public const int FortRange = 6000;
public const int FortDamage = 50;
public const int FortDamage = 500;
}
}
6 changes: 3 additions & 3 deletions logic/Server/CopyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public static class CopyInfo
}
}

public static MessageOfObj? Auto(Team team, long time)
public static MessageOfObj? Auto(Base @base, long time)
{
return Team(team, time);
return Base(@base, time);
}
public static MessageOfObj? Auto(MessageOfNews news)
{
Expand Down Expand Up @@ -97,7 +97,7 @@ public static class CopyInfo
return msg;
}

private static MessageOfObj? Team(Team player, long time)
private static MessageOfObj? Base(Base player, long time)
{
MessageOfObj msg = new()
{
Expand Down
6 changes: 3 additions & 3 deletions logic/Server/GameServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public void ReportGame(GameState gameState, bool requiredGaming = true)
MessageOfObj? msg = CopyInfo.Auto(gameObj, time);
if (msg != null) currentGameInfo.ObjMessage.Add(msg);
}
foreach (Team team in game.TeamList)
foreach (Base team in game.TeamList)
{
MessageOfObj? msg = CopyInfo.Auto(team, time);
if (msg != null) currentGameInfo.ObjMessage.Add(msg);
Expand Down Expand Up @@ -195,7 +195,7 @@ private bool PlayerDeceased(int playerID) //# 这里需要判断大本营dece
public override int[] GetMoney()
{
int[] money = new int[2]; // 0代表RedTeam,1代表BlueTeam
foreach (Team team in game.TeamList)
foreach (Base team in game.TeamList)
{
money[(int)team.TeamID] = (int)game.GetTeamMoney(team.TeamID);
}
Expand All @@ -205,7 +205,7 @@ public override int[] GetMoney()
public override int[] GetScore()
{
int[] score = new int[2]; // 0代表RedTeam,1代表BlueTeam
foreach (Team team in game.TeamList)
foreach (Base team in game.TeamList)
{
score[(int)team.TeamID] = (int)game.GetTeamScore(team.TeamID);
}
Expand Down

0 comments on commit d78c934

Please sign in to comment.