Beispiel #1
0
        public static TyState FromSimulatedGame(POGame.POGame newState, Controller me, PlayerTask task)
        {
            TyState s = new TyState
            {
                HeroHealth = me.Hero.Health,
                HeroArmor  = me.Hero.Armor,

                TurnNumber = newState.Turn,

                NumDeckCards      = me.DeckZone.Count,
                NumHandCards      = me.HandZone.Count,
                NumMinionsOnBoard = me.BoardZone.Count,

                Fatigue      = me.Hero.Fatigue,
                MinionValues = TyMinionUtil.ComputeMinionValues(me)
            };

            if (me.Hero.Weapon != null)
            {
                s.WeaponDurability = me.Hero.Weapon.Durability;
                s.WeaponDamage     = me.Hero.Weapon.AttackDamage;
            }

            //this case is met, if the player uses a card that temporarily boosts attack:
            if (me.Hero.TotalAttackDamage > s.WeaponDamage)
            {
                s.WeaponDamage = me.Hero.TotalAttackDamage;

                //assume that the player can at least attack once:
                if (s.WeaponDurability == 0)
                {
                    s.WeaponDurability = 1;
                }
            }

            //aka, can't attack:
            if (me.Hero.IsFrozen)
            {
                s.WeaponDamage = 0;
            }

            var minion = task.TryGetMinion();

            if (minion != null)
            {
                //give reward/punishment of minions cost less/more than usual:
                float diff = (float)minion.Card.Cost - (float)minion.Cost;
                s.BiasValue += diff * 1.5f;
            }

            return(s);
        }