Merge branch 'sam/ability-sets' into 'master'

Allow Specification of Custom Ability Sets per Weapon

See merge request veloren/veloren!2231
This commit is contained in:
Samuel Keiffer 2021-05-03 17:50:11 +00:00
commit 610c529c42
235 changed files with 1668 additions and 1452 deletions

View File

@ -0,0 +1,246 @@
// Maps a tool kind to a set of abilities
// A set of abilities is a primary, a secondary, and a vec of all extra abilities
({
Tool(Sword): (
primary: "common.abilities.sword.triplestrike",
secondary: "common.abilities.sword.dash",
abilities: [
(Some(Sword(UnlockSpin)), "common.abilities.sword.spin"),
],
),
Tool(Axe): (
primary: "common.abilities.axe.doublestrike",
secondary: "common.abilities.axe.spin",
abilities: [
(Some(Axe(UnlockLeap)), "common.abilities.axe.leap"),
],
),
Tool(Hammer): (
primary: "common.abilities.hammer.singlestrike",
secondary: "common.abilities.hammer.charged",
abilities: [
(Some(Hammer(UnlockLeap)), "common.abilities.hammer.leap"),
],
),
Tool(Bow): (
primary: "common.abilities.bow.basic",
secondary: "common.abilities.bow.charged",
abilities: [
(Some(Bow(UnlockRepeater)), "common.abilities.bow.repeater"),
],
),
Custom("Husk"): (
primary: "common.abilities.custom.husk.singlestrike",
secondary: "common.abilities.custom.husk.triplestrike",
abilities: [],
),
Tool(Spear): (
primary: "common.abilities.spear.doublestrike",
secondary: "common.abilities.spear.dash",
abilities: [],
),
Custom("Hammer Simple"): (
primary: "common.abilities.hammersimple.doublestrike",
secondary: "common.abilities.hammersimple.doublestrike",
abilities: [],
),
Custom("Axe Simple"): (
primary: "common.abilities.axesimple.doublestrike",
secondary: "common.abilities.axesimple.dash",
abilities: [],
),
Custom("Sword Simple"): (
primary: "common.abilities.swordsimple.doublestrike",
secondary: "common.abilities.swordsimple.dash",
abilities: [
],
),
Custom("Staff Simple"): (
primary: "common.abilities.staffsimple.firebomb",
secondary: "common.abilities.staffsimple.flamethrower",
abilities: [],
),
Custom("Bow Simple"): (
primary: "common.abilities.bowsimple.basic",
secondary: "common.abilities.bowsimple.basic",
abilities: [
],
),
Tool(Staff): (
primary: "common.abilities.staff.firebomb",
secondary: "common.abilities.staff.flamethrower",
abilities: [
(Some(Staff(UnlockShockwave)), "common.abilities.staff.fireshockwave"),
],
),
Tool(Sceptre): (
primary: "common.abilities.sceptre.lifestealbeam",
secondary: "common.abilities.sceptre.healingbeam",
abilities: [
(Some(Sceptre(UnlockAura)), "common.abilities.sceptre.wardingaura"),
],
),
Tool(Dagger): (
primary: "common.abilities.dagger.tempbasic",
secondary: "common.abilities.dagger.tempbasic",
abilities: [],
),
Tool(Shield): (
primary: "common.abilities.shield.tempbasic",
secondary: "common.abilities.shield.block",
abilities: [],
),
Custom("Stone Golem"): (
primary: "common.abilities.custom.stonegolemfist.singlestrike",
secondary: "common.abilities.custom.stonegolemfist.shockwave",
abilities: [
(None, "common.abilities.custom.stonegolemfist.spin"),
],
),
Custom("Beast Claws"): (
primary: "common.abilities.custom.beastclaws.basic",
secondary: "common.abilities.custom.beastclaws.basic",
abilities: [],
),
Custom("Wendigo Magic"): (
primary: "common.abilities.custom.wendigomagic.frostbomb",
secondary: "common.abilities.custom.wendigomagic.singlestrike",
abilities: [],
),
Custom("Tidal Claws"): (
primary: "common.abilities.staff.flamethrower",
secondary: "common.abilities.custom.wendigomagic.singlestrike",
abilities: [],
),
Custom("Quad Med Quick"): (
primary: "common.abilities.custom.quadmedquick.triplestrike",
secondary: "common.abilities.custom.quadmedquick.dash",
abilities: [],
),
Custom("Quad Med Jump"): (
primary: "common.abilities.custom.quadmedjump.leap",
secondary: "common.abilities.custom.quadmedjump.doublestrike",
abilities: [
(None, "common.abilities.custom.quadmedjump.quickleap"),
],
),
Custom("Quad Med Charge"): (
primary: "common.abilities.custom.quadmedcharge.doublestrike",
secondary: "common.abilities.custom.quadmedcharge.dash",
abilities: [],
),
Custom("Quad Med Hoof"): (
primary: "common.abilities.custom.quadmedhoof.basic",
secondary: "common.abilities.custom.quadmedhoof.basic",
abilities: [],
),
Custom("Quad Med Basic"): (
primary: "common.abilities.custom.quadmedbasic.singlestrike",
secondary: "common.abilities.custom.quadmedbasic.triplestrike",
abilities: [],
),
Custom("Quad Low Ranged"): (
primary: "common.abilities.custom.quadlowranged.singlestrike",
secondary: "common.abilities.custom.quadlowranged.firebomb",
abilities: [],
),
Custom("Quad Low Breathe"): (
primary: "common.abilities.custom.quadlowbreathe.flamethrower",
secondary: "common.abilities.custom.quadlowbreathe.triplestrike",
abilities: [
(None, "common.abilities.custom.quadlowbreathe.dash"),
],
),
Custom("Quad Low Tail"): (
primary: "common.abilities.custom.quadlowtail.charged",
secondary: "common.abilities.custom.quadlowtail.triplestrike",
abilities: [],
),
Custom("Quad Low Quick"): (
primary: "common.abilities.custom.quadlowquick.dash",
secondary: "common.abilities.custom.quadlowquick.quadstrike",
abilities: [],
),
Custom("Quad Low Basic"): (
primary: "common.abilities.custom.quadlowbasic.triplestrike",
secondary: "common.abilities.custom.quadlowbasic.singlestrike",
abilities: [],
),
Custom("Quad Low Beam"): (
primary: "common.abilities.custom.quadlowbeam.healingbeam",
secondary: "common.abilities.custom.quadlowbreathe.triplestrike",
abilities: [
(None, "common.abilities.custom.quadlowbreathe.dash"),
],
),
Custom("Quad Small Basic"): (
primary: "common.abilities.custom.quadsmallbasic.singlestrike",
secondary: "common.abilities.custom.quadsmallbasic.singlestrike",
abilities: [],
),
Custom("Theropod Basic"): (
primary: "common.abilities.custom.theropodbasic.triplestrike",
secondary: "common.abilities.custom.theropodbasic.triplestrike",
abilities: [],
),
Custom("Theropod Bird"): (
primary: "common.abilities.custom.theropodbird.triplestrike",
secondary: "common.abilities.custom.theropodbird.triplestrike",
abilities: [],
),
Custom("Theropod Charge"): (
primary: "common.abilities.custom.theropodbird.triplestrike",
secondary: "common.abilities.custom.theropodbasic.dash",
abilities: [],
),
Custom("Turret"): (
primary: "common.abilities.custom.turret.arrows",
secondary: "common.abilities.custom.turret.arrows",
abilities: [],
),
Custom("Mindflayer"): (
primary: "common.abilities.custom.mindflayer.cursedflames",
secondary: "common.abilities.custom.mindflayer.necroticvortex",
abilities: [
(None, "common.abilities.custom.mindflayer.dimensionaldoor"),
(None, "common.abilities.custom.mindflayer.summonminions"),
],
),
Custom("Bird Large Breathe"): (
primary: "common.abilities.custom.birdlargebreathe.firebomb",
secondary: "common.abilities.custom.birdlargebreathe.triplestrike",
abilities: [
(None, "common.abilities.custom.birdlargebreathe.flamethrower"),
],
),
Custom("Bird Large Fire"): (
primary: "common.abilities.custom.birdlargefire.firebomb",
secondary: "common.abilities.custom.birdlargefire.triplestrike",
abilities: [
(None, "common.abilities.custom.birdlargefire.fireshockwave"),
],
),
Tool(Debug): (
primary: "common.abilities.debug.forwardboost",
secondary: "common.abilities.debug.upboost",
abilities: [
(None, "common.abilities.debug.possess"),
],
),
Tool(Farming): (
primary: "common.abilities.farming.basic",
secondary: "common.abilities.farming.basic",
abilities: [],
),
Tool(Pick): (
primary: "common.abilities.pick.swing",
secondary: "common.abilities.pick.swing",
abilities: [],
),
Tool(Empty): (
primary: "common.abilities.empty.basic",
secondary: "common.abilities.empty.basic",
abilities: [],
),
})

