Esempio n. 1
0
        public void updateMinions(HRSim.Playfield p, bool own)
        {
            HRSim.Player mPlayer, ePlayer;
            if (own)
            {
                mPlayer = p.playerFirst;
                ePlayer = p.playerSecond;
            }
            else
            {
                mPlayer = p.playerSecond;
                ePlayer = p.playerFirst;
            }

            this.ownMinions.Clear();
            this.enemyMinions.Clear();
            foreach (HRSim.Minion m in mPlayer.ownMinions)
            {
                Minion mMinion = new Minion(m);
                mMinion.own = true;
                this.ownMinions.Add(mMinion);
            }
            foreach (HRSim.Minion m in ePlayer.ownMinions)
            {
                Minion mMinion = new Minion(m);
                mMinion.own = false;
                this.enemyMinions.Add(mMinion);
            }
        }
Esempio n. 2
0
        // todo ask the posibility manager!
//    zieht eine karte und verursacht schaden, der ihren kosten entspricht.
		public override void onCardPlay(Playfield p, bool ownplay, Minion target, int choice)
		{
            p.drawACard(p.getArandomCardFromDeck(ownplay), ownplay);

            int dmg = p.getSpellDamageDamage(3, ownplay);
            p.minionGetDamageOrHeal(target, dmg);
		}
Esempio n. 3
0
//    tauscht zu beginn eures zuges diesen diener gegen einen zufälligen diener auf eurer hand aus.

        public override void onTurnStartTrigger(Playfield p, Minion triggerEffectMinion, bool turnStartOfOwner)
        {
            if (turnStartOfOwner && triggerEffectMinion.own == turnStartOfOwner)
            {
                List<Handmanager.Handcard> temp2 = new List<Handmanager.Handcard>();
                foreach (Handmanager.Handcard hc in p.playerFirst.owncards)
                {
                    if (hc.card.type == CardDB.cardtype.MOB) temp2.Add(hc);
                }
                temp2.Sort((a, b) => -a.card.Attack.CompareTo(b.card.Attack));//damage the stronges
                foreach (Handmanager.Handcard mins in temp2)
                {
                    CardDB.Card c = CardDB.Instance.getCardDataFromID(mins.card.cardIDenum);
                    p.minionTransform(triggerEffectMinion, c);
                    p.removeCard(mins, true);
                    p.drawACard(CardDB.cardName.alarmobot, true, true);
                    break;
                }
                return;
            }

            if (!turnStartOfOwner && triggerEffectMinion.own == turnStartOfOwner)
            {
                p.minionGetBuffed(triggerEffectMinion, 4, 4);
                triggerEffectMinion.Hp = triggerEffectMinion.maxHp;
            }
        }
Esempio n. 4
0
        // <deDE>Stellt zu Beginn Eures Zuges bei einem verletzten befreundeten Charakter 3 Leben wieder her.</deDE>
        public override void onTurnStartTrigger(Playfield p, Minion triggerEffectMinion, bool turnStartOfOwner)
        {
            if (turnStartOfOwner == triggerEffectMinion.own)
            {
                int heal = p.getMinionHeal(3, turnStartOfOwner);
                List<Minion> temp = (turnStartOfOwner) ? p.playerFirst.ownMinions : p.playerSecond.ownMinions;
                if (temp.Count >= 1)
                {
                    bool healed = false;
                    foreach (Minion mins in temp)
                    {
                        if (mins.wounded)
                        {
                            p.minionGetDamageOrHeal(mins, -heal);
                            healed = true;
                            break;
                        }
                    }

                    if (!healed)
                    {
                        p.minionGetDamageOrHeal(turnStartOfOwner ? p.playerFirst.ownHero : p.playerSecond.ownHero, -heal);
                    }
                }
                else
                {
                    p.minionGetDamageOrHeal(turnStartOfOwner ? p.playerFirst.ownHero : p.playerSecond.ownHero, -heal);
                }

            }
        }
Esempio n. 5
0
//    zieht am ende eures zuges eine karte.
        public override void onTurnEndsTrigger(Playfield p, Minion triggerEffectMinion, bool turnEndOfOwner)
        {
            if (turnEndOfOwner == triggerEffectMinion.own)
            {
                p.drawACard(p.getArandomCardFromDeck(turnEndOfOwner), turnEndOfOwner);
            }
        }
