Ejemplo n.º 1
0
 public void HitPlayer(World world, Vector3I pos, Player hitted, Player by, ref int restDistance, IList <BlockUpdate> updates)
 {
     hitted.Kill(world, String.Format("{0}&S was torn to pieces by {1}", hitted.ClassyName, hitted.ClassyName == by.ClassyName ? "theirself" : by.ClassyName));
     updates.Add(new BlockUpdate(null, pos, Block.TNT));
     world.AddPhysicsTask(new TNTTask(world, pos, by, false, true), 0);
     restDistance = 0;
 }
Ejemplo n.º 2
0
 public void HitPlayer(World world, Vector3I pos, Player hitted, Player by, ref int restDistance,
                       IList <BlockUpdate> updates)
 {
     hitted.Kill(world,
                 String.Format("{0}&S was shot by {1}", hitted.ClassyName,
                               hitted.ClassyName == by.ClassyName ? "theirself" : by.ClassyName));
     updates.Add(new BlockUpdate(null, pos, Block.Air));
     restDistance = 0;
 }
Ejemplo n.º 3
0
 public void HitPlayer(World world, Player hitted, Player by)
 {
     if (by == null)
     {
         if (MineField.Failed != null && !MineField.Failed.Contains(hitted))
         {
             hitted.Kill(world, String.Format("{0}&S was torn to pieces and lost the game!", hitted.ClassyName));
             if (MineField.PlayerBlowUpCheck(hitted))
             {
                 hitted.Message("&WYou lost the game! You are now unable to win.");
             }
             return;
         }
         else
         {
             return;
         }
     }
     hitted.Kill(world, String.Format("{0}&S was torn to pieces by {1}", hitted.ClassyName, hitted.ClassyName == by.ClassyName?"theirself":by.ClassyName));
 }
Ejemplo n.º 4
0
 public void HitPlayer(World world, Player hitted, Player by)
 {
     if (by == null)
     {
         if (MineField.Failed != null && !MineField.Failed.Contains(hitted))
         {
             hitted.Kill(world, String.Format("{0}&S was torn to pieces and lost the game!", hitted.ClassyName));
             if (MineField.PlayerBlowUpCheck(hitted))
             {
                 hitted.Message("&WYou lost the game! You are now unable to win.");
             }
             return;
         }
         else return;
     }
     hitted.Kill(world, String.Format("{0}&S was torn to pieces by {1}", hitted.ClassyName, hitted.ClassyName==by.ClassyName?"theirself":by.ClassyName));
 }
Ejemplo n.º 5
0
 public void HitPlayer(World world, Vector3I pos, Player hitted, Player by, ref int restDistance, IList<BlockUpdate> updates)
 {
     hitted.Kill(world, String.Format("{0}&S was torn to pieces by {1}", hitted.ClassyName, hitted.ClassyName == by.ClassyName ? "theirself" : by.ClassyName));
     updates.Add(new BlockUpdate(null, pos, Block.TNT));
     world.AddPhysicsTask(new TNTTask(world, pos, by, false, true), 0);
     restDistance = 0;
 }
Ejemplo n.º 6
0
 public void HitPlayer(World world, Vector3I pos, Player hitted, Player by, ref int restDistance, IList<BlockUpdate> updates)
 {
     hitted.Kill(world, String.Format("{0}&S was blown up by {1}", hitted.ClassyName, hitted.ClassyName == by.ClassyName ? "theirself" : by.ClassyName));
 }