View File

@ -1,246 +0,0 @@
// Maps a tool kind to a set of abilities
// A set of abilities is a primary, a secondary, and a vec of all extra abilities
({
Sword: (
primary: "common.abilities.sword.triplestrike",
secondary: "common.abilities.sword.dash",
abilities: [
(Some(Sword(UnlockSpin)), "common.abilities.sword.spin"),
],
),
Axe: (
primary: "common.abilities.axe.doublestrike",
secondary: "common.abilities.axe.spin",
abilities: [
(Some(Axe(UnlockLeap)), "common.abilities.axe.leap"),
],
),
Hammer: (
primary: "common.abilities.hammer.singlestrike",
secondary: "common.abilities.hammer.charged",
abilities: [
(Some(Hammer(UnlockLeap)), "common.abilities.hammer.leap"),
],
),
Bow: (
primary: "common.abilities.bow.basic",
secondary: "common.abilities.bow.charged",
abilities: [
(Some(Bow(UnlockRepeater)), "common.abilities.bow.repeater"),
],
),
Unique(Husk): (
primary: "common.abilities.unique.husk.singlestrike",
secondary: "common.abilities.unique.husk.triplestrike",
abilities: [],
),
Spear: (
primary: "common.abilities.spear.doublestrike",
secondary: "common.abilities.spear.dash",
abilities: [],
),
HammerSimple: (
primary: "common.abilities.hammersimple.doublestrike",
secondary: "common.abilities.hammersimple.doublestrike",
abilities: [],
),
AxeSimple: (
primary: "common.abilities.axesimple.doublestrike",
secondary: "common.abilities.axesimple.dash",
abilities: [],
),
SwordSimple: (
primary: "common.abilities.swordsimple.doublestrike",
secondary: "common.abilities.swordsimple.dash",
abilities: [
],
),
StaffSimple: (
primary: "common.abilities.staffsimple.firebomb",
secondary: "common.abilities.staffsimple.flamethrower",
abilities: [],
),
BowSimple: (
primary: "common.abilities.bowsimple.basic",
secondary: "common.abilities.bowsimple.basic",
abilities: [
],
),
Staff: (
primary: "common.abilities.staff.firebomb",
secondary: "common.abilities.staff.flamethrower",
abilities: [
(Some(Staff(UnlockShockwave)), "common.abilities.staff.fireshockwave"),
],
),
Sceptre: (
primary: "common.abilities.sceptre.lifestealbeam",
secondary: "common.abilities.sceptre.healingbeam",
abilities: [
(Some(Sceptre(UnlockAura)), "common.abilities.sceptre.wardingaura"),
],
),
Dagger: (
primary: "common.abilities.dagger.tempbasic",
secondary: "common.abilities.dagger.tempbasic",
abilities: [],
),
Shield: (
primary: "common.abilities.shield.tempbasic",
secondary: "common.abilities.shield.block",
abilities: [],
),
Unique(StoneGolemFist): (
primary: "common.abilities.unique.stonegolemfist.singlestrike",
secondary: "common.abilities.unique.stonegolemfist.shockwave",
abilities: [
(None, "common.abilities.unique.stonegolemfist.spin"),
],
),
Unique(BeastClaws): (
primary: "common.abilities.unique.beastclaws.basic",
secondary: "common.abilities.unique.beastclaws.basic",
abilities: [],
),
Unique(WendigoMagic): (
primary: "common.abilities.unique.wendigomagic.frostbomb",
secondary: "common.abilities.unique.wendigomagic.singlestrike",
abilities: [],
),
Unique(TidalClaws): (
primary: "common.abilities.staff.flamethrower",
secondary: "common.abilities.unique.wendigomagic.singlestrike",
abilities: [],
),
Unique(QuadMedQuick): (
primary: "common.abilities.unique.quadmedquick.triplestrike",
secondary: "common.abilities.unique.quadmedquick.dash",
abilities: [],
),
Unique(QuadMedJump): (
primary: "common.abilities.unique.quadmedjump.leap",
secondary: "common.abilities.unique.quadmedjump.doublestrike",
abilities: [
(None, "common.abilities.unique.quadmedjump.quickleap"),
],
),
Unique(QuadMedCharge): (
primary: "common.abilities.unique.quadmedcharge.doublestrike",
secondary: "common.abilities.unique.quadmedcharge.dash",
abilities: [],
),
Unique(QuadMedHoof): (
primary: "common.abilities.unique.quadmedhoof.basic",
secondary: "common.abilities.unique.quadmedhoof.basic",
abilities: [],
),
Unique(QuadMedBasic): (
primary: "common.abilities.unique.quadmedbasic.singlestrike",
secondary: "common.abilities.unique.quadmedbasic.triplestrike",
abilities: [],
),
Unique(QuadLowRanged): (
primary: "common.abilities.unique.quadlowranged.singlestrike",
secondary: "common.abilities.unique.quadlowranged.firebomb",
abilities: [],
),
Unique(QuadLowBreathe): (
primary: "common.abilities.unique.quadlowbreathe.flamethrower",
secondary: "common.abilities.unique.quadlowbreathe.triplestrike",
abilities: [
(None, "common.abilities.unique.quadlowbreathe.dash"),
],
),
Unique(QuadLowTail): (
primary: "common.abilities.unique.quadlowtail.charged",
secondary: "common.abilities.unique.quadlowtail.triplestrike",
abilities: [],
),
Unique(QuadLowQuick): (
primary: "common.abilities.unique.quadlowquick.dash",
secondary: "common.abilities.unique.quadlowquick.quadstrike",
abilities: [],
),
Unique(QuadLowBasic): (
primary: "common.abilities.unique.quadlowbasic.triplestrike",
secondary: "common.abilities.unique.quadlowbasic.singlestrike",
abilities: [],
),
Unique(QuadLowBeam): (
primary: "common.abilities.unique.quadlowbeam.healingbeam",
secondary: "common.abilities.unique.quadlowbreathe.triplestrike",
abilities: [
(None, "common.abilities.unique.quadlowbreathe.dash"),
],
),
Unique(QuadSmallBasic): (
primary: "common.abilities.unique.quadsmallbasic.singlestrike",
secondary: "common.abilities.unique.quadsmallbasic.singlestrike",
abilities: [],
),
Unique(TheropodBasic): (
primary: "common.abilities.unique.theropodbasic.triplestrike",
secondary: "common.abilities.unique.theropodbasic.triplestrike",
abilities: [],
),
Unique(TheropodBird): (
primary: "common.abilities.unique.theropodbird.triplestrike",
secondary: "common.abilities.unique.theropodbird.triplestrike",
abilities: [],
),
Unique(TheropodCharge): (
primary: "common.abilities.unique.theropodbird.triplestrike",
secondary: "common.abilities.unique.theropodbasic.dash",
abilities: [],
),
Unique(ObjectTurret): (
primary: "common.abilities.unique.turret.arrows",
secondary: "common.abilities.unique.turret.arrows",
abilities: [],
),
Unique(MindflayerStaff): (
primary: "common.abilities.unique.mindflayer.cursedflames",
secondary: "common.abilities.unique.mindflayer.necroticvortex",
abilities: [
(None, "common.abilities.unique.mindflayer.dimensionaldoor"),
(None, "common.abilities.unique.mindflayer.summonminions"),
],
),
Unique(BirdLargeBreathe): (
primary: "common.abilities.unique.birdlargebreathe.firebomb",
secondary: "common.abilities.unique.birdlargebreathe.triplestrike",
abilities: [
(None, "common.abilities.unique.birdlargebreathe.flamethrower"),
],
),
Unique(BirdLargeFire): (
primary: "common.abilities.unique.birdlargefire.firebomb",
secondary: "common.abilities.unique.birdlargefire.triplestrike",
abilities: [
(None, "common.abilities.unique.birdlargefire.fireshockwave"),
],
),
Debug: (
primary: "common.abilities.debug.forwardboost",
secondary: "common.abilities.debug.upboost",
abilities: [
(None, "common.abilities.debug.possess"),
],
),
Farming: (
primary: "common.abilities.farming.basic",
secondary: "common.abilities.farming.basic",
abilities: [],
),
Pick: (
primary: "common.abilities.pick.swing",
secondary: "common.abilities.pick.swing",
abilities: [],
),
Empty: (
primary: "common.abilities.empty.basic",
secondary: "common.abilities.empty.basic",
abilities: [],
),
})

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Minotaur Axe",
description: "Placeholder",
kind: Tool((
kind: AxeSimple,
kind: Axe,
hands: Two,
stats: Direct((
equip_time_secs: 0.5,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Axe Simple")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Blue Oni Axe",
description: "Placeholder",
kind: Tool((
kind: AxeSimple,
kind: Axe,
hands: Two,
stats: Direct((
equip_time_secs: 0.5,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Axe Simple")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Gnoll Staff",
description: "eekum bokum",
kind: Tool((
kind: StaffSimple,
kind: Staff,
hands: Two,
stats: Direct((
equip_time_secs: 0.0,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_set: Some(Custom("Staff Simple")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Gnoll Staff",
description: "eekum bokum",
kind: Tool((
kind: StaffSimple,
kind: Staff,
hands: Two,
stats: Direct((
equip_time_secs: 0.0,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Staff Simple")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Gnoll Staff",
description: "eekum bokum",
kind: Tool((
kind: StaffSimple,
kind: Staff,
hands: Two,
stats: Direct((
equip_time_secs: 0.0,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Staff Simple")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Gnoll Staff",
description: "eekum bokum",
kind: Tool((
kind: StaffSimple,
kind: Staff,
hands: Two,
stats: Direct((
equip_time_secs: 0.0,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Staff Simple")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Gnoll Staff",
description: "eekum bokum",
kind: Tool((
kind: StaffSimple,
kind: Staff,
hands: Two,
stats: Direct((
equip_time_secs: 0.0,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Staff Simple")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Saurok bow",
description: "Placeholder",
kind: Tool((
kind: BowSimple,
kind: Bow,
hands: Two,
stats: Direct((
equip_time_secs: 0.5,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Bow Simple")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Cyclops Hammer",
description: "Placeholder",
kind: Tool((
kind: HammerSimple,
kind: Hammer,
hands: Two,
stats: Direct((
equip_time_secs: 0.5,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Hammer Simple")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Harvester Sythe",
description: "Placeholder",
kind: Tool((
kind: HammerSimple,
kind: Hammer,
hands: Two,
stats: Direct((
equip_time_secs: 0.001,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Hammer Simple")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Ogre Hammer",
description: "Placeholder",
kind: Tool((
kind: HammerSimple,
kind: Hammer,
hands: Two,
stats: Direct((
equip_time_secs: 0.5,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Hammer Simple")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Red Oni Hammer",
description: "Placeholder",
kind: Tool((
kind: HammerSimple,
kind: Hammer,
hands: Two,
stats: Direct((
equip_time_secs: 0.5,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Hammer Simple")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Troll Hammer",
description: "Placeholder",
kind: Tool((
kind: HammerSimple,
kind: Hammer,
hands: Two,
stats: Direct((
equip_time_secs: 0.5,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Hammer Simple")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Yeti Hammer",
description: "Placeholder",
kind: Tool((
kind: HammerSimple,
kind: Hammer,
hands: Two,
stats: Direct((
equip_time_secs: 0.0,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Hammer Simple")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Mindflayer Staff",
description: "Placeholder",
kind: Tool((
kind: Unique(MindflayerStaff),
kind: Staff,
hands: Two,
stats: Direct((
equip_time_secs: 0.01,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Legendary,
tags: [],
ability_spec: Some(Custom("Mindflayer")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Ogre Staff",
description: "Placeholder",
kind: Tool((
kind: StaffSimple,
kind: Staff,
hands: Two,
stats: Direct((
equip_time_secs: 0.5,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Staff Simple")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Saurok Staff",
description: "Placeholder",
kind: Tool((
kind: StaffSimple,
kind: Staff,
hands: Two,
stats: Direct((
equip_time_secs: 0.5,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Staff Simple")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Dullahan Sword",
description: "Placehoder",
kind: Tool((
kind: SwordSimple,
kind: Sword,
hands: Two,
stats: Direct((
equip_time_secs: 0.5,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Sword Simple")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Saurok Sword",
description: "Placehoder",
kind: Tool((
kind: SwordSimple,
kind: Sword,
hands: Two,
stats: Direct((
equip_time_secs: 0.5,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Sword Simple")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Beast Claws",
description: "Was attached to a beast.",
kind: Tool((
kind: Unique(BeastClaws),
kind: Natural,
hands: Two,
stats: Direct((
equip_time_secs: 0.5,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Beast Claws")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Bird Large Breathe",
description: "testing123",
kind: Tool((
kind: Unique(BirdLargeBreathe),
kind: Natural,
hands: Two,
stats: Direct((
equip_time_secs: 0.01,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Bird Large Breathe")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Bird Large Fire",
description: "testing123",
kind: Tool((
kind: Unique(BirdLargeFire),
kind: Natural,
hands: Two,
stats: Direct((
equip_time_secs: 0.01,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Bird Large Fire")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Husk",
description: "testing123",
kind: Tool((
kind: Unique(Husk),
kind: Natural,
hands: Two,
stats: Direct((
equip_time_secs: 0.01,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Husk")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Quad Low Basic",
description: "testing123",
kind: Tool((
kind: Unique(QuadLowBasic),
kind: Natural,
hands: Two,
stats: Direct((
equip_time_secs: 0.01,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Quad Low Basic")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Quad Small Beam",
description: "testing123",
kind: Tool((
kind: Unique(QuadLowBeam),
kind: Natural,
hands: Two,
stats: Direct((
equip_time_secs: 0.01,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Quad Low Beam")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Quad Low Breathe",
description: "testing123",
kind: Tool((
kind: Unique(QuadLowBreathe),
kind: Natural,
hands: Two,
stats: Direct((
equip_time_secs: 0.01,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Quad Low Breathe")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Quad Low Quick",
description: "testing123",
kind: Tool((
kind: Unique(QuadLowQuick),
kind: Natural,
hands: Two,
stats: Direct((
equip_time_secs: 0.01,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Quad Low Quick")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Quad Low Ranged",
description: "testing123",
kind: Tool((
kind: Unique(QuadLowRanged),
kind: Natural,
hands: Two,
stats: Direct((
equip_time_secs: 0.01,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Quad Low Ranged")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Quad Low Tail",
description: "testing123",
kind: Tool((
kind: Unique(QuadLowTail),
kind: Natural,
hands: Two,
stats: Direct((
equip_time_secs: 0.01,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Quad Low Tail")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Quad Med Basic",
description: "testing123",
kind: Tool((
kind: Unique(QuadMedBasic),
kind: Natural,
hands: Two,
stats: Direct((
equip_time_secs: 0.01,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Quad Med Basic")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Quad Med Basic",
description: "testing123",
kind: Tool((
kind: Unique(QuadMedBasic),
kind: Natural,
hands: Two,
stats: Direct((
equip_time_secs: 0.01,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Quad Med Basic")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Quad Med Charge",
description: "testing123",
kind: Tool((
kind: Unique(QuadMedCharge),
kind: Natural,
hands: Two,
stats: Direct((
equip_time_secs: 0.01,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Quad Med Charge")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Quad Med Hoof",
description: "testing123",
kind: Tool((
kind: Unique(QuadMedHoof),
kind: Natural,
hands: Two,
stats: Direct((
equip_time_secs: 0.01,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Quad Med Hoof")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Quad Med Jump",
description: "testing123",
kind: Tool((
kind: Unique(QuadMedJump),
kind: Natural,
hands: Two,
stats: Direct((
equip_time_secs: 0.01,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Quad Med Jump")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Quad Med Quick",
description: "testing123",
kind: Tool((
kind: Unique(QuadMedQuick),
kind: Natural,
hands: Two,
stats: Direct((
equip_time_secs: 0.01,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Quad Med Quick")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Quad Small Basic",
description: "testing123",
kind: Tool((
kind: Unique(QuadSmallBasic),
kind: Natural,
hands: Two,
stats: Direct((
equip_time_secs: 0.01,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Quad Small Basic")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Stone Golem's Fist",
description: "Was attached to a mighty stone golem.",
kind: Tool((
kind: Unique(StoneGolemFist),
kind: Natural,
hands: Two,
stats: Direct((
equip_time_secs: 0.001,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Stone Golem")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Theropod Basic",
description: "testing123",
kind: Tool((
kind: Unique(TheropodBasic),
kind: Natural,
hands: Two,
stats: Direct((
equip_time_secs: 0.01,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Theropod Basic")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Theropod Bird",
description: "testing123",
kind: Tool((
kind: Unique(TheropodBird),
kind: Natural,
hands: Two,
stats: Direct((
equip_time_secs: 0.01,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Theropod Bird")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Theropod Charge",
description: "testing123",
kind: Tool((
kind: Unique(TheropodCharge),
kind: Natural,
hands: Two,
stats: Direct((
equip_time_secs: 0.01,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Theropod Charge")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Tidal Claws",
description: "Snip snap",
kind: Tool((
kind: Unique(TidalClaws),
kind: Natural,
hands: Two,
stats: Direct((
equip_time_secs: 0.5,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Tidal Claws")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Turret",
description: "Turret weapon",
kind: Tool((
kind: Unique(ObjectTurret),
kind: Natural,
hands: Two,
stats: Direct((
equip_time_secs: 0.01,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Turret")),
)

View File

@ -2,7 +2,7 @@ ItemDef(
name: "Wendigo Magic",
description: "spook.",
kind: Tool((
kind: Unique(WendigoMagic),
kind: Natural,
hands: Two,
stats: Direct((
equip_time_secs: 0.5,
@ -15,4 +15,5 @@ ItemDef(
)),
quality: Low,
tags: [],
ability_spec: Some(Custom("Wendigo Magic")),
)

View File

@ -23,7 +23,7 @@ pub enum Tactic {
Sword,
Bow,
Staff,
StoneGolemBoss,
StoneGolem,
CircleCharge { radius: u32, circle_time: u32 },
QuadLowRanged,
TailSlap,

View File

@ -4,7 +4,7 @@ pub mod tool;
// Reexports
pub use modular::{ModularComponent, ModularComponentKind, ModularComponentTag};
pub use tool::{AbilitySet, Hands, MaterialStatManifest, Tool, ToolKind, UniqueKind};
pub use tool::{AbilitySet, AbilitySpec, Hands, MaterialStatManifest, Tool, ToolKind};
use crate::{
assets::{self, AssetExt, Error},
@ -28,6 +28,7 @@ use serde::{de, Deserialize, Serialize, Serializer};
use specs::{Component, DerefFlaggedStorage};
use specs_idvs::IdvStorage;
use std::{fmt, sync::Arc};
use tracing::error;
use vek::Rgb;
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
@ -275,17 +276,19 @@ pub struct ItemDef {
pub tags: Vec<ItemTag>,
#[serde(default)]
pub slots: u16,
ability_map: AbilityMap,
/// Used to specify a custom ability set for a weapon. Leave None (or don't
/// include field in ItemDef) to use default ability set for weapon kind.
pub ability_spec: Option<AbilitySpec>,
}
impl PartialEq for ItemDef {
fn eq(&self, other: &Self) -> bool { self.item_definition_id == other.item_definition_id }
}
// TODO: Look into removing ItemConfig and just using AbilitySet
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct ItemConfig {
pub abilities: AbilitySet<CharacterAbility>,
pub block_ability: Option<CharacterAbility>,
}
#[derive(Debug)]
@ -293,19 +296,39 @@ pub enum ItemConfigError {
BadItemKind,
}
impl TryFrom<(&ItemKind, &[Item], &AbilityMap, &MaterialStatManifest)> for ItemConfig {
impl TryFrom<(&Item, &AbilityMap, &MaterialStatManifest)> for ItemConfig {
type Error = ItemConfigError;
fn try_from(
(item_kind, components, map, msm): (&ItemKind, &[Item], &AbilityMap, &MaterialStatManifest),
(item, ability_map, msm): (&Item, &AbilityMap, &MaterialStatManifest),
) -> Result<Self, Self::Error> {
if let ItemKind::Tool(tool) = item_kind {
let abilities = tool.get_abilities(msm, components, map);
if let ItemKind::Tool(tool) = &item.kind {
// If no custom ability set is specified, fall back to abilityset of tool kind.
let tool_default = ability_map
.get_ability_set(&AbilitySpec::Tool(tool.kind))
.cloned();
let abilities = if let Some(set_key) = item.ability_spec() {
if let Some(set) = ability_map.get_ability_set(set_key) {
set.clone().modified_by_tool(&tool, msm, &item.components)
} else {
error!(
"Custom ability set: {:?} references non-existent set, falling back to \
default ability set.",
set_key
);
tool_default.unwrap_or_default()
}
} else if let Some(set) = tool_default {
set.modified_by_tool(&tool, msm, &item.components)
} else {
error!(
"No ability set defined for tool: {:?}, falling back to default ability set.",
tool.kind
);
Default::default()
};
Ok(ItemConfig {
abilities,
block_ability: None,
})
Ok(ItemConfig { abilities })
} else {
Err(ItemConfigError::BadItemKind)
}
@ -351,7 +374,6 @@ impl ItemDef {
quality: Quality,
tags: Vec<ItemTag>,
slots: u16,
ability_map: AbilityMap,
) -> Self {
Self {
item_definition_id,
@ -361,7 +383,7 @@ impl ItemDef {
quality,
tags,
slots,
ability_map,
ability_spec: None,
}
}
}
@ -395,10 +417,6 @@ impl assets::Compound for ItemDef {
.load_owned::<RawItemDef>(specifier)
.or_else(|e| modular::synthesize_modular_asset(specifier).ok_or(e))?;
let ability_map_handle =
cache.load::<AbilityMap>("common.abilities.weapon_ability_manifest")?;
let ability_map = ability_map_handle.read().clone();
let RawItemDef {
name,
description,
@ -406,6 +424,7 @@ impl assets::Compound for ItemDef {
quality,
tags,
slots,
ability_spec,
} = raw;
// Some commands like /give_item provide the asset specifier separated with \
@ -422,7 +441,7 @@ impl assets::Compound for ItemDef {
quality,
tags,
slots,
ability_map,
ability_spec,
})
}
}
@ -437,6 +456,7 @@ struct RawItemDef {
tags: Vec<ItemTag>,
#[serde(default)]
slots: u16,
ability_spec: Option<AbilitySpec>,
}
impl assets::Asset for RawItemDef {
@ -474,13 +494,18 @@ impl Item {
pub fn new_from_item_def(
inner_item: Arc<ItemDef>,
input_components: &[Item],
ability_map: &AbilityMap,
msm: &MaterialStatManifest,
) -> Self {
let mut components = Vec::new();
if inner_item.is_modular() {
// recipe ensures that types match (i.e. no axe heads on a sword hilt, or double
// sword blades)
components.extend(input_components.iter().map(|comp| comp.duplicate(msm)));
components.extend(
input_components
.iter()
.map(|comp| comp.duplicate(ability_map, msm)),
);
}
let mut item = Item {
@ -491,7 +516,7 @@ impl Item {
item_def: inner_item,
item_config: None,
};
item.update_item_config(msm);
item.update_item_config(ability_map, msm);
item
}
@ -499,8 +524,10 @@ impl Item {
/// Panics if the asset does not exist.
pub fn new_from_asset_expect(asset_specifier: &str) -> Self {
let inner_item = Arc::<ItemDef>::load_expect_cloned(asset_specifier);
// TODO: Figure out better way to get msm and ability_map
let msm = MaterialStatManifest::default();
Item::new_from_item_def(inner_item, &[], &msm)
let ability_map = AbilityMap::default();
Item::new_from_item_def(inner_item, &[], &ability_map, &msm)
}
/// Creates a Vec containing one of each item that matches the provided
@ -513,14 +540,20 @@ impl Item {
/// it exists
pub fn new_from_asset(asset: &str) -> Result<Self, Error> {
let inner_item = Arc::<ItemDef>::load_cloned(asset)?;
// TODO: Get msm and ability_map less hackily
let msm = MaterialStatManifest::default();
Ok(Item::new_from_item_def(inner_item, &[], &msm))
let ability_map = AbilityMap::default();
Ok(Item::new_from_item_def(inner_item, &[], &ability_map, &msm))
}
/// Duplicates an item, creating an exact copy but with a new item ID
pub fn duplicate(&self, msm: &MaterialStatManifest) -> Self {
let mut new_item =
Item::new_from_item_def(Arc::clone(&self.item_def), &self.components, msm);
pub fn duplicate(&self, ability_map: &AbilityMap, msm: &MaterialStatManifest) -> Self {
let mut new_item = Item::new_from_item_def(
Arc::clone(&self.item_def),
&self.components,
ability_map,
msm,
);
new_item.set_amount(self.amount()).expect(
"`new_item` has the same `item_def` and as an invariant, \
self.set_amount(self.amount()) should always succeed.",
@ -529,7 +562,7 @@ impl Item {
|(new_item_slot, old_item_slot)| {
*new_item_slot = old_item_slot
.as_ref()
.map(|old_item| old_item.duplicate(msm));
.map(|old_item| old_item.duplicate(ability_map, msm));
},
);
new_item
@ -596,22 +629,22 @@ impl Item {
}
}
pub fn add_component(&mut self, component: Item, msm: &MaterialStatManifest) {
pub fn add_component(
&mut self,
component: Item,
ability_map: &AbilityMap,
msm: &MaterialStatManifest,
) {
// TODO: hook for typechecking (not needed atm if this is only used by DB
// persistence, but will definitely be needed once enhancement slots are
// added to prevent putting a sword into another sword)
self.components.push(component);
// adding a component changes the stats, so recalculate the ItemConfig
self.update_item_config(msm);
self.update_item_config(ability_map, msm);
}
fn update_item_config(&mut self, msm: &MaterialStatManifest) {
if let Ok(item_config) = ItemConfig::try_from((
self.kind(),
self.components(),
&self.item_def.ability_map,
msm,
)) {
fn update_item_config(&mut self, ability_map: &AbilityMap, msm: &MaterialStatManifest) {
if let Ok(item_config) = ItemConfig::try_from((&*self, ability_map, msm)) {
self.item_config = Some(Box::new(item_config));
}
}
@ -731,6 +764,8 @@ impl Item {
_ => return None,
}))
}
pub fn ability_spec(&self) -> Option<&AbilitySpec> { self.item_def.ability_spec.as_ref() }
}
/// Provides common methods providing details about an item definition

View File

@ -36,34 +36,34 @@ impl TagExampleInfo for ModularComponentTag {
fn name(&self) -> &'static str {
match self.modkind {
ModularComponentKind::Damage => match self.toolkind {
ToolKind::Sword | ToolKind::SwordSimple => "sword blade",
ToolKind::Axe | ToolKind::AxeSimple => "axe head",
ToolKind::Hammer | ToolKind::HammerSimple => "hammer head",
ToolKind::Bow | ToolKind::BowSimple => "bow limbs",
ToolKind::Sword => "sword blade",
ToolKind::Axe => "axe head",
ToolKind::Hammer => "hammer head",
ToolKind::Bow => "bow limbs",
ToolKind::Dagger => "dagger blade",
ToolKind::Staff | ToolKind::StaffSimple => "staff head",
ToolKind::Staff => "staff head",
ToolKind::Sceptre => "sceptre head",
// TODO: naming
ToolKind::Spear => "spear damage component",
ToolKind::Shield => "shield damage component",
ToolKind::Unique(_) => "unique damage component",
ToolKind::Debug => "debug damage component",
ToolKind::Farming => "farming damage component",
ToolKind::Pick => "pickaxe head",
ToolKind::Natural => "natural damage component",
ToolKind::Empty => "empty damage component",
},
ModularComponentKind::Held => match self.toolkind {
ToolKind::Sword | ToolKind::SwordSimple => "sword hilt",
ToolKind::Axe | ToolKind::AxeSimple => "axe shaft",
ToolKind::Hammer | ToolKind::HammerSimple => "hammer shaft",
ToolKind::Bow | ToolKind::BowSimple => "bow riser",
ToolKind::Sword => "sword hilt",
ToolKind::Axe => "axe shaft",
ToolKind::Hammer => "hammer shaft",
ToolKind::Bow => "bow riser",
ToolKind::Dagger => "dagger grip",
ToolKind::Staff | ToolKind::StaffSimple => "staff shaft",
ToolKind::Staff => "staff shaft",
ToolKind::Sceptre => "sceptre shaft",
// TODO: naming
ToolKind::Spear => "spear held component",
ToolKind::Shield => "shield held component",
ToolKind::Unique(_) => "unique held component",
ToolKind::Natural => "natural held component",
ToolKind::Debug => "debug held component",
ToolKind::Farming => "farming held component",
ToolKind::Pick => "pickaxe handle",
@ -75,48 +75,32 @@ impl TagExampleInfo for ModularComponentTag {
fn exemplar_identifier(&self) -> &'static str {
match self.modkind {
ModularComponentKind::Damage => match self.toolkind {
ToolKind::Sword | ToolKind::SwordSimple => {
"common.items.tag_examples.modular.damage.sword"
},
ToolKind::Axe | ToolKind::AxeSimple => {
"common.items.tag_examples.modular.damage.axe"
},
ToolKind::Hammer | ToolKind::HammerSimple => {
"common.items.tag_examples.modular.damage.hammer"
},
ToolKind::Bow | ToolKind::BowSimple => {
"common.items.tag_examples.modular.damage.bow"
},
ToolKind::Sword => "common.items.tag_examples.modular.damage.sword",
ToolKind::Axe => "common.items.tag_examples.modular.damage.axe",
ToolKind::Hammer => "common.items.tag_examples.modular.damage.hammer",
ToolKind::Bow => "common.items.tag_examples.modular.damage.bow",
ToolKind::Dagger => "common.items.tag_examples.modular.damage.dagger",
ToolKind::Staff | ToolKind::StaffSimple => {
"common.items.tag_examples.modular.damage.staff"
},
ToolKind::Staff => "common.items.tag_examples.modular.damage.staff",
ToolKind::Sceptre => "common.items.tag_examples.modular.damage.sceptre",
ToolKind::Shield => "common.items.tag_examples.modular.damage.shield",
ToolKind::Spear => "common.items.tag_examples.modular.damage.spear",
ToolKind::Unique(_) => "common.items.tag_examples.modular.damage.unique",
ToolKind::Natural => "common.items.tag_examples.modular.damage.natural",
ToolKind::Debug => "common.items.tag_examples.modular.damage.debug",
ToolKind::Farming => "common.items.tag_examples.modular.damage.farming",
ToolKind::Pick => "common.items.tag_examples.modular.damage.pick",
ToolKind::Empty => "common.items.tag_examples.modular.damage.empty",
},
ModularComponentKind::Held => match self.toolkind {
ToolKind::Sword | ToolKind::SwordSimple => {
"common.items.tag_examples.modular.held.sword"
},
ToolKind::Axe | ToolKind::AxeSimple => "common.items.tag_examples.modular.held.axe",
ToolKind::Hammer | ToolKind::HammerSimple => {
"common.items.tag_examples.modular.held.hammer"
},
ToolKind::Bow | ToolKind::BowSimple => "common.items.tag_examples.modular.held.bow",
ToolKind::Sword => "common.items.tag_examples.modular.held.sword",
ToolKind::Axe => "common.items.tag_examples.modular.held.axe",
ToolKind::Hammer => "common.items.tag_examples.modular.held.hammer",
ToolKind::Bow => "common.items.tag_examples.modular.held.bow",
ToolKind::Dagger => "common.items.tag_examples.modular.held.dagger",
ToolKind::Staff | ToolKind::StaffSimple => {
"common.items.tag_examples.modular.held.staff"
},
ToolKind::Staff => "common.items.tag_examples.modular.held.staff",
ToolKind::Sceptre => "common.items.tag_examples.modular.held.sceptre",
ToolKind::Shield => "common.items.tag_examples.modular.held.shield",
ToolKind::Spear => "common.items.tag_examples.modular.held.spear",
ToolKind::Unique(_) => "common.items.tag_examples.modular.held.unique",
ToolKind::Natural => "common.items.tag_examples.modular.held.natural",
ToolKind::Debug => "common.items.tag_examples.modular.held.debug",
ToolKind::Farming => "common.items.tag_examples.modular.held.farming",
ToolKind::Pick => "common.items.tag_examples.modular.held.pick",
@ -208,6 +192,7 @@ fn make_component_def(
quality,
tags: vec![ItemTag::ModularComponent(tag)],
slots: 0,
ability_spec: None,
};
(identifier, item)
}
@ -230,6 +215,7 @@ fn make_weapon_def(toolkind: ToolKind) -> (String, RawItemDef) {
quality,
tags: Vec::new(),
slots: 0,
ability_spec: None,
};
(identifier, item)
}
@ -282,6 +268,7 @@ fn make_tagexample_def(
quality,
tags: vec![ItemTag::ModularComponent(tag)],
slots: 0,
ability_spec: None,
};
(identifier, item)
}

View File

@ -11,25 +11,19 @@ use std::{
ops::{AddAssign, DivAssign, MulAssign, Sub},
time::Duration,
};
use tracing::error;
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ToolKind {
Sword,
Axe,
Hammer,
HammerSimple, //simple tools utilized by small/large biped variants, to simplify movesets
SwordSimple,
StaffSimple,
BowSimple,
AxeSimple,
Bow,
Dagger,
Staff,
Sceptre,
Shield,
Spear,
Unique(UniqueKind),
Natural, // Intended for invisible weapons (e.g. a creature using its claws or biting)
Debug,
Farming,
Pick,
@ -41,20 +35,15 @@ impl ToolKind {
pub fn identifier_name(&self) -> &'static str {
match self {
ToolKind::Sword => "sword",
ToolKind::SwordSimple => "simple sword",
ToolKind::Axe => "axe",
ToolKind::AxeSimple => "simple axe",
ToolKind::Hammer => "hammer",
ToolKind::HammerSimple => "simple hammer",
ToolKind::Bow => "bow",
ToolKind::BowSimple => "simple bow",
ToolKind::Dagger => "dagger",
ToolKind::Staff => "staff",
ToolKind::StaffSimple => "simple staff",
ToolKind::Spear => "spear",
ToolKind::Sceptre => "sceptre",
ToolKind::Shield => "shield",
ToolKind::Unique(_) => "unique",
ToolKind::Natural => "natural",
ToolKind::Debug => "debug",
ToolKind::Farming => "farming",
ToolKind::Pick => "pickaxe",
@ -167,6 +156,7 @@ impl Asset for MaterialStatManifest {
impl Default for MaterialStatManifest {
fn default() -> MaterialStatManifest {
// TODO: Don't do this, loading a default should have no ability to panic
MaterialStatManifest::load_expect_cloned("common.material_stats_manifest")
}
}
@ -310,23 +300,6 @@ impl Tool {
Duration::from_secs_f32(self.stats.resolve_stats(msm, components).equip_time_secs)
}
pub fn get_abilities(
&self,
msm: &MaterialStatManifest,
components: &[Item],
map: &AbilityMap,
) -> AbilitySet<CharacterAbility> {
if let Some(set) = map.0.get(&self.kind).cloned() {
set.modified_by_tool(&self, msm, components)
} else {
error!(
"ToolKind: {:?} has no AbilitySet in the ability map falling back to default",
&self.kind
);
Default::default()
}
}
pub fn can_block(&self) -> bool {
matches!(
self.kind,
@ -386,17 +359,32 @@ impl Default for AbilitySet<CharacterAbility> {
}
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, Hash)]
pub enum AbilitySpec {
Tool(ToolKind),
Custom(String),
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct AbilityMap<T = CharacterAbility>(HashMap<ToolKind, AbilitySet<T>>);
pub struct AbilityMap<T = CharacterAbility>(HashMap<AbilitySpec, AbilitySet<T>>);
impl Default for AbilityMap {
fn default() -> Self {
let mut map = HashMap::new();
map.insert(ToolKind::Empty, AbilitySet::default());
AbilityMap(map)
// TODO: Revert to old default
if let Ok(map) = Self::load_cloned("common.abilities.ability_set_manifest") {
map
} else {
let mut map = HashMap::new();
map.insert(AbilitySpec::Tool(ToolKind::Empty), AbilitySet::default());
AbilityMap(map)
}
}
}
impl<T> AbilityMap<T> {
pub fn get_ability_set(&self, key: &AbilitySpec) -> Option<&AbilitySet<T>> { self.0.get(key) }
}
impl Asset for AbilityMap<String> {
type Loader = assets::RonLoader;
@ -416,7 +404,7 @@ impl assets::Compound for AbilityMap {
.iter()
.map(|(kind, set)| {
(
*kind,
kind.clone(),
// expect cannot fail because CharacterAbility always
// provides a default value in case of failure
set.map_ref(|s| cache.load_expect(&s).cloned()),
@ -426,32 +414,3 @@ impl assets::Compound for AbilityMap {
))
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum UniqueKind {
StoneGolemFist,
Husk,
BeastClaws,
WendigoMagic,
TidalClaws,
QuadMedQuick,
QuadMedJump,
QuadMedHoof,
QuadMedBasic,
QuadMedCharge,
QuadLowRanged,
QuadLowBreathe,
QuadLowTail,
QuadLowQuick,
QuadLowBasic,
QuadLowBeam,
QuadSmallBasic,
TheropodBasic,
TheropodBird,
TheropodCharge,
ObjectTurret,
WoodenSpear,
MindflayerStaff,
BirdLargeBreathe,
BirdLargeFire,
}

View File

@ -388,7 +388,7 @@ impl LoadoutBuilder {
"common.items.npc_armor.biped_small.adlet.tail.adlet",
)))
.build(),
Some(ToolKind::Spear) | Some(ToolKind::StaffSimple) => LoadoutBuilder::new()
Some(ToolKind::Spear) | Some(ToolKind::Staff) => LoadoutBuilder::new()
.active_item(active_item)
.head(Some(Item::new_from_asset_expect(
"common.items.npc_armor.biped_small.adlet.head.adlet_spear",
@ -433,7 +433,7 @@ impl LoadoutBuilder {
"common.items.npc_armor.biped_small.gnarling.tail.gnarling",
)))
.build(),
Some(ToolKind::StaffSimple) => LoadoutBuilder::new()
Some(ToolKind::Staff) => LoadoutBuilder::new()
.active_item(active_item)
.head(Some(Item::new_from_asset_expect(
"common.items.npc_armor.biped_small.gnarling.head.gnarling",

Some files were not shown because too many files have changed in this diff Show More