示例#1
0
        private void getMinions()
        {
            ownMinions.Clear();
            enemyMinions.Clear();
            HRPlayer ownPlayer   = HRPlayer.GetLocalPlayer();
            HRPlayer enemyPlayer = HRPlayer.GetEnemyPlayer();

            // ALL minions on Playfield:
            List <HRCard> list = HRCard.GetCards(ownPlayer, HRCardZone.PLAY);

            list.AddRange(HRCard.GetCards(enemyPlayer, HRCardZone.PLAY));

            List <HREntity> enchantments = new List <HREntity>();


            foreach (HRCard item in list)
            {
                HREntity entitiy = item.GetEntity();
                int      zp      = entitiy.GetZonePosition();

                if (entitiy.GetCardType() == HRCardType.MINION && zp >= 1)
                {
                    //HRLog.Write("zonepos " + zp);
                    CardDB.Card c = CardDB.Instance.getCardDataFromID(entitiy.GetCardId());
                    Minion      m = new Minion();
                    m.name          = c.name;
                    m.handcard.card = c;
                    m.Angr          = entitiy.GetATK();
                    m.maxHp         = entitiy.GetHealth();
                    m.Hp            = m.maxHp - entitiy.GetDamage();
                    m.wounded       = false;
                    if (m.maxHp > m.Hp)
                    {
                        m.wounded = true;
                    }


                    m.exhausted = entitiy.IsExhausted();

                    m.taunt = (entitiy.HasTaunt()) ? true : false;

                    m.charge = (entitiy.HasCharge()) ? true : false;

                    m.numAttacksThisTurn = entitiy.GetNumAttacksThisTurn();

                    int temp = entitiy.GetNumTurnsInPlay();
                    m.playedThisTurn = (temp == 0) ? true : false;

                    m.windfury = (entitiy.HasWindfury()) ? true : false;

                    m.frozen = (entitiy.IsFrozen()) ? true : false;

                    m.divineshild = (entitiy.HasDivineShield()) ? true : false;

                    m.stealth = (entitiy.IsStealthed()) ? true : false;

                    m.poisonous = (entitiy.IsPoisonous()) ? true : false;

                    m.immune = (entitiy.IsImmune()) ? true : false;

                    m.silenced = (entitiy.GetTag(HRGameTag.SILENCED) >= 1) ? true:false;


                    m.zonepos = zp;
                    m.id      = m.zonepos - 1;

                    m.entitiyID = entitiy.GetEntityId();

                    m.enchantments.Clear();

                    //HRLog.Write(  m.name + " ready params ex: " + m.exhausted + " charge: " +m.charge + " attcksthisturn: " + m.numAttacksThisTurn + " playedthisturn " + m.playedThisTurn );

                    m.Ready = false; // if exhausted, he is NOT ready

                    if (!m.playedThisTurn && !m.exhausted && !m.frozen && (m.numAttacksThisTurn == 0 || (m.numAttacksThisTurn == 1 && m.windfury)))
                    {
                        m.Ready = true;
                    }

                    if (m.playedThisTurn && m.charge && (m.numAttacksThisTurn == 0 || (m.numAttacksThisTurn == 1 && m.windfury)))
                    {
                        //m.exhausted = false;
                        m.Ready = true;
                    }

                    if (!m.silenced && (m.name == "ancientwatcher" || m.name == "ragnarosthefirelord"))
                    {
                        m.Ready = false;
                    }


                    if (entitiy.GetControllerId() == this.ownPlayerController) // OWN minion
                    {
                        this.ownMinions.Add(m);
                    }
                    else
                    {
                        this.enemyMinions.Add(m);
                    }
                }
                // minions added

                if (entitiy.GetCardType() == HRCardType.WEAPON)
                {
                    //HRLog.Write("found weapon!");
                    if (entitiy.GetControllerId() == this.ownPlayerController) // OWN weapon
                    {
                        this.ownHeroWeapon        = CardDB.Instance.getCardDataFromID(entitiy.GetCardId()).name;
                        this.heroWeaponAttack     = entitiy.GetATK();
                        this.heroWeaponDurability = entitiy.GetDurability();
                        //this.heroImmuneToDamageWhileAttacking = false;
                    }
                    else
                    {
                        this.enemyHeroWeapon       = CardDB.Instance.getCardDataFromID(entitiy.GetCardId()).name;
                        this.enemyWeaponAttack     = entitiy.GetATK();
                        this.enemyWeaponDurability = entitiy.GetDurability();
                    }
                }

                if (entitiy.GetCardType() == HRCardType.ENCHANTMENT)
                {
                    enchantments.Add(entitiy);
                }
            }

            foreach (HRCard item in list)
            {
                foreach (HREntity e in item.GetEntity().GetEnchantments())
                {
                    enchantments.Add(e);
                }
            }


            // add enchantments to minions
            setEnchantments(enchantments);
        }
