summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-04-11 16:34:50 +0000
committerzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-04-11 16:34:50 +0000
commitf9a9e380b81616ee2e88214cea8f347296b96708 (patch)
treea4c8f44631dd870cd5758d1dd4aaec5e1963fc1b
parent044ca381f50daa43b09fad43c9a671c276fc2f2f (diff)
downloadhercules-f9a9e380b81616ee2e88214cea8f347296b96708.tar.gz
hercules-f9a9e380b81616ee2e88214cea8f347296b96708.tar.bz2
hercules-f9a9e380b81616ee2e88214cea8f347296b96708.tar.xz
hercules-f9a9e380b81616ee2e88214cea8f347296b96708.zip
- Added code to remove a trap when it dies.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12566 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--src/map/skill.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/src/map/skill.c b/src/map/skill.c
index 1f9fb843b..1a2c24855 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -9593,14 +9593,11 @@ int skill_unit_timer_sub (struct block_list* bl, va_list ap)
break;
case UNT_ANKLESNARE:
- if( group->val2 > 0 ) { // used trap
- struct block_list *target = map_id2bl(group->val2);
- if(target)
- status_change_end(target,SC_ANKLE,-1);
+ if( group->val2 > 0 ) {
+ // Used Trap don't returns back to item
skill_delunit(unit);
break;
}
- // else fall through
case UNT_SKIDTRAP:
case UNT_LANDMINE:
case UNT_SHOCKWAVE:
@@ -9610,9 +9607,9 @@ int skill_unit_timer_sub (struct block_list* bl, va_list ap)
case UNT_CLAYMORETRAP:
case UNT_TALKIEBOX:
{
- struct block_list* src = map_id2bl(group->src_id);
- if( src && src->type == BL_PC )
- { // revert unit back into a trap
+ struct block_list* src;
+ if( unit->val1 > 0 && (src = map_id2bl(group->src_id)) != NULL && src->type == BL_PC )
+ { // revert unit back into a trap
struct item item_tmp;
memset(&item_tmp,0,sizeof(item_tmp));
item_tmp.nameid = ITEMID_TRAP;
@@ -9666,7 +9663,24 @@ int skill_unit_timer_sub (struct block_list* bl, va_list ap)
unit->val1 -= SKILLUNITTIMER_INTERVAL/20; // trap's hp
if( unit->val1 <= 0 && unit->limit + group->tick > tick + 700 )
unit->limit = DIFF_TICK(tick+700,group->tick);
- break;
+ break;
+ case UNT_SKIDTRAP:
+ case UNT_LANDMINE:
+ case UNT_SHOCKWAVE:
+ case UNT_SANDMAN:
+ case UNT_FLASHER:
+ case UNT_FREEZINGTRAP:
+ case UNT_TALKIEBOX:
+ case UNT_ANKLESNARE:
+ if( unit->val1 <= 0 ) {
+ if( group->unit_id == UNT_ANKLESNARE && group->val2 > 0 )
+ skill_delunit(unit);
+ else {
+ group->unit_id = UNT_USED_TRAPS;
+ group->limit = DIFF_TICK(tick, group->tick) + 1500;
+ }
+ }
+ break;
case UNT_TATAMIGAESHI:
if( unit->range >= 0 )
{ //Disable processed cell.
@@ -9677,7 +9691,7 @@ int skill_unit_timer_sub (struct block_list* bl, va_list ap)
group->bl_flag= BL_NUL;
}
}
- break;
+ break;
}
}