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

ensure trust spells are level appropriate #581

Merged
merged 2 commits into from
May 7, 2020

Conversation

brianmask
Copy link
Contributor

I affirm:

  • that I agree to Project Topaz's Limited Contributor License Agreement, as written on this date
  • x[] that I've tested my code since the last commit in the PR, and will test after any later commits

Purpose of this pull request is to ensure Trust Spells are both level appropriate and pass required checks in order to cast.

In the current implementation gambits registered with the SELECT_SPECIFIC reaction modifier will be cast regardless of level, recast timer and current MP.

This pull request adds one method to mob_spell_container (GetAvailable) in the same style as (GetBestAvailable) in order to check the trust has the spell in a spell container, has the appropriate mp to cast the spell, and the spell is currently not on cooldown.

This will still allow the trust lua files to register any needed gambits without regard to the trust level or other conditions and keep the flow as simple and straight forward as possible.

If a more appropriate method already exists rather than the new method added, I'm happy to modify the PR accordingly.

@ibm2431 ibm2431 self-assigned this May 4, 2020
@brianmask brianmask changed the title ensure trust spells are level appropriate WIP: ensure trust spells are level appropriate May 4, 2020
@brianmask
Copy link
Contributor Author

going to make a few more enhancements to not load the gambit in the first place if not applicable instead of checking every time if is applicable

@brianmask brianmask changed the title WIP: ensure trust spells are level appropriate ensure trust spells are level appropriate May 5, 2020
@brianmask
Copy link
Contributor Author

modified logic slightly to check if spell is level appropriate during call to AddGambit
modified spell::CanUseSpell slightly to take in account for trust level during check
added GetAvailable to mob_spell_container to return SpellID if passed id is available and null if spell is on cooldown or trust does not have appropriate MP to cast

Copy link
Contributor

@ibm2431 ibm2431 left a comment

Choose a reason for hiding this comment

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

Thanks, brianmask!

@ibm2431 ibm2431 added the merge ready reviewed and deemed ready to merge label May 6, 2020
@zircon-tpl zircon-tpl merged commit 651b919 into project-topaz:trust May 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
merge ready reviewed and deemed ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants