Beispiel #1
0
        private void Zap()
        {
            Spend(TimeToZap);

            if (Hit(this, Enemy, true))
            {
                if (Enemy == Dungeon.Hero && Random.Int(2) == 0)
                {
                    buffs.Buff.Prolong <Weakness>(Enemy, Weakness.Duration(Enemy));
                }

                var dmg = Random.Int(12, 18);
                Enemy.Damage(dmg, this);

                if (Enemy.IsAlive || Enemy != Dungeon.Hero)
                {
                    return;
                }

                Dungeon.Fail(Utils.Format(ResultDescriptions.MOB, Utils.Indefinite(Name), Dungeon.Depth));
                GLog.Negative(TxtShadowboltKilled, Name);
            }
            else
            {
                Enemy.Sprite.ShowStatus(CharSprite.Neutral, Enemy.DefenseVerb());
            }
        }
Beispiel #2
0
        public void OnDeath()
        {
            Badge.ValidateDeathFromFire();

            Dungeon.Fail(Utils.Format(ResultDescriptions.BURNING, Dungeon.Depth));
            GLog.Negative(TXT_BURNED_TO_DEATH);
        }
Beispiel #3
0
        public override bool DoEquip(Hero hero)
        {
            if (hero.Belongings.Ring1 != null && hero.Belongings.Ring2 != null)
            {
                GLog.Warning("you can only wear 2 rings at a time");
                return(false);
            }
            if (hero.Belongings.Ring1 == null)
            {
                hero.Belongings.Ring1 = this;
            }
            else
            {
                hero.Belongings.Ring2 = this;
            }

            Detach(hero.Belongings.Backpack);

            Activate(hero);

            cursedKnown = true;
            if (cursed)
            {
                EquipCursed(hero);
                GLog.Negative("your " + this + " tightens around your finger painfully");
            }

            hero.SpendAndNext(TIME_TO_EQUIP);
            return(true);
        }
Beispiel #4
0
            protected override bool Act()
            {
                if (Target.IsAlive)
                {
                    Target.Damage(1, this);
                    if (Target == Dungeon.Hero && !Target.IsAlive)
                    {
                        // FIXME
                        var glyph = new Viscosity();
                        Dungeon.Fail(Utils.Format(ResultDescriptions.GLYPH, glyph.Name(), Dungeon.Depth));
                        GLog.Negative("{0} killed you...", glyph.Name());

                        Badge.ValidateDeathFromGlyph();
                    }
                    Spend(Tick);

                    if (--damage <= 0)
                    {
                        Detach();
                    }
                }
                else
                {
                    Detach();
                }

                return(true);
            }
Beispiel #5
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);
        }
Beispiel #6
0
        public void OnDeath()
        {
            Badge.ValidateDeathFromHunger();

            Dungeon.Fail(Utils.Format(ResultDescriptions.HUNGER, Dungeon.Depth));
            GLog.Negative(TxtDeath);
        }
Beispiel #7
0
        public void OnDeath()
        {
            Badge.ValidateDeathFromPoison();

            Dungeon.Fail(Utils.Format(ResultDescriptions.POISON, Dungeon.Depth));
            GLog.Negative("You died from poison...");
        }
Beispiel #8
0
            public override bool Attack(Character enemy)
            {
                if (Level.Adjacent(pos, enemy.pos))
                {
                    return(base.Attack(enemy));
                }

                Spend(AttackDelay());

                if (Hit(this, enemy, true))
                {
                    var dmg = DamageRoll();
                    enemy.Damage(dmg, this);

                    enemy.Sprite.BloodBurstA(Sprite.Center(), dmg);
                    enemy.Sprite.Flash();

                    if (enemy.IsAlive || enemy != Dungeon.Hero)
                    {
                        return(true);
                    }

                    Dungeon.Fail(Utils.Format(ResultDescriptions.BOSS, Name, Dungeon.Depth));
                    GLog.Negative(TxtKill, Name);
                    return(true);
                }

                enemy.Sprite.ShowStatus(CharSprite.Neutral, enemy.DefenseVerb());
                return(false);
            }
