Bug Fixes

* Fixed #145 - Corrected the duration of Frigg's Song ending too quickly.
* Fixed #202 - Added damage bonus for Rifle when using Piercing Shot (renewal).
* Fixed #257 - Adjusted get_status() in athena-start to return the correct string.
* Fixed #272 - Blood Lust not leeching HP from target.
* Fixed #298 - Corrected the renewal calculation of ATK and ASPD for Homunculus.
* Fixed #309 and #313 - Cleaned up warnings during compile.
* Fixed #321 - Monsters not calculating MATK at spawn (renewal).
* Added missing renewal calculations for Mercenary.
This commit is contained in:
aleos89 2015-03-11 10:10:05 -04:00
parent ad8e22139f
commit 1b6be4e0df
5 changed files with 69 additions and 51 deletions

View File

@ -21,7 +21,7 @@ get_status(){
PIDFILE=.$1.pid PIDFILE=.$1.pid
if [ -e ${PIDFILE} ]; then if [ -e ${PIDFILE} ]; then
ISRUN=$(ps ax | grep $(cat ${PIDFILE}) | grep $1) ISRUN=$(ps ax | grep $(cat ${PIDFILE}) | grep $1)
PSRUN=$(echo "$ISRUN" | awk '{ print substr( $0, 0, 7) }') PSRUN=$(echo "$ISRUN" | awk '{ print $1 }')
fi fi
#return ${PSRUN} #seem to cause issue for some os #return ${PSRUN} #seem to cause issue for some os
} }

View File

