Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AMK][Lua] Cardian orb drop mechanic #4800

Merged
merged 2 commits into from
Jan 3, 2024

Conversation

Flibe-XI
Copy link
Contributor

@Flibe-XI Flibe-XI commented Dec 3, 2023

I affirm:

  • I understand that if I do not agree to the following points by completing the checkboxes my PR will be ignored.
  • I understand I should leave resolving conversations to the LandSandBoat team so that reviewers won't miss what was said.
  • I have read and understood the Contributing Guide and the Code of Conduct.
  • 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?

Adds a function to cardians in outer horutoto ruins that allows them to drop their respective key items "orb of sword/baton/coin/cup" for AMK mission 6.

Steps to test these changes

!addmission 10 5
Kill cardians in outer horutoto ruins until they cause the player to obtain their key items. If the player isn't on the right mission, or already has the orb, the orb won't drop and no error is caused.

The drop rate has very little information other than the level of the mob is involved, and the higher the level, the higher the droprate. Some sources say drop rate on lower level mobs is very poor, so the range is set it at is between 4 - 25.8%, which increases with size of the party as well.

image

@zach2good
Copy link
Contributor

Well well well, the questions from my other PR comment are answered :D

zach2good
zach2good previously approved these changes Dec 3, 2023
Copy link
Contributor

@zach2good zach2good left a comment

Choose a reason for hiding this comment

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

As a note to passers-by, another way of doing this would have been to create and apply the cardian family mixin to all these files - resulting in the same one-line-per-file change. These mobs aren't particularly special, so there's little difference in either approach. The meat is in the new helper.

-- a local var that is set once by the first player is called by onMobDeath
-- The rest of the players in alliance get the same outcome as the first
xi.amk.helpers.cardianOrbDrop = function(mob, player, orb)
if player:getCurrentMission(xi.mission.log_id.AMK) < xi.mission.id.amk.AN_ERRAND_THE_PROFESSORS_PRICE then
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 cardian dies from DoT, player will be nil - should be checking for that

end
end

-- Chance ranges from 4% to 25.8% (based on max mob lvl of 44)
Copy link
Contributor

Choose a reason for hiding this comment

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

👍


entity.onMobDeath = function(mob, player, optParams)
xi.amk.helpers.cardianOrbDrop(mob, player, xi.ki.ORB_OF_SWORDS)
xi.regime.checkRegime(player, mob, 665, 3, xi.regime.type.GROUNDS)
Copy link
Contributor

@TeoTwawki TeoTwawki Dec 3, 2023

Choose a reason for hiding this comment

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

Not seeing any regime pages that use Two of Swords
https://www.bg-wiki.com/ffxi/Grounds_of_Valor#Outer_Horutoto_Ruins

Watch what you copy and paste. Make sure the things you add actually belong in new mob scripts.

@Flibe-XI
Copy link
Contributor Author

Flibe-XI commented Dec 4, 2023

As a note to passers-by, another way of doing this would have been to create and apply the cardian family mixin to all these files - resulting in the same one-line-per-file change. These mobs aren't particularly special, so there's little difference in either approach. The meat is in the new helper.

Good to know thanks.

Also, I spoke with Xaver about possibly creating different mob_family_system ids for each type of cardian, as they are supposed to drop different crystals, but they are all the same element currently. When they are all different families, the orb can be removed as an argument and the KI's can just be mapped to the family and determined by mob:getFamily() with the helpers function. Probably not worth the effort and is fine the way it is.

@Flibe-XI Flibe-XI closed this Dec 4, 2023
@Flibe-XI Flibe-XI reopened this Dec 4, 2023
Comment on lines 61 to 63
player:getCurrentMission(xi.mission.log_id.AMK) < xi.mission.id.amk.AN_ERRAND_THE_PROFESSORS_PRICE or
player == nil or
orb == nil
Copy link
Contributor

Choose a reason for hiding this comment

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

This new change won't work, because you're checking the player's mission before you're checking if player is really there.
Lua properly has short-circuit logic, so you can just move the check for player or orb being nil before the mission check and you'll be fine.

https://www.tutorialspoint.com/execute_lua_online.php :

local player = nil

if player == nil or player:thisFunctionDoesntExist() == true then
    print("Short circuit success")
end

Prints correctly.

    if
        player == nil or
        player:getCurrentMission(xi.mission.log_id.AMK) < xi.mission.id.amk.AN_ERRAND_THE_PROFESSORS_PRICE or

You don't need to check whether or not orb is nil, because you're the one making the call and you know you've populated it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

D'oh! Understood, thanks. Will fix soon.

@zach2good
Copy link
Contributor

Don't worry about the family/crystal stuff, that's out of the scope of this PR

@@ -57,11 +57,7 @@ end
-- a local var that is set once by the first player is called by onMobDeath
-- The rest of the players in alliance get the same outcome as the first
xi.amk.helpers.cardianOrbDrop = function(mob, player, orb)
Copy link
Contributor

Choose a reason for hiding this comment

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

What are the conditions for cardians to drop this key item? Can the item drop forever if you've completed AMK? Or do they only drop during this mission and if you want repeat KIs then you have to buy them from squintox?

Either way, your most recent commit removed the mission check all together

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is what happens when I try to rush something at work. I'll focus and fix it when I get home.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image

I can't, however, find any information about whether or not the key items can drop before flagging mission 6 from shantotto.

Copy link
Contributor

Choose a reason for hiding this comment

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

Easy to go get caps on retail

Copy link
Contributor

Choose a reason for hiding this comment

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

For now, this condition seems fine: player:getCurrentMission(xi.mission.log_id.AMK) < xi.mission.id.amk.AN_ERRAND_THE_PROFESSORS_PRICE

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made a request in FFXI Captures discord. I don't have a retail account personally.

@zach2good zach2good added the squash Reminder to squash commits before/on merge (you can do this, or maintainers will do this for you) label Dec 4, 2023
@Flibe-XI Flibe-XI requested a review from TeoTwawki December 7, 2023 02:57
@zach2good zach2good merged commit 45ad07b into LandSandBoat:feature/amk_missions Jan 3, 2024
11 checks passed
zach2good pushed a commit that referenced this pull request Apr 29, 2024
* AMK6: Added mechanic to drop KI orbs for cardians

* Fixed null player check
zach2good pushed a commit that referenced this pull request May 23, 2024
* AMK6: Added mechanic to drop KI orbs for cardians

* Fixed null player check
hooksta4 pushed a commit to hooksta4/LSB_Hook_fork that referenced this pull request May 23, 2024
* AMK6: Added mechanic to drop KI orbs for cardians

* Fixed null player check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
squash Reminder to squash commits before/on merge (you can do this, or maintainers will do this for you)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants