Ejemplo n.º 1
0
        public static void AdjustFavor(this PlayerInstance ch, DeityFieldTypes field, int mod)
        {
            if (ch.IsNpc() || ch.PlayerData.CurrentDeity == null)
            {
                return;
            }

            var oldfavor = ch.PlayerData.Favor;
            var deity    = ch.PlayerData.CurrentDeity;

            if ((ch.CurrentAlignment - deity.Alignment > 650) ||
                (ch.CurrentAlignment - deity.Alignment < -650) &&
                (deity.Alignment != 0))
            {
                ch.PlayerData.Favor -= 2;
                ch.PlayerData.Favor  = ch.PlayerData.Favor.GetNumberThatIsBetween(-2500, 2500);

                deity.UpdateCharacterBits(ch);
                ch.CheckForExtremeFavor(oldfavor);
            }
            else
            {
                ch.PlayerData.Favor += deity.FuzzifyFavor(field, mod < 1 ? 1 : mod);
                ch.PlayerData.Favor  = ch.PlayerData.Favor.GetNumberThatIsBetween(-2500, 2500);
            }
        }
Ejemplo n.º 2
0
        private static bool CastPause(PlayerInstance ch, string argument)
        {
            var sn = ch.tempnum;

            if (Macros.IS_VALID_SN(sn))
            {
                var skill = RepositoryManager.Instance.GetEntity <SkillData>(sn);
                if (skill == null)
                {
                    ch.SendTo("Something went wrong...");
                    return(false);
                }

                if (skill.Type != Common.Enumerations.SkillTypes.Spell)
                {
                    ch.SendTo("Something cancels out the spell!");
                    return(false);
                }

                var skillLevel = skill.SkillLevels.ToList()[(int)ch.CurrentClass];
                var mana       = ch.IsNpc() ? 0 : Macros.UMAX(skill.MinimumMana, 100 / (2 + ch.Level - skillLevel));
                var blood      = Macros.UMAX(1, (mana + 4) / 8);

                // TODO magic.c 1643
            }

            return(true);
        }
Ejemplo n.º 3
0
        private static bool CastAbortTimer(PlayerInstance ch, string argument)
        {
            var sn = ch.tempnum;

            if (Macros.IS_VALID_SN(sn))
            {
                var skill = RepositoryManager.Instance.GetEntity <SkillData>(sn);
                if (skill == null)
                {
                    ch.SendTo("Something went wrong...");
                    return(false);
                }

                var skillLevel = skill.SkillLevels.ToList()[(int)ch.CurrentClass];
                var mana       = ch.IsNpc() ? 0 : Macros.UMAX(skill.MinimumMana, 100 / (2 + ch.Level - skillLevel));
                var blood      = Macros.UMAX(1, (mana + 4) / 8);

                if (ch.IsVampire())
                {
                    ch.GainCondition(ConditionTypes.Bloodthirsty, -1 * Macros.UMAX(1, blood / 3));
                }
                else if (!ch.IsImmortal())
                {
                    ch.CurrentMana -= mana / 3;
                }
            }

            ch.SetColor(ATTypes.AT_MAGIC);
            ch.SendTo("You stop chanting...");

            return(true);
        }
