#W# Traps: New region traps tweaked. Also give skill gains. Settings to disable messages.
This commit is contained in:
parent
becd970525
commit
a055a9e525
3 changed files with 46 additions and 26 deletions
|
|
@ -23,25 +23,41 @@ namespace Server.Engines.DungeonTraps
|
||||||
// The master method called when a region step roll succeeds
|
// The master method called when a region step roll succeeds
|
||||||
public virtual void Trigger(PlayerMobile pm)
|
public virtual void Trigger(PlayerMobile pm)
|
||||||
{
|
{
|
||||||
// 1. Remove Trap Check (Absolute Disarm)
|
// 1. Detect Hidden Check (Spot and Avoid)
|
||||||
double removeTrap = pm.Skills[SkillName.RemoveTrap].Value;
|
// Uses CheckSkill to allow for skill gains. 0.0 to 100.0 means the success chance scales exactly with their skill.
|
||||||
if (removeTrap > 0 && removeTrap >= Utility.RandomDouble() * 100.0)
|
if (pm.Skills[SkillName.DetectHidden].Value > 0 && pm.CheckSkill(SkillName.DetectHidden, 0.0, 100.0))
|
||||||
{
|
{
|
||||||
pm.SendMessage(0x35, $"You hear a click and instinctively jam the {Name} mechanism before it fires.");
|
if (Settings.S_TrapDetected)
|
||||||
pm.PlaySound(0x3A4); // Click sound
|
{
|
||||||
|
pm.SendMessage(0x42, $"You spot a concealed {Name} and carefully step around it.");
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. Evasion Check: (Dex + Int) * 0.25
|
// 2. Remove Trap Check (Absolute Disarm)
|
||||||
|
if (pm.Skills[SkillName.RemoveTrap].Value > 0 && pm.CheckSkill(SkillName.RemoveTrap, 0.0, 100.0))
|
||||||
|
{
|
||||||
|
if (Settings.S_TrapDetected)
|
||||||
|
{
|
||||||
|
pm.SendMessage(0x35, $"You hear a click and instinctively jam the {Name} mechanism before it fires.");
|
||||||
|
pm.PlaySound(0x3A4); // Click sound
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. Evasion Check: (Dex + Int) * 0.25
|
||||||
double evasionChance = (pm.Dex + pm.Int) * 0.25;
|
double evasionChance = (pm.Dex + pm.Int) * 0.25;
|
||||||
if (evasionChance >= Utility.RandomDouble() * 100.0)
|
if (evasionChance >= Utility.RandomDouble() * 100.0)
|
||||||
{
|
{
|
||||||
pm.SendMessage(0x59, $"A {Name} triggers, but your quick reflexes allow you to dodge it!");
|
if (Settings.S_TrapDetected)
|
||||||
PlayTrapEffect(pm); // Trap goes off, but misses
|
{
|
||||||
|
pm.SendMessage(0x59, $"A {Name} triggers, but your quick reflexes allow you to dodge it!");
|
||||||
|
PlayTrapEffect(pm); // Trap goes off, but misses
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Mitigation Check (AR for Physical, Magic Resist for Magical)
|
// 4. Mitigation Check (AR for Physical, Magic Resist for Magical)
|
||||||
PlayTrapEffect(pm);
|
PlayTrapEffect(pm);
|
||||||
bool mitigated = false;
|
bool mitigated = false;
|
||||||
|
|
||||||
|
|
@ -55,22 +71,29 @@ namespace Server.Engines.DungeonTraps
|
||||||
}
|
}
|
||||||
else // Magical
|
else // Magical
|
||||||
{
|
{
|
||||||
if (pm.Skills[SkillName.MagicResist].Value >= Utility.RandomDouble() * 100.0)
|
// Magic Resist check with skill gain opportunity
|
||||||
|
if (pm.Skills[SkillName.MagicResist].Value > 0 && pm.CheckSkill(SkillName.MagicResist, 0.0, 100.0))
|
||||||
{
|
{
|
||||||
mitigated = true;
|
mitigated = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. Resolve Impact
|
// 5. Resolve Impact
|
||||||
if (mitigated)
|
if (mitigated)
|
||||||
{
|
{
|
||||||
pm.SendMessage(0x22, $"Your defenses absorb the {Name}, but your equipment takes a beating!");
|
if (Settings.S_TrapDamageMitigated)
|
||||||
DamageRandomArmor(pm);
|
{
|
||||||
|
pm.SendMessage(0x22, $"Your defenses absorb the {Name}, but your equipment takes a beating!");
|
||||||
|
DamageRandomArmor(pm);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pm.SendMessage(0x22, $"You are struck by a {Name}!");
|
if (Settings.S_TrapDamageMitigated)
|
||||||
ApplyDamage(pm);
|
{
|
||||||
|
pm.SendMessage(0x22, $"You are struck by a {Name}!");
|
||||||
|
ApplyDamage(pm);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -142,8 +165,8 @@ namespace Server.Engines.DungeonTraps
|
||||||
{
|
{
|
||||||
public override string Name => "hidden explosive";
|
public override string Name => "hidden explosive";
|
||||||
public override TrapDamageType DamageType => TrapDamageType.Physical;
|
public override TrapDamageType DamageType => TrapDamageType.Physical;
|
||||||
public override int MinDamage => 20;
|
public override int MinDamage => 15;
|
||||||
public override int MaxDamage => 40;
|
public override int MaxDamage => 30;
|
||||||
|
|
||||||
public override void PlayTrapEffect(PlayerMobile pm)
|
public override void PlayTrapEffect(PlayerMobile pm)
|
||||||
{
|
{
|
||||||
|
|
@ -156,8 +179,8 @@ namespace Server.Engines.DungeonTraps
|
||||||
{
|
{
|
||||||
public override string Name => "flame jet";
|
public override string Name => "flame jet";
|
||||||
public override TrapDamageType DamageType => TrapDamageType.Magical;
|
public override TrapDamageType DamageType => TrapDamageType.Magical;
|
||||||
public override int MinDamage => 20;
|
public override int MinDamage => 15;
|
||||||
public override int MaxDamage => 40;
|
public override int MaxDamage => 30;
|
||||||
|
|
||||||
public override void PlayTrapEffect(PlayerMobile pm)
|
public override void PlayTrapEffect(PlayerMobile pm)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -95,15 +95,10 @@ namespace Server.Regions
|
||||||
return; // Player is still in their grace period
|
return; // Player is still in their grace period
|
||||||
}
|
}
|
||||||
|
|
||||||
// 5. Calculate Trigger Chance (Base 5% chance per step)
|
|
||||||
// Detect Hidden actively reduces this chance.
|
|
||||||
// At 0 DH = 5% chance. At 100 DH = 1% chance.
|
|
||||||
double baseChance = ValidSettings.RegionDungeonTrapsChance();
|
double baseChance = ValidSettings.RegionDungeonTrapsChance();
|
||||||
double detectHidden = pm.Skills[SkillName.DetectHidden].Value;
|
|
||||||
double finalChance = Math.Max(1.0, baseChance - (detectHidden / 25.0));
|
|
||||||
|
|
||||||
// 6. Roll for Trap Trigger
|
// 6. Roll for Trap Trigger
|
||||||
if (Utility.RandomDouble() * 100.0 <= finalChance)
|
if (Utility.RandomDouble() * 100.0 <= baseChance)
|
||||||
{
|
{
|
||||||
// Pick a random trap from the pool
|
// Pick a random trap from the pool
|
||||||
BaseRegionTrap trap = _dungeonTraps[Utility.Random(_dungeonTraps.Length)];
|
BaseRegionTrap trap = _dungeonTraps[Utility.Random(_dungeonTraps.Length)];
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,8 @@ namespace Server
|
||||||
public static int S_DungeonBountyRefusalDelay = 10; // 1-1440 minutes delay between refusing a quest
|
public static int S_DungeonBountyRefusalDelay = 10; // 1-1440 minutes delay between refusing a quest
|
||||||
public static bool S_DungeonTraps = false; // Spawns Dugeon floor traps
|
public static bool S_DungeonTraps = false; // Spawns Dugeon floor traps
|
||||||
public static bool S_RegionDungeonTraps = true; // Step activated dungeon traps
|
public static bool S_RegionDungeonTraps = true; // Step activated dungeon traps
|
||||||
public static int S_RegionDungeonTrapsChance = 5; // 1-100 Chance to get a trap check per step
|
public static int S_RegionDungeonTrapsChance = 3; // 1-100 Chance to get a trap check per step
|
||||||
|
public static bool S_TrapDetected = false; // Get a message if the trap gets detected
|
||||||
|
public static bool S_TrapDamageMitigated = true; // Get a message if the trap damage gets mitigated
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue