fix: 🐛 fix the Fuction of LockDoor
tags/0.1.0
| @@ -164,7 +164,7 @@ namespace GameClass.GameObj | |||
| ap = value; | |||
| } | |||
| } | |||
| public override int Speed => 4300; | |||
| public override int Speed => (int)(GameData.basicBulletMoveSpeed * 43 / 37); | |||
| public override bool IsRemoteAttack => false; | |||
| public override int CastTime => 0; | |||
| @@ -296,6 +296,27 @@ namespace GameClass.GameObj | |||
| } | |||
| return GameObjForInteract; | |||
| } | |||
| public GameObj? PartInTheSameCell(XY Pos, GameObjType gameObjType) | |||
| { | |||
| GameObj? GameObjForInteract = null; | |||
| GameObjLockDict[gameObjType].EnterReadLock(); | |||
| try | |||
| { | |||
| foreach (GameObj gameObj in GameObjDict[gameObjType]) | |||
| { | |||
| if (GameData.PartInTheSameCell(gameObj.Position, Pos)) | |||
| { | |||
| GameObjForInteract = gameObj; | |||
| break; | |||
| } | |||
| } | |||
| } | |||
| finally | |||
| { | |||
| GameObjLockDict[gameObjType].ExitReadLock(); | |||
| } | |||
| return GameObjForInteract; | |||
| } | |||
| public GameObj? OneForInteractInACross(XY Pos, GameObjType gameObjType) | |||
| { | |||
| GameObj? GameObjForInteract = null; | |||
| @@ -55,7 +55,7 @@ namespace Gaming | |||
| public bool Fix(Student player)// 自动检查有无发电机可修 | |||
| { | |||
| if ((!player.Commandable()) || player.PlayerState == PlayerStateType.Fixing) | |||
| if (player.CharacterType == CharacterType.Teacher || (!player.Commandable()) || player.PlayerState == PlayerStateType.Fixing) | |||
| return false; | |||
| Generator? generatorForFix = (Generator?)gameMap.OneForInteract(player.Position, GameObjType.Generator); | |||
| @@ -368,7 +368,7 @@ namespace Gaming | |||
| if (!(player.Commandable()) || player.PlayerState == PlayerStateType.LockingOrOpeningTheDoor) | |||
| return false; | |||
| Door? doorToLock = (Door?)gameMap.OneForInteract(player.Position, GameObjType.Door); | |||
| if (doorToLock == null || doorToLock.OpenOrLockDegree > 0) | |||
| if (doorToLock == null || doorToLock.OpenOrLockDegree > 0 || gameMap.PartInTheSameCell(doorToLock.Position, GameObjType.Character) != null) | |||
| return false; | |||
| bool flag = false; | |||
| foreach (Prop prop in player.PropInventory) | |||
| @@ -403,7 +403,8 @@ namespace Gaming | |||
| loopCondition: () => flag && player.PlayerState == PlayerStateType.LockingOrOpeningTheDoor && gameMap.Timer.IsGaming && doorToLock.OpenOrLockDegree < GameData.degreeOfLockingOrOpeningTheDoor, | |||
| loopToDo: () => | |||
| { | |||
| flag = ((gameMap.OneInTheSameCell(doorToLock.Position, GameObjType.Character)) == null); | |||
| flag = ((gameMap.PartInTheSameCell(doorToLock.Position, GameObjType.Character)) == null); | |||
| Preparation.Utility.Debugger.Output(doorToLock, flag.ToString()); | |||
| doorToLock.OpenOrLockDegree += GameData.frameDuration * player.SpeedOfOpeningOrLocking; | |||
| }, | |||
| timeInterval: GameData.frameDuration, | |||
| @@ -1,4 +1,5 @@ | |||
| using System; | |||
| using Preparation.Interface; | |||
| using System; | |||
| using System.Net.NetworkInformation; | |||
| namespace Preparation.Utility | |||
| @@ -68,6 +69,11 @@ namespace Preparation.Utility | |||
| { | |||
| return PosGridToCellX(pos1) == PosGridToCellX(pos2) && PosGridToCellY(pos1) == PosGridToCellY(pos2); | |||
| } | |||
| public static bool PartInTheSameCell(XY pos1, XY pos2) | |||
| { | |||
| return Math.Abs((pos1 - pos2).x) < characterRadius + (numOfPosGridPerCell / 2) | |||
| && Math.Abs((pos1 - pos2).y) < characterRadius + (numOfPosGridPerCell / 2); | |||
| } | |||
| public static bool ApproachToInteract(XY pos1, XY pos2) | |||
| { | |||
| if (pos1 == pos2) return false; | |||
| @@ -4,13 +4,6 @@ | |||
| - *斜体表示Logic底层尚未(完全)实现* | |||
| - []表示待决定 | |||
| ## 游戏简介 | |||
| - 1位捣蛋鬼对抗4位学生的非对称竞技模式 | |||
| - [本届THUAI电子系赛道为以4名同学和1名捣蛋鬼的求学与阻挠展开的非对称竞技模式,同学需要完成足够的家庭作业和考试,相互督促以避免沉迷娱乐生活,利用道具地形躲避捣蛋鬼的各种干扰诱惑,完成学业;捣蛋鬼则要极力阻止。] | |||
| - [我们的设计是一个非对称游戏,类似第五人格,分为学生、捣蛋鬼两个阵营。在游戏中,学生修完若干课程之后通过考试即可顺利毕业,捣蛋鬼试图干扰学生使其沉迷游戏,以致于无法修完规定课程,直至挂科、退学。] | |||
| [对于选手来说,需要提前制定好学生的学习方案以抵御对方捣蛋鬼的干扰,类似地,也需要制定好捣蛋鬼的行动策略以影响对方学生的学习,也即每队至少要写好两份代码以执行不同阵营的不同策略。] | |||
| [当一局比赛结束(场上的学生有且仅有两种状态:退学或毕业)时,分别记录双方总得分;之后双方换边进行下半场比赛。最终将每队的学生方、捣蛋鬼方的得分相加,比较总得分判断胜负。] | |||
| ## 简要规则 | |||
| ### 地图 | |||
| @@ -21,29 +14,30 @@ | |||
| - 略 | |||
| - 地图上的每个格子有自己的区域类型:陆地、墙、草地、电机、出口、紧急出口、门、窗、箱子 | |||
| ### 人物状态 | |||
| 游戏人物共有17种不可叠加的状态:(加^为学生独有) | |||
| 1.普通状态 | |||
| 2^.学习 | |||
| 3^.被治疗 | |||
| 4^.在治疗 | |||
| 5.开或锁门 | |||
| 6.翻箱 | |||
| 7.使用技能 | |||
| 8^.正在毕业 | |||
| 9^.唤醒他人中 | |||
| 10^.被唤醒中(从沉迷状态中) | |||
| 11^.沉迷 | |||
| 12^.退学 | |||
| 13^.毕业 | |||
| 14.被眩晕 | |||
| 15.前摇 | |||
| 16.后摇 | |||
| 17.翻窗 | |||
| 其中后8项为不可行动状态 | |||
| -不加声明,不可行动状态中的玩家各项指令是无效的 | |||
| ### 人物 | |||
| - 人物半径为800 | |||
| - 游戏人物共有17种不可叠加的状态:(加^为学生独有) | |||
| 1. 普通状态 | |||
| 2. 学习^ | |||
| 3. 被治疗^ | |||
| 4. 在治疗^ | |||
| 5. 开或锁门 | |||
| 6. 翻箱 | |||
| 7. 使用技能 | |||
| 8. 正在毕业^ | |||
| 9. 唤醒他人中^ | |||
| 10. 被唤醒中(从沉迷状态中^ | |||
| 11. 沉迷^ | |||
| 12. 退学^ | |||
| 13. 毕业^ | |||
| 14. 被眩晕 | |||
| 15. 前摇 | |||
| 16. 后摇 | |||
| 17. 翻窗 | |||
| - 其中后8项为不可行动状态 | |||
| - 不加声明,不可行动状态中的玩家各项指令是无效的 | |||
| ### 交互 | |||
| - 除了翻窗,交互目标与交互者在一个九宫格内则为可交互 | |||
| @@ -265,7 +259,6 @@ | |||
| ## 细则 | |||
| ### 特殊说明 | |||
| - 不加说明,这里“学生”往往包括职业“教师” | |||
| ### 初始状态 | |||
| @@ -299,118 +292,11 @@ | |||
| - 爬窗:从窗一侧边缘中点到另一侧格子中心,位置渐移,时间=距离/爬窗速度。中断时,停留在另一侧格子中心 | |||
| ### 箱子 | |||
| - 地图上有8个箱子 | |||
| - 同一时刻只允许一人进行开启 | |||
| - 未开启完成的箱子在下一次需要重新开始开启。 | |||
| - 箱子开启后其中道具才可以被观测和拿取 | |||
| ## 游戏内Logic底层的枚举类型、类与属性 | |||
| - 底层实现中的属性,不代表界面全部都需要展示,也可能需要额外展示信息 | |||
| - 只展示外部需要的属性,部分属性被省略 | |||
| ### 物体 | |||
| - 位置 | |||
| - 位置地形 | |||
| - ID | |||
| - 类型 | |||
| - 面向角度 | |||
| - 形状 | |||
| - 半径 | |||
| - 是否可移动 | |||
| - 是否在移动 | |||
| - 移动速度 | |||
| ### 人物:物体 | |||
| - 装弹CD | |||
| - 持有子弹数量 | |||
| - 血量 | |||
| - 最大血量 | |||
| - 玩家状态(不可叠加) | |||
| - Bgm(字典) | |||
| - 得分 | |||
| - 当前子弹类型 | |||
| - 原始子弹类型 | |||
| - 持有道具 (最多三个)(数组) | |||
| - 是否隐身 | |||
| - 队伍ID | |||
| - 玩家ID | |||
| - 当前Buff | |||
| - 职业类型 | |||
| - 拥有的被动技能(列表) | |||
| - 拥有的主动技能(列表) | |||
| - 各个主动技能CD(字典) | |||
| - 警戒半径 | |||
| - double 隐蔽度 | |||
| - 翻窗时间 | |||
| - 开锁门速度 | |||
| - 开箱速度 | |||
| - 视野范围 | |||
| ### 学生:人物 | |||
| - 修理电机速度 | |||
| - 治疗速度 | |||
| - 沉迷游戏程度 | |||
| - 最大沉迷游戏程度 | |||
| - 被治疗程度 | |||
| - 被救援程度 | |||
| ### 搞蛋鬼:人物 | |||
| 无 | |||
| ### 队伍: | |||
| - 队伍ID | |||
| - 队伍得分 | |||
| - 队伍成员 | |||
| ### 所有物: | |||
| - 主人 | |||
| ### 子弹:所有物 | |||
| - 子弹攻击范围 | |||
| - 子弹爆炸范围 | |||
| - 子弹攻击力 | |||
| - 是否可以穿墙 | |||
| - 是否为远程攻击 | |||
| - 移动速度 | |||
| - 子弹类型 | |||
| ### 爆炸中的子弹:物体 | |||
| - 原来的子弹ID | |||
| - 爆炸范围 | |||
| - 子弹类型 | |||
| ### 道具:所有物 | |||
| - 道具类型 | |||
| ### 被捡起的道具:物体 | |||
| - 原来的道具ID | |||
| - 道具类型 | |||
| ### 出口:物体 | |||
| - 电力供应(是否可以被打开) | |||
| - 开启进度 | |||
| ### 紧急出口:物体 | |||
| - 是否显现 | |||
| - 是否打开 | |||
| ### 墙:物体 | |||
| ### 窗:物体 | |||
| - 正在翻窗的人 | |||
| ### 箱子:物体 | |||
| - 开箱进度 | |||
| ### 门:物体 | |||
| - 属于那个教学区 | |||
| - 是否锁上 | |||
| - 开锁门进度 | |||
| - 不提供是否可以锁上的属性 | |||
| ### 电机(建议称为homework):物体 | |||
| - 修理程度 | |||
| ## 键鼠控制 | |||
| | 键位 | 效果 | | |||