Esempio n. 6
0
        //   Whenever your opponent casts a spell, gain +1 Attack.

        public override void onCardIsGoingToBePlayed(Playfield p, CardDB.Card c, bool wasOwnCard, Minion triggerEffectMinion)
        {
            if (c.type == CardDB.cardtype.SPELL && wasOwnCard != triggerEffectMinion.own)
            {
                p.minionGetBuffed(triggerEffectMinion, 1, 0);
            }
        }
Esempio n. 7
0
//    fügt einem feindlichen charakter $1 schaden zu und friert/ ihn ein.
		public override void onCardPlay(Playfield p, bool ownplay, Minion target, int choice)
		{
            int dmg = p.getSpellDamageDamage(1, ownplay);
            target.frozen = true;
            p.minionGetDamageOrHeal(target, dmg);
            
		}
Esempio n. 8
0
 //Return true is already exist
 // false if non-exist
 public override bool addToMap(Playfield state)
 {
     float key = getHashkey(state);
     //Helpfunctions.Instance.logg("end key = " + key);
     if (TTable.ContainsKey(key))
     {
         foreach (Playfield existState in TTable[key])
         {
             if (existState.isHandEqual(state, true))
             {
                 return true;
             }
         }
         if (TTable[key][0].getBoardValue() < state.getBoardValue())
         {
             //Helpfunctions.Instance.logg("orig board " + TTable[key][0].getBoardValue());
             //TTable[key][0].debugMinions();
             //Helpfunctions.Instance.logg("new board " + state.getBoardValue());
             //state.debugMinions();
             TTable[key][0] = state;
         } 
         return false;
     }
     else
     {
         TTable.Add(key, new List<Playfield>());
         TTable[key].Add(state);
     }
     return false;
 }
Esempio n. 9
0
//    erhaltet einen leeren manakristall.
		public override void onCardPlay(Playfield p, bool ownplay, Minion target, int choice)
		{
            if (ownplay)
            {
                if (p.playerFirst.ownMaxMana < 10)
                {
                    p.playerFirst.ownMaxMana++;
                }
                else
                {
                    p.drawACard(CardDB.cardName.excessmana, true, true);
                }

            }
            else
            {
                if (p.playerSecond.ownMaxMana < 10)
                {
                    p.playerSecond.ownMaxMana++;
                }
                else
                {
                    p.drawACard(CardDB.cardName.excessmana, false, true);
                }
            }
		}
Esempio n. 10
0
        //    fügt dem feindlichen helden $3 schaden zu.
        public override void onCardPlay(Playfield p, bool ownplay, Minion target, int choice)
        {
            int dmg = p.getSpellDamageDamage(3, ownplay);

            p.minionGetDamageOrHeal(ownplay ? p.playerSecond.ownHero : p.playerFirst.ownHero, dmg);

        }
Esempio n. 11
0
//    fügt einem feind $4 schaden und allen anderen feinden $1 schaden zu.
		public override void onCardPlay(Playfield p, bool ownplay, Minion target, int choice)
		{
            int dmg = p.getSpellDamageDamage(1, ownplay);
            int dmg1 = p.getSpellDamageDamage(4, ownplay);

            List<Minion> temp = (ownplay) ? p.playerSecond.ownMinions : p.playerFirst.ownMinions;
            p.minionGetDamageOrHeal(target, dmg1);
            foreach (Minion m in temp)
            {
                if (m.entitiyID != target.entitiyID)
                {
                    p.minionGetDamageOrHeal(m, dmg);
                }
            }
            if (ownplay)
            {
                if (p.playerSecond.ownHero.entitiyID != target.entitiyID)
                {
                    p.minionGetDamageOrHeal(p.playerSecond.ownHero, dmg);
                }
            }
            else
            {
                if (p.playerFirst.ownHero.entitiyID != target.entitiyID)
                {
                    p.minionGetDamageOrHeal(p.playerFirst.ownHero, dmg);
                }
                
            }
		}