Beispiel #9
0
        protected internal override void OnZap(int cell)
        {
            var localLevel = Level;

            for (var i = 1; i < Ballistica.Distance - 1; i++)
            {
                var c = Ballistica.Trace[i];
                if (levels.Level.flamable[c])
                {
                    GameScene.Add(Blob.Seed(c, 1, typeof(Fire)));
                }
            }

            GameScene.Add(Blob.Seed(cell, 1, typeof(Fire)));

            var ch = Actor.FindChar(cell);

            if (ch == null)
            {
                return;
            }

            ch.Damage(pdsharp.utils.Random.Int(1, 8 + localLevel * localLevel), this);
            Buff.Affect <Burning>(ch).Reignite(ch);

            ch.Sprite.Emitter().Burst(FlameParticle.Factory, 5);

            if (ch != CurUser || ch.IsAlive)
            {
                return;
            }

            Dungeon.Fail(Utils.Format(ResultDescriptions.WAND, name, Dungeon.Depth));
            GLog.Negative("You killed yourself with your own Wand of Firebolt...");
        }
Beispiel #10
0
        public void OnDeath()
        {
            Badge.ValidateDeathFromGas();

            Dungeon.Fail(Utils.Format(ResultDescriptions.GAS, Dungeon.Depth));
            GLog.Negative("You died from a toxic gas..");
        }
Beispiel #11
0
        public override bool DoEquip(Hero hero)
        {
            DetachAll(hero.Belongings.Backpack);

            if (hero.Belongings.Weapon == null || hero.Belongings.Weapon.DoUnequip(hero, true))
            {
                hero.Belongings.Weapon = this;
                Activate(hero);

                QuickSlot.Refresh();

                cursedKnown = true;
                if (cursed)
                {
                    EquipCursed(hero);
                    GLog.Negative(TxtEquipCursed, Name);
                }

                hero.SpendAndNext(TimeToEquip);
                return(true);
            }

            Collect(hero.Belongings.Backpack);
            return(false);
        }
Beispiel #12
0
        // 00x66CCEE
        public static void Trigger(int pos, Character ch)
        {
            if (ch != null)
            {
                ch.Damage(Math.Max(1, Random.Int(ch.HP / 3, 2 * ch.HP / 3)), LIGHTNING);
                if (ch == Dungeon.Hero)
                {
                    Camera.Main.Shake(2, 0.3f);

                    if (!ch.IsAlive)
                    {
                        Dungeon.Fail(Utils.Format(ResultDescriptions.TRAP, name, Dungeon.Depth));
                        GLog.Negative("You were killed by a discharge of a lightning trap...");
                    }
                    else
                    {
                        ((Hero)ch).Belongings.Charge(false);
                    }
                }

                var points = new int[2];

                points[0] = pos - Level.Width;
                points[1] = pos + Level.Width;
                ch.Sprite.Parent.Add(new Lightning(points, 2, null));

                points[0] = pos - 1;
                points[1] = pos + 1;
                ch.Sprite.Parent.Add(new Lightning(points, 2, null));
            }

            CellEmitter.Center(pos).Burst(SparkParticle.Factory, Random.IntRange(3, 4));
        }
Beispiel #13
0
        protected internal override void OnZap(int cell)
        {
            if (CurUser.IsAlive)
            {
                return;
            }

            Dungeon.Fail(Utils.Format(ResultDescriptions.WAND, name, Dungeon.Depth));
            GLog.Negative("You killed yourself with your own Wand of Lightning...");
        }
Beispiel #14
0
        protected internal override bool DoAttack(Character enemy)
        {
            if (Level.Distance(pos, enemy.pos) <= 1)
            {
                return(base.DoAttack(enemy));
            }

            var visible = Level.fieldOfView[pos] || Level.fieldOfView[enemy.pos];

            if (visible)
            {
                ((ShamanSprite)Sprite).DoZap(enemy.pos);
            }

            Spend(TimeToZap);

            if (Hit(this, enemy, true))
            {
                var dmg = (float)pdsharp.utils.Random.Int(2, 12);

                if (Level.water[enemy.pos] && !enemy.Flying)
                {
                    dmg *= 1.5f;
                }

                enemy.Damage((int)dmg, LightningTrap.LIGHTNING);

                enemy.Sprite.CenterEmitter().Burst(SparkParticle.Factory, 3);
                enemy.Sprite.Flash();

                if (enemy != Dungeon.Hero)
                {
                    return(!visible);
                }

                Camera.Main.Shake(2, 0.3f);

                if (enemy.IsAlive)
                {
                    return(!visible);
                }

                Dungeon.Fail(Utils.Format(ResultDescriptions.MOB, Utils.Indefinite(Name), Dungeon.Depth));
                GLog.Negative(TxtLightningKilled, Name);
            }
            else
            {
                enemy.Sprite.ShowStatus(CharSprite.Neutral, enemy.DefenseVerb());
            }

            return(!visible);
        }