示例#2
0
文件: Silverfish.cs 项目: tnd34/e
        private void getMinions()
        {
            Dictionary <int, HREntity> allEntitys = HRGame.GetEntityMap();

            ownMinions.Clear();
            enemyMinions.Clear();
            HRPlayer ownPlayer   = HRPlayer.GetLocalPlayer();
            HRPlayer enemyPlayer = HRPlayer.GetEnemyPlayer();

            // ALL minions on Playfield:
            List <HRCard> list = HRCard.GetCards(ownPlayer, HRCardZone.PLAY);

            list.AddRange(HRCard.GetCards(enemyPlayer, HRCardZone.PLAY));

            List <HREntity> enchantments = new List <HREntity>();


            foreach (HRCard item in list)
            {
                HREntity entitiy = item.GetEntity();
                int      zp      = entitiy.GetZonePosition();

                if (entitiy.GetCardType() == HRCardType.MINION && zp >= 1)
                {
                    //Helpfunctions.Instance.ErrorLog("zonepos " + zp);
                    CardDB.Card c = CardDB.Instance.getCardDataFromID(CardDB.Instance.cardIdstringToEnum(entitiy.GetCardId()));
                    Minion      m = new Minion();
                    m.name          = c.name;
                    m.handcard.card = c;
                    m.Angr          = entitiy.GetATK();
                    m.maxHp         = entitiy.GetHealth();
                    m.Hp            = m.maxHp - entitiy.GetDamage();
                    if (m.Hp <= 0)
                    {
                        continue;
                    }
                    m.wounded = false;
                    if (m.maxHp > m.Hp)
                    {
                        m.wounded = true;
                    }


                    m.exhausted = entitiy.IsExhausted();

                    m.taunt = (entitiy.HasTaunt()) ? true : false;

                    m.numAttacksThisTurn = entitiy.GetNumAttacksThisTurn();

                    int temp = entitiy.GetNumTurnsInPlay();
                    m.playedThisTurn = (temp == 0) ? true : false;

                    m.windfury = (entitiy.HasWindfury()) ? true : false;

                    m.frozen = (entitiy.IsFrozen()) ? true : false;

                    m.divineshild = (entitiy.HasDivineShield()) ? true : false;

                    m.stealth = (entitiy.IsStealthed()) ? true : false;

                    m.poisonous = (entitiy.IsPoisonous()) ? true : false;

                    m.immune = (entitiy.IsImmune()) ? true : false;

                    m.silenced = (entitiy.GetTag(HRGameTag.SILENCED) >= 1) ? true : false;

                    m.charge = 0;

                    if (!m.silenced && m.name == CardDB.cardName.southseadeckhand && entitiy.GetTag(HRGameTag.CHARGE) == 1)
                    {
                        m.charge = 1;
                    }
                    if (!m.silenced && m.handcard.card.Charge)
                    {
                        m.charge = 1;
                    }

                    m.zonepos = zp;

                    m.entitiyID = entitiy.GetEntityId();


                    //Helpfunctions.Instance.ErrorLog(  m.name + " ready params ex: " + m.exhausted + " charge: " +m.charge + " attcksthisturn: " + m.numAttacksThisTurn + " playedthisturn " + m.playedThisTurn );


                    List <miniEnch> enchs = new List <miniEnch>();
                    foreach (HREntity ent in allEntitys.Values)
                    {
                        if (ent.GetTag(HRGameTag.ATTACHED) == m.entitiyID && ent.GetZone() == HRCardZone.PLAY)
                        {
                            CardDB.cardIDEnum id = CardDB.Instance.cardIdstringToEnum(ent.GetCardId());
                            int creator          = ent.GetTag(HRGameTag.CREATOR);
                            int controler        = ent.GetTag(HRGameTag.CONTROLLER);
                            enchs.Add(new miniEnch(id, creator, controler));
                        }
                    }

                    m.loadEnchantments(enchs, entitiy.GetControllerId());



                    m.Ready = false; // if exhausted, he is NOT ready

                    m.updateReadyness();


                    if (entitiy.GetControllerId() == this.ownPlayerController) // OWN minion
                    {
                        m.own = true;
                        this.ownMinions.Add(m);
                    }
                    else
                    {
                        m.own = false;
                        this.enemyMinions.Add(m);
                    }
                }
                // minions added

                /*
                 * if (entitiy.GetCardType() == HRCardType.WEAPON)
                 * {
                 *  //Helpfunctions.Instance.ErrorLog("found weapon!");
                 *  if (entitiy.GetControllerId() == this.ownPlayerController) // OWN weapon
                 *  {
                 *      this.ownHeroWeapon = CardDB.Instance.getCardDataFromID(CardDB.Instance.cardIdstringToEnum(entitiy.GetCardId())).name.ToString();
                 *      this.heroWeaponAttack = entitiy.GetATK();
                 *      this.heroWeaponDurability = entitiy.GetDurability();
                 *      //this.heroImmuneToDamageWhileAttacking = false;
                 *
                 *
                 *  }
                 *  else
                 *  {
                 *      this.enemyHeroWeapon = CardDB.Instance.getCardDataFromID(CardDB.Instance.cardIdstringToEnum(entitiy.GetCardId())).name.ToString();
                 *      this.enemyWeaponAttack = entitiy.GetATK();
                 *      this.enemyWeaponDurability = entitiy.GetDurability();
                 *  }
                 * }
                 *
                 * if (entitiy.GetCardType() == HRCardType.ENCHANTMENT)
                 * {
                 *
                 *  enchantments.Add(entitiy);
                 * }
                 */
            }

            /*foreach (HRCard item in list)
             * {
             *  foreach (HREntity e in item.GetEntity().GetEnchantments())
             *  {
             *      enchantments.Add(e);
             *  }
             * }
             *
             *
             * // add enchantments to minions
             * setEnchantments(enchantments);*/
        }
