Skip to content

Commit

Permalink
Fix previously plagiarized skill re-appearing after relog, when remov…
Browse files Browse the repository at this point in the history
…ed prior due to lower level copy failure
  • Loading branch information
skyleo committed Sep 25, 2024
1 parent 71fc107 commit c228f3c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/map/skill.c
Original file line number Diff line number Diff line change
Expand Up @@ -3690,12 +3690,13 @@ static int skill_attack(int attack_type, struct block_list *src, struct block_li
switch(can_copy(tsd, copy_skill)) {
case 1: // Plagiarism
{
pc->clear_existing_cloneskill(tsd, false);

lv = min(skill_lv, pc->checkskill(tsd, RG_PLAGIARISM));
if (learned_lv > lv)
if (learned_lv > lv) {
pc->clear_existing_cloneskill(tsd, true);
break; // [Aegis] can't overwrite skill of higher level, but will still remove previously copied skill.
}

pc->clear_existing_cloneskill(tsd, false);
tsd->cloneskill_id = copy_skill;
pc_setglobalreg(tsd, script->add_variable("CLONE_SKILL"), copy_skill);
pc_setglobalreg(tsd, script->add_variable("CLONE_SKILL_LV"), lv);
Expand All @@ -3712,12 +3713,13 @@ static int skill_attack(int attack_type, struct block_list *src, struct block_li
case 2: // Reproduce
{
lv = sc ? sc->data[SC__REPRODUCE]->val1 : 1;
pc->clear_existing_reproduceskill(tsd, false);

lv = min(lv, skill->get_max(copy_skill));
if (learned_lv > lv)
if (learned_lv > lv) {
pc->clear_existing_reproduceskill(tsd, true);
break; // unconfirmed, but probably the same behavior as for RG_PLAGIARISM
}

pc->clear_existing_reproduceskill(tsd, false);
tsd->reproduceskill_id = copy_skill;
pc_setglobalreg(tsd, script->add_variable("REPRODUCE_SKILL"), copy_skill);
pc_setglobalreg(tsd, script->add_variable("REPRODUCE_SKILL_LV"), lv);
Expand Down

0 comments on commit c228f3c

Please sign in to comment.