Beispiel #1
0
 public void Bump()
 {
     Systems.Events.TheInstance.BrickBump();
     if (!HasNoItems())
     {
         IRevealableItem item = items.Dequeue();
         item.RevealItem();
         if (item is BlockCoin)
         {
             Systems.Events.TheInstance.Coin();
         }
         State.HandleCollision(false);
         if (HasNoItems())
         {
             unused      = false;
             this.sprite = this.spriteFactory.CreateProduct(BlockTypes.Used);
         }
     }
     else
     {
         Mario player = Mario.GetInstance();
         if (player.IsPoweredUp() && unused)
         {
             this.sprite = this.spriteFactory.CreateProduct(BlockTypes.Broken);
             Systems.Events.TheInstance.BrickBreak();
         }
         State.HandleCollision(player.IsPoweredUp() && unused);
     }
 }
Beispiel #2
0
 public override void HandleMovingItemTransition()
 {
     if (this.item is Star)
     {
         IRevealableItem revealableItem = (IRevealableItem)this.item;
         revealableItem.ChangeItemState(new BouncingStarState(this.item));
     }
 }
Beispiel #3
0
        public override void HandleMovingItemTransition()
        {
            IRevealableItem revealableItem = (IRevealableItem)this.item;

            if (this.item is Mushroom || this.item is OneUp || this.item is Star)
            {
                revealableItem.ChangeItemState(new MovingItemState(this.item));
            }
        }
Beispiel #4
0
        public override void HandleItemRevealTransistion()
        {
            IRevealableItem revealableItem = (IRevealableItem)this.item;

            if (this.item is BlockCoin)
            {
                revealableItem.ChangeItemState(new BlockCoinRevealState(this.item));
            }
            else
            {
                revealableItem.ChangeItemState(new RevealItemState(this.item));
            }
        }
Beispiel #5
0
 public void Bump()
 {
     Systems.Events.TheInstance.BrickBump();
     if (!HasNoItems())
     {
         IRevealableItem item = items.Dequeue();
         item.RevealItem();
         if (item is BlockCoin)
         {
             Systems.Events.TheInstance.Coin();
         }
     }
     State.HandleCollision(false);
     if (HasNoItems())
     {
         this.sprite = this.spriteFactory.CreateProduct(BlockTypes.Used);
     }
 }
Beispiel #6
0
            protected override void OnTarget(Mobile src, object targ)
            {
                bool foundAnyone = false;

                Point3D p;

                if (targ is Mobile)
                {
                    p = ((Mobile)targ).Location;
                }
                else if (targ is Item)
                {
                    p = ((Item)targ).Location;
                }
                else if (targ is IPoint3D)
                {
                    p = new Point3D((IPoint3D)targ);
                }
                else
                {
                    p = src.Location;
                }

                double srcSkill = src.Skills[SkillName.DetectHidden].Value;
                int    range    = Math.Max(2, (int)(srcSkill / 10.0));

                if (!src.CheckSkill(SkillName.DetectHidden, 0.0, 100.0))
                {
                    range /= 2;
                }

                BaseHouse house = BaseHouse.FindHouseAt(p, src.Map, 16);

                bool inHouse = house != null && house.IsFriend(src);

                if (inHouse)
                {
                    range = 22;
                }

                if (range > 0)
                {
                    IPooledEnumerable inRange = src.Map.GetMobilesInRange(p, range);

                    foreach (Mobile trg in inRange)
                    {
                        if (trg.Hidden && src != trg)
                        {
                            double ss         = srcSkill + Utility.Random(21) - 10;
                            double ts         = trg.Skills[SkillName.Hiding].Value + Utility.Random(21) - 10;
                            double shadow     = Server.Spells.SkillMasteries.ShadowSpell.GetDifficultyFactor(trg);
                            bool   houseCheck = inHouse && house.IsInside(trg);

                            if (src.AccessLevel >= trg.AccessLevel && (ss >= ts || houseCheck) && Utility.RandomDouble() > shadow)
                            {
                                if ((trg is ShadowKnight && (trg.X != p.X || trg.Y != p.Y)) ||
                                    (!houseCheck && !CanDetect(src, trg)))
                                {
                                    continue;
                                }

                                trg.RevealingAction();
                                trg.SendLocalizedMessage(500814); // You have been revealed!
                                trg.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 500814, trg.NetState);
                                foundAnyone = true;
                            }
                        }
                    }

                    inRange.Free();

                    IPooledEnumerable itemsInRange = src.Map.GetItemsInRange(p, range);

                    foreach (Item item in itemsInRange)
                    {
                        if (item is LibraryBookcase && Server.Engines.Khaldun.GoingGumshoeQuest3.CheckBookcase(src, item))
                        {
                            foundAnyone = true;
                        }
                        else
                        {
                            IRevealableItem dItem = item as IRevealableItem;

                            if (dItem == null || (item.Visible && dItem.CheckWhenHidden))
                            {
                                continue;
                            }

                            if (dItem.CheckReveal(src))
                            {
                                dItem.OnRevealed(src);

                                foundAnyone = true;
                            }
                        }
                    }

                    itemsInRange.Free();
                }

                if (!foundAnyone)
                {
                    src.SendLocalizedMessage(500817); // You can see nothing hidden there.
                }
            }
            protected override void OnTarget(Mobile src, object targ)
            {
                bool foundAnyone = false;

                Point3D p;

                if (targ is Mobile)
                {
                    p = ((Mobile)targ).Location;
                }
                else if (targ is Item)
                {
                    p = ((Item)targ).Location;
                }
                else if (targ is IPoint3D)
                {
                    p = new Point3D((IPoint3D)targ);
                }
                else
                {
                    p = src.Location;
                }

                double srcSkill = src.Skills[SkillName.DetectHidden].Value;
                int    range    = (int)(srcSkill / 10.0);

                if (!src.CheckSkill(SkillName.DetectHidden, 0.0, 100.0))
                {
                    range /= 2;
                }

                BaseHouse house = BaseHouse.FindHouseAt(p, src.Map, 16);

                bool inHouse = (house != null && house.IsFriend(src));

                if (inHouse)
                {
                    range = 22;
                }

                if (range > 0)
                {
                    IPooledEnumerable inRange = src.Map.GetMobilesInRange(p, range);

                    foreach (Mobile trg in inRange)
                    {
                        if (trg.Hidden && src != trg)
                        {
                            double ss = srcSkill + Utility.Random(21) - 10;
                            double ts = trg.Skills[SkillName.Hiding].Value + Utility.Random(21) - 10;

                            if (src.AccessLevel >= trg.AccessLevel && (ss >= ts || (inHouse && house.IsInside(trg))))
                            {
                                if (trg is ShadowKnight && (trg.X != p.X || trg.Y != p.Y))
                                {
                                    continue;
                                }

                                trg.RevealingAction();
                                trg.SendLocalizedMessage(500814); // You have been revealed!
                                foundAnyone = true;
                            }
                        }
                    }

                    inRange.Free();

                    IPooledEnumerable itemsInRange = src.Map.GetItemsInRange(p, range);

                    foreach (Item item in itemsInRange)
                    {
                        if (item.Visible)
                        {
                            continue;
                        }

                        IRevealableItem dItem = item as IRevealableItem;

                        if (dItem != null && dItem.CheckReveal(src))
                        {
                            dItem.OnRevealed(src);

                            foundAnyone = true;
                        }
                    }

                    itemsInRange.Free();
                }

                if (!foundAnyone)
                {
                    src.SendLocalizedMessage(500817); // You can see nothing hidden there.
                }
            }
Beispiel #8
0
 public virtual void AddItem(IRevealableItem item)
 {
     items.Enqueue(item);
 }
Beispiel #9
0
 public override void AddItem(IRevealableItem item)
 {
     this.block.AddItem(item);
 }