mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-19 17:38:26 +00:00
Switch random function to std::mt19937
Added class EQEmu::Random Functions: EQEmu::Random::Int(int low, int high) EQEmu::Random::Real(double low, double high) EQEmu::Random::Roll(int required) EQEmu::Random::Roll(double required) EQEmu::Random::Reseed() For zone, you will access the random object through the zone object ex. zone->random.Int(0, 100); Int returns a random int between low and high Real returns a random double between low and high Roll(int) returns true if Int(0, 99) < required is true Roll(double) returns true if Real(0.0, 1.0) <= required is true
This commit is contained in:
+3
-3
@@ -329,7 +329,7 @@ bool Mob::CheckWillAggro(Mob *mob) {
|
||||
||
|
||||
(
|
||||
fv == FACTION_THREATENLY
|
||||
&& MakeRandomInt(0,99) < THREATENLY_ARRGO_CHANCE - heroicCHA_mod
|
||||
&& zone->random.Roll(THREATENLY_ARRGO_CHANCE - heroicCHA_mod)
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -1254,7 +1254,7 @@ bool Mob::PassCharismaCheck(Mob* caster, Mob* spellTarget, uint16 spell_id) {
|
||||
return true;
|
||||
|
||||
//1: The mob has a default 25% chance of being allowed a resistance check against the charm.
|
||||
if (MakeRandomInt(0, 99) > RuleI(Spells, CharmBreakCheckChance))
|
||||
if (zone->random.Int(0, 99) > RuleI(Spells, CharmBreakCheckChance))
|
||||
return true;
|
||||
|
||||
if (RuleB(Spells, CharismaCharmDuration))
|
||||
@@ -1273,7 +1273,7 @@ bool Mob::PassCharismaCheck(Mob* caster, Mob* spellTarget, uint16 spell_id) {
|
||||
//3: At maxed ability, Total Domination has a 50% chance of preventing the charm break that otherwise would have occurred.
|
||||
int16 TotalDominationBonus = caster->aabonuses.CharmBreakChance + caster->spellbonuses.CharmBreakChance + caster->itembonuses.CharmBreakChance;
|
||||
|
||||
if (MakeRandomInt(0, 99) < TotalDominationBonus)
|
||||
if (zone->random.Int(0, 99) < TotalDominationBonus)
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user