Active+ Member Reached 605 Posted December 10, 2024 Active+ Member Share Posted December 10, 2024 The reflect aiflag found in the Official game's protos allows the mob to reflect y% of the damage dealt under x% health. char_state.cpp // Search bool CHARACTER::IsStoneSkinner() const // Add Above bool CHARACTER::IsReflector() const { return IS_SET(m_pointsInstant.dwAIFlag, AIFLAG_REFLECT); } // search in CHARACTER::__StateIdle_Monster() if (IsGodSpeeder()) if (IsGodSpeed()) SetGodSpeed(false); // Add below if (IsReflector()) if (IsReflect()) SetReflect(false); // search in CHARACTER::StateBattle() if (IsGodSpeeder() == true) if (GetHPPct() < m_pkMobData->m_table.bGodSpeedPoint) if (IsGodSpeed() != true) SetGodSpeed(true); // Add above if (IsReflector() == true) if (GetHPPct() < 25) if (IsReflect() != true) SetReflect(true); char_battle.cpp // Search in ::Damage SendDamagePacket(pAttacker, dam, damageFlag); // Add above if (pAttacker && pAttacker->IsPC() && IsNPC() && IsReflect()) pAttacker->SendDamagePacket(this, dam/100*5, damageFlag); char.h // Search bool IsBerserker() const; bool IsBerserk() const; void SetBerserk(bool mode); // Add below bool IsReflector() const; bool IsReflect() const; void SetReflect(bool mode); char.cpp // Search bool CHARACTER::IsGodSpeed() const // Add above bool CHARACTER::IsReflect() const { if (m_pkMobInst != nullptr) return m_pkMobInst->m_IsReflect; else return false; } void CHARACTER::SetReflect(bool mode) { if (m_pkMobInst != nullptr) m_pkMobInst->m_IsReflect = mode; } mob_manager.cpp // Search CMobInstance::CMobInstance() : m_IsBerserk(false), m_IsGodSpeed(false), m_IsRevive(false), // Add , m_IsReflect(false) mob_manager.h // Search bool m_IsRevive; // Add below bool m_IsReflect; + I didn't include it here but in length.h enum EAIFlags into AIFLAG_REFLECT and in your ProtoReader file get_Mob_AIFlag_Value function, after including it as "REFLECT" in the array, when the mobs you give REFLECT as aiflag in mob_proto have less than 25% health, it reflects 5% of the damage you deal back to you. I preferred to make these parts static, if you wish, you can open columns like berserk, stoneskin in mob proto and dynamically set how many health points it will reflect and how many damage points it will reflect back. 2 1 Link to comment Share on other sites More sharing options...
BadRomani 61 Posted December 25, 2024 Share Posted December 25, 2024 (edited) bool CHARACTER::IsReflect() const { if (m_pkMobInst != nullptr) return m_pkMobInst->m_IsReflect; else return false; } Oh brother, you code so badly. Fix bool CHARACTER::IsReflect() const { if (m_pkMobInst != nullptr) return m_pkMobInst->m_IsReflect; return false; } // OTHER if (IsReflector() && IsReflect()) SetReflect(false); // OTHER if (IsReflector() && GetHPPct() < 25 && !IsReflect()) SetReflect(true); Edited December 25, 2024 by BadRomani Link to comment Share on other sites More sharing options...
Contributor Amun 2295 Posted December 25, 2024 Contributor Share Posted December 25, 2024 (edited) Spoiler 2 hours ago, BadRomani said: bool CHARACTER::IsReflect() const { if (m_pkMobInst != nullptr) return m_pkMobInst->m_IsReflect; else return false; } Oh brother, you code so badly. Fix bool CHARACTER::IsReflect() const { if (m_pkMobInst != nullptr) return m_pkMobInst->m_IsReflect; return false; } // OTHER if (IsReflector() && IsReflect()) SetReflect(false); // OTHER if (IsReflector() && GetHPPct() < 25 && !IsReflect()) SetReflect(true); Seems like he just copy/pasted what was already in the source. Also: // fuck off bool CHARACTER::IsReflect() const { return m_pkMobInst && m_pkMobInst->m_IsReflect; } Edit: Is this even used on official? I see it's mostly used for zodiac stuff, but it doesn't seem to have a column in proto for when to start reflecting. Maybe somebody that plays the official could do a test and tell us if it's used and if the percentages are in the good ball park. Edited December 25, 2024 by Amun Link to comment Share on other sites More sharing options...
Active+ Member Reached 605 Posted December 26, 2024 Author Active+ Member Share Posted December 26, 2024 14 hours ago, Amun said: Reveal hidden contents Seems like he just copy/pasted what was already in the source. Also: // fuck off bool CHARACTER::IsReflect() const { return m_pkMobInst && m_pkMobInst->m_IsReflect; } Edit: Is this even used on official? I see it's mostly used for zodiac stuff, but it doesn't seem to have a column in proto for when to start reflecting. Maybe somebody that plays the official could do a test and tell us if it's used and if the percentages are in the good ball park. Yeah, just like berserk or stoneskin. Link to comment Share on other sites More sharing options...
enisina 203 Posted December 26, 2024 Share Posted December 26, 2024 On 12/25/2024 at 7:44 PM, Amun said: Reveal hidden contents Seems like he just copy/pasted what was already in the source. Also: // fuck off bool CHARACTER::IsReflect() const { return m_pkMobInst && m_pkMobInst->m_IsReflect; } Edit: Is this even used on official? I see it's mostly used for zodiac stuff, but it doesn't seem to have a column in proto for when to start reflecting. Maybe somebody that plays the official could do a test and tell us if it's used and if the percentages are in the good ball park. I play on the official server, the boss and monsters on the yohara map use it (not all). Alastor, nethis etc. But the reflection feature is not in skill damage, where the code is put is wrong On 12/25/2024 at 7:44 PM, Amun said: Reveal hidden contents Seems like he just copy/pasted what was already in the source. Also: // fuck off bool CHARACTER::IsReflect() const { return m_pkMobInst && m_pkMobInst->m_IsReflect; } Edit: Is this even used on official? I see it's mostly used for zodiac stuff, but it doesn't seem to have a column in proto for when to start reflecting. Maybe somebody that plays the official could do a test and tell us if it's used and if the percentages are in the good ball park. Also, the feature is always active, not when health is 25% (unrelated, but why can't I use react to any message anymore?) 14 hours ago, Reached said: Yeah, just like berserk or stoneskin. I'm sorry, but I doubt you even know what you're doing. We should avoid copy/paste, know the logic of our changes and avoid unnecessary additions. //protoreader and dump_proto source/itemcsvreader Find: "REVIVE", Add Below: "REFLECT", ///// mob_proto - Add in monster AIFlag REFLECT //// //length.h Find: AIFLAG_REVIVE = (1 << 11), Add below: AIFLAG_REFLECT = (1 << 12), //char.h Find: void SetRevive(bool mode); Add Below: bool IsReflecter() const; //char_state.cpp Find: bool CHARACTER::IsReviver() const { ... } Add Below: bool CHARACTER::IsReflecter() const { return IS_SET(m_pointsInstant.dwAIFlag, AIFLAG_REFLECT); } //char_battle.cpp Find: if (GetPoint(POINT_REFLECT_MELEE)) { int reflectDamage = dam * GetPoint(POINT_REFLECT_MELEE) / 100; if (pAttacker->IsImmune(IMMUNE_REFLECT)) reflectDamage = int(reflectDamage / 3.0f + 0.5f); pAttacker->Damage(this, reflectDamage, DAMAGE_TYPE_SPECIAL); } Abb Below: if (IsMonster() && IsReflecter()) { pAttacker->Damage(this, (dam * 5 / 100), DAMAGE_TYPE_SPECIAL); } Add below: AIFLAG_REFLECT = (1 << 12), //char.h bool IsReflecter() const; //char_state.cpp bool CHARACTER::IsReflecter() const { return IS_SET(m_pointsInstant.dwAIFlag, AIFLAG_REFLECT); } //char_battle.cpp Find: if (GetPoint(POINT_REFLECT_MELEE)) { int reflectDamage = dam * GetPoint(POINT_REFLECT_MELEE) / 100; if (pAttacker->IsImmune(IMMUNE_REFLECT)) reflectDamage = int(reflectDamage / 3.0f + 0.5f); pAttacker->Damage(this, reflectDamage, DAMAGE_TYPE_SPECIAL); } Abb Below: if (IsMonster() && IsReflecter()) { pAttacker->Damage(this, (dam * 5 / 100), DAMAGE_TYPE_SPECIAL); } 1 Link to comment Share on other sites More sharing options...
Active+ Member Reached 605 Posted December 27, 2024 Author Active+ Member Share Posted December 27, 2024 23 hours ago, enisina said: Resmi sunucuda oynuyorum, yohara haritasındaki patron ve canavarlar kullanıyor (hepsi değil). Alastor, nethis vb. Ancak yansıtma özelliği beceri hasarında değil, kodun konulduğu yer yanlıştır Ayrıca, özellik her zaman aktiftir, sağlık %25 olduğunda değil (ilgisiz, ama neden artık herhangi bir mesaja tepki veremiyorum?) I'm sorry, but I doubt you even know what you're doing. We should avoid copy/paste, know the logic of our changes and avoid unnecessary additions. //protoreader and dump_proto source/itemcsvreader Find: "REVIVE", Add Below: "REFLECT", ///// mob_proto - Add in monster AIFlag REFLECT //// //length.h Find: AIFLAG_REVIVE = (1 << 11), Add below: AIFLAG_REFLECT = (1 << 12), //char.h Find: void SetRevive(bool mode); Add Below: bool IsReflecter() const; //char_state.cpp Find: bool CHARACTER::IsReviver() const { ... } Add Below: bool CHARACTER::IsReflecter() const { return IS_SET(m_pointsInstant.dwAIFlag, AIFLAG_REFLECT); } //char_battle.cpp Find: if (GetPoint(POINT_REFLECT_MELEE)) { int reflectDamage = dam * GetPoint(POINT_REFLECT_MELEE) / 100; if (pAttacker->IsImmune(IMMUNE_REFLECT)) reflectDamage = int(reflectDamage / 3.0f + 0.5f); pAttacker->Damage(this, reflectDamage, DAMAGE_TYPE_SPECIAL); } Abb Below: if (IsMonster() && IsReflecter()) { pAttacker->Damage(this, (dam * 5 / 100), DAMAGE_TYPE_SPECIAL); } Add below: AIFLAG_REFLECT = (1 << 12), //char.h bool IsReflecter() const; //char_state.cpp bool CHARACTER::IsReflecter() const { return IS_SET(m_pointsInstant.dwAIFlag, AIFLAG_REFLECT); } //char_battle.cpp Find: if (GetPoint(POINT_REFLECT_MELEE)) { int reflectDamage = dam * GetPoint(POINT_REFLECT_MELEE) / 100; if (pAttacker->IsImmune(IMMUNE_REFLECT)) reflectDamage = int(reflectDamage / 3.0f + 0.5f); pAttacker->Damage(this, reflectDamage, DAMAGE_TYPE_SPECIAL); } Abb Below: if (IsMonster() && IsReflecter()) { pAttacker->Damage(this, (dam * 5 / 100), DAMAGE_TYPE_SPECIAL); } Thank you for corrections, i'm not currently playing on Official Server so i made like this (Reflecting all damage like skill hit etc.). Link to comment Share on other sites More sharing options...
BadRomani 61 Posted December 29, 2024 Share Posted December 29, 2024 On 12/25/2024 at 9:44 PM, Amun said: Reveal hidden contents Seems like he just copy/pasted what was already in the source. Also: // fuck off bool CHARACTER::IsReflect() const { return m_pkMobInst && m_pkMobInst->m_IsReflect; } Edit: Is this even used on official? I see it's mostly used for zodiac stuff, but it doesn't seem to have a column in proto for when to start reflecting. Maybe somebody that plays the official could do a test and tell us if it's used and if the percentages are in the good ball park. Yes, it should be like this. I was going to do it like this, in a shorter and more compact way. But I preferred to use return false for people who don't know the short circuit feature. Link to comment Share on other sites More sharing options...
Recommended Posts