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
Merged
1 change: 1 addition & 0 deletions scripts/globals/bluemagic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ TPMOD_CRITICAL = 1
TPMOD_DAMAGE = 2
TPMOD_ACC = 3
TPMOD_ATTACK = 4
TPMOD_DURATION = 5

-- The SC the spell makes
SC_IMPACTION = 0
Expand Down
67 changes: 67 additions & 0 deletions scripts/globals/spells/bluemagic/pinecone_bomb.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
-----------------------------------------
-- 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 inverseBellRand(min, max, weight)
if not weight then weight = 0.5 end
local mid = math.floor((max - min) / 2)
local rand = math.floor(mid * math.pow(math.random(), weight))
if math.random() < 0.5 then
return min + mid - rand
else
return min + mid + rand
end
end

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_DURATION
params.attackType = tpz.attackType.RANGED
params.damageType = tpz.damageType.PIERCING
params.scattr = SC_LIQUEFACTION
params.numhits = 1
params.multiplier = 2.25
params.tp150 = 2.25
params.tp300 = 2.25
params.azuretp = 2.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 duration = inverseBellRand(15, 60, 0.3)
target:addStatusEffect(tpz.effect.SLEEP_II, 2, 0, duration)
end

return damage
end