Ejemplo n.º 7
0
        //hitted? jonty I thought you were better than that :(
        public void HitPlayer(World world, Vector3I pos, Player hitted, Player by, ref int restDistance, IList<BlockUpdate> updates)
        {
            //Capture the flag
            if (by.Info.isPlayingCTF)
            {
                //Friendly fire
                if ((hitted.Info.CTFBlueTeam && by.Info.CTFBlueTeam) || (hitted.Info.CTFRedTeam && by.Info.CTFRedTeam))
                {
                    by.Message("{0} is on your team!", hitted.Name);
                    return;
                }

                if (hitted.Info.canDodge)
                {
                    int dodgeChance = (new Random()).Next(0, 2);
                    if (dodgeChance == 0)
                    {
                        by.Message("{0} dodged your attack!", hitted.Name);
                        return;
                    }
                }
                //Take the hit, one in ten chance of a critical hit which does 50 damage instead of 25
                int critical = (new Random()).Next(0, 9);

                if (critical == 0)
                {
                    if (by.Info.strengthened)//critical by a strengthened enemy instantly kills
                    {
                        hitted.Info.Health = 0;
                    }
                    else
                    {
                        hitted.Info.Health -= 50;
                    }
                    world.Players.Message("{0} landed a critical shot on {1}!", by.Name, hitted.Name);
                }
                else
                {
                    if (by.Info.strengthened)
                    {
                        hitted.Info.Health -= 50;
                    }
                    else
                    {
                        hitted.Info.Health -= 25;
                    }
                }

                //Create epic ASCII Health Bar

                string healthBar = "&f[&a--------&f]";
                if (hitted.Info.Health == 75)
                {
                    healthBar = "&f[&a------&8--&f]";
                }
                else if (hitted.Info.Health == 50)
                {
                    healthBar = "&f[&e----&8----&f]";
                }
                else if (hitted.Info.Health == 25)
                {
                    healthBar = "&f[&c--&8------&f]";
                }
                else if(hitted.Info.Health <= 0)
                {
                    healthBar = "&f[&8--------&f]";
                }

                if (hitted.ClassiCube && Heartbeat.ClassiCube())
                {
                    hitted.Send(PacketWriter.MakeSpecialMessage((byte)1, healthBar));
                }
                else
                {
                    hitted.Message("You have " + hitted.Info.Health.ToString() + " health.");
                }

                //If the hit player's health is 0 or less, they die
                if (hitted.Info.Health <= 0)
                {

                    hitted.KillCTF(world, String.Format("&f{0}&S was shot by &f{1}", hitted.Name, by.Name));
                    CTF.PowerUp(by);
                    hitted.Info.CTFKills++;

                    if (hitted.Info.hasRedFlag)
                    {
                        world.Players.Message("The red flag has been returned.");
                        hitted.Info.hasRedFlag = false;

                        //Put flag back
                        BlockUpdate blockUpdate = new BlockUpdate(null, world.redFlag, Block.Red);
                        foreach (Player p in world.Players)
                        {
                            p.World.Map.QueueUpdate(blockUpdate);
                        }
                        world.redFlagTaken = false;

                    }

                    if (hitted.Info.hasBlueFlag)
                    {
                        world.Players.Message("The blue flag has been returned.");
                        hitted.Info.hasBlueFlag = false;

                        //Put flag back
                        BlockUpdate blockUpdate = new BlockUpdate(null, world.blueFlag, Block.Blue);
                        foreach (Player p in world.Players)
                        {
                            p.World.Map.QueueUpdate(blockUpdate);
                        }
                        world.blueFlagTaken = false;
                    }

                    //revive dead players with 100% health
                    hitted.Info.Health = 100;

                    if (hitted.ClassiCube && Heartbeat.ClassiCube())
                    {
                        hitted.Send(PacketWriter.MakeSpecialMessage((byte)1, "&f[&a--------&f]"));
                    }
                    else
                    {
                        hitted.Message("You have 100 health.");
                    }
                }

                return;
            }

            //TDM and FFA
            if ((hitted.Info.isOnBlueTeam && by.Info.isOnBlueTeam) || (hitted.Info.isOnRedTeam && by.Info.isOnRedTeam))
            {
                by.Message("{0} is on your team!", hitted.ClassyName);
            }
            else
            {

                //Take the hit, one in ten chance of a critical hit which does 50 damage instead of 25
                int critical = (new Random()).Next(0, 9);

                if (critical == 0)
                {
                    hitted.Info.Health -= 50;
                    world.Players.Message("{0} landed a critical shot on {1}!", by.Name, hitted.Name);
                }
                else
                {
                    hitted.Info.Health -= 25;
                }

                if (hitted.Info.Health < 0)
                {
                    hitted.Info.Health = 0;
                }

                //Create epic ASCII Health Bar

                string healthBar = "&f[&a--------&f]";
                if (hitted.Info.Health == 75)
                {
                    healthBar = "&f[&a------&8--&f]";
                }
                else if (hitted.Info.Health == 50)
                {
                    healthBar = "&f[&e----&8----&f]";
                }
                else if (hitted.Info.Health == 25)
                {
                    healthBar = "&f[&c--&8------&f]";
                }
                else
                {
                    healthBar = "&f[&8--------&f]";
                }
                hitted.Send(PacketWriter.MakeSpecialMessage((byte)1, healthBar));
                if (hitted.ClassiCube && Heartbeat.ClassiCube())
                {
                    hitted.Send(PacketWriter.MakeSpecialMessage((byte)1, healthBar));
                }
                else
                {
                    hitted.Message("You have " + hitted.Info.Health.ToString() + " health.");
                }

                if (hitted.Info.Health == 0)
                {

                    hitted.Kill(world, String.Format("{0}&S was shot by {1}", hitted.ClassyName, hitted.ClassyName == by.ClassyName ? "theirself" : by.ClassyName));
                    updates.Add(new BlockUpdate(null, pos, Block.Air));
                    restDistance = 0;

                    //TDM
                    if (fCraft.TeamDeathMatch.isOn)
                    {
                        if (hitted.Info.isPlayingTD && hitted.Info.isOnBlueTeam && by.Info.isPlayingTD) //if the player is playing TD and on blue team, +1 for Red Team Score
                        {
                            fCraft.TeamDeathMatch.redScore++;
                            hitted.Info.gameDeaths++;
                            hitted.Info.totalDeathsTDM++;
                            by.Info.gameKills++;
                            by.Info.totalKillsTDM++;
                        }
                        if (hitted.Info.isPlayingTD && hitted.Info.isOnRedTeam && by.Info.isPlayingTD) //if the player is playing TD and on blue team, +1 for Red Team Score
                        {
                            fCraft.TeamDeathMatch.blueScore++;
                            hitted.Info.gameDeaths++;       //counts the individual players deaths
                            hitted.Info.totalDeathsTDM++;   //tallies total TDM deaths (never gets reset)
                            by.Info.gameKills++;            //counts the individual players amount of kills
                            by.Info.totalKillsTDM++;        //tallies total TDM kills
                        }

                        //update scoreboard for all players
                        foreach (Player p in hitted.World.Players)
                        {
                            if (p.ClassiCube && Heartbeat.ClassiCube())
                            {
                                p.Send(PacketWriter.MakeSpecialMessage((byte)2, "&cRed&f: " + fCraft.TeamDeathMatch.redScore + ",&1 Blue&f: " + fCraft.TeamDeathMatch.blueScore));
                            }
                            else
                            {
                                p.Message("The score is now &cRed&f: " + fCraft.TeamDeathMatch.redScore + ",&1 Blue&f: " + fCraft.TeamDeathMatch.blueScore);
                            }
                        }
                    }

                    //FFA
                    if (FFA.isOn())
                    {
                        if (hitted.Info.isPlayingFFA && by.Info.isPlayingFFA) //if the player is playing FFA and the person they hit is also playing
                        {
                            hitted.Info.gameDeathsFFA++;
                            hitted.Info.totalDeathsFFA++;
                            by.Info.gameKillsFFA++;
                            by.Info.totalKillsFFA++;
                        }

                        //find current kill leader
                        Player leader = new Player("");//create a temp pseudo player
                        int kills = 0;

                        foreach (Player p in hitted.World.Players)
                        {
                            if (p.Info.gameKillsFFA > kills)
                            {
                                kills = p.Info.gameKillsFFA;
                                leader = p;
                            }
                        }
                        foreach (Player p in hitted.World.Players)
                        {
                            if (p.ClassiCube && Heartbeat.ClassiCube())
                            {
                                p.Send(PacketWriter.MakeSpecialMessage((byte)2, "&eCurrent Leader&f: " + leader.Name + ", Kills: " + leader.Info.gameKillsFFA));
                            }
                        }
                    }

                    //revive dead players with 100% health
                    hitted.Info.Health = 100;

                    if (hitted.ClassiCube && Heartbeat.ClassiCube())
                    {
                        hitted.Send(PacketWriter.MakeSpecialMessage((byte)1, "&f[&a--------&f]"));
                    }
                    else
                    {
                        hitted.Message("You have " + hitted.Info.Health.ToString() + "health.");
                    }
                }
            }
        }
