Merge of Rytech's 4CrAM (#6414)

Merged Rytech2/4CrAM-Open@978d4fc406

Original author is @Rytech2 and all credits belong to him.
Cleanups by @Lemongrass3110, @aleos89 and @Atemo.

Co-authored-by: Rytech2 <rytech16@gmail.com>
Co-authored-by: aleos <aleos89@users.noreply.github.com>
Co-authored-by: Atemo <capucrath@gmail.com>
This commit is contained in:
Lemongrass3110
2021-12-30 20:25:19 +01:00
committed by GitHub
parent 5105a03aec
commit 7556453dfc
78 changed files with 19190 additions and 559 deletions

View File

@@ -1815,6 +1815,34 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
}
}
break;
case DK_SERVANT_W_SIGN: {
uint8 i = 0, count = min(skill_lv, MAX_SERVANT_SIGN);
ARR_FIND( 0, count, i, sd->servant_sign[i] == target_id );
// Already targetted
if( i < count ){
break;
}
ARR_FIND( 0, count, i, sd->servant_sign[i] == 0 );
// No free slots
if( i == count ){
clif_skill_fail( sd, skill_id, USESKILL_FAIL_LEVEL, 0 );
return 0;
}
}
break;
case TR_RETROSPECTION:
// Prevent using the song skill if you no longer have the skill in your tree.
if (!sd->skill_id_song || pc_checkskill(sd, sd->skill_id_song) <= 0) {
clif_skill_fail(sd, skill_id, USESKILL_FAIL_LEVEL, 0);
return 0;
}
sd->skill_id_old = skill_id;
break;
}
if (!skill_check_condition_castbegin(sd, skill_id, skill_lv))
@@ -1935,6 +1963,16 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
if (sc && sc->data[SC_WUGDASH])
casttime = -1;
break;
case DK_SERVANT_W_PHANTOM: { // Stops servants from being consumed on unmarked targets.
status_change *tsc = status_get_sc(target);
// Only allow to attack if the enemy has a sign mark given by the caster.
if( tsc == nullptr || tsc->data[SC_SERVANT_SIGN] == nullptr || tsc->data[SC_SERVANT_SIGN]->val1 != src->id ){
clif_skill_fail(sd, skill_id, USESKILL_FAIL, 0);
return 0;
}
}
break;
case EL_WIND_SLASH:
case EL_HURRICANE:
case EL_TYPOON_MIS:
@@ -2023,12 +2061,12 @@ int unit_skilluse_id2(struct block_list *src, int target_id, uint16 skill_id, ui
if( sc ) {
// These 3 status do not stack, so it's efficient to use if-else
if( sc->data[SC_CLOAKING] && !(sc->data[SC_CLOAKING]->val4&4) && skill_id != AS_CLOAKING ) {
if( sc->data[SC_CLOAKING] && !(sc->data[SC_CLOAKING]->val4&4) && skill_id != AS_CLOAKING && skill_id != SHC_SHADOW_STAB) {
status_change_end(src, SC_CLOAKING, INVALID_TIMER);
if (!src->prev)
return 0; // Warped away!
} else if( sc->data[SC_CLOAKINGEXCEED] && !(sc->data[SC_CLOAKINGEXCEED]->val4&4) && skill_id != GC_CLOAKINGEXCEED ) {
} else if( sc->data[SC_CLOAKINGEXCEED] && !(sc->data[SC_CLOAKINGEXCEED]->val4&4) && skill_id != GC_CLOAKINGEXCEED && skill_id != SHC_SHADOW_STAB) {
status_change_end(src,SC_CLOAKINGEXCEED, INVALID_TIMER);
if (!src->prev)
@@ -3041,6 +3079,7 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file,
status_change_end(bl, SC_TINDER_BREAKER, INVALID_TIMER);
status_change_end(bl, SC_TINDER_BREAKER2, INVALID_TIMER);
status_change_end(bl, SC_FLASHKICK, INVALID_TIMER);
status_change_end(bl, SC_SERVANT_SIGN, INVALID_TIMER);
status_change_end(bl, SC_HIDING, INVALID_TIMER);
// Ensure the bl is a PC; if so, we'll handle the removal of cloaking and cloaking exceed later
if ( bl->type != BL_PC ) {