Exemplo n.º 1
0
        public void sendCurrentBoardToClient()
        {
            //bool runEx = true;
            Helpfunctions hpf      = Helpfunctions.Instance;
            player        p        = p2;
            player        opponent = p1;

            if (this.currentplayer)
            {
                p        = p1;
                opponent = p2;
            }

            //DO we need this?
            //hpf.resetBuffer();
            //hpf.writeBufferToActionFile(p.client);
            hpf.resetBuffer();

            string dtimes = DateTime.Now.ToString("HH:mm:ss:ffff");

            /*int ownsecretcount = p.secrets.Count;
             * int enemySecretCount = opponent.secrets.Count;
             *
             * string enemysecretIds = "";
             * enemysecretIds = Probabilitymaker.Instance.getEnemySecretData();
             *
             *
             * hpf.writeToBuffer("#######################################################################");
             * hpf.writeToBuffer("#######################################################################");
             * hpf.writeToBuffer("start calculations, current time: " + dtimes + " V" + "115.55" + " " + p.settings);
             * hpf.writeToBuffer("#######################################################################");
             * hpf.writeToBuffer("mana " + p.curMana + "/" + p.maxMana);
             * hpf.writeToBuffer("emana " + opponent.maxMana);
             * hpf.writeToBuffer("own secretsCount: " + ownsecretcount);
             * hpf.writeToBuffer("enemy secretsCount: " + enemySecretCount + " ;" + enemysecretIds);
             *
             * Hrtprozis.Instance.printHero(runEx);
             * Hrtprozis.Instance.printOwnMinions(runEx);
             * Hrtprozis.Instance.printEnemyMinions(runEx);
             * Handmanager.Instance.printcards(runEx);
             * Probabilitymaker.Instance.printTurnGraveYard(runEx);
             * Probabilitymaker.Instance.printGraveyards(runEx);*/

            hpf.writeToBuffer(this.board.getCompleteBoardForSimulating(p.settings, "116.00", dtimes));
            hpf.writeBufferToFile(p.client);
            hpf.ErrorLog("sended");
        }
Exemplo n.º 2
0
        public void print(bool tobuffer = false)
        {
            Helpfunctions help = Helpfunctions.Instance;

            if (tobuffer)
            {
                if (this.actionType == actionEnum.playcard)
                {
                    string playaction = "play ";

                    playaction += "id " + this.card.entity;
                    if (this.target != null)
                    {
                        playaction += " target " + this.target.entitiyID;
                    }

                    if (this.place >= 0)
                    {
                        playaction += " pos " + this.place;
                    }

                    if (this.druidchoice >= 1)
                    {
                        playaction += " choice " + this.druidchoice;
                    }

                    help.writeToBuffer(playaction);
                }
                if (this.actionType == actionEnum.attackWithMinion)
                {
                    help.writeToBuffer("attack " + this.own.entitiyID + " enemy " + this.target.entitiyID);
                }
                if (this.actionType == actionEnum.attackWithHero)
                {
                    help.writeToBuffer("heroattack " + this.target.entitiyID);
                }
                if (this.actionType == actionEnum.useHeroPower)
                {
                    if (this.target != null)
                    {
                        help.writeToBuffer("useability on target " + this.target.entitiyID);
                    }
                    else
                    {
                        help.writeToBuffer("useability");
                    }
                }
                return;
            }
            if (this.actionType == actionEnum.playcard)
            {
                string playaction = "play ";

                playaction += "id " + this.card.entity;
                if (this.target != null)
                {
                    playaction += " target " + this.target.entitiyID;
                }

                if (this.place >= 0)
                {
                    playaction += " pos " + this.place;
                }

                if (this.druidchoice >= 1)
                {
                    playaction += " choice " + this.druidchoice;
                }

                help.logg(playaction);
            }
            if (this.actionType == actionEnum.attackWithMinion)
            {
                help.logg("attacker: " + this.own.entitiyID + " enemy: " + this.target.entitiyID);
            }
            if (this.actionType == actionEnum.attackWithHero)
            {
                help.logg("attack with hero, enemy: " + this.target.entitiyID);
            }
            if (this.actionType == actionEnum.useHeroPower)
            {
                help.logg("useability ");
                if (this.target != null)
                {
                    help.logg("on enemy: " + this.target.entitiyID);
                }
            }
            help.logg("");
        }
