public BattleEvent(Character user, BattleAction action, Character target, int damage)
        {
            /* start constructor */

            mUser = user;
            mAction = action;
            mTarget = target;
            mDamage = damage;
        }
Beispiel #2
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);
        }
Beispiel #3
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);
        }