Example #1
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!this.Validate(attacker) || !this.CheckMana(attacker, true))
                return;

            ClearCurrentAbility(attacker);

            attacker.SendLocalizedMessage(1063353); // You perform a masterful defense!

            attacker.FixedParticles(0x375A, 1, 17, 0x7F2, 0x3E8, 0x3, EffectLayer.Waist);

            int modifier = (int)(30.0 * ((Math.Max(attacker.Skills[SkillName.Bushido].Value, attacker.Skills[SkillName.Ninjitsu].Value) - 50.0) / 70.0));

            DefenseMasteryInfo info = m_Table[attacker] as DefenseMasteryInfo;

            if (info != null)
                EndDefense((object)info);

            ResistanceMod mod = new ResistanceMod(ResistanceType.Physical, 50 + modifier);
            attacker.AddResistanceMod(mod);

            info = new DefenseMasteryInfo(attacker, 80 - modifier, mod);
            info.m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(3.0), new TimerStateCallback(EndDefense), info);

            m_Table[attacker] = info;

            attacker.Delta(MobileDelta.WeaponDamage);
        }
Example #2
0
        public override void DoEffect( Mobile m )
        {
            m.PlaySound( 0x165 );
            m.FixedParticles( 0x3728, 1, 13, 9918, 92, 3, EffectLayer.Head );

            m.Delta( MobileDelta.WeaponDamage );
        }
Example #3
0
        public override void RemoveEffect(Mobile m)
        {
            ResistanceMod[] mods = (ResistanceMod[])m_Table[m];

            if (mods != null)
            {             
                m_Table.Remove(m);

                m_Table[m] = mods;

                for (int i = 0; i < mods.Length; ++i)
                    m.RemoveResistanceMod(mods[i]);

                m.PlaySound(0x65B);
                m.FixedParticles(0x3728, 1, 13, 9918, 92, 3, EffectLayer.Head);
                m.Delta(MobileDelta.WeaponDamage);
                m.EndAction(typeof(StoneFormSpell));
            }
        }
Example #4
0
        public static void EventSink_AggressiveAction(AggressiveActionEventArgs e)
        {
            Mobile aggressor = e.Aggressor;
            Mobile aggressed = e.Aggressed;

            if (!aggressor.Player || !aggressed.Player)
            {
                return;
            }

            if (!CheckAggressions(aggressor, aggressed))
            {
                aggressor.LocalOverheadMessage(MessageType.Regular, Hue, true, String.Format(AggressorFormat, aggressed.Name));
                aggressed.LocalOverheadMessage(MessageType.Regular, Hue, true, String.Format(AggressedFormat, aggressor.Name));

                aggressor.Delta(MobileDelta.Noto);
                aggressed.Delta(MobileDelta.Noto);
            }
        }
Example #5
0
        public override void OnDoubleClick(Mobile from)
        {
            if (!from.InRange(GetWorldLocation(), 2))
            {
                from.SendLocalizedMessage(500446); // That is too far away.
                return;
            }

            DefragTables();

            if (!IsCoolingDown(from))
            {
                m_LuckTable[from] = DateTime.UtcNow + TimeSpan.FromMinutes(60);
                from.SendLocalizedMessage(1079551); // Your luck just improved!
                m_RewardCooldown[from] = DateTime.UtcNow + TimeSpan.FromHours(24);

                from.Delta(MobileDelta.Armor);
            }
        }
Example #6
0
        public static void EndSleep(Mobile target)
        {
            if (m_Table.ContainsKey(target))
            {
                target.SendSpeedControl(SpeedControlType.Disable);

                m_Table[target].Stop();
                m_Table.Remove(target);

                BuffInfo.RemoveBuff(target, BuffIcon.Sleep);

                double immduration = target.Skills[SkillName.MagicResist].Value / 10;

                m_ImmunityList.Add(target);
                Timer.DelayCall(TimeSpan.FromSeconds(immduration), new TimerStateCallback(RemoveImmunity_Callback), target);

                target.Delta(MobileDelta.WeaponDamage);
            }
        }
        public override void OnEnter(Mobile m)
        {
            if (!Controller.InUse)
            {
                return;
            }

            m.SendMessage("Your health is being regenerated faster!");

            if (m is PlayerMobile)
            {
                HealTimer timer = new HealTimer(m);
                PlayerTimers.Add(timer);
                timer.Start();
            }

            m.Delta(MobileDelta.Noto);
            m.InvalidateProperties();
        }
Example #8
0
        public override void OnRemoved(object parent)
        {
            if (parent is Mobile)
            {
                Mobile from = (Mobile)parent;

                m_SkillBonuses.Remove();

                string modName = this.Serial.ToString();

                from.RemoveStatMod(modName + "Str");
                from.RemoveStatMod(modName + "Dex");
                from.RemoveStatMod(modName + "Int");

                from.CheckStatTimers();

                from.Delta(MobileDelta.Armor);
            }
        }
