Conversation
zach2good
left a comment
There was a problem hiding this comment.
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
| 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.
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
| // 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.
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.