public GameResults(int timeLeft, int remainingHealth, bool won, DeathReason deathReason)
 {
     this.timeLeft        = timeLeft;
     this.remainingHealth = remainingHealth;
     this.won             = won;
     this.deathReason     = deathReason;
 }
Example #2
0
        public override void OnLocalDie(PlayerControl Victim, DeathReason Reason)
        {
            if (!IsLocalPlayer())
            {
                return;
            }
            if (Victim.PlayerId != Player.PlayerId)
            {
                return;
            }

            Infected.Remove(Player.PlayerId);
            var TargetIds = new Il2CppStructArray <byte>(Infected.Count);
            var Index     = 0;

            foreach (var InfectedId in Infected)
            {
                TargetIds[Index] = InfectedId;
                Index++;
            }
            ConsoleTools.Info(TargetIds.Count.ToString());

            ExtraNetwork.Send(CustomRPC.ZombieChainKill, Writer => {
                Writer.WriteBytesAndSize(TargetIds);
            });

            KillTargets(TargetIds);
        }
Example #3
0
        protected async Task Kill(MafiaPlayer player, DeathReason reason)
        {
            Players.Remove(player);
            Killed.Add(player);
            await GetGuild().GetUser(player.GetId()).AddRoleAsync(GetDeadRole());

            await ChannelVisibility(GetGeneral(), Killed, x => false, true);
            await ChannelVisibility(GetDead(), Killed, x => true);
            await VoiceMute(Killed, false);

            if (IsMafia(player))
            {
                await ChannelVisibility(GetMafia(), new List <MafiaPlayer> {
                    player
                }, false, true);
            }

            var dm = await player.GetDm();

            await dm.SendMessageAsync("", false, new EmbedBuilder()
                                      .WithColor(Color.Red)
                                      .WithTitle("You are dead.")
                                      .WithDescription(DeathDescription(reason))
                                      .Build());
        }
Example #4
0
        public static bool Prefix(PlayerControl __instance, [HarmonyArgument(0)] DeathReason oecopgmhmkc)
        {
            var flag = AmongUsClient.Instance.ClientId == AmongUsClient.Instance.HostId;

            if (!flag)
            {
                return(true);
            }
            __instance.Data.IsDead = true;

            var flag3 = __instance.isLover() && CustomGameOptions.BothLoversDie;

            if (!flag3)
            {
                return(true);
            }
            var otherLover = Roles.Role.GetRole <Roles.Lover>(__instance).OtherLover.Player;

            if (otherLover.Data.IsDead)
            {
                return(true);
            }
            Utils.RpcMurderPlayer(otherLover, otherLover);
            return(true);
        }
Example #5
0
 IEnumerator SpawnPlayer(PlayerBase player, float time, DeathReason type)
 {
     yield return new WaitForSeconds(time);
     var availablePositions = player.Team == Team.Suicidials ? SuicidialSpawnPoints : RescuerSpawnPoints;
     var length = availablePositions.Count;
     var newPosition = availablePositions[Random.Range(0, length)].position;
     if (type == DeathReason.Net)
     {
         var weapon = GameObject.FindObjectOfType<PlayerWeapon>();
         weapon.CmdSpawnBullet(player.transform.position, new Vector2());
     }
     player.transform.position = newPosition;
     player.GetComponent<PlayerMovement>().alive = true;
 }
Example #6
0
        private static string DeathDescription(DeathReason reason)
        {
            switch (reason)
            {
            case DeathReason.MafiaAttack:
                return("You got attacked by the Mafia.");

            case DeathReason.VotedOut:
                return("You got voted out by the town.");

            case DeathReason.HunterAttacked:
                return("You got stalked and hunted by the Hunter.");
            }
            return("You somehow died.");
        }
Example #7
0
        void OnPlayerDeath(int player, DeathReason reason, int sourceID)
        {
            //Respawn the player and send a death message to all players
            Respawn(player);

            string deathMessage = "";
            //Different death message depending on reason for death
            switch (reason)
            {
                case DeathReason.FallDamage:
                    deathMessage = string.Format("{0} &7was doomed to fall.", ColoredPlayername(player));
                    break;
                case DeathReason.BlockDamage:
                    if (sourceID == m.GetBlockId("Lava"))
                    {
                        deathMessage = string.Format("{0} &7thought they could swim in Lava.", ColoredPlayername(player));
                    }
                    else if (sourceID == m.GetBlockId("Fire"))
                    {
                        deathMessage = string.Format("{0} &7was burned alive.", ColoredPlayername(player));
                    }
                    else
                    {
                        deathMessage = string.Format("{0} &7was killed by {1}.", ColoredPlayername(player), m.GetBlockName(sourceID));
                    }
                    break;
                case DeathReason.Drowning:
                    deathMessage = string.Format("{0} &7tried to breathe under water.", ColoredPlayername(player));
                    break;
                case DeathReason.Explosion:
                    deathMessage = string.Format("{0} &7was blown into pieces by {1}.", ColoredPlayername(player), ColoredPlayername(sourceID));
                    break;
                default:
                    deathMessage = string.Format("{0} &7died.", ColoredPlayername(player));
                    break;
            }
            m.SendMessageToAll(deathMessage);
        }
Example #8
0
 private void OnPlayerDeath(PlayerBase player, DeathReason type)
 {
     player.GetComponent<PlayerMovement>().alive = false;
     StartCoroutine(SpawnPlayer(player, SpawnTimeInSeconds, type));
 }
