Esempio n. 1
0
        private static void RemoveDevotion(PlayerInstance ch)
        {
            if (CheckFunctions.CheckIfNullObject(ch, ch.PlayerData.CurrentDeity,
                                                 "You have already chosen to worship no deities."))
            {
                return;
            }

            var deity = ch.PlayerData.CurrentDeity;

            --deity.Worshippers;
            if (deity.Worshippers < 0)
            {
                deity.Worshippers = 0;
            }

            ch.PlayerData.Favor = -2500;
            ch.MentalState      = -80;
            ch.SendTo("A terrible curse afflicts you as you forsake a deity!");

            ch.AffectedBy.RemoveBits(deity.Affected);
            ch.Resistance.RemoveBit(deity.Element);
            ch.Susceptibility.RemoveBit(deity.Suscept);

            var af = new AffectData
            {
                Type      = AffectedByTypes.Blind,
                Location  = ApplyTypes.HitRoll,
                Modifier  = -4,
                Duration  = 50 * GameConstants.GetConstant <int>("AffectDurationConversionValue"),
                BitVector = ExtendedBitvector.Meb((int)AffectedByTypes.Blind)
            };

            ch.AddAffect(af);

            // TODO Save the deity data to the database
            // save_deity(ch->pcdata->deity);

            ch.SendTo("You cease to worship any deity.");
            ch.PlayerData.CurrentDeity = null;
            save.save_char_obj(ch);
        }