From 609f20501e891a9200df680f39b0bd40d158b154 Mon Sep 17 00:00:00 2001 From: Fate Date: Sat, 16 May 2009 13:54:51 +0000 Subject: Added sc_check command to determine whether a given status change is active --- src/map/script.c | 18 ++++++++++++++++++ src/map/skill.c | 16 ++++++++++++++++ src/map/skill.h | 1 + 3 files changed, 35 insertions(+) (limited to 'src') diff --git a/src/map/script.c b/src/map/script.c index a0ab3e0..e3f82d6 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -209,6 +209,7 @@ int buildin_hideonnpc(struct script_state *st); int buildin_sc_start(struct script_state *st); int buildin_sc_start2(struct script_state *st); int buildin_sc_end(struct script_state *st); +int buildin_sc_check(struct script_state *st); int buildin_getscrate(struct script_state *st); int buildin_debugmes(struct script_state *st); int buildin_resetlvl(struct script_state *st); @@ -413,6 +414,7 @@ struct { {buildin_sc_start,"sc_start","iii*"}, {buildin_sc_start2,"sc_start2","iiii*"}, {buildin_sc_end,"sc_end","i"}, + {buildin_sc_check,"sc_check","i"}, {buildin_getscrate,"getscrate","ii*"}, {buildin_debugmes,"debugmes","s"}, {buildin_resetlvl,"resetlvl","i"}, @@ -4162,6 +4164,22 @@ int buildin_sc_end(struct script_state *st) // printf("sc_end : %d %d\n",st->rid,type); return 0; } + +int buildin_sc_check(struct script_state *st) +{ + struct block_list *bl; + int type; + type=conv_num(st,& (st->stack->stack_data[st->start+2])); + bl = map_id2bl(st->rid); + if(bl->type == BL_PC && ((struct map_session_data *)bl)->state.potionpitcher_flag) + bl = map_id2bl(((struct map_session_data *)bl)->skilltarget); + + push_val (st->stack, C_INT, + skill_status_change_active(bl, type)); + + return 0; +} + /*========================================== * 状態異常耐性を計算した確率を返す *------------------------------------------ diff --git a/src/map/skill.c b/src/map/skill.c index 8a25f64..3099aeb 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -7494,6 +7494,22 @@ int skill_status_change_timer_sub(struct block_list *bl, va_list ap ) * ステータス異常終了 *------------------------------------------ */ +int skill_status_change_active(struct block_list* bl, int type) +{ + struct status_change* sc_data; + + nullpo_retr(0, bl); + if(bl->type!=BL_PC && bl->type!=BL_MOB) { + if(battle_config.error_log) + printf("skill_status_change_active: neither MOB nor PC !\n"); + return 0; + } + + nullpo_retr(0, sc_data = battle_get_sc_data(bl)); + + return sc_data[type].timer != -1; +} + int skill_status_change_end(struct block_list* bl, int type, int tid) { struct status_change* sc_data; diff --git a/src/map/skill.h b/src/map/skill.h index bfbe93e..ea204e0 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -129,6 +129,7 @@ int skill_is_danceskill(int id); int skill_status_effect(struct block_list *bl,int type,int val1,int val2,int val3,int val4,int tick,int flag, int spell_invocation); int skill_status_change_start(struct block_list *bl,int type,int val1,int val2,int val3,int val4,int tick,int flag); int skill_status_change_timer(int tid, unsigned int tick, int id, int data); +int skill_status_change_active(struct block_list *bl,int type); // [fate] int skill_encchant_eremental_end(struct block_list *bl, int type); int skill_status_change_end( struct block_list* bl , int type,int tid ); int skill_status_change_clear(struct block_list *bl,int type); -- cgit v1.2.3-70-g09d2