public override void Update(AIEnemyHuman ai)
        {
            var attackZone = ai.GetAttackZone(new Vector2(20, 0), new Vector2(40, 30));

            if (!(ai.Target.Weapon is WeaponUnarmed) && !ai.IsAttacking() && IsInMeleeRange(ai, attackZone) && ai.AttackCooldown <= 0 && ai.Target.Invincibility < 3)
            {
                ai.Owner.Velocity.X += Math.Sign(ai.DifferenceVector.X) * 2;
                ai.CurrentAction     = new ActionStealWeapon(ai.Owner, ai.Target, 4, 8);
                ai.AttackCooldown    = 15;
            }
        }
Esempio n. 2
0
        public override void Update(AIEnemyHuman ai)
        {
            var attackZone = ai.GetAttackZone(new Vector2(20, 0), new Vector2(40, 30));

            if (!ai.IsAttacking() && ai.OnGround && IsInMeleeRange(ai, attackZone) && ai.AttackCooldown <= 0 && ai.Target.Invincibility < 3)
            {
                ai.Owner.Velocity.X += Math.Sign(ai.DifferenceVector.X) * 2;
                ai.CurrentAction     = new ActionTwohandSlash(ai.Owner, 3, 12, ai.Weapon);
                ai.AttackCooldown    = 30;
            }
        }
 public override void Update(AIEnemyHuman ai)
 {
     if (!ai.IsAttacking() && IsInRangedRange(ai) && ai.AttackCooldown <= 0 && ai.Target.Invincibility < 3)
     {
         var boomerang = ai.Weapon as WeaponBoomerang;
         ai.CurrentAction = new ActionBoomerangThrow(ai.Owner, 10, boomerang, 40)
         {
             Angle = VectorToAngle(ai.DifferenceVector)
         };
         ai.RangedCooldown = 60 + ai.Random.Next(40);
     }
 }
Esempio n. 4
0
        public override void Update(AIEnemyHuman ai)
        {
            var katana     = ai.Weapon as WeaponKatana;
            var attackZone = ai.GetAttackZone(new Vector2(20, 0), new Vector2(40, 30));

            if (katana.Sheathed && !ai.IsAttacking() && IsInMeleeRange(ai, attackZone) && ai.AttackCooldown <= 0 && ai.Target.Invincibility < 3)
            {
                ai.Owner.Velocity.X += Math.Sign(ai.DifferenceVector.X) * 2;
                ai.CurrentAction     = new ActionKatanaSlash(ai.Owner, 2, 4, 12, 4, katana);
                ai.AttackCooldown    = 30;
            }
        }
Esempio n. 5
0
 public override void Update(AIEnemyHuman ai)
 {
     if (!ai.IsAttacking() && IsInRangedRange(ai) && ai.AttackCooldown <= 0 && ai.Target.Invincibility < 3)
     {
         if (ai.OnGround)
         {
             ai.Owner.Velocity.Y = -5;
             ai.OnGround         = false;
         }
         ai.CurrentAction  = new ActionShockwave(ai.Owner, 4, 8, ai.Weapon, 2);
         ai.RangedCooldown = 60 + ai.Random.Next(40);
     }
 }
Esempio n. 6
0
 public override void Update(AIEnemyHuman ai)
 {
     if (!ai.IsAttacking() && IsInRangedRange(ai) && ai.AttackCooldown <= 0 && ai.Target.Invincibility < 3)
     {
         if (ai.OnGround)
         {
             ai.Owner.Velocity.Y = -2.5f;
             ai.OnGround         = false;
         }
         ai.CurrentAction  = new ActionDashAttack(ai.Owner, 2, 6, 2, 4, false, false, new ActionStab(ai.Owner, 4, 2, ai.Weapon));
         ai.AttackCooldown = 30;
     }
 }
