static void LoadDelayedBlastFireball() { // Note: this was reworked a bit. It does not spawn an item. // The original version did use an item, and it worked (the code is still in ExperimentalSpells). // // But this version has nicer UX, IMO: you get the AOE targeting circle, and you can see the // buff tick down, and the projectile is fired later from the caster's position, which looks neat. // And it doesn't spawn the loot bag. I'm more confident it'll work correctly with saves and such. var fireball = library.Get <BlueprintAbility>("2d81362af43aeac4387a3d4fced489c3"); var spell = Helpers.CreateAbility("DelayedBlastFireball", "Delayed Blast Fireball", "This spell functions like fireball, except that it is more powerful and can detonate up to 5 rounds after the spell is cast. The burst of flame deals 1d6 points of fire damage per caster level (maximum 20d6). " + "The glowing bead created by delayed blast fireball can detonate immediately if you desire, or you can choose to delay the burst for as many as 5 rounds. " + "You select the amount of delay upon completing the spell.", //", and that time cannot change once it has been set unless someone touches the bead. If you choose a delay, the glowing bead sits at its destination until it detonates. " + //"A creature can pick up and hurl the bead as a thrown weapon (range increment 10 feet). If a creature handles and moves the bead within 1 round of its detonation, there is a 25% chance that the bead detonates while being handled.", "dfe891561c4d48ed8235268b0e7692e7", fireball.Icon, AbilityType.Spell, CommandType.Standard, fireball.Range, "5 rounds or less; see text", fireball.LocalizedSavingThrow); spell.SpellResistance = true; spell.EffectOnAlly = AbilityEffectOnUnit.Harmful; spell.EffectOnEnemy = AbilityEffectOnUnit.Harmful; spell.AvailableMetamagic = Metamagic.Empower | Metamagic.Heighten | Metamagic.Maximize | Metamagic.Quicken | Metamagic.Reach; var delayIds = new String[] { "1e403a3188214a5c94ad63ede5928f81", "2b6efa3759d842f7a549b85712784ee2", "d762acc02c71446b834723ac20eb722a", "2ca70c4525574cba8661beaef0a6b35f", "45f6b2f4c3ce424d98d269548691d6bc", "c1b683e809c348428011f0ed2e9da67b", }; var spell0 = library.CopyAndAdd(fireball, $"{spell.name}Delay0", delayIds[0]); spell0.SetNameDescriptionIcon(spell); spell0.ReplaceContextRankConfig(c => { Helpers.SetField(c, "m_UseMax", false); Helpers.SetField(c, "m_Max", 20); }); spell0.SpellResistance = true; var buff = Helpers.CreateBuff($"{spell.name}Buff", spell.Name, spell.Description, "fc9490e3a7d24723a017609397521ea1", spell.Icon, null, Helpers.CreateAddFactContextActions( deactivated: ActionCastSpellWithOriginalParams.Create(spell0))); buff.Stacking = StackingType.Stack; delayedBlastFireballBuff = buff; var variants = new List <BlueprintAbility> { spell0 }; for (int delay = 1; delay <= 5; delay++) { var delaySpell = library.CopyAndAdd(spell0, $"{spell.name}Delay{delay}", delayIds[delay]); delaySpell.SetName($"{spell.Name} ({delay} rounds)"); delaySpell.SetComponents( spell0.GetComponent <SpellComponent>(), FakeTargetsAround.Create(20.Feet(), toCaster: true), Helpers.CreateRunActions( Helpers.CreateApplyBuff(buff, Helpers.CreateContextDuration(delay), fromSpell: true, dispellable: false, toCaster: true))); variants.Add(delaySpell); } spell.SetComponents( Helpers.CreateSpellComponent(fireball.School), Helpers.CreateSpellDescriptor(fireball.SpellDescriptor), spell.CreateAbilityVariants(variants)); spell.AddToSpellList(Helpers.wizardSpellList, 7); Helpers.AddSpellAndScroll(spell, "5b172c2c3e356eb43ba5a8f8008a8a5a", 1); // scroll of fireball delayedBlastFireball = spell; }
static void LoadDelayedBlastFireball() { // Note: this was reworked a bit. It does not spawn an item. // The original version did use an item, and it worked (the code is still in ExperimentalSpells). // // But this version has nicer UX, IMO: you get the AOE targeting circle, and you can see the // buff tick down, and the projectile is fired later from the caster's position, which looks neat. // And it doesn't spawn the loot bag. I'm more confident it'll work correctly with saves and such. var fireball = library.Get <BlueprintAbility>("2d81362af43aeac4387a3d4fced489c3"); var spell = Helpers.CreateAbility("DelayedBlastFireball", Main.lc.GetTranslate("FireSpells.spDelayedFireballName"), Main.lc.GetTranslate("FireSpells.spDelayedFireballDesc"), "dfe891561c4d48ed8235268b0e7692e7", fireball.Icon, AbilityType.Spell, CommandType.Standard, fireball.Range, "5 rounds or less; see text", fireball.LocalizedSavingThrow); spell.SpellResistance = true; spell.EffectOnAlly = AbilityEffectOnUnit.Harmful; spell.EffectOnEnemy = AbilityEffectOnUnit.Harmful; spell.AvailableMetamagic = Metamagic.Empower | Metamagic.Heighten | Metamagic.Maximize | Metamagic.Quicken | Metamagic.Reach; var delayIds = new String[] { "1e403a3188214a5c94ad63ede5928f81", "2b6efa3759d842f7a549b85712784ee2", "d762acc02c71446b834723ac20eb722a", "2ca70c4525574cba8661beaef0a6b35f", "45f6b2f4c3ce424d98d269548691d6bc", "c1b683e809c348428011f0ed2e9da67b", }; var spell0 = library.CopyAndAdd(fireball, $"{spell.name}Delay0", delayIds[0]); spell0.SetNameDescriptionIcon(spell); spell0.ReplaceContextRankConfig(c => { Helpers.SetField(c, "m_UseMax", false); Helpers.SetField(c, "m_Max", 20); }); spell0.SpellResistance = true; var buff = Helpers.CreateBuff($"{spell.name}Buff", spell.Name, spell.Description, "fc9490e3a7d24723a017609397521ea1", spell.Icon, null, Helpers.CreateAddFactContextActions( deactivated: ActionCastSpellWithOriginalParams.Create(spell0))); buff.Stacking = StackingType.Stack; delayedBlastFireballBuff = buff; var variants = new List <BlueprintAbility> { spell0 }; for (int delay = 1; delay <= 5; delay++) { var delaySpell = library.CopyAndAdd(spell0, $"{spell.name}Delay{delay}", delayIds[delay]); delaySpell.SetName($"{spell.Name} ({delay} rounds)"); delaySpell.SetComponents( spell0.GetComponent <SpellComponent>(), FakeTargetsAround.Create(20.Feet(), toCaster: true), Helpers.CreateRunActions( Helpers.CreateApplyBuff(buff, Helpers.CreateContextDuration(delay), fromSpell: true, dispellable: false, toCaster: true))); variants.Add(delaySpell); } spell.SetComponents( Helpers.CreateSpellComponent(fireball.School), Helpers.CreateSpellDescriptor(fireball.SpellDescriptor), spell.CreateAbilityVariants(variants)); spell.AddToSpellList(Helpers.wizardSpellList, 7); Helpers.AddSpellAndScroll(spell, "5b172c2c3e356eb43ba5a8f8008a8a5a", 1); // scroll of fireball delayedBlastFireball = spell; }