void HealSelf()
    {
        manaCost = 2;

        if (manaCost <= source.Mana)
        {
            played = true;
            //print(manaCost);
            //print(source.Mana);
            health.CmdTakeDamage(-10);
            source.Mana -= manaCost;
        }
        else
        {
            played = false;
        }
    }
    // Update is called once per frame
    void FixedUpdate()
    {
        //print(Time.timeSinceLevelLoad.ToString() + " - " + playerState);

        //if (!matchStarted)
        //{
        //    transform.position = new Vector3(0, 0, transform.position.z);

        //    if (Input.GetKeyDown(KeyCode.Space))
        //    {
        //        readied = !readied;
        //    }

        //    if (readied)
        //    {
        //        endGameText.GetComponent<Text>().text = "Ready\nPress spacebar to not be ready";
        //        if (opponent && opponent.GetComponent<NetworkFighterScript>().Ready && isServer)
        //        {
        //            networkManager.GetComponent<NetworkSpawnHandler>().CmdStartMatch();
        //        }
        //    }
        //    else
        //    {
        //        endGameText.GetComponent<Text>().text = "Not Ready\nPress spacebar to be ready";
        //    }
        //    return;
        //}

        //run all usual code if the player hasn't won or lost yet
        if (playerState == 0)
        {
            endGameText.GetComponent <Text>().text = "";
            gameObject.SetActive(true);

            if (!isLocalPlayer)
            {
                return;
            }

            networkManager.GetComponent <CardEffects>().SetSources(gameObject);

            //SetCamera();

            DisplayHealth();

            if (opponent == null)
            {
                GameObject[] players = GameObject.FindGameObjectsWithTag("Player");
                foreach (GameObject player in players)
                {
                    if (player != this.gameObject)
                    {
                        opponent = player;
                    }
                }
            }

            //takes in "Horizontal" input for movement on the X-Axis (Refer to the Project-> Project Settings -> Input)
            float inputX = Input.GetAxis("Horizontal");

            //Flips the direction the character is facing
            Flip(inputX);
            CmdFlip(inputX);
            CorrectFlip();

            anim.SetFloat("Speed", Mathf.Abs(rigid.velocity.x));

            //Moves the character each frame
            if (inputX != 0)
            {
                Move(inputX);
            }

            //Checks if the character is within the boundaries of the stage
            CheckBoundaries();

            //Checks for jump
            CheckJump();

            //Checks player state
            CheckPlayerState();

            CheckInput();

            ManaSystem();

            if (!gameStarted && Opponent && lives == 4 && endGameText.GetComponent <Text>().text == "")
            {
                gameStarted = true;
            }

            if (Opponent)
            {
                #region EnemyTelegraphSetup
                o_NetFighterScript = opponent.GetComponent <NetworkFighterScript>();

                float opponentTimer = o_NetFighterScript.TimeStopTimer;

                if (opponentTimeStopTimer <= 0 && opponentTimer > opponentTimeStopTimer)
                {
                    opponentTimeStopTimer = opponentTimer;
                }
                if (opponentTimeStopTimer > 0)
                {
                    telegraph2.GetComponent <Image>().sprite = networkManager.GetComponent <CardSelect>().cardArt[o_NetFighterScript.ArtArrayNum];
                    telegraph2.enabled = true;
                }
                else
                {
                    telegraph2.enabled = false;
                }
                #endregion

                if (timeStopTimer <= 0)
                {
                    telegraph1.enabled = false;
                }

                if (telegraph1.enabled || telegraph2.enabled)
                {
                    //Time.timeScale = cardTimeScale;
                    // telegraph time slow code here, Dito
                }
                else
                {
                    //Time.timeScale = defaultTime;
                    // disable telegraph time slow code here, Dito
                }

                float nextTimeStopTimer = timeStopTimer - Time.deltaTime;

                CmdSetStopTimer(nextTimeStopTimer);
                timeStopTimer          = nextTimeStopTimer;
                opponentTimeStopTimer -= Time.deltaTime;

                int dmg = o_NetFighterScript.OpponentDamage - lastDamage;

                if (dmg > 0)
                {
                    localPlayerHealthScript.CmdTakeDamage(dmg);
                    lastDamage += dmg;
                }

                //float myOppGravTimer = Opponent.GetComponent<NetworkFighterScript>().OpponentGravTimer;
                //print("oppgravtime: " + myOppGravTimer);
                //if (myOppGravTimer > totalGravTimer)
                //{
                //    print("triggered grav start");
                //    gravTimer = myOppGravTimer - totalGravTimer;
                //    totalGravTimer = myOppGravTimer;
                //}
                //if (gravTimer > 0)
                //{
                //    print("grav increased");
                //    GetComponent<Rigidbody2D>().gravityScale = gravityScale;
                //    gravTimer -= Time.deltaTime;
                //    if (gravTimer <= 0)
                //    {
                //        GetComponent<Rigidbody2D>().gravityScale = baseGravScale;
                //    }
                //}
            }
        }

        //run this code if the player has won
        if (gameStarted && playerState == 1)
        {
            endGameText.SetActive(true);

            endGameText.GetComponent <Text>().text = "You Win!\nPress Any Button to Exit";

            if (Input.anyKey)
            {
                Debug.Break();
                Application.Quit();
            }
        }

        //run this code if the player has lost
        if (gameStarted && playerState == 2)
        {
            endGameText.SetActive(true);

            endGameText.GetComponent <Text>().text = "You Lose...\nPress Any Button to Exit";

            Reset();

            rigid.bodyType = RigidbodyType2D.Static;

            if (Input.anyKey)
            {
                Debug.Break();
                Application.Quit();
            }
        }
    }