Beispiel #15
0
        protected override bool Act()
        {
            if (Target.IsAlive)
            {
                var hero = (Hero)Target;

                if (IsStarving)
                {
                    if (Random.Float() < 0.3f && (Target.HP > 1 || !Target.Paralysed))
                    {
                        GLog.Negative(TxtStarving);
                        hero.Damage(1, this);

                        hero.Interrupt();
                    }
                }
                else
                {
                    var bonus = Target.Buffs <RingOfSatiety.Satiety>().Sum(buff => ((RingOfSatiety.Satiety)buff).Level);

                    var newLevel      = _level + Step - bonus;
                    var statusUpdated = false;
                    if (newLevel >= Starving)
                    {
                        GLog.Negative(TxtStarving);
                        statusUpdated = true;

                        hero.Interrupt();
                    }
                    else if (newLevel >= Hungry && _level < Hungry)
                    {
                        GLog.Warning(TxtHungry);
                        statusUpdated = true;
                    }
                    _level = newLevel;

                    if (statusUpdated)
                    {
                        BuffIndicator.RefreshHero();
                    }
                }

                var step = ((Hero)Target).heroClass == HeroClass.Rogue ? Step * 1.2f : Step;
                Spend(Target.Buff <Shadows>() == null ? step : step *1.5f);
            }
            else
            {
                Deactivate();
            }

            return(true);
        }
Beispiel #16
0
        protected internal override void OnZap(int cell)
        {
            Sample.Instance.Play(Assets.SND_ROCKS);

            var localLevel = Level;

            Ballistica.Distance = Math.Min(Ballistica.Distance, 8 + localLevel);

            var size = 1 + localLevel / 3;

            PathFinder.BuildDistanceMap(cell, BArray.not(levels.Level.solid, null), size);

            for (var i = 0; i < levels.Level.Length; i++)
            {
                int d = PathFinder.Distance[i];

                if (d >= int.MaxValue)
                {
                    continue;
                }

                var ch = Actor.FindChar(i);
                if (ch != null)
                {
                    ch.Sprite.Flash();

                    ch.Damage(pdsharp.utils.Random.Int(2, 6 + (size - d) * 2), this);

                    if (ch.IsAlive && pdsharp.utils.Random.Int(2 + d) == 0)
                    {
                        Buff.Prolong <Paralysis>(ch, pdsharp.utils.Random.IntRange(2, 6));
                    }
                }

                CellEmitter.Get(i).Start(Speck.Factory(Speck.ROCK), 0.07f, 3 + (size - d));
                Camera.Main.Shake(3, 0.07f * (3 + (size - d)));
            }

            if (CurUser.IsAlive)
            {
                return;
            }

            Dungeon.Fail(Utils.Format(ResultDescriptions.WAND, name, Dungeon.Depth));
            GLog.Negative("You killed yourself with your own Wand of Avalanche...");
        }
Beispiel #17
0
        protected override bool Act()
        {
            if (Target.IsAlive)
            {
                Target.Damage(Damage, this);
                if (!Target.IsAlive && Target == Dungeon.Hero)
                {
                    Dungeon.Fail(Utils.Format(ResultDescriptions.OOZE, Dungeon.Depth));
                    GLog.Negative(TXT_HERO_KILLED, ToString());
                }
                Spend(Tick);
            }

            if (levels.Level.water[Target.pos])
            {
                Detach();
            }
            return(true);
        }
Beispiel #18
0
        public override void Move(int step)
        {
            base.Move(step);

            if (Dungeon.Level.map[step] == Terrain.INACTIVE_TRAP && HP < HT)
            {
                HP += pdsharp.utils.Random.Int(1, HT - HP);
                Sprite.Emitter().Burst(ElmoParticle.Factory, 5);

                if (Dungeon.Visible[step] && Dungeon.Hero.IsAlive)
                {
                    GLog.Negative("DM-300 repairs itself!");
                }
            }

            int[] cells = { step - 1, step + 1, step - Level.Width, step + Level.Width, step - 1 - Level.Width, step - 1 + Level.Width, step + 1 - Level.Width, step + 1 + Level.Width };
            var   cell  = cells[pdsharp.utils.Random.Int(cells.Length)];

            if (Dungeon.Visible[cell])
            {
                CellEmitter.Get(cell).Start(Speck.Factory(Speck.ROCK), 0.07f, 10);
                Camera.Main.Shake(3, 0.7f);
                Sample.Instance.Play(Assets.SND_ROCKS);

                if (Level.water[cell])
                {
                    GameScene.Ripple(cell);
                }
                else
                if (Dungeon.Level.map[cell] == Terrain.EMPTY)
                {
                    Level.Set(cell, Terrain.EMPTY_DECO);
                    GameScene.UpdateMap(cell);
                }
            }

            var ch = FindChar(cell);

            if (ch != null && ch != this)
            {
                buffs.Buff.Prolong <Paralysis>(ch, 2);
            }
        }
