From 96a3da18a1e77035ee894283a3c805c7062a203d Mon Sep 17 00:00:00 2001 From: celest Date: Fri, 1 Apr 2005 08:37:31 +0000 Subject: * Fixed a potential crash in pc_walk in Win32 builds * Added bAddEffWhenHitShort and changed bAddEffWhenHit back to all physical damage git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1373 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/map.h | 3 ++- src/map/pc.c | 16 +++++++++++----- src/map/skill.c | 36 +++++++++++++++++++----------------- src/map/status.c | 1 + 4 files changed, 33 insertions(+), 23 deletions(-) (limited to 'src/map') diff --git a/src/map/map.h b/src/map/map.h index 0193c315e..ceddea0e8 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -286,6 +286,7 @@ struct map_session_data { int critaddrace[12]; short no_regen; int addeff3[10]; + short addeff3_type[10]; short autospell2_id,autospell2_lv,autospell2_rate,autospell2_type; int skillatk[2]; unsigned short unstripable_equip; @@ -659,7 +660,7 @@ enum { SP_SKILL_ATK, SP_UNSTRIPABLE, SP_ADD_DAMAGE_BY_CLASS, // 2018-2020 SP_SP_GAIN_VALUE, SP_IGNORE_DEF_MOB, SP_HP_LOSS_RATE, SP_ADDRACE2, SP_HP_GAIN_VALUE, // 2021-2025 SP_SUBSIZE, SP_DAMAGE_WHEN_UNEQUIP, SP_ADD_ITEM_HEAL_RATE, SP_LOSESP_WHEN_UNEQUIP, SP_EXP_ADDRACE, // 2026-2030 - SP_SP_GAIN_RACE, SP_SUBRACE2, + SP_SP_GAIN_RACE, SP_SUBRACE2, SP_ADDEFF_WHENHIT_SHORT // 2031-2033 }; enum { diff --git a/src/map/pc.c b/src/map/pc.c index dc5792327..de289a33b 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -1829,8 +1829,16 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val) sd->critaddrace[type2]+=val; break; case SP_ADDEFF_WHENHIT: - if(sd->state.lr_flag != 2) + if(sd->state.lr_flag != 2) { + sd->addeff3[type2]+=val; + sd->addeff3_type[type2]=1; + } + break; + case SP_ADDEFF_WHENHIT_SHORT: + if(sd->state.lr_flag != 2) { sd->addeff3[type2]+=val; + sd->addeff3_type[type2]=0; + } break; case SP_SKILL_ATK: if(sd->state.lr_flag != 2) { @@ -3198,10 +3206,8 @@ static int pc_walk(int tid,unsigned int tick,int id,int data) int moveblock; int x,y,dx,dy; - sd = map_id2sd(id); -#ifndef _WIN32 - nullpo_retr_f(0, sd, "id=%d", id); -#endif + if ((sd = map_id2sd(id)) == NULL) + return 0; if(sd->walktimer != tid){ if(battle_config.error_log) diff --git a/src/map/skill.c b/src/map/skill.c index d84a18d7a..1f891e944 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -1020,10 +1020,11 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int } if((sd||dstsd) && skillid != MC_CARTREVOLUTION && attack_type&BF_WEAPON){ /* カ?ドによる追加?果 */ - int i; + int i, type; int sc_def_card=100; for(i=SC_STONE;i<=SC_BLIND;i++){ + type=i-SC_STONE; //?象に?態異常 switch (i) { case SC_STONE: @@ -1046,17 +1047,17 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int if (sd) { if(!sd->state.arrow_atk) { - if(rand()%10000 < (sd->addeff[i-SC_STONE])*sc_def_card/100 ){ + if(rand()%10000 < (sd->addeff[type])*sc_def_card/100 ){ if(battle_config.battle_log) - printf("PC %d skill_addeff: cardによる異常?動 %d %d\n",sd->bl.id,i,sd->addeff[i-SC_STONE]); - status_change_start(bl,i,7,0,0,0,(i==SC_CONFUSION)? 10000+7000:skill_get_time2(sc2[i-SC_STONE],7),0); + printf("PC %d skill_addeff: cardによる異常?動 %d %d\n",sd->bl.id,i,sd->addeff[type]); + status_change_start(bl,i,7,0,0,0,(i==SC_CONFUSION)? 10000+7000:skill_get_time2(sc2[type],7),0); } } else { - if(rand()%10000 < (sd->addeff[i-SC_STONE]+sd->arrow_addeff[i-SC_STONE])*sc_def_card/100 ){ + if(rand()%10000 < (sd->addeff[type]+sd->arrow_addeff[type])*sc_def_card/100 ){ if(battle_config.battle_log) - printf("PC %d skill_addeff: cardによる異常?動 %d %d\n",sd->bl.id,i,sd->addeff[i-SC_STONE]); - status_change_start(bl,i,7,0,0,0,(i==SC_CONFUSION)? 10000+7000:skill_get_time2(sc2[i-SC_STONE],7),0); + printf("PC %d skill_addeff: cardによる異常?動 %d %d\n",sd->bl.id,i,sd->addeff[type]); + status_change_start(bl,i,7,0,0,0,(i==SC_CONFUSION)? 10000+7000:skill_get_time2(sc2[type],7),0); } } } @@ -1082,25 +1083,26 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int if (sd) { if(!sd->state.arrow_atk) { - if(rand()%10000 < (sd->addeff2[i-SC_STONE])*sc_def_card/100 ){ + if(rand()%10000 < (sd->addeff2[type])*sc_def_card/100 ){ if(battle_config.battle_log) - printf("PC %d skill_addeff: cardによる異常?動 %d %d\n",src->id,i,sd->addeff2[i-SC_STONE]); - status_change_start(src,i,7,0,0,0,(i==SC_CONFUSION)? 10000+7000:skill_get_time2(sc2[i-SC_STONE],7),0); + printf("PC %d skill_addeff: cardによる異常?動 %d %d\n",src->id,i,sd->addeff2[type]); + status_change_start(src,i,7,0,0,0,(i==SC_CONFUSION)? 10000+7000:skill_get_time2(sc2[type],7),0); } } else { - if(rand()%10000 < (sd->addeff2[i-SC_STONE]+sd->arrow_addeff2[i-SC_STONE])*sc_def_card/100 ){ + if(rand()%10000 < (sd->addeff2[type]+sd->arrow_addeff2[type])*sc_def_card/100 ){ if(battle_config.battle_log) - printf("PC %d skill_addeff: cardによる異常?動 %d %d\n",src->id,i,sd->addeff2[i-SC_STONE]); - status_change_start(src,i,7,0,0,0,(i==SC_CONFUSION)? 10000+7000:skill_get_time2(sc2[i-SC_STONE],7),0); + printf("PC %d skill_addeff: cardによる異常?動 %d %d\n",src->id,i,sd->addeff2[type]); + status_change_start(src,i,7,0,0,0,(i==SC_CONFUSION)? 10000+7000:skill_get_time2(sc2[type],7),0); } } } - if (dstsd && ((sd && !sd->state.arrow_atk) || (status_get_range(src)<=2)) && - rand()%10000 < dstsd->addeff3[i-SC_STONE]*sc_def_card/100){ + if (dstsd && rand()%10000 < dstsd->addeff3[type]*sc_def_card/100){ + if (dstsd->addeff3_type[type] != 1 && ((sd && !sd->state.arrow_atk) || (status_get_range(src)<=2))) + continue; if(battle_config.battle_log) - printf("PC %d skill_addeff: cardによる異常?動 %d %d\n",src->id,i,dstsd->addeff3[i-SC_STONE]); - status_change_start(src,i,7,0,0,0,(i==SC_CONFUSION)? 10000+7000:skill_get_time2(sc2[i-SC_STONE],7),0); + printf("PC %d skill_addeff: cardによる異常?動 %d %d\n",src->id,i,dstsd->addeff3[type]); + status_change_start(src,i,7,0,0,0,(i==SC_CONFUSION)? 10000+7000:skill_get_time2(sc2[type],7),0); } } } diff --git a/src/map/status.c b/src/map/status.c index 493544677..f5098bd20 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -498,6 +498,7 @@ int status_calc_pc(struct map_session_data* sd,int first) sd->autospell2_id = sd->autospell2_lv = sd->autospell2_rate = 0; memset(sd->critaddrace,0,sizeof(sd->critaddrace)); memset(sd->addeff3,0,sizeof(sd->addeff3)); + memset(sd->addeff3_type,0,sizeof(sd->addeff3_type)); memset(sd->skillatk,0,sizeof(sd->skillatk)); sd->add_damage_class_count = sd->add_damage_class_count_ = sd->add_magic_damage_class_count = 0; sd->add_def_class_count = sd->add_mdef_class_count = 0; -- cgit v1.2.3-70-g09d2