示例#1
0
        public override BattleAction ai(Party goodGuys)
        {
            /* start ai */

            Random random = new Random();
            int target = random.Next( goodGuys.Size );

            while( goodGuys.getCharacter(target).isDead )
                target = random.Next(goodGuys.Size);

            return new AttackAction(goodGuys.getCharacter(target));
        }
        public override BattleAction ai(Party goodGuys)
        {
            /* start ai */

            Random random = new Random();
            int i;
            Character target = null;

            /* Should modularize these loops */
            for (i = 0; i < goodGuys.Size; i++)
                if (((PlayerCharacter)goodGuys.getCharacter(i)).Class == ClassEnum.WHITEMAGE && !goodGuys.getCharacter(i).isDead)
                    target = goodGuys.getCharacter(i);

            if( target == null )
                for (i = 0; i < goodGuys.Size; i++)
                    if (((PlayerCharacter)goodGuys.getCharacter(i)).Class == ClassEnum.REDMAGE && !goodGuys.getCharacter(i).isDead)
                        target = goodGuys.getCharacter(i);

            if (target == null)
            {/* start if */

                target = goodGuys.getCharacter(random.Next(Party.MAXPARTY));

                while( target.isDead )
                    target = goodGuys.getCharacter(random.Next(Party.MAXPARTY));

            }/* end if */

            return new AttackAction(target);
        }
示例#3
0
        public override BattleEvent ai(Party goodGuys)
        {
            /* start ai */

            Random random = new Random();
            int target = random.Next( Party.MAXPARTY );
            BattleAction action = new BattleAction(ActionEnum.ATTACK, null);

            return new BattleEvent(mEnemy, action, goodGuys.getCharacter(target), 0);
        }
示例#4
0
        public override BattleEvent ai(Party goodGuys)
        {
            /* start ai */

            Character target = goodGuys.getCharacter(0);
            BattleAction action;
            int i;
            AbilitiesIterator abilities;
            Ability theAbility;

            if (mAbilities.Count != 0)
            {/* start if */

                abilities = getAbilities();
                theAbility = abilities.getAbilityAtIndex(0);

                foreach (Ability ability in abilities)
                    if (ability.AffectEnemy)
                        if (ability.BaseDamage > theAbility.BaseDamage)
                            theAbility = ability;

                for (i = 0; i < goodGuys.Size; i++)
                    if (goodGuys.getCharacter(i).CurrentHealth < target.CurrentHealth)
                        target = goodGuys.getCharacter(i);

                if (theAbility.Cost > mEnemy.CurrentMana)
                    action = new BattleAction(ActionEnum.ATTACK, null);
                else
                    action = new BattleAction(ActionEnum.ABILITY, theAbility);

            }/* end if */
            else
            {/* start else */

                action = new BattleAction(ActionEnum.ATTACK, null);

            }/* end else */

            return new BattleEvent(mEnemy, action, target, 0);
        }
        public override BattleEvent ai(Party goodGuys)
        {
            /* start ai */

            Random random = new Random();
            int i;
            Character target = null;
            BattleAction action = new BattleAction(ActionEnum.ATTACK, null);

            /* Should modularize these loops */
            for (i = 0; i < goodGuys.Size; i++)
                if (((PlayerCharacter)goodGuys.getCharacter(i)).Class == ClassEnum.WHITEMAGE)
                    target = goodGuys.getCharacter(i);

            if( target == null )
                for (i = 0; i < goodGuys.Size; i++)
                    if (((PlayerCharacter)goodGuys.getCharacter(i)).Class == ClassEnum.REDMAGE)
                        target = goodGuys.getCharacter(i);

            if (target == null)
                target = goodGuys.getCharacter(random.Next(Party.MAXPARTY));

            return new BattleEvent(mEnemy, action, target, 0);
        }
示例#6
0
        private Character[] getAliveCharacters(Party goodGuys)
        {
            /* start getAliveCharacters */

            int i, j, count = 0;
            Character[] alivePlayers;

            for (i = 0; i < goodGuys.Size; i++)
                if (!goodGuys.getCharacter(i).isDead)
                    count++;

            alivePlayers = new Character[count];

            for( i = 0,j = 0; i < goodGuys.Size; i++ )
                if (!goodGuys.getCharacter(i).isDead)
                {/* start if */

                    alivePlayers[j] = goodGuys.getCharacter(i);
                    j++;

                }/* end if */

            return alivePlayers;
        }
示例#7
0
        private Character getTarget(Party party, bool partyAlignment)
        {
            /* start getTarget */

            int i;
            bool dead = true;
            Character candidate = null;

            if (partyAlignment == GOODGUYS)
            {/* start if */

                Console.WriteLine("Who would you like to heal?");
                for (i = 0; i < party.Size; i++)
                    Console.WriteLine(i + ". " + party.getCharacter(i).Name + "-Health: " + party.getCharacter(i).CurrentHealth + " -Mana : " + party.getCharacter(i).CurrentMana);

                candidate = party.getCharacter(sanitizeInput( 0, party.Size - 1));

            }/* end if */
            else
            {/* start else */

                while (dead)
                {/* start loop */

                    Console.WriteLine("Who would you like to damage?");
                    for (i = 0; i < party.Size; i++)
                        if (!party.getCharacter(i).isDead)
                            Console.WriteLine(i + ". " + party.getCharacter(i).Name + "-Health: " + party.getCharacter(i).CurrentHealth + " -Mana : " + party.getCharacter(i).CurrentMana);

                    candidate = party.getCharacter(sanitizeInput(0, party.Size - 1));

                    dead = candidate.isDead;

                    if (dead)
                        Console.WriteLine("INVALID INPUT! Pick one that's alive!");

                }/* end loop */

            }/* end else */

            return candidate;
        }