From 5e6480cb11403f8f634a1cfc9648c7ec654c0fb8 Mon Sep 17 00:00:00 2001 From: skotlex Date: Mon, 20 Feb 2006 03:14:49 +0000 Subject: - Fixed Taekwon stances not triggering. - Added atcommand @exp - Added error reporting when add_timer_interval receives a negative/0 interval value. - Fixed a possible infinite recursion bug with splash self skills. - Modified the way firewall_hits_on_undead works, to loop and invoke multiple skill_attacks based on the value. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5338 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/common/timer.c | 9 ++++++++- src/map/atcommand.c | 28 ++++++++++++++++++++++++++++ src/map/atcommand.h | 1 + src/map/battle.c | 3 +-- src/map/skill.c | 25 ++++++++++++++----------- 5 files changed, 52 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/common/timer.c b/src/common/timer.c index 7b7ac5e2c..49b6e18de 100644 --- a/src/common/timer.c +++ b/src/common/timer.c @@ -237,8 +237,15 @@ int add_timer(unsigned int tick,int (*func)(int,unsigned int,int,int), int id, i int add_timer_interval(unsigned int tick, int (*func)(int,unsigned int,int,int), int id, int data, int interval) { - int tid = acquire_timer(); + int tid; + if (interval < 1) { + ShowError("add_timer_interval : function %08x(%s) has invalid interval %d!\n", + (int)func, search_timer_func_list(func)); + return -1; + } + + tid = acquire_timer(); timer_data[tid].tick = tick; timer_data[tid].func = func; timer_data[tid].id = id; diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 48157c3e2..a3e22a90a 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -256,6 +256,7 @@ ACMD_FUNC(undisguiseall); ACMD_FUNC(disguiseall); ACMD_FUNC(changelook); ACMD_FUNC(mobinfo); //by Lupus +ACMD_FUNC(exp); // by Skotlex ACMD_FUNC(adopt); // by Veider ACMD_FUNC(version); // by Ancyker @@ -565,6 +566,7 @@ static AtCommandInfo atcommand_info[] = { { AtCommand_MobInfo, "@mobinfo", 1, atcommand_mobinfo }, // [Lupus] { AtCommand_MobInfo, "@monsterinfo", 1, atcommand_mobinfo }, // [Lupus] { AtCommand_MobInfo, "@mi", 1, atcommand_mobinfo }, // [Lupus] + { AtCommand_Exp, "@exp", 0, atcommand_exp }, // [Skotlex] { AtCommand_Adopt, "@adopt", 40, atcommand_adopt }, // [Veider] { AtCommand_Version, "@version", 1, atcommand_version }, @@ -6506,6 +6508,32 @@ int atcommand_undisguiseall( return 0; } +/*========================================== + * @exp by [Skotlex] + *------------------------------------------ + */ +int atcommand_exp( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + char output[200]; + double nextb, nextj; + nullpo_retr(-1, sd); + memset(output, '\0', sizeof(output)); + + nextb = pc_nextbaseexp(sd); + if (nextb) + nextb = sd->status.base_exp*100.0/nextb; + + nextj = pc_nextjobexp(sd); + if (nextj) + nextj = sd->status.job_exp*100.0/nextj; + + sprintf(output, "Base Level: %d (%.3f%%) | Job Level: %d (%.3f%%)", sd->status.base_level, nextb, sd->status.job_level, nextj); + clif_displaymessage(fd, output); + return 0; +} + /*========================================== * @broadcast by [Valaris] diff --git a/src/map/atcommand.h b/src/map/atcommand.h index 5c24778fa..a84b8ba8c 100644 --- a/src/map/atcommand.h +++ b/src/map/atcommand.h @@ -236,6 +236,7 @@ enum AtCommandType { AtCommand_ChangeLook, AtCommand_AutoLoot, //by Upa-Kun AtCommand_MobInfo, //by Lupus + AtCommand_Exp, // by Skotlex AtCommand_Adopt, // by Veider AtCommand_Version, // by Ancyker diff --git a/src/map/battle.c b/src/map/battle.c index 7439760b5..78cb1bb15 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -2422,8 +2422,7 @@ struct Damage battle_calc_magic_attack( switch(skill_num) { case MG_FIREWALL: - if(mflag) { //mflag has a value when it was checked it works against an undead in skill.c [Skotlex] - ad.div_ = mflag; //mflag contains the number of hits against undead. + if(mflag) { //mflag has a value when it was checked against an undead in skill.c [Skotlex] ad.blewcount = 0; //No knockback ad.dmotion = 0; //No flinch animation. } else diff --git a/src/map/skill.c b/src/map/skill.c index 07ef6e066..06b3550d8 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -859,13 +859,13 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int // Chance to trigger Taekwon kicks [Dralnu] if(sd->sc.count) { if(sd->sc.data[SC_READYSTORM].timer != -1) - status_change_start(src,SC_COMBO, TK_STORMKICK,15,0,0,0, + status_change_start(src,SC_COMBO, 15, TK_STORMKICK,0,0,0, (2000 - 4 * status_get_agi(src) - 2 * status_get_dex(src)),0); else if(sd->sc.data[SC_READYDOWN].timer != -1) - status_change_start(src,SC_COMBO, TK_DOWNKICK,15,0,0,0, + status_change_start(src,SC_COMBO, 15, TK_DOWNKICK,0,0,0, (2000 - 4 * status_get_agi(src) - 2 * status_get_dex(src)),0); else if(sd->sc.data[SC_READYTURN].timer != -1 && sd->sc.data[SC_COMBO].timer == -1) - status_change_start(src,SC_COMBO, TK_TURNKICK,15,0,0,0, + status_change_start(src,SC_COMBO, 15, TK_TURNKICK,0,0,0, (2000 - 4 * status_get_agi(src) - 2 * status_get_dex(src)),0); else if(sd->sc.data[SC_READYCOUNTER].timer != -1 && sd->sc.data[SC_COMBO].timer == -1) //additional chance from SG_FRIEND [Komurka] { @@ -874,7 +874,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int rate += rate*sd->sc.data[SC_SKILLRATE_UP].val2/100; status_change_end(src,SC_SKILLRATE_UP,-1); } - status_change_start(src,SC_COMBO, TK_COUNTER,rate, bl->id,0,0, + status_change_start(src,SC_COMBO, rate, TK_COUNTER, bl->id,0,0, (2000 - 4 * status_get_agi(src) - 2 * status_get_dex(src)),0); } } @@ -3052,7 +3052,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in return 1; //Self skill with target changed? We assume these are offensive auto-select-target skills. [Skotlex] - if (skill_get_inf(skillid)&INF_SELF_SKILL && src != bl && !(skill_get_nk(skillid)&NK_NO_DAMAGE)) + //But only do this on the first call (flag&~1) + if (!(flag&1) && skill_get_inf(skillid)&INF_SELF_SKILL && src != bl && !(skill_get_nk(skillid)&NK_NO_DAMAGE)) return skill_castend_damage_id (src, bl, skillid, skilllv, tick, flag); if (skillid > 0 && skillid < MAX_SKILL) @@ -6758,12 +6759,14 @@ int skill_unit_onplace_timer(struct skill_unit *src,struct block_list *bl,unsign switch (sg->unit_id) { case UNT_FIREWALL: { - int flag=0, t_ele = status_get_elem_type(bl); - if (t_ele == 3 || battle_check_undead(status_get_race(bl), t_ele)) - flag = src->val2>battle_config.firewall_hits_on_undead?battle_config.firewall_hits_on_undead:src->val2; - - skill_attack(BF_MAGIC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,flag); - src->val2-=flag?flag:1; + int count=0, t_ele = status_get_elem_type(bl); + if (t_ele == 3 || battle_check_undead(status_get_race(bl), t_ele)) { + while (count++ < battle_config.firewall_hits_on_undead && src->val2-- && !status_isdead(bl)) + skill_attack(BF_MAGIC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick+count*10,1); + } else { + skill_attack(BF_MAGIC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0); + src->val2--; + } if (src->val2<=0) skill_delunit(src); break; -- cgit v1.2.3-70-g09d2