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

Add Pinecone Bomb blue magic spell. #346

Merged
merged 12 commits into from
Apr 9, 2020
65 changes: 65 additions & 0 deletions scripts/globals/spells/bluemagic/pinecone_bomb.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
-----------------------------------------
-- Spell: Pinecone Bomb
-- Additional effect: Sleep. Duration of effect varies with TP
-- Spell cost: 48 MP
-- Monster Type: Plantoids
-- Spell Type: Physical (Piercing)
-- Blue Magic Points: 2
-- Stat Bonus: STR+1
-- Level: 36
-- Casting Time: 2.5 seconds
-- Recast Time: 26.5 seconds
-- Skillchain Element(s): Fire (can open Scission or Fusion and can close Liquefaction)
-- Combos: None
-----------------------------------------
require("scripts/globals/bluemagic")
require("scripts/globals/status")
require("scripts/globals/magic")
-----------------------------------------

function onMagicCastingCheck(caster,target,spell)
return 0
end

function onSpellCast(caster,target,spell)
local params = {}
-- This data should match information on http://wiki.ffxiclopedia.org/wiki/Calculating_Blue_Magic_Damage
params.tpmod = TPMOD_CRITICAL
Copy link
Contributor

Choose a reason for hiding this comment

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

I was going to say that the TP mod for this spell doesn't seem to be critical hit chance, but then I looked at the blue magic global and it doesn't look like tpmod params are used at all.

I did some searches and found a definition for params.tpmod = TPMOD_DURATION for Battle Dance, which seems like what we should be using here (again, this param is never checked), but that specific global value doesn't seem to be defined anyway.

I'm not going to expect you to fix that fact that these mods don't seem to do anything, but could you change this to at least claim it's supposed to effect duration?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A lot of these BLU enums seems to be in bad shape. I'm happy to clean them up as needed, but need some guidance.

Would you prefer which/any of the following:

  • Remove the TPMOD param since it's unused
  • Add TPMOD_DURATION value since it's missing, and then reference it here
  • Add usage of params.tpmod in the global bluemagic.lua (if so, where)

I think the bottom two are probably the right approach, assuming this value is supposed to be used somewhere. But if we felt this value is obsolete or unnecessary, perhaps removing it until it's implemented would be less ambiguous?

Also we should probably file an issue for this problem to track these changes, which can be applied ahead of this PR as needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Filed #354 to track.

Let me know what your preferences are. I'm happy to do an audit or cleanup based on what is preferred. (Although if we want to use the parameters, I could use some pointers since I'm not that familiar with the code and have no retail FFXI)

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, the bottom two are the more time consuming, but overall the best choice. It will require a bit of rework for the Blue Magic global, which desperately needs it.

For the purpose of this PR though, go ahead and add TPMOD_DURATION to both the global and this script (matching the one for Battle Dance), and then after a separate PR hooking up the params to be used, we can work on having spells being able to make use of the mods.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds like a plan. Will update this in a commit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Commit added. Please take a look.

params.dmgtype = DMGTYPE_PIERCE
mrhappyasthma marked this conversation as resolved.
Show resolved Hide resolved
params.scattr = SC_LIQUEFACTION
params.numhits = 1
params.multiplier = 1.25
params.tp150 = 1.25
params.tp300 = 1.25
ibm2431 marked this conversation as resolved.
Show resolved Hide resolved
params.azuretp = 1.25
params.duppercap = 37
params.str_wsc = 0.20
params.dex_wsc = 0.0
params.vit_wsc = 0.0
params.agi_wsc = 0.20
params.int_wsc = 0.0
params.mnd_wsc = 0.0
params.chr_wsc = 0.0

local damage = BluePhysicalSpell(caster, target, spell, params)
damage = BlueFinalAdjustments(caster, target, spell, damage, params)

-- After damage is applied (which would have woken the target up from a
-- preexisting sleep, if necesesary), apply the sleep effect for this spell.
if (damage > 0) then
local sleepParams = {}
sleepParams.attribute = tpz.mod.INT
sleepParams.bonus = 0
sleepParams.effect = tpz.effect.SLEEP_II
sleepParams.skillType = tpz.skill.BLUE_MAGIC
local resist = applyResistanceEffect(caster, target, spell, sleepParams)
if (resist > 0.5) then -- Apply the sleep
local power = 2
local tick = 0
local duration = 90 * resist
Copy link
Contributor

Choose a reason for hiding this comment

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

Looking at the description for the spell, it claims that duration is supposed to vary depending on TP. At the moment, this is basing the duration off of attacker INT versus target resistance.

  1. Is it supposed to always be affected by TP?
  2. Is TP -> duration effect only applicable when under Chain Affinity?
  3. What's the base duration of this type of sleep? With or without Chain Affinity?
  4. What's the sleep duration at certain TP values? Minimum, maximum?

@Wiggo32 I looked at your capture of you learning Pinecone Bomb and testing it out, but there was no explicit duration testing (the sapling was auto-attacked awake, and the draugar was unaffected)

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 was my first time adding a BLU spell, so I'm open to any improvements.

I just copied how sleep was applied in other spells, so it may not be 100% accurate. If you have a reference for how this should be applied, please point me in the right direciton!

Copy link
Contributor

Choose a reason for hiding this comment

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

What we'll probably have to do is find some information - or get a capture - on the basic duration of the effect. Even if we can't fully pick apart how TP affects the duration for this (or other) Blue spells, we can at least apply the bare minimum duration for now and add a note in the script (and create a new Issue) that it's still missing duration bonuses from TP.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good.

Should I wait on someone to do a "capture"? Or should I go forward with a TODO note and reference a github issue to update the TP modification of the sleep duration?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have some captures. I'll check them out and see what I can determine. Then hopefully someone more experienced can double check me.

target:addStatusEffect(sleepParams.effect, power, tick, duration)
mrhappyasthma marked this conversation as resolved.
Show resolved Hide resolved
end
end

return damage
end