From 7c024b967f25fdc7e30dfebba2134073bb48e9b8 Mon Sep 17 00:00:00 2001 From: Xuc Pan Date: Thu, 11 Apr 2024 12:21:09 +0800 Subject: [PATCH 1/4] fix: :bug: cannot go through wormhole --- logic/GameClass/GameObj/Areas/WormholeCell.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logic/GameClass/GameObj/Areas/WormholeCell.cs b/logic/GameClass/GameObj/Areas/WormholeCell.cs index 6036508b..90cd9b08 100644 --- a/logic/GameClass/GameObj/Areas/WormholeCell.cs +++ b/logic/GameClass/GameObj/Areas/WormholeCell.cs @@ -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; } From 265f9ec468e811d5b5b95ecbcaa7e3e00b080315 Mon Sep 17 00:00:00 2001 From: Xuc Pan Date: Thu, 11 Apr 2024 12:25:14 +0800 Subject: [PATCH 2/4] refactor: :art: rename team to base --- logic/Client/ViewModel/GeneralViewModel.cs | 2 +- logic/GameClass/GameObj/{Team.cs => Base.cs} | 4 ++-- logic/Gaming/ActionManager.cs | 2 +- logic/Gaming/Game.cs | 6 +++--- logic/Server/CopyInfo.cs | 6 +++--- logic/Server/GameServer.cs | 6 +++--- 6 files changed, 13 insertions(+), 13 deletions(-) rename logic/GameClass/GameObj/{Team.cs => Base.cs} (97%) mode change 100755 => 100644 diff --git a/logic/Client/ViewModel/GeneralViewModel.cs b/logic/Client/ViewModel/GeneralViewModel.cs index 92a845bc..248940f0 100644 --- a/logic/Client/ViewModel/GeneralViewModel.cs +++ b/logic/Client/ViewModel/GeneralViewModel.cs @@ -809,8 +809,8 @@ Show the error message ConnectToServer(new string[]{ "localhost", "8888", - "0", "1", + "0", "1" }); diff --git a/logic/GameClass/GameObj/Team.cs b/logic/GameClass/GameObj/Base.cs old mode 100755 new mode 100644 similarity index 97% rename from logic/GameClass/GameObj/Team.cs rename to logic/GameClass/GameObj/Base.cs index 6d549907..baadb551 --- a/logic/GameClass/GameObj/Team.cs +++ b/logic/GameClass/GameObj/Base.cs @@ -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); @@ -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; diff --git a/logic/Gaming/ActionManager.cs b/logic/Gaming/ActionManager.cs index c2fd8842..d5521da1 100755 --- a/logic/Gaming/ActionManager.cs +++ b/logic/Gaming/ActionManager.cs @@ -297,7 +297,7 @@ public bool Repair(Ship ship) { IsBackground = true }.Start(); return false; } - public bool AddMoneyNaturally(Team team) + public bool AddMoneyNaturally(Base team) { new Thread ( diff --git a/logic/Gaming/Game.cs b/logic/Gaming/Game.cs index cb12d781..1eb5c88d 100755 --- a/logic/Gaming/Game.cs +++ b/logic/Gaming/Game.cs @@ -18,8 +18,8 @@ public struct PlayerInitInfo(long teamID, long playerID, ShipType shipType) public long playerID = playerID; public ShipType shipType = shipType; } - private readonly List teamList; - public List TeamList => teamList; + private readonly List teamList; + public List TeamList => teamList; private readonly Map gameMap; public Map GameMap => gameMap; private readonly Random random = new(); @@ -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); } diff --git a/logic/Server/CopyInfo.cs b/logic/Server/CopyInfo.cs index 062c6a7e..637785b2 100755 --- a/logic/Server/CopyInfo.cs +++ b/logic/Server/CopyInfo.cs @@ -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) { @@ -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() { diff --git a/logic/Server/GameServer.cs b/logic/Server/GameServer.cs index 004332fb..d828d5f5 100755 --- a/logic/Server/GameServer.cs +++ b/logic/Server/GameServer.cs @@ -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); @@ -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); } @@ -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); } From e9efe70b12a8b08fbe64df676ef180cd28547aa4 Mon Sep 17 00:00:00 2001 From: Xuc Pan Date: Thu, 11 Apr 2024 12:47:06 +0800 Subject: [PATCH 3/4] feat: :sparkles: modifications on number --- logic/GameClass/GameObj/Base.cs | 1 - logic/Gaming/ActionManager.cs | 2 +- logic/Preparation/Utility/GameData.cs | 78 +++++++++++++-------------- 3 files changed, 40 insertions(+), 41 deletions(-) diff --git a/logic/GameClass/GameObj/Base.cs b/logic/GameClass/GameObj/Base.cs index baadb551..4112529d 100644 --- a/logic/GameClass/GameObj/Base.cs +++ b/logic/GameClass/GameObj/Base.cs @@ -45,7 +45,6 @@ public Base(Home home) public void AddMoney(long add) { MoneyPool.Money.Add(add); - MoneyPool.Score.Add(add); } public void SubMoney(long sub) { diff --git a/logic/Gaming/ActionManager.cs b/logic/Gaming/ActionManager.cs index d5521da1..edd34f2c 100755 --- a/logic/Gaming/ActionManager.cs +++ b/logic/Gaming/ActionManager.cs @@ -309,7 +309,7 @@ public bool AddMoneyNaturally(Base team) loopCondition: () => gameMap.Timer.IsGaming, loopToDo: () => { - team.AddMoney(team.MoneyAddPerSecond); + team.AddMoney(team.MoneyAddPerSecond / GameData.NumOfStepPerSecond); return true; }, timeInterval: GameData.CheckInterval, diff --git a/logic/Preparation/Utility/GameData.cs b/logic/Preparation/Utility/GameData.cs index fc828ab0..0b625fec 100755 --- a/logic/Preparation/Utility/GameData.cs +++ b/logic/Preparation/Utility/GameData.cs @@ -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) @@ -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; // 激光装甲修正 @@ -109,41 +109,41 @@ 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; @@ -151,23 +151,23 @@ public static bool IsInTheRange(XY pos1, XY pos2, int range) 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; @@ -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; } } From b564fd01abcc245580621ded32118183df5ce87b Mon Sep 17 00:00:00 2001 From: Xuc Pan Date: Thu, 11 Apr 2024 12:53:00 +0800 Subject: [PATCH 4/4] fix: :bug: fort attack damage --- logic/Gaming/ActionManager.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/logic/Gaming/ActionManager.cs b/logic/Gaming/ActionManager.cs index edd34f2c..bbfd6935 100755 --- a/logic/Gaming/ActionManager.cs +++ b/logic/Gaming/ActionManager.cs @@ -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; },