Merge pull request #82 from MindRapist/mr-12

Various fixes
This commit is contained in:
rtw1x1
2026-02-15 20:46:01 +00:00
committed by GitHub
5 changed files with 71 additions and 19 deletions

View File

@@ -25,11 +25,9 @@ It builds as it is, without external dependencies.
## 📋 Changelog ## 📋 Changelog
### ⬆️ Feature Improvements ### 🐛 Bug fixes
- **Poison**: Verified consistency with the official methods and increased chances of infliction to lower level entities - **Dragonsoul Qualification**: Minimum level hardcoded in the checks for qualification.
- **Fire**: - **USE_AFFECT flag**: Now allows overrriding the same affect if its value is about to increase.
- 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).
<br> <br>
<br> <br>

View File

@@ -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% 확률 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 = 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) 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% 확률 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 = 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) if (i)
{ {

View File

@@ -49,10 +49,18 @@ bool CHARACTER::DragonSoul_IsQualified() const
void CHARACTER::DragonSoul_GiveQualification() 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", ""); LogManager::instance().CharLog(this, 0, "DS_QUALIFIED", "");
} }
AddAffect(AFFECT_DRAGON_SOUL_QUALIFIED, APPLY_NONE, 0, AFF_NONE, INFINITE_AFFECT_DURATION, 0, false, false); AddAffect(AFFECT_DRAGON_SOUL_QUALIFIED, APPLY_NONE, 0, AFF_NONE, INFINITE_AFFECT_DURATION, 0, false, false);
//SetQuestFlag("dragon_soul.is_qualified", 1); //SetQuestFlag("dragon_soul.is_qualified", 1);
//// 자격있다면 POINT_DRAGON_SOUL_IS_QUALIFIED는 무조건 1 //// 자격있다면 POINT_DRAGON_SOUL_IS_QUALIFIED는 무조건 1

View File

@@ -4869,19 +4869,32 @@ bool CHARACTER::UseItemEx(LPITEM item, TItemPos DestCell)
case USE_MONEYBAG: case USE_MONEYBAG:
break; break;
// MR-12: Overwrite lower value affects
case USE_AFFECT : 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("이미 효과가 걸려 있습니다.")); if (applyValue <= existing->lApplyValue)
} {
else ChatPacket(CHAT_TYPE_INFO, LC_TEXT("이미 효과가 걸려 있습니다."));
{ break;
AddAffect(item->GetValue(0), aApplyInfo[item->GetValue(1)].bPointType, item->GetValue(2), 0, item->GetValue(3), 0, false); }
item->SetCount(item->GetCount() - 1);
RemoveAffect(existing);
} }
AddAffect(affectType, applyType, applyValue, 0, applyDuration, 0, false);
item->SetCount(item->GetCount() - 1);
} }
break; break;
// MR-12: -- END OF -- Overwrite lower value affects
case USE_CREATE_STONE: case USE_CREATE_STONE:
AutoGiveItem(number(28000, 28013)); AutoGiveItem(number(28000, 28013));

View File

@@ -12,13 +12,20 @@ namespace quest
int ds_open_refine_window(lua_State* L) int ds_open_refine_window(lua_State* L)
{ {
const LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); const LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
if (NULL == ch) if (NULL == ch)
{ {
sys_err ("NULL POINT ERROR"); sys_err("DS_QUEST_OPEN_REFINE_WINDOW:: NULL POINT ERROR");
return 0; return 0;
} }
if (ch->DragonSoul_IsQualified()) 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; return 0;
} }
@@ -26,11 +33,27 @@ namespace quest
int ds_give_qualification(lua_State* L) int ds_give_qualification(lua_State* L)
{ {
const LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); const LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
if (NULL == ch) if (NULL == ch)
{ {
sys_err ("NULL POINT ERROR"); sys_err("DS_QUEST_GIVE_QUALIFICATION:: NULL POINT ERROR");
return 0; 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(); ch->DragonSoul_GiveQualification();
return 0; return 0;
@@ -39,13 +62,23 @@ namespace quest
int ds_is_qualified(lua_State* L) int ds_is_qualified(lua_State* L)
{ {
const LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); const LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr();
if (NULL == ch) if (NULL == ch)
{ {
sys_err ("NULL POINT ERROR"); sys_err("DS_QUEST_IS_QUALIFIED:: NULL POINT ERROR");
lua_pushnumber(L, 0); lua_pushnumber(L, 0);
return 1; 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()); lua_pushnumber(L, ch->DragonSoul_IsQualified());
return 1; return 1;
} }