Jump to content

Official AI Flag Reflect


Recommended Posts

  • Active+ Member

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.

 

 

  • Good 2
  • Love 1
Link to comment
Share on other sites

  • 2 weeks later...
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 by BadRomani
Link to comment
Share on other sites

  • Contributor
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 by Amun
Link to comment
Share on other sites

  • Active+ Member
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

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);
				}
				

 

  • Love 1
Link to comment
Share on other sites

  • Active+ Member
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

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

×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.