summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxazax-hun <xazax-hun@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-04-25 18:31:34 +0000
committerxazax-hun <xazax-hun@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-04-25 18:31:34 +0000
commit71693d0f15245dd87b243b0feaa2737f9525b8cb (patch)
tree967ac6d3ab6b9977e0aae594ab9259e6d9635a48
parent11c2d016d40070f1895d88c0eb7bb88079555cfd (diff)
downloadhercules-71693d0f15245dd87b243b0feaa2737f9525b8cb.tar.gz
hercules-71693d0f15245dd87b243b0feaa2737f9525b8cb.tar.bz2
hercules-71693d0f15245dd87b243b0feaa2737f9525b8cb.tar.xz
hercules-71693d0f15245dd87b243b0feaa2737f9525b8cb.zip
* Replaced rand() calls with rnd().
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15975 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--src/map/atcommand.c2
-rw-r--r--src/map/battle.c18
-rw-r--r--src/map/elemental.c2
-rw-r--r--src/map/pc.c2
-rw-r--r--src/map/skill.c40
5 files changed, 32 insertions, 32 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index d5a8e75e0..6ad69e5e3 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -6251,7 +6251,7 @@ ACMD_FUNC(pettalk)
};
int i;
ARR_FIND( 0, ARRAYLENGTH(emo), i, stricmp(message, emo[i]) == 0 );
- if( i == E_DICE1 ) i = rand()%6 + E_DICE1; // randomize /dice
+ if( i == E_DICE1 ) i = rnd()%6 + E_DICE1; // randomize /dice
if( i < ARRAYLENGTH(emo) )
{
if (sd->emotionlasttime + 1 >= time(NULL)) { // not more than 1 per second
diff --git a/src/map/battle.c b/src/map/battle.c
index eb8444d07..167a040ce 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -652,7 +652,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag
if (!damage) return 0;
- if( (sce = sc->data[SC_LIGHTNINGWALK]) && flag&BF_LONG && rand()%100 < sce->val1 ) {
+ if( (sce = sc->data[SC_LIGHTNINGWALK]) && flag&BF_LONG && rnd()%100 < sce->val1 ) {
int dx[8]={0,-1,-1,-1,0,1,1,1};
int dy[8]={1,1,0,-1,-1,-1,0,1};
int dir = map_calc_dir(bl, src->x, src->y);
@@ -674,7 +674,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag
if( sd && (sce = sc->data[SC_FORCEOFVANGUARD]) && flag&BF_WEAPON && rnd()%100 < sce->val2 )
pc_addspiritball(sd,skill_get_time(LG_FORCEOFVANGUARD,sce->val1),sce->val3);
- if( sc->data[SC__DEADLYINFECT] && damage > 0 && rand()%100 < 65 + 5 * sc->data[SC__DEADLYINFECT]->val1 )
+ if( sc->data[SC__DEADLYINFECT] && damage > 0 && rnd()%100 < 65 + 5 * sc->data[SC__DEADLYINFECT]->val1 )
status_change_spread(bl, src); // Deadly infect attacked side
if( sc && sc->data[SC__SHADOWFORM] ) {
@@ -730,7 +730,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag
}
if( sc->data[SC_POISONINGWEAPON] && skill_num != GC_VENOMPRESSURE && (flag&BF_WEAPON) && damage > 0 && rnd()%100 < sc->data[SC_POISONINGWEAPON]->val3 )
sc_start(bl,sc->data[SC_POISONINGWEAPON]->val2,100,sc->data[SC_POISONINGWEAPON]->val1,skill_get_time2(GC_POISONINGWEAPON,sc->data[SC_POISONINGWEAPON]->val1));
- if( sc->data[SC__DEADLYINFECT] && damage > 0 && rand()%100 < 65 + 5 * sc->data[SC__DEADLYINFECT]->val1 )
+ if( sc->data[SC__DEADLYINFECT] && damage > 0 && rnd()%100 < 65 + 5 * sc->data[SC__DEADLYINFECT]->val1 )
status_change_spread(src, bl);
}
@@ -768,7 +768,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag
mobskill_event((TBL_MOB*)bl,src,gettick(),MSC_SKILLUSED|(skill_num<<16));
}
if( sd ) {
- if( (sd->sc.option&OPTION_MADOGEAR) && rand()%100 < 50 ) {
+ if( (sd->sc.option&OPTION_MADOGEAR) && rnd()%100 < 50 ) {
short element = skill_get_ele(skill_num, skill_lv);
if( !skill_num || element == -1 ) { //Take weapon's element
struct status_data *sstatus = NULL;
@@ -3764,7 +3764,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
{
int level = sd?sd->status.base_level:status_get_lv(src);
md.damage = skill_lv*sstatus->dex*(3+level/100)*(1+sstatus->int_/35);
- md.damage+= md.damage*(rand()%20-10)/100;
+ md.damage+= md.damage*(rnd()%20-10)/100;
md.damage+= 40*(sd?pc_checkskill(sd,RA_RESEARCHTRAP):0);
}
break;
@@ -4083,7 +4083,7 @@ int battle_calc_return_damage(struct block_list* bl, struct block_list *src, int
if (rdamage < 1) rdamage = 1;
}
}
- if( sc && sc->data[SC_CRESCENTELBOW] && !(flag&BF_SKILL) && !is_boss(src) && rand()%100 < sc->data[SC_CRESCENTELBOW]->val2 )
+ if( sc && sc->data[SC_CRESCENTELBOW] && !(flag&BF_SKILL) && !is_boss(src) && rnd()%100 < sc->data[SC_CRESCENTELBOW]->val2 )
{ // Stimated formula from test
rdamage += (int)((*dmg) + (*dmg) * status_get_hp(src) * 2.15 / 100000);
if( rdamage < 1 ) rdamage = 1;
@@ -4321,7 +4321,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
return ATK_MISS;
}
if( sc->data[SC_GT_ENERGYGAIN] ) {
- if( sd && rand()%100 < 10 + 5 * sc->data[SC_GT_ENERGYGAIN]->val1)
+ if( sd && rnd()%100 < 10 + 5 * sc->data[SC_GT_ENERGYGAIN]->val1)
pc_addspiritball(sd,
skill_get_time(MO_CALLSPIRITS, sc->data[SC_GT_ENERGYGAIN]->val1),
sc->data[SC_GT_ENERGYGAIN]->val1);
@@ -4345,7 +4345,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
else
status_change_end(src,SC_SPELLFIST,INVALID_TIMER);
}
- if( sc->data[SC_GIANTGROWTH] && (wd.flag&BF_SHORT) && rand()%100 < sc->data[SC_GIANTGROWTH]->val2 )
+ if( sc->data[SC_GIANTGROWTH] && (wd.flag&BF_SHORT) && rnd()%100 < sc->data[SC_GIANTGROWTH]->val2 )
wd.damage *= 3; // Triple Damage
}
if (sd && sd->state.arrow_atk) //Consume arrow.
@@ -4451,7 +4451,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
}
}
if (sd) {
- if( wd.flag&BF_SHORT && sc && sc->data[SC__AUTOSHADOWSPELL] && rand()%100 < sc->data[SC__AUTOSHADOWSPELL]->val3 &&
+ if( wd.flag&BF_SHORT && sc && sc->data[SC__AUTOSHADOWSPELL] && rnd()%100 < sc->data[SC__AUTOSHADOWSPELL]->val3 &&
sd->status.skill[sc->data[SC__AUTOSHADOWSPELL]->val1].id != 0 && sd->status.skill[sc->data[SC__AUTOSHADOWSPELL]->val1].flag == SKILL_FLAG_PLAGIARIZED )
{
int r_skill = sd->status.skill[sc->data[SC__AUTOSHADOWSPELL]->val1].id,
diff --git a/src/map/elemental.c b/src/map/elemental.c
index a021e8b26..902c598e3 100644
--- a/src/map/elemental.c
+++ b/src/map/elemental.c
@@ -611,7 +611,7 @@ static int elemental_ai_sub_timer(struct elemental_data *ed, struct map_session_
return 1;
}
- if( battle_check_range(&ed->bl,target,ed->db->range2) && rand()%100 < 2 ) { // 2% chance to cast attack skill.
+ if( battle_check_range(&ed->bl,target,ed->db->range2) && rnd()%100 < 2 ) { // 2% chance to cast attack skill.
if( elemental_action(ed,target,tick) )
return 1;
}
diff --git a/src/map/pc.c b/src/map/pc.c
index a881fdc97..e2994ef97 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -4373,7 +4373,7 @@ int pc_steal_coin(struct map_session_data *sd,struct block_list *target)
rate = skill + (sd->status.base_level - md->level)*3 + sd->battle_status.dex*2 + sd->battle_status.luk*2;
if(rnd()%1000 < rate)
{
- int amount = md->level*10 + rand()%100;
+ int amount = md->level*10 + rnd()%100;
log_zeny(sd, LOG_TYPE_STEAL, sd, amount);
pc_getzeny(sd, amount);
diff --git a/src/map/skill.c b/src/map/skill.c
index 1c827962c..6250b85a3 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -1268,7 +1268,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int
if( dstsd )
skill_addtimerskill(src,tick+status_get_amotion(src),bl->id,0,0,skillid,skilllv,BF_WEAPON,0);
else if( dstmd && !is_boss(bl) )
- sc_start(bl, SC_STUN, 100, skilllv, 1000 + 1000 * (rand()%3));
+ sc_start(bl, SC_STUN, 100, skilllv, 1000 + 1000 * (rnd() %3));
break;
case SR_GENTLETOUCH_QUIET:
sc_start(bl, SC_SILENCE, 2 * skilllv, skilllv, skill_get_time(skillid, skilllv));
@@ -1277,7 +1277,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int
sc_start(bl, SC_FEAR, 5 + 5 * skilllv, skilllv, skill_get_time(skillid, skilllv));
break;
case WM_SOUND_OF_DESTRUCTION:
- if( rand()%100 < 5 + 5 * skilllv ) { // Temporarly Check Until We Get the Official Formula
+ if( rnd()%100 < 5 + 5 * skilllv ) { // Temporarly Check Until We Get the Official Formula
status_change_end(bl, SC_DANCING, INVALID_TIMER);
status_change_end(bl, SC_RICHMANKIM, INVALID_TIMER);
status_change_end(bl, SC_ETERNALCHAOS, INVALID_TIMER);
@@ -4338,7 +4338,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int
break;
case WM_LULLABY_DEEPSLEEP:
- if( rand()%100 < 88 + 2 * skilllv )
+ if( rnd()%100 < 88 + 2 * skilllv )
sc_start(bl,status_skill2sc(skillid),100,skilllv,skill_get_time(skillid,skilllv));
break;
@@ -4363,7 +4363,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int
break;
case GN_CRAZYWEED:
- if( rand()%100 < 75 ) {
+ if( rnd()%100 < 75 ) {
if( bl->type == BL_SKILL ) {
struct skill_unit *su = (struct skill_unit *)bl;
if( !su )
@@ -4407,7 +4407,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int
int i = skill_get_splash(skillid,skilllv);
clif_skill_nodamage(src,battle_get_master(src),skillid,skilllv,1);
clif_skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6);
- if( rand()%100 < 30 )
+ if( rnd()%100 < 30 )
map_foreachinrange(skill_area_sub,bl,i,BL_CHAR,src,skillid,skilllv,tick,flag|BCT_ENEMY|1,skill_castend_damage_id);
else
skill_attack(skill_get_type(skillid),src,src,bl,skillid,skilllv,tick,flag);
@@ -4417,7 +4417,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int
case EL_ROCK_CRUSHER:
clif_skill_nodamage(src,battle_get_master(src),skillid,skilllv,1);
clif_skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6);
- if( rand()%100 < 50 )
+ if( rnd()%100 < 50 )
skill_attack(BF_MAGIC,src,src,bl,skillid,skilllv,tick,flag);
else
skill_attack(BF_WEAPON,src,src,bl,EL_ROCK_CRUSHER_ATK,skilllv,tick,flag);
@@ -4430,7 +4430,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int
int i = skill_get_splash(skillid,skilllv);
clif_skill_nodamage(src,battle_get_master(src),skillid,skilllv,1);
clif_skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6);
- if( rand()%100 < 30 )
+ if( rnd()%100 < 30 )
map_foreachinrange(skill_area_sub,bl,i,BL_CHAR,src,skillid,skilllv,tick,flag|BCT_ENEMY|1,skill_castend_damage_id);
else
skill_attack(skill_get_type(skillid),src,src,bl,skillid,skilllv,tick,flag);
@@ -4459,7 +4459,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int
if( (sc && sc->data[type2]) || (tsc && tsc->data[type]) ) {
elemental_clean_single_effect(ele, skillid);
}
- if( rand()%100 < 50 )
+ if( rnd()%100 < 50 )
skill_attack(skill_get_type(skillid),src,src,bl,skillid,skilllv,tick,flag);
else {
sc_start(src,type2,100,skilllv,skill_get_time(skillid,skilllv));
@@ -8157,7 +8157,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
if( !status_isdead(bl) )
break;
- if( rand()%100 < 88 + 2 * skilllv ) {
+ if( rnd()%100 < 88 + 2 * skilllv ) {
int heal = tstatus->sp;
if( heal <= 0 )
heal = 1;
@@ -8254,9 +8254,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
case WM_RANDOMIZESPELL: {
int improv_skillid = 0, improv_skilllv;
do {
- i = rand() % MAX_SKILL_IMPROVISE_DB;
+ i = rnd() % MAX_SKILL_IMPROVISE_DB;
improv_skillid = skill_improvise_db[i].skillid;
- } while( improv_skillid == 0 || rand()%10000 >= skill_improvise_db[i].per );
+ } while( improv_skillid == 0 || rnd()%10000 >= skill_improvise_db[i].per );
improv_skilllv = 4 + skilllv;
clif_skill_nodamage (src, bl, skillid, skilllv, 1);
@@ -15138,10 +15138,10 @@ int skill_produce_mix (struct map_session_data *sd, int skill_id, int nameid, in
qty = 3;
break; //3 items to make at once.
case 9:
- qty = 3 + rand()%3;
+ qty = 3 + rnd()%3;
break; //3~5 items to make at once.
case 10:
- qty = 4 + rand()%3;
+ qty = 4 + rnd()%3;
break; //4~6 items to make at once.
default:
qty = 2;
@@ -15257,8 +15257,8 @@ int skill_produce_mix (struct map_session_data *sd, int skill_id, int nameid, in
tmp_item.amount = 0;
if( skill_id == GN_MIX_COOKING && firstQty > 1 ) {// Mix Cooking level 2.
// Success. As I see the chance as level 2 is global, not indiviual.
- if( rand()%10000 < make_per )
- tmp_item.amount = 5 + rand()%5;
+ if( rnd()%10000 < make_per )
+ tmp_item.amount = 5 + rnd()%5;
} else {
for (i=0; i< qty; i++) { //Apply quantity modifiers.
if (rnd()%10000 < make_per || qty == 1) { //Success
@@ -15377,11 +15377,11 @@ int skill_produce_mix (struct map_session_data *sd, int skill_id, int nameid, in
memset(&tmp_item,0,sizeof(tmp_item));
tmp_item.nameid = nameid;
do {
- i = rand()%5;
+ i = rnd()%5;
tmp_item.nameid = products[i][0];
}
- while( rand()%10000 >= products[i][1] );
- tmp_item.amount = (firstQty > 1 )? 5 + rand()%5 : 1; // When it fails it gives a random amount of items.
+ while( rnd()%10000 >= products[i][1] );
+ tmp_item.amount = (firstQty > 1 )? 5 + rnd()%5 : 1; // When it fails it gives a random amount of items.
tmp_item.identify = 1;
if( pc_additem(sd,&tmp_item,tmp_item.amount,LOG_TYPE_PRODUCE) ) {
clif_additem(sd,0,0,flag);
@@ -15630,7 +15630,7 @@ int skill_elementalanalysis(struct map_session_data* sd, int n, int skill_lv, un
if( skill_lv == 2 )
del_amount -= (del_amount % 10);
- add_amount = (skill_lv == 1) ? del_amount * (5 + rand()%5) : del_amount / 10 ;
+ add_amount = (skill_lv == 1) ? del_amount * (5 + rnd()%5) : del_amount / 10 ;
if( (nameid = sd->status.inventory[idx].nameid) <= 0 || del_amount > sd->status.inventory[idx].amount ) {
clif_skill_fail(sd,SO_EL_ANALYSIS,0,0);
@@ -15658,7 +15658,7 @@ int skill_elementalanalysis(struct map_session_data* sd, int n, int skill_lv, un
return 1;
}
- if( skill_lv == 2 && rand()%100 < 25 ) { // At level 2 have a fail chance. You loose your items if it fails.
+ if( skill_lv == 2 && rnd()%100 < 25 ) { // At level 2 have a fail chance. You loose your items if it fails.
clif_skill_fail(sd,SO_EL_ANALYSIS,0,0);
return 1;
}