Exemplo n.º 3
0
Arquivo: Hrtprozis.cs Projeto: tnd34/e
        public void printHero(bool writetobuffer = false)
        {
            help.logg("player:");
            help.logg(this.numMinionsPlayedThisTurn + " " + this.cardsPlayedThisTurn + " " + this.ueberladung + " " + this.ownPlayerController);

            help.logg("ownhero:");
            help.logg(this.heroname + " " + this.ownHero.Hp + " " + this.ownHero.maxHp + " " + this.ownHero.armor + " " + this.ownHero.immuneWhileAttacking + " " + this.ownHero.immune + " " + this.ownHero.entitiyID + " " + this.ownHero.Ready + " " + this.ownHero.numAttacksThisTurn + " " + this.ownHero.frozen + " " + this.ownHero.Angr + " " + this.ownHero.tempAttack);
            help.logg("weapon: " + heroWeaponAttack + " " + heroWeaponDurability + " " + ownHeroWeapon);
            help.logg("ability: " + this.ownAbilityisReady + " " + this.heroAbility.cardIDenum);
            string secs = "";
            foreach (CardDB.cardIDEnum sec in this.ownSecretList)
            {
                secs += sec + " ";
            }
            help.logg("osecrets: " + secs);
            help.logg("enemyhero:");
            help.logg(this.enemyHeroname + " " + this.enemyHero.Hp + " " + this.enemyHero.maxHp + " " + this.enemyHero.armor + " " + this.enemyHero.frozen + " " + this.enemyHero.immune + " " + this.enemyHero.entitiyID);
            help.logg("weapon: " + this.enemyWeaponAttack + " " + this.enemyWeaponDurability + " " + this.enemyHeroWeapon);
            help.logg("ability: " + "true" + " " + this.enemyAbility.cardIDenum);
            help.logg("fatigue: " + this.ownDeckSize + " " + this.ownHeroFatigue + " " + this.enemyDeckSize + " " + this.enemyHeroFatigue);

            if (writetobuffer)
            {
                help.writeToBuffer("player:");
                help.writeToBuffer(this.numMinionsPlayedThisTurn + " " + this.cardsPlayedThisTurn + " " + this.ueberladung + " " + this.ownPlayerController);

                help.writeToBuffer("ownhero:");
                help.writeToBuffer(this.heroname + " " + this.ownHero.Hp + " " + this.ownHero.maxHp + " " + this.ownHero.armor + " " + this.ownHero.immuneWhileAttacking + " " + this.ownHero.immune + " " + this.ownHero.entitiyID + " " + this.ownHero.Ready + " " + this.ownHero.numAttacksThisTurn + " " + this.ownHero.frozen + " " + this.ownHero.Angr + " " + this.ownHero.tempAttack);
                help.writeToBuffer("weapon: " + heroWeaponAttack + " " + heroWeaponDurability + " " + ownHeroWeapon);
                help.writeToBuffer("ability: " + this.ownAbilityisReady + " " + this.heroAbility.cardIDenum);
                secs = "";
                foreach (CardDB.cardIDEnum sec in this.ownSecretList)
                {
                    secs += sec + " ";
                }
                help.writeToBuffer("osecrets: " + secs);
                help.writeToBuffer("enemyhero:");
                help.writeToBuffer(this.enemyHeroname + " " + this.enemyHero.Hp + " " + this.enemyHero.maxHp + " " + this.enemyHero.armor + " " + this.enemyHero.frozen + " " + this.enemyHero.immune + " " + this.enemyHero.entitiyID);
                help.writeToBuffer("weapon: " + this.enemyWeaponAttack + " " + this.enemyWeaponDurability + " " + this.enemyHeroWeapon);
                help.writeToBuffer("ability: " + "true" + " " + this.enemyAbility.cardIDenum);
                help.writeToBuffer("fatigue: " + this.ownDeckSize + " " + this.ownHeroFatigue + " " + this.enemyDeckSize + " " + this.enemyHeroFatigue);
            }
        }
