From 05c59511cda1a4c9f75fa40d019a464aab6eb0c8 Mon Sep 17 00:00:00 2001 From: Mind Rapist Date: Sun, 15 Feb 2026 21:40:33 +0200 Subject: [PATCH] Various fixes --- README.md | 8 +++---- src/game/char_battle.cpp | 4 ++-- src/game/char_dragonsoul.cpp | 10 +++++++- src/game/char_item.cpp | 27 +++++++++++++++------ src/game/questlua_dragonsoul.cpp | 41 ++++++++++++++++++++++++++++---- 5 files changed, 71 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 65378a3..db7093d 100644 --- a/README.md +++ b/README.md @@ -25,11 +25,9 @@ It builds as it is, without external dependencies. ## 📋 Changelog -### ⬆️ Feature Improvements - - **Poison**: Verified consistency with the official methods and increased chances of infliction to lower level entities - - **Fire**: - - Updated so it cannot kill the target, only lower them to 1 HP (consistency with official). - - The Powerful Ice Witch (`1192`) takes 20% less damage from the fire affect (consistency with official). +### 🐛 Bug fixes + - **Dragonsoul Qualification**: Minimum level hardcoded in the checks for qualification. + - **USE_AFFECT flag**: Now allows overrriding the same affect if its value is about to increase.

