Skip to content
This repository has been archived by the owner on Apr 29, 2020. It is now read-only.

Tredecim Scythe #6424

Open
wants to merge 3 commits into
base: master
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
15 changes: 14 additions & 1 deletion src/map/entities/battleentity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1426,6 +1426,12 @@ bool CBattleEntity::OnAttack(CAttackState& state, action_t& action)
actionList_t& list = action.getNewActionList();

list.ActionTargetID = PTarget->id;

bool tredecim = false;
if (this->objtype == TYPE_PC && (((CCharEntity*)this)->getEquip(SLOT_MAIN))->getID() == 18052)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not good to hard code specific item IDs in the core, it would be much better to handle this with an item mod

{
tredecim = true;
}

/////////////////////////////////////////////////////////////////////////
// Start of the attack loop.
Expand All @@ -1435,6 +1441,9 @@ bool CBattleEntity::OnAttack(CAttackState& state, action_t& action)
actionTarget_t& actionTarget = list.getNewActionTarget();
// Reference to the current swing.
CAttack& attack = attackRound.GetCurrentAttack();

if (tredecim)
(((CCharEntity*)this)->m_hitCounter)++;

// Set the swing animation.
actionTarget.animation = attack.GetAnimationID();
Expand Down Expand Up @@ -1514,7 +1523,11 @@ bool CBattleEntity::OnAttack(CAttackState& state, action_t& action)
{
// Set this attack's critical flag.
attack.SetCritical(dsprand::GetRandomNumber(100) < battleutils::GetCritHitRate(this, PTarget, !attack.IsFirstSwing()));

if (tredecim && ((CCharEntity*)this)->m_hitCounter > 12)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the mod was CRIT_ON_HIT_X, you could do:

if (hasMod(CRIT_ON_HIT_X))
    (((CCharEntity*)this)->m_hitCounter)++;

...

if (hasMod(CRIT_ON_HIT_X) && counter % modValue == 0)
    ((CCharEntity*)this)->m_hitCounter = 0;
	 attack.SetCritical(true);

{
((CCharEntity*)this)->m_hitCounter = 0;
attack.SetCritical(true);
}
// Critical hit.
if (attack.IsCritical())
{
Expand Down
2 changes: 2 additions & 0 deletions src/map/entities/charentity.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@ class CCharEntity : public CBattleEntity
bool m_mentorUnlocked;
uint32 m_moghouseID;
uint16 m_moghancementID;

uint8 m_hitCounter; // auto-attack it counter for Tredecim Scythe

int8 getShieldSize();

Expand Down
2 changes: 2 additions & 0 deletions src/map/utils/charutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,8 @@ namespace charutils
memcpy(&PChar->teleport.survival, buf, (length > sizeof(PChar->teleport.survival) ? sizeof(PChar->teleport.survival) : length));
}

PChar->m_hitCounter = 0;

PChar->PMeritPoints = new CMeritPoints(PChar);
PChar->PMeritPoints->SetMeritPoints(meritPoints);
PChar->PMeritPoints->SetLimitPoints(limitPoints);
Expand Down