Beispiel #19
0
        public virtual bool Collect(Bag container)
        {
            var items = container.Items;

            if (items.Contains(this))
            {
                return(true);
            }

            foreach (var item in items.Where(item => item is Bag && ((Bag)item).Grab(this)))
            {
                return(Collect((Bag)item));
            }

            if (Stackable)
            {
                var c = GetType();
                foreach (var item in items.Where(item => item.GetType() == c))
                {
                    item.quantity += quantity;
                    item.UpdateQuickslot();
                    return(true);
                }
            }

            if (items.Count < container.Size)
            {
                if (Dungeon.Hero != null && Dungeon.Hero.IsAlive)
                {
                    Badge.ValidateItemLevelAquired(this);
                }

                items.Add(this);
                QuickSlot.Refresh();
                items.Sort();

                return(true);
            }

            GLog.Negative(TxtPackFull, Name);
            return(false);
        }
Beispiel #20
0
        protected internal override bool DoAttack(Character enemy)
        {
            if (_pumpedUp || pdsharp.utils.Random.Int(3) > 0)
            {
                return(base.DoAttack(enemy));
            }

            _pumpedUp = true;
            Spend(PumpUpDelay);

            ((GooSprite)Sprite).PumpUp();

            if (!Dungeon.Visible[pos])
            {
                return(true);
            }

            Sprite.ShowStatus(CharSprite.Negative, "!!!");
            GLog.Negative("Goo is pumping itself up!");

            return(true);
        }
Beispiel #21
0
        public override bool Attack(Character enemy)
        {
            for (var i = 1; i < Ballistica.Distance; i++)
            {
                var localPos = Ballistica.Trace[i];

                var ch = FindChar(localPos);
                if (ch == null)
                {
                    continue;
                }

                if (Hit(this, ch, true))
                {
                    ch.Damage(pdsharp.utils.Random.NormalIntRange(14, 20), this);

                    if (Dungeon.Visible[localPos])
                    {
                        ch.Sprite.Flash();
                        CellEmitter.Center(localPos).Burst(PurpleParticle.Burst, pdsharp.utils.Random.IntRange(1, 2));
                    }

                    if (ch.IsAlive || ch != Dungeon.Hero)
                    {
                        continue;
                    }

                    Dungeon.Fail(Utils.Format(ResultDescriptions.MOB, Utils.Indefinite(Name), Dungeon.Depth));
                    GLog.Negative(TxtDeathgazeKilled, Name);
                }
                else
                {
                    ch.Sprite.ShowStatus(CharSprite.Neutral, ch.DefenseVerb());
                }
            }

            return(true);
        }
Beispiel #22
0
        protected internal override void OnZap(int cell)
        {
            var ch = Actor.FindChar(cell);

            if (ch == null)
            {
                return;
            }

            var localLevel = Level;

            ch.Damage(pdsharp.utils.Random.Int(1, 6 + localLevel * 2), this);

            ch.Sprite.Burst(Color.Argb(0xFF, 0x99, 0xCC, 0xFF), localLevel / 2 + 2);

            if (ch != CurUser || ch.IsAlive)
            {
                return;
            }

            Dungeon.Fail(Utils.Format(ResultDescriptions.WAND, name, Dungeon.Depth));
            GLog.Negative("You killed yourself with your own Wand of Magic Factory...");
        }
Beispiel #23
0
        public override bool DoEquip(Hero hero)
        {
            Detach(hero.Belongings.Backpack);

            if (hero.Belongings.Armor == null || hero.Belongings.Armor.DoUnequip(hero, true, false))
            {
                hero.Belongings.Armor = this;

                cursedKnown = true;
                if (cursed)
                {
                    EquipCursed(hero);
                    GLog.Negative(TxtEquipCursed, ToString());
                }

                ((HeroSprite)hero.Sprite).UpdateArmor();

                hero.SpendAndNext(2 * TimeToEquip(hero));
                return(true);
            }

            Collect(hero.Belongings.Backpack);
            return(false);
        }
