From 6699c90798b52154bf6d4cd62cf151b312a12db1 Mon Sep 17 00:00:00 2001 From: skotlex Date: Sun, 30 Apr 2006 18:41:05 +0000 Subject: - If someone is expulsed from a guild while the guild storage is open, it will be auto-closed now. - Modified battle_consume_ammo to prevent consuming multiple arrows on AC_SHOWER. - Readded script command skillpointcount. (who removed it? <.<) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6406 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/battle.c | 8 +++++++- src/map/battle.h | 1 + src/map/guild.c | 3 ++- src/map/script.c | 14 ++++++++++++++ src/map/skill.c | 6 ++++++ 5 files changed, 30 insertions(+), 2 deletions(-) (limited to 'src/map') diff --git a/src/map/battle.c b/src/map/battle.c index 521753a25..c1c451471 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -934,12 +934,18 @@ static void battle_calc_base_damage(struct block_list *src, struct block_list *t * Consumes ammo for the given skill. *------------------------------------------ */ -static void battle_consume_ammo(TBL_PC*sd, int skill, int lv) +void battle_consume_ammo(TBL_PC*sd, int skill, int lv) { int qty=1; if (!battle_config.arrow_decrement) return; + if (skill == AC_SHOWER) { + //Can't consume arrows this way as it triggers per target, gotta wait for the direct invocation with lv -1 + if (lv > 0) + return; + lv *= -1; + } if (skill) { qty = skill_get_ammo_qty(skill, lv); diff --git a/src/map/battle.h b/src/map/battle.h index d0511eb53..96ea7eebc 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -90,6 +90,7 @@ int battle_check_undead(int race,int element); int battle_check_target(struct block_list *src, struct block_list *target,int flag); int battle_check_range(struct block_list *src,struct block_list *bl,int range); +void battle_consume_ammo(struct map_session_data* sd, int skill, int lv); // ݒ int battle_config_switch(const char *str); // [Valaris] diff --git a/src/map/guild.c b/src/map/guild.c index 0c71ee293..820e17484 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -851,7 +851,8 @@ int guild_member_leaved(int guild_id,int account_id,int char_id,int flag, clif_guild_memberlist(online_member_sd); if(sd != NULL && sd->status.guild_id == guild_id) { - + if (sd->state.storage_flag == 2) //Close the guild storage. + storage_guild_storageclose(sd); sd->status.guild_id=0; sd->guild_emblem_id=0; sd->state.guild_sent=0; diff --git a/src/map/script.c b/src/map/script.c index 5880c0b81..f9a87e1be 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -271,6 +271,7 @@ int buildin_birthpet(struct script_state *st); int buildin_resetlvl(struct script_state *st); int buildin_resetstatus(struct script_state *st); int buildin_resetskill(struct script_state *st); +int buildin_skillpointcount(struct script_state *st); int buildin_changebase(struct script_state *st); int buildin_changesex(struct script_state *st); int buildin_waitingroom(struct script_state *st); @@ -594,6 +595,7 @@ struct { {buildin_resetlvl,"resetlvl","i"}, {buildin_resetstatus,"resetstatus",""}, {buildin_resetskill,"resetskill",""}, + {buildin_skillpointcount,"skillpointcount",""}, {buildin_changebase,"changebase","i"}, {buildin_changesex,"changesex",""}, {buildin_waitingroom,"waitingroom","si*"}, @@ -6321,6 +6323,18 @@ int buildin_resetskill(struct script_state *st) return 0; } +/*========================================== + * Counts total amount of skill points. + *------------------------------------------ + */ +int buildin_skillpointcount(struct script_state *st) +{ + struct map_session_data *sd; + sd=script_rid2sd(st); + push_val(st->stack,C_INT,sd->status.skill_point + pc_resetskill(sd,2)); + return 0; +} + /*========================================== * *------------------------------------------ diff --git a/src/map/skill.c b/src/map/skill.c index c4ecd5960..1103d6c19 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -2732,6 +2732,8 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl,int s skill_castend_damage_id); //Skill-attack at the end in case it has knockback. [Skotlex] skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,0); + if (sd) + battle_consume_ammo(sd, skillid, -skilllv); } break; @@ -6853,6 +6855,8 @@ int skill_unit_onplace_timer(struct skill_unit *src,struct block_list *bl,unsign case UNT_ATTACK_SKILLS: skill_attack(skill_get_type(sg->skill_id),ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0); + if (sg->skill_id == AC_SHOWER) + sg->val2++; //Store count of hitted enemies to know when to delete an arrow. break; case UNT_FIREPILLAR_WAITING: @@ -9476,6 +9480,8 @@ int skill_delunitgroup(struct block_list *src, struct skill_unit_group *group) status_change_end(src,SC_GOSPEL,-1); } } + if (group->skill_id == AC_SHOWER && group->val2 && src->type==BL_PC) + battle_consume_ammo((TBL_PC*)src, group->skill_id, -group->skill_lv); //Delete arrow if at least one target was hit. group->alive_count=0; if(group->unit!=NULL){ -- cgit v1.2.3-70-g09d2