@ -1227,12 +1227,6 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam
return 0; return 0;
} }
//Probably not the most correct place, but it'll do here
//(since battle_drain is strictly for players currently)
if ((sce=sc->data[SC_BLOODLUST]) && flag&BF_WEAPON && damage > 0 &&
rnd()%100 < sce->val3)
status_heal(src, (int64)damage*sce->val4/100, 0, 3);
if( sd && (sce = sc->data[SC_FORCEOFVANGUARD]) && flag&BF_WEAPON && rnd()%100 < sce->val2 ) 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); pc_addspiritball(sd,skill_get_time(LG_FORCEOFVANGUARD,sce->val1),sce->val3);
@ -1263,6 +1257,10 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam
if (sc && sc->count) { if (sc && sc->count) {
if( sc->data[SC_INVINCIBLE] && !sc->data[SC_INVINCIBLEOFF] ) if( sc->data[SC_INVINCIBLE] && !sc->data[SC_INVINCIBLEOFF] )
DAMAGE_ADDRATE(75) DAMAGE_ADDRATE(75)
if ((sce = sc->data[SC_BLOODLUST]) && flag&BF_WEAPON && damage > 0 && rnd()%100 < sce->val3)
status_heal(src, damage * sce->val4 / 100, 0, 3);
// [Epoque] // [Epoque]
if (bl->type == BL_MOB) { if (bl->type == BL_MOB) {
uint8 i; uint8 i;
@ -3460,7 +3458,12 @@ static int battle_calc_attack_skill_ratio(struct Damage wd, struct block_list *s
skillratio += 100 *(skill_lv+1); skillratio += 100 *(skill_lv+1);
break; break;
case GS_PIERCINGSHOT: case GS_PIERCINGSHOT:
skillratio += 20*skill_lv; #ifdef RENEWAL
if (sd && sd->weapontype1 == W_RIFLE)
skillratio += 50 + 30 * skill_lv;
else
#endif
skillratio += 20*skill_lv;
break; break;
case GS_RAPIDSHOWER: case GS_RAPIDSHOWER:
skillratio += 400+50*skill_lv; skillratio += 400+50*skill_lv;

View File

@ -2247,7 +2247,7 @@ void pc_exeautobonus(struct map_session_data *sd,struct s_autobonus *autobonus)
autobonus->active = add_timer(gettick()+autobonus->duration, pc_endautobonus, sd->bl.id, (intptr_t)autobonus); autobonus->active = add_timer(gettick()+autobonus->duration, pc_endautobonus, sd->bl.id, (intptr_t)autobonus);
sd->state.autobonus |= autobonus->pos; sd->state.autobonus |= autobonus->pos;
status_calc_pc(sd,SCO_NONE); status_calc_pc(sd,SCO_FORCE);
} }
int pc_endautobonus(int tid, unsigned int tick, int id, intptr_t data) int pc_endautobonus(int tid, unsigned int tick, int id, intptr_t data)
@ -2260,7 +2260,7 @@ int pc_endautobonus(int tid, unsigned int tick, int id, intptr_t data)
autobonus->active = INVALID_TIMER; autobonus->active = INVALID_TIMER;
sd->state.autobonus &= ~autobonus->pos; sd->state.autobonus &= ~autobonus->pos;
status_calc_pc(sd,SCO_NONE); status_calc_pc(sd,SCO_FORCE);
return 0; return 0;
} }
@ -7755,7 +7755,7 @@ bool pc_setparam(struct map_session_data *sd,int type,int val)
clif_updatestatus(sd, SP_NEXTBASEEXP); clif_updatestatus(sd, SP_NEXTBASEEXP);
clif_updatestatus(sd, SP_STATUSPOINT); clif_updatestatus(sd, SP_STATUSPOINT);
clif_updatestatus(sd, SP_BASEEXP); clif_updatestatus(sd, SP_BASEEXP);
status_calc_pc(sd, SCO_NONE); status_calc_pc(sd, SCO_FORCE);
if(sd->status.party_id) if(sd->status.party_id)
party_send_levelup(sd); party_send_levelup(sd);
break; break;
@ -7770,7 +7770,7 @@ bool pc_setparam(struct map_session_data *sd,int type,int val)
// clif_updatestatus(sd, SP_JOBLEVEL); // Gets updated at the bottom // clif_updatestatus(sd, SP_JOBLEVEL); // Gets updated at the bottom
clif_updatestatus(sd, SP_NEXTJOBEXP); clif_updatestatus(sd, SP_NEXTJOBEXP);
clif_updatestatus(sd, SP_JOBEXP); clif_updatestatus(sd, SP_JOBEXP);
status_calc_pc(sd, 0); status_calc_pc(sd, SCO_FORCE);
break; break;
case SP_SKILLPOINT: case SP_SKILLPOINT:
sd->status.skill_point = val; sd->status.skill_point = val;

View File

@ -218,12 +218,8 @@ const char* skill_get_desc( uint16 skill_id ) {
static void skill_chk(uint16 *skill_id) { static void skill_chk(uint16 *skill_id) {
*skill_id = skill_get_index(*skill_id); // checks/adjusts id *skill_id = skill_get_index(*skill_id); // checks/adjusts id
} }
// checks/adjusts level /// checks/adjusts index. make sure we don't use negative index
static void skill_chk2(uint16 *skill_lv) { static void skill_chk2(int *idx) {
*skill_lv = cap_value(*skill_lv, 1, MAX_SKILL_LEVEL);
}
// checks/adjusts index. make sure we don't use negative index
static void skill_chk3(int *idx) {
if (*idx < 0) *idx = 0; if (*idx < 0) *idx = 0;
} }
@ -241,7 +237,7 @@ static void skill_chk3(int *idx) {
}\ }\
return ((arrvar)[idx]);\ return ((arrvar)[idx]);\
} while(0) } while(0)
#define skill_get3(id,x,var) { skill_chk(&id); if (!id) return 0; skill_chk3(&x); return var; } #define skill_get3(id,x,var) { skill_chk(&id); if (!id) return 0; skill_chk2(&x); return var; }
// Skill DB // Skill DB
int skill_get_hit( uint16 skill_id ) { skill_get (skill_id, skill_db[skill_id]->hit); } int skill_get_hit( uint16 skill_id ) { skill_get (skill_id, skill_db[skill_id]->hit); }
@ -19986,7 +19982,7 @@ static void skill_destroy_requirement(uint16 idx) {
static bool skill_parse_row_requiredb(char* split[], int columns, int current) static bool skill_parse_row_requiredb(char* split[], int columns, int current)
{ {
char* p; char* p;
uint16 skill_id = atoi(split[0]), idx, i; uint16 idx, i;
idx = skill_db_isset(atoi(split[0]), __FUNCTION__); idx = skill_db_isset(atoi(split[0]), __FUNCTION__);

View File

@ -2087,11 +2087,7 @@ int status_base_amotion_pc(struct map_session_data* sd, struct status_data* stat
*/ */
unsigned short status_base_atk(const struct block_list *bl, const struct status_data *status) unsigned short status_base_atk(const struct block_list *bl, const struct status_data *status)
{ {
int flag = 0, str, dex, int flag = 0, str, dex, dstr;
#ifdef RENEWAL
rstr,
#endif
dstr;
if(!(bl->type&battle_config.enable_baseatk)) if(!(bl->type&battle_config.enable_baseatk))
return 0; return 0;
@ -2110,13 +2106,13 @@ unsigned short status_base_atk(const struct block_list *bl, const struct status_
} }
if (flag) { if (flag) {
#ifdef RENEWAL #ifdef RENEWAL
rstr = dstr =
#endif #endif
str = status->dex; str = status->dex;
dex = status->str; dex = status->str;
} else { } else {
#ifdef RENEWAL #ifdef RENEWAL
rstr = dstr =
#endif #endif
str = status->str; str = status->str;
dex = status->dex; dex = status->dex;
@ -2128,16 +2124,18 @@ unsigned short status_base_atk(const struct block_list *bl, const struct status_
#ifdef RENEWAL #ifdef RENEWAL
if (bl->type == BL_HOM) if (bl->type == BL_HOM)
str = 2 * ((((TBL_HOM*)bl)->homunculus.level) + status_get_homstr(bl)); str = 2 * ((((TBL_HOM*)bl)->homunculus.level) + status_get_homstr(bl));
#endif #else
dstr = str/10; dstr = str/10;
str += dstr*dstr; str += dstr*dstr;
if (bl->type == BL_PC) { #endif
if (bl->type == BL_PC)
#ifdef RENEWAL #ifdef RENEWAL
str = (rstr*10 + dex*10/5 + status->luk*10/3 + ((TBL_PC*)bl)->status.base_level*10/4)/10; str = (dstr*10 + dex*10/5 + status->luk*10/3 + ((TBL_PC*)bl)->status.base_level*10/4)/10;
else if (bl->type == BL_MOB || bl->type == BL_MER)
str = dstr + ((TBL_MOB*)bl)->level;
#else #else
str+= dex/5 + status->luk/5; str+= dex/5 + status->luk/5;
#endif #endif
}
return cap_value(str, 0, USHRT_MAX); return cap_value(str, 0, USHRT_MAX);
} }
@ -2171,6 +2169,8 @@ unsigned short status_base_matk(struct block_list *bl, const struct status_data*
return status->int_ + level; return status->int_ + level;
case BL_HOM: case BL_HOM:
return status_get_homint(bl) + level; return status_get_homint(bl) + level;
case BL_MER:
return status->int_ + status->int_ / 5 * status->int_ / 5;
case BL_PC: case BL_PC:
default: default:
return status->int_ + (status->int_ / 2) + (status->dex / 5) + (status->luk / 3) + (level / 4); return status->int_ + (status->int_ / 2) + (status->dex / 5) + (status->luk / 3) + (level / 4);
@ -2227,18 +2227,30 @@ void status_calc_misc(struct block_list *bl, struct status_data *status, int lev
status->hit = cap_value(stat, 1, SHRT_MAX); status->hit = cap_value(stat, 1, SHRT_MAX);
// Flee // Flee
stat = status->flee; stat = status->flee;
stat += level + status->agi + (bl->type == BL_PC ? status->luk / 5 : 0) + 100; //base level + ( every 1 agi = +1 flee ) + (every 5 luk = +1 flee) + 100 stat += level + status->agi + (bl->type == BL_MER ? 0 : bl->type == BL_PC ? status->luk / 5 : 0) + 100; //base level + ( every 1 agi = +1 flee ) + (every 5 luk = +1 flee) + 100
status->flee = cap_value(stat, 1, SHRT_MAX); status->flee = cap_value(stat, 1, SHRT_MAX);
// Def2 // Def2
stat = status->def2; if (bl->type == BL_MER)
stat += (int)(((float)level + status->vit) / 2 + (bl->type == BL_PC ? ((float)status->agi / 5) : 0)); //base level + (every 2 vit = +1 def) + (every 5 agi = +1 def) stat = (int)(status->vit + ((float)level / 10) + ((float)status->vit / 5));
else {
stat = status->def2;
stat += (int)(((float)level + status->vit) / 2 + (bl->type == BL_PC ? ((float)status->agi / 5) : 0)); //base level + (every 2 vit = +1 def) + (every 5 agi = +1 def)
}
status->def2 = cap_value(stat, 0, SHRT_MAX); status->def2 = cap_value(stat, 0, SHRT_MAX);
// Mdef2 // Mdef2
stat = status->mdef2; if (bl->type == BL_MER)
stat += (int)(bl->type == BL_PC ? (status->int_ + ((float)level / 4) + ((float)(status->dex + status->vit) / 5)) : ((float)(status->int_ + level) / 4)); //(every 4 base level = +1 mdef) + (every 1 int = +1 mdef) + (every 5 dex = +1 mdef) + (every 5 vit = +1 mdef) stat = (int)(((float)level / 10) + ((float)status->int_ / 5));
else {
stat = status->mdef2;
stat += (int)(bl->type == BL_PC ? (status->int_ + ((float)level / 4) + ((float)(status->dex + status->vit) / 5)) : ((float)(status->int_ + level) / 4)); //(every 4 base level = +1 mdef) + (every 1 int = +1 mdef) + (every 5 dex = +1 mdef) + (every 5 vit = +1 mdef)
}
status->mdef2 = cap_value(stat, 0, SHRT_MAX); status->mdef2 = cap_value(stat, 0, SHRT_MAX);
// Special Matk case for Mercenary
if (bl->type == BL_MER)
status->matk_min = status->matk_max = status_base_matk(bl, status, level);
} }
#else #else
// Matk
status->matk_min = status_base_matk_min(status); status->matk_min = status_base_matk_min(status);
status->matk_max = status_base_matk_max(status); status->matk_max = status_base_matk_max(status);
// Hit // Hit
@ -4434,20 +4446,20 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag)
* MATK = (sMATK + wMATK + eMATK) * Multiplicative Modifiers * MATK = (sMATK + wMATK + eMATK) * Multiplicative Modifiers
**/ **/
status->matk_min = status->matk_max = status_base_matk(bl, status, status_get_lv(bl)); status->matk_min = status->matk_max = status_base_matk(bl, status, status_get_lv(bl));
switch( bl->type ) { switch( bl->type ) {
case BL_PC: { case BL_PC: {
int wMatk = 0; int wMatk = 0;
int variance = 0; int variance = 0;
// Any +MATK you get from skills and cards, including cards in weapon, is added here. // Any +MATK you get from skills and cards, including cards in weapon, is added here.
if (sd->bonus.ematk > 0) { if (sd->bonus.ematk > 0)
status->matk_max += sd->bonus.ematk;
status->matk_min += sd->bonus.ematk; status->matk_min += sd->bonus.ematk;
}
status->matk_min = status_calc_ematk(bl, sc, status->matk_min);
status->matk_max = status_calc_ematk(bl, sc, status->matk_max);
// This is the only portion in MATK that varies depending on the weapon level and refinement rate.
status->matk_min = status_calc_ematk(bl, sc, status->matk_min);
status->matk_max = status->matk_min;
// This is the only portion in MATK that varies depending on the weapon level and refinement rate.
if (b_status->lhw.matk) { if (b_status->lhw.matk) {
if (sd) { if (sd) {
//sd->state.lr_flag = 1; //?? why was that set here //sd->state.lr_flag = 1; //?? why was that set here
@ -4476,18 +4488,21 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag)
status->matk_max += wMatk + variance; status->matk_max += wMatk + variance;
} }
break; break;
case BL_HOM: case BL_HOM:
status->matk_min += (status_get_homint(bl) + status_get_homdex(bl)) / 5; status->matk_min += (status_get_homint(bl) + status_get_homdex(bl)) / 5;
status->matk_max += (status_get_homluk(bl) + status_get_homint(bl) + status_get_homdex(bl)) / 3; status->matk_max += (status_get_homluk(bl) + status_get_homint(bl) + status_get_homdex(bl)) / 3;
break; break;
case BL_MOB: case BL_MOB:
status->matk_min += 70 * ((TBL_MOB*)bl)->status.rhw.atk2 / 100; status->matk_min += 70 * ((TBL_MOB*)bl)->status.rhw.atk2 / 100;
status->matk_max += 130 * ((TBL_MOB*)bl)->status.rhw.atk2 / 100; status->matk_max += 130 * ((TBL_MOB*)bl)->status.rhw.atk2 / 100;
break; break;
case BL_MER:
status->matk_min += 70 * ((TBL_MER*)bl)->battle_status.rhw.atk2 / 100;
status->matk_max += 130 * ((TBL_MER*)bl)->battle_status.rhw.atk2 / 100;
break;
} }
#endif #endif
if (bl->type&BL_PC && sd->matk_rate != 100) { if (bl->type&BL_PC && sd->matk_rate != 100) {
status->matk_max = status->matk_max * sd->matk_rate/100; status->matk_max = status->matk_max * sd->matk_rate/100;
status->matk_min = status->matk_min * sd->matk_rate/100; status->matk_min = status->matk_min * sd->matk_rate/100;
@ -4510,6 +4525,7 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag)
if(flag&SCB_ASPD) { if(flag&SCB_ASPD) {
int amotion; int amotion;
if ( bl->type&BL_HOM ) { if ( bl->type&BL_HOM ) {
#ifdef RENEWAL_ASPD #ifdef RENEWAL_ASPD
amotion = ((TBL_HOM*)bl)->homunculusDB->baseASPD; amotion = ((TBL_HOM*)bl)->homunculusDB->baseASPD;
@ -4518,7 +4534,7 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag)
#else #else
amotion = (1000 - 4 * status->agi - status->dex) * ((TBL_HOM*)bl)->homunculusDB->baseASPD / 1000; amotion = (1000 - 4 * status->agi - status->dex) * ((TBL_HOM*)bl)->homunculusDB->baseASPD / 1000;
amotion = status_calc_aspd_rate(bl, sc, b_status->aspd_rate); amotion = status_calc_aspd_rate(bl, sc, amotion);
if (status->aspd_rate != 1000) if (status->aspd_rate != 1000)
amotion = amotion * status->aspd_rate / 1000; amotion = amotion * status->aspd_rate / 1000;
@ -4540,8 +4556,7 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag)
amotion -= (int)(sqrt( (pow(status->agi, 2) / 2) + (pow(status->dex, 2) / 5) ) / 4 + (status_calc_aspd(bl, sc, 1) * status->agi / 200)) * 10; amotion -= (int)(sqrt( (pow(status->agi, 2) / 2) + (pow(status->dex, 2) / 5) ) / 4 + (status_calc_aspd(bl, sc, 1) * status->agi / 200)) * 10;
if( (status_calc_aspd(bl, sc, 2) + status->aspd_rate2) != 0 ) // RE ASPD percertage modifier if( (status_calc_aspd(bl, sc, 2) + status->aspd_rate2) != 0 ) // RE ASPD percertage modifier
amotion -= ( amotion - pc_maxaspd(sd) ) amotion -= ( amotion - pc_maxaspd(sd) ) * (status_calc_aspd(bl, sc, 2) + status->aspd_rate2) / 100;
* (status_calc_aspd(bl, sc, 2) + status->aspd_rate2) / 100;
if(status->aspd_rate != 1000) // Absolute percentage modifier if(status->aspd_rate != 1000) // Absolute percentage modifier
amotion = ( 200 - (200-amotion/10) * status->aspd_rate / 1000 ) * 10; amotion = ( 200 - (200-amotion/10) * status->aspd_rate / 1000 ) * 10;
@ -4632,12 +4647,16 @@ void status_calc_bl_(struct block_list* bl, enum scb_flag flag, enum e_status_ca
} }
} }
if (opt&SCO_FIRST && bl->type == BL_MOB)
return; // Assume there will be no statuses active
if( bl->type == BL_PET ) if( bl->type == BL_PET )
return; // Pets are not affected by statuses return; // Pets are not affected by statuses
if (opt&SCO_FIRST && bl->type == BL_MOB) {
#ifdef RENEWAL
status_calc_bl_main(bl, SCB_MATK); // Otherwise, the mob will spawn with lower MATK values
#endif
return; // Assume there will be no statuses active
}
status_calc_bl_main(bl, flag); status_calc_bl_main(bl, flag);
if (opt&SCO_FIRST && bl->type == BL_HOM) if (opt&SCO_FIRST && bl->type == BL_HOM)
@ -9884,7 +9903,7 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
case SC_FRIGG_SONG: case SC_FRIGG_SONG:
val2 = 5 * val1; // maxhp bonus val2 = 5 * val1; // maxhp bonus
val3 = 80 + 20 * val1; // healing val3 = 80 + 20 * val1; // healing
tick_time = 10000; tick_time = 1000;
val4 = tick / tick_time; val4 = tick / tick_time;
break; break;
case SC_FLASHCOMBO: case SC_FLASHCOMBO: