浏览代码

Fixed shield spell status changes

Thanks to @limitro
Lemongrass3110 3 年之前
父节点
当前提交
801864fe60
共有 1 个文件被更改,包括 12 次插入14 次删除
  1. 12 14
      src/map/status.cpp

+ 12 - 14
src/map/status.cpp

@@ -8973,6 +8973,10 @@ static int status_get_sc_interval(enum sc_type type)
 		case SC_BLEEDING:
 		case SC_TOXIN:
 			return 10000;
+		case SC_SHIELDSPELL_HP:
+			return 3000;
+		case SC_SHIELDSPELL_SP:
+			return 5000;
 		default:
 			break;
 	}
@@ -11907,13 +11911,13 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
 			break;
 		case SC_SHIELDSPELL_HP:
 			val2 = 3; // 3% HP every 3 seconds
-			tick_time = 3000;
-			val4 = tick / tick_time;
+			tick_time = status_get_sc_interval(type);
+			val4 = tick - tick_time; // Remaining time
 			break;
 		case SC_SHIELDSPELL_SP:
 			val2 = 3; // 3% SP every 5 seconds
-			tick_time = 5000;
-			val4 = tick / tick_time;
+			tick_time = status_get_sc_interval(type);
+			val4 = tick - tick_time; // Remaining time
 			break;
 		case SC_SHIELDSPELL_ATK:
 			val2 = 150; // WATK/MATK bonus
@@ -14892,20 +14896,14 @@ TIMER_FUNC(status_change_timer){
 		break;
 
 	case SC_SHIELDSPELL_HP:
-		if (sce->val4 >= 0) {
-			if (status->hp < status->max_hp)
-				status_heal(bl, status->max_hp * sce->val2 / 100, 0, 1);
-			sc_timer_next(3000 + tick);
-			return 0;
+		if( sce->val4 >= 0 && status->hp < status->max_hp ){
+			status_heal( bl, status->max_hp * sce->val2 / 100, 0, 1 );
 		}
 		break;
 
 	case SC_SHIELDSPELL_SP:
-		if (sce->val4 >= 0) {
-			if (status->sp < status->max_sp)
-				status_heal(bl, 0, status->max_sp * sce->val2 / 100, 1);
-			sc_timer_next(5000 + tick);
-			return 0;
+		if( sce->val4 >= 0 && status->sp < status->max_sp ){
+			status_heal( bl, 0, status->max_sp * sce->val2 / 100, 1 );
 		}
 		break;