Example #1
0
        public override void OnDamage(int amount, Mobile from, bool willKill)
        {
            base.OnDamage(amount, from, willKill);

            if (from == null && ((from = Combatant) == null))
            {
                return;
            }

            if (0.5 > Utility.RandomDouble())
            {
                Point3D loc = from.Location;

                // Throw a bottle!
                Effects.SendMovingParticles(this, from, 0x1C19, 10, 0, false, false, 0x1395, 1, 0xFFFF);

                Timer.DelayCall(TimeSpan.FromSeconds(1.0), new TimerCallback(
                                    delegate
                {
                    if (from.Map == null)
                    {
                        return;
                    }

                    switch (Utility.Random(3))
                    {
                    case 0:                                     // The bottle was empty
                        {
                            from.PlaySound(0x3F);
                            AOS.Damage(from, this, Utility.RandomMinMax(5, 10), 100, 0, 0, 0, 0);

                            break;
                        }

                    case 1:                                     // Supernova Potion
                        {
                            Effects.PlaySound(loc, from.Map, 0x11D);

                            List <Mobile> targets = new List <Mobile>();

                            foreach (Mobile target in from.Map.GetMobilesInRange(loc, 2))
                            {
                                if (target is GreenGoblinAlchemist)
                                {
                                    continue;
                                }

                                targets.Add(target);
                            }

                            for (int i = 0; i < targets.Count; i++)
                            {
                                Mobile target = targets[i];

                                AOS.Damage(target, this, Utility.RandomMinMax(45, 55), 0, 100, 0, 0, 0);
                            }

                            for (int x = -2; x <= 2; x++)
                            {
                                for (int y = -2; y <= 2; y++)
                                {
                                    Point3D p = new Point3D(loc.X + x, loc.Y + y, loc.Z);
                                    int dist  = (int)Math.Round(Utility.GetDistanceToSqrt(loc, p));

                                    if (dist <= 2)
                                    {
                                        Timer.DelayCall(TimeSpan.FromSeconds(0.2 * dist), new TimerCallback(
                                                            delegate
                                        {
                                            Effects.SendPacket(loc, from.Map, new HuedEffect(EffectType.FixedXYZ, Serial.Zero, Serial.Zero, 0x3709, p, p, 20, 30, true, false, 1502, 4));
                                        }
                                                            ));
                                    }
                                }
                            }

                            break;
                        }

                    case 2:                                     // Acid potion
                        {
                            Effects.SendTargetParticles(from, 0x374A, 1, 10, 0x557, 0, 0x139D, EffectLayer.Waist, 0);

                            from.PlaySound(0x22F);
                            from.SendLocalizedMessage(1077483);                                               // The acid burns you!

                            AcidTimer timer = new AcidTimer(from);
                            timer.Start();

                            break;
                        }
                    }
                }));
            }
        }
 public static Composite WitchDoctorCombat()
 {
     return(new PrioritySelector(CtxChanger,
                                 new Decorator(
                                     ctx =>
                                     ctx is CombatContext &&
                                     ((CombatContext)ctx).CurrentTarget != null,
                                     new PrioritySelector(
                                         Common.CreateUsePotion(),
                                         Common.CreateWaitWhileFearedStunnedFrozenOrBlind(),
                                         Common.CreateGetHealthGlobe(),
                                         Common.CreateUseHealthWell(),
                                         Common.CreateWaitForAttack(),
                                         Kiting.CreateKitingBehavior(),
                                         // Make sure we are within range/line of sight of the unit.
                                         Movement.MoveTo(ctx => ((CombatContext)ctx).TargetPosition,
                                                         BelphegorSettings.Instance.WitchDoctor.MaximumRange),
                                         new SelfCast(SNOPower.Witchdoctor_SpiritWalk,
                                                      extra =>
                                                      ((CombatContext)extra).CurrentHealthPercentage <=
                                                      BelphegorSettings.Instance.WitchDoctor.SpiritWalkHp),
                                         new SelfCast(SNOPower.Witchdoctor_Sacrifice,
                                                      ctx => Minion.PetCount(((CombatContext)ctx), Pet.ZombieDogs) > 1 &&
                                                      ((CombatContext)ctx).CurrentHealthPercentage <=
                                                      BelphegorSettings.Instance.WitchDoctor.SacrificeHp),
                                         new SelfCast(SNOPower.Witchdoctor_Hex),
                                         new SelfCast(SNOPower.Witchdoctor_SoulHarvest,
                                                      ctx =>
                                                      Clusters.GetClusterCount(ZetaDia.Me, ((CombatContext)ctx), 16f) >=
                                                      BelphegorSettings.Instance.WitchDoctor.SoulHarvestAoECount ||
                                                      (((CombatContext)ctx).CurrentTargetIsElite &&
                                                       ((CombatContext)ctx).TargetDistance < 16f)),
                                         new CastAtLocation(SNOPower.Witchdoctor_Piranhas, ctx => ((CombatContext)ctx).TargetPosition,
                                                            ctx =>
                                                            ((CombatContext)ctx).CurrentTargetIsElite ||
                                                            Clusters.GetClusterCount(((CombatContext)ctx).CurrentTarget, ((CombatContext)ctx), 10f) >=
                                                            BelphegorSettings.Instance.WitchDoctor.PiranhasAoECount),
                                         new SelfCast(SNOPower.Witchdoctor_BigBadVoodoo,
                                                      ctx =>
                                                      Clusters.GetClusterCount(
                                                          ((CombatContext)ctx).CurrentTarget,
                                                          ((CombatContext)ctx), 40f) >=
                                                      BelphegorSettings.Instance.WitchDoctor.BigBadVoodooAoECount ||
                                                      ((CombatContext)ctx).CurrentTargetIsElite),
                                         new SelfCast(SNOPower.Witchdoctor_FetishArmy,
                                                      ctx =>
                                                      Clusters.GetClusterCount(
                                                          ((CombatContext)ctx).CurrentTarget,
                                                          ((CombatContext)ctx), 40f) >=
                                                      BelphegorSettings.Instance.WitchDoctor.FetishArmyAoECount ||
                                                      ((CombatContext)ctx).CurrentTargetIsElite),
                                         new SelfCast(SNOPower.Witchdoctor_Horrify,
                                                      extra =>
                                                      Clusters.GetClusterCount(
                                                          ((CombatContext)extra).CurrentTarget,
                                                          ((CombatContext)extra), 40f) >=
                                                      BelphegorSettings.Instance.WitchDoctor.HorrifyAoECount),
                                         new CastOnUnit(SNOPower.Witchdoctor_MassConfusion,
                                                        ctx => ((CombatContext)ctx).TargetGuid,
                                                        extra =>
                                                        Clusters.GetClusterCount(
                                                            ((CombatContext)extra).CurrentTarget,
                                                            ((CombatContext)extra), 40f) >=
                                                        BelphegorSettings.Instance.WitchDoctor.
                                                        MassConfusionAoECount),
                                         new CastOnUnit(SNOPower.Witchdoctor_GraspOfTheDead,
                                                        ctx => ((CombatContext)ctx).TargetGuid),
                                         new CastAtLocation(SNOPower.Witchdoctor_AcidCloud,
                                                            ctx => ((CombatContext)ctx).TargetPosition,
                                                            ctx =>
                                                            AcidTimer.IsFinished &&
                                                            Clusters.GetClusterCount(
                                                                ((CombatContext)ctx).CurrentTarget,
                                                                ((CombatContext)ctx), 18f) >=
                                                            BelphegorSettings.Instance.WitchDoctor.
                                                            AcidCloudAoECount,
                                                            s => AcidTimer.Reset()),
                                         new CastAtLocation(SNOPower.Witchdoctor_Firebats,
                                                            ctx => ((CombatContext)ctx).TargetPosition,
                                                            extra =>
                                                            Clusters.GetClusterCount(
                                                                ((CombatContext)extra).CurrentTarget,
                                                                ((CombatContext)extra), 40f) >=
                                                            BelphegorSettings.Instance.WitchDoctor.
                                                            FirebatsAoECount),
                                         new CastAtLocation(SNOPower.Witchdoctor_WallOfZombies,
                                                            ctx => ((CombatContext)ctx).TargetPosition,
                                                            extra =>
                                                            Clusters.GetClusterCount(
                                                                ((CombatContext)extra).CurrentTarget,
                                                                ((CombatContext)extra), 40f) >=
                                                            BelphegorSettings.Instance.WitchDoctor.
                                                            WallOfZombiesAoECount),
                                         new CastOnUnit(SNOPower.Witchdoctor_Locust_Swarm,
                                                        ctx => ((CombatContext)ctx).TargetGuid,
                                                        ctx =>
                                                        LocustSwarmTimer.IsFinished &&
                                                        ((CombatContext)ctx).TargetDistance < 16 &&
                                                        ((CombatContext)ctx).CurrentTargetIsElite ||
                                                        Clusters.GetClusterCount(
                                                            ((CombatContext)ctx).CurrentTarget,
                                                            ((CombatContext)ctx), 20) >=
                                                        BelphegorSettings.Instance.WitchDoctor.
                                                        LocustSwarmAoECount,
                                                        s => LocustSwarmTimer.Reset()),
                                         new CastOnUnit(SNOPower.Witchdoctor_Haunt,
                                                        ctx => ((CombatContext)ctx).TargetGuid,
                                                        extra => HauntTimer.IsFinished, s => HauntTimer.Reset()),
                                         //Other spells
                                         new CastOnUnit(SNOPower.Witchdoctor_SpiritBarrage,
                                                        ctx => ((CombatContext)ctx).TargetGuid),
                                         new CastOnUnit(SNOPower.Witchdoctor_ZombieCharger,
                                                        ctx => ((CombatContext)ctx).TargetGuid),
                                         //Primary
                                         new CastAtLocation(SNOPower.Witchdoctor_PlagueOfToads,
                                                            ctx => ((CombatContext)ctx).TargetPosition),
                                         new CastAtLocation(SNOPower.Witchdoctor_CorpseSpider,
                                                            ctx => ((CombatContext)ctx).TargetPosition),
                                         new CastOnUnit(SNOPower.Witchdoctor_Firebomb,
                                                        ctx => ((CombatContext)ctx).TargetGuid),
                                         new CastOnUnit(SNOPower.Witchdoctor_PoisonDart,
                                                        ctx => ((CombatContext)ctx).TargetGuid)
                                         )
                                     ),
                                 new Action(ret => RunStatus.Success)
                                 ));
 }
        public override void OnDamage( int amount, Mobile from, bool willKill )
        {
            base.OnDamage( amount, from, willKill );

            if ( from == null && ( ( from = Combatant ) == null ) )
                return;

            if ( 0.5 > Utility.RandomDouble() )
            {
                Point3D loc = from.Location;

                // Throw a bottle!
                Effects.SendMovingParticles( this, from, 0x1C19, 10, 0, false, false, 0x1395, 1, 0xFFFF );

                Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerCallback(
                    delegate
                    {
                        if ( from.Map == null )
                            return;

                        switch ( Utility.Random( 3 ) )
                        {
                            case 0: // The bottle was empty
                                {
                                    from.PlaySound( 0x3F );
                                    AOS.Damage( from, this, Utility.RandomMinMax( 5, 10 ), 100, 0, 0, 0, 0 );

                                    break;
                                }
                            case 1: // Supernova Potion
                                {
                                    Effects.PlaySound( loc, from.Map, 0x11D );

                                    List<Mobile> targets = new List<Mobile>();

                                    foreach ( Mobile target in from.Map.GetMobilesInRange( loc, 2 ) )
                                    {
                                        if ( target is GreenGoblinAlchemist )
                                            continue;

                                        targets.Add( target );
                                    }

                                    for ( int i = 0; i < targets.Count; i++ )
                                    {
                                        Mobile target = targets[i];

                                        AOS.Damage( target, this, Utility.RandomMinMax( 45, 55 ), 0, 100, 0, 0, 0 );
                                    }

                                    for ( int x = -2; x <= 2; x++ )
                                    {
                                        for ( int y = -2; y <= 2; y++ )
                                        {
                                            Point3D p = new Point3D( loc.X + x, loc.Y + y, loc.Z );
                                            int dist = (int) Math.Round( Utility.GetDistanceToSqrt( loc, p ) );

                                            if ( dist <= 2 )
                                            {
                                                Timer.DelayCall( TimeSpan.FromSeconds( 0.2 * dist ), new TimerCallback(
                                                    delegate
                                                    {
                                                        Effects.SendPacket( loc, from.Map, new HuedEffect( EffectType.FixedXYZ, Serial.Zero, Serial.Zero, 0x3709, p, p, 20, 30, true, false, 1502, 4 ) );
                                                    }
                                                ) );
                                            }
                                        }
                                    }

                                    break;
                                }
                            case 2: // Acid potion
                                {
                                    Effects.SendTargetParticles( from, 0x374A, 1, 10, 0x557, 0, 0x139D, EffectLayer.Waist, 0 );

                                    from.PlaySound( 0x22F );
                                    from.SendLocalizedMessage( 1077483 ); // The acid burns you!

                                    AcidTimer timer = new AcidTimer( from );
                                    timer.Start();

                                    break;
                                }
                        }
                    } ) );
            }
        }