Ejemplo n.º 1
0
            protected override void OnTarget(Mobile from, object target)
            {
                if (!m_Flag.Game.Running)
                {
                    from.SendMessage("You cannot pass or capture after the game end.");
                    return;
                }

                CTFTeam fteam = m_Flag.Game.GetTeam(from);

                if (target is Mobile)
                {
                    Mobile  targ  = (Mobile)target;
                    CTFTeam tteam = m_Flag.Game.GetTeam(targ);
                    if (targ.Alive && tteam == fteam && from != targ)
                    {
                        if (targ.Backpack != null)
                        {
                            m_Flag.RandomizeItemID();
                            targ.Backpack.DropItem(m_Flag);
                            targ.SendMessage("{0} gave you the {1} flag!", from.Name, m_Flag.Team.Name);
                            m_Flag.Game.PlayerMessage("{0} passed the {1} flag to {2}!", from.Name, m_Flag.Team.Name, targ.Name);
                        }
                    }
                    else
                    {
                        from.SendMessage("You cannot give the flag to them!");
                    }
                }
                else if (target is CTFFlag)
                {
                    CTFFlag flag = target as CTFFlag;
                    if (flag.Team == fteam)
                    {
                        if (flag.Home)
                        {
                            CTFScoreBoard.Captured(from);
                            if (m_Flag.Game != null && m_Flag.Game.IsLeagueGame)
                            {
                                CTFLScoreBoard.Captured(from);
                            }
                            from.SendMessage("You captured the {0} flag!", m_Flag.Team.Name);
                            flag.Game.PlayerMessage("{0} ({1}) captured the {2} flag!", from.Name, fteam.Name, m_Flag.Team.Name);
                            m_Flag.ReturnToHome();
                            fteam.Points += 15;
                        }
                        else
                        {
                            from.SendMessage("Your flag must be at home to capture!");
                        }
                    }
                    else
                    {
                        from.SendMessage("You can only capture for your own team!");
                    }
                }
            }
Ejemplo n.º 2
0
            protected override void OnTick()
            {
                Mobile  owner = m_Flag.RootParent as Mobile;
                CTFGame game  = m_Flag.Game;

                TimeSpan left = MaxFlagHoldTime - (DateTime.Now - m_Start);

                if (left >= TimeSpan.FromSeconds(1.0))
                {
                    if (left > TimeSpan.FromMinutes(1.0))
                    {
                        Interval = TimeSpan.FromSeconds(30.0);
                    }
                    else if (left > TimeSpan.FromSeconds(30.0))
                    {
                        Interval = TimeSpan.FromSeconds(15.0);
                    }
                    else if (left >= TimeSpan.FromSeconds(10.0))
                    {
                        Interval = TimeSpan.FromSeconds(5.0);
                    }
                    else
                    {
                        Interval = TimeSpan.FromSeconds(1.0);
                    }

                    if (owner != null)
                    {
                        owner.SendAsciiMessage("You must take the {0} flag to your flag in {1} seconds or be killed!", m_Flag.Team.Name, (int)left.TotalSeconds);
                    }
                }
                else
                {
                    if (owner != null)
                    {
                        owner.BoltEffect(0);
                        owner.PlaySound(0xDC);                          //snake hiss
                        owner.Kill();
                    }

                    m_Flag.Game.PlayerMessage("The {0} flag has been returned to base!", m_Flag.Team.Name);
                    m_Flag.ReturnToHome();
                    Stop();
                }
            }
Ejemplo n.º 3
0
            protected override void OnTarget(Mobile from, object target)
            {
                CTFTeam fteam = m_Flag.Game.GetTeam(from);

                if (target is Mobile)
                {
                    Mobile  targ  = (Mobile)target;
                    CTFTeam tteam = m_Flag.Game.GetTeam(targ);
                    if (tteam == fteam && from != targ)
                    {
                        if (targ.Backpack != null)
                        {
                            targ.Backpack.DropItem(m_Flag);
                            targ.SendAsciiMessage("{0} gave you the {1} flag!", from.Name, m_Flag.Team.Name);
                            m_Flag.Game.PlayerMessage("{0} passed the {1} flag to {2}!", from.Name, m_Flag.Team.Name, targ.Name);
                        }
                    }
                    else
                    {
                        from.SendAsciiMessage("You cannot give the flag to them!");
                    }
                }
                else if (target is CTFFlag)
                {
                    CTFFlag flag = target as CTFFlag;
                    if (flag.Team == fteam)
                    {
                        if (flag.Home)
                        {
                            from.SendAsciiMessage("You captured the {0} flag!", m_Flag.Team.Name);
                            flag.Game.PlayerMessage("{0} ({1}) captured the {2} flag!", from.Name, fteam.Name, m_Flag.Team.Name);
                            m_Flag.ReturnToHome();
                            fteam.Points += 15;
                        }
                        else
                        {
                            from.SendAsciiMessage("Your flag must be at home to capture!");
                        }
                    }
                    else
                    {
                        from.SendAsciiMessage("You can only capture for your own team!");
                    }
                }
            }