Ejemplo n.º 4
0
        public override bool Verify(ChannelTypes channelType, PlayerInstance ch, int minTrust = 0)
        {
            if (ch.PlayerData.Council == null)
            {
                return(false);
            }

            return(!NoNpc || !ch.IsNpc());
        }
        public static void AbilityLearnFromSuccess(this SkillData skill, PlayerInstance ch)
        {
            var sn           = (int)skill.ID;
            var skillMastery = ch.PlayerData.GetSkillMastery(sn);

            if (ch.IsNpc() || skillMastery <= 0)
            {
                return;
            }

            var adept      = skill.RaceAdept.ToList()[(int)ch.CurrentRace];
            var skillLevel = skill.RaceLevel.ToList()[(int)ch.CurrentRace];

            if (skillLevel == 0)
            {
                skillLevel = ch.Level;
            }
            if (skillMastery < adept)
            {
                var schance = skillMastery + 5 * skill.difficulty;
                var percent = SmaugRandom.D100();

                var learn = 1;
                if (percent >= schance)
                {
                    learn = 2;
                }
                else if (schance - percent > 25)
                {
                    return;
                }

                ch.PlayerData.UpdateSkillMastery(sn, adept.GetLowestOfTwoNumbers(skillMastery + learn));

                int gain;
                if (ch.PlayerData.GetSkillMastery(sn) == adept)
                {
                    gain = 1000 * skillLevel;
                    ch.SetColor(ATTypes.AT_WHITE);
                    ch.Printf("You are now an adept of %s!  You gain %d bonus experience!", skill.Name,
                              gain);
                }
                else
                {
                    gain = 20 * skillLevel;
                    if (ch.CurrentFighting == null) // TODO: Check gsn_hide && gsn_sneak
                    {
                        ch.SetColor(ATTypes.AT_WHITE);
                        ch.Printf("You gain %d experience points from your success!", gain);
                    }
                }
                ch.GainXP(gain);
            }
        }
        public override bool Verify(ChannelTypes channelType, PlayerInstance ch, int minTrust = 0)
        {
            if (ch.PlayerData.Clan == null)
            {
                return(false);
            }

            if (NoNpc && ch.IsNpc())
            {
                return(false);
            }

            return(ClanType == ch.PlayerData.Clan.ClanType);
        }
Ejemplo n.º 7
0
        private static void SupplicateForRecall(PlayerInstance ch, string argument)
        {
            var oldfavor = ch.PlayerData.Favor;

            if (CheckFunctions.CheckIfTrue(ch, ch.PlayerData.Favor < ch.PlayerData.CurrentDeity.SupplicateRecallCost,
                                           "Your favor is inadequate for such a supplication."))
            {
                return;
            }
            if (CheckFunctions.CheckIfSet(ch, ch.CurrentRoom.Flags, RoomFlags.NoSupplicate, "You have been forsaken!"))
            {
                return;
            }
            if (CheckFunctions.CheckIfTrue(ch, ch.HasTimer(TimerTypes.RecentFight) && !ch.IsImmortal(),
                                           "You cannot supplicate recall under adrenaline!"))
            {
                return;
            }

            RoomTemplate location = null;

            if (!ch.IsNpc() && ch.PlayerData.Clan != null)
            {
                location = RepositoryManager.Instance.ROOMS.Get(ch.PlayerData.Clan.RecallRoom);
            }

            if (!ch.IsNpc() && location == null && ch.Level >= 5 && ch.PlayerData.Flags.IsSet(PCFlags.Deadly))
            {
                location = RepositoryManager.Instance.ROOMS.Get(VnumConstants.ROOM_VNUM_DEADLY);
            }

            if (location == null)
            {
                var raceRecallRoom = RepositoryManager.Instance.RACES.Get(ch.CurrentRace.GetValue()).RaceRecallRoom;
                location = RepositoryManager.Instance.ROOMS.Get(raceRecallRoom);
            }

            if (location == null)
            {
                location = RepositoryManager.Instance.ROOMS.Get(VnumConstants.ROOM_VNUM_TEMPLE);
            }

            if (CheckFunctions.CheckIfNullObject(ch, location, "You are completely lost."))
            {
                return;
            }

            comm.act(ATTypes.AT_MAGIC, "$n disappears in a column of divine power.", ch, null, null, ToTypes.Room);

            var oldRoom = ch.CurrentRoom;

            oldRoom.RemoveFrom(ch);
            location.AddTo(ch);

            if (ch.CurrentMount != null)
            {
                oldRoom.RemoveFrom(ch.CurrentMount);
                location.AddTo(ch.CurrentMount);
            }

            comm.act(ATTypes.AT_MAGIC, "$n appears in the room from a column of divine power.", ch, null, null, ToTypes.Room);

            Look.do_look(ch, "auto");
            ch.PlayerData.Favor -= ch.PlayerData.CurrentDeity.SupplicateRecallCost;

            if (ch.PlayerData.Favor < ch.PlayerData.CurrentDeity.SusceptNum)
            {
                ch.Susceptibility.SetBit(ch.PlayerData.CurrentDeity.Suscept);
            }

            if ((oldfavor > ch.PlayerData.CurrentDeity.AffectedNum &&
                 ch.PlayerData.Favor <= ch.PlayerData.CurrentDeity.AffectedNum) ||
                (oldfavor > ch.PlayerData.CurrentDeity.ElementNum &&
                 ch.PlayerData.Favor <= ch.PlayerData.CurrentDeity.ElementNum) ||
                (oldfavor < ch.PlayerData.CurrentDeity.SusceptNum &&
                 ch.PlayerData.Favor >= ch.PlayerData.CurrentDeity.SusceptNum))
            {
                ch.update_aris();
            }
        }
