| @@ -45,7 +45,7 @@ namespace GameClass.GameObj | |||
| this.place = placeType; | |||
| this.CanMove = true; | |||
| this.moveSpeed = this.Speed; | |||
| this.hasSpear = player.HasSpear; | |||
| this.hasSpear = player.TryUseSpear(); | |||
| this.Parent = player; | |||
| } | |||
| public override bool IsRigid => true; // 默认为true | |||
| @@ -1,5 +1,6 @@ | |||
| using System; | |||
| using System.Collections.Generic; | |||
| using System.Linq; | |||
| using System.Runtime.InteropServices; | |||
| using System.Threading; | |||
| using Preparation.Utility; | |||
| @@ -183,6 +184,44 @@ namespace GameClass.GameObj | |||
| } | |||
| } | |||
| } | |||
| public bool TryUseSpear() | |||
| { | |||
| if (HasSpear) | |||
| { | |||
| lock (buffListLock[(int)BuffType.Spear]) | |||
| { | |||
| buffList[(int)BuffType.Spear].RemoveFirst(); | |||
| } | |||
| return true; | |||
| } | |||
| return false; | |||
| } | |||
| public void AddClairaudience(int shieldTime) => AddBuff(new BuffValue(), shieldTime, BuffType.Clairaudience, () => | |||
| { }); | |||
| public bool HasClairaudience | |||
| { | |||
| get | |||
| { | |||
| lock (buffListLock[(int)BuffType.Clairaudience]) | |||
| { | |||
| return buffList[(int)BuffType.Clairaudience].Count != 0; | |||
| } | |||
| } | |||
| } | |||
| public void AddInvisible(int shieldTime) => AddBuff(new BuffValue(), shieldTime, BuffType.Invisible, () => | |||
| { }); | |||
| public bool HasInvisible | |||
| { | |||
| get | |||
| { | |||
| lock (buffListLock[(int)BuffType.Invisible]) | |||
| { | |||
| return buffList[(int)BuffType.Invisible].Count != 0; | |||
| } | |||
| } | |||
| } | |||
| /// <summary> | |||
| /// 清除所有buff | |||
| @@ -123,22 +123,6 @@ namespace GameClass.GameObj | |||
| }*/ | |||
| #endregion | |||
| #region 感知相关的基本属性及方法 | |||
| /// <summary> | |||
| /// 是否在隐身 | |||
| /// </summary> | |||
| private bool isInvisible = false; | |||
| public bool IsInvisible | |||
| { | |||
| get => isInvisible; | |||
| set | |||
| { | |||
| lock (gameObjLock) | |||
| { | |||
| isInvisible = value; | |||
| } | |||
| } | |||
| } | |||
| private Dictionary<BgmType, double> bgmDictionary = new(); | |||
| public Dictionary<BgmType, double> BgmDictionary | |||
| { | |||
| @@ -519,6 +503,12 @@ namespace GameClass.GameObj | |||
| public void AddSpear(int spearTime) => buffManager.AddSpear(spearTime); | |||
| public bool HasSpear => buffManager.HasSpear; | |||
| public void AddClairaudience(int time) => buffManager.AddClairaudience(time); | |||
| public bool HasClairaudience => buffManager.HasClairaudience; | |||
| public void AddInvisible(int time) => buffManager.AddInvisible(time); | |||
| public bool HasInvisible => buffManager.HasInvisible; | |||
| private Array buffTypeArray = Enum.GetValues(typeof(BuffType)); | |||
| public Dictionary<BuffType, bool> Buff | |||
| { | |||
| @@ -568,6 +558,11 @@ namespace GameClass.GameObj | |||
| return false; | |||
| } | |||
| public bool TryUseSpear() | |||
| { | |||
| return buffManager.TryUseSpear(); | |||
| } | |||
| public bool TryUseShield() | |||
| { | |||
| if (buffManager.TryUseShield()) | |||
| @@ -251,7 +251,7 @@ namespace GameClass.GameObj | |||
| } | |||
| public bool CanSee(Character player, GameObj gameObj) | |||
| { | |||
| if ((gameObj.Type == GameObjType.Character) && !((Character)gameObj).IsInvisible) return false; | |||
| if ((gameObj.Type == GameObjType.Character) && !((Character)gameObj).HasInvisible) return false; | |||
| XY pos1 = player.Position; | |||
| XY pos2 = gameObj.Position; | |||
| XY del = pos1 - pos2; | |||
| @@ -45,13 +45,14 @@ namespace Gaming | |||
| public static bool BecomeInvisible(Character player) | |||
| { | |||
| return ActiveSkillEffect(player.UseIActiveSkill(ActiveSkillType.BecomeInvisible), player, () => | |||
| IActiveSkill activeSkill = player.UseIActiveSkill(ActiveSkillType.BecomeInvisible); | |||
| return ActiveSkillEffect(activeSkill, player, () => | |||
| { | |||
| player.IsInvisible = true; | |||
| player.AddInvisible(activeSkill.DurationTime); | |||
| Debugger.Output(player, "become invisible!"); | |||
| }, | |||
| () => | |||
| { player.IsInvisible = false; }); | |||
| { }); | |||
| } | |||
| public bool NuclearWeapon(Character player) | |||
| @@ -64,6 +64,40 @@ namespace Preparation.Interface | |||
| public int timeOfOpenChest = GameData.basicSpeedOfOpenChest; | |||
| public int TimeOfOpenChest => timeOfOpenChest; | |||
| } | |||
| public class HoD : IGhost | |||
| { | |||
| private const int moveSpeed = GameData.basicMoveSpeed * 473 / 380; | |||
| public int MoveSpeed => moveSpeed; | |||
| 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<ActiveSkillType> ListOfIActiveSkill => new(new ActiveSkillType[] { ActiveSkillType.BecomeInvisible, ActiveSkillType.UseKnife }); | |||
| public List<PassiveSkillType> ListOfIPassiveSkill => new(new PassiveSkillType[] { }); | |||
| public double concealment = GameData.basicConcealment * 1.5; | |||
| public double Concealment => concealment; | |||
| public int alertnessRadius = (int)(GameData.basicAlertnessRadius * 1.3); | |||
| public int AlertnessRadius => alertnessRadius; | |||
| public int viewRange = (int)(GameData.basicViewRange * 1.3); | |||
| public int ViewRange => viewRange; | |||
| public int timeOfOpeningOrLocking = GameData.basicSpeedOfOpeningOrLocking; | |||
| public int TimeOfOpeningOrLocking => timeOfOpeningOrLocking; | |||
| public int speedOfClimbingThroughWindows = GameData.basicGhostSpeedOfClimbingThroughWindows; | |||
| public int SpeedOfClimbingThroughWindows => speedOfClimbingThroughWindows; | |||
| public int timeOfOpenChest = GameData.basicSpeedOfOpenChest; | |||
| public int TimeOfOpenChest => timeOfOpenChest; | |||
| } | |||
| public class Teacher : IStudent | |||
| { | |||
| private const int moveSpeed = GameData.basicMoveSpeed * 3 / 4; | |||
| @@ -111,6 +111,8 @@ namespace Preparation.Utility | |||
| Shield = 3, | |||
| Spear = 4, | |||
| AddAp = 5, | |||
| Clairaudience = 6, | |||
| Invisible = 7, | |||
| } | |||
| public enum PlaceType | |||