コード例 #1
0
        public void OnSelect(int?target)
        {
            if (target == null || target == _warriorArmor.CurUser.pos)
            {
                return;
            }

            target = Ballistica.Cast(_warriorArmor.CurUser.pos, target.Value, false, true);
            if (Actor.FindChar(target.Value) != null && target != _warriorArmor.CurUser.pos)
            {
                target = Ballistica.Trace[Ballistica.Distance - 2];
            }

            _warriorArmor.CurUser.HP -= (_warriorArmor.CurUser.HP / 3);
            if (_warriorArmor.CurUser.subClass == HeroSubClass.BERSERKER && _warriorArmor.CurUser.HP <= _warriorArmor.CurUser.HT * Fury.Level)
            {
                Buff.Affect <Fury>(_warriorArmor.CurUser);
            }

            Invisibility.Dispel();

            _dest = target.Value;
            _warriorArmor.CurUser.Busy();
            ((HeroSprite)_warriorArmor.CurUser.Sprite).Jump(_warriorArmor.CurUser.pos, target.Value, this);
        }
コード例 #2
0
        protected internal override void DoRead()
        {
            var respawnPoints = Level.NEIGHBOURS8.Select(t => CurUser.pos + t).Where(p => Actor.FindChar(p) == null && (Level.passable[p] || Level.avoid[p])).ToList();

            var nImages = Nimages;

            while (nImages > 0 && respawnPoints.Count > 0)
            {
                var index = pdsharp.utils.Random.Index(respawnPoints);

                var mob = new MirrorImage();
                mob.Duplicate(CurUser);
                GameScene.Add(mob);
                WandOfBlink.Appear(mob, respawnPoints[index]);

                respawnPoints.Remove(index);
                nImages--;
            }

            if (nImages < Nimages)
            {
                SetKnown();
            }

            Sample.Instance.Play(Assets.SND_READ);
            Invisibility.Dispel();

            CurUser.SpendAndNext(TimeToRead);
        }
コード例 #3
0
        protected internal override void DoRead()
        {
            new Flare(6, 32).Show(CurUser.Sprite, 2f);
            Sample.Instance.Play(Assets.SND_READ);
            Invisibility.Dispel();

            var procced = Uncurse(CurUser, CurUser.Belongings.Backpack.Items.ToArray());

            procced = Uncurse(CurUser, CurUser.Belongings.Weapon, CurUser.Belongings.Armor, CurUser.Belongings.Ring1, CurUser.Belongings.Ring2) || procced;

            Buff.Detach <Weakness>(CurUser);

            if (procced)
            {
                GLog.Positive(TxtProcced);
            }
            else
            {
                GLog.Information(TxtNotProcced);
            }

            SetKnown();

            CurUser.SpendAndNext(TimeToRead);
        }
コード例 #4
0
        protected internal override void DoRead()
        {
            Sample.Instance.Play(Assets.SND_READ);
            Invisibility.Dispel();

            TeleportHero(CurUser);
            SetKnown();

            CurUser.SpendAndNext(TimeToRead);
        }
コード例 #5
0
        protected internal override void DoRead()
        {
            const int length       = Level.Length;
            var       map          = Dungeon.Level.map;
            var       mapped       = Dungeon.Level.mapped;
            var       discoverable = Level.discoverable;

            var noticed = false;

            for (var i = 0; i < length; i++)
            {
                var terr = map[i];

                if (!discoverable[i])
                {
                    continue;
                }

                mapped[i] = true;
                if ((Terrain.Flags[terr] & Terrain.SECRET) == 0)
                {
                    continue;
                }

                Level.Set(i, Terrain.discover(terr));
                GameScene.UpdateMap(i);

                if (!Dungeon.Visible[i])
                {
                    continue;
                }

                GameScene.DiscoverTile(i, terr);
                Discover(i);

                noticed = true;
            }

            Dungeon.Observe();

            GLog.Information(TxtLayout);
            if (noticed)
            {
                Sample.Instance.Play(Assets.SND_SECRET);
            }

            SpellSprite.Show(CurUser, SpellSprite.Map);
            Sample.Instance.Play(Assets.SND_READ);
            Invisibility.Dispel();

            SetKnown();

            CurUser.SpendAndNext(TimeToRead);
        }
コード例 #6
0
ファイル: Hero.cs プロジェクト: zvinch/SharpDungeon
        public override void OnAttackComplete()
        {
            AttackIndicator.Target(_enemy);

            Attack(_enemy);
            curAction = null;

            Invisibility.Dispel();

            base.OnAttackComplete();
        }
コード例 #7
0
        protected internal override void DoRead()
        {
            CurUser.Sprite.CenterEmitter().Start(Speck.Factory(Speck.NOTE), 0.3f, 5);
            Sample.Instance.Play(Assets.SND_LULLABY);
            Invisibility.Dispel();

            var count    = 0;
            Mob affected = null;

            foreach (var mob in Dungeon.Level.mobs)
            {
                if (!Level.fieldOfView[mob.pos])
                {
                    continue;
                }

                Buff.Affect <Sleep>(mob);

                if (mob.Buff <Sleep>() == null)
                {
                    continue;
                }

                affected = mob;
                count++;
            }

            switch (count)
            {
            case 0:
                GLog.Information("The scroll utters a soothing melody.");
                break;

            case 1:
                if (affected != null)
                {
                    GLog.Information("The scroll utters a soothing melody and the " + affected.Name + " falls asleep!");
                }
                else
                {
                    GLog.Information("The scroll utters a soothing melody.");
                }
                break;

            default:
                GLog.Information("The scroll utters a soothing melody and the monsters fall asleep!");
                break;
            }
            SetKnown();

            CurUser.SpendAndNext(TimeToRead);
        }