Esempio n. 12
0
    //public PlayoutInfo m_pi;

    //public ParetoTreeNode()
    //{
    //    this(null, null, -1, null, null, null, null,null);
    //}

    //public ParetoTreeNode(Game state, Roller roller, ParetoTreePolicy treePolicy, Random rnd,
    //                      Player a_player, PlayoutInfo pi) {
    //    this(state, null, -1, roller, treePolicy, rnd, a_player,pi);
    //}

    //public ParetoTreeNode(Playfield state, RandomRoller roller, ParetoTreePolicy treePolicy, Random rnd,
    //                  ParetoMCTSPlayer a_player)
    //{
    //    this(state, null, -1, roller, treePolicy, rnd, a_player);
    //}

    //public ParetoTreeNode(Game state, ParetoTreeNode parent, int childIndex, Roller roller,
    //                      TreePolicy treePolicy, Random rnd, Player a_player, PlayoutInfo pi) {
    //    this.m_player = a_player;
    //    this.state = state;
    //    this.parent = parent;
    //    this.m_rnd = rnd;
    //    children = new ParetoTreeNode[ParetoMCTSParameters.NUM_ACTIONS];
    //    totValue = new double[ParetoMCTSParameters.NUM_TARGETS];
    //    this.roller = roller;
    //    this.treePolicy = treePolicy;
    //    pa = new ParetoArchive();
    //    this.childIndex = childIndex;
    //    this.m_prunedChildren = new bool[ParetoMCTSParameters.NUM_ACTIONS];
    //    this.m_numIters = 0;
    //    this.m_pi = pi;
        
    //    if(parent == null) //This is only for the root:
    //    {
    //        this.initValueRoute();
    //    }
    //}

    public ParetoTreeNode(Playfield state, ParetoTreeNode parent, int childIndex, RandomRoller roller,
                      ParetoTreePolicy treePolicy, Random rnd, ParetoMCTSPlayer a_player)
    {
        this.m_player = a_player;
        this.state = state;
        this.parent = parent;
        this.m_rnd = rnd;
        //children = new ParetoTreeNode[ParetoMCTSParameters.NUM_ACTIONS];
        this.roller = roller;
        this.mTreePolicy = treePolicy;
        pa = new ParetoArchive();
        this.childIndex = childIndex;
        this.m_prunedChildren = new bool[ParetoMCTSParameters.NUM_ACTIONS];
        this.m_numIters = 0;
        //this.m_pi = pi;

        isTerminal = false;
        isExpanded = false;
        isExhausted = false;
        numExpandedChildren = 0;
        numExhaustedChildren = 0;
        nodeNum = GameManager.Instance.nodeCount;
        GameManager.Instance.nodeCount++;

        totValue = new double[ParetoMCTSParameters.NUM_TARGETS];
        //if (parent == null) //This is only for the root:
        //{
        //    this.initValueRoute();
        //}
    }
Esempio n. 13
0
 public override void onCardPlay(Playfield p, bool ownplay, Minion target, int choice)
 {
     int dmg = p.getSpellDamageDamage(1, ownplay);
     if (p.playerFirst.cardsPlayedThisTurn >= 1) dmg = p.getSpellDamageDamage(2, ownplay);
     p.minionGetDamageOrHeal(target, dmg);
     p.equipWeapon(w, ownplay);
 }
Esempio n. 14
0
        //    Give each player a Mana Crystal.

        public override void getBattlecryEffect(Playfield p, Minion own, Minion target, int choice)
        {

            p.drawACard(p.getArandomCardFromDeck(true), true);
            p.drawACard(p.getArandomCardFromDeck(false), false);
           
        }
Esempio n. 15
0
//    jedes mal, wenn ihr einen diener mit max. 3 angriff herbeiruft, erhält dieser ansturm/.

        public override void onMinionIsSummoned(Playfield p, Minion triggerEffectMinion, Minion summonedMinion)
        {
            if (triggerEffectMinion.own == summonedMinion.own && summonedMinion.handcard.card.Attack <= 3 )
            {
                p.minionGetCharge(summonedMinion);
            }
        }
Esempio n. 16
0
        public override void onSecretPlay(Playfield p, bool ownplay, Minion attacker, Minion target, out int number)
        {
            number = 0;
            if (ownplay)
            {
                int posi = p.playerFirst.ownMinions.Count;
                p.callKid(kid, posi, true);
                if (p.playerFirst.ownMinions.Count >= 1)
                {
                    if (p.playerFirst.ownMinions[p.playerFirst.ownMinions.Count - 1].name == CardDB.cardName.defender)
                    {
                        number = p.playerFirst.ownMinions[p.playerFirst.ownMinions.Count - 1].entitiyID;
                    }
                }
            }
            else
            {
                int posi = p.playerSecond.ownMinions.Count;
                p.callKid(kid, posi, false);

                if (p.playerSecond.ownMinions.Count >= 1)
                {
                    if (p.playerSecond.ownMinions[p.playerSecond.ownMinions.Count - 1].name == CardDB.cardName.defender)
                    {
                        number = p.playerSecond.ownMinions[p.playerSecond.ownMinions.Count - 1].entitiyID;
                    }
                }
            }

        }
