server
server copied to clipboard
[LUA] Aymur listeners to enhance sic/ready with bonus tp
I affirm:
- [x] I understand that if I do not agree to the following points by completing the checkboxes my PR will be ignored.
- [x] I understand I should leave resolving conversations to the LandSandBoat team so that reviewers won't miss what was said.
- [x] I have read and understood the Contributing Guide and the Code of Conduct.
- [x] I have tested my code and the things my code has changed since the last commit in the PR and will test after any later commits.
What does this pull request do?
A bit of trickery due to the flow of abilities with sic and ready, but a works well regardless.
Enhances "Sic" and "Ready" effect gives +500 tp immediately and 500 tp is added to the ability. This is done via a listener on the player and a listener on the pet.
Player Listener:
- gives 500 tp immediately to charmed pets upon usage of
SIC
- adds listener to pet if not already there
Pet listener:
- just before using any skill, if it's a jug pet, give 1000 TP
- if it's a charmed pet, give the remaining 500 TP
On item unequip, remove both listeners
Steps to test these changes
To test, i added prints everywhere.
Inside aymur.lua
:
- i added a print at the beginning and end of the pet's listener to confirm how much TP is being added
- Added one at each level of onItemEquip to confirm listeners were being added at the appropriate times
- finally printed ability:getID and ability:getRecastID to confirm the recastID of ready abilities (note that giving tp in player's
ABILITY_USE
is too late, as the pet readies its ability beforeABILITY_USE
is called, butABILITY_USE
is the only place in the chain you can see that the player used an ability withrecastID == 102
. This ended up being ok as the ready abilites are for jug pets, and those are perfectly fine getting the full 1000 tp in the pet's listener, but noteworthy discovery I think)
outside of all the obvious places in aymur.lua
, i added to foot_kick.lua
to print(skill:getTP())
just to confirm we were getting the tp for a jug pet actualized in the skill.
Sorry, everything should be in order now. First, i forgot to make itemObject local, then i was informed that the first aymur item doesn't have this effect. All others have identical effects though (+500 then +500 before pet skill usage)
I dont know if this is the correct approach to implement the enhancement to sic
and ready
For starters, there are multiple versions of the weapon, meaning, this approach would require having the same logic repeated in multiple files.
EDIT: Furthermore, there are other items with a similar (weaker) effect. Example:
- https://www.bg-wiki.com/ffxi/Nukumi_Manoplas
- https://www.bg-wiki.com/ffxi/Frn.Manoplas%2B1
I think the correct approach here would be to implement a modifier. 1 would suffice for both Sic and Ready. And then add some logic to sic and ready skills to account for it.
This feels like a hacky way to do it if you needed to module custom content. A mod that would be accounted for in the petskill/mobskill state to add TP on start is the way to go IMO
@Xaver-DaRed both of your examples are only giving TP_BONUS. If mobskills could be coded to respect that mod, then they could be simplified to just giving item_pet_mods.sql
entries.
This line of weapons has a unique benefit to sic
and ready
in that they give 500 TP immediately, then another 500 as a TP_BONUS. Since that mod does nothing for mobskills, I added the second listener to ws prepare.