The Backstabbing Framework provides easy support to a much more refined backstabbing mechanic than what exists in the game with stats (i.e. : not FacingMe()). It only supports spells and passives, not status, but since you can make a status give a passive it basically supports status aswell. With it, you can precisely describe what condition(s) enable backstab (what spell can backstab and what passive make a character able to backstab). Furthermore, you can associate a precise angle on a case-by-case basis, so you can make a spell that backstabs all the time, regardless of the targets's orientations for instance. It also supports what is called “Modifiers”, spells/passives that do not inherently enable backstab, but rather increases (or decreases) the angle at which you can backstab.
To properly use this framework, you'll have to do 2 things :
This file is the core of the framework. Here, you'll list all the spells/passives that can backstab, and at what angle. The file harbors the following structure :
{
"Enabling" :
{
"Spells" : [
],
"Passives": [
]
},
"Custom" :
{
"Spells" : [
],
"Passives": [
]
},
"Modifiers" :
{
"Spells" : [
],
"Passives" : [
]
}
}
You can see 3 distincts categories, each having Spells/Passives separated :
We'll go through each one, explaining what they do and how to use them.
This category is to get going easily without headaches and is pretty straight forward. In it, you only need to put the name of the spell (for Spells) or the passive (for Passives, I think you got it), which will automatically have a 90° angle associated. For instance, in the BackstabbingBlueprint-Example.json we have :
"Enabling" :
{
"Spells" : [
"Projectile_FireBolt"
],
"Passives": [
"SneakAttack_Unlock"
]
},
So any character using the Firebolt cantrip, or any character possessing the “SneakAttack_Unlock” passive (so basically, any rogue), will be able to backstab if they are within a 90° cone in the back of the character.
Be wary that each Spell/Passive must be separated by a comma “,”.
Here, it's getting a little bit more complicated but worry not it's still easy and it allows some customization. For each entry in this section, you'll have to put a table associating the name of a spell/passive to an angle of your choice. In case you want to associate multiple spells/passives to a single angle, you'll have to create additional tables. You don't need to add entries here in the Enabling section, every spell/passive in here will automatically be “Enablers". The priority is (for now) always given to the widest angle (whether it's from a spell or a passive). So, if a character has a passive associated to a 180° angle and uses a spell associated to an angle of 60° for instance, then the passive will take priority and completely disregards the spell. In the BackstabbingBlueprint-Example.json we have :
"Custom" :
{
"Spells" : [
["Target_MainHandAttack",180]
],
"Passives": [
["UnlockedSpellSlotLevel2",240]
]
},
Again, each individual entry (in this case, each table) must be separated by a comma “,”.
Modifiers work very differently from the 2 categories above. Instead of making backstab possible with a fixed angle, modifiers will add their associated value to any backstab angle calculation. This means you can make a passive that increases the width of every other spell/passive's angle you might have added in the two categories above. It shall be noted that modifiers do not enable backstab inherently, meaning that if you want a modifier that also makes a character able to backstab, you'll have to put it into Enabling or Custom aswell. In the BackstabbingBlueprint-Example.json there is :
"Modifiers" :
{
"Spells" : [
["Target_Smite_Divine",40],
["Target_SneakAttack",15],
["Projectile_SneakAttack",30]
],
"Passives" : [
["DivineHealth",30]
]
}
There is no priority for modifiers, every single one will be accounted for if a character has multiple of them. So in this case for instance, a Paladin having Divine Health and using Divine Smite will add 70 to every backstab calculation. Considering he also has UnlockedSpellSlotLevel2, which is associated to an angle of 240°, then if he uses Divine Smite he'll have a total backstabbing angle of 240+30+40 = 310° (very close to 360°, which is guaranteed backstab).
As always be sure to separate every table by a comma “,”.
We enter the stats part of this mod. This framework only provides the foundations on which you can create your own classes/items/passives or whatever and since I opted for customability over practicality, you'll have to do most of the work here.
How it works is simple : on previewing a spell (aka when a player clicks on a spell icon), this mod will calculate (using the angles mentionned above) the backstabbing state of each entity within a roughly 30 meter radius and apply the status BACKSTABBING_FRAMEWORK_MAIN_STATUS_200001 to all those that meet the conditions. What you do with this status is entirely up to you, you can for instance make a passive like that :
new entry "Shade_Infiltrate_100011"
type "PassiveData"
data "Properties" "IsHidden"
data "DisplayName" "he532834a9e294966b775dae69c06f4f14ff9;1"
data "Boosts" "IF(HasStatus('BACKSTABBING_FRAMEWORK_MAIN_STATUS_200001',context.Target)):CriticalHit(AttackRoll,Success,Always)"
Such a passive would guarantee critical hits to the character's attacks against Backstabbed entities, but you can do much more (basically everything you can do with stats).