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

Mobs engage player by casting a spell (if any present) despite of job #1479

Open
2 tasks done
MarianArlt opened this issue Nov 5, 2020 · 5 comments
Open
2 tasks done

Comments

@MarianArlt
Copy link
Contributor

MarianArlt commented Nov 5, 2020

I have:

  • searched existing issues (http://project-topaz.com/issues/) to see if the issue has already been opened
  • checked the commit log to see if the issue has been resolved since my server was last updated

If a monster has a spell list and mp > 0 it will currently always instantly cast a spell when engaging its target despite of its job.
This is clearly a bug as CMobController::Engage() even explicitly creates an exception for jobs that have a value set in MOBMOD_MAGIC_DELAY (note the comment!):

bool CMobController::Engage(uint16 targid)
{
TracyZoneScoped;
auto ret = CController::Engage(targid);
if (ret)
{
m_firstSpell = true;
// Don't cast magic or use special ability right away
if(PMob->getBigMobMod(MOBMOD_MAGIC_DELAY) != 0)
{
m_LastMagicTime = m_Tick - std::chrono::milliseconds(PMob->getBigMobMod(MOBMOD_MAGIC_COOL) + tpzrand::GetRandomNumber(PMob->getBigMobMod(MOBMOD_MAGIC_DELAY)));
}
if(PMob->getBigMobMod(MOBMOD_SPECIAL_DELAY) != 0)
{
m_LastSpecialTime = m_Tick - std::chrono::milliseconds(PMob->getBigMobMod(MOBMOD_SPECIAL_COOL) + tpzrand::GetRandomNumber(PMob->getBigMobMod(MOBMOD_SPECIAL_DELAY)));
}
}
return ret;
}

The offending line here is Line 982 where MAGIC_COOL and a random number up to MAGIC_DELAY get both multiplied by 1000, then added and the sum subtracted as milliseconds from m_Tick.

The multiplier of 1000 from getBigModMod() simply seems to make this result too small for the comparison with m_LastMagicTime later in CMobController::IsSpellReady()

I confirmed this by messing around with this value and simply calling with getMobMod() instead and manually multiplying you can manually increase/decrease the after-engage-cast-timeout for jobs that have MAGIC_DELAY set. This also applies for the special ability check.

It may be questioned how big this timeout should be to be retail accurate, to be able to re-write this formula.

Additional Information (Steps to reproduce/Expected behavior) :

  • Engage any mob that is not BLM/SMN/BLU/SCH/GEO/RUN, has spells and mp, and observe first action made.
    It will always be a cast.
  • Only those jobs with MAGIC_DELAY unset should be able to behave this way.

(On a side note, this could be questioned to only be the case while out of melee range anyways, after seeing the recently captured video on Kuftal Worm (BLM) behavior)

@TeoTwawki
Copy link
Contributor

TeoTwawki commented Nov 5, 2020

its probably worth re-confirming retail behaviors for mobs that cast. tehre were some changes over the years to when a mob chooses to hang back or close for melee, and we need to consider DRK and PLD along with RUN for our "melee casters". IIRC PLD Orcs will open with a cast and them immediately close for melee. I can't think of any RUN mob I can easily check.

The bug may have unintentionally been giving retail accurate behavior..

@MarianArlt
Copy link
Contributor Author

MarianArlt commented Nov 6, 2020

I watched a lot of different captures from the capture Discord and made a spread sheet anybody can comment on
(see page 3 "capture observations")

I believe to see the following:
(my observations only! nothing definitive! would be good to have more observations)
(I watched 24 captures for this and got tired for the moment. Some jobs were not observed at all)

• BLM seems to depend on the family:
⠀└ Aura Pots would always open with a cast.
⠀└ Worms would open with cast only if target was out of range (maybe the "range" is simply very small? model size!)
⠀└ a popped WAR/BLM NM (huge model) opened casting, another popped BLM main NM (rather large model) would not

• RDM seemed to behave mostly like worms but I've seen exceptions (summoned by NM and in range, opened with cast)
• DRK opened with cast, always...
• SMN never opened with cast
• WHM seemed to open with cast exclusively to buff up, otherwise (and mostly) wouldn't
• PLD seemed like WHM, but I only saw Ouryu and Jailer of Fortitude.
⠀└ The former would always open with a buff but since it's a BCNM he cannot cast while idle
⠀└ The latter did not, in fact, JoF did not buff up at all

• I did not observe BRD/NIN/BLU/GEO/RUN/SCH mobs
• I feel like defensive magic jobs like PLD and WHM would only open with a cast if they're not on roaming cooldown (that much is obvious) and recently lost a buff
• RDM seemed to be pretty consistent in behaving like worms despite family

More observations are welcome.

@TeoTwawki
Copy link
Contributor

I have some I am in the process of documentation. I'll post back later with the details. So far most everything that can cast or ranged attack opens with those unless player is already in melee range at the start. NMs break the "rules" and do whatever. A few mobs seems to heavily favor specific spells to open with.

a popped WAR/BLM NM (huge model) opened casting, another popped BLM main NM (rather large model) would not

which mobs were these specifically? I don't trust what wiki says for the jobs - wiki jobs are generally conjecture based on observed abilities a mob has

@MarianArlt
Copy link
Contributor Author

Awesome Teo. Thank you for the shared interest. Sure wikis only estimate, actually in my sheet I was about to put "supposed retail job" but that would've simply been to long a line.
If you wanna double check I was talking of Apademak and Jailer of Faith.

@TeoTwawki
Copy link
Contributor

TeoTwawki commented Nov 16, 2020

K so both Apademek and Jailer of Faith are NMs, as mentions NMs don't always follow regular mob rules. For jobs I trust anything from Jimmayus' spreadsheet says over either wiki if they disagree. Lets hope they don't lol.

Below are my own observations.

All of the below are observations of mobs that had full HP. Behaviors changes when mob is weakened

Magic casting mob checks

Closes for melee before casting anything/will prioritize swinging over castings:

  • Desert worm will not cast till I walk out of melee range
  • pending

Opens with an immediate cast even if I am within melee range, does not close for melee until below 75% hp, spell chosen seems random:

  • Tunnel Worm, contrary to the desert worm above. Will check more types of Worm.
  • Orcish Mesmerizer
  • Orcish Neckchopper (drain, bio, poison, stone)
  • Orcish Cursemaker
  • Bogy
  • Goblin Leecher
  • Goblin Shaman
  • Goblin weaver
  • Yagudo Scribe
  • Yagodo Accolyte
  • magicked bones (scythe)
  • Sprinkler (Ru'Aun Gardens - it opened with blaze spikes, Burst, Bio II..)
  • Aura Pot (shrine of Ru'Avitau - it opened with Blind, Burn,)
  • pending

Opens with an immediate cast even if I am within melee range, will close for melee immediately after initial cast, spell chosen seems random:

  • Orcish Trooper
  • pending

Have more to add, not done yet. Also checking mobs that do ranged attacks to see if they always fire off an arrow/bolt/whatever immediately, if they will stay back, or if they will run up and point blank you between swings. I recall some behavior in regards to standing back was changed in the past, so I'm making sure what the game does in the present day for both mages and ranged attackers. Have not delved into hp percent or time based changes in behaviors -yet- I have used Dia to gradually lower mob HP. So far, every one I have checked will close for melee either immediately or after falling below the 75% p bar mark.

Ranged attack mob checks

Stands back and shoots:

  • Orcish Stonechucker - closed for melee below 75% (used dia to lower it gradually)
  • pending

Closes for melee, shoots between melee swings:

  • pending

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants