Exemple #1
0
 public virtual void Burst(Color color, int n)
 {
     if (Visible)
     {
         Splash.At(Center(), color, n);
     }
 }
Exemple #2
0
        protected override bool Act()
        {
            if (Target.IsAlive)
            {
                if ((Level = pdsharp.utils.Random.Int(Level / 2, Level)) > 0)
                {
                    Target.Damage(Level, this);
                    if (Target.Sprite.IsVisible)
                    {
                        Splash.At(Target.Sprite.Center(), -PointF.Pi / 2, PointF.Pi / 6, Target.Sprite.Blood(),
                                  Math.Min(10 * Level / Target.HT, 10));
                    }

                    if (Target == Dungeon.Hero && !Target.IsAlive)
                    {
                        Dungeon.Fail(Utils.Format(ResultDescriptions.BLEEDING, Dungeon.Depth));
                        GLog.Negative("You bled to death...");
                    }

                    Spend(Tick);
                }
                else
                {
                    Detach();
                }
            }
            else
            {
                Detach();
            }

            return(true);
        }
Exemple #3
0
        public virtual void BloodBurstA(PointF fromPoint, int damage)
        {
            if (!Visible)
            {
                return;
            }

            var c = Center();
            var n = (int)Math.Min(9 * Math.Sqrt((double)damage / Ch.HT), 9);

            Splash.At(c, PointF.Angle(fromPoint, c), 3.1415926f / 2, Blood(), n);
        }
Exemple #4
0
        protected internal virtual void splash(int cell)
        {
            var color = ItemSprite.Pick(image, 8, 10);

            Splash.At(cell, color, 5);
        }
Exemple #5
0
        public override void DoDie()
        {
            base.DoDie();

            Splash.At(Center(), Blood(), 12);
        }
Exemple #6
0
        public virtual Item Transmute()
        {
            CellEmitter.Get(Pos).Burst(Speck.Factory(Speck.BUBBLE), 3);
            Splash.At(Pos, new Android.Graphics.Color(0xFFFFFF), 3);

            var chances = new float[Items.Count];
            var count   = 0;

            var index = 0;

            foreach (var item in Items)
            {
                if (item is Plant.Seed)
                {
                    count           += item.quantity;
                    chances[index++] = item.quantity;
                }
                else
                {
                    count = 0;
                    break;
                }
            }

            if (count < SeedsToPotion)
            {
                return(null);
            }

            CellEmitter.Get(Pos).Burst(Speck.Factory(Speck.WOOL), 6);
            Sample.Instance.Play(Assets.SND_PUFF);

            if (pdsharp.utils.Random.Int(count) == 0)
            {
                CellEmitter.Center(Pos).Burst(Speck.Factory(Speck.EVOKE), 3);

                Destroy();

                Statistics.PotionsCooked++;
                Badge.ValidatePotionsCooked();

                return(Generator.Random(Generator.Category.POTION));
            }

            var proto = (Plant.Seed)Items[pdsharp.utils.Random.Chances(chances)];

            var itemClass = proto.AlchemyClass;

            Destroy();

            Statistics.PotionsCooked++;
            Badge.ValidatePotionsCooked();

            if (itemClass == null)
            {
                return(Generator.Random(Generator.Category.POTION));
            }

            try
            {
                return((Item)Activator.CreateInstance(itemClass));
            }
            catch (Exception)
            {
                return(null);
            }
        }