From 3e0e62675685bf18ef5ab0a12cdd97834462a0e4 Mon Sep 17 00:00:00 2001 From: Vicious Date: Thu, 9 Mar 2006 05:43:51 +0000 Subject: * included MAX_WEAPON_SIZE for flexible weapon types * more ninja/GS work git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5527 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/battle.c | 41 ++++++++++++++++++++++++----------------- src/map/pc.c | 15 ++++++++------- src/map/status.c | 50 +++++++++++++++++++++++++++++--------------------- src/map/status.h | 2 ++ 4 files changed, 63 insertions(+), 45 deletions(-) (limited to 'src/map') diff --git a/src/map/battle.c b/src/map/battle.c index fbd3b5f21..b75bf0f16 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -911,17 +911,18 @@ int battle_addmastery(struct map_session_data *sd,struct block_list *target,int } break; } - case 0x11: // Place holder for guns + case 0x11: // Revolver + case 0x12: // Rifle + case 0x13: // Shotgun + case 0x14: //Gatling Gun + case 0x15: //Grenade Launcher break; - case 0x12: // place holder for shrikens - { - if((skill = pc_checkskill(sd,NJ_TOBIDOUGU)) > 0) { - //Advanced Katar Research by zanetheinsane - damage += (skill * 3); - } - break; - } } +/*//need to add this on shuriken skills. + if((skill = pc_checkskill(sd,NJ_TOBIDOUGU)) > 0) { + damage += (skill * 3); + } +*/ return (damage); } /*========================================== @@ -1159,7 +1160,8 @@ static struct Damage battle_calc_weapon_attack( } } //Set miscellaneous data that needs be filled regardless of hit/miss - if(sd && sd->status.weapon == 11) { + if(sd && (sd->status.weapon == 11 || sd->status.weapon == 17 || sd->status.weapon == 18 + || sd->status.weapon == 19 || sd->status.weapon == 20 || sd->status.weapon == 21)) { wd.flag=(wd.flag&~BF_RANGEMASK)|BF_LONG; flag.arrow = 1; } else if (status_get_range(src) > 3) @@ -1246,6 +1248,10 @@ static struct Damage battle_calc_weapon_attack( case NJ_HUUMA: flag.arrow = 1; break; + + case GS_MAGICALBULLET: + flag.arrow = 0; + break; } } @@ -1311,7 +1317,7 @@ static struct Damage battle_calc_weapon_attack( flag.rh=0; flag.lh=1; } - if(sd->status.weapon > 16) + if(sd->status.weapon > MAX_WEAPON_TYPE) flag.rh = flag.lh = 1; } @@ -1559,7 +1565,7 @@ static struct Damage battle_calc_weapon_attack( //Add any bonuses that modify the base baseatk+watk (pre-skills) if(sd) { - if (sd->status.weapon < 16 && (sd->atk_rate != 100 || sd->weapon_atk_rate[sd->status.weapon] != 0)) + if (sd->status.weapon < MAX_WEAPON_TYPE && (sd->atk_rate != 100 || sd->weapon_atk_rate[sd->status.weapon] != 0)) ATK_RATE(sd->atk_rate + sd->weapon_atk_rate[sd->status.weapon]); if(flag.cri && sd->crit_atk_rate) @@ -2251,7 +2257,7 @@ static struct Damage battle_calc_weapon_attack( wd.div_=skill_get_num(TF_DOUBLE,skill_lv?skill_lv:1); wd.type = 0x08; } - } else if (( (skill_lv = 5*pc_checkskill(sd,GS_CHAINACTION)) > 0 && sd->weapontype1 == 0x01) || + } else if (( (skill_lv = 5*pc_checkskill(sd,GS_CHAINACTION)) > 0 && sd->weapontype1 == 0x11) || sd->double_rate > 0) // Copied double attack if (rand()%100 < (skill_lv>sd->double_rate?skill_lv:sd->double_rate)) { @@ -2275,7 +2281,7 @@ static struct Damage battle_calc_weapon_attack( wd.damage2 = 0; flag.rh=1; flag.lh=0; - } else if(sd->status.weapon > 16) + } else if(sd->status.weapon > MAX_WEAPON_TYPE) { //Dual-wield if (wd.damage > 0) { @@ -3100,7 +3106,8 @@ int battle_weapon_attack( struct block_list *src,struct block_list *target, race = status_get_race(target); ele = status_get_elem_type(target); - if(sd && sd->status.weapon == 11) { + if(sd && (sd->status.weapon == 11 || sd->status.weapon == 17 || sd->status.weapon == 18 + || sd->status.weapon == 19 || sd->status.weapon == 20 || sd->status.weapon == 21)) { if(sd->equip_index[10] >= 0) { if(battle_config.arrow_decrement) pc_delitem(sd,sd->equip_index[10],1,0); @@ -3144,7 +3151,7 @@ int battle_weapon_attack( struct block_list *src,struct block_list *target, } //Recycled the damage variable rather than use a new one... [Skotlex] - if(sd && (damage = pc_checkskill(sd,MO_TRIPLEATTACK)) > 0 && sd->status.weapon <= 16) // triple blow works with bows ^^ [celest] + if(sd && (damage = pc_checkskill(sd,MO_TRIPLEATTACK)) > 0 && sd->status.weapon <= MAX_WEAPON_TYPE) // triple blow works with bows ^^ [celest] { int triple_rate= 30 - damage; //Base Rate if (sc && sc->data[SC_SKILLRATE_UP].timer!=-1 && sc->data[SC_SKILLRATE_UP].val1 == MO_TRIPLEATTACK) @@ -3170,7 +3177,7 @@ int battle_weapon_attack( struct block_list *src,struct block_list *target, clif_damage(src, target, tick, wd.amotion, wd.dmotion, wd.damage, wd.div_ , wd.type, wd.damage2); //“ρ“?—¬?ΆŽθ‚ΖƒJƒ^?[ƒ‹’ΗŒ‚‚Μƒ~ƒX•\Ž¦(–³—?‚β‚θ?`) - if(sd && sd->status.weapon >= 16 && wd.damage2 == 0) + if(sd && sd->status.weapon >= MAX_WEAPON_TYPE && wd.damage2 == 0) clif_damage(src, target, tick+10, wd.amotion, wd.dmotion,0, 1, 0, 0); if (sd && sd->splash_range > 0 && damage > 0) diff --git a/src/map/pc.c b/src/map/pc.c index b5c078d06..b57ae27d2 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -507,20 +507,20 @@ int pc_calcweapontype(struct map_session_data *sd) if(sd->weapontype1 == 0 && sd->weapontype2 != 0)// ΆŽθ•Šν Only sd->status.weapon = sd->weapontype2; else if(sd->weapontype1 == 1 && sd->weapontype2 == 1)// ?’Z? - sd->status.weapon = 0x11; + sd->status.weapon = MAX_WEAPON_TYPE+1; else if(sd->weapontype1 == 2 && sd->weapontype2 == 2)// ??Žθ? - sd->status.weapon = 0x12; + sd->status.weapon = MAX_WEAPON_TYPE+2; else if(sd->weapontype1 == 6 && sd->weapontype2 == 6)// ??Žθ•€ - sd->status.weapon = 0x13; + sd->status.weapon = MAX_WEAPON_TYPE+3; else if( (sd->weapontype1 == 1 && sd->weapontype2 == 2) || (sd->weapontype1 == 2 && sd->weapontype2 == 1) ) // ’Z? - ?Žθ? - sd->status.weapon = 0x14; + sd->status.weapon = MAX_WEAPON_TYPE+4; else if( (sd->weapontype1 == 1 && sd->weapontype2 == 6) || (sd->weapontype1 == 6 && sd->weapontype2 == 1) ) // ’Z? - •€ - sd->status.weapon = 0x15; + sd->status.weapon = MAX_WEAPON_TYPE+5; else if( (sd->weapontype1 == 2 && sd->weapontype2 == 6) || (sd->weapontype1 == 6 && sd->weapontype2 == 2) ) // ?Žθ? - •€ - sd->status.weapon = 0x16; + sd->status.weapon = MAX_WEAPON_TYPE+6; else sd->status.weapon = sd->weapontype1; @@ -4335,7 +4335,8 @@ int pc_attack_timer(int tid,unsigned int tick,int id,int data) return 0; } - if(sd->status.weapon == 11 && sd->equip_index[10] < 0) + if((sd->status.weapon == 11 || sd->status.weapon == 17 || sd->status.weapon == 18 + || sd->status.weapon == 19 || sd->status.weapon == 20 || sd->status.weapon == 21)&& sd->equip_index[10] < 0) { clif_arrow_fail(sd,0); return 0; diff --git a/src/map/status.c b/src/map/status.c index 6aff9bb4e..f56436455 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -35,11 +35,11 @@ static int hp_coefficient[MAX_PC_CLASS]; static int hp_coefficient2[MAX_PC_CLASS]; static int hp_sigma_val[MAX_PC_CLASS][MAX_LEVEL]; static int sp_coefficient[MAX_PC_CLASS]; -static int aspd_base[MAX_PC_CLASS][20]; +static int aspd_base[MAX_PC_CLASS][MAX_WEAPON_TYPE]; #define MAX_REFINE_BONUS 5 static int refinebonus[MAX_REFINE_BONUS][3]; // Έ˜Bƒ{[ƒiƒXƒe[ƒuƒ‹(refine_db.txt) int percentrefinery[5][MAX_REFINE+1]; // Έ˜B¬Œχ—¦(refine_db.txt) -static int atkmods[3][20]; // •ŠνATKƒTƒCƒYC³(size_fix.txt) +static int atkmods[3][MAX_WEAPON_TYPE]; // •ŠνATKƒTƒCƒYC³(size_fix.txt) static char job_bonus[MAX_PC_CLASS][MAX_LEVEL]; int current_equip_item_index; //Contains inventory index of an equipped item. To pass it into the EQUP_SCRIPT [Lupus] @@ -1069,6 +1069,11 @@ int status_calc_pc(struct map_session_data* sd,int first) case 11: // Bows case 13: // Musical Instruments case 14: // Whips + case 17: // Revolver + case 18: // Rifle + case 19: // Shotgun + case 20: //Gatling Gun + case 21: //Grenade Launcher str = sd->paramc[4]; dex = sd->paramc[0]; break; @@ -1159,10 +1164,11 @@ int status_calc_pc(struct map_session_data* sd,int first) if(sd->status.weapon == 11) sd->attackrange += skill; } - if((skill=pc_checkskill(sd,GS_SINGLEACTION))>0 && (sd->status.weapon == 11)){ //temp until we get gun id + if((skill=pc_checkskill(sd,GS_SINGLEACTION))>0 && (sd->status.weapon == 17 || sd->status.weapon == 18 + || sd->status.weapon == 19 || sd->status.weapon == 20 || sd->status.weapon == 21)) sd->hit += 2*skill; - } - if((skill=pc_checkskill(sd,GS_SNAKEEYE))>0 && (sd->status.weapon == 11)){ //temp until we get gun id + if((skill=pc_checkskill(sd,GS_SNAKEEYE))>0 && (sd->status.weapon == 17 || sd->status.weapon == 18 + || sd->status.weapon == 19 || sd->status.weapon == 20 || sd->status.weapon == 21)) { sd->hit += skill; sd->attackrange += skill; } @@ -1323,7 +1329,7 @@ int status_calc_pc(struct map_session_data* sd,int first) // Unlike other stats, ASPD rate modifiers from skills/SCs/items/etc are first all added together, then the final modifier is applied // Basic ASPD value - if (sd->status.weapon <= 16) + if (sd->status.weapon < MAX_WEAPON_TYPE) sd->aspd += aspd_base[sd->status.class_][sd->status.weapon]-(sd->paramc[1]*4+sd->paramc[4])*aspd_base[sd->status.class_][sd->status.weapon]/1000; else sd->aspd += ( @@ -1340,9 +1346,9 @@ int status_calc_pc(struct map_session_data* sd,int first) if(pc_isriding(sd)) sd->aspd_rate += 50-10*pc_checkskill(sd,KN_CAVALIERMASTERY); - if((skill=pc_checkskill(sd,GS_SINGLEACTION))>0 && (sd->status.weapon == 11)){ //temp until we get gun id + if((skill=pc_checkskill(sd,GS_SINGLEACTION))>0 && (sd->status.weapon == 17 || sd->status.weapon == 18 + || sd->status.weapon == 19 || sd->status.weapon == 20 || sd->status.weapon == 21)) sd->aspd_rate -= (int)(skill / 2); - } // Relative modifiers from status changes (shared between PC and NPC) sd->aspd_rate = status_calc_aspd_rate(&sd->bl,sd->aspd_rate); @@ -1830,11 +1836,12 @@ int status_calc_batk(struct block_list *bl, int batk) if(sc->data[SC_SKE].timer!=-1) batk += batk * 3; if(sc->data[SC_JOINTBEAT].timer!=-1 && sc->data[SC_JOINTBEAT].val2==4) - batk -= batk * 25/100; + batk -= batk * 25/100; if(sc->data[SC_CURSE].timer!=-1) - batk -= batk * 25/100; - if(sc->data[SC_BLEEDING].timer != -1) batk -= batk * 25/100; +//Curse shouldn't effect on this? +// if(sc->data[SC_BLEEDING].timer != -1) +// batk -= batk * 25/100; } return batk; @@ -2191,8 +2198,9 @@ int status_calc_aspd_rate(struct block_list *bl, int aspd_rate) aspd_rate += 25; if(sc->data[SC_GRAVITATION].timer!=-1) aspd_rate += sc->data[SC_GRAVITATION].val2; - if(sc->data[SC_BLEEDING].timer != -1) - aspd_rate += 25; +//Curse shouldn't effect on this? +// if(sc->data[SC_BLEEDING].timer != -1) +// aspd_rate += 25; if(sc->data[SC_JOINTBEAT].timer!=-1) { if (sc->data[SC_JOINTBEAT].val2 == 1) aspd_rate += 25; @@ -2686,7 +2694,7 @@ int status_get_batk(struct block_list *bl) if(bl->type==BL_PC) { batk = ((struct map_session_data *)bl)->base_atk; - if (((struct map_session_data *)bl)->status.weapon < 16) + if (((struct map_session_data *)bl)->status.weapon < MAX_WEAPON_TYPE) batk += ((struct map_session_data *)bl)->weapon_atk[((struct map_session_data *)bl)->status.weapon]; } else { int str,dstr; @@ -5293,7 +5301,7 @@ int status_change_timer(int tid, unsigned int tick, int id, int data) // - υσϊμͺΞͺήͺή«΅?«ΠμΉΤΡͺδ«κ«ν«°ͺ·ͺΖͺβ?ΝύͺΟαΌͺ¨ͺΚͺ€ // To-do: bleeding effect increases damage taken? if ((sc->data[type].val4 -= 10000) >= 0) { - int hp = rand()%300 + 400; + int hp = rand()%600 + 200; if(sd) { pc_heal(sd,-hp,0); } else if(bl->type == BL_MOB) { @@ -5671,7 +5679,7 @@ int status_readdb(void) { return 1; } while(fgets(line, sizeof(line)-1, fp)){ - char *split[23]; + char *split[MAX_WEAPON_TYPE + 5]; if(line[0]=='/' && line[1]=='/') continue; for(j=0,p=line;j<22 && p;j++){ @@ -5687,7 +5695,7 @@ int status_readdb(void) { hp_coefficient[atoi(split[0])]=atoi(split[2]); hp_coefficient2[atoi(split[0])]=atoi(split[3]); sp_coefficient[atoi(split[0])]=atoi(split[4]); - for(j=0;j<17;j++) + for(j=0;j