Beispiel #24
0
        public override void Die(object cause)
        {
            base.Die(cause);

            var heroKilled = false;

            for (var i = 0; i < Level.NEIGHBOURS8.Length; i++)
            {
                var ch = FindChar(pos + Level.NEIGHBOURS8[i]);

                if (ch == null || !ch.IsAlive)
                {
                    continue;
                }

                var damage = Math.Max(0, DamageRoll() - pdsharp.utils.Random.IntRange(0, ch.Dr() / 2));
                ch.Damage(damage, this);
                if (ch == Dungeon.Hero && !ch.IsAlive)
                {
                    heroKilled = true;
                }
            }

            if (Dungeon.Visible[pos])
            {
                Sample.Instance.Play(Assets.SND_BONES);
            }

            if (!heroKilled)
            {
                return;
            }

            Dungeon.Fail(Utils.Format(ResultDescriptions.MOB, Utils.Indefinite(Name), Dungeon.Depth));
            GLog.Negative(TxtHeroKilled);
        }
Beispiel #25
0
 public virtual void Yell(string str)
 {
     GLog.Negative("{0}: \"{1}\" ", Name, str);
 }
Beispiel #26
0
 public void OnDeath()
 {
     Badge.ValidateDeathFromFalling();
     Dungeon.Fail(Utils.Format(ResultDescriptions.FALL, Dungeon.Depth));
     GLog.Negative("You fell to death...");
 }
Beispiel #27
0
        public virtual bool Attack(Character enemy)
        {
            var visibleFight = Dungeon.Visible[pos] || Dungeon.Visible[enemy.pos];

            if (Hit(this, enemy, false))
            {
                if (visibleFight)
                {
                    GLog.Information(TxtHit, Name, enemy.Name);
                }

                // FIXME
                var dr = this is Hero && ((Hero)this).RangedWeapon != null && ((Hero)this).subClass == HeroSubClass.SNIPER ? 0 : Random.IntRange(0, enemy.Dr());

                var dmg             = DamageRoll();
                var effectiveDamage = Math.Max(dmg - dr, 0);

                effectiveDamage = AttackProc(enemy, effectiveDamage);
                effectiveDamage = enemy.DefenseProc(this, effectiveDamage);
                enemy.Damage(effectiveDamage, this);

                if (visibleFight)
                {
                    Sample.Instance.Play(Assets.SND_HIT, 1, 1, Random.Float(0.8f, 1.25f));
                }

                if (enemy == Dungeon.Hero)
                {
                    Dungeon.Hero.Interrupt();
                }

                enemy.Sprite.BloodBurstA(Sprite.Center(), effectiveDamage);
                enemy.Sprite.Flash();

                if (!enemy.IsAlive && visibleFight)
                {
                    if (enemy == Dungeon.Hero)
                    {
                        if (Dungeon.Hero.KillerGlyph != null)
                        {
                            Dungeon.Fail(Utils.Format(ResultDescriptions.GLYPH, Dungeon.Hero.KillerGlyph.Name(), Dungeon.Depth));
                            GLog.Negative(TxtKill, Dungeon.Hero.KillerGlyph.Name());
                        }
                        else
                        {
                            if (Bestiary.IsUnique(this))
                            {
                                Dungeon.Fail(Utils.Format(ResultDescriptions.BOSS, Name, Dungeon.Depth));
                            }
                            else
                            {
                                Dungeon.Fail(Utils.Format(ResultDescriptions.MOB, Utils.Indefinite(Name), Dungeon.Depth));
                            }

                            GLog.Negative(TxtKill, Name);
                        }
                    }
                    else
                    {
                        GLog.Information(TxtDefeat, Name, enemy.Name);
                    }
                }

                return(true);
            }

            if (!visibleFight)
            {
                return(false);
            }

            var defense = enemy.DefenseVerb();

            enemy.Sprite.ShowStatus(CharSprite.Neutral, defense);
            if (this == Dungeon.Hero)
            {
                GLog.Information(TxtYouMissed, enemy.Name, defense);
            }
            else
            {
                GLog.Information(TxtSmbMissed, enemy.Name, defense, Name);
            }

            Sample.Instance.Play(Assets.SND_MISS);

            return(false);
        }