From 6a0ec64db298c2bca5aa62c06734367238c3c34c Mon Sep 17 00:00:00 2001 From: shangfengh <3495281661@qq.com> Date: Sat, 6 May 2023 00:20:09 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20:memo:=20add=20=E6=B8=B8=E6=88=8F?= =?UTF-8?q?=E6=9C=BA=E5=88=B6=E4=B8=8E=E5=B9=B3=E8=A1=A1=E6=80=A7=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E6=9B=B4=E6=96=B0=E8=8D=89=E6=A1=88.md=20and=20delete?= =?UTF-8?q?=20the=20Property=20"Place"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/GameRules.md | 14 +-- ...戏机制与平衡性调整更新草案.md | 89 +++++++++++++++++++ docs/版本更新说明.md | 9 ++ .../GameClass/GameObj/Bullet/BombedBullet.cs | 1 - .../GameClass/GameObj/Bullet/Bullet.Ghost.cs | 14 ++- logic/GameClass/GameObj/Bullet/Bullet.cs | 13 ++- .../GameObj/Character/Character.Skill.cs | 1 - .../GameClass/GameObj/Character/Character.cs | 5 +- logic/GameClass/GameObj/GameObj.cs | 21 +++-- logic/GameClass/GameObj/Map/Chest.cs | 1 - logic/GameClass/GameObj/Map/Door.cs | 18 +++- logic/GameClass/GameObj/Map/Doorway.cs | 1 - logic/GameClass/GameObj/Map/EmergencyExit.cs | 1 - logic/GameClass/GameObj/Map/Generator.cs | 1 - logic/GameClass/GameObj/Map/Wall.cs | 1 - logic/GameClass/GameObj/Map/Window.cs | 1 - logic/GameClass/GameObj/Moveable.cs | 12 +-- logic/GameClass/GameObj/OutOfBoundBlock.cs | 1 - logic/GameClass/GameObj/PickedProp.cs | 1 - logic/GameClass/GameObj/Prop.cs | 47 +++++----- logic/GameEngine/MoveEngine.cs | 8 +- logic/Gaming/ActionManager.cs | 14 +-- logic/Gaming/AttackManager.cs | 2 +- logic/Gaming/CharacterManager .cs | 2 +- logic/Gaming/PropManager.cs | 12 +-- logic/Preparation/Interface/IGameObj.cs | 1 - logic/Preparation/Interface/IMoveable.cs | 3 +- logic/Preparation/Utility/GameData.cs | 1 - logic/Server/CopyInfo.cs | 6 +- logic/cmd/gameServerAndClient.cmd | 2 +- 30 files changed, 194 insertions(+), 109 deletions(-) create mode 100644 docs/游戏机制与平衡性调整更新草案.md create mode 100644 docs/版本更新说明.md diff --git a/docs/GameRules.md b/docs/GameRules.md index ba03c8b..e8f1488 100644 --- a/docs/GameRules.md +++ b/docs/GameRules.md @@ -1,5 +1,5 @@ # 规则 -V5.5 +V5.6 - [规则](#规则) - [简则](#简则) - [地图](#地图) @@ -192,7 +192,7 @@ $$ | :------------ | :--------------------- | :--------------------- | :--------------------- | :--------------------- | | 移动速度/s | 3960 | 3600 | 3852 | 3600 | | 隐蔽度 | 1.5 | 1 | 0.8 | 0.75| -| 警戒范围 | 22,100 | 17000 | 15300 | 17000 +| 警戒范围 | 22100 | 17000 | 15300 | 17000| | 视野范围 | 15600 | 13000 | 13000 | 14300| | 开锁门速度/ms | 4000 | 4000 | 4000 |4000 | | 翻窗速度/s | 2540 | 2540 | 2794 | 2540| @@ -246,14 +246,14 @@ $$ | :------------ | :--------------------- | :--------------------- | :--------------------- | :--------------------- | | 移动速度/s | 2700 | 3150 | 2880 | 3000 | | 最大毅力值 | 30000000 | 3000000 | 3300000 | 3200000 | -| 最大沉迷度 | 600000 | 54,000 | 78,000 | 66,000 | -| 学习一科速度 | 0 | 73 | 135 | 123 | +| 最大沉迷度 | 600000 | 54000 | 78000 | 66000 | +| 学习速度/ms | 0 | 73 | 135 | 123 | | 勉励速度/ms | 80 | 90 | 100 | 120 | | 隐蔽度 | 0.5 | 0.9 | 0.9 | 0.8 | -| 警戒范围 | 7500 | 15000 | 13,500 | 15000 | -| 视野范围 | 9,000 | 11000 | 9,000 | 10000 | +| 警戒范围 | 7500 | 15000 | 13500 | 15000 | +| 视野范围 | 9000 | 11000 | 9000 | 10000 | | 开锁门速度/ms | 4000 | 4000 | 4000 | 2800 | -| 翻窗速度/ms | 1270 | 3048 | 2116 | 2540 | +| 翻窗速度/ms | 611 | 1466 | 1018 | 1222 | | 翻箱速度/ms | 1000 | 1000 | 1000 | 900 | #### 运动员 diff --git a/docs/游戏机制与平衡性调整更新草案.md b/docs/游戏机制与平衡性调整更新草案.md new file mode 100644 index 0000000..e5b6f77 --- /dev/null +++ b/docs/游戏机制与平衡性调整更新草案.md @@ -0,0 +1,89 @@ +# 游戏机制与平衡性调整更新草案 +v1.0 + +## 说明 +- 该草案尚未完全确定,请大家不要过分依靠该文档进行修改自己的代码 +- 有任何问题都可以在选手群中提出建议和讨论 + +## 游戏接口 + 删除structures.h中Player的属性place + +## 游戏规则 + +## 游戏机制 + +## 攻击 +- 飞刀FlyingKnife + - 前摇变为600ms +- 搞蛋鬼的一般攻击CommonAttackOfTricker + - 改为“不能攻击未写完的作业” +- 蹦蹦炸弹BombBomb + - 增强为“可以攻击未写完的作业” + - 增强为“可以攻击使门被打开(可以重新被锁上)” +- strike(新增) + - 可以攻击未写完的作业 + +修改后: +| 攻击(子弹)类型 |搞蛋鬼的一般攻击CommonAttackOfTricker|飞刀FlyingKnife | 蹦蹦炸弹BombBomb | 小炸弹JumpyDumpty | strike | +| :--------------------- | :---------------------| :--------------------- | :--------------------- | :--------------------- | :--------------------- | +| 子弹爆炸范围 | 0 | 0 | 2000 | 1000 | 0 | +| 子弹攻击距离 | 2200 | 78000 | 2200 | 4400 | 2000 | +| 攻击力 | 1500000 | 1200000 | 1800000 | 900000 | 1600000 | +| 移动速度/s | 7400 | 18500 | 6000 | 8600 | 6250 | +| 前摇(ms) | 297 | 600 | 366 | - | 320 | +|未攻击至目标时的后摇(ms)| 800 | 0 | 3700 | - | 800 | +|攻击至目标时的后摇(ms) | 3700 | 0 | 3700 | - | 3700 | +| CD(ms) | 800 | 400 | 3000 | - | 800 | +| 最大子弹容量 | 1 | 1 | 1 | - | 1 | + + +## 职业 +- 所有角色开锁门速度加速至1.25倍 +- 所有角色翻箱速度加速至1.25倍 + +### 学生 +- 先前学生翻窗数据有误 + +- Teacher + - Teacher的学习速度由0改为43 + - 警戒范围由7500改为13000 + - 技能惩罚(Punish)强化为“使用瞬间,在**视野距离范围内(不是可视范围)的**、翻窗、开锁门、攻击前后摇、**使用技能期间**的捣蛋鬼会被眩晕(3070+**500***已受伤害/基本伤害(1500000))ms” +- Robot(新增) + - 无技能 + - 特性 + - 不可被眩晕 + - 不可毕业 + - 无牵制得分 + - 不可使用道具(可以捡起和扔道具) +- TechOtaku(新增) + - 一名TechOtaku最多可以在场上同时最多拥有3个Robot + 0. SummonGolem + - CD:40s,持续时间:6s + - 在持续时间中,学生进入人物状态进入UsingSpecialSkill,进入其他状态会导致制作机器人失败 + - 在持续时间中,学生面前生成道具CraftingBench,该道具被碰撞后消失且制作机器人失败 + - 持续时间结束后,道具CraftingBench所在位置生成一个Robot + 1. UseRobot + - CD:0s,持续时间:0s + - TechOtaku的Robot的PlayerId = TechOtaku的PlayerId + n*5(一局游戏理论人数),其中1<=n<=3 +修改后: +| 学生职业 | 教师Teacher | 健身狂Athlete |学霸StraightAStudent | 开心果Sunshine | 机器人Robot | TechOtaku | +| :------------ | :------------------ | :------------------ | :------------------ | :------------------ | :------------------ | :------------------ | +| 移动速度/s | 2700 | 3150 | 2880 | 3000 | 2600 | 2250 | +| 最大毅力值 | 30000000 | 3000000 | 3300000 | 3200000 | 900000 | 2700000 | +| 最大沉迷度 | 600000 | 54000 | 78000 | 60000 | 0 | 60000 | +| 学习速度/ms | 43 | 73 | 135 | 123 | 100 | 130 | +| 勉励速度/ms | 80 | 90 | 100 | 120 | 0 | 90 | +| 隐蔽度 | 0.5 | 0.9 | 0.9 | 0.8 | 0.8 | 1.1 | +| 警戒范围 | 7500 | 15000 | 13500 | 15000 | 0 | 15000 | +| 视野范围 | 9000 | 11000 | 9000 | 10000 | 0 | 9000 | +| 开锁门速度/ms | 5000 | 5000 | 5000 | 3500 | 0 | 5000 | +| 翻窗速度/ms | 611 | 1466 | 1018 | 1222 | 1 | 916 | +| 翻箱速度/ms | 1250 | 1250 | 1250 | 1125 | 1000 | 750 | + +### 捣蛋鬼 +- Assassin + - 技能隐身(BecomeInvisible)添加约束条件“使用隐身技能后,人物状态进入UsingSpecialSkill,进入其他状态会使得隐身状态解除" +- 喧哗者ANoisyPerson + - 普通攻击改为strike +- Klee + - 被动技能Lucky!(新增):开局获得随机的一个道具(不会是钥匙) diff --git a/docs/版本更新说明.md b/docs/版本更新说明.md new file mode 100644 index 0000000..805dbda --- /dev/null +++ b/docs/版本更新说明.md @@ -0,0 +1,9 @@ +# 版本更新说明 + +# 说明 +- 只说明对于选手较为重要的修改 + +# 等待更新的更改 +- docs:添加了 游戏机制与平衡性调整更新草案.pdf +- docs:添加了 版本更新说明.pdf +- docs&hotfix: 修正了GameRules.pdf中学生翻窗速度的错误 \ No newline at end of file diff --git a/logic/GameClass/GameObj/Bullet/BombedBullet.cs b/logic/GameClass/GameObj/Bullet/BombedBullet.cs index c9b245f..b4afd1f 100644 --- a/logic/GameClass/GameObj/Bullet/BombedBullet.cs +++ b/logic/GameClass/GameObj/Bullet/BombedBullet.cs @@ -13,7 +13,6 @@ namespace GameClass.GameObj public BombedBullet(Bullet bullet) : base(bullet.Position, bullet.Radius, GameObjType.BombedBullet) { - this.place = bullet.Place; this.bulletHasBombed = bullet; this.MappingID = bullet.ID; this.FacingDirection = bullet.FacingDirection; diff --git a/logic/GameClass/GameObj/Bullet/Bullet.Ghost.cs b/logic/GameClass/GameObj/Bullet/Bullet.Ghost.cs index 2b3df5c..7601669 100644 --- a/logic/GameClass/GameObj/Bullet/Bullet.Ghost.cs +++ b/logic/GameClass/GameObj/Bullet/Bullet.Ghost.cs @@ -5,8 +5,8 @@ namespace GameClass.GameObj { internal sealed class CommonAttackOfGhost : Bullet { - public CommonAttackOfGhost(Character player, PlaceType placeType, XY pos, int radius = GameData.bulletRadius) : - base(player, radius, placeType, pos) + public CommonAttackOfGhost(Character player, XY pos, int radius = GameData.bulletRadius) : + base(player, radius, pos) { } public override double BulletBombRange => 0; @@ -52,8 +52,8 @@ namespace GameClass.GameObj internal sealed class FlyingKnife : Bullet { - public FlyingKnife(Character player, PlaceType placeType, XY pos, int radius = GameData.bulletRadius) : - base(player, radius, placeType, pos) + public FlyingKnife(Character player, XY pos, int radius = GameData.bulletRadius) : + base(player, radius, pos) { } public override double BulletBombRange => 0; @@ -100,8 +100,7 @@ namespace GameClass.GameObj internal sealed class BombBomb : Bullet { - public BombBomb(Character player, PlaceType placeType, XY pos, int radius = GameData.bulletRadius) : - base(player, radius, placeType, pos) + public BombBomb(Character player, XY pos, int radius = GameData.bulletRadius) : base(player, radius, pos) { } public override double BulletBombRange => GameData.basicBulletBombRange; @@ -146,8 +145,7 @@ namespace GameClass.GameObj } internal sealed class JumpyDumpty : Bullet { - public JumpyDumpty(Character player, PlaceType placeType, XY pos, int radius = GameData.bulletRadius) : - base(player, radius, placeType, pos) + public JumpyDumpty(Character player, XY pos, int radius = GameData.bulletRadius) : base(player, radius, pos) { } public override double BulletBombRange => GameData.basicBulletBombRange / 2; diff --git a/logic/GameClass/GameObj/Bullet/Bullet.cs b/logic/GameClass/GameObj/Bullet/Bullet.cs index 29f2d78..acada59 100644 --- a/logic/GameClass/GameObj/Bullet/Bullet.cs +++ b/logic/GameClass/GameObj/Bullet/Bullet.cs @@ -41,10 +41,9 @@ namespace GameClass.GameObj return true; return false; } - public Bullet(Character player, int radius, PlaceType placeType, XY Position) : + public Bullet(Character player, int radius, XY Position) : base(Position, radius, GameObjType.Bullet) { - this.place = placeType; this.CanMove = true; this.moveSpeed = this.Speed; this.hasSpear = player.TryUseSpear(); @@ -57,18 +56,18 @@ namespace GameClass.GameObj public static class BulletFactory { - public static Bullet? GetBullet(Character character, PlaceType place, XY pos) + public static Bullet? GetBullet(Character character, XY pos) { switch (character.BulletOfPlayer) { case BulletType.FlyingKnife: - return new FlyingKnife(character, place, pos); + return new FlyingKnife(character, pos); case BulletType.CommonAttackOfGhost: - return new CommonAttackOfGhost(character, place, pos); + return new CommonAttackOfGhost(character, pos); case BulletType.JumpyDumpty: - return new JumpyDumpty(character, place, pos); + return new JumpyDumpty(character, pos); case BulletType.BombBomb: - return new BombBomb(character, place, pos); + return new BombBomb(character, pos); default: return null; } diff --git a/logic/GameClass/GameObj/Character/Character.Skill.cs b/logic/GameClass/GameObj/Character/Character.Skill.cs index a1dc379..c835a6d 100644 --- a/logic/GameClass/GameObj/Character/Character.Skill.cs +++ b/logic/GameClass/GameObj/Character/Character.Skill.cs @@ -57,7 +57,6 @@ namespace GameClass.GameObj protected Character(XY initPos, int initRadius, CharacterType characterType) : base(initPos, initRadius, GameObjType.Character) { - this.place = PlaceType.Null; this.CanMove = true; this.score = 0; this.buffManager = new BuffManager(); diff --git a/logic/GameClass/GameObj/Character/Character.cs b/logic/GameClass/GameObj/Character/Character.cs index d8dea18..aa799eb 100644 --- a/logic/GameClass/GameObj/Character/Character.cs +++ b/logic/GameClass/GameObj/Character/Character.cs @@ -58,10 +58,10 @@ namespace GameClass.GameObj /// 进行一次攻击 /// /// 攻击操作发出的子弹 - public Bullet? Attack(XY pos, PlaceType place) + public Bullet? Attack(XY pos) { if (TrySubBulletNum()) - return BulletFactory.GetBullet(this, place, pos); + return BulletFactory.GetBullet(this, pos); else return null; } @@ -365,7 +365,6 @@ namespace GameClass.GameObj CanMove = false; IsResetting = true; Position = GameData.PosWhoDie; - place = PlaceType.Grass; } } #endregion diff --git a/logic/GameClass/GameObj/GameObj.cs b/logic/GameClass/GameObj/GameObj.cs index 3aba2a1..4a0bae8 100644 --- a/logic/GameClass/GameObj/GameObj.cs +++ b/logic/GameClass/GameObj/GameObj.cs @@ -14,20 +14,22 @@ namespace GameClass.GameObj protected readonly XY birthPos; - private GameObjType type; + private readonly GameObjType type; public GameObjType Type => type; private static long currentMaxID = 0; // 目前游戏对象的最大ID public const long invalidID = long.MaxValue; // 无效的ID - public const long noneID = long.MinValue; public long ID { get; } private XY position; public XY Position { - get => position; - protected - set + get + { + lock (gameObjLock) + return position; + } + set { lock (gameObjLock) { @@ -36,13 +38,14 @@ namespace GameClass.GameObj } } - protected PlaceType place; - public PlaceType Place { get => place; } - private XY facingDirection = new(1, 0); public XY FacingDirection { - get => facingDirection; + get + { + lock (gameObjLock) + return facingDirection; + } set { lock (gameObjLock) diff --git a/logic/GameClass/GameObj/Map/Chest.cs b/logic/GameClass/GameObj/Map/Chest.cs index 23d9571..b302e44 100644 --- a/logic/GameClass/GameObj/Map/Chest.cs +++ b/logic/GameClass/GameObj/Map/Chest.cs @@ -11,7 +11,6 @@ namespace GameClass.GameObj public Chest(XY initPos) : base(initPos, GameData.numOfPosGridPerCell / 2, GameObjType.Chest) { - this.place = PlaceType.Chest; this.CanMove = false; } public override bool IsRigid => true; diff --git a/logic/GameClass/GameObj/Map/Door.cs b/logic/GameClass/GameObj/Map/Door.cs index 6dd85e9..c03f160 100644 --- a/logic/GameClass/GameObj/Map/Door.cs +++ b/logic/GameClass/GameObj/Map/Door.cs @@ -11,9 +11,25 @@ namespace GameClass.GameObj public Door(XY initPos, PlaceType placeType) : base(initPos, GameData.numOfPosGridPerCell / 2, GameObjType.Door) { - this.place = placeType; + switch (placeType) + { + case PlaceType.Door3: + doorNum = 3; + break; + case PlaceType.Door5: + doorNum = 5; + break; + case PlaceType.Door6: + default: + doorNum = 6; + break; + } this.CanMove = false; } + + private readonly int doorNum; + public int DoorNum => doorNum; + public override bool IsRigid => !isOpen; public override ShapeType Shape => ShapeType.Square; diff --git a/logic/GameClass/GameObj/Map/Doorway.cs b/logic/GameClass/GameObj/Map/Doorway.cs index cff420b..4c5f78d 100644 --- a/logic/GameClass/GameObj/Map/Doorway.cs +++ b/logic/GameClass/GameObj/Map/Doorway.cs @@ -11,7 +11,6 @@ namespace GameClass.GameObj public Doorway(XY initPos) : base(initPos, GameData.numOfPosGridPerCell / 2, GameObjType.Doorway) { - this.place = PlaceType.Doorway; this.CanMove = false; } public override bool IsRigid => true; diff --git a/logic/GameClass/GameObj/Map/EmergencyExit.cs b/logic/GameClass/GameObj/Map/EmergencyExit.cs index f311238..02414c4 100644 --- a/logic/GameClass/GameObj/Map/EmergencyExit.cs +++ b/logic/GameClass/GameObj/Map/EmergencyExit.cs @@ -11,7 +11,6 @@ namespace GameClass.GameObj public EmergencyExit(XY initPos) : base(initPos, GameData.numOfPosGridPerCell / 2, GameObjType.EmergencyExit) { - this.place = PlaceType.EmergencyExit; this.CanMove = false; } public override bool IsRigid => true; diff --git a/logic/GameClass/GameObj/Map/Generator.cs b/logic/GameClass/GameObj/Map/Generator.cs index d982161..fe3fbd5 100644 --- a/logic/GameClass/GameObj/Map/Generator.cs +++ b/logic/GameClass/GameObj/Map/Generator.cs @@ -10,7 +10,6 @@ namespace GameClass.GameObj public Generator(XY initPos) : base(initPos, GameData.numOfPosGridPerCell / 2, GameObjType.Generator) { - this.place = PlaceType.Generator; this.CanMove = false; } public override bool IsRigid => true; diff --git a/logic/GameClass/GameObj/Map/Wall.cs b/logic/GameClass/GameObj/Map/Wall.cs index 3a81ee4..1cef8e9 100644 --- a/logic/GameClass/GameObj/Map/Wall.cs +++ b/logic/GameClass/GameObj/Map/Wall.cs @@ -10,7 +10,6 @@ namespace GameClass.GameObj public Wall(XY initPos) : base(initPos, GameData.numOfPosGridPerCell / 2, GameObjType.Wall) { - this.place = PlaceType.Wall; this.CanMove = false; } public override bool IsRigid => true; diff --git a/logic/GameClass/GameObj/Map/Window.cs b/logic/GameClass/GameObj/Map/Window.cs index 3694ec4..a71e05f 100644 --- a/logic/GameClass/GameObj/Map/Window.cs +++ b/logic/GameClass/GameObj/Map/Window.cs @@ -11,7 +11,6 @@ namespace GameClass.GameObj public Window(XY initPos) : base(initPos, GameData.numOfPosGridPerCell / 2, GameObjType.Window) { - this.place = PlaceType.Window; this.CanMove = false; } public override bool IsRigid => true; diff --git a/logic/GameClass/GameObj/Moveable.cs b/logic/GameClass/GameObj/Moveable.cs index 128240f..603df4b 100644 --- a/logic/GameClass/GameObj/Moveable.cs +++ b/logic/GameClass/GameObj/Moveable.cs @@ -48,27 +48,17 @@ namespace GameClass.GameObj public int OrgMoveSpeed { get; protected set; } // 移动,改变坐标 - public long MovingSetPos(XY moveVec, PlaceType place) + public long MovingSetPos(XY moveVec) { if (moveVec.x != 0 || moveVec.y != 0) lock (gameObjLock) { FacingDirection = moveVec; this.Position += moveVec; - this.place = place; } return moveVec * moveVec; } - public void ReSetPos(XY pos, PlaceType place) - { - lock (gameObjLock) - { - this.Position = pos; - this.place = place; - } - } - /// /// 设置移动速度 /// diff --git a/logic/GameClass/GameObj/OutOfBoundBlock.cs b/logic/GameClass/GameObj/OutOfBoundBlock.cs index 1c62417..3cd88eb 100644 --- a/logic/GameClass/GameObj/OutOfBoundBlock.cs +++ b/logic/GameClass/GameObj/OutOfBoundBlock.cs @@ -11,7 +11,6 @@ namespace GameClass.GameObj public OutOfBoundBlock(XY initPos) : base(initPos, int.MaxValue, GameObjType.OutOfBoundBlock) { - this.place = PlaceType.Wall; this.CanMove = false; } diff --git a/logic/GameClass/GameObj/PickedProp.cs b/logic/GameClass/GameObj/PickedProp.cs index 33418c2..221e6e8 100644 --- a/logic/GameClass/GameObj/PickedProp.cs +++ b/logic/GameClass/GameObj/PickedProp.cs @@ -17,7 +17,6 @@ namespace GameClass.GameObj public PickedProp(Prop prop) : base(prop.Position, prop.Radius, GameObjType.PickedProp) { - this.place = prop.Place; this.PropHasPicked = prop; this.MappingID = prop.ID; } diff --git a/logic/GameClass/GameObj/Prop.cs b/logic/GameClass/GameObj/Prop.cs index 3704a10..c3626de 100644 --- a/logic/GameClass/GameObj/Prop.cs +++ b/logic/GameClass/GameObj/Prop.cs @@ -19,10 +19,9 @@ namespace GameClass.GameObj public abstract PropType GetPropType(); - public Prop(XY initPos, PlaceType place, int radius = GameData.PropRadius) : + public Prop(XY initPos, int radius = GameData.PropRadius) : base(initPos, radius, GameObjType.Prop) { - this.place = place; this.CanMove = false; this.moveSpeed = GameData.PropMoveSpeed; } @@ -43,8 +42,8 @@ namespace GameClass.GameObj /// public sealed class AddSpeed : Prop { - public AddSpeed(XY initPos, PlaceType placeType) : - base(initPos, placeType) + public AddSpeed(XY initPos) : + base(initPos) { } public override PropType GetPropType() => PropType.AddSpeed; @@ -54,24 +53,24 @@ namespace GameClass.GameObj /// public sealed class AddLifeOrClairaudience : Prop { - public AddLifeOrClairaudience(XY initPos, PlaceType placeType) : - base(initPos, placeType) + public AddLifeOrClairaudience(XY initPos) : + base(initPos) { } public override PropType GetPropType() => PropType.AddLifeOrClairaudience; } public sealed class AddHpOrAp : Prop { - public AddHpOrAp(XY initPos, PlaceType placeType) : - base(initPos, placeType) + public AddHpOrAp(XY initPos) : + base(initPos) { } public override PropType GetPropType() => PropType.AddHpOrAp; } public sealed class RecoveryFromDizziness : Prop { - public RecoveryFromDizziness(XY initPos, PlaceType placeType) : - base(initPos, placeType) + public RecoveryFromDizziness(XY initPos) : + base(initPos) { } public override PropType GetPropType() => PropType.RecoveryFromDizziness; @@ -81,35 +80,35 @@ namespace GameClass.GameObj /// public sealed class ShieldOrSpear : Prop { - public ShieldOrSpear(XY initPos, PlaceType placeType) : base(initPos, placeType) + public ShieldOrSpear(XY initPos) : base(initPos) { } public override PropType GetPropType() => PropType.ShieldOrSpear; } public sealed class Key3 : Prop { - public Key3(XY initPos, PlaceType placeType) : base(initPos, placeType) + public Key3(XY initPos) : base(initPos) { } public override PropType GetPropType() => PropType.Key3; } public sealed class Key5 : Prop { - public Key5(XY initPos, PlaceType placeType) : base(initPos, placeType) + public Key5(XY initPos) : base(initPos) { } public override PropType GetPropType() => PropType.Key5; } public sealed class Key6 : Prop { - public Key6(XY initPos, PlaceType placeType) : base(initPos, placeType) + public Key6(XY initPos) : base(initPos) { } public override PropType GetPropType() => PropType.Key6; } public sealed class NullProp : Prop { - public NullProp(PlaceType placeType = PlaceType.Wall) : base(new XY(1, 1), placeType) + public NullProp() : base(new XY(1, 1)) { } public override PropType GetPropType() => PropType.Null; @@ -143,26 +142,26 @@ namespace GameClass.GameObj // #endregion public static class PropFactory { - public static Prop GetProp(PropType propType, XY pos, PlaceType place) + public static Prop GetProp(PropType propType, XY pos) { switch (propType) { case PropType.AddSpeed: - return new AddSpeed(pos, place); + return new AddSpeed(pos); case PropType.AddLifeOrClairaudience: - return new AddLifeOrClairaudience(pos, place); + return new AddLifeOrClairaudience(pos); case PropType.ShieldOrSpear: - return new ShieldOrSpear(pos, place); + return new ShieldOrSpear(pos); case PropType.AddHpOrAp: - return new AddHpOrAp(pos, place); + return new AddHpOrAp(pos); case PropType.RecoveryFromDizziness: - return new RecoveryFromDizziness(pos, place); + return new RecoveryFromDizziness(pos); case PropType.Key3: - return new Key3(pos, place); + return new Key3(pos); case PropType.Key5: - return new Key5(pos, place); + return new Key5(pos); case PropType.Key6: - return new Key6(pos, place); + return new Key6(pos); default: return new NullProp(); } diff --git a/logic/GameEngine/MoveEngine.cs b/logic/GameEngine/MoveEngine.cs index aa13c68..e3c758e 100644 --- a/logic/GameEngine/MoveEngine.cs +++ b/logic/GameEngine/MoveEngine.cs @@ -70,7 +70,7 @@ namespace GameEngine XY nextPos = obj.Position + moveVec; double maxLen = collisionChecker.FindMax(obj, nextPos, moveVec); maxLen = Math.Min(maxLen, obj.MoveSpeed / GameData.numOfStepPerSecond); - obj.MovingSetPos(new XY(moveVec, maxLen), GetPlaceType(nextPos)); + obj.MovingSetPos(new XY(moveVec, maxLen)); } public void MoveObj(IMoveable obj, int moveTime, double direction) @@ -90,7 +90,7 @@ namespace GameEngine double moveVecLength = 0.0; XY res = new(direction, moveVecLength); - double deltaLen = moveVecLength - Math.Sqrt(obj.MovingSetPos(res, GetPlaceType(obj.Position + res))); // 转向,并用deltaLen存储行走的误差 + double deltaLen = moveVecLength - Math.Sqrt(obj.MovingSetPos(res)); // 转向,并用deltaLen存储行走的误差 IGameObj? collisionObj = null; bool isDestroyed = false; @@ -156,7 +156,7 @@ namespace GameEngine } while (flag); if (threadNum == 0 || ((ICharacter)obj).ThreadNum == threadNum) - deltaLen += moveVecLength - Math.Sqrt(obj.MovingSetPos(res, GetPlaceType(obj.Position + res))); + deltaLen += moveVecLength - Math.Sqrt(obj.MovingSetPos(res)); return true; }, @@ -175,7 +175,7 @@ namespace GameEngine if ((collisionObj = collisionChecker.CheckCollisionWhenMoving(obj, res)) == null) { if (threadNum == 0 || ((ICharacter)obj).ThreadNum == threadNum) - obj.MovingSetPos(res, GetPlaceType(obj.Position + res)); + obj.MovingSetPos(res); } else { diff --git a/logic/Gaming/ActionManager.cs b/logic/Gaming/ActionManager.cs index 842e625..2e142e1 100644 --- a/logic/Gaming/ActionManager.cs +++ b/logic/Gaming/ActionManager.cs @@ -267,7 +267,7 @@ namespace Gaming { Prop prop = chestToOpen.PropInChest[i]; chestToOpen.PropInChest[i] = new NullProp(); - prop.ReSetPos(player.Position, gameMap.GetPlaceType(player.Position)); + prop.Position = player.Position; gameMap.Add(prop); } } @@ -295,7 +295,7 @@ namespace Gaming if (characterInWindow != null) { if (player.IsGhost() && !characterInWindow.IsGhost()) - characterManager.BeAttacked((Student)(characterInWindow), player.Attack(characterInWindow.Position, PlaceType.Null)); + characterManager.BeAttacked((Student)(characterInWindow), player.Attack(characterInWindow.Position)); return false; }*/ @@ -323,7 +323,7 @@ namespace Gaming return; } - player.ReSetPos(windowToPlayer + windowForClimb.Position, PlaceType.Window); + player.Position = windowToPlayer + windowForClimb.Position; player.MoveSpeed = player.SpeedOfClimbingThroughWindows; moveEngine.MoveObj(player, (int)(windowToPlayer.Length() * 3.0 * 1000 / player.MoveSpeed), (-1 * windowToPlayer).Angle()); @@ -339,7 +339,7 @@ namespace Gaming ) .Start(); XY PosJumpOff = windowForClimb.Position - 2 * windowToPlayer; - player.ReSetPos(PosJumpOff, gameMap.GetPlaceType(PosJumpOff)); + player.Position = PosJumpOff; player.MoveSpeed = player.ReCalculateBuff(BuffType.AddSpeed, player.OrgMoveSpeed, GameData.MaxSpeed, GameData.MinSpeed); windowForClimb.WhoIsClimbing = null; // gameMap.Remove(addWall); @@ -367,15 +367,15 @@ namespace Gaming switch (prop.GetPropType()) { case PropType.Key3: - if (doorToLock.Place == PlaceType.Door3) + if (doorToLock.DoorNum == 3) flag = true; break; case PropType.Key5: - if (doorToLock.Place == PlaceType.Door5) + if (doorToLock.DoorNum == 5) flag = true; break; case PropType.Key6: - if (doorToLock.Place == PlaceType.Door6) + if (doorToLock.DoorNum == 6) flag = true; break; default: diff --git a/logic/Gaming/AttackManager.cs b/logic/Gaming/AttackManager.cs index 9b9fc1e..69203b1 100644 --- a/logic/Gaming/AttackManager.cs +++ b/logic/Gaming/AttackManager.cs @@ -178,7 +178,7 @@ namespace Gaming (int)(Math.Abs((player.Radius + BulletFactory.BulletRadius(player.BulletOfPlayer)) * Math.Sin(angle))) * ((Math.Sin(angle) > 0) ? 1 : -1) ); - Bullet? bullet = player.Attack(res, gameMap.GetPlaceType(res)); + Bullet? bullet = player.Attack(res); if (bullet != null) { diff --git a/logic/Gaming/CharacterManager .cs b/logic/Gaming/CharacterManager .cs index 2a12664..92593a4 100644 --- a/logic/Gaming/CharacterManager .cs +++ b/logic/Gaming/CharacterManager .cs @@ -407,7 +407,7 @@ namespace Gaming Prop? prop = player.UseProp(i); if (prop != null) { - prop.ReSetPos(player.Position, gameMap.GetPlaceType(player.Position)); + prop.Position = player.Position; gameMap.Add(prop); } } diff --git a/logic/Gaming/PropManager.cs b/logic/Gaming/PropManager.cs index 6b2ba2b..57b18c9 100644 --- a/logic/Gaming/PropManager.cs +++ b/logic/Gaming/PropManager.cs @@ -124,13 +124,13 @@ namespace Gaming if (prop.GetPropType() == PropType.Null) return; - prop.ReSetPos(player.Position, gameMap.GetPlaceType(player.Position)); + prop.Position = player.Position; gameMap.Add(prop); } - private Prop ProduceOnePropNotKey(Random r, XY Pos) + private static Prop ProduceOnePropNotKey(Random r, XY Pos) { - return PropFactory.GetProp((PropType)r.Next(GameData.numOfTeachingBuilding + 1, GameData.numOfPropSpecies + 1), Pos, gameMap.GetPlaceType(Pos)); + return PropFactory.GetProp((PropType)r.Next(GameData.numOfTeachingBuilding + 1, GameData.numOfPropSpecies + 1), Pos); } private Chest GetChest(Random r) @@ -153,7 +153,7 @@ namespace Gaming { ++cou; Chest chest = GetChest(r); - chest.PropInChest[1] = new Key3(chest.Position, PlaceType.Chest); + chest.PropInChest[1] = new Key3(chest.Position); chest.PropInChest[0] = ProduceOnePropNotKey(r, chest.Position); } cou = 0; @@ -161,7 +161,7 @@ namespace Gaming { ++cou; Chest chest = GetChest(r); - chest.PropInChest[1] = new Key5(chest.Position, PlaceType.Chest); + chest.PropInChest[1] = new Key5(chest.Position); chest.PropInChest[0] = ProduceOnePropNotKey(r, chest.Position); } cou = 0; @@ -169,7 +169,7 @@ namespace Gaming { ++cou; Chest chest = GetChest(r); - chest.PropInChest[1] = new Key6(chest.Position, PlaceType.Chest); + chest.PropInChest[1] = new Key6(chest.Position); chest.PropInChest[0] = ProduceOnePropNotKey(r, chest.Position); } diff --git a/logic/Preparation/Interface/IGameObj.cs b/logic/Preparation/Interface/IGameObj.cs index 7990248..58c4141 100644 --- a/logic/Preparation/Interface/IGameObj.cs +++ b/logic/Preparation/Interface/IGameObj.cs @@ -7,7 +7,6 @@ namespace Preparation.Interface public GameObjType Type { get; } public long ID { get; } public XY Position { get; } // if Square, Pos equals the center - public PlaceType Place { get; } public XY FacingDirection { get; } public bool IsRigid { get; } public ShapeType Shape { get; } diff --git a/logic/Preparation/Interface/IMoveable.cs b/logic/Preparation/Interface/IMoveable.cs index a9ee5cb..d9c5e3a 100644 --- a/logic/Preparation/Interface/IMoveable.cs +++ b/logic/Preparation/Interface/IMoveable.cs @@ -9,8 +9,7 @@ namespace Preparation.Interface public int MoveSpeed { get; } public bool IsMoving { get; set; } public bool IsAvailable { get; } - public long MovingSetPos(XY moveVec, PlaceType place); - public void ReSetPos(XY pos, PlaceType place); + public long MovingSetPos(XY moveVec); public bool WillCollideWith(IGameObj? targetObj, XY nextPos) // 检查下一位置是否会和目标物碰撞 { if (targetObj == null) diff --git a/logic/Preparation/Utility/GameData.cs b/logic/Preparation/Utility/GameData.cs index b788f41..72c37b8 100644 --- a/logic/Preparation/Utility/GameData.cs +++ b/logic/Preparation/Utility/GameData.cs @@ -1,6 +1,5 @@ using Preparation.Interface; using System; -using System.Net.NetworkInformation; namespace Preparation.Utility { diff --git a/logic/Server/CopyInfo.cs b/logic/Server/CopyInfo.cs index d6a1423..9b4ff84 100644 --- a/logic/Server/CopyInfo.cs +++ b/logic/Server/CopyInfo.cs @@ -61,7 +61,6 @@ namespace Server Speed = player.MoveSpeed, Determination = player.HP, Addiction = player.GamingAddiction, - Place = Transformation.ToPlaceType((Preparation.Utility.PlaceType)player.Place), Guid = player.ID, PlayerState = Transformation.ToPlayerState((PlayerStateType)player.PlayerState), @@ -108,7 +107,6 @@ namespace Server X = player.Position.x, Y = player.Position.y, Speed = player.MoveSpeed, - Place = Transformation.ToPlaceType((Preparation.Utility.PlaceType)player.Place), TrickerType = Transformation.ToTrickerType(player.CharacterType), Guid = player.ID, @@ -152,7 +150,6 @@ namespace Server FacingDirection = bullet.FacingDirection.Angle(), Guid = bullet.ID, Team = (bullet.Parent!.IsGhost()) ? PlayerType.TrickerPlayer : PlayerType.StudentPlayer, - Place = Transformation.ToPlaceType((Preparation.Utility.PlaceType)bullet.Place), BombRange = bullet.BulletBombRange, Speed = bullet.Speed } @@ -170,8 +167,7 @@ namespace Server X = prop.Position.x, Y = prop.Position.y, FacingDirection = prop.FacingDirection.Angle(), - Guid = prop.ID, - Place = Transformation.ToPlaceType((Preparation.Utility.PlaceType)prop.Place) + Guid = prop.ID } }; return msg; diff --git a/logic/cmd/gameServerAndClient.cmd b/logic/cmd/gameServerAndClient.cmd index 125b391..71f90c7 100644 --- a/logic/cmd/gameServerAndClient.cmd +++ b/logic/cmd/gameServerAndClient.cmd @@ -1,6 +1,6 @@ @echo off -start cmd /k ..\Server\bin\Debug\net6.0\Server.exe --ip 0.0.0.0 --port 8888 --studentCount 0 --trickerCount 1 --gameTimeInSecond 600 --fileName test +start cmd /k ..\Server\bin\Debug\net6.0\Server.exe --ip 0.0.0.0 --port 8888 --studentCount 4 --trickerCount 1 --gameTimeInSecond 600 --fileName test ping -n 2 127.0.0.1 > NUL