コード例 #1
0
    // Does a creature's combat turn
    private static void ActPermanent(CreatureStats permanent)
    {
        if (CanAttackAnything(permanent))
        {
            Attack(permanent);
            return;
        }


        if (permanent.CanMove())
        {
            int movesLeft = (int)permanent.Speed;

            for (int i = 0; i < movesLeft; i++)
            {
                if (CanAttackAnything(permanent))
                {
                    Attack(permanent);
                    return;
                }
                CreatureStats inFront = GetCreatureAt(permanent.GetForward());
                if (!inFront)
                {
                    Move(permanent);
                }
            }
        }
    }