Example #9
0
 public void RpcDie(DeathReason reason)
 {
     Die(reason);
 }
Example #10
0
 public void RpcDelayedDie(int seconds, DeathReason reason)
 {
     StartCoroutine(DelayedDie(seconds, reason));
 }
Example #11
0
        private void Die(DeathReason reason)
        {
            if (reason == DeathReason.Net && Team != Team.Rescuers)
                TeamManager.instance.CmdAddScoreForRescuers(1);
            else if (Team != Team.Rescuers)
                TeamManager.instance.CmdAddScoreForSuicidas(1);

            if (reason == DeathReason.TrapSpike)
            {
                GetComponent<ParticleEffects>().PlayBlood();
            }
            if (reason == DeathReason.Net)
            {
                GetComponent<AnimationController>().PlayDieAnimation(AnimationDeathType.DieNet);
            }

            Debug.Log(string.Format("RpcDie: PlayerId: {0}, Reason: {1}, Team: {2}", netId, reason, Team));
            AudioManager.instance.PlayAudio(AudioType.PlayerDie);
            if (OnDeath != null)
            {
                OnDeath(this, reason);
            }
        }
Example #12
0
 private IEnumerator DelayedDie(int seconds, DeathReason reason)
 {
     yield return new WaitForSeconds(seconds);
     Die(reason);
 }
Example #13
0
 private void PlayerOnOnDeath(PlayerBase player, DeathReason type)
 {
     switch (type)
     {
         case DeathReason.TrapSpike:
             PlayDieAnimation(AnimationDeathType.DieSpike);
             break;
         case DeathReason.Net:
             break;
         default:
             throw new ArgumentOutOfRangeException("type");
     }
 }
Example #14
0
 void OnPlayerDeath(int player, DeathReason reason, int sourceID)
 {
     string deathMessage = "";
     switch (reason)
     {
         case DeathReason.FallDamage:
             Die(player);
             deathMessage = string.Format("{0}{1} &7was doomed to fall.", GetTeamColorString(players[player].team), m.GetPlayerName(player));
             break;
         case DeathReason.BlockDamage:
             if (sourceID == m.GetBlockId("Lava"))
             {
                 Die(player);
                 deathMessage = string.Format("{0}{1} &7thought they could swim in Lava.", GetTeamColorString(players[player].team), m.GetPlayerName(player));
             }
             else if (sourceID == m.GetBlockId("Fire"))
             {
                 Die(player);
                 deathMessage = string.Format("{0}{1} &7was burned alive.", GetTeamColorString(players[player].team), m.GetPlayerName(player));
             }
             else
             {
                 Die(player);
                 deathMessage = string.Format("{0}{1} &7was killed by {2}.", GetTeamColorString(players[player].team), m.GetPlayerName(player), m.GetBlockName(sourceID));
             }
             break;
         case DeathReason.Drowning:
             Die(player);
             deathMessage = string.Format("{0}{1} &7tried to breathe under water.", GetTeamColorString(players[player].team), m.GetPlayerName(player));
             break;
         case DeathReason.Explosion:
             if (!EnableTeamkill)
             {
                 if (players[sourceID].team == players[player].team)
                 {
                     break;
                 }
             }
             //Check if one of the players is spectator
             if (players[sourceID].team == Team.Spectator || players[player].team == Team.Spectator)
             {
                 //Just here for safety. Spectators shouldn't have weapons...
                 break;
             }
             //Check if one of the players is dead
             if (players[player].isdead || players[sourceID].isdead)
             {
                 break;
             }
             Die(player);
             if (sourceID == player)
             {
                 deathMessage = string.Format("{0}{1} &7blew himself up.", GetTeamColorString(players[player].team), m.GetPlayerName(player));
                 break;
             }
             if (players[sourceID].team != players[player].team)
             {
                 players[sourceID].kills = players[sourceID].kills + 1;
             }
             else
             {
                 players[sourceID].kills = players[sourceID].kills - 2;
             }
             if (players[sourceID].team == players[player].team)
             {
                 deathMessage = string.Format("{0}{1} &7was blown into pieces by {2}{3}. - {4}TEAMKILL", GetTeamColorString(players[player].team), m.GetPlayerName(player), GetTeamColorString(players[sourceID].team), m.GetPlayerName(sourceID), m.colorError());
             }
             else
             {
                 deathMessage = string.Format("{0}{1} &7was blown into pieces by {2}{3}&7.", GetTeamColorString(players[player].team), m.GetPlayerName(player), GetTeamColorString(players[sourceID].team), m.GetPlayerName(sourceID));
             }
             break;
         default:
             Die(player);
             deathMessage = string.Format("{0}{1} &7died.", GetTeamColorString(players[player].team), m.GetPlayerName(player));
             break;
     }
     if (!string.IsNullOrEmpty(deathMessage))
     {
         m.SendMessageToAll(deathMessage);
     }
 }
Example #15
0
 public void Die(DeathReason reason)
 {
     Console.WriteLine("Sorry, animal is dead ({0})\n", reason.GetDescription());
     Console.WriteLine("Animal's life time: {0} sec.\n----------------------------\n",
         InternalState.FullLifeTime.TotalSeconds);
 }
Example #16
0
 private void Die(DeathReason reason)
 {
     PlayerInfo.IsDead          = true;
     PlayerInfo.LastDeathReason = reason;
 }