// Function from file: flashbang.dm public void bang(dynamic T = null, Mob_Living M = null) { bool ear_safety = false; int distance = 0; M.show_message("<span class='warning'>BANG</span>", 2); GlobalFuncs.playsound(this.loc, "sound/weapons/flashbang.ogg", 100, 1); ear_safety = M.check_ear_prot(); distance = Num13.MaxInt(1, Map13.GetDistance(this, T)); if (M.weakeyes) { M.visible_message("<span class='disarm'><b>" + M + "</b> screams and collapses!</span>"); M.WriteMsg("<span class='userdanger'><font size=3>AAAAGH!</font></span>"); M.Weaken(15); M.Stun(15); M.adjust_eye_damage(8); } if (M.flash_eyes(null, null, true)) { M.Stun(Num13.MaxInt(((int)(10 / distance)), 3)); M.Weaken(Num13.MaxInt(((int)(10 / distance)), 3)); } if (this.loc == M || this.loc == M.loc) { M.Stun(10); M.Weaken(10); } if (!ear_safety) { M.WriteMsg(new Sound("sound/weapons/flash_ring.ogg", false, true, 0, 100)); M.Stun(Num13.MaxInt(((int)(10 / distance)), 3)); M.Weaken(Num13.MaxInt(((int)(10 / distance)), 3)); M.setEarDamage(M.ear_damage + Rand13.Int(0, 5), Num13.MaxInt(((int)(M.ear_deaf ?? 0)), 15)); if (M.ear_damage >= 15) { M.WriteMsg("<span class='warning'>Your ears start to ring badly!</span>"); if (Rand13.PercentChance(M.ear_damage - 10 + 5)) { M.WriteMsg("<span class='warning'>You can't hear anything!</span>"); M.disabilities |= 4; } } else if (M.ear_damage >= 5) { M.WriteMsg("<span class='warning'>Your ears start to ring!</span>"); } } return; }