Exemple #1
0
        public override void Die(int killerIndex, Arrow arrow, Explosion explosion, ShockCircle circle)
        {
            base.Die(killerIndex, arrow, explosion, circle);
            ((MyPlayerCorpse)(this.corpse)).hasGhost = false;

            List <Entity> players = Level.Session.CurrentLevel[GameTags.Player];

            for (int i = 0; i < players.Count; i++)
            {
                MyPlayer player = (MyPlayer)players[i];
                if (player.PlayerIndex == this.PlayerIndex)
                {
                    i = players.Count;
                }
            }

            var mobLogic = this.Level.Session.RoundLogic as MobRoundLogic;

            if (mobLogic != null)
            {
                // Ghosts treated as players in crawl mode
                mobLogic.OnPlayerDeath(
                    null, this.corpse, this.PlayerIndex, DeathCause.Arrow, // FIXME
                    this.Position, killerIndex
                    );
            }
            if (((MyMatchVariants)base.Level.Session.MatchSettings.Variants).GottaBustGhosts)
            {
                ((MySession)base.Level.Session).OnPlayerGhostDeath(this, this.corpse);
            }
        }
Exemple #2
0
        public override void Die(int killerIndex, Arrow arrow, Explosion explosion, ShockCircle circle)
        {
            base.Die(killerIndex, arrow, explosion, circle);
            var mobLogic = this.Level.Session.RoundLogic as MobRoundLogic;

            if (mobLogic != null)
            {
                mobLogic.OnPlayerDeath(
                    null, this.corpse, this.PlayerIndex, DeathCause.Arrow,                     // FIXME
                    this.Position, killerIndex
                    );
            }
        }
Exemple #3
0
        public override void Hurt(Vector2 force, int damage, int killerIndex, Arrow arrow = null, Explosion explosion = null, ShockCircle shock = null)
        {
            if (shock && killerIndex == this.PlayerIndex)
            {
                // ShockCircle shouldn't kill friendly ghosts
                return;
            }

            if (this.HasShield)
            {
                this.HasShield = false;
                if (explosion && explosion.PlayerIndex != -1)
                {
                    base.Level.Session.MatchStats[explosion.PlayerIndex].ShieldsBroken += 1u;
                }
            }
            else
            {
                if (this.Alive && this.CanHurt)
                {
                    this.Health -= damage;
                    if (this.Health <= 0)
                    {
                        this.Die(killerIndex, arrow, explosion, shock);
                    }
                }
            }
            this.Speed = force;
        }
Exemple #4
0
 public override void Die(int killerIndex, Arrow arrow = null, Explosion explosion = null, ShockCircle shock = null)
 {
     if (this.PlayerIndex != -1 &&
         base.Level.Session.MatchSettings.Variants.ReturnAsGhosts[this.PlayerIndex] &&
         ((MyMatchVariants)this.Level.Session.MatchSettings.Variants).GhostsRespawn &&
         ownerCorpse != null)
     {
         ownerCorpse.RespawnGhost();
     }
     DropArrow();
     base.Die(killerIndex, arrow, explosion, shock);
 }
Exemple #5
0
        public Player FinishReviving()
        {
            Vector2 zero = Vector2.Zero;
            Player  result;

            if (this.Corpse.Squished == Vector2.Zero && this.CanReviveAtThisPosition(ref zero))
            {
                PlayerInventory inventory = new PlayerInventory(false, false, false, false, new ArrowList(this.Corpse.Arrows));
                // this.Corpse.Arrows.Clear (); // I don't know what this line does, but it was causing an accessibility exception
                if (this.Corpse.ArrowCushion.Count > 0)
                {
                    Arrow arrow = this.Corpse.ArrowCushion.ArrowDatas [0].Arrow;
                    if (inventory.Arrows.CanAddArrow(arrow.ArrowType) && arrow.Scene != null && !arrow.MarkedForRemoval)
                    {
                        base.Level.Remove <Arrow> (arrow);
                        inventory.Arrows.AddArrows(new ArrowTypes[] {
                            arrow.ArrowType
                        });
                    }
                    this.Corpse.ArrowCushion.ReleaseArrows(Vector2.UnitY * -1f);
                }
                if (this.Mode == TeamReviver.Modes.Quest && inventory.Arrows.Count == 0)
                {
                    ArrowList    arg_153_0 = inventory.Arrows;
                    ArrowTypes[] arrows    = new ArrowTypes[1];
                    arg_153_0.AddArrows(arrows);
                }
                Vector2 position = zero;
                Player  player   = new Player(this.Corpse.PlayerIndex, position, this.Corpse.Allegiance, this.Corpse.TeamColor, inventory, Player.HatStates.NoHat, true, false, false);
                if (this.Mode == TeamReviver.Modes.TeamDeathmatch)
                {
                    player.Flash(45, null);
                }
                else
                {
                    player.Flash(135, null);
                }
                base.Level.Add <Player> (player);
                //if (((MyMatchVariants)base.Level.Session.MatchSettings.Variants).GottaBustGhosts) {
                //   ((MySession)base.Level.Session).OnTeamRevive(player);
                //}
                int playerIndex = this.reviver;
                if (playerIndex == -1)
                {
                    playerIndex = player.PlayerIndex;
                }
                if (this.Mode == TeamReviver.Modes.DarkWorld)
                {
                    Player player2 = base.Level.GetPlayer(this.reviver);
                    if (player2 != null)
                    {
                        player2.Flash(60, null);
                    }
                }
                ShockCircle shockCircle = Cache.Create <ShockCircle> ();
                shockCircle.Init(position, playerIndex, player, ShockCircle.ShockTypes.TeamRevive);
                base.Level.Add <ShockCircle> (shockCircle);
                int num = Calc.Random.Next(360);
                for (int i = num; i < num + 360; i += 30)
                {
                    base.Level.Add <BombParticle> (new BombParticle(position, (float)i, BombParticle.Type.TeamRevive));
                }
                TFGame.PlayerInputs [this.Corpse.PlayerIndex].Rumble(1f, 30);
                if (this.reviver != -1)
                {
                    TFGame.PlayerInputs [this.reviver].Rumble(0.5f, 30);
                }
                if (this.reviver != -1)
                {
                    MatchStats[] expr_2FA_cp_0 = base.Level.Session.MatchStats;
                    int          expr_2FA_cp_1 = this.reviver;
                    expr_2FA_cp_0 [expr_2FA_cp_1].Revives = expr_2FA_cp_0 [expr_2FA_cp_1].Revives + 1u;
                    if (base.Level.Session.DarkWorldState != null)
                    {
                        base.Level.Session.DarkWorldState.Revives [this.reviver]++;
                    }
                }
                this.reviveCounter = 0f;
                if (this.Corpse.TeamColor == Allegiance.Red)
                {
                    Sounds.sfx_reviveRedteamFinish.Play(210f, 1f);
                }
                else
                {
                    Sounds.sfx_reviveBlueteamFinish.Play(210f, 1f);
                }
                result = player;
            }
            else
            {
                result = null;
            }

            // If ghost revives is on, then a revive can cancel a level ending

            if (this.ghostRevives && base.Level.Session.MatchSettings.Mode == Modes.TeamDeathmatch)
            {
                Allegiance allegiance;
                if (!base.Level.Session.RoundLogic.TeamCheckForRoundOver(out allegiance))
                {
                    base.Level.Session.CurrentLevel.Ending = false;
                }
            }

            return(result);
        }
Exemple #6
0
 public override void Die(int killerIndex, Arrow arrow, Explosion explosion, ShockCircle circle)
 {
     base.Die(killerIndex, arrow, explosion, circle);
     var mobLogic = this.Level.Session.RoundLogic as MobRoundLogic;
     if (mobLogic != null) {
         mobLogic.OnPlayerDeath(
             null, this.corpse, this.PlayerIndex, DeathCause.Arrow, // FIXME
             this.Position, killerIndex
         );
     }
 }