Example #9
0
        public virtual void OnExit(PvPRegion region, Mobile m)
        {
            if (region == null || m == null || m.Deleted)
            {
                return;
            }

            if (region.IsPartOf(BattleRegion) && !m.InRegion(BattleRegion))
            {
                var pm = m as PlayerMobile;

                if (pm != null)
                {
                    if (IsParticipant(pm))
                    {
                        Eject(pm, false);
                    }

                    pm.SendMessage("You have left {0}", Name);
                }

                AutoPvP.InvokeExitBattle(this, region, m);
            }
            else if (region.IsPartOf(SpectateRegion) && !m.InRegion(SpectateRegion))
            {
                var pm = m as PlayerMobile;

                if (pm != null)
                {
                    pm.SendMessage("You have left {0} spectator area", Name);

                    if (IsSpectator(pm))
                    {
                        RemoveSpectator(pm, false);
                    }
                }

                AutoPvP.InvokeExitBattle(this, region, m);
            }

            m.Delta(MobileDelta.Noto);
        }
		public void RemoveMember( Mobile mob )
		{
			PlayerState pl = PlayerState.Find( mob );

			if ( pl == null || !Members.Contains( pl ) )
				return;

			if( mob.Backpack != null )
			{
				//Ordinarily, through normal faction removal, this will never find any sigils.
				//Only with a leave delay less than the ReturnPeriod or a Faction Kick/Ban, will this ever do anything
				Item[] sigils = mob.Backpack.FindItemsByType( typeof( Sigil ) );

				for ( int i = 0; i < sigils.Length; ++i )
					((Sigil)sigils[i]).ReturnHome();
			}

			Members.Remove( pl );

			if ( mob is PlayerMobile )
				((PlayerMobile)mob).FactionPlayerState = null;

			mob.InvalidateProperties();
			mob.Delta( MobileDelta.Noto );

			if ( Election.IsCandidate( mob ) )
				Election.RemoveCandidate( mob );

			Election.RemoveVoter( mob );

			if ( pl.Finance != null )
				pl.Finance.Finance = null;

			if ( pl.Sheriff != null )
				pl.Sheriff.Sheriff = null;

			if ( Commander == mob )
				Commander = null;

			if ( mob is PlayerMobile )
				((PlayerMobile)mob).ValidateEquipment();
		}
Example #11
0
        public static void DoSleep(Mobile caster, Mobile target, TimeSpan duration)
        {
            target.Combatant = null;
            target.Send(SpeedControl.WalkSpeed);

            caster.PlaySound(0x657);
            target.FixedParticles(0x374A, 1, 15, 9502, 97, 3, (EffectLayer)255);
            target.FixedParticles(0x376A, 1, 15, 9502, 97, 3, (EffectLayer)255);

            if (m_Table.ContainsKey(target))
            {
                m_Table[target].Stop();
            }

            m_Table[target] = new SleepTimer(target, duration);

            BuffInfo.AddBuff(target, new BuffInfo(BuffIcon.Sleep, 1080139, 1080140, duration, target));

            target.Delta(MobileDelta.WeaponDamage);
        }
Example #12
0
        public static void RemoveBuff(Mobile from, FishPieEffect type)
        {
            if (!m_EffectsList.ContainsKey(from))
            {
                return;
            }

            if (m_EffectsList[from] != null && m_EffectsList[from].Contains(type))
            {
                m_EffectsList[from].Remove(type);
            }

            if (m_EffectsList[from] == null || m_EffectsList[from].Count == 0)
            {
                m_EffectsList.Remove(from);
            }

            BuffInfo.RemoveBuff(from, BuffIcon.FishPie);
            from.Delta(MobileDelta.WeaponDamage);
        }
Example #13
0
        public void SwitchTeams(Mobile from, CTFTeam team)
        {
            CTFTeam old = GetTeam(from);

            if (old == team)
            {
                return;
            }
            else if (old != null)
            {
                old.RemoveMember(from);
            }

            team.AddMember(from);
            from.Delta(MobileDelta.Noto);

            Item robe = from.FindItemOnLayer(Layer.OuterTorso);

            if (robe is CTFRobe)
            {
                robe.Name = team.Name + " Game Robe";
                robe.Hue  = team.Hue;
            }
            else
            {
                if (robe != null)
                {
                    if (robe.Movable)
                    {
                        from.AddToBackpack(robe);
                    }
                    else
                    {
                        robe.Delete();
                    }
                }

                robe = new CTFRobe(team);
                from.EquipItem(robe);
            }
        }
Example #14
0
        public override void OnEnter(Mobile m)
        {
            if (!Controller.InUse)
            {
                return;
            }

            if (m is EnergyVortex)
            {
                EnergyVortex ev = (EnergyVortex)m;
                Controller.EVsAndBSsAdd(ev);
            }
            else if (m is BladeSpirits)
            {
                BladeSpirits bs = (BladeSpirits)m;
                Controller.EVsAndBSsAdd(bs);
            }

            m.Delta(MobileDelta.Noto);
            m.InvalidateProperties();
        }
Example #15
0
        public void RemoveMember(Mobile m, int message = 1018028) // You have been dismissed from your guild.
        {
            if (Members.Contains(m))
            {
                Members.Remove(m);

                Guild guild = m.Guild as Guild;

                m.Guild = null;

                if (m is PlayerMobile mobile)
                {
                    mobile.GuildRank = RankDefinition.Lowest;
                }

                if (message > 0)
                {
                    m.SendLocalizedMessage(message);
                }

                if (m == m_Leader)
                {
                    CalculateGuildmaster();

                    if (m_Leader == null)
                    {
                        Disband();
                    }
                }

                if (Members.Count == 0)
                {
                    Disband();
                }

                guild?.InvalidateWarNotoriety();

                m.Delta(MobileDelta.Noto);
            }
        }
Example #16
0
        public virtual void RefreshPlayer(Mobile from)
        {
            if (from == null)
            {
                return;
            }

            if (!from.Alive)
            {
                from.Resurrect();
            }

            Container pack    = from.Backpack;
            Item      holding = from.Holding;

            if (holding != null && pack != null)
            {
                pack.DropItem(holding);
            }

            from.RevealingAction();

            from.Poison = null;
            from.StatMods.Clear();

            Factions.Faction.ClearSkillLoss(from);

            from.Hits = from.HitsMax;
            from.Mana = from.ManaMax;
            from.Stam = from.StamMax;

            Targeting.Target.Cancel(from);
            from.MagicDamageAbsorb = 0;
            from.MeleeDamageAbsorb = 0;
            Spells.Second.ProtectionSpell.Registry.Remove(from);
            DefensiveSpell.Nullify(from);
            from.Combatant = null;

            from.Delta(MobileDelta.Noto);               //Update notoriety
        }
