コード例 #1
0
            public override StateIDs Update()
            {
                //FIGHTING?
                if (IsCombatViable())
                {
                    return(StateIDs.Combat);
                }

                if (Grunt.Self.Gold < 2)
                {
                    return(StateIDs.Mining);
                }

                if (Grunt.Self.MineRatio == 0) //nothing to lose
                {
                    return(StateIDs.Mining);
                }

                if (Grunt.Self.Life < START_MINING_HEALTH)
                {
                    return(StateIDs.Drinking);
                }

                if (!Grunt.IsThreatened(5))
                {
                    return(StateIDs.Mining);
                }

                return(StateIDs.Drinking);
            }
コード例 #2
0
            public override StateIDs Update()
            {
                //FIGHTING?
                if (IsCombatViable())
                {
                    return(StateIDs.Combat);
                }

                //DRINKING?
                if (Grunt.Self.Gold > 2 && Grunt.Self.MineRatio > 0) //somethign to lose & can afford beer?
                {
                    float hpAtNextMine = Grunt.Self.Life - Grunt.DistanceToNextMine();
                    if ((Grunt.IsWinning() && Grunt.IsThreatened(5)) || Grunt.IsThreatened(3))
                    {
                        return(StateIDs.Drinking);
                    }

                    if (Grunt.Self.MineRatio > 0 && hpAtNextMine <= START_DRINKING_HEALTH)
                    {
                        return(StateIDs.Drinking);
                    }
                }
                return(StateIDs.Mining);
            }