Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pet commands flood & memory tick fail fixes #1326

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3914,3 +3914,10 @@ Added: 'H' shortcut for variables to get the value as hexadecimal.

13-10-2024, Jhobean
- Added: @PetRelease trigger work like @petdesert and return 1 to prevent the pet from being released.

26-10-2024, canerksk
- Fixed: Memory OnTick link char if not, the skill will not fail.
If the memory owner is not present, skills do not fail when taking damage, but if the memory owner is alive, skills fail when taking damage.

- Fixed: The entity was jumping frames in flooded pet commands (come, guard)

14 changes: 10 additions & 4 deletions src/game/chars/CCharNPCPet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,20 @@ bool CChar::NPC_OnHearPetCmd( lpctstr pszCmd, CChar *pSrc, bool fAllPets )
break;

case PC_GUARD_ME:
m_Act_UID = pSrc->GetUID();
Skill_Start(NPCACT_GUARD_TARG);
if ((m_Act_UID != pSrc->GetUID()) || (Skill_GetActive() != NPCACT_GUARD_TARG)) // When you do all guard flood, the mount jumps one frame.
{
m_Act_UID = pSrc->GetUID();
Skill_Start(NPCACT_GUARD_TARG);
}
break;

case PC_COME:
case PC_FOLLOW_ME:
m_Act_UID = pSrc->GetUID();
Skill_Start(NPCACT_FOLLOW_TARG);
if ((m_Act_UID != pSrc->GetUID()) || (Skill_GetActive() != NPCACT_FOLLOW_TARG)) // When you do all come flood, the mount jumps one frame.
{
m_Act_UID = pSrc->GetUID();
Skill_Start(NPCACT_FOLLOW_TARG);
}
break;

case PC_FOLLOW:
Expand Down
24 changes: 17 additions & 7 deletions src/game/chars/CCharSpell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1982,13 +1982,23 @@ bool CChar::Spell_Equip_OnTick( CItem * pItem )
iDmgType = (DAMAGE_TYPE)(ResGetIndex((dword)Args.m_VarsLocal.GetKeyNum("DamageType")));
if (iDmgType > 0 && iEffect > 0) // This is necessary if we have a spell that is harmful but does no damage periodically.
{
OnTakeDamage(iEffect, pItem->m_uidLink.CharFind(), iDmgType,
(iDmgType & (DAMAGE_HIT_BLUNT | DAMAGE_HIT_PIERCE | DAMAGE_HIT_SLASH)) ? 100 : 0,
(iDmgType & DAMAGE_FIRE) ? 100 : 0,
(iDmgType & DAMAGE_COLD) ? 100 : 0,
(iDmgType & DAMAGE_POISON) ? 100 : 0,
(iDmgType & DAMAGE_ENERGY) ? 100 : 0,
spell);
//
CChar *pLinkedChar = pItem->m_uidLink.CharFind();
if (pLinkedChar == nullptr)
{
// pLinkedChar = this; // If it is not alive or deleted, should it be like it is self-damaging? Note: Under the OnTakeDamage()
Skill_Fail(); // If the memory does not belong to a creature, or if the creature is dead or deleted, skills do not take effect on damage taken.
}

OnTakeDamage(iEffect,
pLinkedChar,
iDmgType,
(iDmgType & (DAMAGE_HIT_BLUNT | DAMAGE_HIT_PIERCE | DAMAGE_HIT_SLASH)) ? 100 : 0,
(iDmgType & DAMAGE_FIRE) ? 100 : 0,
(iDmgType & DAMAGE_COLD) ? 100 : 0,
(iDmgType & DAMAGE_POISON) ? 100 : 0,
(iDmgType & DAMAGE_ENERGY) ? 100 : 0,
spell);
}
}
else if (pSpellDef->IsSpellType(SPELLFLAG_HEAL))
Expand Down