Skip to content

Commit

Permalink
1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
NellsRelo committed Nov 8, 2023
1 parent e5532cf commit c9c948d
Show file tree
Hide file tree
Showing 6 changed files with 126 additions and 34 deletions.
18 changes: 17 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,23 @@ Volothamp Geddarm is timeless. Literally. After the Spellplague, Mystra and Elmi

Mechanically speaking, if Volo dies, **anyone** who casts a spell will be inflicted with a variation of Wild Magic, which will proc 100% of the time. This mod is compatible with mods that add to the Wild Magic table, and is best enjoyed with as many possibilities as possible.

In the future, additional surprise effects may happen as well.
In addition, you have a high chance of one of the following occurring:

- The damage type for a spell that deals damage may permanently change (not reflected in tooltip)
- Money (between 1 and 1000) appears in your bag
- Money (up to 100) is removed from your bag
- Your turn immediately ends
- Your equipped item is unequipped
- You are affected by a Random Status
- A Random Projectile spell fires upon you
- An Random Explosion occurs, centered on you
- Your character immediately dies
- All your cooldowns are reset
- A Random Surface is created under your feet
- A Random Pool Surface is created under your feet
- Your Tadpole Powers are lost
- You forget the spell you cast
- All your summons are dispelled

## Installation
This mod works with [Baldur's Gate 3 Mod Manager](https://github.com/LaughingLeader/BG3ModManager), and possibly Vortex and Manual Installations. BG3 Mod Managers is by far the simplest method, and as such is recommended one.
Expand Down
26 changes: 20 additions & 6 deletions ToppleTheWeave/Mods/ToppleTheWeave/ScriptExtender/Lua/Globals.lua
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
Globals.volo = "S_GLO_Volo_2af25a85-5b9a-4794-85d3-0bd4c4d262fa"
Globals.UnstableWeaveTable = {}
Globals.Vars = Ext.Vars.GetModVariables(ToppleTheWeave.UUID)
-- Globals.Vars = Ext.Vars.GetModVariables(ToppleTheWeave.UUID)

Ext.Vars.RegisterModVariable(ToppleTheWeave.UUID, "IsVoloDead", {
Server = true, Client = false, SyncToClient = false
})
--Ext.Vars.RegisterModVariable(ToppleTheWeave.UUID, "IsVoloDead", {
-- Server = true, Client = false, SyncToClient = false
--})

Globals.Projectiles = {}
Globals.Puddles = {}
Globals.Explosions = {}
Globals.Statuses = {}
Globals.DamageTypes = {}

table.insert(Globals.Projectiles, "Projectile_Fireball")
table.insert(Globals.Projectiles, "Projectile_FingerOfDeath_Apostle")
Expand Down Expand Up @@ -44,6 +44,7 @@ table.insert(Globals.Projectiles, "Projectile_ScorchingRay_4")
table.insert(Globals.Projectiles, "Projectile_ArrowOfAntimagic")
table.insert(Globals.Projectiles, "Projectile_Fireball")
table.insert(Globals.Projectiles, "Projectile_Fireball_4")

table.insert(Globals.Puddles, "PotionHealingSupremeCloud")
table.insert(Globals.Puddles, "DarknessCloud")
table.insert(Globals.Puddles, "PotionHealingSuperiorCloud")
Expand Down Expand Up @@ -114,6 +115,7 @@ table.insert(Globals.Puddles, "PotionResistancePoisonCloud")
table.insert(Globals.Puddles, "CausticBrine")
table.insert(Globals.Puddles, "BlackTentacles")
table.insert(Globals.Puddles, "BlackRain")

table.insert(Globals.Explosions, "Projectile_MAG_ChargedLightning_EnsnaringShock_Explosion")
table.insert(Globals.Explosions, "Projectile_UND_Runepowder_Barrel_Explosion")
table.insert(Globals.Explosions, "Projectile_UND_Runepowder_Vial_Explosion")
Expand Down Expand Up @@ -148,6 +150,7 @@ table.insert(Globals.Explosions, "Projectile_WildMagic_Heal_4")
table.insert(Globals.Explosions, "Projectile_WildMagic_Heal_3")
table.insert(Globals.Explosions, "Projectile_ClarifiedMortality")
table.insert(Globals.Explosions, "Projectile_MagicAllergy_Unstable")

table.insert(Globals.Statuses, "TAD_DISPLACER_BEAST")
table.insert(Globals.Statuses, "POLYMORPH_SHEEP")
table.insert(Globals.Statuses, "WILDSHAPE_SABERTOOTH_TIGER_PLAYER")
Expand Down Expand Up @@ -289,4 +292,15 @@ table.insert(Globals.Statuses, "THAUMATURGY")
table.insert(Globals.Statuses, "TIDES_OF_CHAOS")
table.insert(Globals.Statuses, "BIBBERBANG_FUMES")
table.insert(Globals.Statuses, "TIMMASK_SPORES")
table.insert(Globals.Statuses, "TONGUE_OF_MADNESS")
table.insert(Globals.Statuses, "TONGUE_OF_MADNESS")

table.insert(Globals.DamageTypes, "Force")
table.insert(Globals.DamageTypes, "Fire")
table.insert(Globals.DamageTypes, "Necrotic")
table.insert(Globals.DamageTypes, "Cold")
table.insert(Globals.DamageTypes, "Thunder")
table.insert(Globals.DamageTypes, "Acid")
table.insert(Globals.DamageTypes, "Poison")
table.insert(Globals.DamageTypes, "Radiant")
table.insert(Globals.DamageTypes, "Psychic")
table.insert(Globals.DamageTypes, "Lightning")
91 changes: 67 additions & 24 deletions ToppleTheWeave/Mods/ToppleTheWeave/ScriptExtender/Lua/Logic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,47 +8,79 @@ end
function DestabilizingWeave(caster, spell)
local IsVolatile = Ext.Math.Random(0, 4)
if IsVolatile == 1 then
local effectIdx = Ext.math.Random(0, 120)
_P("Volatile effect! Rolling a " .. effectIdx)
if effectIdx <= 5 then Osi.RemoveSpell(caster, spell) end
Osi.ShowNotification(caster, Strings.MSG_VOLATILE_FORCE)
local effectIdx = Ext.Math.Random(0, 120)
if effectIdx <= 5 then
Osi.RemoveSpell(caster, spell)
Osi.ShowNotification(caster, Strings.MSG_UNLEARN_SPELL)
end
if effectIdx > 5 and effectIdx <= 15 then
Osi.CreateProjectileStrikeAt(caster,
Globals.Projectiles[Ext.Math.Random(1, #Globals.Projectiles)])
Osi.ShowNotification(caster, Strings.MSG_UNLEASHED_PROJECTILE)
end
if effectIdx > 15 and effectIdx <= 25 then
Osi.CreateExplosionAt(caster,
Osi.CreateExplosion(caster,
Globals.Explosions[Ext.Math.Random(1, #Globals.Explosions)], Ext.Math.Random(1, 6))
Osi.ShowNotification(caster, Strings.MSG_EXPLOSION)
end
if effectIdx > 25 and effectIdx <= 35 then
Osi.ApplyStatus(caster,
Globals.Statuses[Ext.Math.Random(1, #Globals.Statuses)], Ext.Math.Random(1, 8))
Osi.ShowNotification(caster, Strings.MSG_STATUS)
end
if effectIdx > 35 and effectIdx <= 45 then
Osi.RemoveSummons(caster, 0)
Osi.ShowNotification(caster, Strings.MSG_DESUMMON)
end
if effectIdx > 45 and effectIdx <= 50 then
Osi.ResetCooldowns(caster)
Osi.ShowNotification(caster, Strings.MSG_RESET_COOLDOWN)
end
if effectIdx > 35 and effectIdx <= 45 then Osi.RemoveSummons(caster, 0) end
if effectIdx > 45 and effectIdx <= 50 then Osi.ResetCooldowns(caster) end
if effectIdx > 50 and effectIdx <= 60 then Osi.Unequip(caster, Osi.GetEquippedWeapon(caster)) end
if effectIdx > 60 and effectIdx <= 70 then
Osi.CreatePuddle(caster,
Globals.Puddles[Ext.Math.Random(1, #Globals.Puddles)], Ext.Math.Random(0, 4), Ext.Math.Random(4, 12),
Ext.Math.Random(0, 4), Ext.Math.Random(0, 4), Ext.Math.Random(0, 30), Ext.Math.Random(0, 10000))
-- if effectIdx > 50 and effectIdx <= 60 then
-- Osi.Unequip(caster, Osi.GetEquippedWeapon(caster))
-- Osi.ShowNotification(caster, Strings.MSG_UNEQUIP)
-- end
if effectIdx > 50 and effectIdx <= 70 then
local puddle = Globals.Puddles[Ext.Math.Random(1, #Globals.Puddles)]
Osi.CreatePuddle(caster, puddle, Ext.Math.Random(0, 4), Ext.Math.Random(4, 12),
Ext.Math.Random(0, 4), Ext.Math.Random(4, 30), Ext.Math.Random(0, 10000))
Osi.ShowNotification(caster, Strings.MSG_CREATE_PUDDLE)
end
if effectIdx > 70 and effectIdx <= 80 then
Osi.CreateSurface(caster,
Globals.Puddles[Ext.Math.Random(1, #Globals.Puddles)], Ext.Math.Random(0, 4), Ext.Math.Random(4, 12),
Ext.Math.Random(0, 4), Ext.Math.Random(4, 12), Ext.Math.Random(0, 100))
local surface = Globals.Puddles[Ext.Math.Random(1, #Globals.Puddles)]
Osi.CreateSurface(caster, surface, Ext.Math.Random(0, 4), Ext.Math.Random(4, 12))
Osi.ShowNotification(caster, Strings.MSG_CREATE_SURFACE)
end
if effectIdx > 80 and effectIdx <= 85 then
Osi.EndTurn(caster)
Osi.ShowNotification(caster, Strings.MSG_END_TURN)
end
if effectIdx > 85 and effectIdx <= 85 then
local moneyModifier = Ext.Math.Random(-100, 1000)
if moneyModifier > 0 then
Osi.ShowNotification(caster, Strings.MSG_GAINED_MONEY)
elseif moneyModifier == 0 then
Osi.ShowNotification(caster, Strings.MSG_NO_MONEY)
else
Osi.ShowNotification(caster, Strings.MSG_LOST_MONEY)
end
Osi.PartyAddGold(caster, moneyModifier)
end
if effectIdx > 115 and effectIdx <= 119 then
Osi.ShowNotification(caster, Strings.MSG_REMOVE_TADPOLE)
Osi.RemoveAllTadpolePowers(caster)
end
if effectIdx == 120 then
Osi.ShowNotification(caster, Strings.MSG_YOU_DIED)
Osi.Die(caster)
end
if effectIdx > 80 and effectIdx <= 85 then Osi.EndTurn(caster) end
if effectIdx > 85 and effectIdx <= 85 then Osi.PartyAddGold(caster, Ext.Math.Random(-100, 1000)) end
if effectIdx > 115 and effectIdx <= 119 then Osi.RemoveAllTadpolePowers(caster) end
if effectIdx == 120 then Osi.Die(caster) end
end
end

function OnSessionLoaded()
Ext.Vars.RegisterModVariable(ToppleTheWeave.UUID, "IsVoloDead", {
Server = false, Client = false, SyncToClient = true
})
Utils.Info(Strings.INFO_MOD_LOADED)
ShiftPersistentVarToModVar('IsVoloDead')
--ShiftPersistentVarToModVar('IsVoloDead')
if not Utils.IsVoloDead() then
Utils.Info(Strings.INFO_MOD_LOADED_ALIVE)
else
Expand All @@ -59,13 +91,14 @@ end
Ext.Osiris.RegisterListener("Died", 1, "after", function(char)
if char == Globals.volo then
Utils.Info(Strings.INFO_VOLO_IS_NOW_DEAD)
Globals.Vars.IsVoloDead = true
--Globals.Vars.IsVoloDead = true
PersistentVars['IsVoloDead'] = true
Osi.OpenMessageBox(GetHostCharacter(), Strings.INFO_VOLO_IS_NOW_DEAD)
end
end)

Ext.Osiris.RegisterListener("CastSpell", 5, "after", function(caster, spell, _, _, _)
if IsVoloDead() then
if Utils.IsVoloDead() then
if Osi.IsCharacter(caster) == 1 and Osi.HasPassive(caster, "TTW_WildMagic_UnstableWeave") == 0 then
Osi.AddPassive(caster, "TTW_WildMagic_UnstableWeave")
elseif Osi.HasPassive(caster, "TTW_WildMagic_UnstableWeave") == 1 then
Expand All @@ -74,4 +107,14 @@ Ext.Osiris.RegisterListener("CastSpell", 5, "after", function(caster, spell, _,
end
end)

Ext.Events.DealDamage:Subscribe(function(e)
if Utils.IsVoloDead() and e.Functor.Magical then
local IsVolatile = Ext.Math.Random(1, 4)
if IsVolatile == 1 then
Osi.ShowNotification(Osi.GetIdentity(e.Caster.Uuid.EntityUuid, 1), Strings.MSG_VOLATILE_FORCE_DAMAGE_TYPE)
e.Functor.DamageType = Globals.DamageTypes[Ext.Math.Random(1, #Globals.DamageTypes)]
end
end
end)

Ext.Events.SessionLoaded:Subscribe(OnSessionLoaded)
18 changes: 18 additions & 0 deletions ToppleTheWeave/Mods/ToppleTheWeave/ScriptExtender/Lua/Strings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,21 @@ Strings.INFO_VOLO_IS_NOW_DEAD =
"With this character's death, the threads of the Weave have been severed. Restore a saved game to restore the Weave, or persist in the doomed world you have created."
Strings.INFO_MOD_LOADED_ALIVE = "The Weave ripples gently around you..."
Strings.INFO_MOD_LOADED_DEAD = "The Weave races against your skin, like a storm come to land..."

Strings.MSG_VOLATILE_FORCE = "Magic churns around you. You struggle for control over the spell you have cast as raw Weave pours out."
Strings.MSG_YOU_DIED = "The Weave rips through you, killing you instantly."
Strings.MSG_REMOVE_TADPOLE = "The Weave pours into your brain, weakening any unwelcome passengers."
Strings.MSG_GAINED_MONEY = "As magical wind flurries past, your purse feels heavier."
Strings.MSG_NO_MONEY = "You feel a strong wind flow into your purse."
Strings.MSG_LOST_MONEY = "As magical wind flurries past, your purse feels lighter."
Strings.MSG_END_TURN = "The moment passes before it has even begun."
Strings.MSG_CREATE_SURFACE = "The excess energy pouring out of the weave forms a surface of magical effect beneath you."
Strings.MSG_CREATE_PUDDLE = "The excess energy pouring out of the weave forms a pool of magical effect beneath you."
Strings.MSG_UNEQUIP = "As your spell unleashes, a telekinetic force puts your weapon away."
Strings.MSG_RESET_COOLDOWN = "The raw magical energy bursting past brings with it a feeling of renewal."
Strings.MSG_DESUMMON = "The beings you have summoned, if any, are sucked back through your spell, into the Weave once more."
Strings.MSG_STATUS = "You are struck by the coursing energy around you, afflicted with a status of magical origin."
Strings.MSG_EXPLOSION = "The Weave concentrates into your spell, exploding outward around you."
Strings.MSG_UNLEASHED_PROJECTILE = "As your Spell fires at the enemy, more Spells shift through the Weave. Toward you."
Strings.MSG_UNLEARN_SPELL = "No sooner than your spell left your lips did it also leave your brain, for good."
Strings.MSG_VOLATILE_FORCE_DAMAGE_TYPE = "As your spell strikes its target, the churning of the Weave permanently shifts the type of damage it will deal the next time it is cast."
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ function Utils.InsertToTable(arr, entry, count)
end

function Utils.IsVoloDead()
return Globals.Vars.IsVoloDead or false
return PersistentVars['IsVoloDead'] or false
--return Globals.Vars.IsVoloDead or false
end
4 changes: 2 additions & 2 deletions ToppleTheWeave/Mods/ToppleTheWeave/meta.lsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
<attribute id="Tags" type="LSString" value="" />
<attribute id="Type" type="FixedString" value="Add-on" />
<attribute id="UUID" type="FixedString" value="e77d25c4-a7d5-4233-8aa2-9d718cb9959b" />
<attribute id="Version64" type="int64" value="36028797018963968" />
<attribute id="Version64" type="int64" value="36169534507319296" />
<children>
<node id="PublishVersion">
<attribute id="Version64" type="int64" value="36028797018963968" />
<attribute id="Version64" type="int64" value="36169534507319296" />
</node>
<node id="Scripts" />
<node id="TargetModes">
Expand Down

0 comments on commit c9c948d

Please sign in to comment.