コード例 #8
0
ファイル: ScrollOfTerror.cs プロジェクト: zvinch/SharpDungeon
        protected internal override void DoRead()
        {
            new Flare(5, 32).Color(0xFF0000, true).Show(CurUser.Sprite, 2f);
            Sample.Instance.Play(Assets.SND_READ);
            Invisibility.Dispel();

            var count    = 0;
            Mob affected = null;

            foreach (var mob in Dungeon.Level.mobs.ToArray())
            {
                if (!Level.fieldOfView[mob.pos])
                {
                    continue;
                }

                var terror = Buff.Affect <Terror>(mob, Terror.Duration);
                terror.Source = CurUser;

                count++;
                affected = mob;
            }

            switch (count)
            {
            case 0:
                GLog.Information("The scroll emits a brilliant flash of red light");
                break;

            case 1:
                if (affected != null)
                {
                    GLog.Information("The scroll emits a brilliant flash of red light and the " + affected.Name + " flees!");
                }
                else
                {
                    GLog.Information("The scroll emits a brilliant flash of red light");
                }
                break;

            default:
                GLog.Information("The scroll emits a brilliant flash of red light and the monsters flee!");
                break;
            }
            SetKnown();

            CurUser.SpendAndNext(TimeToRead);
        }
コード例 #9
0
        protected internal override void DoRead()
        {
            foreach (var mob in Dungeon.Level.mobs)
            {
                mob.Beckon(CurUser.pos);
            }

            GLog.Warning("The scroll emits a challenging roar that echoes throughout the dungeon!");
            SetKnown();

            CurUser.Sprite.CenterEmitter().Start(Speck.Factory(Speck.SCREAM), 0.3f, 3);
            Sample.Instance.Play(Assets.SND_CHALLENGE);
            Invisibility.Dispel();

            CurUser.SpendAndNext(TimeToRead);
        }
コード例 #10
0
        protected internal override void DoRead()
        {
            GameScene.Flash(new Color(0xFFFFFF));

            Sample.Instance.Play(Assets.SND_BLAST);
            Invisibility.Dispel();

            foreach (var mob in Dungeon.Level.mobs.Where(mob => Level.fieldOfView[mob.pos]))
            {
                Buff.Prolong <Blindness>(mob, pdsharp.utils.Random.Int(3, 6));
                mob.Damage(pdsharp.utils.Random.IntRange(1, mob.HT * 2 / 3), this);
            }

            Buff.Prolong <Blindness>(CurUser, pdsharp.utils.Random.Int(3, 6));
            Dungeon.Observe();

            SetKnown();

            CurUser.SpendAndNext(TimeToRead);
        }
コード例 #11
0
        public void OnSelect(Item item)
        {
            if (item != null)
            {
                _scroll.OnItemSelected(item);
                _scroll.CurUser.SpendAndNext(Scroll.TimeToRead);
#if !DEBUG
                Sample.Instance.Play(Assets.SND_READ);
#endif
                Invisibility.Dispel();
            }
            else
            if (_scroll.IdentifiedByUse)
            {
                _scroll.ConfirmCancelation();
            }
            else
            {
                _scroll.Collect(_scroll.CurUser.Belongings.Backpack);
            }
        }
コード例 #12
0
        protected internal override void DoRead()
        {
            var count = CurUser.Belongings.Charge(true);

            Charge(CurUser);

            Sample.Instance.Play(Assets.SND_READ);
            Invisibility.Dispel();

            if (count > 0)
            {
                GLog.Information("a surge of energy courses through your pack, recharging your wand" + (count > 1 ? "s" : ""));
                SpellSprite.Show(CurUser, SpellSprite.Charge);
            }
            else
            {
                GLog.Information("a surge of energy courses through your pack, but nothing happens");
            }

            SetKnown();

            CurUser.SpendAndNext(TimeToRead);
        }
コード例 #13
0
        public void OnSelect(int?target)
        {
            if (target == null)
            {
                return;
            }

            if (target == _wand.CurUser.pos)
            {
                GLog.Information(Wand.TxtSelfTarget);
                return;
            }

            _wand.SetKnown();

            _cell = Ballistica.Cast(_wand.CurUser.pos, target.Value, true, _wand.HitChars);
            _wand.CurUser.Sprite.DoZap(_cell);

            QuickSlot.Target(_wand, Actor.FindChar(_cell));

            if (_wand.CurrrentCharges > 0)
            {
                _wand.CurUser.Busy();

                _wand.Fx(_cell, this);

                Invisibility.Dispel();
            }
            else
            {
                _wand.CurUser.SpendAndNext(Wand.TimeToZap);
                GLog.Warning(Wand.TxtFizzles);
                _wand.levelKnown = true;

                _wand.UpdateQuickslot();
            }
        }