Esempio n. 17
0
        CardDB.Card card2 = CardDB.Instance.getCardDataFromID(CardDB.cardIDEnum.EX1_tk28); // squirrel
        //todo better
//    kampfschrei:/ verwandelt einen anderen zufälligen diener in einen teufelssaurier (5/5) oder ein eichhörnchen (1/1).
		public override void getBattlecryEffect(Playfield p, Minion own, Minion target, int choice)
		{
            int oc = p.playerFirst.ownMinions.Count;
            int ec = p.playerSecond.ownMinions.Count;
            if (oc == 0 && ec == 0) return;
            if (oc > ec)
            {
                List<Minion> temp = new List<Minion>(p.playerFirst.ownMinions);
                temp.AddRange(p.playerSecond.ownMinions);
                temp.Sort((a, b) => a.Hp.CompareTo(b.Hp));//transform the weakest
                foreach (Minion m in temp)
                {
                    p.minionTransform(m, card1);
                    break;
                }
            }
            else
            {
                List<Minion> temp = new List<Minion>(p.playerFirst.ownMinions);
                temp.AddRange(p.playerSecond.ownMinions);
                temp.Sort((a, b) => -a.Hp.CompareTo(b.Hp));//transform the strongest
                foreach (Minion m in temp)
                {
                    p.minionTransform(m, card2);
                    break;
                }
            }
		}
Esempio n. 18
0
//    zieht 4 karten.
		public override void onCardPlay(Playfield p, bool ownplay, Minion target, int choice)
		{
            p.drawACard(p.getArandomCardFromDeck(ownplay), ownplay);
            p.drawACard(p.getArandomCardFromDeck(ownplay), ownplay);
            p.drawACard(p.getArandomCardFromDeck(ownplay), ownplay);
            p.drawACard(p.getArandomCardFromDeck(ownplay), ownplay);
		}
Esempio n. 19
0
        //   At the end of each player's turn, that player draws until they have 3 cards.

        public override void onTurnEndsTrigger(Playfield p, Minion triggerEffectMinion, bool turnEndOfOwner)
        {
            if (triggerEffectMinion.own == turnEndOfOwner)
            {
                Player mPlayer;
                if (turnEndOfOwner)
                {
                    mPlayer = p.playerFirst;
                }
                else
                {
                    mPlayer = p.playerSecond;
                }

                int cardstodraw = 0;
                if (mPlayer.owncards.Count <= 2)
                {
                    cardstodraw = 3 - mPlayer.owncards.Count;
                }

                for (int i = 0; i < cardstodraw; i++)
                {
                    p.drawACard(p.getArandomCardFromDeck(turnEndOfOwner), turnEndOfOwner);
                }
            }
        }
Esempio n. 20
0
		// Hero PowerDeal 8 damage to a random enemy.
		
        public override void onCardPlay(Playfield p, bool ownplay, Minion target, int choice)
        {
            int dmg = 8;
            if (ownplay)
            {
                if (p.playerFirst.doublepriest >= 1) dmg *= (2 * p.playerFirst.doublepriest);
				if (p.playerSecond.ownMinions.Count > 0)
				{
					target = p.searchRandomMinion(p.playerSecond.ownMinions, Playfield.searchmode.searchLowestHP); //damage the lowest (pessimistic variant)
				}
				else
				{
					target = p.playerSecond.ownHero;
				}
            }
            else
            {
                if (p.playerSecond.doublepriest >= 1) dmg *= (2 * p.playerSecond.doublepriest);
				if (p.playerFirst.ownMinions.Count > 0)
				{
					target = p.searchRandomMinion(p.playerFirst.ownMinions, Playfield.searchmode.searchHighestAttack); //damage the Highest (pessimistic variant)
				}
				else
				{
					target = p.playerFirst.ownHero;
				}
            }			
            p.minionGetDamageOrHeal(target, dmg);
        }
Esempio n. 21
0
        //   Battlecry:&lt;/b&gt; Give a friendly Mech +4 Health.

        public override void getBattlecryEffect(Playfield p, Minion own, Minion target, int choice)
        {
            if (target != null)
            {
                p.minionGetBuffed(target, 0, 4);
            }
        }
Esempio n. 22
0
//    verstohlenheit/. erhält zu beginn eures zuges +1/+1.

        public override void onTurnStartTrigger(Playfield p, Minion triggerEffectMinion, bool turnStartOfOwner)
        {
            if (triggerEffectMinion.own == turnStartOfOwner)
            {
                p.minionGetBuffed(triggerEffectMinion,1,1);
            }
        }
