public BattleCommand GetNextAction(Player[] party, Enemy[] allies, ElementType[] fieldEffect)
        {
            if (pressTheAdvantage.CanUse(fieldEffect))
            {
                var target = new Target { TheTarget = BehaviorHelpers.GetStrongestTarget(party), TargetType = TargetTypes.Single };

                return CreateBattleCommand(target, pressTheAdvantage, CommandType.Ability);
            }

            if ((me.CurrentHP / (decimal)me.MaxHP) <= .5m && solarBeam.CanUse(fieldEffect))
            {
                var target = new Target { TheTarget = BehaviorHelpers.GetWeakestTarget(party), TargetType = TargetTypes.Single };

                return CreateBattleCommand(target, solarBeam, CommandType.Ability);
            }

            if (party.All(p => !p.IsDead) && cleave.CanUse(fieldEffect))
            {
                var target = new Target { TargetType = TargetTypes.All };

                return CreateBattleCommand(target, cleave, CommandType.Ability);
            }

            if (sliceAndDice.CanUse(fieldEffect))
            {
                var target = new Target { TheTarget = BehaviorHelpers.GetRandomTarget(party), TargetType = TargetTypes.Single };

                return CreateBattleCommand(target, sliceAndDice, CommandType.Ability);
            }

            return CreateBattleCommand(new Target { TheTarget = BehaviorHelpers.GetRandomTarget(party), TargetType = TargetTypes.Single },
                                       Ability.ATTACK,
                                       CommandType.Attack);
        }
        public RimuldarGeneralBehavior(Enemy owner)
        {
            me = owner;

            pressTheAdvantage = me.EquippedFinishers.FirstOrDefault(a => a.Name == "Press the Advantage");
            solarBeam = me.EquippedAbilities.FirstOrDefault(a => a.Name == "Solar Beam");
            cleave = me.EquippedAbilities.FirstOrDefault(a => a.Name == "Cleave");
            sliceAndDice = me.EquippedAbilities.FirstOrDefault(a => a.Name == "Slice & Dice");

            // The general can use the solar beam ability every other turn
            solarBeam.Cooldown = 1;
        }
Exemple #3
0
        /// <summary>
        /// This will create a separate instance for use in battle
        /// </summary>		
        public Enemy(Enemy toClone)
            : this(toClone.Name, toClone.MaxHP)
        {
            this.Sprite = toClone.Sprite;

            this.Speed = toClone.Speed;
            this.Strength = toClone.Strength;
            this.Experience = toClone.Experience;
            this.Gold = toClone.Gold;
            this.BehaviorType = toClone.BehaviorType;

            if (toClone.EquippedAbilities != null)
                this.EquippedAbilities = toClone.EquippedAbilities.Select(a => a.Clone()).ToArray();

            if (toClone.EquippedFinishers != null)
                this.EquippedFinishers = toClone.EquippedFinishers.Select(a => a.Clone()).ToArray();

            CreateBehavior();
        }