diff options
Diffstat (limited to 'src/game/SpellEffects.cpp')
| -rw-r--r-- | src/game/SpellEffects.cpp | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 86c2235cdb5..a1cf876fc6c 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -315,7 +315,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx) //Gore if(m_spellInfo->SpellIconID == 2269 ) { - damage+= rand()%2 ? damage : 0; + damage+= (uint32)unitTarget->GetMap()->rand32()%2 ? damage : 0; } // Meteor like spells (divided damage to targets) @@ -563,7 +563,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx) // Steady Shot else if(m_spellInfo->SpellFamilyFlags & 0x100000000LL) { - int32 base = irand((int32)m_caster->GetWeaponDamageRange(RANGED_ATTACK, MINDAMAGE),(int32)m_caster->GetWeaponDamageRange(RANGED_ATTACK, MAXDAMAGE)); + int32 base = m_caster->GetMap()->irand((int32)m_caster->GetWeaponDamageRange(RANGED_ATTACK, MINDAMAGE),(int32)m_caster->GetWeaponDamageRange(RANGED_ATTACK, MAXDAMAGE)); damage += int32(float(base)/m_caster->GetAttackTime(RANGED_ATTACK)*2800 + m_caster->GetTotalAttackPowerValue(RANGED_ATTACK)*0.2f); bool found = false; @@ -708,7 +708,7 @@ void Spell::EffectDummy(uint32 i) return; uint32 spell_id = 0; - switch(urand(1,5)) + switch(m_caster->GetMap()->urand(1,5)) { case 1: spell_id = 8064; break; // Sleepy case 2: spell_id = 8065; break; // Invigorate @@ -725,7 +725,7 @@ void Spell::EffectDummy(uint32 i) return; uint32 spell_id = 0; - switch(urand(1,2)) + switch(m_caster->GetMap()->urand(1,2)) { // Flip Out - ninja case 1: spell_id = (m_caster->getGender() == GENDER_MALE ? 8219 : 8220); break; @@ -785,7 +785,7 @@ void Spell::EffectDummy(uint32 i) uint32 spell_id = 0; - uint32 roll = urand(0, 99); + uint32 roll = m_caster->GetMap()->urand(0, 99); if(roll < 2) // 2% for 30 sec self root (off-like chance unknown) spell_id = 16566; @@ -856,7 +856,7 @@ void Spell::EffectDummy(uint32 i) return; uint32 spell_id = 0; - switch(urand(1,3)) + switch(m_caster->GetMap()->urand(1,3)) { case 1: spell_id = 16595; break; case 2: spell_id = 16593; break; @@ -932,7 +932,7 @@ void Spell::EffectDummy(uint32 i) return; case 23448: // Ultrasafe Transporter: Gadgetzan - backfires { - int32 r = irand(0, 119); + int32 r = m_caster->GetMap()->irand(0, 119); if ( r < 20 ) // 1/6 polymorph m_caster->CastSpell(m_caster,23444,true); else if ( r < 100 ) // 4/6 evil twin @@ -1033,7 +1033,7 @@ void Spell::EffectDummy(uint32 i) uint32 spell_id = 0; - switch(urand(1,5)) + switch(m_caster->GetMap()->urand(1,5)) { case 1: spell_id = 33053; break; case 2: spell_id = 33057; break; @@ -1071,7 +1071,7 @@ void Spell::EffectDummy(uint32 i) { // selecting one from Bloodstained Fortune item uint32 newitemid; - switch(urand(1,20)) + switch(m_caster->GetMap()->urand(1,20)) { case 1: newitemid = 32688; break; case 2: newitemid = 32689; break; @@ -1145,7 +1145,7 @@ void Spell::EffectDummy(uint32 i) tempSummon->UnSummon(); - Creature* pCreature = m_caster->SummonCreature(entry_list[urand(0, 2)], x, y, z, o,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,180000); + Creature* pCreature = m_caster->SummonCreature(entry_list[m_caster->GetMap()->urand(0, 2)], x, y, z, o,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,180000); if (!pCreature) return; @@ -1297,7 +1297,7 @@ void Spell::EffectDummy(uint32 i) { //Polymorph Cast Visual Rank 1 const uint32 spell_list[6] = {32813, 32816, 32817, 32818, 32819, 32820}; - unitTarget->CastSpell( unitTarget, spell_list[urand(0, 5)], true); + unitTarget->CastSpell( unitTarget, spell_list[m_caster->GetMap()->urand(0, 5)], true); } return; } @@ -2039,7 +2039,7 @@ void Spell::EffectTeleportUnits(uint32 i) // Dimensional Ripper - Everlook case 23442: { - int32 r = irand(0, 119); + int32 r = m_caster->GetMap()->irand(0, 119); if ( r >= 70 ) // 7/12 success { if ( r < 100 ) // 4/12 evil twin @@ -2054,7 +2054,7 @@ void Spell::EffectTeleportUnits(uint32 i) { if ( roll_chance_i(50) ) // 50% success { - int32 rand_eff = urand(1,7); + int32 rand_eff = m_caster->GetMap()->urand(1,7); switch ( rand_eff ) { case 1: @@ -2099,7 +2099,7 @@ void Spell::EffectTeleportUnits(uint32 i) { if ( roll_chance_i(50) ) // 50% success { - int32 rand_eff = urand(1,4); + int32 rand_eff = m_caster->GetMap()->urand(1,4); switch ( rand_eff ) { case 1: @@ -2557,7 +2557,7 @@ void Spell::DoCreateItem(uint32 i, uint32 itemtype) /*int32 basePoints = m_currentBasePoints[i]; int32 randomPoints = m_spellInfo->EffectDieSides[i]; if (randomPoints) - num_to_add = basePoints + irand(1, randomPoints); + num_to_add = basePoints + m_caster->GetMap()->irand(1, randomPoints); else num_to_add = basePoints + 1;*/ } @@ -2747,7 +2747,7 @@ void Spell::EffectEnergize(uint32 i) if (!elixirs.empty()) { // cast random elixir on target - uint32 rand_spell = urand(0,elixirs.size()-1); + uint32 rand_spell = m_caster->GetMap()->urand(0,elixirs.size()-1); m_caster->CastSpell(unitTarget,elixirs[rand_spell],true,m_CastItem); } } @@ -3292,7 +3292,7 @@ void Spell::EffectDispel(uint32 i) for (int32 count=0; count < damage && list_size > 0; ++count) { // Random select buff for dispel - Aura *aur = dispel_list[urand(0, list_size-1)]; + Aura *aur = dispel_list[m_caster->GetMap()->urand(0, list_size-1)]; SpellEntry const* spellInfo = aur->GetSpellProto(); // Base dispel chance @@ -3440,7 +3440,7 @@ void Spell::EffectPickPocket(uint32 /*i*/) { int32 chance = 10 + int32(m_caster->getLevel()) - int32(unitTarget->getLevel()); - if (chance > irand(0, 19)) + if (chance > m_caster->GetMap()->irand(0, 19)) { // Stealing successful //sLog.outDebug("Sending loot from pickpocket"); @@ -4485,7 +4485,7 @@ void Spell::EffectScriptEffect(uint32 effIndex) uint32 iTmpSpellId; - switch(urand(0,3)) + switch(m_caster->GetMap()->urand(0,3)) { case 0: iTmpSpellId = 26272; @@ -4513,7 +4513,7 @@ void Spell::EffectScriptEffect(uint32 effIndex) return; uint32 spell_id = 0; - switch(urand(1,5)) + switch(m_caster->GetMap()->urand(1,5)) { case 1: spell_id = 8854; break; default: spell_id = 8855; break; @@ -4682,7 +4682,7 @@ void Spell::EffectScriptEffect(uint32 effIndex) for(uint8 i=0; i<5; i++) if(unitTarget->HasAura(spellid+i, 0)) return; - unitTarget->CastSpell(unitTarget, spellid+urand(0, 4), true); + unitTarget->CastSpell(unitTarget, spellid+m_caster->GetMap()->urand(0, 4), true); break; } @@ -4702,7 +4702,7 @@ void Spell::EffectScriptEffect(uint32 effIndex) case 29830: { uint32 item = 0; - switch ( urand(1,6) ) + switch ( m_caster->GetMap()->urand(1,6) ) { case 1: case 2: case 3: item = 23584; break;// Loch Modan Lager case 4: case 5: item = 23585; break;// Stouthammer Lite @@ -4746,7 +4746,7 @@ void Spell::EffectScriptEffect(uint32 effIndex) return; uint32 spellId; - switch(rand()%4) + switch((uint32)m_caster->GetMap()->rand32()%4) { case 0: spellId=46740; @@ -5747,7 +5747,7 @@ void Spell::EffectKnockBack(uint32 i) float vcos, vsin; if(dx < 0.001f && dy < 0.001f) { - float angle = rand_norm()*2*M_PI; + float angle = m_caster->GetMap()->rand_norm()*2*M_PI; vcos = cos(angle); vsin = sin(angle); } @@ -5991,7 +5991,7 @@ void Spell::EffectTransmitted(uint32 effIndex) { float min_dis = GetSpellMinRange(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex)); float max_dis = GetSpellMaxRange(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex)); - float dis = rand_norm() * (max_dis - min_dis) + min_dis; + float dis = m_caster->GetMap()->rand_norm() * (max_dis - min_dis) + min_dis; m_caster->GetClosePoint(fx,fy,fz,DEFAULT_WORLD_OBJECT_SIZE, dis); } @@ -6041,7 +6041,7 @@ void Spell::EffectTransmitted(uint32 effIndex) // end time of range when possible catch fish (FISHING_BOBBER_READY_TIME..GetDuration(m_spellInfo)) // start time == fish-FISHING_BOBBER_READY_TIME (0..GetDuration(m_spellInfo)-FISHING_BOBBER_READY_TIME) int32 lastSec; - switch(urand(0, 3)) + switch(m_caster->GetMap()->urand(0, 3)) { case 0: lastSec = 3; break; case 1: lastSec = 7; break; @@ -6221,7 +6221,7 @@ void Spell::EffectStealBeneficialBuff(uint32 i) for (int32 count=0; count < damage && list_size > 0; ++count) { // Random select buff for dispel - Aura *aur = steal_list[urand(0, list_size-1)]; + Aura *aur = steal_list[m_caster->GetMap()->urand(0, list_size-1)]; // Not use chance for steal // TODO possible need do it success_list.push_back( std::pair<uint32,uint64>(aur->GetId(),aur->GetCasterGUID())); |