Example #17
0
        public void LeaveGame(Mobile m)
        {
            CTFTeam t = GetTeam(m);

            if (t != null)
            {
                t.RemoveMember(m);
            }

            if (m.AccessLevel == AccessLevel.Player && !m.Blessed)
            {
                if (m.Alive)
                {
                    m.Kill();
                    if (m.Corpse != null && !m.Corpse.Deleted)
                    {
                        m.Corpse.Delete();
                    }
                }
                m.Resurrect();
            }

            Item robe = m.FindItemOnLayer(Layer.OuterTorso);

            if (robe is CTFRobe)
            {
                robe.Delete();
            }
            if (m.Backpack != null)
            {
                Item[] robes = m.Backpack.FindItemsByType(typeof(CTFRobe));
                for (int i = 0; i < robes.Length; i++)
                {
                    robes[i].Delete();
                }
            }

            m.Delta(MobileDelta.Noto);
        }
Example #18
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker) || !CheckMana(attacker, true))
            {
                return;
            }

            ClearCurrentMove(attacker);

            attacker.PrivateOverheadMessage(MessageType.Regular, 1150, 1155984, attacker.NetState);

            defender.FixedEffect(0x3779, 20, 10, 2719, 0);

            double skills = (attacker.Skills[MoveSkill].Value + attacker.Skills[SkillName.Tactics].Value + (MasteryInfo.GetMasteryLevel(attacker, MoveSkill) * 40)) / 3;

            AddToTable(defender, (int)(skills / 2));
            BuffInfo.AddBuff(defender, new BuffInfo(BuffIcon.Stagger, 1155981, 1155982, TimeSpan.FromSeconds(10), defender, ((int)skills / 2).ToString()));

            defender.Delta(MobileDelta.WeaponDamage);

            AddToCooldown(attacker);
        }
Example #19
0
        protected virtual void BeginTimer()
        {
            if (Timer != null)
            {
                Timer.Stop();
                Timer = null;
            }

            Timer = new UpkeepTimer(this);
            Timer.Start();

            if (Expires < DateTime.UtcNow)
            {
                Expires = DateTime.UtcNow + ExpirationPeriod;
            }

            AddToTable(Caster, this);
            AddStatMods();

            if (RevealOnTick)
            {
                Caster.RevealingAction();
            }

            Caster.Delta(MobileDelta.WeaponDamage);

            Target?.Delta(MobileDelta.WeaponDamage);

            if (PartyList != null)
            {
                for (var index = 0; index < PartyList.Count; index++)
                {
                    Mobile m = PartyList[index];

                    m.Delta(MobileDelta.WeaponDamage);
                }
            }
        }
Example #20
0
        public void RemoveMember(Mobile m, int message)
        {
            if (m_Members.Contains(m))
            {
                m_Members.Remove(m);

                Guild guild = m.Guild as Guild;

                m.Guild = null;

                if (m is PlayerMobile)
                {
                    ((PlayerMobile)m).GuildRank = RankDefinition.Lowest;
                }

                if (message > 0)
                {
                    m.SendLocalizedMessage(message);
                }

                if (m == m_Leader)
                {
                    CalculateGuildmaster();

                    if (m_Leader == null)
                    {
                        Disband();
                    }
                }

                if (m_Members.Count == 0)
                {
                    Disband();
                }

                m.Delta(MobileDelta.Noto);
            }
        }
Example #21
0
        public void AddFriend(Mobile from, Mobile targ)
        {
            if (m_Friends == null || m_Owner == targ)
            {
                return;
            }

            if (!targ.Player)
            {
                from.SendMessage("That can't be a friend of the tent.");
            }
            else if (m_Friends.Contains(targ))
            {
                from.SendLocalizedMessage(501376);                   //This person is already on your friends list.
            }
            else
            {
                m_Friends.Add(targ);

                targ.Delta(MobileDelta.Noto);
                targ.SendMessage("You have been granted access to the tent chest.");
            }
        }
Example #22
0
        public virtual void OnEnter(PvPRegion region, Mobile m)
        {
            if (region == null || m == null || m.Deleted)
            {
                return;
            }

            if (region.IsPartOf(BattleRegion) && m.InRegion(BattleRegion))
            {
                var pm = m as PlayerMobile;

                if (pm != null)
                {
                    pm.SendMessage("You have entered {0}", Name);
                }

                AutoPvP.InvokeEnterBattle(this, region, m);
            }
            else if (region.IsPartOf(SpectateRegion) && m.InRegion(SpectateRegion))
            {
                var pm = m as PlayerMobile;

                if (pm != null)
                {
                    pm.SendMessage("You have entered {0} spectator area.", Name);

                    if (!IsSpectator(pm))
                    {
                        AddSpectator(pm, false);
                    }
                }

                AutoPvP.InvokeEnterBattle(this, region, m);
            }

            m.Delta(MobileDelta.Noto);
        }
Example #23
0
        public override void OnAdded(object parent)
        {
            if (parent is Mobile)
            {
                Mobile from = (Mobile)parent;

                m_SkillBonuses.AddTo(from);

                int strBonus = m_MagicalAttributes.BonusStr;
                int dexBonus = m_MagicalAttributes.BonusDex;
                int intBonus = m_MagicalAttributes.BonusInt;

                if (strBonus != 0 || dexBonus != 0 || intBonus != 0)
                {
                    string modName = this.Serial.ToString();

                    if (strBonus != 0)
                    {
                        from.AddStatMod(new StatMod(StatType.Str, modName + "Str", strBonus, TimeSpan.Zero));
                    }

                    if (dexBonus != 0)
                    {
                        from.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero));
                    }

                    if (intBonus != 0)
                    {
                        from.AddStatMod(new StatMod(StatType.Int, modName + "Int", intBonus, TimeSpan.Zero));
                    }
                }

                from.CheckStatTimers();

                from.Delta(MobileDelta.Armor);
            }
        }
Example #24
0
        public static void RemoveContext(Mobile m, TransformContext context, bool resetGraphics)
        {
            m_Table.Remove(m);

            ArrayList mods = context.Mods;

            for (int i = 0; i < mods.Count; ++i)
            {
                m.RemoveResistanceMod((ResistanceMod)mods[i]);
            }

            if (resetGraphics)
            {
                m.HueMod  = -1;
                m.BodyMod = 0;
            }

            context.Timer.Stop();

            if (context.Type == typeof(HorrificBeastSpell))
            {
                m.Delta(MobileDelta.WeaponDamage);
            }
        }
		public void RemovePlayerState( PlayerState pl )
		{
			if ( pl == null || !Members.Contains( pl ) )
				return;

			Members.Remove( pl );

			PlayerMobile pm = (PlayerMobile) pl.Mobile;
			if( pm == null )
				return;

			Mobile mob = pl.Mobile;
			if ( pm.FactionPlayerState == pl )
			{
				pm.FactionPlayerState = null;

				mob.InvalidateProperties();
				mob.Delta( MobileDelta.Noto );

				if ( Election.IsCandidate( mob ) )
					Election.RemoveCandidate( mob );

				if ( pl.Finance != null )
					pl.Finance.Finance = null;

				if ( pl.Sheriff != null )
					pl.Sheriff.Sheriff = null;

				Election.RemoveVoter( mob );

				if ( Commander == mob )
					Commander = null;

				pm.ValidateEquipment();
			}
		}
Example #26
0
        public static void AddTempParticipant(Mobile m, Mobile friendlyTo)
        {
            if (TempCombatants == null)
            {
                TempCombatants = new List <TemporaryCombatant>();
                AddTempCombatantTimer();
            }

            var combatant = GetTempCombatant(m, friendlyTo);

            if (combatant == null)
            {
                combatant = new TemporaryCombatant(m, friendlyTo);
            }
            else
            {
                combatant.Reset();
            }

            TempCombatants.Add(combatant);

            m.Delta(MobileDelta.Noto);
            m.ProcessDelta();
        }
Example #27
0
        public void RemoveCoOwner(Mobile from, Mobile targ)
        {
            if (!this.IsOwner(from) || this.m_CoOwners == null)
                return;

            if (this.m_CoOwners.Contains(targ))
            {
                this.m_CoOwners.Remove(targ);

                targ.Delta(MobileDelta.Noto);

                from.SendLocalizedMessage(501299); // Co-owner removed from list.
                targ.SendLocalizedMessage(501300); // You have been removed as a house co-owner.

                foreach (SecureInfo info in this.m_Secures)
                {
                    Container c = info.Item;

                    if (c is StrongBox && ((StrongBox)c).Owner == targ)
                    {
                        c.IsLockedDown = false;
                        c.IsSecure = false;
                        this.m_Secures.Remove(info);
                        c.Destroy();
                        break;
                    }
                }
            }
        }
Example #28
0
        public void AddCoOwner(Mobile from, Mobile targ)
        {
            if (!this.IsOwner(from) || this.m_CoOwners == null || this.m_Friends == null)
                return;

            if (this.IsOwner(targ))
            {
                from.SendLocalizedMessage(501360); // This person is already the house owner!
            }
            else if (this.m_Friends.Contains(targ))
            {
                from.SendLocalizedMessage(501361); // This person is a friend of the house. Remove them first.
            }
            else if (!targ.Player)
            {
                from.SendLocalizedMessage(501362); // That can't be a co-owner of the house.
            }
            else if (HasAccountHouse(targ))
            {
                from.SendLocalizedMessage(501364); // That person is already a house owner.
            }
            else if (this.IsBanned(targ))
            {
                from.SendLocalizedMessage(501367); // This person is banned!  Unban them first.
            }
            else if (this.m_CoOwners.Count >= MaxCoOwners)
            {
                from.SendLocalizedMessage(501368); // Your co-owner list is full!
            }
            else if (this.m_CoOwners.Contains(targ))
            {
                from.SendLocalizedMessage(501369); // This person is already on your co-owner list!
            }
            else
            {
                this.m_CoOwners.Add(targ);

                targ.Delta(MobileDelta.Noto);
                targ.SendLocalizedMessage(501343); // You have been made a co-owner of this house.
            }
        }
Example #29
0
        public virtual void AddMember(Mobile mob)
        {
            this.Members.Insert(this.ZeroRankOffset, new PlayerState(mob, this, this.Members));

            mob.AddToBackpack(FactionItem.Imbue(new Robe(), this, false, this.Definition.HuePrimary));
            mob.SendLocalizedMessage(1010374); // You have been granted a robe which signifies your faction

            mob.InvalidateProperties();
            mob.Delta(MobileDelta.Noto);

            mob.FixedEffect(0x373A, 10, 30);
            mob.PlaySound(0x209);
        }