Esempio n. 23
0
//    combo:/ ruft einen banditen der defias (2/1) herbei.
		public override void getBattlecryEffect(Playfield p, Minion own, Minion target, int choice)
		{
            if (p.playerFirst.cardsPlayedThisTurn >= 1)
            {
                p.callKid(card, own.zonepos, own.own);
            }
		}
Esempio n. 24
0
 // erhält jedes Mal +1/+1, wenn Ihr eine Karte mit uberladung&lt; ausspielt.
 public override void onCardIsGoingToBePlayed(Playfield p, CardDB.Card c, bool wasOwnCard, Minion triggerEffectMinion)
 {
     if (wasOwnCard == triggerEffectMinion.own && c.Recall)
     {
         p.minionGetBuffed(triggerEffectMinion, 1, 1);
     }
 }
Esempio n. 25
0
        CardDB.Card wcard = CardDB.Instance.getCardDataFromID(CardDB.cardIDEnum.EX1_409t);//heavyaxe
//    wenn ihr eine waffe habt, erhält sie +1/+1. legt anderenfalls eine waffe (1/3) an.
		public override void onCardPlay(Playfield p, bool ownplay, Minion target, int choice)
		{
            if (ownplay)
            {
                if (p.playerFirst.ownWeaponName != CardDB.cardName.unknown)
                {
                    p.playerFirst.ownWeaponAttack++;
                    p.playerFirst.ownWeaponDurability++;
                    p.minionGetBuffed(p.playerFirst.ownHero, 1, 0);
                }
                else
                {

                    p.equipWeapon(wcard, true);
                }
            }
            else
            {
                if (p.playerSecond.ownWeaponName != CardDB.cardName.unknown)
                {
                    p.playerSecond.ownWeaponAttack++;
                    p.playerSecond.ownWeaponDurability++;
                    p.minionGetBuffed(p.playerSecond.ownHero, 1, 0);
                }
                else
                {

                    p.equipWeapon(wcard, false);
                }
            }
		}
Esempio n. 26
0
        //    At the start of your turn, deal 1 damage to your hero.

        public override void onTurnStartTrigger(Playfield p, Minion triggerEffectMinion, bool turnStartOfOwner)
        {
            if (triggerEffectMinion.own == turnStartOfOwner)
            {
				p.minionGetDamageOrHeal(turnStartOfOwner ? p.playerFirst.ownHero : p.playerSecond.ownHero, 1);
            }
        }
Esempio n. 27
0
//    verdoppelt den schaden und die heilung eurer zauber und heldenfähigkeiten.
		public override void onAuraStarts(Playfield p, Minion own)
		{
            if (own.own)
            {
                p.playerFirst.doublepriest++;
            }
		}
Esempio n. 28
0
        public override float getHashkey(Playfield p)
        {
            Player mPlayer;
            if (p.isOwnTurn) //end turn evaluation, so opponent
            {
                mPlayer = p.playerSecond;
            }
            else
            {
                mPlayer = p.playerFirst;
            }

            float handValue = 0f;

            foreach (Handmanager.Handcard hc in p.playerFirst.owncards)
            {
                if (hc.card.type == CardDB.cardtype.MOB)
                {
                    handValue += hc.card.cost * (int)(hc.card.name);
                }
                else
                {
                    handValue += (float)Math.Sqrt(hc.card.cost) * (int)(hc.card.name);
                }
            }

            return handValue;
        }
Esempio n. 29
0
 public override void onAuraEnds(Playfield p, Minion m)
 {
     if (m.own)
     {
         p.playerFirst.doublepriest--;
     }
 }
Esempio n. 30
0
        CardDB.Card kid = CardDB.Instance.getCardDataFromID(CardDB.cardIDEnum.GVG_110t);//chillwind

        public override void getBattlecryEffect(Playfield p, Minion own, Minion target, int choice)
        {
            int pos = (own.own) ? p.playerFirst.ownMinions.Count : p.playerSecond.ownMinions.Count;
            p.callKid(kid, pos, own.own);
            pos = (own.own) ? p.playerFirst.ownMinions.Count : p.playerSecond.ownMinions.Count;
            p.callKid(kid, pos, own.own);
        }
Esempio n. 31
0
        //todo make it better