Exemplo n.º 4
0
        public void print(bool tobuffer = false)
        {
            Helpfunctions help     = Helpfunctions.Instance;
            string        discover = "";

            if (this.tracking >= 1)
            {
                discover = " discover " + tracking;
            }
            if (tobuffer)
            {
                if (this.actionType == actionEnum.playcard)
                {
                    string playaction = "play ";

                    playaction += "id " + this.card.entity;
                    if (this.target != null)
                    {
                        playaction += " target " + this.target.entityID;
                    }

                    if (this.place >= 0)
                    {
                        playaction += " pos " + this.place;
                    }

                    if (this.druidchoice >= 1)
                    {
                        playaction += " choice " + this.druidchoice;
                    }

                    help.writeToBuffer(playaction + discover);
                }
                if (this.actionType == actionEnum.attackWithMinion && this.target != null)
                {
                    help.writeToBuffer("attack " + this.own.entityID + " enemy " + this.target.entityID + discover);
                }
                if (this.actionType == actionEnum.attackWithHero && this.target != null)
                {
                    help.writeToBuffer("heroattack " + this.target.entityID + discover);
                }
                if (this.actionType == actionEnum.useHeroPower)
                {
                    if (this.target != null)
                    {
                        help.writeToBuffer("useability on target " + this.target.entityID + discover);
                    }
                    else
                    {
                        help.writeToBuffer("useability" + discover);
                    }
                }
                return;
            }

            //todo sepefeets - consider adding names into actions from the start instead of mapping them here
            string    cardname   = "";
            string    targetname = "";
            Playfield tmpPf      = new Playfield();

            if (this.target != null)
            {
                foreach (Minion m in tmpPf.enemyMinions)
                {
                    if (m.entityID == this.target.entityID)
                    {
                        targetname = "" + m.name;
                    }
                }
                if (tmpPf.enemyHero.entityID == this.target.entityID)
                {
                    targetname = "" + tmpPf.enemyHeroName;
                }
            }
            foreach (Minion m in tmpPf.ownMinions)
            {
                if (this.target != null && m.entityID == this.target.entityID)
                {
                    targetname = "" + m.name;
                }
                if (this.card != null && m.entityID == this.card.entity)
                {
                    cardname = "" + m.name;
                }
                if (this.own != null && m.entityID == this.own.entityID)
                {
                    cardname = "" + m.name;
                }
            }
            if (this.target != null && tmpPf.ownHero.entityID == this.target.entityID)
            {
                targetname = "" + tmpPf.ownHeroName;
            }
            foreach (Handmanager.Handcard h in tmpPf.owncards)
            {
                if (this.card != null && h.entity == this.card.entity)
                {
                    cardname = "" + h.card.name;
                }
            }


            if (this.actionType == actionEnum.playcard && this.card != null)
            {
                string playaction = "play ";
                playaction += cardname;
                playaction += " id " + this.card.entity;

                if (this.target != null)
                {
                    playaction += ", target " + targetname + " id " + this.target.entityID;
                }

                if (this.place >= 0)
                {
                    playaction += ", pos " + this.place;
                }

                if (this.druidchoice >= 1)
                {
                    playaction += ", choice " + this.druidchoice;
                }

                help.logg(playaction + discover);
            }
            if (this.actionType == actionEnum.attackWithMinion && this.target != null && this.own != null)
            {
                help.logg("attacker: " + cardname + " id " + this.own.entityID + ", enemy: " + targetname + " id " + this.target.entityID + discover);
            }
            if (this.actionType == actionEnum.attackWithHero && this.target != null)
            {
                help.logg("attack with hero, enemy: " + targetname + " id " + this.target.entityID + discover);
            }
            if (this.actionType == actionEnum.useHeroPower)
            {
                help.logg("useability " + discover);
                if (this.target != null)
                {
                    help.logg("on " + (target.own ? "own " : "enemy ") + targetname + " id " + this.target.entityID + discover);
                }
            }
        }
Exemplo n.º 5
0
        //not updated anymore!
        public void printcards(bool writeTobuffer = false)
        {
            help.logg("Own Handcards: ");
            foreach (Handmanager.Handcard c in this.handCards)
            {
                help.logg("pos " + c.position + " " + c.card.name + " " + c.manacost + " entity " + c.entity + " " + c.card.cardIDenum + " " + c.addattack);
            }
            help.logg("Enemy cards: " + this.enemyAnzCards);

            //todo print died minions this turn!

            /*if(Ai.Instance.playaround)
             * {
             *  if(Hrtprozis.Instance.enemyHeroname == HeroEnum.mage)
             *  {
             *      help.logg("probs: "  + Probabilitymaker.Instance.anzCardsInDeck(CardDB.cardIDEnum.CS2_032) + " " + Probabilitymaker.Instance.anzCardsInDeck(CardDB.cardIDEnum.CS2_028));
             *  }
             *
             *  if (Hrtprozis.Instance.enemyHeroname == HeroEnum.warrior)
             *  {
             *      help.logg("probs: "  + Probabilitymaker.Instance.anzCardsInDeck(CardDB.cardIDEnum.EX1_400));
             *  }
             *
             *  if (Hrtprozis.Instance.enemyHeroname == HeroEnum.hunter)
             *  {
             *      help.logg("probs: "  + Probabilitymaker.Instance.anzCardsInDeck(CardDB.cardIDEnum.EX1_538));
             *  }
             *
             *  if (Hrtprozis.Instance.enemyHeroname == HeroEnum.priest)
             *  {
             *      help.logg("probs: "  + Probabilitymaker.Instance.anzCardsInDeck(CardDB.cardIDEnum.CS1_112));
             *  }
             *
             *  if (Hrtprozis.Instance.enemyHeroname == HeroEnum.shaman)
             *  {
             *      help.logg("probs: "  + Probabilitymaker.Instance.anzCardsInDeck(CardDB.cardIDEnum.EX1_259));
             *  }
             *
             *  if (Hrtprozis.Instance.enemyHeroname == HeroEnum.pala)
             *  {
             *      help.logg("probs: "  + Probabilitymaker.Instance.anzCardsInDeck(CardDB.cardIDEnum.CS2_093));
             *  }
             *
             *  if (Hrtprozis.Instance.enemyHeroname == HeroEnum.druid)
             *  {
             *      help.logg("probs: "  + Probabilitymaker.Instance.anzCardsInDeck(CardDB.cardIDEnum.CS2_012));
             *  }
             * }*/

            if (writeTobuffer)
            {
                help.writeToBuffer("Own Handcards: ");
                foreach (Handmanager.Handcard c in this.handCards)
                {
                    help.writeToBuffer("pos " + c.position + " " + c.card.name + " " + c.manacost + " entity " + c.entity + " " + c.card.cardIDenum + " " + c.addattack);
                }
                help.writeToBuffer("Enemy cards: " + this.enemyAnzCards);

                //todo print died minions this turn!
            }
        }