Jump to content

Apply elemental on monsters


Go to solution Solved by Hunger,

Recommended Posts

  • Premium

Hello devs!
 

I am trying to set the elemental bonuses on all mobs (only the defence against certain monsters).

So, for setaou i have DEVIL,ATT_ELEC which is fine so far, but the bonus against lightning does absolutely nothing on their damage, strong against arrows still required by them.

And my question is: How the hell is this thing working after all? I see nothing about arrows in mob proto or source code for setaou monsters.

Does any of you share the same problem with me?

 

Best regards,

Cara

 

 

 

Mark as solved / closed please. I found the solution for it.

Link to comment
Share on other sites

44 minutes ago, Caramelito said:

Hello devs!
 

I am trying to set the elemental bonuses on all mobs (only the defence against certain monsters).

So, for setaou i have DEVIL,ATT_ELEC which is fine so far, but the bonus against lightning does absolutely nothing on their damage, strong against arrows still required by them.

And my question is: How the hell is this thing working after all? I see nothing about arrows in mob proto or source code for setaou monsters.

Does any of you share the same problem with me?

 

Best regards,

Cara

Hi,

I do not know if this is relevant answer, but bonus lightning, wind and maybe more bonuses, never worked..
Its old problem from official server.. I mean problem is in source, same problem is with magic attack..

For example magic attack in char_skill.cpp..

Old code:

pkSk->SetPointVar("mwep", iMtk);

New code:

pkSk->SetPointVar("mwep", iMtk + ch->GetPoint(POINT_MAGIC_ATT_GRADE_BONUS));

I mean this is your problem, why your bonuses did not working.. Idk, I dont have wind, lightning bonuses in my game.. Only magic attack..

Link to comment
Share on other sites

On 11/26/2018 at 10:39 PM, Caramelito said:

I was wondering where is the bonus "defence against arrows" required by this type of monsters in the source.

char_skill.cpp:

if (pkChrVictim->IsNPC())
		{
			if (IS_SET(m_pkSk->dwFlag, SKILL_FLAG_WIND))
			{
				iDam = iDam * (100 - pkChrVictim->GetPoint(POINT_RESIST_WIND)) / 100;
			}

			if (IS_SET(m_pkSk->dwFlag, SKILL_FLAG_ELEC))
			{
				iDam = iDam * (100 - pkChrVictim->GetPoint(POINT_RESIST_ELEC)) / 100;
			}

			if (IS_SET(m_pkSk->dwFlag, SKILL_FLAG_FIRE))
			{
				iDam = iDam * (100 - pkChrVictim->GetPoint(POINT_RESIST_FIRE)) / 100;
			}
		}

Maybe this is your problem?

battle.cpp:

if (pkVictim->IsNPC())
	{
		if (pkVictim->IsRaceFlag(RACE_FLAG_ANIMAL))
			iAtk += (iAtk * pkAttacker->GetPoint(POINT_ATTBONUS_ANIMAL)) / 100;
		else if (pkVictim->IsRaceFlag(RACE_FLAG_UNDEAD))
			iAtk += (iAtk * pkAttacker->GetPoint(POINT_ATTBONUS_UNDEAD)) / 100;
		else if (pkVictim->IsRaceFlag(RACE_FLAG_DEVIL))
			iAtk += (iAtk * pkAttacker->GetPoint(POINT_ATTBONUS_DEVIL)) / 100;
		else if (pkVictim->IsRaceFlag(RACE_FLAG_HUMAN))
			iAtk += (iAtk * pkAttacker->GetPoint(POINT_ATTBONUS_HUMAN)) / 100;
		else if (pkVictim->IsRaceFlag(RACE_FLAG_ORC))
			iAtk += (iAtk * pkAttacker->GetPoint(POINT_ATTBONUS_ORC)) / 100;
		else if (pkVictim->IsRaceFlag(RACE_FLAG_MILGYO))
			iAtk += (iAtk * pkAttacker->GetPoint(POINT_ATTBONUS_MILGYO)) / 100;
		else if (pkVictim->IsRaceFlag(RACE_FLAG_INSECT))
			iAtk += (iAtk * pkAttacker->GetPoint(POINT_ATTBONUS_INSECT)) / 100;
		else if (pkVictim->IsRaceFlag(RACE_FLAG_FIRE))
			iAtk += (iAtk * pkAttacker->GetPoint(POINT_ATTBONUS_FIRE)) / 100;
		else if (pkVictim->IsRaceFlag(RACE_FLAG_ICE))
			iAtk += (iAtk * pkAttacker->GetPoint(POINT_ATTBONUS_ICE)) / 100;
		else if (pkVictim->IsRaceFlag(RACE_FLAG_DESERT))
			iAtk += (iAtk * pkAttacker->GetPoint(POINT_ATTBONUS_DESERT)) / 100;
		else if (pkVictim->IsRaceFlag(RACE_FLAG_TREE))
			iAtk += (iAtk * pkAttacker->GetPoint(POINT_ATTBONUS_TREE)) / 100;

		iAtk += (iAtk * pkAttacker->GetPoint(POINT_ATTBONUS_MONSTER)) / 100;
	}