//    kampfschrei:/ verursacht 3 schaden, der zufällig auf alle anderen charaktere aufgeteilt wird.
		public override void getBattlecryEffect(Playfield p, Minion own, Minion target, int choice)
		{
            int anz = 3;
            for (int i = 0; i < anz; i++)
            {
                if (p.playerFirst.ownHero.Hp <= anz)
                {
                    p.minionGetDamageOrHeal(p.playerFirst.ownHero, 1);
                    continue;
                }
                List<Minion> temp = new List<Minion>(p.playerSecond.ownMinions);
                if (temp.Count == 0)
                {
                    temp.AddRange(p.playerFirst.ownMinions);
                }
                temp.Sort((a, b) => a.Hp.CompareTo(b.Hp));//destroys the weakest

                foreach (Minion m in temp)
                {
                    p.minionGetDamageOrHeal(m, 1);
                    break;
                }
                p.minionGetDamageOrHeal(p.playerSecond.ownHero, 1);
            }
		}
Esempio n. 32
0
        private void updateHandcards(HRSim.Playfield p, bool own)
        {
            HRSim.Player mPlayer, ePlayer;
            if (own)
            {
                mPlayer = p.playerFirst;
                ePlayer = p.playerSecond;
            }
            else
            {
                mPlayer = p.playerSecond;
                ePlayer = p.playerFirst;
            }

            this.handCards.Clear();
            this.anzcards = 0;
            this.anzcards = mPlayer.owncards.Count;
            foreach (HRSim.Handmanager.Handcard hc in mPlayer.owncards)
            {
                Handmanager.Handcard mHandcard = new Handmanager.Handcard(hc);
                this.handCards.Add(mHandcard);
            }
            enemyAnzCards = ePlayer.owncards.Count;
        }
Esempio n. 33
0
        //private static Silverfish instance;

        public override void updateState(HRSim.Playfield playfield)
        {
            this.updateEverything(playfield, playfield.isOwnTurn);
        }
Esempio n. 34
0
        public void updateHeroStuff(HRSim.Playfield p, bool own)
        {
            HRSim.Player mPlayer, ePlayer;
            if (own)
            {
                mPlayer = p.playerFirst;
                ePlayer = p.playerSecond;
            }
            else
            {
                mPlayer = p.playerSecond;
                ePlayer = p.playerFirst;
            }

            int ownheroentity   = mPlayer.ownHero.entitiyID;
            int enemyheroentity = ePlayer.ownHero.entitiyID;

            this.ownHero   = new Minion(mPlayer.ownHero);
            this.enemyHero = new Minion(ePlayer.ownHero);

            this.currentMana  = mPlayer.mana;
            this.ownMaxMana   = mPlayer.ownMaxMana;
            this.enemyMaxMana = ePlayer.ownMaxMana;

            //secret
            this.ownSecretList = new List <string>();
            foreach (CardDB.cardIDEnum cardIDenum in mPlayer.ownSecretsIDList)
            {
                this.ownSecretList.Add(cardIDenum.ToString());
            }
            enemySecretCount = ePlayer.ownSecretsIDList.Count;

            //minions
            this.numMinionsPlayedThisTurn = mPlayer.mobsplayedThisTurn;
            this.cardsPlayedThisTurn      = mPlayer.cardsPlayedThisTurn;
            //ueberladung = TritonHs.RecallOwed;

            //get weapon stuff
            this.ownHeroWeapon        = mPlayer.ownWeaponName.ToString();
            this.heroWeaponAttack     = mPlayer.ownWeaponAttack;
            this.heroWeaponDurability = mPlayer.ownWeaponDurability;

            this.ownHeroFatigue   = mPlayer.ownHeroFatigue;
            this.enemyHeroFatigue = ePlayer.ownHeroFatigue;

            //this.ownDecksize = mPlayer.ownDeckSize;
            //this.enemyDecksize = ePlayer.ownDeckSize;

            //own hero stuff###########################
            int heroAtk     = mPlayer.ownHero.Angr;
            int heroHp      = mPlayer.ownHero.Hp;
            int heroDefence = mPlayer.ownHero.armor;

            this.heroname = "mage"; //hard coded
            //this.heroname = "warlock"; //hard coded

            //enmey weapon hardcoded for mage
            this.enemyHeroname = "mage";
            //this.enemyHeroname = "warlock";
            this.enemyHeroWeapon       = ePlayer.ownWeaponName.ToString();
            this.enemyWeaponAttack     = ePlayer.ownWeaponAttack;
            this.enemyWeaponDurability = ePlayer.ownWeaponDurability;

            //own hero ablity stuff###########################################################
            //hard coded for mage

            this.heroAbility = CardDB.Instance.getCardData(CardDB.Instance.cardNamestringToEnum("fireblast"));
            //this.heroAbility =
            //    CardDB.Instance.getCardData(CardDB.Instance.cardNamestringToEnum("lifetap"));
            this.ownAbilityisReady = mPlayer.ownAbilityReady;
            this.enemyAbility      = CardDB.Instance.getCardData(CardDB.Instance.cardNamestringToEnum("fireblast"));
            //this.enemyAbility =
            //    CardDB.Instance.getCardData(CardDB.Instance.cardNamestringToEnum("lifetap"));

            //generate Heros
            this.ownHero         = new Minion(mPlayer.ownHero);
            this.enemyHero       = new Minion(ePlayer.ownHero);
            this.enemyHero.Ready = false;

            this.ownHero.updateReadyness();

            //load enchantments of the heros
            //How to do this?

            //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;
            }
        }
