private void getMinions() { // ALL minions on Playfield: List <HSCard> list = TritonHs.GetCards(CardZone.Battlefield, true); list.AddRange(TritonHs.GetCards(CardZone.Battlefield, false)); var enchantments = new List <HSCard>(); ownMinions.Clear(); enemyMinions.Clear(); List <HSCard> allcards = TritonHs.GetAllCards(); foreach (HSCard entiti in list) { int zp = entiti.GetTag(GAME_TAG.ZONE_POSITION); if (entiti.IsMinion && zp >= 1) { HSCard entitiy = entiti; foreach (HSCard ent in allcards) { if (ent.EntityId == entiti.EntityId) { entitiy = ent; break; } } //Helpfunctions.Instance.ErrorLog("zonepos " + zp); CardDB.Card c = CardDB.Instance.getCardDataFromID(CardDB.Instance.cardIdstringToEnum(entitiy.Id)); Minion m = new Minion(); m.name = c.name; m.handcard.card = c; m.Angr = entitiy.GetTag(GAME_TAG.ATK); m.maxHp = entitiy.GetTag(GAME_TAG.HEALTH); m.Hp = entitiy.GetTag(GAME_TAG.HEALTH) - entitiy.GetTag(GAME_TAG.DAMAGE); if (m.Hp <= 0) { continue; } m.wounded = false; if (m.maxHp > m.Hp) { m.wounded = true; } m.exhausted = (entitiy.GetTag(GAME_TAG.EXHAUSTED) == 0) ? false : true; m.taunt = (entitiy.GetTag(GAME_TAG.TAUNT) == 0) ? false : true; m.numAttacksThisTurn = entitiy.GetTag(GAME_TAG.NUM_ATTACKS_THIS_TURN); int temp = entitiy.GetTag(GAME_TAG.NUM_TURNS_IN_PLAY); m.playedThisTurn = (temp == 0) ? true : false; m.windfury = (entitiy.GetTag(GAME_TAG.WINDFURY) == 0) ? false : true; m.frozen = (entitiy.GetTag(GAME_TAG.FROZEN) == 0) ? false : true; m.divineshild = (entitiy.GetTag(GAME_TAG.DIVINE_SHIELD) == 0) ? false : true; m.stealth = (entitiy.GetTag(GAME_TAG.STEALTH) == 0) ? false : true; m.poisonous = (entitiy.GetTag(GAME_TAG.POISONOUS) == 0) ? false : true; m.immune = (entitiy.GetTag(GAME_TAG.IMMUNE_WHILE_ATTACKING) == 0) ? false : true; m.silenced = (entitiy.GetTag(GAME_TAG.SILENCED) == 0) ? false : true; // Drew: fixed | is the tag removed when silenced, via Mass Dispel? m.cantBeTargetedBySpellsOrHeroPowers = (entitiy.GetTag(GAME_TAG.CANT_BE_TARGETED_BY_HERO_POWERS) == 0) ? false : true; m.charge = 0; if (!m.silenced && m.name == CardDB.cardName.southseadeckhand && entitiy.GetTag(GAME_TAG.CHARGE) == 1) { m.charge = 1; } if (!m.silenced && m.handcard.card.Charge) { m.charge++; } m.zonepos = zp; m.entitiyID = entitiy.EntityId; //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 (HSCard ent in allcards) { if (ent.GetTag(GAME_TAG.ATTACHED) == m.entitiyID && ent.GetTag(GAME_TAG.ZONE) == 1) //1==play { CardDB.cardIDEnum id = CardDB.Instance.cardIdstringToEnum(ent.Id); int controler = ent.GetTag(GAME_TAG.CONTROLLER); int creator = ent.GetTag(GAME_TAG.CREATOR); enchs.Add(new miniEnch(id, creator, controler)); } } m.loadEnchantments(enchs, entitiy.GetTag(GAME_TAG.CONTROLLER)); m.Ready = false; // if exhausted, he is NOT ready m.updateReadyness(); if (entitiy.GetTag(GAME_TAG.CONTROLLER) == this.ownPlayerController) // OWN minion { m.own = true; this.ownMinions.Add(m); } else { m.own = false; this.enemyMinions.Add(m); } } } }
private void getHerostuff() { List <HSCard> allcards = TritonHs.GetAllCards(); HSCard ownHeroCard = TritonHs.OurHero; HSCard enemHeroCard = TritonHs.EnemyHero; int ownheroentity = TritonHs.OurHero.EntityId; int enemyheroentity = TritonHs.EnemyHero.EntityId; foreach (HSCard ent in allcards) { if (ent.EntityId == enemyheroentity) { enemHeroCard = ent; } if (ent.EntityId == ownheroentity) { ownHeroCard = ent; } } //player stuff######################### //this.currentMana =ownPlayer.GetTag(HRGameTag.RESOURCES) - ownPlayer.GetTag(HRGameTag.RESOURCES_USED) + ownPlayer.GetTag(HRGameTag.TEMP_RESOURCES); this.currentMana = TritonHs.CurrentMana; this.ownMaxMana = TritonHs.Resources; this.enemyMaxMana = ownMaxMana; //count own secrets ownSecretList = new List <string>(); // the CARDIDS of the secrets enemySecretCount = 0; //count enemy secrets: enemySecretList.Clear(); foreach (HSCard ent in allcards) { if (ent.IsSecret && ent.ControllerId != ownPlayerController && ent.GetTag(GAME_TAG.ZONE) == 7) { enemySecretCount++; enemySecretList.Add(ent.GetTag(GAME_TAG.ENTITY_ID)); } if (ent.IsSecret && ent.ControllerId == ownPlayerController && ent.GetTag(GAME_TAG.ZONE) == 7) { ownSecretList.Add(ent.Id); } } int ourSecretsCount = ownSecretList.Count; numMinionsPlayedThisTurn = TritonHs.NumMinionsPlayedThisTurn; cardsPlayedThisTurn = TritonHs.NumCardsPlayedThisTurn; //get weapon stuff this.ownHeroWeapon = ""; this.heroWeaponAttack = 0; this.heroWeaponDurability = 0; this.ownHeroFatigue = ownHeroCard.GetTag(GAME_TAG.FATIGUE); this.enemyHeroFatigue = enemHeroCard.GetTag(GAME_TAG.FATIGUE); this.ownDecksize = 0; this.enemyDecksize = 0; //count decksize foreach (HSCard ent in allcards) { if (ent.ControllerId == ownPlayerController && ent.GetTag(GAME_TAG.ZONE) == 2) { ownDecksize++; } if (ent.ControllerId != ownPlayerController && ent.GetTag(GAME_TAG.ZONE) == 2) { enemyDecksize++; } } //own hero stuff########################### int heroAtk = ownHeroCard.GetTag(GAME_TAG.ATK); int heroHp = ownHeroCard.GetTag(GAME_TAG.HEALTH) - ownHeroCard.GetTag(GAME_TAG.DAMAGE); int heroDefence = ownHeroCard.GetTag(GAME_TAG.ARMOR); this.heroname = Hrtprozis.Instance.heroIDtoName(TritonHs.OurHero.Id); bool heroImmuneToDamageWhileAttacking = false; bool herofrozen = (ownHeroCard.GetTag(GAME_TAG.FROZEN) == 0) ? false : true; int heroNumAttacksThisTurn = ownHeroCard.GetTag(GAME_TAG.NUM_ATTACKS_THIS_TURN); bool heroHasWindfury = (ownHeroCard.GetTag(GAME_TAG.WINDFURY) == 0) ? false : true; bool heroImmune = (ownHeroCard.GetTag(GAME_TAG.CANT_BE_DAMAGED) == 0) ? false : true; //Helpfunctions.Instance.ErrorLog(ownhero.GetName() + " ready params ex: " + exausted + " " + heroAtk + " " + numberofattacks + " " + herofrozen); if (TritonHs.DoWeHaveWeapon) { HSCard weapon = TritonHs.OurWeaponCard; ownHeroWeapon = CardDB.Instance.getCardDataFromID(CardDB.Instance.cardIdstringToEnum(weapon.Id)).name.ToString(); heroWeaponAttack = weapon.GetTag(GAME_TAG.ATK); heroWeaponDurability = weapon.GetTag(GAME_TAG.DURABILITY) - weapon.GetTag(GAME_TAG.DAMAGE); //weapon.GetDurability(); if (ownHeroWeapon == "gladiatorslongbow") { heroImmuneToDamageWhileAttacking = true; } if (this.ownHeroWeapon == "doomhammer") { heroHasWindfury = true; } //Helpfunctions.Instance.ErrorLog("weapon: " + ownHeroWeapon + " " + heroWeaponAttack + " " + heroWeaponDurability); } //enemy hero stuff############################################################### this.enemyHeroname = Hrtprozis.Instance.heroIDtoName(TritonHs.EnemyHero.Id); int enemyAtk = enemHeroCard.GetTag(GAME_TAG.ATK); //lol should be zero :D int enemyHp = enemHeroCard.GetTag(GAME_TAG.HEALTH) - enemHeroCard.GetTag(GAME_TAG.DAMAGE); int enemyDefence = enemHeroCard.GetTag(GAME_TAG.ARMOR); bool enemyfrozen = (enemHeroCard.GetTag(GAME_TAG.FROZEN) == 0) ? false : true; bool enemyHeroImmune = (enemHeroCard.GetTag(GAME_TAG.CANT_BE_DAMAGED) == 0) ? false : true; this.enemyHeroWeapon = ""; this.enemyWeaponAttack = 0; this.enemyWeaponDurability = 0; if (TritonHs.DoesEnemyHasWeapon) { HSCard weapon = TritonHs.EnemyWeaponCard; enemyHeroWeapon = CardDB.Instance.getCardDataFromID(CardDB.Instance.cardIdstringToEnum(weapon.Id)).name.ToString(); enemyWeaponAttack = weapon.GetTag(GAME_TAG.ATK); enemyWeaponDurability = weapon.GetTag(GAME_TAG.DURABILITY) - weapon.GetTag(GAME_TAG.DAMAGE); } //own hero ablity stuff########################################################### this.heroAbility = CardDB.Instance.getCardDataFromID(CardDB.Instance.cardIdstringToEnum(TritonHs.OurHeroPowerCard.Id)); this.ownAbilityisReady = (TritonHs.OurHeroPowerCard.GetTag(GAME_TAG.EXHAUSTED) == 0) ? true : false; this.enemyAbility = CardDB.Instance.getCardDataFromID(CardDB.Instance.cardIdstringToEnum(TritonHs.OurHeroPowerCard.Id)); int ownHeroAbilityEntity = TritonHs.OurHeroPowerCard.EntityId; foreach (HSCard ent in allcards) { if (ent.EntityId != ownHeroAbilityEntity && ent.GetTag(GAME_TAG.CARDTYPE) == 10) { enemyAbility = CardDB.Instance.getCardDataFromID(CardDB.Instance.cardIdstringToEnum(ent.Id)); break; } } //generate Heros this.ownHero = new Minion(); this.enemyHero = new Minion(); this.ownHero.isHero = true; this.enemyHero.isHero = true; this.ownHero.own = true; this.enemyHero.own = false; this.ownHero.maxHp = ownHeroCard.GetTag(GAME_TAG.HEALTH); this.enemyHero.maxHp = enemHeroCard.GetTag(GAME_TAG.HEALTH); this.ownHero.entitiyID = ownHeroCard.EntityId; this.enemyHero.entitiyID = enemHeroCard.EntityId; this.ownHero.Angr = heroAtk; this.ownHero.Hp = heroHp; this.ownHero.armor = heroDefence; this.ownHero.frozen = herofrozen; this.ownHero.immuneWhileAttacking = heroImmuneToDamageWhileAttacking; this.ownHero.immune = heroImmune; this.ownHero.numAttacksThisTurn = heroNumAttacksThisTurn; this.ownHero.windfury = heroHasWindfury; this.enemyHero.Angr = enemyAtk; this.enemyHero.Hp = enemyHp; this.enemyHero.frozen = enemyfrozen; this.enemyHero.armor = enemyDefence; this.enemyHero.immune = enemyHeroImmune; this.enemyHero.Ready = false; this.ownHero.updateReadyness(); //load enchantments of the heros List <miniEnch> miniEnchlist = new List <miniEnch>(); foreach (HSCard ent in allcards) { if (ent.GetTag(GAME_TAG.ATTACHED) == this.ownHero.entitiyID && ent.GetTag(GAME_TAG.ZONE) == 1) //1==play { CardDB.cardIDEnum id = CardDB.Instance.cardIdstringToEnum(ent.Id); int controler = ent.GetTag(GAME_TAG.CONTROLLER); int creator = ent.GetTag(GAME_TAG.CREATOR); miniEnchlist.Add(new miniEnch(id, creator, controler)); } } this.ownHero.loadEnchantments(miniEnchlist, ownHeroCard.GetTag(GAME_TAG.CONTROLLER)); ueberladung = TritonHs.RecallOwed;//was at the start, but copied it over here :D , its german for overload :D //Reading new values:################################################################################################### //ToDo: this.numberMinionsDiedThisTurn = 0;// GameTag.NUM_MINIONS_KILLED_THIS_TURN; //this should work (hope i didnt oversee a value :D) //THIS IS WRONG CHANGE THIS (should be the ownPLAYER and enemyPLAYER this.ownCurrentOverload = ownHeroCard.GetTag(GAME_TAG.RECALL); this.enemyOverload = enemHeroCard.GetTag(GAME_TAG.RECALL_OWED); //count buffs off !!players!! (players and not heros) (like preparation, kirintor-buff and stuff) // hope this works, dont own these cards to test where its attached int owncontrollerblubb = ownHeroCard.GetTag(GAME_TAG.CONTROLLER) + 1; // controller = 1 or 2, but entity with 1 is the board -> +1 int enemycontrollerblubb = enemHeroCard.GetTag(GAME_TAG.CONTROLLER) + 1; // controller = 1 or 2, but entity with 1 is the board -> +1 foreach (HSCard ent in allcards) { if (ent.GetTag(GAME_TAG.ATTACHED) == owncontrollerblubb && ent.GetTag(GAME_TAG.ZONE) == 1) //1==play { CardDB.cardIDEnum id = CardDB.Instance.cardIdstringToEnum(ent.Id); if (id == CardDB.cardIDEnum.NEW1_029t) { this.ownMillhouse++; } if (id == CardDB.cardIDEnum.FP1_030e) { this.ownLoathebs++; } if (id == CardDB.cardIDEnum.BRM_018e) { this.ownDragonConsort++; } if (id == CardDB.cardIDEnum.EX1_612o) { this.ownKirintor++; } if (id == CardDB.cardIDEnum.EX1_145o) { this.ownPrepa++; } } if (ent.GetTag(GAME_TAG.ATTACHED) == enemycontrollerblubb && ent.GetTag(GAME_TAG.ZONE) == 1) //1==play { CardDB.cardIDEnum id = CardDB.Instance.cardIdstringToEnum(ent.Id); if (id == CardDB.cardIDEnum.NEW1_029t) { this.enemyMillhouse++; } if (id == CardDB.cardIDEnum.FP1_030e) { this.enemyLoathebs++; } if (id == CardDB.cardIDEnum.BRM_018e) { this.enemyDragonConsort++; } // not needef for enemy, because its lasting only for his turn //if (id == CardDB.cardIDEnum.EX1_612o) this.enemyKirintor++; //if (id == CardDB.cardIDEnum.EX1_145o) this.enemyPrepa++; } } //TODO test Bolvar Fordragon but it will be on his card :D //Reading new values end################################ miniEnchlist.Clear(); foreach (HSCard ent in allcards) { if (ent.GetTag(GAME_TAG.ATTACHED) == this.enemyHero.entitiyID && ent.GetTag(GAME_TAG.ZONE) == 1) //1==play { CardDB.cardIDEnum id = CardDB.Instance.cardIdstringToEnum(ent.Id); int controler = ent.GetTag(GAME_TAG.CONTROLLER); int creator = ent.GetTag(GAME_TAG.CREATOR); miniEnchlist.Add(new miniEnch(id, creator, controler)); } } this.enemyHero.loadEnchantments(miniEnchlist, enemHeroCard.GetTag(GAME_TAG.CONTROLLER)); //fastmode weapon correction: if (this.ownHero.Angr < this.heroWeaponAttack) { this.ownHero.Angr = this.heroWeaponAttack; } if (this.enemyHero.Angr < this.enemyWeaponAttack) { this.enemyHero.Angr = this.enemyWeaponAttack; } }