From a340fed2c3daaf921902aed3caba813a444ea70e Mon Sep 17 00:00:00 2001 From: shangfengh <3495281661@qq.com> Date: Fri, 31 Mar 2023 18:20:22 +0800 Subject: [PATCH] perf: :zap: optimize the bullet system --- logic/GameClass/GameObj/Bullet/Bullet.cs | 2 +- .../GameObj/Character/Character.Skill.cs | 2 -- logic/Gaming/AttackManager.cs | 2 +- logic/Preparation/Interface/IOccupation.cs | 25 ------------------- 4 files changed, 2 insertions(+), 29 deletions(-) diff --git a/logic/GameClass/GameObj/Bullet/Bullet.cs b/logic/GameClass/GameObj/Bullet/Bullet.cs index ab8efd3..86dfdb8 100644 --- a/logic/GameClass/GameObj/Bullet/Bullet.cs +++ b/logic/GameClass/GameObj/Bullet/Bullet.cs @@ -110,7 +110,7 @@ namespace GameClass.GameObj case BulletType.JumpyDumpty: return JumpyDumpty.maxBulletNum; default: - return 1; + return 0; } } } diff --git a/logic/GameClass/GameObj/Character/Character.Skill.cs b/logic/GameClass/GameObj/Character/Character.Skill.cs index 026076e..42664ac 100644 --- a/logic/GameClass/GameObj/Character/Character.Skill.cs +++ b/logic/GameClass/GameObj/Character/Character.Skill.cs @@ -91,8 +91,6 @@ namespace GameClass.GameObj } this.MaxHp = this.hp = Occupation.MaxHp; this.OrgMoveSpeed = this.moveSpeed = Occupation.MoveSpeed; - this.OrgCD = this.cd = BulletFactory.BulletCD(Occupation.InitBullet); - this.bulletNum = this.maxBulletNum = Occupation.MaxBulletNum; this.bulletOfPlayer = this.OriBulletOfPlayer = Occupation.InitBullet; this.concealment = Occupation.Concealment; this.alertnessRadius = Occupation.AlertnessRadius; diff --git a/logic/Gaming/AttackManager.cs b/logic/Gaming/AttackManager.cs index ac44688..01ca4f6 100644 --- a/logic/Gaming/AttackManager.cs +++ b/logic/Gaming/AttackManager.cs @@ -169,7 +169,7 @@ namespace Gaming return false; } - if (!player.Commandable()) + if (player.BulletOfPlayer == BulletType.Null || !player.Commandable()) return false; XY res = player.Position + new XY // 子弹紧贴人物生成。 diff --git a/logic/Preparation/Interface/IOccupation.cs b/logic/Preparation/Interface/IOccupation.cs index 47d1d1e..0a1d07f 100644 --- a/logic/Preparation/Interface/IOccupation.cs +++ b/logic/Preparation/Interface/IOccupation.cs @@ -8,7 +8,6 @@ namespace Preparation.Interface public int MoveSpeed { get; } public int MaxHp { get; } public BulletType InitBullet { get; } - public int MaxBulletNum { get; } public List ListOfIActiveSkill { get; } public List ListOfIPassiveSkill { get; } public double Concealment { get; } @@ -38,9 +37,6 @@ namespace Preparation.Interface private const int maxHp = GameData.basicHp; public int MaxHp => maxHp; - public const int maxBulletNum = 1; - public int MaxBulletNum => maxBulletNum; - public BulletType InitBullet => BulletType.CommonAttackOfGhost; public List ListOfIActiveSkill => new(new ActiveSkillType[] { ActiveSkillType.BecomeInvisible, ActiveSkillType.UseKnife }); @@ -72,9 +68,6 @@ namespace Preparation.Interface private const int maxHp = GameData.basicHp; public int MaxHp => maxHp; - public const int maxBulletNum = 1; - public int MaxBulletNum => maxBulletNum; - public BulletType InitBullet => BulletType.CommonAttackOfGhost; public List ListOfIActiveSkill => new(new ActiveSkillType[] { ActiveSkillType.JumpyBomb }); @@ -106,9 +99,6 @@ namespace Preparation.Interface private const int maxHp = GameData.basicHp * 12 / 10; public int MaxHp => maxHp; - public const int maxBulletNum = 1; - public int MaxBulletNum => maxBulletNum; - public BulletType InitBullet => BulletType.CommonAttackOfGhost; public List ListOfIActiveSkill => new(new ActiveSkillType[] { ActiveSkillType.Howl }); @@ -143,9 +133,6 @@ namespace Preparation.Interface private const int maxGamingAddiction = GameData.basicMaxGamingAddiction * 10; public int MaxGamingAddiction => maxGamingAddiction; - public const int maxBulletNum = 0; - public int MaxBulletNum => maxBulletNum; - public BulletType InitBullet => BulletType.Null; public List ListOfIActiveSkill => new(new ActiveSkillType[] { ActiveSkillType.Punish }); @@ -186,9 +173,6 @@ namespace Preparation.Interface private const int maxGamingAddiction = GameData.basicMaxGamingAddiction * 9 / 10; public int MaxGamingAddiction => maxGamingAddiction; - public const int maxBulletNum = 0; - public int MaxBulletNum => maxBulletNum; - public BulletType InitBullet => BulletType.Null; public List ListOfIActiveSkill => new(new ActiveSkillType[] { ActiveSkillType.CanBeginToCharge }); @@ -229,9 +213,6 @@ namespace Preparation.Interface private const int maxGamingAddiction = (int)(GameData.basicMaxGamingAddiction * 1.5); public int MaxGamingAddiction => maxGamingAddiction; - public const int maxBulletNum = 0; - public int MaxBulletNum => maxBulletNum; - public BulletType InitBullet => BulletType.Null; public List ListOfIActiveSkill => new(new ActiveSkillType[] { ActiveSkillType.WriteAnswers }); @@ -272,9 +253,6 @@ namespace Preparation.Interface private const int maxGamingAddiction = 0; public int MaxGamingAddiction => maxGamingAddiction; - public const int maxBulletNum = 0; - public int MaxBulletNum => maxBulletNum; - public BulletType InitBullet => BulletType.Null; public List ListOfIActiveSkill => new(new ActiveSkillType[] { }); @@ -315,9 +293,6 @@ namespace Preparation.Interface private const int maxGamingAddiction = (int)(GameData.basicMaxGamingAddiction * 1.1); public int MaxGamingAddiction => maxGamingAddiction; - public const int maxBulletNum = 0; - public int MaxBulletNum => maxBulletNum; - public BulletType InitBullet => BulletType.Null; public List ListOfIActiveSkill => new(new ActiveSkillType[] { });