Exemple #1
0
        private void OnMantraSpoken(Mobile from, VirtueBonusEntry bonusEntry)
        {
            PlayerMobile pm = from as PlayerMobile;

            if (pm == null)
            {
                return;
            }

            if (m_Bonuses.ContainsKey(pm))
            {
                var currentBonusEntry = m_Bonuses[pm];

                // You already feel ~1_VIRTUE~ from your earlier contemplation of the virtues.
                pm.SendLocalizedMessage(1079544, string.Format("#{0}", currentBonusEntry.Cliloc));
            }
            else if (pm.NextAnkhPendantUse > DateTime.Now)
            {
                TimeSpan delta = pm.NextAnkhPendantUse - DateTime.Now;

                if (delta < TimeSpan.FromHours(1.0))
                {
                    // You feel as if you should contemplate what you've learned for another ~1_TIME~ minutes.
                    pm.SendLocalizedMessage(1079568, ((int)delta.TotalMinutes).ToString());
                }
                else
                {
                    // You feel as if you should contemplate what you've learned for another ~1_TIME~ hours.
                    pm.SendLocalizedMessage(1079566, ((int)delta.TotalHours).ToString());
                }
            }
            else
            {
                List <AttributeMod> mods = ComputeBonuses(pm, bonusEntry);

                foreach (AttributeMod mod in mods)
                {
                    pm.AddAttributeMod(mod);
                }

                m_Bonuses.Add(pm, bonusEntry);
                pm.NextAnkhPendantUse = DateTime.Now + TimeSpan.FromDays(1.0);

                // Contemplating at the shrine has left you feeling more ~1_VIRTUE~.
                pm.SendLocalizedMessage(1079546, string.Format("#{0}", bonusEntry.Cliloc));

                Timer.DelayCall(TimeSpan.FromHours(1.0),
                                delegate
                {
                    foreach (AttributeMod mod in mods)
                    {
                        pm.RemoveAttributeMod(mod);
                    }

                    m_Bonuses.Remove(pm);

                    pm.SendLocalizedMessage(1079553);                               // The effects of meditating at the shrine have worn off.
                });
            }
        }
Exemple #2
0
        private static void GenerateRegion(VirtueBonusEntry entry, Map map)
        {
            Region region = new VirtueBonusRegion(entry, map);

            region.Register();
        }
Exemple #3
0
 public VirtueBonusRegion(VirtueBonusEntry bonusEntry, Map map)
     : base(null, map, null, bonusEntry.Area)
 {
     m_BonusEntry = bonusEntry;
 }
Exemple #4
0
        private static List <AttributeMod> ComputeBonuses(Mobile m, VirtueBonusEntry entry)
        {
            List <AttributeMod> mods = new List <AttributeMod>();

            switch (entry.Virtue)
            {
            case VirtueName.Honesty:
            {
                mods.Add(new AttributeMod(MagicalAttribute.RegenMana, 2));
                break;
            }

            case VirtueName.Compassion:
            {
                mods.Add(new AttributeMod(MagicalAttribute.RegenHits, 2));
                break;
            }

            case VirtueName.Valor:
            {
                mods.Add(new AttributeMod(MagicalAttribute.RegenStam, 2));
                break;
            }

            case VirtueName.Justice:
            {
                bool bump  = 0.5 > Utility.RandomDouble();
                bool which = Utility.RandomBool();

                mods.Add(new AttributeMod(MagicalAttribute.RegenMana, bump && which ? 2 : 1));
                mods.Add(new AttributeMod(MagicalAttribute.RegenHits, bump && !which ? 2 : 1));

                break;
            }

            case VirtueName.Sacrifice:
            {
                bool bump  = 0.5 > Utility.RandomDouble();
                bool which = Utility.RandomBool();

                mods.Add(new AttributeMod(MagicalAttribute.RegenHits, bump && which ? 2 : 1));
                mods.Add(new AttributeMod(MagicalAttribute.RegenStam, bump && !which ? 2 : 1));

                break;
            }

            case VirtueName.Honor:
            {
                bool bump  = 0.5 > Utility.RandomDouble();
                bool which = Utility.RandomBool();

                mods.Add(new AttributeMod(MagicalAttribute.RegenMana, bump && which ? 2 : 1));
                mods.Add(new AttributeMod(MagicalAttribute.RegenStam, bump && !which ? 2 : 1));

                break;
            }

            case VirtueName.Spirituality:
            {
                mods.Add(new AttributeMod(MagicalAttribute.RegenHits, 0.25 > Utility.RandomDouble() ? 2 : 1));
                mods.Add(new AttributeMod(MagicalAttribute.RegenMana, 0.25 > Utility.RandomDouble() ? 2 : 1));
                mods.Add(new AttributeMod(MagicalAttribute.RegenStam, 0.25 > Utility.RandomDouble() ? 2 : 1));

                break;
            }

            case VirtueName.Humility:
            {
                var attribute = Utility.RandomList(MagicalAttribute.RegenHits, MagicalAttribute.RegenMana, MagicalAttribute.RegenStam);
                mods.Add(new AttributeMod(attribute, 3));

                break;
            }
            }

            return(mods);
        }
