Example #1
0
        public RockSpitAction(BattleEntity user, BattleEntity entityUsed) : base(user)
        {
            Name = "Rock Spit";

            //Gulpits shouldn't use this move to begin with if there are no usable entities available, so this must be valid
            IUsableEntity usableEntity = (IUsableEntity)entityUsed;

            //NOTE: As an idea, this can perhaps add the charge of the usable entity to the damage; something to consider
            MoveInfo = new MoveActionData(null, "Spit a rock at an enemy.", MoveResourceTypes.FP, 0, CostDisplayTypes.Shown,
                                          MoveAffectionTypes.Other, Enumerations.EntitySelectionType.Single, true, null, User.GetOpposingEntityType());
            DamageInfo = new DamageData(usableEntity.UsableValue, Elements.Normal, false, ContactTypes.None, ContactProperties.Ranged,
                                        null, false, false, DefensiveActionTypes.None, DamageEffects.None);

            SetMoveSequence(new RockSpitSequence(this, entityUsed));
        }
Example #2
0
        public override void PerformAction()
        {
            //Try to use an item; if so, return
            if (TryUseItem() == true)
            {
                return;
            }

            //If any IUsableEntities are found in the Neutral BattleEntity list, perform Rock Spit with it
            //Otherwise, perform Lick
            List <BattleEntity> usableEntities = new List <BattleEntity>();

            int chosenIndex = -1;

            //Get all Neutral entities
            Enemy.BManager.GetEntities(usableEntities, Enumerations.EntityTypes.Neutral, Enumerations.HeightStates.Grounded);
            for (int i = 0; i < usableEntities.Count; i++)
            {
                IUsableEntity usableEntity = usableEntities[i] as IUsableEntity;
                //Remove from the list if this entity is not usable
                if (usableEntity == null)
                {
                    usableEntities.RemoveAt(i);
                    i--;
                }
            }

            //Choose a random entity out of the ones we found
            if (usableEntities.Count > 0)
            {
                chosenIndex = RandomGlobals.Randomizer.Next(0, usableEntities.Count);
            }

            //If we found and chose a usable entity, use Rock Spit with the entity
            //Otherwise, use Lick
            MoveAction action = null;

            if (chosenIndex >= 0)
            {
                action = new RockSpitAction(Enemy, usableEntities[chosenIndex]);
            }
            else
            {
                action = new LickAction(Enemy);
            }

            Enemy.StartAction(action, false, Enemy.BManager.FrontPlayer.GetTrueTarget());
        }
        public override void PerformAction()
        {
            //If any IUsableEntities are found in the Neutral BattleEntity list, perform Rock Spit with it
            //Otherwise, perform Lick
            List <BattleEntity> usableEntities = new List <BattleEntity>();

            int chosenIndex = -1;

            //Get all Neutral entities
            BattleEntity[] neutralEntities = BattleManager.Instance.GetEntities(Enumerations.EntityTypes.Neutral, Enumerations.HeightStates.Grounded);
            for (int i = 0; i < neutralEntities.Length; i++)
            {
                IUsableEntity usableEntity = neutralEntities[i] as IUsableEntity;
                //Add to the list if this entity is usable
                if (usableEntity != null)
                {
                    usableEntities.Add(neutralEntities[i]);
                }
            }

            //Choose a random entity out of the ones we found
            if (usableEntities.Count > 0)
            {
                chosenIndex = GeneralGlobals.Randomizer.Next(0, usableEntities.Count);
            }

            //If we found and chose a usable entity, use Rock Spit with the entity
            //Otherwise, use Lick
            MoveAction action = null;

            if (chosenIndex >= 0)
            {
                action = new RockSpitAction(usableEntities[chosenIndex]);
            }
            else
            {
                action = new LickAction();
            }

            Enemy.StartAction(action, false, BattleManager.Instance.GetFrontPlayer().GetTrueTarget());
        }