Example #30
0
        public void AddFriend( Mobile from, Mobile targ )
        {
            if ( !IsCoOwner( from ) || m_Friends == null || m_CoOwners == null )
            {
                return;
            }

            Account acc = targ.Account as Account;

            if ( IsOwner( targ ) )
            {
                from.SendLocalizedMessage( 501370 ); // This person is already an owner of the house!
            }
            else if ( m_CoOwners.Contains( targ ) )
            {
                from.SendLocalizedMessage( 501369 ); // This person is already on your co-owner list!
            }
            else if ( !targ.IsPlayer )
            {
                from.SendLocalizedMessage( 501371 ); // That can't be a friend of the house.
            }
            else if ( IsBanned( targ ) )
            {
                from.SendLocalizedMessage( 501374 ); // This person is banned!  Unban them first.
            }
            else if ( acc == null || acc.Trial )
            {
                from.SendLocalizedMessage( 1111865 ); // Trial account players do not have access to that level of house security.
            }
            else if ( m_Friends.Count >= MaxFriends )
            {
                from.SendLocalizedMessage( 501375 ); // Your friends list is full!
            }
            else if ( m_Friends.Contains( targ ) )
            {
                from.SendLocalizedMessage( 501376 ); // This person is already on your friends list!
            }
            else
            {
                m_Friends.Add( targ );

                targ.Delta( MobileDelta.Noto );
                targ.SendLocalizedMessage( 501337 ); // You have been made a friend of this house.
            }
        }
Example #31
0
		public void RemoveMember(Mobile mob)
		{
			PlayerState pl = PlayerState.Find(mob);

			if (pl == null || !Members.Contains(pl))
			{
				return;
			}

			int killPoints = pl.KillPoints;

			if (mob.Backpack != null)
			{
				//Ordinarily, through normal faction removal, this will never find any sigils.
				//Only with a leave delay less than the ReturnPeriod or a Faction Kick/Ban, will this ever do anything
				Item[] sigils = mob.Backpack.FindItemsByType(typeof(Sigil));

				foreach (Sigil s in sigils.OfType<Sigil>())
				{
					s.ReturnHome();
				}
			}

			if (pl.RankIndex != -1)
			{
				while ((pl.RankIndex + 1) < ZeroRankOffset)
				{
					PlayerState pNext = Members[pl.RankIndex + 1];
					Members[pl.RankIndex + 1] = pl;
					Members[pl.RankIndex] = pNext;
					pl.RankIndex++;
					pNext.RankIndex--;
				}

				ZeroRankOffset--;
			}

			Members.Remove(pl);

			if (mob is PlayerMobile)
			{
				((PlayerMobile)mob).FactionPlayerState = null;
			}

			mob.InvalidateProperties();
			mob.Delta(MobileDelta.Noto);

			if (Election.IsCandidate(mob))
			{
				Election.RemoveCandidate(mob);
			}

			Election.RemoveVoter(mob);

			if (pl.Finance != null)
			{
				pl.Finance.Finance = null;
			}

			if (pl.Sheriff != null)
			{
				pl.Sheriff.Sheriff = null;
			}

			if (Commander == mob)
			{
				Commander = null;
			}

			if (mob is PlayerMobile)
			{
				((PlayerMobile)mob).ValidateEquipment();
			}

			if (killPoints > 0)
			{
				LoggingCustom.Log(
					"LOG_FactionPoints.txt", DateTime.Now + "\t" + mob.Name + "\tFaction.RemoveMember: DistributePoints\t" + killPoints);
				DistributePoints(killPoints);
			}

			Player epl = Player.Find(mob);
			if (Ethic.Enabled && epl != null)
			{
				epl.Detach();
			}
		}
Example #32
0
        public override void OnHit(Mobile attacker, Mobile defender, int damage)
        {
            if (!Validate(attacker) || !CheckMana(attacker, true))
            {
                return;
            }

            ClearCurrentMove(attacker);

            if (m_Table[attacker] is HonorableExecutionInfo info)
            {
                info.Clear();

                if (info.m_Timer != null)
                {
                    info.m_Timer.Stop();
                }
            }

            if (!defender.Alive)
            {
                attacker.FixedParticles(0x373A, 1, 17, 0x7E2, EffectLayer.Waist);

                double bushido = attacker.Skills[SkillName.Bushido].Value;

                attacker.Hits += 20 + (int)((bushido * bushido) / 480.0);

                int swingBonus = Math.Max(1, (int)((bushido * bushido) / 720.0));

                info         = new HonorableExecutionInfo(attacker, swingBonus);
                info.m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(20.0), new TimerStateCallback(EndEffect), info);

                BuffInfo.AddBuff(attacker, new BuffInfo(BuffIcon.HonorableExecution, 1060595, 1153807, TimeSpan.FromSeconds(20.0), attacker, string.Format("{0}", swingBonus)));

                m_Table[attacker] = info;
            }
            else
            {
                ArrayList mods = new ArrayList
                {
                    new ResistanceMod(ResistanceType.Physical, -40),
                    new ResistanceMod(ResistanceType.Fire, -40),
                    new ResistanceMod(ResistanceType.Cold, -40),
                    new ResistanceMod(ResistanceType.Poison, -40),
                    new ResistanceMod(ResistanceType.Energy, -40)
                };

                double resSpells = attacker.Skills[SkillName.MagicResist].Value;

                if (resSpells > 0.0)
                {
                    mods.Add(new DefaultSkillMod(SkillName.MagicResist, true, -resSpells));
                }

                info         = new HonorableExecutionInfo(attacker, mods);
                info.m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(7.0), new TimerStateCallback(EndEffect), info);

                BuffInfo.AddBuff(attacker, new BuffInfo(BuffIcon.HonorableExecution, 1060595, 1153808, TimeSpan.FromSeconds(7.0), attacker, string.Format("{0}\t40\t40\t40\t40\t40", resSpells)));

                m_Table[attacker] = info;
            }

            attacker.Delta(MobileDelta.WeaponDamage);
            CheckGain(attacker);
        }
        public override void OnCast()
        {
            if (this.CheckSequence())
            {
                this.Caster.PlaySound(0x5CE);

                double skill = this.Caster.Skills[SkillName.Spellweaving].Value;

                int damage = Math.Max(11, 10 + (int)(skill / 24)) + this.FocusLevel;

                int sdiBonus = AosAttributes.GetValue(this.Caster, AosAttribute.SpellDamage);

                int pvmDamage = damage * (100 + sdiBonus);
                pvmDamage /= 100;

                if (sdiBonus > 15)
                {
                    sdiBonus = 15;
                }

                int pvpDamage = damage * (100 + sdiBonus);
                pvpDamage /= 100;

                int      range    = 2 + this.FocusLevel;
                TimeSpan duration = TimeSpan.FromSeconds(5 + this.FocusLevel);

                List <Mobile> targets = new List <Mobile>();

                foreach (Mobile m in this.Caster.GetMobilesInRange(range))
                {
                    if (this.Caster != m && SpellHelper.ValidIndirectTarget(this.Caster, m) && this.Caster.CanBeHarmful(m, false) && this.Caster.InLOS(m))
                    {
                        targets.Add(m);
                    }
                }

                for (int i = 0; i < targets.Count; i++)
                {
                    Mobile m = targets[i];

                    this.Caster.DoHarmful(m);

                    Spell oldSpell = m.Spell as Spell;

                    SpellHelper.Damage(this, m, (m.Player && this.Caster.Player) ? pvpDamage : pvmDamage, 0, 0, 0, 0, 100);

                    if (oldSpell != null && oldSpell != m.Spell)
                    {
                        if (!this.CheckResisted(m))
                        {
                            m_Table[m] = Timer.DelayCall <Mobile>(duration, DoExpire, m);

                            BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Thunderstorm, 1075800, duration, m, GetCastRecoveryMalus(m)));
                            m.Delta(MobileDelta.WeaponDamage);
                        }
                    }
                }
            }

            this.FinishSequence();
        }
