Пример #1
0
        public static int CanCarryN(this CharacterInstance ch)
        {
            var penalty = 0;

            if (!ch.IsNpc() && ch.Level >= LevelConstants.ImmortalLevel)
            {
                return(ch.Trust * 200);
            }
            if (ch.IsNpc() && ch.Act.IsSet((int)ActFlags.Immortal))
            {
                return(ch.Level * 200);
            }
            if (ch.GetEquippedItem(WearLocations.Wield) != null)
            {
                ++penalty;
            }
            if (ch.GetEquippedItem(WearLocations.DualWield) != null)
            {
                ++penalty;
            }
            if (ch.GetEquippedItem(WearLocations.WieldMissile) != null)
            {
                ++penalty;
            }
            if (ch.GetEquippedItem(WearLocations.Hold) != null)
            {
                ++penalty;
            }
            if (ch.GetEquippedItem(WearLocations.Shield) != null)
            {
                ++penalty;
            }
            return(((ch.Level + 15) / 5 + ch.GetCurrentDexterity() - 13 - penalty).GetNumberThatIsBetween(5, 20));
        }
Пример #2
0
        public static bool CheckTumble(CharacterInstance ch, CharacterInstance victim, IRepositoryManager dbManager = null,
                                       IGameManager gameManager = null)
        {
            if (victim.CurrentClass != ClassTypes.Thief || !victim.IsAwake())
            {
                return(false);
            }

            var skill = (dbManager ?? RepositoryManager.Instance).GetEntity <SkillData>("tumble");

            if (skill == null)
            {
                throw new ObjectNotFoundException("Skill 'tumble' not found");
            }

            if (!victim.IsNpc() && !(((PlayerInstance)victim).GetLearned((int)skill.ID) > 0))
            {
                return(false);
            }

            int chances;

            if (victim.IsNpc())
            {
                chances = 60.GetLowestOfTwoNumbers(2 * victim.Level);
            }
            else
            {
                chances = (int)Macros.LEARNED(victim, (int)skill.ID) /
                          (gameManager ?? GameManager.Instance).SystemData.TumbleMod +
                          (victim.GetCurrentDexterity() - 13);
            }

            if (chances != 0 && victim.CurrentMorph != null)
            {
                chances += victim.CurrentMorph.Morph.TumbleChances;
            }

            if (!victim.Chance(chances + victim.Level - ch.Level))
            {
                return(false);
            }

            if (!victim.IsNpc() && !((PlayerInstance)victim).PlayerData.Flags.IsSet(PCFlags.Gag))
            {
                comm.act(ATTypes.AT_SKILL, "You tumble away from $n's attack.", ch, null, victim, ToTypes.Victim);
            }

            if (!ch.IsNpc() && !((PlayerInstance)ch).PlayerData.Flags.IsSet(PCFlags.Gag))
            {
                comm.act(ATTypes.AT_SKILL, "$N tumbles away from your attack.", ch, null, victim, ToTypes.Character);
            }

            skill.LearnFromSuccess(victim);
            return(true);
        }
Пример #3
0
 private static bool PotionWasFumbled(CharacterInstance ch)
 {
     return(SmaugRandom.D100() > ch.GetCurrentDexterity() * 2 + 48);
 }