Exemplo n.º 1
0
        public virtual void Melt()
        {
            _target.ResetColor();
            KillAndErase();

            if (!Visible)
            {
                return;
            }

            Splash.At(_target.Center(), Color.Argb(0xFF, 0xB2, 0xD6, 0xFF), 5);
            Sample.Instance.Play(Assets.SND_SHATTER);
        }
Exemplo n.º 2
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);
        }