Example #34
0
        public virtual void RemovePlayer(Mobile player)
        {
            if (player == null || player.Deleted)
                return;

            if (!Players.Contains(player))
                return;

            if (!player.Alive)
                player.Resurrect();

            if (player is PlayerMobile)
            {
                ((PlayerMobile)player).CurrentEvent = null;
                ((PlayerMobile)player).IsInEvent = false;
                ((PlayerMobile)player).Score = 0;
            }

            player.Blessed = false;

            if (player.Map != Map.Internal)
            {
                player.Location = m_Lobby;
                player.Map = m_LobbyMap;
            }
            else
            {
                player.LogoutLocation = m_Lobby;
                player.LogoutMap = m_LobbyMap;
            }
            m_Players.Remove(player);

            if (m_PlayerSupplies.ContainsKey((PlayerMobile)player))
            {
                SupplySystem.RemoveEventGear(player);
                EquipmentStorage storage = m_PlayerSupplies[(PlayerMobile)player];
                if (storage != null)
                {
                    storage.OnDoubleClick(player);
                    m_PlayerSupplies.Remove((PlayerMobile)player);
                }
            }
            player.Delta(MobileDelta.Noto);
            SendPlayerGumps();
        }
Example #35
0
        public static void OnMasteryChanged(Mobile m, SkillName oldMastery)
        {
            PassiveSpell passive    = GetActivePassive(m);
            SkillName    newMastery = m.Skills.CurrentMastery;

            if (oldMastery != newMastery)
            {
                List <SkillMasterySpell> list = SkillMasterySpell.GetSpells(m);

                if (list != null)
                {
                    list.ForEach(spell =>
                    {
                        spell.Expire();
                    });

                    ColUtility.Free(list);
                }

                if (m is PlayerMobile && oldMastery == SkillName.Necromancy)
                {
                    ((PlayerMobile)m).AllFollowers.IterateReverse(mob =>
                    {
                        if (mob is BaseCreature && CommandUndeadSpell.ValidateTarget((BaseCreature)mob))
                        {
                            ((BaseCreature)mob).SetControlMaster(null);
                        }
                    });
                }

                SpecialMove move = SpecialMove.GetCurrentMove(m);

                if (move is SkillMasteryMove)
                {
                    SpecialMove.ClearCurrentMove(m);
                }

                m.RemoveStatMod("SavingThrow_Str");

                ColUtility.Free(list);
                RemovePassiveBuffs(m);
            }

            if (passive != PassiveSpell.None && passive != PassiveSpell.AnticipateHit)
            {
                switch (passive)
                {
                case PassiveSpell.EnchantedSummoning:
                    BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.EnchantedSummoning, 1155904, 1156090, String.Format("{0}\t{0}", EnchantedSummoningBonus(m).ToString()), true));     // +~1_STAMINA~ Stamina Regeneration and +~2_HP~% Hit Points for summoned pets.<br>Increased difficulty for summoned pets to be dispelled.
                    break;

                case PassiveSpell.Intuition:
                    BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Intuition, 1155907, 1156089, IntuitionBonus(m).ToString(), true));     // Mana Increase ~1_VAL~
                    break;

                case PassiveSpell.SavingThrow:
                {
                    string args = null;

                    switch (GetMasteryLevel(m, newMastery))
                    {
                    default: args = "5\t0\t0\t0"; break;

                    case 2: args = "5\t5\t0\t0"; break;

                    case 3: args = "5\t5\t5\t5"; break;
                    }

                    m.AddStatMod(new StatMod(StatType.Str, "SavingThrow_Str", 5, TimeSpan.Zero));
                    BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.SavingThrow, 1156031, 1156032, args, true));         // Provides a chance to block disarm attempts based on Mastery level, weapon skill level and tactics skill level.
                }
                break;

                case PassiveSpell.Potency:
                    BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Potency, 1155928, 1156195, NonPoisonConsumeChance(m).ToString(), true));     // ~1_VAL~% chance to not consume poison charges when using infecting strike or injected strike.
                    break;

                case PassiveSpell.Knockout:
                    BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Knockout, 1155931, 1156030, String.Format("{0}\t{1}", GetKnockoutModifier(m).ToString(), GetKnockoutModifier(m, true).ToString(), true)));     // Wrestling Damage Bonus:<br>+~1_VAL~% PvM<br>+~2_VAL~% PvP
                    break;

                case PassiveSpell.Boarding:
                    BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Boarding, 1155934, 1156194, BoardingSlotIncrease(m).ToString(), true));     // Your number of stable slots has been increased by ~1_VAL~.
                    break;
                }

                m.Delta(MobileDelta.WeaponDamage);
                m.UpdateResistances();

                if (m.Mana > m.ManaMax)
                {
                    m.Mana = m.ManaMax;
                }
            }

            if (m.Backpack != null)
            {
                foreach (Item item in m.Backpack.FindItemsByType(typeof(BookOfMasteries)))
                {
                    BookOfMasteries book = item as BookOfMasteries;

                    if (book != null)
                    {
                        book.InvalidateProperties();
                    }
                }
            }

            foreach (Item item in m.Items.Where(i => i is BookOfMasteries))
            {
                BookOfMasteries book = item as BookOfMasteries;

                if (book != null)
                {
                    book.InvalidateProperties();
                }
            }
        }
