Hammers
All Weapons in Hades 2 can be altered in unique ways using Daedalus hammers.
Some hammers modify the way an attack works, some affect which attacks are available and some affect the aspect trait.
Hammers are considered as traits, similar to boons and can be accessed in game from TraitData.
Base game Hammers are located in:
Staff Hammers - Scripts/TraitData_Staff.lua
Daggers Hammers - Scripts/TraitData_Dagger.lua
Torch Hammers - Scripts/TraitData_Torch.lua
Axe Hammers - Scripts/TraitData_Axe.lua
Skull Hammers - Scripts/TraitData_Lob.lua
Suit Hammers - Scripts/TraitData_Suit.lua
Restricting incompatible Hammers
When creating a new Weapon Aspect, some Daedalus Hammers may no longer work as intented with the altered moveset/trait. The easiest way to solve this incompatability is to add a restriction to the incompatible hammers, so they won't appear in the available pool while using the new aspect.
In order to do so, we would like to modify the GameStateRequirements field of the trait and add aspect based restrictions.
We could acccess this field through
TraitData.TRAITNAME.GameStateRequirements with TRAITNAME being the name of your specific trait.
GameStateRequirements contains several {} items that state which all conditions have to be met in order for the hammer to appear.
In a trait where field is empty (as in the case for some boons), the trait would appear in its available pool at all times.
Hammer usually have at least one limitation that requires the affected weapon to be equiped. In this example The hero is required to have the Torch equiped in order for the hammer ExampleHammer to appear in the hammer pool
ExampleHammer =
{
InheritFrom = { "WeaponTrait", "TorchHammerTrait" },
GameStateRequirements =
{
{
Path = { "CurrentRun", "Hero", "Weapons", },
HasAll = { "WeaponTorch", },
},
},
}
Common Hammer restrictions:
Equipped Weapons / Attacks
Path = { "CurrentRun", "Hero", "Weapons", }
Last used aspect for X weapon
Path = { "GameState", "LastWeaponUpgradeName", "WeaponTorch", }
Equipped Traits (Hammers/Boons/Aspects)
Path = {"CurrentRun", "Hero", "TraitDictionary"}
Restriction conditions
While the Path tells which restriction to look at the next part tells the condition needed to pass. The path must contains all items listed for the condition to pass.
HasAll = { "WeaponTorchSpecial", },
The path must not contains any of the items listed for the condition to pass.
HasNone = {"TorchAspectofYoungMelinoe", },
The path needs to contain at least one of the items listed for the condition to pass.
IsAny = { "TorchAspectofYoungMelinoe" }
Adding restrictions to base game hammers
There are two ways of modifying the Game requirements of an aspect:
OverwriteTableKeys- This is a function that allows us to replace the existing contents of a table with new contents. This is a destructive method that removes the original content and thus can easilly lead to incompatability issues when several mods overwrite the same entry.table.insert- This function adds and additional item into an existing table. Generaly this is a better ways to modify base game content as its less likely to conflict with other mods.
In the example below we remove TorchSpecialImpactTrait from appearing if the hero has the trait TorchAspectofYoungMelinoe which is the aspect object.
table.insert(TraitData.TorchSpecialImpactTrait.GameStateRequirements, {
Path = {"CurrentRun", "Hero", "TraitDictionary"},
HasNone = {"TorchAspectofYoungMelinoe", },
})
Adding new Hammers
Creating a new hammer trait
Similar to 3.Shop_Upgrades.md here we also add our new traits by their name using OverwriteTableKeys our new trait with a unique name enters TraitData.
Hammers, and aspects-objects are both considered as traits and thus both can have the fields WeaponDataOverride, PropertyChanges and all the trigger fields e.g OnEnemyDeathFunction to create the hammer unique effect.
Below is an example hammer which grants an attack the ability to deflect enemy projectiles.
This Hammer impact a specific attack WeaponAxeSpecial so we the player can use that attack in order for the hammer to be availble in the hammer pool. Additionally we demand the hero uses our aspect, this can be done either by ensuring the last Axe Aspect used is our new aspect or by ensuring the hero has the aspect trait.
In this case we replaced the attack projectile with a custom projectile that was inserted into Game/Projectiles/PlayerProjectiles.sjson.
OverwriteTableKeys( TraitData, {
AxeShieldDeflectTraitYM =
{
InheritFrom = { "WeaponTrait", "AxeHammerTrait" },
Icon = "JarlUlsfark-AspectYoungMel\\ShieldBlockIcon",
GameStateRequirements =
{
{
Path = { "CurrentRun", "Hero", "Weapons", },
HasAll = { "WeaponAxeSpecial", },
},
{
Path = { "GameState", "LastWeaponUpgradeName", "WeaponAxe", },
IsAny = {"AxeAspectofYoungMelinoe", }
},
},
PropertyChanges =
{
{
WeaponName = "WeaponAxeSpecial",
WeaponProperty = "Projectile",
ChangeValue = "ProjectileAxeBlockSpinDeflect",
},
{
WeaponName = "WeaponAxeSpecial",
WeaponProperty = "DoProjectileBlockPresentation",
ChangeVlaue = false,
ChangeType = "Absolute",
ExcludeLinked = true,
},
{
WeaponName = "WeaponAxeSpecial",
WeaponProperty = "ExpireProjectilesOnFire",
ChangeVlaue = "ProjectileAxeBlockSpinDeflect",
ExcludeLinked = true,
},
}
},
}
Inserting our new hammer trait into the Hammer pool
Once we have our new hammer trait we need to insert it to the LootData or LootSetData that feeds into LootData. We add our hammer into the Traits sections of WeaponUpgrade so the game will know its a hammer.
table.insert( LootSetData.Loot.WeaponUpgrade.Traits, "AxeShieldDeflectTraitYM")
Note! if you're using ponymenu mod then you would be able to see your hammer using ponymenu only if you currently comply with all of the hammer requirements.