Corrected the Chorus skills damage bonus (#2379)
* Added the missing range value when searching the map. * Resolves an incorrect calculation in the bonus when less than 8 of the members are a Minstrel or Wanderer. * Moved the Chorus check to the respective skills to avoid unnecessary calls to the function. * Added documentation. * Removed redundancy. Thanks to @Tokeiburu and @Lemongrass3110!
This commit is contained in:
parent
7a1b2e0f0a
commit
515fa6a163
@ -2185,16 +2185,16 @@ static int battle_skill_damage(struct block_list *src, struct block_list *target
|
||||
|
||||
/**
|
||||
* Calculates Minstrel/Wanderer bonus for Chorus skills.
|
||||
* @param sd Player who has Chorus skill active
|
||||
* @param sd: Player who has Chorus skill active
|
||||
* @return Bonus value based on party count
|
||||
*/
|
||||
static int battle_calc_chorusbonus(struct map_session_data *sd) {
|
||||
int battle_calc_chorusbonus(struct map_session_data *sd) {
|
||||
int members = 0;
|
||||
|
||||
if (!sd || !sd->status.party_id)
|
||||
return 0;
|
||||
|
||||
members = party_foreachsamemap(party_sub_count_class, sd, MAPID_THIRDMASK, MAPID_MINSTRELWANDERER);
|
||||
members = party_foreachsamemap(party_sub_count_class, sd, 0, MAPID_THIRDMASK, MAPID_MINSTRELWANDERER);
|
||||
|
||||
if (members < 3)
|
||||
return 0; // Bonus remains 0 unless 3 or more Minstrels/Wanderers are in the party.
|
||||
|
@ -106,6 +106,8 @@ int64 battle_calc_bg_damage(struct block_list *src,struct block_list *bl,int64 d
|
||||
void battle_damage(struct block_list *src, struct block_list *target, int64 damage, int delay, uint16 skill_lv, uint16 skill_id, enum damage_lv dmg_lv, unsigned short attack_type, bool additional_effects, unsigned int tick, bool spdamage);
|
||||
int battle_delay_damage (unsigned int tick, int amotion, struct block_list *src, struct block_list *target, int attack_type, uint16 skill_id, uint16 skill_lv, int64 damage, enum damage_lv dmg_lv, int ddelay, bool additional_effects, bool spdamage);
|
||||
|
||||
int battle_calc_chorusbonus(struct map_session_data *sd);
|
||||
|
||||
// Summary normal attack treatment (basic attack)
|
||||
enum damage_lv battle_weapon_attack( struct block_list *bl,struct block_list *target,unsigned int tick,int flag);
|
||||
|
||||
|
@ -1202,9 +1202,12 @@ int party_send_dot_remove(struct map_session_data *sd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// To use for Taekwon's "Fighting Chant"
|
||||
// int c = 0;
|
||||
// party_foreachsamemap(party_sub_count, sd, 0, &c);
|
||||
/**
|
||||
* Check whether a party member is in autotrade or idle for count functions
|
||||
* @param bl: Object invoking the counter
|
||||
* @param ap: List of parameters
|
||||
* @return 1 when neither autotrading and not idle or 0 otherwise
|
||||
*/
|
||||
int party_sub_count(struct block_list *bl, va_list ap)
|
||||
{
|
||||
struct map_session_data *sd = (TBL_PC *)bl;
|
||||
@ -1218,7 +1221,12 @@ int party_sub_count(struct block_list *bl, va_list ap)
|
||||
return 1;
|
||||
}
|
||||
|
||||
// To use for counting classes in a party.
|
||||
/**
|
||||
* To use for counting classes in a party.
|
||||
* @param bl: Object invoking the counter
|
||||
* @param ap: List of parameters: Class_Mask, Class_ID
|
||||
* @return 1 when class exists in party or 0 otherwise
|
||||
*/
|
||||
int party_sub_count_class(struct block_list *bl, va_list ap)
|
||||
{
|
||||
struct map_session_data *sd = (TBL_PC *)bl;
|
||||
|
@ -1007,7 +1007,6 @@ int skill_additional_effect(struct block_list* src, struct block_list *bl, uint1
|
||||
enum sc_type status;
|
||||
int skill;
|
||||
int rate;
|
||||
int chorusbonus = 0;
|
||||
|
||||
nullpo_ret(src);
|
||||
nullpo_ret(bl);
|
||||
@ -1062,16 +1061,6 @@ int skill_additional_effect(struct block_list* src, struct block_list *bl, uint1
|
||||
//So if the target can't be inflicted with statuses, this is pointless.
|
||||
return 0;
|
||||
|
||||
// Minstrel/Wanderer number check for chorus skills.
|
||||
// Bonus remains 0 unless 3 or more Minstrels/Wanderers are in the party.
|
||||
if( sd && sd->status.party_id ) {
|
||||
chorusbonus = party_foreachsamemap(party_sub_count_class, sd, AREA_SIZE, MAPID_THIRDMASK, MAPID_MINSTRELWANDERER);
|
||||
if( chorusbonus > 7 )
|
||||
chorusbonus = 5; // Maximum effect possible from 7 or more Minstrels/Wanderers
|
||||
else if( chorusbonus > 2 )
|
||||
chorusbonus = chorusbonus - 2; // Effect bonus from additional Minstrels/Wanderers if not above the max possible.
|
||||
}
|
||||
|
||||
if( sd )
|
||||
{ // These statuses would be applied anyway even if the damage was blocked by some skills. [Inkfish]
|
||||
if( skill_id != WS_CARTTERMINATION && skill_id != AM_DEMONSTRATION && skill_id != CR_REFLECTSHIELD && skill_id != MS_REFLECTSHIELD && skill_id != ASC_BREAKER ) {
|
||||
@ -1662,7 +1651,7 @@ int skill_additional_effect(struct block_list* src, struct block_list *bl, uint1
|
||||
tsc->data[SC_GLOOMYDAY] || tsc->data[SC_GLOOMYDAY_SK] || tsc->data[SC_SONGOFMANA] ||
|
||||
tsc->data[SC_DANCEWITHWUG] || tsc->data[SC_SATURDAYNIGHTFEVER] || tsc->data[SC_LERADSDEW] ||
|
||||
tsc->data[SC_MELODYOFSINK] || tsc->data[SC_BEYONDOFWARCRY] || tsc->data[SC_UNLIMITEDHUMMINGVOICE] ) &&
|
||||
rnd()%100 < 4 * skill_lv + 2 * ((sd) ? pc_checkskill(sd, WM_LESSON) : skill_get_max(WM_LESSON)) + 10 * chorusbonus) {
|
||||
rnd()%100 < 4 * skill_lv + 2 * ((sd) ? pc_checkskill(sd, WM_LESSON) : skill_get_max(WM_LESSON)) + 10 * battle_calc_chorusbonus(sd)) {
|
||||
status_change_start(src, bl, SC_STUN, 10000, skill_lv, 0, 0, 0, skill_get_time(skill_id,skill_lv), SCSTART_NOTICKDEF);
|
||||
status_change_end(bl, SC_DANCING, INVALID_TIMER);
|
||||
status_change_end(bl, SC_RICHMANKIM, INVALID_TIMER);
|
||||
@ -6078,7 +6067,6 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
|
||||
struct status_data *sstatus, *tstatus;
|
||||
struct status_change *tsc;
|
||||
struct status_change_entry *tsce;
|
||||
int chorusbonus = 0;
|
||||
|
||||
int i = 0;
|
||||
enum sc_type type;
|
||||
@ -6119,16 +6107,6 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
|
||||
tstatus = status_get_status_data(bl);
|
||||
sstatus = status_get_status_data(src);
|
||||
|
||||
// Minstrel/Wanderer number check for chorus skills.
|
||||
// Bonus remains 0 unless 3 or more Minstrels/Wanderers are in the party.
|
||||
if( sd && sd->status.party_id ) {
|
||||
chorusbonus = party_foreachsamemap(party_sub_count_class, sd, AREA_SIZE, MAPID_THIRDMASK, MAPID_MINSTRELWANDERER);
|
||||
if( chorusbonus > 7 )
|
||||
chorusbonus = 5; // Maximum effect possible from 7 or more Minstrels/Wanderers
|
||||
else if( chorusbonus > 2 )
|
||||
chorusbonus = chorusbonus - 2; // Effect bonus from additional Minstrels/Wanderers if not above the max possible.
|
||||
}
|
||||
|
||||
//Check for undead skills that convert a no-damage skill into a damage one. [Skotlex]
|
||||
switch (skill_id) {
|
||||
case HLIF_HEAL: //[orn]
|
||||
@ -10091,10 +10069,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
|
||||
if( flag&1 ) { // These affect to to all party members near the caster.
|
||||
struct status_change *sc = status_get_sc(src);
|
||||
if( sc && sc->data[type] ) {
|
||||
sc_start2(src,bl,type,100,skill_lv,chorusbonus,skill_get_time(skill_id,skill_lv));
|
||||
sc_start2(src,bl,type,100,skill_lv,battle_calc_chorusbonus(sd),skill_get_time(skill_id,skill_lv));
|
||||
}
|
||||
} else if( sd ) {
|
||||
if( sc_start2(src,bl,type,100,skill_lv,chorusbonus,skill_get_time(skill_id,skill_lv)) )
|
||||
if( sc_start2(src,bl,type,100,skill_lv,battle_calc_chorusbonus(sd),skill_get_time(skill_id,skill_lv)) )
|
||||
party_foreachsamemap(skill_area_sub,sd,skill_get_splash(skill_id,skill_lv),src,skill_id,skill_lv,tick,flag|BCT_PARTY|1,skill_castend_nodamage_id);
|
||||
clif_skill_nodamage(src,bl,skill_id,skill_lv,1);
|
||||
}
|
||||
@ -10103,9 +10081,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
|
||||
case WM_MELODYOFSINK:
|
||||
case WM_BEYOND_OF_WARCRY:
|
||||
if( flag&1 ) {
|
||||
sc_start2(src,bl,type,100,skill_lv,chorusbonus,skill_get_time(skill_id,skill_lv));
|
||||
sc_start2(src,bl,type,100,skill_lv,battle_calc_chorusbonus(sd),skill_get_time(skill_id,skill_lv));
|
||||
} else { // These affect to all targets arround the caster.
|
||||
if( rnd()%100 < 15 + 5 * skill_lv * 5 * chorusbonus ) {
|
||||
if( rnd()%100 < 15 + 5 * skill_lv * 5 * battle_calc_chorusbonus(sd) ) {
|
||||
map_foreachinallrange(skill_area_sub, src, skill_get_splash(skill_id,skill_lv),BL_PC, src, skill_id, skill_lv, tick, flag|BCT_ENEMY|1, skill_castend_nodamage_id);
|
||||
clif_skill_nodamage(src,bl,skill_id,skill_lv,1);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user