Пример #1
0
    public void StartMatch(VisualPlayer v_player = null, VisualMinion v_minion = null, int visualBoardHeight = 0, MatchUI matchUI = null)
    {
        V_Player          = v_player;
        V_Minion          = v_minion;
        VisualBoardHeight = visualBoardHeight;

        if (Visual)
        {
            // UI
            MatchUI       = matchUI;
            MatchUI.Match = this;
            MatchUI.UpdatePlayerBar();
            MatchUI.UpdateTurnText();
            if (MatchType == MatchType.AI_vs_AI)
            {
                MatchUI.UpdatePlayerGenomes();
            }

            // Summon Players
            Player1.Visual = GameObject.Instantiate(V_Player, new Vector3(0, 0, -(VisualBoardHeight / 2)), Quaternion.identity);
            Player2.Visual = GameObject.Instantiate(V_Player, new Vector3(0, 0, VisualBoardHeight / 2), Quaternion.identity);
            Player1.Color  = PlayerColor;
            Player2.Color  = PlayerColor;
            VisualActions.Add(new VA_SummonPlayer(Player1.Visual, PlayerColor));
            VisualActions.Add(new VA_SummonPlayer(Player2.Visual, PlayerColor));
        }

        // Let's go
        Phase = MatchPhase.GameReady;
    }
Пример #2
0
    public Create1v1(Vector3 _offset, VisualPlayer _player1, VisualPlayer _player2)
    {
        board = new DrawBoardGame();
        board.Initialize(8, 10);
        board.DrawBoard(_offset);

        board_offset = _offset;

        p1        = _player1;
        p1_offset = new Vector3(-1, -2, 0) + board_offset;
        p1.slist  = board.DrawStash(p1_offset);

        p2        = _player2;
        p2_offset = new Vector3(-1, 9, 0) + board_offset;
        p2.slist  = board.DrawStash(p2_offset);

        p1.AddPieceStash(new Mage());
        p1.AddPieceStash(new BoardPiece());
        p1.AddPieceStash(new BoardPiece());
        p1.AddPieceStash(new BoardPiece());
        p1.AddPieceStash(new BoardPiece());

        p2.AddPieceStash(new BoardPiece());
        p2.AddPieceStash(new BoardPiece());
        p2.AddPieceStash(new BoardPiece());
        p2.AddPieceStash(new BoardPiece());
        p2.AddPieceStash(new BoardPiece());
        p2.AddPieceStash(new Dummy());

        turn = p1;
    }
Пример #3
0
 public override void NearbyEffects(int i, int j, bool closer)
 {
     if (Main.tile[i, j].frameY >= 56)
     {
         VisualPlayer modPlayer = Main.LocalPlayer.GetModPlayer <VisualPlayer>();
         modPlayer.FountainNeon = true;
     }
 }
Пример #4
0
 //TODO: Can cause concurrency problems if 2 players remove at same time
 public void GivePieceToPlayer(VisualPlayer _player)
 {
     if (shop_pieces.Count > 0)
     {
         int id = Random.Range(0, shop_pieces.Count);
         _player.AddPieceStash(shop_pieces[id]);
         shop_pieces.RemoveAt(id);
     }
 }
