Skip to content

Commit 0f547f9

Browse files
committed
== Critical Bug fixes ==
=General: *Merged missing changes from 3ceam rev. 556 - 557 *Rewrote some more calculation formulars. This is a critical fix, you should update ASAP! -Thanks to rAthena for the base. -This is another follow-up to r139(@cd0f269). -HP, SP, ASPD and most of the damage calculations where destroyed in this commit. -Now the calculations should be fixed, sorry for this... ^^" *Fixed a mistake related to Banana Bomb, you're able to stand up when the bomb force you to sit. =Skills: *Fixed SR_CRESCENTELBOW. -Consumes spirit spheres when is casted not when it takes damage. -It only consumes spirit spheres if you have. Is it a bug in kRO-RE? *Fixed SR_ASSIMILATEPOWER animation. *Fixed SR_EARTHSHAKER animation. *Fixed SR_CURSEDCIRCLE: -It doesn't use OPT3_BLADESTOP. -The effect is removed with packet 0x196. *Optimized SR_LIGHTNINGWALK skill.
1 parent 5c4530b commit 0f547f9

File tree

8 files changed

+213
-150
lines changed

8 files changed

+213
-150
lines changed

Changelog-15-3athena.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,25 @@
44
// * Modifications.
55
// - Details.
66
//========================================
7+
02/24/2017
8+
r156 [15peaces]
9+
*Merged missing changes from 3ceam rev. 556 - 557
10+
*Rewrote some more calculation formulars. This is a critical fix, you should update ASAP!
11+
-Thanks to rAthena for the base.
12+
-This is another follow-up to r139(@cd0f269).
13+
-HP, SP, ASPD and most of the damage calculations where destroyed in this commit.
14+
-Now the calculations should be fixed, sorry for this... ^^"
15+
*Fixed SR_CRESCENTELBOW.
16+
-Consumes spirit spheres when is casted not when it takes damage.
17+
-It only consumes spirit spheres if you have. Is it a bug in kRO-RE?
18+
*Fixed SR_ASSIMILATEPOWER animation.
19+
*Fixed SR_EARTHSHAKER animation.
20+
*Fixed SR_CURSEDCIRCLE:
21+
-It doesn't use OPT3_BLADESTOP.
22+
-The effect is removed with packet 0x196.
23+
*Optimized SR_LIGHTNINGWALK skill.
24+
*Fixed a mistake related to Banana Bomb, you're able to stand up when the bomb force you to sit.
25+
726
02/19/2017
827
r155 [15peaces]
928
*Fixed a typo on my last commit, sorry. ^^

src/common/cbasetypes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ typedef char bool;
257257
#ifndef max
258258
#define max(a,b) (((a) > (b)) ? (a) : (b))
259259
#endif
260+
static inline uint32 umax(uint32 a, uint32 b){ return (a > b) ? a : b; }
260261

261262
#ifndef min
262263
#define min(a,b) (((a) < (b)) ? (a) : (b))

src/map/battle.c

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -696,17 +696,12 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag
696696
status_change_end(bl, SC_KYRIE, INVALID_TIMER);
697697
}
698698