Ejemplo n.º 8
0
        //hitted? jonty I thought you were better than that :(
        public void HitPlayer(World world, Vector3I pos, Player hitted, Player by, ref int restDistance, IList <BlockUpdate> updates)
        {
            //Capture the flag
            if (by.Info.isPlayingCTF)
            {
                //Friendly fire
                if ((hitted.Info.CTFBlueTeam && by.Info.CTFBlueTeam) || (hitted.Info.CTFRedTeam && by.Info.CTFRedTeam))
                {
                    by.Message("{0} is on your team!", hitted.Name);
                    return;
                }

                if (hitted.Info.canDodge)
                {
                    int dodgeChance = (new Random()).Next(0, 2);
                    if (dodgeChance == 0)
                    {
                        by.Message("{0} dodged your attack!", hitted.Name);
                        return;
                    }
                }
                //Take the hit, one in ten chance of a critical hit which does 50 damage instead of 25
                int critical = (new Random()).Next(0, 9);

                if (critical == 0)
                {
                    if (by.Info.strengthened)                   //critical by a strengthened enemy instantly kills
                    {
                        hitted.Info.Health = 0;
                    }
                    else
                    {
                        hitted.Info.Health -= 50;
                    }
                    world.Players.Message("{0} landed a critical shot on {1}!", by.Name, hitted.Name);
                }
                else
                {
                    if (by.Info.strengthened)
                    {
                        hitted.Info.Health -= 50;
                    }
                    else
                    {
                        hitted.Info.Health -= 25;
                    }
                }

                //Create epic ASCII Health Bar

                string healthBar = "&f[&a--------&f]";
                if (hitted.Info.Health == 75)
                {
                    healthBar = "&f[&a------&8--&f]";
                }
                else if (hitted.Info.Health == 50)
                {
                    healthBar = "&f[&e----&8----&f]";
                }
                else if (hitted.Info.Health == 25)
                {
                    healthBar = "&f[&c--&8------&f]";
                }
                else if (hitted.Info.Health <= 0)
                {
                    healthBar = "&f[&8--------&f]";
                }

                if (hitted.usesCPE)
                {
                    hitted.Send(PacketWriter.MakeSpecialMessage((byte)1, healthBar));
                }
                else
                {
                    hitted.Message("You have " + hitted.Info.Health.ToString() + " health.");
                }

                //If the hit player's health is 0 or less, they die
                if (hitted.Info.Health <= 0)
                {
                    hitted.KillCTF(world, String.Format("&f{0}&S was shot by &f{1}", hitted.Name, by.Name));
                    CTF.PowerUp(by);
                    hitted.Info.CTFKills++;

                    if (hitted.Info.hasRedFlag)
                    {
                        world.Players.Message("The red flag has been returned.");
                        hitted.Info.hasRedFlag = false;

                        //Put flag back
                        BlockUpdate blockUpdate = new BlockUpdate(null, world.redFlag, Block.Red);
                        foreach (Player p in world.Players)
                        {
                            p.World.Map.QueueUpdate(blockUpdate);
                        }
                        world.redFlagTaken = false;
                    }

                    if (hitted.Info.hasBlueFlag)
                    {
                        world.Players.Message("The blue flag has been returned.");
                        hitted.Info.hasBlueFlag = false;

                        //Put flag back
                        BlockUpdate blockUpdate = new BlockUpdate(null, world.blueFlag, Block.Blue);
                        foreach (Player p in world.Players)
                        {
                            p.World.Map.QueueUpdate(blockUpdate);
                        }
                        world.blueFlagTaken = false;
                    }

                    //revive dead players with 100% health
                    hitted.Info.Health = 100;

                    if (hitted.usesCPE)
                    {
                        hitted.Send(PacketWriter.MakeSpecialMessage((byte)1, "&f[&a--------&f]"));
                    }
                    else
                    {
                        hitted.Message("You have 100 health.");
                    }
                }

                return;
            }

            //TDM and FFA
            if ((hitted.Info.isOnBlueTeam && by.Info.isOnBlueTeam) || (hitted.Info.isOnRedTeam && by.Info.isOnRedTeam))
            {
                by.Message("{0} is on your team!", hitted.ClassyName);
            }
            else
            {
                //Take the hit, one in ten chance of a critical hit which does 50 damage instead of 25
                int critical = (new Random()).Next(0, 9);

                if (critical == 0)
                {
                    hitted.Info.Health -= 50;
                    world.Players.Message("{0} landed a critical shot on {1}!", by.Name, hitted.Name);
                }
                else
                {
                    hitted.Info.Health -= 25;
                }

                if (hitted.Info.Health < 0)
                {
                    hitted.Info.Health = 0;
                }

                //Create epic ASCII Health Bar

                string healthBar = "&f[&a--------&f]";
                if (hitted.Info.Health == 75)
                {
                    healthBar = "&f[&a------&8--&f]";
                }
                else if (hitted.Info.Health == 50)
                {
                    healthBar = "&f[&e----&8----&f]";
                }
                else if (hitted.Info.Health == 25)
                {
                    healthBar = "&f[&c--&8------&f]";
                }
                else
                {
                    healthBar = "&f[&8--------&f]";
                }
                hitted.Send(PacketWriter.MakeSpecialMessage((byte)1, healthBar));
                if (hitted.usesCPE)
                {
                    hitted.Send(PacketWriter.MakeSpecialMessage((byte)1, healthBar));
                }
                else
                {
                    hitted.Message("You have " + hitted.Info.Health.ToString() + " health.");
                }

                if (hitted.Info.Health == 0)
                {
                    hitted.Kill(world, String.Format("{0}&S was shot by {1}", hitted.ClassyName, hitted.ClassyName == by.ClassyName ? "theirself" : by.ClassyName));
                    updates.Add(new BlockUpdate(null, pos, Block.Air));
                    restDistance = 0;

                    //TDM
                    if (fCraft.TeamDeathMatch.isOn)
                    {
                        if (hitted.Info.isPlayingTD && hitted.Info.isOnBlueTeam && by.Info.isPlayingTD)                        //if the player is playing TD and on blue team, +1 for Red Team Score
                        {
                            fCraft.TeamDeathMatch.redScore++;
                            hitted.Info.gameDeaths++;
                            hitted.Info.totalDeathsTDM++;
                            by.Info.gameKills++;
                            by.Info.totalKillsTDM++;
                        }
                        if (hitted.Info.isPlayingTD && hitted.Info.isOnRedTeam && by.Info.isPlayingTD)                        //if the player is playing TD and on blue team, +1 for Red Team Score
                        {
                            fCraft.TeamDeathMatch.blueScore++;
                            hitted.Info.gameDeaths++;                                   //counts the individual players deaths
                            hitted.Info.totalDeathsTDM++;                               //tallies total TDM deaths(never gets reset)
                            by.Info.gameKills++;                                        //counts the individual players amount of kills
                            by.Info.totalKillsTDM++;                                    //tallies total TDM kills
                        }

                        //update scoreboard for all players
                        foreach (Player p in hitted.World.Players)
                        {
                            if (p.usesCPE)
                            {
                                p.Send(PacketWriter.MakeSpecialMessage((byte)2, "&cRed&f: " + fCraft.TeamDeathMatch.redScore + ",&1 Blue&f: " + fCraft.TeamDeathMatch.blueScore));
                            }
                            else
                            {
                                p.Message("The score is now &cRed&f: " + fCraft.TeamDeathMatch.redScore + ",&1 Blue&f: " + fCraft.TeamDeathMatch.blueScore);
                            }
                        }
                    }

                    //FFA
                    if (FFA.isOn())
                    {
                        if (hitted.Info.isPlayingFFA && by.Info.isPlayingFFA)                        //if the player is playing FFA and the person they hit is also playing
                        {
                            hitted.Info.gameDeathsFFA++;
                            hitted.Info.totalDeathsFFA++;
                            by.Info.gameKillsFFA++;
                            by.Info.totalKillsFFA++;
                        }

                        //find current kill leader
                        Player leader = new Player("");                        //create a temp pseudo player
                        int    kills  = 0;

                        foreach (Player p in hitted.World.Players)
                        {
                            if (p.Info.gameKillsFFA > kills)
                            {
                                kills  = p.Info.gameKillsFFA;
                                leader = p;
                            }
                        }
                        foreach (Player p in hitted.World.Players)
                        {
                            if (p.usesCPE)
                            {
                                p.Send(PacketWriter.MakeSpecialMessage((byte)2, "&eCurrent Leader&f: " + leader.Name + ", Kills: " + leader.Info.gameKillsFFA));
                            }
                        }
                    }

                    //revive dead players with 100% health
                    hitted.Info.Health = 100;

                    if (hitted.usesCPE)
                    {
                        hitted.Send(PacketWriter.MakeSpecialMessage((byte)1, "&f[&a--------&f]"));
                    }
                    else
                    {
                        hitted.Message("You have " + hitted.Info.Health.ToString() + "health.");
                    }
                }
            }
        }