Пример #5
0
        public override void PostDraw(int i, int j, SpriteBatch spriteBatch)
        {
            Tile    tile = Main.tile[i, j];
            Vector2 zero = new Vector2(Main.offScreenRange, Main.offScreenRange);

            VisualPlayer modPlayer = Main.LocalPlayer.GetModPlayer <VisualPlayer>();

            if (modPlayer.ShowBlocks)
            {
                Texture2D texture2 = mod.GetTexture("Tiles/BarrierOverlay"); //Overlay

                Main.spriteBatch.Draw(texture2, new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero, new Rectangle(0, 0, texture2.Width, texture2.Height), Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
            }
        }
Пример #6
0
        public override bool UseItem(Player player)
        {
            VisualPlayer modPlayer = Main.LocalPlayer.GetModPlayer <VisualPlayer>();

            if (Main.netMode == 1 || Main.netMode == 0)
            {
                if (!modPlayer.useInvert)
                {
                    player.GetModPlayer <VisualPlayer>().useInvert = true;
                    Main.NewText("Invert effect enabled");
                }
                else
                {
                    player.GetModPlayer <VisualPlayer>().useInvert = false;
                    Main.NewText("Invert effect disabled");
                }
            }
            return(true);
        }
Пример #7
0
        public override bool UseItem(Player player)
        {
            VisualPlayer modPlayer = Main.LocalPlayer.GetModPlayer <VisualPlayer>();

            if (Main.netMode == 1 || Main.netMode == 0)
            {
                if (modPlayer.ViewerRange == 0)
                {
                    if (player.altFunctionUse == 2)
                    {
                        player.GetModPlayer <VisualPlayer>().ViewerRange = 7;
                        Main.NewText("View Range: 64x");
                    }
                    else
                    {
                        player.GetModPlayer <VisualPlayer>().ViewerRange = 1;
                        Main.NewText("View Range: 1x");
                    }
                }
                else if (modPlayer.ViewerRange == 1)
                {
                    if (player.altFunctionUse == 2)
                    {
                        player.GetModPlayer <VisualPlayer>().ViewerRange = 0;
                        Main.NewText("View Range: 0x");
                    }
                    else
                    {
                        player.GetModPlayer <VisualPlayer>().ViewerRange = 2;
                        Main.NewText("View Range: 2x");
                    }
                }
                else if (modPlayer.ViewerRange == 2)
                {
                    if (player.altFunctionUse == 2)
                    {
                        player.GetModPlayer <VisualPlayer>().ViewerRange = 1;
                        Main.NewText("View Range: 1x");
                    }
                    else
                    {
                        player.GetModPlayer <VisualPlayer>().ViewerRange = 3;
                        Main.NewText("View Range: 4x");
                    }
                }
                else if (modPlayer.ViewerRange == 3)
                {
                    if (player.altFunctionUse == 2)
                    {
                        player.GetModPlayer <VisualPlayer>().ViewerRange = 2;
                        Main.NewText("View Range: 2x");
                    }
                    else
                    {
                        player.GetModPlayer <VisualPlayer>().ViewerRange = 4;
                        Main.NewText("View Range: 8x");
                    }
                }
                else if (modPlayer.ViewerRange == 4)
                {
                    if (player.altFunctionUse == 2)
                    {
                        player.GetModPlayer <VisualPlayer>().ViewerRange = 3;
                        Main.NewText("View Range: 4x");
                    }
                    else
                    {
                        player.GetModPlayer <VisualPlayer>().ViewerRange = 5;
                        Main.NewText("View Range: 16x");
                    }
                }
                else if (modPlayer.ViewerRange == 5)
                {
                    if (player.altFunctionUse == 2)
                    {
                        player.GetModPlayer <VisualPlayer>().ViewerRange = 4;
                        Main.NewText("View Range: 8x");
                    }
                    else
                    {
                        player.GetModPlayer <VisualPlayer>().ViewerRange = 6;
                        Main.NewText("View Range: 32x");
                    }
                }
                else if (modPlayer.ViewerRange == 6)
                {
                    if (player.altFunctionUse == 2)
                    {
                        player.GetModPlayer <VisualPlayer>().ViewerRange = 5;
                        Main.NewText("View Range: 16x");
                    }
                    else
                    {
                        player.GetModPlayer <VisualPlayer>().ViewerRange = 7;
                        Main.NewText("View Range: 64x");
                    }
                }
                else if (modPlayer.ViewerRange == 7)
                {
                    if (player.altFunctionUse == 2)
                    {
                        player.GetModPlayer <VisualPlayer>().ViewerRange = 6;
                        Main.NewText("View Range: 32x");
                    }
                    else
                    {
                        player.GetModPlayer <VisualPlayer>().ViewerRange = 0;
                        Main.NewText("View Range: 0x");
                    }
                }
            }
            return(true);
        }
Пример #8
0
        public override bool UseItem(Player player)        //one of the messages shows for everyone in multiplayer
        {
            VisualPlayer modPlayer = Main.LocalPlayer.GetModPlayer <VisualPlayer>();

            if (Main.netMode == 1 || Main.netMode == 0)
            {
                if (Main.myPlayer == player.whoAmI)
                {
                    if (!modPlayer.ShowBlocks)
                    {
                        player.GetModPlayer <VisualPlayer>().ShowBlocks = true;
                        Main.NewText("Invisible blocks shown");
                        if (!Filters.Scene["WaterFilter"].IsActive())
                        {
                            //Texture2D texture2 = mod.GetTexture("Tiles/testDraw2"); //Overlay
                            //Filters.Scene.Activate("AuraFilter", player.Center).GetShader().UseImage(texture2).UseTargetPosition(player.Center).UseIntensity(8f); //For UseProgress (Opacity) lower is stronger, For UseIntensity higher is stronger
                            //Filters.Scene.Activate("ZoomFilter", player.Center).GetShader().UseDirection(new Vector2(8f, 2f)).UseImageOffset(new Vector2(0.4375f, 0.25f));

                            Texture2D texture3 = mod.GetTexture("Effects/Glass4");  //Overlay
                            Texture2D texture4 = mod.GetTexture("Effects/Glass4O"); //Overlay
                            // color1: max for distortion. color2: amount of distortion. color3: minimum for shine. SecondaryColors: shine color. UseImageOffset: zoom out mult. UseIntensity: height scale. UseProgress: shine strength. UseDirection: speed for both layers.

                            Filters.Scene.Activate("RefractionFilter", player.Center).GetShader()
                            .UseImage(texture3, 0)
                            .UseImage(texture4, 1)
                            .UseIntensity(0.05f);                                                                 //y stretch for both layers, lower is more


                            /*Filters.Scene.Activate("WaterFilter", player.Center).GetShader()
                             *  .UseImage(texture3)                     //texture
                             *  .UseColor(0.25f, 0.3f, 1.5f)            //maximim for distortion, amount of distort,
                             *  .UseSecondaryColor(0.7f, 0.95f, 1f)     //shine color and distort color (if used)
                             *  .UseImageOffset(new Vector2(5f, 6f))    //zoom out mult for layer 1 and 2
                             *  .UseIntensity(0.8f)                     //y stretch for both layers, lower is more
                             *  .UseDirection(new Vector2(0.50f, 0.44f)) //
                             *  .UseProgress(8f)                        //mult for shine 2 (change to color blue value later)
                             *  .Shader.Parameters["uSpeed"].SetValue(new Vector4(6.33f, 4.7f, 3.2f, 7f));//speed for both layers, (x, y), (x2, y2) lower is faster
                             */

                            /*Filters.Scene["WaterFilter"].GetShader().UseTargetPosition(player.Center);
                             * Filters.Scene["WaterFilter"].GetShader().UseImage(texture3);
                             * Filters.Scene["WaterFilter"].GetShader().UseColor(0.25f, 0.3f, 1.5f);
                             * Filters.Scene["WaterFilter"].GetShader().UseSecondaryColor(0.7f, 0.95f, 1f);
                             * Filters.Scene["WaterFilter"].GetShader().UseImageOffset(new Vector2(5f, 6f));
                             * Filters.Scene["WaterFilter"].GetShader().UseIntensity(0.8f);
                             * Filters.Scene["WaterFilter"].GetShader().UseDirection(new Vector2(0.50f, 0.44f));
                             * Filters.Scene["WaterFilter"].GetShader().UseProgress(8f);
                             * Filters.Scene["WaterFilter"].GetShader().Shader.Parameters["uSpeed"].SetValue(new Vector4(6.33f, 4.7f, 3.2f, 7f));
                             * Filters.Scene["WaterFilter"].GetShader().Apply();*/



                            //Filters.Scene.Activate("AuraFilter", player.Center).GetShader().UseProgress(1.5f).UseImageOffset(new Vector2(2, 1.15f)).UseIntensity(-0.02f).UseTargetPosition(player.Center).UseOpacity(1.0f).UseColor(new Vector3(0.4f, 0.4f, 0.4f));
                            //UseProgress = size. UseImageOffset = X/Y scale correction. UseIntensity = distortion scale. UseTargetPosition = Position in world for aura. UseOpacity = Desaturation. UseColor = Brightness.
                        }
                    }
                    else
                    {
                        if (Filters.Scene["RefractionFilter"].IsActive())
                        {
                            //Filters.Scene["BlurFilter"].GetShader().UseOpacity(a).UseIntensity(b); //to update the shader
                            Filters.Scene.Deactivate("RefractionFilter");
                        }
                        player.GetModPlayer <VisualPlayer>().ShowBlocks = false;
                        Main.NewText("Invisible blocks hidden");
                    }
                }
            }
            return(true);
        }