699-
if( (sce = sc->data[SC_LIGHTNINGWALK]) && flag&BF_LONG && damage > 0 ){
700-
if( rand()%100 < 88 + 2 * sce->val1 ){
701-
short x, y;
702-
damage = 0;
703-
map_search_freecell(src, 0, &x, &y, 1, 1, 0);
704-
unit_movepos(bl, x, y, 1, 1);
705-
clif_slide(bl, x, y);
706-
clif_fixpos(bl);
707-
map_moveblock(bl, x, y, gettick());
708-
status_change_end(bl, SC_LIGHTNINGWALK, -1);
709-
}
699+
if ((sce = sc->data[SC_LIGHTNINGWALK]) && flag&BF_LONG && damage > 0 && rand()%100 < sce->val1)
700+
{
701+
skill_blown(src, bl, 1, -2, 0);
702+
d->div_ = ATK_DEF;
703+
status_change_end(bl, SC_LIGHTNINGWALK, INVALID_TIMER);
704+
return 0;
710705
}
711706

712707
if (!damage) return 0;
@@ -4138,13 +4133,15 @@ int battle_calc_return_damage(struct block_list *src, struct block_list *bl, int
41384133
rdamage += (*damage) / 100;
41394134
rdamage = cap_value(rdamage,1,max_damage);
41404135
}
4141-
if( sc && sc->data[SC_CRESCENTELBOW] && !is_boss(bl) && sd && sd->spiritball >= 2 &&
4142-
rand()%100 < 94 + sc->data[SC_CRESCENTELBOW]->val1 )
4136+
if (sc && sc->data[SC_CRESCENTELBOW] && !is_boss(bl) && rand()%100 < sc->data[SC_CRESCENTELBOW]->val2)
41434137
{ // Stimated formula from test
41444138
rdamage += (int)((*damage) + (*damage) * status_get_hp(src) * 2.15 / 100000);
4145-
if( rdamage < 1 ) rdamage = 1;
4139+
if (rdamage < 1)
4140+
rdamage = 1;
41464141
}
4147-
} else {
4142+
}
4143+
else
4144+
{
41484145
if (sd && sd->long_weapon_damage_return)
41494146
{
41504147
rdamage += (*damage) * sd->long_weapon_damage_return / 100;
@@ -4429,14 +4426,13 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
44294426
}
44304427
else
44314428
{
4432-
if( tsc && tsc->data[SC_CRESCENTELBOW] )
4429+
if (tsc && tsc->data[SC_CRESCENTELBOW])
44334430
{ // Deal rdamage to src and 10% damage back to target.
4434-
clif_skill_nodamage(target,target,SR_CRESCENTELBOW_AUTOSPELL,tsc->data[SC_CRESCENTELBOW]->val1,1);
4435-
skill_blown(target,src,skill_get_blewcount(SR_CRESCENTELBOW_AUTOSPELL,tsc->data[SC_CRESCENTELBOW]->val1),unit_getdir(src),0);
4436-
status_damage(src,target,rdamage/10,0,0,1);
4437-
clif_damage(src, target, tick, wd.amotion, wd.dmotion, rdamage/10, wd.div_ , wd.type, wd.damage2);
4438-
status_change_end(target,SC_CRESCENTELBOW,-1);
4439-
if( tsd ) pc_delspiritball(tsd,2,0); // remove 2 spiritballs here.
4431+
clif_skill_nodamage(target, target, SR_CRESCENTELBOW_AUTOSPELL, tsc->data[SC_CRESCENTELBOW]->val1, 1);
4432+
skill_blown(target, src,skill_get_blewcount(SR_CRESCENTELBOW_AUTOSPELL, tsc->data[SC_CRESCENTELBOW]->val1), unit_getdir(src), 0);
4433+
status_damage(NULL, target, rdamage / 10, 0, 0, 1);
4434+
clif_damage(target, target, tick, wd.amotion, wd.dmotion, rdamage/10, wd.div_ , wd.type, wd.damage2);
4435+
status_change_end(target, SC_CRESCENTELBOW, INVALID_TIMER);
44404436
}
44414437
rdelay = clif_damage(src, src, tick, wd.amotion, sstatus->dmotion, rdamage, 1, 4, 0);
44424438
//Use Reflect Shield to signal this kind of skill trigger. [Skotlex]

src/map/clif.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10836,10 +10836,11 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type,
1083610836
break;
1083710837
}
1083810838

10839-
if( sd->sc.data[SC_SITDOWN_FORCE] || sd->sc.data[SC_BANANA_BOMB_SITDOWN_POSTDELAY] )
10839+
if (sd->sc.data[SC_SITDOWN_FORCE])
1084010840
return;
1084110841

10842-
if(pc_issit(sd)) {
10842+
if (pc_issit(sd))
10843+
{
1084310844
//Bugged client? Just refresh them.
1084410845
clif_sitting(&sd->bl);
1084510846
return;

src/map/pc.c

Lines changed: 69 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343

4444
#include <stdio.h>
4545
#include <stdlib.h>
46+
#include <math.h>
4647
#include <string.h>
4748
#include <time.h>
4849

@@ -9340,6 +9341,61 @@ static bool pc_readdb_job2(char* fields[], int columns, int current)
93409341
return true;
93419342
}
93429343

9344+
// [Cydh]
9345+
// Calculates base hp of player. Reference: http://irowiki.org/wiki/Max_HP
9346+
// @param level Base level of player
9347+
// @param class_ Job ID @see enum e_job
9348+
// @return base_hp
9349+
static unsigned int pc_calc_basehp(uint16 level, uint16 class_)
9350+
{
9351+
double base_hp;
9352+
uint16 i, idx = pc_class2idx(class_);
9353+
9354+
base_hp = 35 + level * (job_info[idx].hp_multiplicator/100.);
9355+
9356+
if(level >= 10 && (class_ == JOB_NINJA || class_ == JOB_GUNSLINGER)) base_hp += 90;
9357+
9358+
for (i = 2; i <= level; i++)
9359+
base_hp += floor(((job_info[idx].hp_factor/100.) * i) + 0.5); //Don't have round()
9360+
/*if (class_ == JOB_SUMMONER)
9361+
base_hp += floor((base_hp / 2) + 0.5);*/
9362+
return (unsigned int)base_hp;
9363+
}
9364+
9365+
// [Playtester]
9366+
// Calculates base sp of player.
9367+
// @param level Base level of player
9368+
// @param class_ Job ID @see enum e_job
9369+
// @return base_sp
9370+
static unsigned int pc_calc_basesp(uint16 level, uint16 class_)
9371+
{
9372+
double base_sp;
9373+
uint16 idx = pc_class2idx(class_);
9374+
9375+
base_sp = 10 + floor(level * (job_info[idx].sp_factor / 100.));
9376+
9377+
switch (class_)
9378+
{
9379+
case JOB_NINJA:
9380+
if (level >= 10)
9381+
base_sp -= 22;
9382+
else
9383+
base_sp = 11 + 3*level;
9384+
break;
9385+
case JOB_GUNSLINGER:
9386+
if (level > 10)
9387+
base_sp -= 18;
9388+
else
9389+
base_sp = 9 + 3*level;
9390+
break;
9391+
/*case JOB_SUMMONER:
9392+
base_sp -= floor(base_sp / 2);
9393+
break;*/
9394+
}
9395+
9396+
return (unsigned int)base_sp;
9397+
}
9398+
93439399
//Reading job_exp.txt line
93449400
//Max Level,Class list,Type (0 - Base Exp; 1 - Job Exp),Exp/lvl...
93459401
static bool pc_readdb_exp(char* fields[], int columns, int current)
@@ -9490,7 +9546,7 @@ void pc_readdb(void) {
94909546
sv_readdb(db_path, "exp.txt",',',4,1000+3,CLASS_COUNT*2,&pc_readdb_exp);
94919547
sv_readdb(db_path, "job_noenter.txt", ',', 3, 3, CLASS_COUNT, &pc_readdb_job_noenter);
94929548

9493-
// Reset and read skilltree - needs to be read after pc_readdb_job_exp to get max base and job levels
9549+
// Reset and read skilltree
94949550
memset(skill_tree, 0, sizeof(skill_tree));
94959551
sv_readdb(db_path, "skill_tree.txt", ',', 3 + MAX_PC_SKILL_REQUIRE * 2, 5 + MAX_PC_SKILL_REQUIRE * 2, -1, &pc_readdb_skilltree);
94969552

@@ -9503,8 +9559,10 @@ void pc_readdb(void) {
95039559
battle_config.use_statpoint_table = k; //restore setting
95049560

95059561
//Checking if all class have their data
9506-
for (i = 0; i < JOB_MAX; i++) {
9562+
for (i = 0; i < JOB_MAX; i++)
9563+
{
95079564
int idx;
9565+
uint16 j;
95089566
if (!pcdb_checkid(i))
95099567
continue;
95109568
if (i == JOB_WEDDING || i == JOB_XMAS || i == JOB_SUMMER || i == JOB_HANBOK || i == JOB_OKTOBERFEST)
@@ -9514,6 +9572,15 @@ void pc_readdb(void) {
95149572
ShowWarning("Class %s (%d) does not have a base exp table.\n", job_name(i), i);
95159573
if (!job_info[idx].max_level[1])
95169574
ShowWarning("Class %s (%d) does not have a job exp table.\n", job_name(i), i);
9575+
9576+
//Init and checking the empty value of Base HP/SP [Cydh]
9577+
for (j = 0; j < (job_info[idx].max_level[0] ? job_info[idx].max_level[0] : MAX_LEVEL); j++)
9578+
{
9579+
if (job_info[idx].base_hp[j] == 0)
9580+
job_info[idx].base_hp[j] = pc_calc_basehp(j+1,i);
9581+
if (job_info[idx].base_sp[j] == 0)
9582+
job_info[idx].base_sp[j] = pc_calc_basesp(j+1,i);
9583+
}
95179584
}
95189585
}
95199586

src/map/pc.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -956,4 +956,7 @@ void pc_show_questinfo_reinit(struct map_session_data *sd);
956956

957957
bool pc_job_can_entermap(enum e_job jobid, int m, int group_lv);
958958

959+
/// Check if player is Taekwon Ranker and the level is >= 90 (battle_config.taekwon_ranker_min_lv)
960+
#define pc_is_taekwon_ranker(sd) (((sd)->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && pc_famerank((sd)->status.char_id,MAPID_TAEKWON))
961+
959962
#endif /* _PC_H_ */

src/map/skill.c

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2140,7 +2140,8 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
21402140
dmg.dmotion = clif_skill_damage(dsrc,bl,tick, dmg.amotion, dmg.dmotion, damage, dmg.div_, skillid, -2, 5); // needs -2(!) as skill level
21412141
break;
21422142
case WL_HELLINFERNO:
2143-
dmg.dmotion = clif_skill_damage(src,bl,tick,dmg.amotion,dmg.dmotion,damage,1,skillid,-2,6);
2143+
case SR_EARTHSHAKER:
2144+
dmg.dmotion = clif_skill_damage(src, bl, tick, dmg.amotion, dmg.dmotion, damage, 1, skillid, -2, 6);
21442145
break;
21452146
case WL_SOULEXPANSION:
21462147
case WL_COMET:
@@ -7923,21 +7924,28 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
79237924
break;
79247925

79257926
case SR_CURSEDCIRCLE:
7926-
if( flag&1 ){
7927-
if( is_boss(bl) ) break;
7927+
if (flag&1)
7928+
{
7929+
if (is_boss(bl))
7930+
break;
79287931
if (sc_start2(bl, type, 100, skilllv, src->id, skill_get_time(skillid, skilllv)))
79297932
{
79307933
unit_stop_attack(bl);
79317934
clif_bladestop(src, bl->id, 1);
79327935
map_freeblock_unlock();
79337936
return 1;
79347937
}
7935-
}else{
7938+
}
7939+
else
7940+
{
79367941
int count = 0;
7937-
clif_skill_nodamage(src, src, skillid, skilllv, sc_start(src, SC_CURSEDCIRCLE_ATKER, 100, skilllv, skill_get_time(skillid,skilllv)));
7942+
clif_skill_damage(src, bl, tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6);
79387943
count = map_forcountinrange(skill_area_sub, src, skill_get_splash(skillid,skilllv), (sd)?sd->spiritball_old:15, // Assume 15 spiritballs in non-charactors
79397944
BL_CHAR, src, skillid, skilllv, tick, flag|BCT_ENEMY|1, skill_castend_nodamage_id);
7940-
if( sd ) pc_delspiritball(sd, count, 0);
7945+
if(sd)
7946+
pc_delspiritball(sd, count, 0);
7947+
clif_skill_nodamage(src, src, skillid, skilllv, sc_start2(src, SC_CURSEDCIRCLE_ATKER, 100, skilllv, count, skill_get_time(skillid,skilllv)));
7948+
79417949
}
79427950
break;
79437951

@@ -7953,16 +7961,23 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
79537961
break;
79547962

79557963
case SR_ASSIMILATEPOWER:
7956-
if( flag&1 ){
7964+
if (flag&1)
7965+
{
79577966
i = 0;
7958-
if( dstsd && dstsd->spiritball && (sd == dstsd || map_flag_vs(src->m)) && (dstsd->class_&MAPID_BASEMASK)!=MAPID_GUNSLINGER ){
7967+
if (dstsd && dstsd->spiritball && (sd == dstsd || map_flag_vs(src->m)) && (dstsd->class_&MAPID_BASEMASK) != MAPID_GUNSLINGER)
7968+
{
79597969
i = dstsd->spiritball; //1%sp per spiritball.
79607970
pc_delspiritball(dstsd, dstsd->spiritball, 0);
79617971
}
7962-
if( i ) status_percent_heal(src, 0, i);
7972+
if (i)
7973+
status_percent_heal(src, 0, i);
79637974
clif_skill_nodamage(src, bl, skillid, skilllv, i ? 1:0);
7964-
}else
7975+
}
7976+
else
7977+
{
7978+
clif_skill_damage(src, bl, tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6);
79657979
map_foreachinrange(skill_area_sub, bl, skill_get_splash(skillid, skilllv), splash_target(src), src, skillid, skilllv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill_castend_nodamage_id);
7980+
}
79667981
break;
79677982

79687983
case SR_POWERVELOCITY:
@@ -9017,11 +9032,15 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk
90179032
type = status_skill2sc(skillid);
90189033
sce = (sc && type != -1)?sc->data[type]:NULL;
90199034

9020-
if( sc ){ //Status end during cast end.
9021-
if( sc->data[SC_CAMOUFLAGE] )
9022-
status_change_end(src,SC_CAMOUFLAGE,INVALID_TIMER);
9023-
if( sc->data[SC_CURSEDCIRCLE_ATKER] )
9024-
status_change_end(src,SC_CURSEDCIRCLE_ATKER,INVALID_TIMER);
9035+
if (sc)
9036+
{ //Status end during cast end.
9037+
if (sc->data[SC_CAMOUFLAGE])
9038+
status_change_end(src, SC_CAMOUFLAGE, INVALID_TIMER);
9039+
if (sc->data[SC_CURSEDCIRCLE_ATKER])
9040+
{
9041+
sc->data[SC_CURSEDCIRCLE_ATKER]->val3 = 1;
9042+
status_change_end(src, SC_CURSEDCIRCLE_ATKER, INVALID_TIMER);
9043+
}
90259044
}
90269045

90279046
switch (skillid) { //Skill effect.
@@ -12848,6 +12867,10 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, short
1284812867
case LG_RAGEBURST:
1284912868
req.spiritball = sd->rageball?sd->rageball:1;
1285012869
break;
12870+
case SR_CRESCENTELBOW:
12871+
if (sd->spiritball <= 0)
12872+
req.spiritball = 0; // Only consumes spirit spheres if these are pressent. Is a bug?
12873+
break;
1285112874
case SR_RAMPAGEBLASTER:
1285212875
req.spiritball = sd->spiritball?sd->spiritball:15;
1285312876
break;

0 commit comments

Comments
 (0)