-
Notifications
You must be signed in to change notification settings - Fork 549
Tredecim Scythe #6424
base: master
Are you sure you want to change the base?
Tredecim Scythe #6424
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting find! If you need an example of how to transition this from hard-coded items into mods, I had to do exactly the same thing a while ago here:
https://github.com/DarkstarProject/darkstar/pull/5866/files
@@ -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) |
There was a problem hiding this comment.
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
@@ -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) |
There was a problem hiding this comment.
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);
this is the only item in the game that tracks x hits. if you want to generalize it then you have to set up a memory system so that every item with the mod will remember its own hit counter and not interfere with another item's hit counter. it's an unnecessary amount of work to generalize it if it's the only item that will ever use the latent. |
I wonder if it's worth adding a new member to |
the 13th hit guaranteed critical is not coded yet so here it is. wiki says it shouldnt count WS hits and this code follows that, this is just for autoattacks. wiki says it should save hit count when zoning but that will require adding an extra field within the database and i didn't want to clutter the database more to add "cross-zone memory" just seems unimportant. upon zoning the count is just set to 0.