Skip to content

Commit

Permalink
Merge pull request #1326 from canerksk/mini-fixes
Browse files Browse the repository at this point in the history
pet commands flood & memory tick fail fixes
  • Loading branch information
raydienull authored Dec 2, 2024
2 parents 909fd6a + e04b8c3 commit e488b8a
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 15 deletions.
11 changes: 10 additions & 1 deletion Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3915,6 +3915,16 @@ 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)

08-11-2024
- Fixed: ITEMMEMORYEQUIP is not triggered in many default memories.
Previously, many memories did not have morex information, but now for some reason many memories have morex information and for this reason the trigger was not triggered in almost most of the memories, the morex query was removed. Also, the slang did not represent the memory item.

27-11-2024, canerksk
- Added: All skills that have a distance query have been adjusted to take the RANGE values ​​of that skill.
All skills to be used in RANGE;
Expand All @@ -3934,4 +3944,3 @@ Added: 'H' shortcut for variables to get the value as hexadecimal.
- Added: Added NOREJOIN tag for corpses, If the NOREJOIN tag is one, the player cannot come back to life on that corpse. That is, the player comes back to life but not on the corpse.
This tag does not prevent the player from coming back to life, it just prevents them from respawning on that corpse. The player always comes back to life, but not on that corpse.
- Fixed: If you are around an entity that you own and you are trying to open a bank next to a bank, the "bank" command is perceived as a pet command and the bank does not open. There is no problem when you type "bank" after mounting the mount, but "bank" does not work when you dismount. (Issue #1331)

9 changes: 6 additions & 3 deletions src/game/chars/CCharAct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,14 @@ void CChar::LayerAdd( CItem * pItem, LAYER_TYPE layer )
return;
}

if (!pItem->IsTypeSpellable() && !pItem->m_itSpell.m_spell && !pItem->IsType(IT_WAND)) // can this item have a spell effect ? If so we do not send
{
//if (!pItem->IsTypeSpellable() && !pItem->m_itSpell.m_spell && !pItem->IsType(IT_WAND)) // can this item have a spell effect ? If so we do not send
// Since most of the memories came with a morex information by default, almost no memory was triggered.
if (!(pItem->IsTypeSpellable() || pItem->IsType(IT_WAND)))
{
if ((IsTrigUsed(TRIGGER_MEMORYEQUIP)) || (IsTrigUsed(TRIGGER_ITEMMEMORYEQUIP)))
{
CScriptTriggerArgs pArgs;
//CScriptTriggerArgs pArgs;
CScriptTriggerArgs pArgs(pItem); // added "argo" argument
pArgs.m_iN1 = layer;
if (pItem->OnTrigger(ITRIG_MemoryEquip, this, &pArgs) == TRIGRET_RET_TRUE)
{
Expand Down
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

0 comments on commit e488b8a

Please sign in to comment.