示例#3
0
        private void getHerostuff()
        {
            HRPlayer ownPlayer   = HRPlayer.GetLocalPlayer();
            HRPlayer enemyPlayer = HRPlayer.GetEnemyPlayer();

            HREntity ownhero        = ownPlayer.GetHero();
            HREntity enemyhero      = enemyPlayer.GetHero();
            HREntity ownHeroAbility = ownPlayer.GetHeroPower();

            //player stuff#########################
            //this.currentMana =ownPlayer.GetTag(HRGameTag.RESOURCES) - ownPlayer.GetTag(HRGameTag.RESOURCES_USED) + ownPlayer.GetTag(HRGameTag.TEMP_RESOURCES);
            this.currentMana = ownPlayer.GetNumAvailableResources();
            this.ownMaxMana  = ownPlayer.GetTag(HRGameTag.RESOURCES);//ownPlayer.GetRealTimeTempMana();
            Helpfunctions.Instance.logg("#######################################################################");
            Helpfunctions.Instance.logg("#######################################################################");
            Helpfunctions.Instance.logg("start calculations, current time: " + DateTime.Now.ToString("HH:mm:ss"));
            Helpfunctions.Instance.logg("#######################################################################");
            Helpfunctions.Instance.logg("mana " + currentMana + "/" + ownMaxMana);
            Helpfunctions.Instance.logg("own secretsCount: " + ownPlayer.GetSecretDefinitions().Count);
            enemySecretCount = HRCard.GetCards(enemyPlayer, HRCardZone.SECRET).Count;
            enemySecretCount = 0;
            Helpfunctions.Instance.logg("enemy secretsCount: " + enemySecretCount);
            this.ownSecretList            = ownPlayer.GetSecretDefinitions();
            this.numMinionsPlayedThisTurn = ownPlayer.GetTag(HRGameTag.NUM_MINIONS_PLAYED_THIS_TURN);
            this.cardsPlayedThisTurn      = ownPlayer.GetTag(HRGameTag.NUM_CARDS_PLAYED_THIS_TURN);
            //if (ownPlayer.HasCombo()) this.cardsPlayedThisTurn = 1;
            this.ueberladung = ownPlayer.GetTag(HRGameTag.RECALL_OWED);


            //get weapon stuff
            this.ownHeroWeapon        = "";
            this.heroWeaponAttack     = 0;
            this.heroWeaponDurability = 0;

            this.ownHeroFatigue   = ownhero.GetFatigue();
            this.enemyHeroFatigue = enemyhero.GetFatigue();
            //this.ownDecksize = HRCard.GetCards(ownPlayer, HRCardZone.DECK).Count;

            //this.enemyDecksize = HRCard.GetCards(enemyPlayer, HRCardZone.DECK).Count;



            this.enemyHeroWeapon       = "";
            this.enemyWeaponAttack     = 0;
            this.enemyWeaponDurability = 0;
            if (enemyPlayer.HasWeapon())
            {
                HREntity weapon = enemyPlayer.GetWeaponCard().GetEntity();
                this.enemyHeroWeapon       = CardDB.Instance.getCardDataFromID(weapon.GetCardId()).name;
                this.enemyWeaponAttack     = weapon.GetATK();
                this.enemyWeaponDurability = weapon.GetDurability();
            }


            //own hero stuff###########################
            this.heroAtk     = ownhero.GetATK();
            this.heroHp      = ownhero.GetHealth() - ownhero.GetDamage();
            this.heroDefence = ownhero.GetArmor();
            this.heroname    = Hrtprozis.Instance.heroIDtoName(ownhero.GetCardId());
            bool exausted = false;

            exausted           = ownhero.IsExhausted();
            this.ownheroisread = true;

            this.heroImmuneToDamageWhileAttacking = (ownhero.IsImmune()) ? true : false;
            this.herofrozen             = ownhero.IsFrozen();
            this.heroNumAttacksThisTurn = ownhero.GetNumAttacksThisTurn();
            this.heroHasWindfury        = ownhero.HasWindfury();
            //int numberofattacks = ownhero.GetNumAttacksThisTurn();

            //HRLog.Write(ownhero.GetName() + " ready params ex: " + exausted + " " + heroAtk + " " + numberofattacks + " " + herofrozen);

            if (exausted == true)
            {
                this.ownheroisread = false;
            }
            if (exausted == false && this.heroAtk == 0)
            {
                this.ownheroisread = false;
            }
            if (herofrozen)
            {
                ownheroisread = false;
            }


            if (ownPlayer.HasWeapon())
            {
                HREntity weapon = ownPlayer.GetWeaponCard().GetEntity();
                this.ownHeroWeapon                    = CardDB.Instance.getCardDataFromID(weapon.GetCardId()).name;
                this.heroWeaponAttack                 = weapon.GetATK();
                this.heroWeaponDurability             = weapon.GetTag(HRGameTag.DURABILITY) - weapon.GetTag(HRGameTag.DAMAGE);//weapon.GetDurability();
                this.heroImmuneToDamageWhileAttacking = false;
                if (this.ownHeroWeapon == "gladiatorslongbow")
                {
                    this.heroImmuneToDamageWhileAttacking = true;
                }

                //HRLog.Write("weapon: " + ownHeroWeapon + " " + heroWeaponAttack + " " + heroWeaponDurability);
            }

            //enemy hero stuff###############################################################
            this.enemyAtk = enemyhero.GetATK();

            this.enemyHp = enemyhero.GetHealth() - enemyhero.GetDamage();

            this.enemyHeroname = Hrtprozis.Instance.heroIDtoName(enemyhero.GetCardId());

            this.enemyDefence = enemyhero.GetArmor();

            this.enemyfrozen = enemyhero.IsFrozen();



            //own hero ablity stuff###########################################################

            this.heroAbility       = CardDB.Instance.getCardDataFromID(ownHeroAbility.GetCardId());
            this.ownAbilityisReady = (ownHeroAbility.IsExhausted()) ? false : true; // if exhausted, ability is NOT ready
        }