diff --git a/src/game/char_battle.cpp b/src/game/char_battle.cpp index 25885b9..23a0da7 100644 --- a/src/game/char_battle.cpp +++ b/src/game/char_battle.cpp @@ -2078,7 +2078,7 @@ bool CHARACTER::Damage(LPCHARACTER pAttacker, int dam, EDamageType type) // retu if (pAttacker->GetPoint(POINT_HIT_HP_RECOVERY) && number(0, 4) > 0) // 80% 확률 { // int i = MIN(dam, iCurHP) * pAttacker->GetPoint(POINT_HIT_HP_RECOVERY) / 100; - int i = ((iCurHP>=0)?MIN(dam, iCurHP):dam) * pAttacker->GetPoint(POINT_HIT_HP_RECOVERY) / 100; // Fix + int i = ((iCurHP >= 0) ? MIN(dam, iCurHP) : dam) * pAttacker->GetPoint(POINT_HIT_HP_RECOVERY) / 100; // Fix if (i) { @@ -2091,7 +2091,7 @@ bool CHARACTER::Damage(LPCHARACTER pAttacker, int dam, EDamageType type) // retu if (pAttacker->GetPoint(POINT_HIT_SP_RECOVERY) && number(0, 4) > 0) // 80% 확률 { // int i = MIN(dam, iCurHP) * pAttacker->GetPoint(POINT_HIT_SP_RECOVERY) / 100; - int i = ((iCurHP>=0)?MIN(dam, iCurHP):dam) * pAttacker->GetPoint(POINT_HIT_SP_RECOVERY) / 100; // Fix + int i = ((iCurHP >= 0) ? MIN(dam, iCurHP) : dam) * pAttacker->GetPoint(POINT_HIT_SP_RECOVERY) / 100; // Fix if (i) { diff --git a/src/game/char_dragonsoul.cpp b/src/game/char_dragonsoul.cpp index f3e712d..bace6a1 100644 --- a/src/game/char_dragonsoul.cpp +++ b/src/game/char_dragonsoul.cpp @@ -49,10 +49,18 @@ bool CHARACTER::DragonSoul_IsQualified() const void CHARACTER::DragonSoul_GiveQualification() { - if(NULL == FindAffect(AFFECT_DRAGON_SOUL_QUALIFIED)) + // MR-12: Check min level for Dragonsoul qualification + if (GetLevel() > 30) + { + return; + } + // MR-12: -- END OF -- Check min level for Dragonsoul qualification + + if (NULL == FindAffect(AFFECT_DRAGON_SOUL_QUALIFIED)) { LogManager::instance().CharLog(this, 0, "DS_QUALIFIED", ""); } + AddAffect(AFFECT_DRAGON_SOUL_QUALIFIED, APPLY_NONE, 0, AFF_NONE, INFINITE_AFFECT_DURATION, 0, false, false); //SetQuestFlag("dragon_soul.is_qualified", 1); //// 자격있다면 POINT_DRAGON_SOUL_IS_QUALIFIED는 무조건 1 diff --git a/src/game/char_item.cpp b/src/game/char_item.cpp index 8eac66c..2db72fa 100644 --- a/src/game/char_item.cpp +++ b/src/game/char_item.cpp @@ -4869,19 +4869,32 @@ bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell) case USE_MONEYBAG: break; + // MR-12: Overwrite lower value affects case USE_AFFECT : { - if (FindAffect(item->GetValue(0), aApplyInfo[item->GetValue(1)].bPointType)) + const DWORD affectType = item->GetValue(0); + const BYTE applyType = aApplyInfo[item->GetValue(1)].bPointType; + const long applyValue = item->GetValue(2); + const long applyDuration = item->GetValue(3); + + CAffect* existing = FindAffect(affectType, applyType); + + if (existing) { - ChatPacket(CHAT_TYPE_INFO, LC_TEXT("이미 효과가 걸려 있습니다.")); - } - else - { - AddAffect(item->GetValue(0), aApplyInfo[item->GetValue(1)].bPointType, item->GetValue(2), 0, item->GetValue(3), 0, false); - item->SetCount(item->GetCount() - 1); + if (applyValue <= existing->lApplyValue) + { + ChatPacket(CHAT_TYPE_INFO, LC_TEXT("이미 효과가 걸려 있습니다.")); + break; + } + + RemoveAffect(existing); } + + AddAffect(affectType, applyType, applyValue, 0, applyDuration, 0, false); + item->SetCount(item->GetCount() - 1); } break; + // MR-12: -- END OF -- Overwrite lower value affects case USE_CREATE_STONE: AutoGiveItem(number(28000, 28013)); diff --git a/src/game/questlua_dragonsoul.cpp b/src/game/questlua_dragonsoul.cpp index 9c2e713..c11ded2 100644 --- a/src/game/questlua_dragonsoul.cpp +++ b/src/game/questlua_dragonsoul.cpp @@ -12,13 +12,20 @@ namespace quest int ds_open_refine_window(lua_State* L) { const LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); + if (NULL == ch) { - sys_err ("NULL POINT ERROR"); + sys_err("DS_QUEST_OPEN_REFINE_WINDOW:: NULL POINT ERROR"); return 0; } + if (ch->DragonSoul_IsQualified()) - ch->DragonSoul_RefineWindow_Open(CQuestManager::instance().GetCurrentNPCCharacterPtr()); + { + sys_err("DS_QUEST_OPEN_REFINE_WINDOW:: ALREADY QUALIFIED"); + return 0; + } + + ch->DragonSoul_RefineWindow_Open(CQuestManager::instance().GetCurrentNPCCharacterPtr()); return 0; } @@ -26,11 +33,27 @@ namespace quest int ds_give_qualification(lua_State* L) { const LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); + if (NULL == ch) { - sys_err ("NULL POINT ERROR"); + sys_err("DS_QUEST_GIVE_QUALIFICATION:: NULL POINT ERROR"); return 0; } + + if (ch->DragonSoul_IsQualified()) + { + sys_err("DS_QUEST_GIVE_QUALIFICATION:: ALREADY QUALIFIED"); + return 0; + } + + // MR-12: Check min level for Dragonsoul qualification + if (ch->GetLevel() <= 30) + { + sys_err("DS_QUEST_GIVE_QUALIFICATION:: LEVEL TOO LOW"); + return 0; + } + // MR-12: -- END OF -- Check min level for Dragonsoul qualification + ch->DragonSoul_GiveQualification(); return 0; @@ -39,13 +62,23 @@ namespace quest int ds_is_qualified(lua_State* L) { const LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); + if (NULL == ch) { - sys_err ("NULL POINT ERROR"); + sys_err("DS_QUEST_IS_QUALIFIED:: NULL POINT ERROR"); lua_pushnumber(L, 0); return 1; } + // MR-12: Check min level for Dragonsoul qualification + if (ch->GetLevel() <= 30) + { + sys_err("DS_QUEST_IS_QUALIFIED:: LEVEL TOO LOW"); + lua_pushnumber(L, 0); + return 1; + } + // MR-12: -- END OF -- Check min level for Dragonsoul qualification + lua_pushnumber(L, ch->DragonSoul_IsQualified()); return 1; }