From f49effe3403a77b3fb69078465a2906836547041 Mon Sep 17 00:00:00 2001 From: skotlex Date: Wed, 2 Aug 2006 14:27:17 +0000 Subject: - Updated battle_check_target so that all alchemist summoned mobs can be target by everyone. - Cleaned up skill_check_condition_mob_master_sub, it will now count both total number of summoned mobs and amount that belong to the same type. - Corrected AM_CANNIBALIZE so it will fail if you already have plants of another type out. - Using NPC_SELFDESTRUCTION no longer will make the caster stop walking. - Removed SI_GUILDAURA, and replaced it with SI_LANDENDOW, now Volcano/Deluge/V. Gale will get that funky icon instead. - Changed clif_hominfo to receive both sd and hd as parameters - Some redundancy cleaning in mercenary.c - Moved updating of sd->mercenary.hp from merc_damage to pc_makesavestatus. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8048 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/battle.c | 4 +-- src/map/clif.c | 11 +++--- src/map/clif.h | 2 +- src/map/mercenary.c | 100 ++++++++++++++++------------------------------------ src/map/mercenary.h | 2 +- src/map/pc.c | 6 +++- src/map/skill.c | 29 ++++++++------- src/map/status.c | 12 +++---- src/map/status.h | 2 +- src/map/unit.c | 2 +- 10 files changed, 70 insertions(+), 100 deletions(-) (limited to 'src') diff --git a/src/map/battle.c b/src/map/battle.c index ea7bd0d5e..cffec76cb 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -3153,8 +3153,8 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f return -1; //Cannot be targeted yet. break; case BL_MOB: - if (((TBL_MOB*)target)->special_state.ai == 2) - { //Mines are sort of universal enemies. + if (((TBL_MOB*)target)->special_state.ai > 1) + { //Alchemist summoned mobs are sort of universal enemies. state |= BCT_ENEMY; strip_enemy = 0; } diff --git a/src/map/clif.c b/src/map/clif.c index 3c5879c8b..924218c27 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -1455,9 +1455,8 @@ int clif_spawn(struct block_list *bl) } //[orn] -int clif_hominfo(struct map_session_data *sd, int flag) +int clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag) { - struct homun_data *hd = sd->hd; struct status_data *status; unsigned char buf[128]; @@ -1472,7 +1471,7 @@ int clif_hominfo(struct map_session_data *sd, int flag) WBUFB(buf,26)=sd->homunculus.rename_flag | (sd->homunculus.vaporize << 1) | (sd->homunculus.hp?0:4); WBUFW(buf,27)=sd->homunculus.level; WBUFW(buf,29)=sd->homunculus.hunger; - WBUFW(buf,31)=(unsigned short) (hd->master->homunculus.intimacy / 100) ; + WBUFW(buf,31)=(unsigned short) (sd->homunculus.intimacy / 100) ; WBUFW(buf,33)=0; // equip id WBUFW(buf,35)=status->rhw.atk2; WBUFW(buf,37)=status->matk_max; @@ -1574,7 +1573,7 @@ void clif_parse_ChangeHomunculusName(int fd, struct map_session_data *sd) { //[o RFIFOHEAD(fd); memcpy(sd->homunculus.name,RFIFOP(fd,2),24); sd->homunculus.rename_flag = 1; - clif_hominfo(sd,0); + clif_hominfo(sd,sd->hd,0); clif_charnameack(sd->fd,&sd->hd->bl); } @@ -8277,8 +8276,8 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) map_addblock(&sd->hd->bl); clif_spawn(&sd->hd->bl); // clif_homunack(sd); - clif_hominfo(sd,1); - clif_hominfo(sd,0); //for some reason, at least older clients want this sent twice + clif_hominfo(sd,sd->hd,1); + clif_hominfo(sd,sd->hd,0); //for some reason, at least older clients want this sent twice clif_send_homdata(sd,0,0); clif_homskillinfoblock(sd); } diff --git a/src/map/clif.h b/src/map/clif.h index 4e80e13b1..e12bf59b3 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -354,7 +354,7 @@ void clif_mission_mob(struct map_session_data *sd, unsigned short mob_id, unsign // [blackhole89] int clif_spawnhomun(struct homun_data *hd); -int clif_hominfo(struct map_session_data *sd, int flag); +int clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag); int clif_homskillinfoblock(struct map_session_data *sd); void clif_homskillup(struct map_session_data *sd, int skill_num) ; //[orn] int clif_hom_food(struct map_session_data *sd,int foodid,int fail); //[orn] diff --git a/src/map/mercenary.c b/src/map/mercenary.c index a8eecafff..7a5a8217c 100644 --- a/src/map/mercenary.c +++ b/src/map/mercenary.c @@ -108,20 +108,13 @@ void merc_load_exptables(void) void merc_damage(struct homun_data *hd,struct block_list *src,int hp,int sp) { nullpo_retv(hd); - - if( hd->battle_status.hp < 0) - hd->battle_status.hp = 0; - if( hd->battle_status.sp < 0) - hd->battle_status.sp = 0; - hd->master->homunculus.hp = hd->battle_status.hp ; - hd->master->homunculus.sp = hd->battle_status.sp ; - clif_hominfo(hd->master,0); + clif_hominfo(hd->master,hd,0); } int merc_hom_dead(struct homun_data *hd, struct block_list *src) { hd->master->homunculus.hp = 0 ; - clif_hominfo(hd->master, 0); // Send dead flag + clif_hominfo(hd->master,hd,0); // Send dead flag if(!merc_hom_decrease_intimacy(hd, 100)) { // Intimacy was < 100 merc_stop_walking(hd, 1); merc_stop_attack(hd); @@ -217,7 +210,7 @@ void merc_hom_skillup(struct homun_data *hd,int skillnum) hd->master->homunculus.skillpts-- ; status_calc_homunculus(hd,1) ; clif_homskillup(hd->master, skillnum) ; - clif_hominfo(hd->master,0) ; + clif_hominfo(hd->master,hd,0) ; clif_homskillinfoblock(hd->master) ; } } @@ -337,7 +330,7 @@ int merc_hom_gainexp(struct homun_data *hd,int exp) hd->master->homunculus.exp += exp; if(hd->master->homunculus.exp < hd->exp_next) { - clif_hominfo(hd->master,0); + clif_hominfo(hd->master,hd,0); return 0; } @@ -362,13 +355,9 @@ int merc_hom_gainexp(struct homun_data *hd,int exp) int merc_hom_increase_intimacy(struct homun_data * hd, unsigned int value) { if (hd->master->homunculus.intimacy + value <= 100000) - { hd->master->homunculus.intimacy += value; - } else - { hd->master->homunculus.intimacy = 100000; - } return hd->master->homunculus.intimacy; } @@ -376,42 +365,16 @@ int merc_hom_increase_intimacy(struct homun_data * hd, unsigned int value) int merc_hom_decrease_intimacy(struct homun_data * hd, unsigned int value) { if (hd->master->homunculus.intimacy >= value) - { hd->master->homunculus.intimacy -= value; - } else - { hd->master->homunculus.intimacy = 0; - } return hd->master->homunculus.intimacy; } -int merc_hom_heal(struct homun_data *hd,int hp,int sp) +void merc_hom_heal(struct homun_data *hd,int hp,int sp) { - nullpo_retr(0, hd); - - if( hd->battle_status.max_hp < hd->battle_status.hp ) - hd->battle_status.hp = hd->battle_status.max_hp; - else if (hd->battle_status.hp <= 0) { - hd->battle_status.hp = 1; - } - - if( hd->battle_status.max_sp < hd->battle_status.sp ) - hd->battle_status.sp = hd->battle_status.max_sp; - else if (hd->battle_status.sp < 0) { - hd->battle_status.sp = 0; - } - - if ( (hd->battle_status.hp != hd->base_status.hp) || - (hd->battle_status.sp != hd->base_status.sp) ) - { - clif_hominfo(hd->master,0); - } - hd->master->homunculus.hp = hd->base_status.hp = hd->battle_status.hp ; - hd->master->homunculus.sp = hd->base_status.sp = hd->battle_status.sp ; - - return 1; + clif_hominfo(hd->master,hd,0); } static unsigned int natural_heal_prev_tick,natural_heal_diff_tick; @@ -606,7 +569,7 @@ int merc_hom_food(struct map_session_data *sd, struct homun_data *hd) { int i, k, emotion; - if(hd->master->homunculus.vaporize) + if(sd->homunculus.vaporize) return 1 ; k=hd->homunculusDB->foodID; @@ -617,16 +580,16 @@ int merc_hom_food(struct map_session_data *sd, struct homun_data *hd) } pc_delitem(sd,i,1,0); - if ( hd->master->homunculus.hunger >= 91 ) { + if ( sd->homunculus.hunger >= 91 ) { merc_hom_decrease_intimacy(hd, 50); emotion = 16; - } else if ( hd->master->homunculus.hunger >= 76 ) { + } else if ( sd->homunculus.hunger >= 76 ) { merc_hom_decrease_intimacy(hd, 5); emotion = 19; - } else if ( hd->master->homunculus.hunger >= 26 ) { + } else if ( sd->homunculus.hunger >= 26 ) { merc_hom_increase_intimacy(hd, 75); emotion = 2; - } else if ( hd->master->homunculus.hunger >= 11 ) { + } else if ( sd->homunculus.hunger >= 11 ) { merc_hom_increase_intimacy(hd, 100); emotion = 2; } else { @@ -634,9 +597,9 @@ int merc_hom_food(struct map_session_data *sd, struct homun_data *hd) emotion = 2; } - hd->master->homunculus.hunger += 10; //dunno increase value for each food - if(hd->master->homunculus.hunger > 100) - hd->master->homunculus.hunger = 100; + sd->homunculus.hunger += 10; //dunno increase value for each food + if(sd->homunculus.hunger > 100) + sd->homunculus.hunger = 100; clif_emotion(&hd->bl,emotion) ; clif_send_homdata(sd,SP_HUNGRY,sd->homunculus.hunger); @@ -644,14 +607,14 @@ int merc_hom_food(struct map_session_data *sd, struct homun_data *hd) clif_hom_food(sd,hd->homunculusDB->foodID,1); // Too much food :/ - if(hd->master->homunculus.intimacy == 0) { + if(sd->homunculus.intimacy == 0) { merc_stop_walking(hd, 1); merc_stop_attack(hd); // Send homunculus_dead to client sd->homunculus.hp = 0; - clif_hominfo(sd, 0); + clif_hominfo(sd, hd, 0); merc_hom_delete(hd,1); - clif_emotion(&hd->master->bl, 23); //omg + clif_emotion(&sd->bl, 23); //omg } return 0; } @@ -677,17 +640,17 @@ static int merc_hom_hungry(int tid,unsigned int tick,int id,int data) hd->hungry_timer = -1; - hd->master->homunculus.hunger-- ; - if(hd->master->homunculus.hunger <= 10) { + sd->homunculus.hunger-- ; + if(sd->homunculus.hunger <= 10) { clif_emotion(&hd->bl, 6) ; //an - } else if(hd->master->homunculus.hunger == 25) { + } else if(sd->homunculus.hunger == 25) { clif_emotion(&hd->bl, 20) ; //hmm - } else if(hd->master->homunculus.hunger == 75) { + } else if(sd->homunculus.hunger == 75) { clif_emotion(&hd->bl, 33) ; //ok } - if(hd->master->homunculus.hunger < 0) { - hd->master->homunculus.hunger = 0; + if(sd->homunculus.hunger < 0) { + sd->homunculus.hunger = 0; // Delete the homunculus if intimacy <= 100 if ( !merc_hom_decrease_intimacy(hd, 100) ) { merc_stop_walking(hd, 1); @@ -696,7 +659,7 @@ static int merc_hom_hungry(int tid,unsigned int tick,int id,int data) sd->homunculus.hp = 0; clif_hominfo(sd, 0); merc_hom_delete(hd,1); - clif_emotion(&hd->master->bl, 23) ; //omg + clif_emotion(&sd->bl, 23) ; //omg return 0 ; } else { clif_send_homdata(sd,SP_INTIMATE,sd->homunculus.intimacy / 100); @@ -837,8 +800,8 @@ int merc_call_homunculus(struct map_session_data *sd) map_addblock(&sd->hd->bl); clif_spawn(&sd->hd->bl); clif_send_homdata(sd,SP_ACK,0); - clif_hominfo(sd,1); - clif_hominfo(sd,0); // send this x2. dunno why, but kRO does that [blackhole89] + clif_hominfo(sd,sd->hd,1); + clif_hominfo(sd,sd->hd,0); // send this x2. dunno why, but kRO does that [blackhole89] clif_homskillinfoblock(sd); } // save @@ -872,7 +835,6 @@ int merc_hom_recv_data(int account_id, struct s_homunculus *sh, int flag) } memcpy(&sd->homunculus, sh, sizeof(struct s_homunculus)); - if ( flag == 2 ) { sh->hp = 1 ; sd->homunculus.hp = 1 ; @@ -884,10 +846,10 @@ int merc_hom_recv_data(int account_id, struct s_homunculus *sh, int flag) if ( sd->hd && sd->bl.prev != NULL) { map_addblock(&sd->hd->bl); clif_spawn(&sd->hd->bl); - clif_hominfo(sd,1); - clif_hominfo(sd,0); // send this x2. dunno why, but kRO does that [blackhole89] + clif_hominfo(sd,sd->hd,1); + clif_hominfo(sd,sd->hd,0); // send this x2. dunno why, but kRO does that [blackhole89] clif_homskillinfoblock(sd); - clif_hominfo(sd,0); + clif_hominfo(sd,sd->hd,0); clif_send_homdata(sd,SP_ACK,0); } } @@ -956,8 +918,8 @@ int merc_hom_revive(struct map_session_data *sd, int per) map_addblock(&sd->hd->bl); clif_spawn(&sd->hd->bl); clif_send_homdata(sd,SP_ACK,0); - clif_hominfo(sd,1); - clif_hominfo(sd,0); + clif_hominfo(sd,sd->hd,1); + clif_hominfo(sd,sd->hd,0); clif_homskillinfoblock(sd); clif_specialeffect(&sd->hd->bl,77,AREA) ; //resurrection angel } diff --git a/src/map/mercenary.h b/src/map/mercenary.h index 965557759..41f5540de 100644 --- a/src/map/mercenary.h +++ b/src/map/mercenary.h @@ -60,7 +60,7 @@ int merc_hom_checkskill(struct map_session_data *sd,int skill_id) ; int merc_hom_gainexp(struct homun_data *hd,int exp) ; int merc_hom_levelup(struct homun_data *hd) ; int merc_hom_evolution(struct homun_data *hd) ; -int merc_hom_heal(struct homun_data *hd,int hp,int sp); +void merc_hom_heal(struct homun_data *hd,int hp,int sp); int merc_hom_delete(struct homun_data *hd, int flag) ; int merc_hom_revive(struct map_session_data *sd, int per); void merc_save(struct homun_data *hd); diff --git a/src/map/pc.c b/src/map/pc.c index 16828d87b..b312c796f 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -345,6 +345,10 @@ int pc_makesavestatus(struct map_session_data *sd) memcpy(&sd->status.last_point,&sd->status.save_point,sizeof(sd->status.last_point)); } + if (sd->hd) { //Update Homun HP info + sd->homunculus.hp = sd->hd->battle_status.hp ; + sd->homunculus.sp = sd->hd->battle_status.sp ; + } return 0; } @@ -4752,7 +4756,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) if(sd->status.hom_id > 0 && sd->hd) //orn { sd->homunculus.vaporize = 1; - clif_hominfo(sd,0); + clif_hominfo(sd,sd->hd,0); merc_stop_walking(sd->hd, 1) ; merc_stop_attack(sd->hd) ; merc_hom_delete(sd->hd,0); diff --git a/src/map/skill.c b/src/map/skill.c index 678461ae0..605a02006 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -5520,7 +5520,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in { if (sd->hd && ( sd->hd->battle_status.hp >= (sd->hd->battle_status.max_hp * 80 / 100 ) ) ) { sd->homunculus.vaporize = 1; - clif_hominfo(sd, 0); + clif_hominfo(sd, sd->hd, 0); merc_hom_delete(sd->hd, 0) ; } clif_skill_fail(sd,skillid,0,0); @@ -7751,19 +7751,23 @@ int skill_check_pc_partner (struct map_session_data *sd, int skill_id, int* skil static int skill_check_condition_mob_master_sub (struct block_list *bl, va_list ap) { - int *c,src_id=0,mob_class=0; + int *c,src_id,mob_class,skill; struct mob_data *md; - nullpo_retr(0, bl); - nullpo_retr(0, ap); - nullpo_retr(0, md=(struct mob_data*)bl); - nullpo_retr(0, src_id=va_arg(ap,int)); - nullpo_retr(0, mob_class=va_arg(ap,int)); - nullpo_retr(0, c=va_arg(ap,int *)); + md=(struct mob_data*)bl; + src_id=va_arg(ap,int); + mob_class=va_arg(ap,int); + skill=va_arg(ap,int); + c=va_arg(ap,int *); + + if(md->master_id != src_id || + md->special_state.ai != (skill == AM_SPHEREMINE?2:3)) + return 0; //Non alchemist summoned mobs have nothing to do here. - if(md->class_==mob_class && md->master_id==src_id) + if(md->class_==mob_class) (*c)++; - return 0; + + return 1; } static int skill_check_condition_hermod_sub(struct block_list *bl,va_list ap) @@ -8142,8 +8146,9 @@ int skill_check_condition (struct map_session_data *sd, int skill, int lv, int t int maxcount = (skill==AM_CANNIBALIZE)? 6-lv : skill_get_maxcount(skill); int mob_class = (skill==AM_CANNIBALIZE)? summons[lv-1] :1142; if(battle_config.land_skill_limit && maxcount>0 && (battle_config.land_skill_limit&BL_PC)) { - map_foreachinmap(skill_check_condition_mob_master_sub ,sd->bl.m, BL_MOB, sd->bl.id, mob_class,&c ); - if(c >= maxcount){ + i = map_foreachinmap(skill_check_condition_mob_master_sub ,sd->bl.m, BL_MOB, sd->bl.id, mob_class, skill, &c); + if(c >= maxcount || (skill==AM_CANNIBALIZE && c != i)) + { //Fails when: exceed max limit. There are other plant types already out. clif_skill_fail(sd,skill,0,0); return 0; } diff --git a/src/map/status.c b/src/map/status.c index e783b6f56..437be3cdf 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -243,9 +243,9 @@ void initChangeTables(void) { set_sc(SA_FROSTWEAPON, SC_WATERWEAPON, SI_WATERWEAPON, SCB_ATK_ELE); set_sc(SA_LIGHTNINGLOADER, SC_WINDWEAPON, SI_WINDWEAPON, SCB_ATK_ELE); set_sc(SA_SEISMICWEAPON, SC_EARTHWEAPON, SI_EARTHWEAPON, SCB_ATK_ELE); - set_sc(SA_VOLCANO, SC_VOLCANO, SI_BLANK, SCB_WATK); - set_sc(SA_DELUGE, SC_DELUGE, SI_BLANK, SCB_MAXHP); - set_sc(SA_VIOLENTGALE, SC_VIOLENTGALE, SI_BLANK, SCB_FLEE); + set_sc(SA_VOLCANO, SC_VOLCANO, SI_LANDENDOW, SCB_WATK); + set_sc(SA_DELUGE, SC_DELUGE, SI_LANDENDOW, SCB_MAXHP); + set_sc(SA_VIOLENTGALE, SC_VIOLENTGALE, SI_LANDENDOW, SCB_FLEE); add_sc(SA_REVERSEORCISH, SC_ORCISH); add_sc(SA_COMA, SC_COMA); set_sc(BD_ENCORE, SC_DANCING, SI_BLANK, SCB_SPEED); @@ -374,7 +374,7 @@ void initChangeTables(void) { set_sc(HAMI_DEFENCE, SC_DEFENCE, SI_BLANK, SCB_DEF); //[orn] set_sc(HAMI_BLOODLUST, SC_BLOODLUST, SI_BLANK, SCB_BATK|SCB_WATK); - set_sc(GD_LEADERSHIP, SC_GUILDAURA, SI_GUILDAURA, SCB_STR|SCB_AGI|SCB_VIT|SCB_DEX); + set_sc(GD_LEADERSHIP, SC_GUILDAURA, SI_BLANK, SCB_STR|SCB_AGI|SCB_VIT|SCB_DEX); set_sc(GD_BATTLEORDER, SC_BATTLEORDERS, SI_BATTLEORDERS, SCB_STR|SCB_INT|SCB_DEX); // Storing the target job rather than simply SC_SPIRIT simplifies code later on. @@ -2206,7 +2206,7 @@ int status_calc_homunculus(struct homun_data *hd, int first) status_calc_bl(&hd->bl, SCB_ALL); //Status related changes. if (memcmp(&b_status, status, sizeof(struct status_data))) - clif_hominfo(hd->master,0) ; + clif_hominfo(hd->master,hd,0) ; return 1; } @@ -2685,7 +2685,7 @@ void status_calc_bl_sub_hom(struct homun_data *hd, unsigned long flag) //[orn] SCB_BATK|SCB_WATK|SCB_MATK|SCB_ASPD|SCB_SPEED| SCB_RANGE|SCB_MAXHP|SCB_MAXSP) ) - clif_hominfo(hd->master,0); + clif_hominfo(hd->master,hd,0); } void status_calc_bl(struct block_list *bl, unsigned long flag) diff --git a/src/map/status.h b/src/map/status.h index 06e1f3e22..71b7a8344 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -336,7 +336,7 @@ enum { SI_TENSIONRELAX = 106, SI_BERSERK = 107, SI_ASSUMPTIO = 110, - SI_GUILDAURA = 112, + SI_LANDENDOW = 112, SI_MAGICPOWER = 113, SI_EDP = 114, SI_TRUESIGHT = 115, diff --git a/src/map/unit.c b/src/map/unit.c index 0755ef9c4..9c8f66517 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -943,7 +943,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, int skill_num, int ud->skilltimer = add_timer( tick+casttime, skill_castend_id, src->id, 0 ); if(sd && pc_checkskill(sd,SA_FREECAST)) status_freecast_switch(sd); - else + else if (skill_num != NPC_SELFDESTRUCTION) //Required for Marine Spheres unit_stop_walking(src,1); } else -- cgit v1.2.3-60-g2f50