示例#4
0
        private void getHerostuff()
        {
            HRPlayer ownPlayer   = HRPlayer.GetLocalPlayer();
            HRPlayer enemyPlayer = HRPlayer.GetEnemyPlayer();

            HREntity ownhero        = ownPlayer.GetHero();
            HREntity enemyhero      = enemyPlayer.GetHero();
            HREntity ownHeroAbility = ownPlayer.GetHeroPower();

            //player stuff#########################
            this.currentMana = ownPlayer.GetNumAvailableResources();
            this.ownMaxMana  = ownPlayer.GetNumAvailableResources();//ownPlayer.GetRealTimeTempMana();

            Helpfunctions.Instance.logg("mana " + currentMana + "/" + ownMaxMana);
            this.numMinionsPlayedThisTurn = 0;
            this.cardsPlayedThisTurn      = 0;
            if (ownPlayer.HasCombo())
            {
                this.cardsPlayedThisTurn = 1;
            }
            //this.ueberladung = ownPlayer.re(GAME_TAG.RECALL_OWED);

            //get weapon stuff
            this.ownHeroWeapon        = "";
            this.heroWeaponAttack     = 0;
            this.heroWeaponDurability = 0;



            this.enemyHeroWeapon       = "";
            this.enemyWeaponAttack     = 0;
            this.enemyWeaponDurability = 0;
            if (enemyPlayer.HasWeapon())
            {
                HREntity weapon = enemyPlayer.GetWeaponCard().GetEntity();
                this.enemyHeroWeapon       = CardDB.Instance.getCardDataFromID(weapon.GetCardId()).name;
                this.enemyWeaponAttack     = weapon.GetATK();
                this.enemyWeaponDurability = weapon.GetDurability();
            }


            //own hero stuff###########################
            this.heroAtk     = ownhero.GetATK();
            this.heroHp      = ownhero.GetHealth() - ownhero.GetDamage();
            this.heroDefence = ownhero.GetArmor();
            this.heroname    = Hrtprozis.Instance.heroIDtoName(ownhero.GetCardId());
            bool exausted = false;

            exausted                    = ownhero.IsExhausted();
            this.ownheroisread          = true;
            this.ownheroAlreadyAttacked = false;

            this.heroImmuneToDamageWhileAttacking = (ownhero.IsImmune()) ? true : false;
            this.herofrozen = ownhero.IsFrozen();

            int numberofattacks = ownhero.GetNumAttacksThisTurn();

            //HRLog.Write(ownhero.GetName() + " ready params ex: " + exausted + " " + heroAtk + " " + numberofattacks + " " + herofrozen);

            if (exausted == true)
            {
                this.ownheroisread          = false;
                this.ownheroAlreadyAttacked = true;
            }
            if (exausted == false && this.heroAtk == 0)
            {
                this.ownheroisread = false;
            }
            if (herofrozen)
            {
                ownheroisread = false;
            }


            if (ownPlayer.HasWeapon())
            {
                HREntity weapon = ownPlayer.GetWeaponCard().GetEntity();
                this.ownHeroWeapon                    = CardDB.Instance.getCardDataFromID(weapon.GetCardId()).name;
                this.heroWeaponAttack                 = weapon.GetATK();
                this.heroWeaponDurability             = weapon.GetDurability();
                this.heroImmuneToDamageWhileAttacking = false;
                if (this.ownHeroWeapon == "langbogendesgladiators")
                {
                    this.heroImmuneToDamageWhileAttacking = true;
                }

                //HRLog.Write("weapon: " + ownHeroWeapon + " " + heroWeaponAttack + " " + heroWeaponDurability);
            }

            //enemy hero stuff###############################################################
            this.enemyAtk = enemyhero.GetATK();

            this.enemyHp = enemyhero.GetHealth() - enemyhero.GetDamage();

            this.enemyHeroname = Hrtprozis.Instance.heroIDtoName(enemyhero.GetCardId());

            this.enemyDefence = enemyhero.GetArmor();

            this.enemyfrozen = enemyhero.IsFrozen();



            //own hero ablity stuff###########################################################

            this.heroAbility       = CardDB.Instance.getCardDataFromID(ownHeroAbility.GetCardId());
            this.ownAbilityisReady = (ownHeroAbility.IsExhausted()) ? false : true; // if exhausted, ability is NOT ready
        }