Edit: Maybe if you use on monster arrow_defense bonus.. Working if you use ninja -> bow??

Link to comment
Share on other sites

On 11/26/2018 at 9:39 PM, Caramelito said:

I was wondering where is the bonus "defence against arrows" required by this type of monsters in the source.

I think it simply applies to ranged attacks.

So in char_battle -> class CFuncShoot, the case 0 refers to BATTLE_TYPE_RANGE.

Here are the functions:

Spoiler

case BATTLE_TYPE_RANGE:
				FlyTarget(pkVictim->GetVID(), pkVictim->GetX(), pkVictim->GetY(), HEADER_CG_FLY_TARGETING);
				iRet = Shoot(0) ? BATTLE_DAMAGE : BATTLE_NONE;
				break;
...

bool CHARACTER::Shoot(BYTE bType)
{
	sys_log(1, "Shoot %s type %u flyTargets.size %zu", GetName(), bType, m_vec_dwFlyTargets.size());

	if (!CanMove())
	{
		return false;
	}	

	CFuncShoot f(this, bType);

	if (m_dwFlyTargetID != 0)
	{
		f(m_dwFlyTargetID);
		m_dwFlyTargetID = 0;
	}

	f = std::for_each(m_vec_dwFlyTargets.begin(), m_vec_dwFlyTargets.end(), f);
	m_vec_dwFlyTargets.clear();

	return f.m_bSucceed;
}
...

in class CFuncShoot,

...
case 0:
	int iDam = 0;
	...
	iDam = iDam * (100 - pkVictim->GetPoint(POINT_RESIST_BOW)) / 100;

 

Hope this helped.

Link to comment
Share on other sites

  • Premium
  • Solution

I have solved the problem myself, in case somebody is looking for the same thing, the resistances are applied in length.h in common folder.

Basically the official servers absolutely cancelled the defence against arrows for monsters and they replaced them with the elemental bonuses so:

You have them in length.h like this :

enum
{
	SKILL_ATTR_TYPE_NORMAL = 1,
	SKILL_ATTR_TYPE_MELEE,
	SKILL_ATTR_TYPE_RANGE,
	SKILL_ATTR_TYPE_MAGIC
		/*
		   SKILL_ATTR_TYPE_FIRE,
		   SKILL_ATTR_TYPE_ICE,
		   SKILL_ATTR_TYPE_ELEC,
		   SKILL_ATTR_TYPE_DARK,
		   */
};

And you need to comment RANGE which is the defence against arrows required by archers and enable the elemental which are commented.

enum
{
	SKILL_ATTR_TYPE_NORMAL = 1,
	SKILL_ATTR_TYPE_MELEE,
	/* SKILL_ATTR_TYPE_RANGE, */
	SKILL_ATTR_TYPE_MAGIC,
	SKILL_ATTR_TYPE_FIRE,
	SKILL_ATTR_TYPE_ICE,
	SKILL_ATTR_TYPE_ELEC,
	SKILL_ATTR_TYPE_DARK,
};

Please mind the comma after MAGIC.

 

In char skill find the case below:

			case SKILL_ATTR_TYPE_RANGE:
			dt = DAMAGE_TYPE_RANGE;
			iDam = iDam * (100 - pkChrVictim->GetPoint(POINT_RESIST_BOW)) / 100;
			break;

And comment :

iDam = iDam * (100 - pkChrVictim->GetPoint(POINT_RESIST_BOW)) / 100;

How the case should look like after:

			case SKILL_ATTR_TYPE_RANGE:
				dt = DAMAGE_TYPE_RANGE;
				// 으아아아악
				// 예전에 적용안했던 버그가 있어서 방어력 계산을 다시하면 유저가 난리남
				//iDam -= pkChrVictim->GetPoint(POINT_DEF_GRADE);
				//iDam = iDam * (100 - pkChrVictim->GetPoint(POINT_RESIST_BOW)) / 100;
				break;

Regards, Cara

Edited by Hunger
  • Love 1
Link to comment
Share on other sites

  • 1 year later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • 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.