Exemplo n.º 1
0
 //EVENT CARD - Random2
 public static void eventCard39()
 {
     GameController.instance.updateGameConsoleText("39 - The wizard and the archer each immediately get 3 willpower points.");
     if (instance.hasWizard)
     {
         int willpower = wizard.getHero().getWillpower();
         wizard.getHero().setWillpower(willpower + 3);
     }
     if (instance.hasArcher)
     {
         //int willpower = archer.getHero().getWillpower();
         archer.getHero().increaseWillpower(3);
     }
 }
Exemplo n.º 2
0
    public void execute(GameState gs)
    {
        String msg = "";

        Andor.Player playerFrom = gs.getPlayer(players[0]);
        Andor.Player playerTo   = gs.getPlayer(players[1]);
        if (accept)
        {
            if (tradeType[0].Equals("Gold"))
            {
                playerFrom.getHero().decreaseGold(1);
                playerTo.getHero().increaseGold(1);
                msg = playerTo.getHeroType() + " has accepted your gold.";
            }
            else if (tradeType[0].Equals("Gemstones"))
            {
                //gemstones
            }
            else
            {
                Debug.Log("responde trade TRADE");
                if (GameController.instance.checkFalconUse())
                {
                    //mark falcon as used
                    useFalcon(gs);
                }
                //trade
                Article playerTosArticle = playerTo.getHero().removeArticle(tradeType[2]);
                playerFrom.getHero().addArticle(playerTosArticle);
                Article playerFromsArticle = playerFrom.getHero().removeArticle(tradeType[1]);
                playerTo.getHero().addArticle(playerFromsArticle);
                msg = playerTo.getHeroType() + " has accepted your trade request!";
            }
        }
        else
        {
            msg = playerTo.getHeroType() + " has declined your request.";
        }
        Debug.Log(playerTo.getHeroType() + " " + playerTo.getHero().allArticlesAsString());
        Debug.Log(playerFrom.getHeroType() + "playerFrom " + playerFrom.getHero().allArticlesAsString());
        //GameController.instance.sendNotif(msg, 20.0f, players[0]);
        string[] playersToNotify = new string[1];
        playersToNotify[0] = players[0];
        GameController.instance.updateGameConsoleText(msg, playersToNotify);
        GameController.instance.clearTrade();
    }
Exemplo n.º 3
0
    public void updateDropdowns()
    {
        myArticles = Game.myPlayer.getHero().allArticlesAsStringList();
        Andor.Player selectedPlayer = Game.gameState.getPlayer(selectedHero);
        heroArticles = selectedPlayer.getHero().allArticlesAsStringList();


        GameObject parentObj = GameObject.Find("SelectHero");

        Transform[] trs = parentObj.GetComponentsInChildren <Transform>(true);
        foreach (Transform t in trs)
        {
            if (t.name == "myArticles")
            {
                Dropdown myArticlesMenu = t.gameObject.GetComponent <Dropdown>();
                myArticlesMenu.ClearOptions();
                myArticlesMenu.AddOptions(myArticles);
                //myArticlesMenu.GetComponent<Dropdown>().captionText.text = myArticles[0];
                Debug.Log("added it to dropdowns!");
            }
            if (t.name == "heroArticles")
            {
                t.gameObject.SetActive(true);
                Dropdown heroArticlesMenu = t.gameObject.GetComponent <Dropdown>();
                heroArticlesMenu.ClearOptions();
                heroArticlesMenu.AddOptions(heroArticles);
            }
            if (t.name == "HeroArText")
            {
                t.gameObject.SetActive(true);
                Text heroArText = t.gameObject.GetComponent <Text>();
                heroArText.text = selectedPlayer.getHeroType() + " articles";
            }
            //if(t.name == "SendRequest")
            //{
            //    Button sendRequestButton = t.gameObject.GetComponent<Button>();
            //    sendRequestButton.interactable = true;
            //}
        }
    }
Exemplo n.º 4
0
    //     //EVENT CARD - 3
    public static void eventCard3()
    {
        List <Andor.Player> p = new List <Andor.Player>();

        Andor.Player playerOnTree = new Andor.Player();
        int          rank         = -1000000;
        int          i            = 0;

        GameController.instance.updateGameConsoleText("3 - A hero who enters the Tree of Songs space or is already standing there gets 1 strength point");
        foreach (Andor.Player player in Game.gameState.getPlayers())
        {
            i++;
            Dictionary <string, int> players = new Dictionary <string, int>();
            players = Game.gameState.getPlayerLocations();
            int location = players[player.getNetworkID()];
            if (location == 57)
            {
                p.Add(player);
            }
        }

        //if someone is already on the spot
        if (p.Count >= 1)
        {
            foreach (Andor.Player play in p)
            {
                if (play.getHero().getHeroRank() > rank)
                {
                    rank         = play.getHeroRank();
                    playerOnTree = play;
                }
            }
            playerOnTree.getHero().increaseStrength(1);
        }

        //else
        //Game.gameState.eventcard3 = true;
    }
Exemplo n.º 5
0
    public void displayPlayerInfo(Andor.Player player, int i)
    {
        GameObject selectHero = GameObject.Find("SelectHero");
        GameObject herogameobj;

        Transform[] trs = selectHero.GetComponentsInChildren <Transform>(true);
        //Transform[] heroattr = new Transform[3];
        foreach (Transform t in trs)
        {
            if (t.name == ("Hero" + i))
            {
                herogameobj = t.gameObject;
                t.gameObject.SetActive(true);
                Transform[] heroattr = herogameobj.GetComponentsInChildren <Transform>(true);
                foreach (Transform attr in heroattr)
                {
                    attr.gameObject.SetActive(true);
                    if (attr.name == "Name")
                    {
                        Text heroname = attr.GetComponent <Text>();
                        heroname.text = player.getHeroType();
                    }
                    if (attr.name == "Image")
                    {
                        Debug.Log("Image");
                        Sprite herosprite = Resources.Load <Sprite>("PlayerSprites/" + player.getHeroType());
                        attr.GetComponent <Image>().sprite        = herosprite;
                        attr.GetComponent <Image>().useSpriteMesh = true;
                    }
                    if (attr.name == "HeroItems")
                    {
                        Debug.Log("Hero items");
                        Text heroitems = attr.GetComponent <Text>();
                        if (tradeTypeIndex == 0)
                        {
                            heroitems.text += "Articles: ";
                            heroitems.text += player.getHero().allArticlesAsString();
                        }
                        else if (tradeTypeIndex == 1)
                        {
                            heroitems.text = "Gold: " + player.getHero().getGold();
                        }
                        else
                        {
                            heroitems.text += "\nGemstones: " + player.getHero().getGemstone() + "\n";
                        }

                        //for(int j=0; j< heroAr.Count; j++)
                        //{
                        //    heroitems.text += heroAr[j];
                        //    if(j < heroAr.Count - 1)
                        //    {
                        //        heroitems.text += ", ";
                        //    }

                        //}
                    }
                }
            }
        }
    }