Ejemplo n.º 8
0
        public static void show_char_to_char_1(CharacterInstance victim, PlayerInstance ch)
        {
            if (victim.CanSee(ch) && !ch.IsNpc() &&
                !ch.Act.IsSet((int)PlayerFlags.WizardInvisibility))
            {
                comm.act(ATTypes.AT_ACTION, "$n looks at you.", ch, null, victim, ToTypes.Victim);
                comm.act(ATTypes.AT_ACTION, victim != ch ? "$n looks at $N." : "$n looks at $mself.", ch, null, victim,
                         ToTypes.NotVictim);
            }

            if (!string.IsNullOrEmpty(victim.Description))
            {
                ch.SendTo(victim.CurrentMorph?.Morph != null
                    ? victim.CurrentMorph.Morph.Description
                    : victim.Description);
            }
            else
            {
                if (victim.CurrentMorph?.Morph != null)
                {
                    ch.SendTo(victim.CurrentMorph.Morph.Description);
                }
                else if (victim.IsNpc())
                {
                    comm.act(ATTypes.AT_PLAIN, "You see nothing special about $M.", ch, null, victim, ToTypes.Character);
                }
                else if (ch != victim)
                {
                    comm.act(ATTypes.AT_PLAIN, "$E isn't much to look at...", ch, null, victim, ToTypes.Character);
                }
                else
                {
                    comm.act(ATTypes.AT_PLAIN, "You're not much to look at...", ch, null, null, ToTypes.Character);
                }
            }

            ch.ShowRaceOf(victim);
            ch.ShowConditionTo(victim);

            var found = false;

            for (var i = 0; i < GameConstants.MaximumWearLocations; i++)
            {
                var wearLoc = EnumerationExtensions.GetEnum <WearLocations>(i);
                var obj     = victim.GetEquippedItem(wearLoc);
                if (obj != null && ch.CanSee(obj))
                {
                    if (!found)
                    {
                        ch.SendTo("\r\n");
                        if (victim != ch)
                        {
                            comm.act(ATTypes.AT_PLAIN, "$n is using:", ch, null, victim, ToTypes.Character);
                        }
                        else
                        {
                            comm.act(ATTypes.AT_PLAIN, "You are using:", ch, null, null, ToTypes.Character);
                        }
                        found = true;
                    }

                    if (!victim.IsNpc())
                    {
                        var race = RepositoryManager.Instance.GetRace(victim.CurrentRace);
                        ch.SendTo(race.WhereNames.ToList()[i]);
                    }
                    else
                    {
                        ch.SendTo(LookupManager.Instance.GetLookup("WhereNames", i));
                    }
                    ch.SendTo(obj.GetFormattedDescription(ch, true));
                    ch.SendTo("\r\n");
                }
            }

            if (ch.IsNpc() || victim == ch)
            {
                return;
            }

            if (ch.IsImmortal())
            {
                if (victim.IsNpc())
                {
                    ch.Printf("\r\nMobile #%d '%s' ", ((MobileInstance)victim).MobIndex.ID, victim.Name);
                }
                else
                {
                    ch.Printf("\r\n%s ", victim.Name);
                }

                ch.Printf("is a level %d %s %s.\r\n", victim.Level,
                          RepositoryManager.Instance.GetRace(victim.CurrentRace).Name,
                          RepositoryManager.Instance.GetClass(victim.CurrentClass).Name);
            }

            var skill = RepositoryManager.Instance.GetEntity <SkillData>("peek");

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

            if (SmaugRandom.D100() < Macros.LEARNED(ch, (int)skill.ID))
            {
                ch.Printf("\r\nYou peek at %s inventory:\r\n", victim.Gender.PossessivePronoun());
                show_list_to_char(victim.Carrying.ToList(), ch, true, true);
                skill.LearnFromSuccess(ch);
            }
            else if (ch.PlayerData.GetSkillMastery(skill.ID) > skill.GetMasteryLevel(ch))
            {
                skill.LearnFromFailure(ch);
            }
        }