Esempio n. 35
0
        public bool updateEverything(HRSim.Playfield mp, bool own)
        {
            //HRSim.Helpfunctions.Instance.startTimer();
            HRSim.Player mPlayer, ePlayer;
            if (own)
            {
                mPlayer = mp.playerFirst;
                ePlayer = mp.playerSecond;
            }
            else
            {
                mPlayer = mp.playerSecond;
                ePlayer = mp.playerFirst;
            }

            this.updateBehaveString(botbase);

            updateHeroStuff(mp, own);
            updateMinions(mp, own);
            updateHandcards(mp, own);
            updateDecks(mp, own);

            // send ai the data:
            Hrtprozis.clearAll();
            Handmanager.clearAll();

            Hrtprozis.setOwnPlayer(mPlayer.ownController);
            Handmanager.setOwnPlayer(mPlayer.ownController);

            this.numOptionPlayedThisTurn  = 0;
            this.numOptionPlayedThisTurn += this.cardsPlayedThisTurn + this.ownHero.numAttacksThisTurn;
            foreach (Minion m in this.ownMinions)
            {
                if (m.Hp >= 1)
                {
                    this.numOptionPlayedThisTurn += m.numAttacksThisTurn;
                }
            }

            Hrtprozis.updatePlayer(this.ownMaxMana, this.currentMana, this.cardsPlayedThisTurn,
                                   this.numMinionsPlayedThisTurn, this.numOptionPlayedThisTurn, this.ueberladung, mPlayer.ownHero.entitiyID,
                                   mp.playerSecond.ownHero.entitiyID);
            Hrtprozis.updateSecretStuff(this.ownSecretList, this.enemySecretCount);

            Hrtprozis.updateOwnHero(this.ownHeroWeapon, this.heroWeaponAttack, this.heroWeaponDurability,
                                    this.heroname, this.heroAbility, this.ownAbilityisReady, this.ownHero);
            Hrtprozis.updateEnemyHero(this.enemyHeroWeapon, this.enemyWeaponAttack, this.enemyWeaponDurability,
                                      this.enemyHeroname, this.enemyMaxMana, this.enemyAbility, this.enemyHero);

            Hrtprozis.updateMinions(this.ownMinions, this.enemyMinions);
            Handmanager.setHandcards(this.handCards, this.anzcards, this.enemyAnzCards);

            Hrtprozis.updateFatigueStats(this.ownDecksize, this.ownHeroFatigue, this.enemyDecksize,
                                         this.enemyHeroFatigue);

            Hrtprozis.updateMaxEntity(mp.getNextEntity()); //change here!!

            Probabilitymaker.getEnemySecretGuesses(this.enemySecretList,
                                                   Hrtprozis.enemyHeroStartClass);
            //learnmode :D
            //HRSim.Helpfunctions.Instance.logTime("start to finish update");

            Playfield p = new Playfield(this);

            if (lastpf != null)
            {
                if (lastpf.isEqualf(p))
                {
                    return(false);
                }

                //board changed we update secrets!
                //if(Ai.nextMoveGuess!=null) Probabilitymaker.Instance.updateSecretList(Ai.nextMoveGuess.enemySecretList);
                Probabilitymaker.updateSecretList(p, lastpf);
                lastpf = p;
            }
            else
            {
                lastpf = p;
            }

            p = new Playfield(this); //secrets have updated :D

            p.printBoard();

            // calculate stuff
            HRSim.Helpfunctions.Instance.ErrorLog("calculating stuff... " + DateTime.Now.ToString("HH:mm:ss.ffff"));
            //if (runExtern)
            //{
            //    HRSim.Helpfunctions.Instance.logg("recalc-check###########");
            //    if (p.isEqual(Ai.nextMoveGuess, true))
            //    {
            //        //printstuff(false);
            //        Debug.WriteLine("equal");
            //        Ai.doNextCalcedMove();
            //    }
            //    else
            //    {
            //        //printstuff(true);
            //        Debug.WriteLine("not equal");
            //        //readActionFile(passiveWait);
            //    }
            //}
            //else
            //{
            // Drew: This prevents the freeze during AI updates, but no API functions may be called
            // during this time!
            //using (TritonHs.Memory.ReleaseFrame(true))
            //{
            //    printstuff(false);
            Ai.dosomethingclever(botbase);
            //}
            //}
            //HRSim.Helpfunctions.Instance.logTime("end of do sth clever");

            //Ai.bestmove = Movegenerator.getRandomMove(new Playfield(p), true, false, true);

            HRSim.Helpfunctions.Instance.ErrorLog("calculating ended! " + DateTime.Now.ToString("HH:mm:ss.ffff"));
            return(true);
        }