Example #36
0
        public void AddFriend(Mobile from, Mobile targ)
        {
            if (!this.IsCoOwner(from) || this.m_Friends == null || this.m_CoOwners == null)
                return;

            if (this.IsOwner(targ))
            {
                from.SendLocalizedMessage(501370); // This person is already an owner of the house!
            }
            else if (this.m_CoOwners.Contains(targ))
            {
                from.SendLocalizedMessage(501369); // This person is already on your co-owner list!
            }
            else if (!targ.Player)
            {
                from.SendLocalizedMessage(501371); // That can't be a friend of the house.
            }
            else if (this.IsBanned(targ))
            {
                from.SendLocalizedMessage(501374); // This person is banned!  Unban them first.
            }
            else if (this.m_Friends.Count >= MaxFriends)
            {
                from.SendLocalizedMessage(501375); // Your friends list is full!
            }
            else if (this.m_Friends.Contains(targ))
            {
                from.SendLocalizedMessage(501376); // This person is already on your friends list!
            }
            else
            {
                this.m_Friends.Add(targ);

                targ.Delta(MobileDelta.Noto);
                targ.SendLocalizedMessage(501337); // You have been made a friend of this house.
            }
        }
Example #37
0
        public void RemoveFriend(Mobile from, Mobile targ)
        {
            if (!this.IsCoOwner(from) || this.m_Friends == null)
                return;

            if (this.m_Friends.Contains(targ))
            {
                this.m_Friends.Remove(targ);

                targ.Delta(MobileDelta.Noto);

                from.SendLocalizedMessage(501298); // Friend removed from list.
                targ.SendLocalizedMessage(1060751); // You are no longer a friend of this house.
            }
        }
 public void UpdateTitle( Mobile m )
 {
     m.InvalidateProperties();
     m.Delta( MobileDelta.Name );
 }
Example #39
0
        public override void DoEffect(Mobile m)
        {
            ResistanceMod[] mods = (ResistanceMod[])m_Table[m];
       
                int otherMod = 0 + (int)(m.Skills[SkillName.Mysticism].Value / 20);
                int admod = 1 + (int)(m.Skills[SkillName.Focus].Value / 20);
                //int casts = (int)AosAttributes.GetValue(Caster, AosAttribute.CastSpeed - 2);
               

                mods = new ResistanceMod[5]
				{
					new ResistanceMod( ResistanceType.Physical, otherMod + admod  ),
					new ResistanceMod( ResistanceType.Fire,		otherMod + admod  ),
				    new ResistanceMod( ResistanceType.Cold,		otherMod + admod  ),
					new ResistanceMod( ResistanceType.Poison,	otherMod + admod  ),
					new ResistanceMod( ResistanceType.Energy,	otherMod + admod  ),
                   // new ResistanceMod( AosAttribute.CastSpeed, casts )
			       
				};

                m_Table[m] = mods;

                for (int i = 0; i < mods.Length; ++i)
                    m.AddResistanceMod(mods[i]);

                m.PlaySound(0x65B);
                m.FixedParticles(0x3728, 1, 13, 9918, 92, 3, EffectLayer.Head);
                m.Delta(MobileDelta.WeaponDamage);
                
                m.EndAction(typeof(StoneFormSpell));
                
            }
Example #40
0
		public void AddFriend( Mobile from, Mobile targ )
		{
			if( m_Friends == null || m_Owner == targ )
				return;

			if( !targ.Player )
			{
				from.SendMessage( "That can't be a friend of the tent." );
			}
			else if( m_Friends.Contains( targ ) )
			{
				from.SendLocalizedMessage( 501376 ); //This person is already on your friends list.
			}
			else
			{
				m_Friends.Add( targ );

				targ.Delta( MobileDelta.Noto );
				targ.SendMessage( "You have been granted access to this tent." );
			}
		}
Example #41
0
        public override void RemoveEffect( Mobile m )
        {
            m.Delta( MobileDelta.WeaponDamage );

            BuffInfo.RemoveBuff(m, BuffIcon.StoneForm);
        }