Esempio n. 7
0
 public override void Update(AIEnemyHuman ai)
 {
     if (!ai.IsAttacking() && IsInRangedRange(ai) && ai.AttackCooldown <= 0 && ai.Target.Invincibility < 3)
     {
         if (ai.DifferenceVector.Y < 0)
         {
             ai.Owner.Velocity.Y = -4;
         }
         //if (ai.DifferenceVector.Y > 0)
         ai.CurrentAction  = new ActionKnifeThrow(ai.Owner, 2, 4, 8, 2, ai.Weapon);
         ai.RangedCooldown = 60 + ai.Random.Next(40);
     }
 }
        public override void Update(AIEnemyHuman ai)
        {
            var gauntlet = ai.Weapon as WeaponAlchemicalGauntlet;

            if (gauntlet.Orb is OrangeOrb && !ai.IsAttacking() && ai.AttackCooldown <= 0 && ai.Target.Invincibility < 3)
            {
                Bomb bomb = (Bomb)ai.Target.StatusEffects.Find(status => status is Bomb);
                if (bomb != null && bomb.Stacks >= bomb.StacksMax)
                {
                    ai.CurrentAction  = new ActionTransplantActivate(ai.Owner, 4, 6);
                    ai.AttackCooldown = 40;
                }
            }
        }
        public override void Update(AIEnemyHuman ai)
        {
            var gauntlet   = ai.Weapon as WeaponAlchemicalGauntlet;
            var attackZone = ai.GetAttackZone(new Vector2(20, 0), new Vector2(20, 30));

            if (gauntlet.Orb is OrangeOrb && !ai.IsAttacking() && IsInMeleeRange(ai, attackZone) && ai.AttackCooldown <= 0 && ai.Target.Invincibility < 3)
            {
                Bomb bomb = (Bomb)ai.Target.StatusEffects.Find(status => status is Bomb);
                if ((bomb != null && bomb.Stacks < bomb.StacksMax) || bomb == null)
                {
                    ai.CurrentAction  = new ActionTransplantPunch(ai.Owner, 4, 6, ai.Weapon);
                    ai.AttackCooldown = 20;
                }
            }
        }
Esempio n. 10
0
        public override void Update(AIEnemyHuman ai)
        {
            if (ai.CurrentAction is ActionWandBlast)
            {
                ai.AttackCooldown--;
            }

            var wand = ai.Weapon as WeaponWand;

            if (!ai.IsAttacking() && IsInRangedRange(ai) && ai.AttackCooldown <= 0 && ai.Target.Invincibility < 3)
            {
                ai.CurrentAction  = new ActionWandBlastHoming(ai.Owner, ai.Target, 24, 12, wand);
                ai.RangedCooldown = 60 + ai.Random.Next(40);
            }
        }
Esempio n. 11
0
        public override void Update(AIEnemyHuman ai)
        {
            var attackZone = ai.GetAttackZone(new Vector2(20, 0), new Vector2(40, 30));

            if (!ai.IsAttacking() && IsInMeleeRange(ai, attackZone) && ai.AttackCooldown <= 0 && ai.Target.Invincibility < 3)
            {
                ai.Owner.Velocity.X += Math.Sign(ai.DifferenceVector.X) * 2;

                ActionBase[] actionHolder =
                {
                    new ActionSlash(ai.Owner,   2, 4, 8, 2, ai.Weapon),
                    new ActionSlashUp(ai.Owner, 2, 4, 8, 2, ai.Weapon)
                };
                ai.CurrentAction  = actionHolder[ai.Random.Next(0, actionHolder.Length - 1)];
                ai.AttackCooldown = 30;
            }
        }
Esempio n. 12
0
        public override void Update(AIEnemyHuman ai)
        {
            var attackZone = ai.GetAttackZone(new Vector2(20, 0), new Vector2(40, 30));

            if (!ai.IsAttacking() && IsInMeleeRange(ai, attackZone) && ai.AttackCooldown <= 0 && ai.Target.Invincibility < 3)
            {
                if (ai.OnGround)
                {
                    ai.Owner.Velocity.X += GetFacingVector(ai.Owner.Facing).X * 0.75f;
                    ai.Owner.Velocity.Y  = -ai.Owner.GetJumpVelocity(8);
                    ai.OnGround          = false;
                }
                else
                {
                    ai.Owner.Velocity.X += GetFacingVector(ai.Owner.Facing).X * 0.5f;
                }
                ai.CurrentAction  = new ActionRapierThrust(ai.Owner, 4, 8, ai.Weapon);
                ai.AttackCooldown = 30;
            }
        }
Esempio n. 13
0
 public abstract void Update(AIEnemyHuman ai);
Esempio n. 14
0
 protected bool IsInMeleeRange(AIEnemyHuman ai, RectangleF attackZone)
 {
     return(ai.Target.Box.Bounds.Intersects(attackZone) && ai.ShouldUseMeleeAttack(ai.Target));
 }
Esempio n. 15
0
        protected bool IsInRangedRange(AIEnemyHuman ai)
        {
            var differenceVector = ai.Target.Position - ai.Position;

            return((Math.Abs(differenceVector.X) >= RangedMinRange || ai.ShouldUseRangedAttack(ai.Target)) && Math.Abs(differenceVector.X) <= RangedMaxRange);
        }