diff --git a/logic/GameClass/GameObj/Character/Character.cs b/logic/GameClass/GameObj/Character/Character.cs index 6198096..aeec434 100644 --- a/logic/GameClass/GameObj/Character/Character.cs +++ b/logic/GameClass/GameObj/Character/Character.cs @@ -460,6 +460,19 @@ namespace GameClass.GameObj } } + public Prop UseProp(PropType propType) + { + lock (gameObjLock) + { + foreach (Prop prop in propInventory) + { + if (prop.GetPropType() == propType) + return prop; + } + return new NullProp(); + } + } + /// /// 如果indexing==GameData.maxNumOfPropInPropInventory表明道具栏为满 /// diff --git a/logic/GameClass/GameObj/Character/Skill.cs b/logic/GameClass/GameObj/Character/Skill.cs index 41cdc53..94a182e 100644 --- a/logic/GameClass/GameObj/Character/Skill.cs +++ b/logic/GameClass/GameObj/Character/Skill.cs @@ -95,7 +95,8 @@ namespace GameClass.GameObj return ActiveSkillType.UseKnife; case CanBeginToCharge: return ActiveSkillType.CanBeginToCharge; - case Teacher: + case Punish: + return ActiveSkillType.Publish; default: return ActiveSkillType.Null; } diff --git a/logic/Gaming/Game.cs b/logic/Gaming/Game.cs index d8e7670..7fe25d4 100644 --- a/logic/Gaming/Game.cs +++ b/logic/Gaming/Game.cs @@ -341,24 +341,24 @@ namespace Gaming _ = attackManager.Attack(player, angle); } } - public void UseProp(long playerID, int indexing) + public void UseProp(long playerID, PropType propType) { if (!gameMap.Timer.IsGaming) return; Character? player = gameMap.FindPlayer(playerID); if (player != null) { - propManager.UseProp(player, indexing); + propManager.UseProp(player, propType); } } - public void ThrowProp(long playerID, int indexing) + public void ThrowProp(long playerID, PropType propType) { if (!gameMap.Timer.IsGaming) return; Character? player = gameMap.FindPlayer(playerID); if (player != null) { - propManager.ThrowProp(player, indexing); + propManager.ThrowProp(player, propType); } } public bool PickProp(long playerID, PropType propType = PropType.Null) @@ -373,14 +373,14 @@ namespace Gaming return false; } - public bool UseActiveSkill(long playerID, ActiveSkillType activeSkillType) + public bool UseActiveSkill(long playerID, int skillNum) { if (!gameMap.Timer.IsGaming) return false; Character? player = gameMap.FindPlayer(playerID); if (player != null) { - return skillManager.UseActiveSkill(player, activeSkillType); + return skillManager.UseActiveSkill(player, player.Occupation.ListOfIActiveSkill[skillNum]); } else return false; diff --git a/logic/Gaming/PropManager.cs b/logic/Gaming/PropManager.cs index 4d3e692..685ef9f 100644 --- a/logic/Gaming/PropManager.cs +++ b/logic/Gaming/PropManager.cs @@ -21,11 +21,11 @@ namespace Gaming private readonly List availableCellForGenerateProp; - public void UseProp(Character player, int indexing) + public void UseProp(Character player, PropType propType) { if (player.IsResetting) return; - Prop prop = player.UseProp(indexing); + Prop prop = player.UseProp(propType); switch (prop.GetPropType()) { case PropType.ShieldOrSpear: @@ -106,11 +106,11 @@ namespace Gaming return false; } - public void ThrowProp(Character player, int indexing) + public void ThrowProp(Character player, PropType propType) { if (!gameMap.Timer.IsGaming || player.IsResetting) return; - Prop prop = player.UseProp(indexing); + Prop prop = player.UseProp(propType); if (prop.GetPropType() == PropType.Null) return; diff --git a/logic/Preparation/Interface/IOccupation.cs b/logic/Preparation/Interface/IOccupation.cs index 2830825..5eb88f7 100644 --- a/logic/Preparation/Interface/IOccupation.cs +++ b/logic/Preparation/Interface/IOccupation.cs @@ -76,7 +76,7 @@ namespace Preparation.Interface public BulletType InitBullet => BulletType.Null; - public List ListOfIActiveSkill => new(new ActiveSkillType[] { }); + public List ListOfIActiveSkill => new(new ActiveSkillType[] { ActiveSkillType.Publish }); public List ListOfIPassiveSkill => new(new PassiveSkillType[] { }); public const int fixSpeed = 0; @@ -116,7 +116,7 @@ namespace Preparation.Interface public BulletType InitBullet => BulletType.Null; - public List ListOfIActiveSkill => new(new ActiveSkillType[] { }); + public List ListOfIActiveSkill => new(new ActiveSkillType[] { ActiveSkillType.CanBeginToCharge }); public List ListOfIPassiveSkill => new(new PassiveSkillType[] { }); public const int fixSpeed = GameData.basicFixSpeed * 6 / 10; diff --git a/logic/Preparation/Utility/EnumType.cs b/logic/Preparation/Utility/EnumType.cs index d9fcb36..c2ccce3 100644 --- a/logic/Preparation/Utility/EnumType.cs +++ b/logic/Preparation/Utility/EnumType.cs @@ -90,7 +90,8 @@ namespace Preparation.Utility NuclearWeapon = 3, SuperFast = 4, UseKnife = 5, - CanBeginToCharge = 6 + CanBeginToCharge = 6, + Publish = 7, } public enum PassiveSkillType { diff --git a/logic/Server/CopyInfo.cs b/logic/Server/CopyInfo.cs index 98560ef..5337692 100644 --- a/logic/Server/CopyInfo.cs +++ b/logic/Server/CopyInfo.cs @@ -259,11 +259,11 @@ namespace Server foreach (var keyValue in player.TimeUntilActiveSkillAvailable) msg.TrickerMessage.TimeUntilSkillAvailable.Add(keyValue.Value); for (int i = 0; i < GameData.maxNumOfSkill - player.TimeUntilActiveSkillAvailable.Count(); ++i) - msg.StudentMessage.TimeUntilSkillAvailable.Add(-1); + msg.TrickerMessage.TimeUntilSkillAvailable.Add(-1); msg.TrickerMessage.Place = ToPlaceType(player.Place); foreach (var value in player.PropInventory) - msg.StudentMessage.Prop.Add(ToPropType(value.GetPropType())); + msg.TrickerMessage.Prop.Add(ToPropType(value.GetPropType())); msg.TrickerMessage.TrickerType = ToTrickerType(player.CharacterType); msg.TrickerMessage.Guid = player.ID;