Ejemplo n.º 9
0
 public void HitPlayer(World world, Vector3I pos, Player hitted, Player by, ref int restDistance, IList <BlockUpdate> updates)
 {
     hitted.Kill(world, String.Format("{0}&S was blown up by {1}", hitted.ClassyName, hitted.ClassyName == by.ClassyName ? "theirself" : by.ClassyName));
 }
Ejemplo n.º 10
0
 public void HitPlayer(World world, Vector3I pos, Player hitted, Player by, ref int restDistance, IList<BlockUpdate> updates)
 {
     hitted.Kill(world, String.Format("{0}&S was shot by {1}", hitted.ClassyName, hitted.ClassyName == by.ClassyName ? "theirself" : by.ClassyName));
     updates.Add(new BlockUpdate(null, pos, Block.Air));
     restDistance = 0;
 }
Ejemplo n.º 11
0
 public void HitPlayer(World world, Vector3I pos, Player hitted, Player by, ref int restDistance, IList<BlockUpdate> updates)
 {
     if ((hitted.Info.isOnBlueTeam && by.Info.isOnBlueTeam) || (hitted.Info.isOnRedTeam && by.Info.isOnRedTeam))
     {
         by.Message("{0} is on your team!", hitted.ClassyName);
     }
     else
     {
         hitted.Kill(world, String.Format("{0}&S was shot by {1}", hitted.ClassyName, hitted.ClassyName == by.ClassyName ? "theirself" : by.ClassyName));
         updates.Add(new BlockUpdate(null, pos, Block.Air));
         restDistance = 0;
         if (TeamDeathMatch.isOn)
         {
             if (hitted.Info.isPlayingTD && hitted.Info.isOnBlueTeam && by.Info.isPlayingTD) //if the player is playing TD and on blue team, +1 for Red Team Score
             {
                 TeamDeathMatch.redScore++;
                 hitted.Info.gameDeaths++;
                 hitted.Info.totalDeathsTDM++;
                 by.Info.gameKills++;
                 by.Info.totalKillsTDM++;
             }
             if (hitted.Info.isPlayingTD && hitted.Info.isOnRedTeam && by.Info.isPlayingTD) //if the player is playing TD and on blue team, +1 for Red Team Score
             {
                 TeamDeathMatch.blueScore++;
                 hitted.Info.gameDeaths++;       //counts the individual players deaths
                 hitted.Info.totalDeathsTDM++;   //tallies total TDM deaths (never gets reset)
                 by.Info.gameKills++;            //counts the individual players amount of kills
                 by.Info.totalKillsTDM++;        //tallies total TDM kills
             }
         }
     }
 }