Esempio n. 36
0
        private void updateDecks(HRSim.Playfield p, bool own)
        {
            HRSim.Player mPlayer, ePlayer;
            if (own)
            {
                mPlayer = p.playerFirst;
                ePlayer = p.playerSecond;
            }
            else
            {
                mPlayer = p.playerSecond;
                ePlayer = p.playerFirst;
            }

            List <CardDB.cardIDEnum> ownCards   = new List <CardDB.cardIDEnum>();
            List <CardDB.cardIDEnum> enemyCards = new List <CardDB.cardIDEnum>();
            List <GraveYardItem>     graveYard  = new List <GraveYardItem>();

            //own hands
            foreach (HRSim.Handmanager.Handcard c in mPlayer.owncards)
            {
                CardDB.cardIDEnum mCardID = (CardDB.cardIDEnum)Enum.Parse(typeof(CardDB.cardIDEnum), c.card.cardIDenum.ToString());
                ownCards.Add(mCardID);
            }
            //own minions
            foreach (HRSim.Minion m in mPlayer.ownMinions)
            {
                CardDB.cardIDEnum mCardID = (CardDB.cardIDEnum)Enum.Parse(typeof(CardDB.cardIDEnum), m.handcard.card.cardIDenum.ToString());
                ownCards.Add(mCardID);
            }
            //own secret
            foreach (HRSim.CardDB.cardIDEnum c in mPlayer.ownSecretsIDList)
            {
                CardDB.cardIDEnum mCardID = (CardDB.cardIDEnum)Enum.Parse(typeof(CardDB.cardIDEnum), c.ToString());
                ownCards.Add(mCardID);
            }
            //own weapon
            CardDB.cardName weaponName = (CardDB.cardName)Enum.Parse(typeof(CardDB.cardName), mPlayer.ownWeaponName.ToString());
            ownCards.Add(CardDB.Instance.getCardData(weaponName).cardIDenum);

            //playerSecond.own minions
            foreach (HRSim.Minion m in p.playerSecond.ownMinions)
            {
                Minion mMinion = new Minion(m);
                ownCards.Add(mMinion.handcard.card.cardIDenum);
            }
            //playerSecond.own weapon
            weaponName = (CardDB.cardName)Enum.Parse(typeof(CardDB.cardName), p.playerSecond.ownWeaponName.ToString());
            ownCards.Add(CardDB.Instance.getCardData(weaponName).cardIDenum);

            //grave yard
            foreach (HRSim.GraveYardItem g in p.graveYard)
            {
                CardDB.cardIDEnum graveCardID = (CardDB.cardIDEnum)Enum.Parse(typeof(CardDB.cardIDEnum), g.cardid.ToString());
                GraveYardItem     mGraveItem  = new GraveYardItem(graveCardID, g.entity, g.own);
                graveYard.Add(mGraveItem);
            }

            Probabilitymaker.setOwnCards(ownCards);
            Probabilitymaker.setEnemyCards(enemyCards);
            bool isTurnStart = false;

            if (Ai.nextMoveGuess.mana == -100)
            {
                isTurnStart = true;
                Ai.updateTwoTurnSim();
            }
            Probabilitymaker.setGraveYard(graveYard, isTurnStart);
        }