Exemple #5
0
        private static List<AttributeMod> ComputeBonuses( Mobile m, VirtueBonusEntry entry )
        {
            List<AttributeMod> mods = new List<AttributeMod>();

            switch ( entry.Virtue )
            {
                case VirtueName.Honesty:
                    {
                        mods.Add( new AttributeMod( MagicalAttribute.RegenMana, 2 ) );
                        break;
                    }
                case VirtueName.Compassion:
                    {
                        mods.Add( new AttributeMod( MagicalAttribute.RegenHits, 2 ) );
                        break;
                    }
                case VirtueName.Valor:
                    {
                        mods.Add( new AttributeMod( MagicalAttribute.RegenStam, 2 ) );
                        break;
                    }
                case VirtueName.Justice:
                    {
                        bool bump = 0.5 > Utility.RandomDouble();
                        bool which = Utility.RandomBool();

                        mods.Add( new AttributeMod( MagicalAttribute.RegenMana, bump && which ? 2 : 1 ) );
                        mods.Add( new AttributeMod( MagicalAttribute.RegenHits, bump && !which ? 2 : 1 ) );

                        break;
                    }
                case VirtueName.Sacrifice:
                    {
                        bool bump = 0.5 > Utility.RandomDouble();
                        bool which = Utility.RandomBool();

                        mods.Add( new AttributeMod( MagicalAttribute.RegenHits, bump && which ? 2 : 1 ) );
                        mods.Add( new AttributeMod( MagicalAttribute.RegenStam, bump && !which ? 2 : 1 ) );

                        break;
                    }
                case VirtueName.Honor:
                    {
                        bool bump = 0.5 > Utility.RandomDouble();
                        bool which = Utility.RandomBool();

                        mods.Add( new AttributeMod( MagicalAttribute.RegenMana, bump && which ? 2 : 1 ) );
                        mods.Add( new AttributeMod( MagicalAttribute.RegenStam, bump && !which ? 2 : 1 ) );

                        break;
                    }
                case VirtueName.Spirituality:
                    {
                        mods.Add( new AttributeMod( MagicalAttribute.RegenHits, 0.25 > Utility.RandomDouble() ? 2 : 1 ) );
                        mods.Add( new AttributeMod( MagicalAttribute.RegenMana, 0.25 > Utility.RandomDouble() ? 2 : 1 ) );
                        mods.Add( new AttributeMod( MagicalAttribute.RegenStam, 0.25 > Utility.RandomDouble() ? 2 : 1 ) );

                        break;
                    }
                case VirtueName.Humility:
                    {
                        var attribute = Utility.RandomList( MagicalAttribute.RegenHits, MagicalAttribute.RegenMana, MagicalAttribute.RegenStam );
                        mods.Add( new AttributeMod( attribute, 3 ) );

                        break;
                    }
            }

            return mods;
        }
Exemple #6
0
 public VirtueBonusRegion( VirtueBonusEntry bonusEntry, Map map )
     : base(null, map, null, bonusEntry.Area)
 {
     m_BonusEntry = bonusEntry;
 }
Exemple #7
0
        private void OnMantraSpoken( Mobile from, VirtueBonusEntry bonusEntry )
        {
            PlayerMobile pm = from as PlayerMobile;

            if ( pm == null )
                return;

            if ( m_Bonuses.ContainsKey( pm ) )
            {
                var currentBonusEntry = m_Bonuses[pm];

                // You already feel ~1_VIRTUE~ from your earlier contemplation of the virtues.
                pm.SendLocalizedMessage( 1079544, string.Format( "#{0}", currentBonusEntry.Cliloc ) );
            }
            else if ( pm.NextAnkhPendantUse > DateTime.Now )
            {
                TimeSpan delta = pm.NextAnkhPendantUse - DateTime.Now;

                if ( delta < TimeSpan.FromHours( 1.0 ) )
                {
                    // You feel as if you should contemplate what you've learned for another ~1_TIME~ minutes.
                    pm.SendLocalizedMessage( 1079568, ( (int) delta.TotalMinutes ).ToString() );
                }
                else
                {
                    // You feel as if you should contemplate what you've learned for another ~1_TIME~ hours.
                    pm.SendLocalizedMessage( 1079566, ( (int) delta.TotalHours ).ToString() );
                }
            }
            else
            {
                List<AttributeMod> mods = ComputeBonuses( pm, bonusEntry );

                foreach ( AttributeMod mod in mods )
                    pm.AddAttributeMod( mod );

                m_Bonuses.Add( pm, bonusEntry );
                pm.NextAnkhPendantUse = DateTime.Now + TimeSpan.FromDays( 1.0 );

                // Contemplating at the shrine has left you feeling more ~1_VIRTUE~.
                pm.SendLocalizedMessage( 1079546, string.Format( "#{0}", bonusEntry.Cliloc ) );

                Timer.DelayCall( TimeSpan.FromHours( 1.0 ),
                    delegate
                    {
                        foreach ( AttributeMod mod in mods )
                            pm.RemoveAttributeMod( mod );

                        m_Bonuses.Remove( pm );

                        pm.SendLocalizedMessage( 1079553 ); // The effects of meditating at the shrine have worn off.
                    } );
            }
        }
Exemple #8
0
 private static void GenerateRegion( VirtueBonusEntry entry, Map map )
 {
     Region region = new VirtueBonusRegion( entry, map );
     region.Register();
 }