Example #42
0
		public void RemoveFriend( Mobile from, Mobile targ )
		{
			if( m_Friends == null )
				return;

			if( m_Friends.Contains( targ ) )
			{
				m_Friends.Remove( targ );

				targ.Delta( MobileDelta.Noto );

				from.SendMessage( "{0} has been removed from your friends list.", targ.RawName );
				targ.SendMessage( "Your access to this tent has been removed." );
			}
		}
Example #43
0
        public void RemoveMember(Mobile mob)
        {
            PlayerState pl = PlayerState.Find(mob);

            if (pl == null || !this.Members.Contains(pl))
                return;

            int killPoints = pl.KillPoints;

            if (mob.Backpack != null)
            {
                //Ordinarily, through normal faction removal, this will never find any sigils.
                //Only with a leave delay less than the ReturnPeriod or a Faction Kick/Ban, will this ever do anything
                Item[] sigils = mob.Backpack.FindItemsByType(typeof(Sigil));

                for (int i = 0; i < sigils.Length; ++i)
                    ((Sigil)sigils[i]).ReturnHome();
            }

            if (pl.RankIndex != -1)
            {
                while ((pl.RankIndex + 1) < this.ZeroRankOffset)
                {
                    PlayerState pNext = this.Members[pl.RankIndex + 1];
                    this.Members[pl.RankIndex + 1] = pl;
                    this.Members[pl.RankIndex] = pNext;
                    pl.RankIndex++;
                    pNext.RankIndex--;
                }

                this.ZeroRankOffset--;
            }

            this.Members.Remove(pl);

            if (mob is PlayerMobile)
                ((PlayerMobile)mob).FactionPlayerState = null;

            mob.InvalidateProperties();
            mob.Delta(MobileDelta.Noto);

            if (this.Election.IsCandidate(mob))
                this.Election.RemoveCandidate(mob);

            this.Election.RemoveVoter(mob);

            if (pl.Finance != null)
                pl.Finance.Finance = null;

            if (pl.Sheriff != null)
                pl.Sheriff.Sheriff = null;

            if (this.Commander == mob)
                this.Commander = null;

            if (mob is PlayerMobile)
                ((PlayerMobile)mob).ValidateEquipment();

            if (killPoints > 0)
                DistributePoints(killPoints);
        }
Example #44
0
        public virtual void Negate(Mobile m)
        {
            if (m == null || m.Deleted)
            {
                return;
            }

            SpellUtility.NegateAllEffects(m);

            if (DebugMode || m.AccessLevel <= AccessLevel.Counselor)
            {
                m.RevealingAction();
                m.DisruptiveAction();
            }

            if (m.Target != null)
            {
                m.Target.Cancel(m, TargetCancelType.Overriden);
            }

            m.Spell = null;

            if (m.Combatant != null)
            {
#if ServUO
                // ReSharper disable once RedundantCast
                var c = m.Combatant as Mobile;
#else
                var c = m.Combatant;
#endif

                if (c != null && c.Combatant == m)
                {
                    c.Combatant = null;
                    c.Warmode   = false;
                }

                m.Combatant = null;
            }

            if (m.Aggressed != null)
            {
                m.Aggressed.Clear();
            }

            if (m.Aggressors != null)
            {
                m.Aggressors.Clear();
            }

            if (m.Warmode && !m.InRegion(BattleRegion))
            {
                m.Warmode = false;
            }

            m.Criminal = false;

            m.Delta(MobileDelta.Noto);

            if ((DebugMode || m.AccessLevel <= AccessLevel.Counselor) && m.InRegion(BattleRegion))
            {
                m.Items.ForEachReverse(o => InvalidateItem(m, o));
            }
        }
Example #45
0
		public void RemoveMember( Mobile m, int message )
		{
			if ( m_Members.Contains( m ) )
			{
				m_Members.Remove( m );
				
				Guild guild = m.Guild as Guild;
				
				m.Guild = null;

				if( m is PlayerMobile )
					((PlayerMobile)m).GuildRank = RankDefinition.Lowest;

				if( message > 0 )
					m.SendLocalizedMessage( message );

				if ( m == m_Leader )
				{
					CalculateGuildmaster();

					if ( m_Leader == null )
						Disband();
				}

				if ( m_Members.Count == 0 )
					Disband();
				
				if ( guild != null )
					guild.InvalidateWarNotoriety();
				
				m.Delta( MobileDelta.Noto );
			}
		}
Example #46
0
 public override void RemoveEffect(Mobile m)
 {
     m.Delta(MobileDelta.WeaponDamage);
     BuffInfo.RemoveBuff(m, BuffIcon.HorrificBeast);
 }
Example #47
0
		public override bool IsHarmfulCriminal( Mobile target )
		{
			if ( SkillHandlers.Stealing.ClassicMode && target is PlayerMobile && ((PlayerMobile)target).m_PermaFlags.Count > 0 )
			{
				int noto = Notoriety.Compute( this, target );

				if ( noto == Notoriety.Innocent )
					target.Delta( MobileDelta.Noto );

				return false;
			}

			if ( target is BaseCreature && ((BaseCreature)target).InitialInnocent && !((BaseCreature)target).Controlled )
				return false;

			if ( Core.ML && target is BaseCreature && ((BaseCreature)target).Controlled && this == ((BaseCreature)target).ControlMaster )
				return false;

			return base.IsHarmfulCriminal( target );
		}
Example #48
0
		public override void RemoveEffect( Mobile m )
		{
			m.Delta( MobileDelta.WeaponDamage );
		}
Example #49
0
 public override void RemoveEffect(Mobile m)
 {
     m.Delta(MobileDelta.WeaponDamage);
 }
Example #50
0
 public static void RemoveEffect( Mobile m )
 {
     m_Table.Remove( m );
     m.Delta( MobileDelta.WeaponDamage );
 }