public void Ranged_physical_damage_on_Rot_skips_splashback_damage() { var asys = SourceMe.The <AttackSystem>(); var flameRat = BeingCreator.CreateBeing("flame rat"); var am = new AttackMethod("physical.impact.point", "1d3 +2"); var rot = new AreaRot(); flameRat.MoveTo((3, 3)); var rotmap = new RotMap { { rot, new Coord(8, 8) } }; Attack attack = new Attack { Attacker = flameRat, AttackMethod = am, Defender = rot, DefenseMethod = rot.GetDefenseMethod(am) }; Assert.That(asys.AttackQueue.Count, Is.EqualTo(0)); asys.CheckForSpecials(attack); Assert.That(asys.AttackQueue.Count, Is.EqualTo(0), "Because of distance, rot should not splashback attack."); }
public void Nature_strikes_neighboring_rot_through_our_hero() { var player = BeingCreator.CreateBeing("Suvail"); var am = new AttackMethod("physical.impact.blunt", "1d3 +2"); var rot = new AreaRot(); Attack attack = new Attack { Attacker = player, AttackMethod = am, Defender = rot, DefenseMethod = rot.GetDefenseMethod(am) }; RotMap rotMap = new RotMap(); //...add two neighbor ABs, and one further away var nbor_1 = new AreaRot(); var nbor_2 = new AreaRot(); var stranger = new AreaRot(); rotMap.Add(rot, (2, 2)); rotMap.Add(nbor_1, (2, 3)); rotMap.Add(nbor_2, (3, 1)); rotMap.Add(stranger, (8, 2)); GameState gs = new GameState(); var cm = new CompoundMap(); cm.RotMap = rotMap; gs.Map = cm; var asys = new AttackSystem { GameState = gs }; SourceMe.InjectProperties(asys); Assert.That(asys.AttackQueue.Count, Is.EqualTo(0)); asys.CheckForSpecials(attack); Assert.That(asys.AttackQueue.Count, Is.EqualTo(4)); var splashBack = asys.AttackQueue.Dequeue(); Assert.NotNull(splashBack); var newAttack = asys.AttackQueue.Dequeue(); Assert.That(newAttack.Defender, Is.EqualTo(rot)); newAttack = asys.AttackQueue.Dequeue(); Assert.That(newAttack.Defender, Is.EqualTo(nbor_2)); newAttack = asys.AttackQueue.Dequeue(); Assert.That(newAttack.Defender, Is.EqualTo(nbor_1)); }
public bool RemoveFromAppropriateMap(IDelible mote) { // remove from whichever map if (mote is IAreaRot rot) { RotMap.Remove(rot); return(true); } if (mote is IBeing being) { return(BeingMap.Remove(being)); } //1.+: Make IItems IDestroyable if (mote is IItem item) { return(ItemMap.Remove(item)); } throw new Exception($"Unsure how to destroy a {mote.GetType().Name}."); }