public virtual void Burn() { if (HeapType != Type.Heap) { return; } var burnt = false; var evaporated = false; foreach (var item in Items) { if (item is Scroll) { Items.Remove(item); burnt = true; } else if (item is Dewdrop) { Items.Remove(item); evaporated = true; } else if (item is MysteryMeat) { Replace(item, ChargrilledMeat.Cook((MysteryMeat)item)); burnt = true; } } if (!burnt && !evaporated) { return; } if (Dungeon.Visible[Pos]) { if (burnt) { BurnFx(Pos); } else { EvaporateFx(Pos); } } if (IsEmpty) { Destroy(); } else if (Sprite != null) { Sprite.View(Image(), Glowing()); } }
protected override bool Act() { if (Target.IsAlive) { if (Target is Hero) { Prolong <Light>(Target, Tick * 1.01f); } Target.Damage(pdsharp.utils.Random.Int(1, 5), this); var hero = Target as Hero; if (hero != null) { var item = hero.Belongings.RandomUnequipped(); if (item is Scroll) { item = item.Detach(hero.Belongings.Backpack); GLog.Warning(TXT_BURNS_UP, item.ToString()); Heap.BurnFx(hero.pos); } else if (item is MysteryMeat) { item = item.Detach(hero.Belongings.Backpack); var steak = new ChargrilledMeat(); if (!steak.Collect(hero.Belongings.Backpack)) { Dungeon.Level.Drop(steak, hero.pos).Sprite.Drop(); } GLog.Warning(TXT_BURNS_UP, item.ToString()); Heap.BurnFx(hero.pos); } } else if (Target is Thief && ((Thief)Target).Item is Scroll) { ((Thief)Target).Item = null; Target.Sprite.Emitter().Burst(ElmoParticle.Factory, 6); } } else { Detach(); } if (levels.Level.flamable[Target.pos]) { GameScene.Add(Blob.Seed(Target.pos, 4, typeof(Fire))); } Spend(Tick); left -= Tick; if (left <= 0 || Random.Float() > (2 + (float)Target.HP / Target.HT) / 3 || (levels.Level.water[Target.pos] && !Target.Flying)) { Detach(); } return(true); }