Ejemplo n.º 1
0
        public override void Think()
        {
            // logic of the purros brain goes here.
            GamePurros pbody = Body as GamePurros;

            if (pbody.InCombat && !TimerOn)
            {
                new RegionTimer(Body, new RegionTimerCallback(PurroExplode), 5 * 1000);
                TimerOn = true;
            }

            base.Think();
        }
Ejemplo n.º 2
0
        public int PurroExplode(RegionTimer timer)
        {
            GamePurros pbody = Body as GamePurros;

            if (pbody.IsAlive && pbody.Health > 1)
            {
                int damageamount = (int)Math.Round((decimal)(pbody.MaxHealth - pbody.Health) / 2);
                GameZopureo.ZopureoChangeHealth(damageamount);

                // AOE Fire - This should probably be redone as a spell.
                ushort AOErange = 500;
                foreach (GamePlayer player in pbody.GetPlayersInRadius(AOErange)) // each player that is in attack distance of the mob
                {
                    if (GameServer.ServerRules.IsAllowedToAttack(pbody, player, true))
                    {
                        player.Out.SendMessage("The purros explodes in your face causing 300 damage!", eChatType.CT_Damaged, eChatLoc.CL_ChatWindow);
                        player.Out.SendSpellEffectAnimation(pbody, player, 310, 0, false, 1);
                        player.TakeDamage(pbody, eDamageType.Heat, 300, 0);
                        GamePlayer target = player;
                        foreach (GamePlayer onlookers in target.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
                        {
                            if (onlookers != target) // dont send it to the person it happened to, only the other onlookers.
                            {
                                onlookers.Out.SendSpellEffectAnimation(pbody, target, 310, 0, false, 1);
                                onlookers.Out.SendMessage("The purros explodes in " + target.Name + " face!", eChatType.CT_Broadcast, eChatLoc.CL_ChatWindow);
                            }
                        }
                    }
                }

                // purros exploded, let's despawn him, first take away the die handler so he dosn't die twice.
                GameEventMgr.RemoveHandler(pbody, GameNPCEvent.Dying, new DOLEventHandler(Ianetor.PurroHasDied));
                pbody.Health = 0;
                pbody.Delete();
                TimerOn = false;
                Ianetor.PurrosList.Remove(pbody);
            }

            return(0);
        }