Skip to content

Commit

Permalink
Fixed millenium shield crash with clones
Browse files Browse the repository at this point in the history
Thanks to Michieru

Signed-off-by: shennetsind <ind@henn.et>
  • Loading branch information
shennetsind committed Feb 4, 2014
1 parent 250ec31 commit 144a9eb
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 20 deletions.
9 changes: 4 additions & 5 deletions src/map/battle.c
Expand Up @@ -2253,7 +2253,7 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block
case LG_RAGEBURST:
if( sc ){
skillratio += -100 + (status_get_max_hp(src) - status_get_hp(src)) / 100 + sc->fv_counter * 200;
clif->millenniumshield(sd, (sc->fv_counter = 0));
clif->millenniumshield(src, (sc->fv_counter = 0));
}
RE_LVL_DMOD(100);
break;
Expand Down Expand Up @@ -2665,8 +2665,7 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam
if( sce->val3 <= 0 ) { // Shield Down
sce->val2--;
if( sce->val2 > 0 ) {
if( sd )
clif->millenniumshield(sd,sce->val2);
clif->millenniumshield(bl,sce->val2);
sce->val3 = 1000; // Next Shield
} else
status_change_end(bl,SC_MILLENNIUMSHIELD,INVALID_TIMER); // All shields down
Expand Down Expand Up @@ -2932,9 +2931,9 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam
rnd()%100 < sce->val3)
status->heal(src, damage*sce->val4/100, 0, 3);

if( sd && (sce = sc->data[SC_FORCEOFVANGUARD]) && flag&BF_WEAPON
if( (sce = sc->data[SC_FORCEOFVANGUARD]) && flag&BF_WEAPON
&& rnd()%100 < sce->val2 && sc->fv_counter <= sce->val3 )
clif->millenniumshield(sd, sc->fv_counter++);
clif->millenniumshield(bl, sc->fv_counter++);

if (sc->data[SC_STYLE_CHANGE] && rnd()%2) {
TBL_HOM *hd = BL_CAST(BL_HOM,bl);
Expand Down
6 changes: 3 additions & 3 deletions src/map/clif.c
Expand Up @@ -17118,15 +17118,15 @@ int clif_elementalconverter_list(struct map_session_data *sd) {
/**
* Rune Knight
**/
void clif_millenniumshield(struct map_session_data *sd, short shields ) {
void clif_millenniumshield(struct block_list *bl, short shields ) {
#if PACKETVER >= 20081217
unsigned char buf[10];

WBUFW(buf,0) = 0x440;
WBUFL(buf,2) = sd->bl.id;
WBUFL(buf,2) = bl->id;
WBUFW(buf,6) = shields;
WBUFW(buf,8) = 0;
clif->send(buf,packet_len(0x440),&sd->bl,AREA);
clif->send(buf,packet_len(0x440),bl,AREA);
#endif
}
/**
Expand Down
2 changes: 1 addition & 1 deletion src/map/clif.h
Expand Up @@ -763,7 +763,7 @@ struct clif_interface {
void (*specialeffect) (struct block_list* bl, int type, enum send_target target);
void (*specialeffect_single) (struct block_list* bl, int type, int fd);
void (*specialeffect_value) (struct block_list* bl, int effect_id, int num, send_target target);
void (*millenniumshield) (struct map_session_data *sd, short shields );
void (*millenniumshield) (struct block_list *bl, short shields );
void (*charm) (struct map_session_data *sd, short type);
void (*charm_single) (int fd, struct map_session_data *sd, short type);
void (*snap) ( struct block_list *bl, short x, short y );
Expand Down
4 changes: 2 additions & 2 deletions src/map/pc.c
Expand Up @@ -196,7 +196,7 @@ int pc_addspiritball(struct map_session_data *sd,int interval,int max)
sd->spirit_timer[i] = tid;
sd->spiritball++;
if( (sd->class_&MAPID_THIRDMASK) == MAPID_ROYAL_GUARD )
clif->millenniumshield(sd,sd->spiritball);
clif->millenniumshield(&sd->bl,sd->spiritball);
else
clif->spiritball(&sd->bl);

Expand Down Expand Up @@ -235,7 +235,7 @@ int pc_delspiritball(struct map_session_data *sd,int count,int type)

if(!type) {
if( (sd->class_&MAPID_THIRDMASK) == MAPID_ROYAL_GUARD )
clif->millenniumshield(sd,sd->spiritball);
clif->millenniumshield(&sd->bl,sd->spiritball);
else
clif->spiritball(&sd->bl);
}
Expand Down
14 changes: 6 additions & 8 deletions src/map/skill.c
Expand Up @@ -7778,10 +7778,10 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
break;

case RK_MILLENNIUMSHIELD:
if( sd ){
{
short shields = (rnd()%100<50) ? 4 : ((rnd()%100<80) ? 3 : 2);
sc_start4(bl,type,100,skill_lv,shields,1000,0,skill->get_time(skill_id,skill_lv));
clif->millenniumshield(sd,shields);
clif->millenniumshield(src,shields);
clif->skill_nodamage(src,bl,skill_id,1,1);
}
break;
Expand Down Expand Up @@ -7811,12 +7811,10 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
int value = 0;
type = SC_NONE;
if( skill->area_temp[5]&0x10 ){
if( dstsd ){
value = (rnd()%100<50) ? 4 : ((rnd()%100<80) ? 3 : 2);
clif->millenniumshield(dstsd,value);
skill->area_temp[5] &= ~0x10;
type = SC_MILLENNIUMSHIELD;
}
value = (rnd()%100<50) ? 4 : ((rnd()%100<80) ? 3 : 2);
clif->millenniumshield(bl,value);
skill->area_temp[5] &= ~0x10;
type = SC_MILLENNIUMSHIELD;
}else if( skill->area_temp[5]&0x20 ){
value = status_get_max_hp(bl) * 25 / 100;
status->change_clear_buffs(bl,4);
Expand Down
2 changes: 1 addition & 1 deletion src/map/status.c
Expand Up @@ -9683,7 +9683,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const
* 3rd Stuff
**/
case SC_MILLENNIUMSHIELD:
clif->millenniumshield(sd,0);
clif->millenniumshield(bl,0);
break;
case SC_HALLUCINATIONWALK:
sc_start(bl,SC_HALLUCINATIONWALK_POSTDELAY,100,sce->val1,skill->get_time2(GC_HALLUCINATIONWALK,sce->val1));
Expand Down

0 comments on commit 144a9eb

Please sign in to comment.