private void getHandcards() { handCards.Clear(); this.anzcards = 0; this.enemyAnzCards = 0; List <HRCard> list = HRCard.GetCards(HRPlayer.GetLocalPlayer(), HRCardZone.HAND); list.AddRange(HRCard.GetCards(HRPlayer.GetEnemyPlayer(), HRCardZone.HAND)); foreach (HRCard item in list) { HREntity entitiy = item.GetEntity(); if (entitiy.GetControllerId() == this.ownPlayerController && entitiy.GetZonePosition() >= 1) // own handcard { CardDB.Card c = CardDB.Instance.getCardDataFromID(entitiy.GetCardId()); //c.cost = entitiy.GetCost(); //c.entityID = entitiy.GetEntityId(); Handmanager.Handcard hc = new Handmanager.Handcard(); hc.card = c; hc.position = entitiy.GetZonePosition(); hc.entity = entitiy.GetEntityId(); hc.manacost = entitiy.GetCost(); handCards.Add(hc); this.anzcards++; } if (entitiy.GetControllerId() != this.ownPlayerController && entitiy.GetZonePosition() >= 1) // enemy handcard { this.enemyAnzCards++; } } }
private void getHandcards() { handCards.Clear(); this.anzcards = 0; this.enemyAnzCards = 0; List <HRCard> list = HRCard.GetCards(HRPlayer.GetLocalPlayer(), HRCardZone.HAND); foreach (HRCard item in list) { HREntity entitiy = item.GetEntity(); if (entitiy.GetControllerId() == this.ownPlayerController && entitiy.GetZonePosition() >= 1) // own handcard { CardDB.Card c = CardDB.Instance.getCardDataFromID(CardDB.Instance.cardIdstringToEnum(entitiy.GetCardId())); //c.cost = entitiy.GetCost(); //c.entityID = entitiy.GetEntityId(); Handmanager.Handcard hc = new Handmanager.Handcard(); hc.card = c; hc.position = entitiy.GetZonePosition(); hc.entity = entitiy.GetEntityId(); hc.manacost = entitiy.GetCost(); hc.addattack = 0; if (c.name == CardDB.cardName.bolvarfordragon) { hc.addattack = entitiy.GetATK() - 1; // -1 because it starts with 1, we count only the additional attackvalue } handCards.Add(hc); this.anzcards++; } //maybe check if it has BRM_028e on it? } Dictionary <int, HREntity> allEntitys = HRGame.GetEntityMap(); foreach (HREntity ent in allEntitys.Values) { if (ent.GetControllerId() != this.ownPlayerController && ent.GetZonePosition() >= 1 && ent.GetZone() == HRCardZone.HAND) // enemy handcard { this.enemyAnzCards++; } } }
private void getHandcards() { handCards.Clear(); this.anzcards = 0; this.enemyAnzCards = 0; List <HRCard> list = HRCard.GetCards(HRPlayer.GetLocalPlayer(), HRCardZone.HAND); foreach (HRCard item in list) { HREntity entitiy = item.GetEntity(); if (entitiy.GetControllerId() == this.ownPlayerController && entitiy.GetZonePosition() >= 1) // own handcard { CardDB.Card c = CardDB.Instance.getCardDataFromID(CardDB.Instance.cardIdstringToEnum(entitiy.GetCardId())); //c.cost = entitiy.GetCost(); //c.entityID = entitiy.GetEntityId(); Handmanager.Handcard hc = new Handmanager.Handcard(); hc.card = c; hc.position = entitiy.GetZonePosition(); hc.entity = entitiy.GetEntityId(); hc.manacost = entitiy.GetCost(); handCards.Add(hc); this.anzcards++; } } Dictionary <int, HREntity> allEntitys = HRGame.GetEntityMap(); foreach (HREntity ent in allEntitys.Values) { if (ent.GetControllerId() != this.ownPlayerController && ent.GetZonePosition() >= 1 && ent.GetZone() == HRCardZone.HAND) // enemy handcard { this.enemyAnzCards++; } } }
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); }
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);*/ }