From 57fae48f7ef1af224d1d566336300db8c2ccc13f Mon Sep 17 00:00:00 2001 From: Chris Vickery Date: Mon, 22 Jan 2024 22:28:02 -0800 Subject: [PATCH] types and moving code around --- src/components/combat/stance-selector.tsx | 5 +- src/game/inventory.tsx | 310 +--------------------- src/helpers.ts | 309 +++++++++++++++++++++ 3 files changed, 313 insertions(+), 311 deletions(-) diff --git a/src/components/combat/stance-selector.tsx b/src/components/combat/stance-selector.tsx index f8282e0..f970268 100644 --- a/src/components/combat/stance-selector.tsx +++ b/src/components/combat/stance-selector.tsx @@ -15,8 +15,9 @@ const stanceDescriptions: { [x in HeroStance]?: string } = { export function StanceSelector(): JSX.Element { const hero = useHero(); - console.log(hero.availableStances); - + if (!hero) { + return null; + } const stances = hero.availableStances.map((stance) => ({ name: stance, tooltip: stanceDescriptions[stance], diff --git a/src/game/inventory.tsx b/src/game/inventory.tsx index 3b3c615..2dc99f6 100644 --- a/src/game/inventory.tsx +++ b/src/game/inventory.tsx @@ -27,6 +27,7 @@ import { itemAllowsRebirth, itemAllowsCrafting, itemAllowsVoidTravel, + getEnchantmentDisplay, } from "src/helpers"; import { RebirthMenu } from "./rebirth"; import { CreaftingMenu } from "./crafting"; @@ -353,312 +354,3 @@ export function Inventory(): JSX.Element | null { ); } - -function getEnchantmentDisplay(enchantment: string): string { - switch (enchantment) { - // quest items - case "fishermans-strength": - return "+50% Strength"; - break; - case "fishermans-dexterity": - return "+50% Dexterity"; - break; - case "fishermans-constitution": - return "+50% Constitution"; - break; - case "fishermans-intelligence": - return "+50% Intelligence"; - break; - case "fishermans-wisdom": - return "+50% Wisdom"; - break; - case "fishermans-willpower": - return "+50% Willpower"; - break; - case "fishermans-luck": - return "+50% Luck"; - break; - case "totem-of-champion": - return "+Level cap, auto-battler, +100% XP"; - break; - case "totem-of-hero": - return "2x Leveling rate, +Level cap, auto-battler, +100% XP"; - break; - case "warriors-armlette": - return "Upgrades Fighter and Berserker classes"; - break; - case "tome-of-knowledge": - return "Upgrades Wizard and Warlock classes"; - break; - case "quiver-of-speed": - return "Upgrades Ranger class"; - break; - case "vampire-ring": - return "Upgrades Blood Mage class"; - break; - case "gambling-kit": - return "Upgrades Gambler class"; - break; - case "patrons-wisdom": - return "Upgrades Battle Mage class"; - break; - case "liturgical-censer": - return "Upgrades Paladin class"; - break; - case "dont-get-hit": - return "Double dodge, double accuracy"; - break; - case "aqua-lungs": - return "Allows water travel"; - break; - case "trophy-hellhound": - return "2x All Stats, +1 Weapon Tier"; - break; - case "trophy-hiddenstump": - return "2x All Stats, 2x Dodge"; - break; - case "trophy-steamgear": - return "2x All Stats, Improved auto-battler"; - break; - case "trophy-drowning": - return "2x All Stats, +1 Armor Tier"; - break; - - case "archers-impatience": - return "50% Double Shot"; - break; - case "archers-determination": - return "Ranged -20% Armor, 50% Double Shot"; - break; - case "archers-balance": - return "+1 Ranged Weapon Tier, Ranged -20% Armor, +50% Second Attack"; - break; - case "attackers-precision": - return "+30% Dexterity"; - break; - case "attackers-honor": - return "Melee -20% Armor, +30% Dexterity"; - break; - case "attackers-warbanner": - return "+1 Melee Weapon Tier, Melee -20% Armor, +30% Dexterity"; - break; - case "casters-book": - return "+30% Wisdom"; - break; - case "casters-wisdom": - return "Caster -20% Armor, +30% Wisdom"; - break; - case "casters-destiny": - return "+1 Spell Focus Tier, Caster -20% Armor, +30% Wisdom"; - break; - case "smiters-inspiration": - return "+30% Willpower"; - break; - case "smiters-calling": - return "Smite -20% Armor, +30% Willpower"; - break; - case "smiters-light": - return "+1 Shield Tier, Smite -20% Armor, +30% Willpower"; - break; - case "vampires-blood": - return "+30% Constitution"; - break; - case "vampires-gaze": - return "-50% Enemy Enchantment Resist, +30% Constitution"; - break; - case "vampires-darkness": - return "-75% Enemy Enchantment Resist, +30% Constitution"; - break; - case "naga-scale": - return "Cancels out 1 enemy enchantment"; - break; - case "unimaginable-gearbox": - return "Improved auto-battler"; - break; - case "circle-of-protection": - return "Counter Spell"; - break; - case "circle-of-hexing": - return "3x Counter Spell"; - break; - case "ashen-circle-of-hexing": - return "+1 Weapon Tier, 3x Counter Spell"; - break; - case "shadow-circle-of-hexing": - return "5x Counter Spell"; - break; - case "thorny-circle-of-hexing": - return "+1 Armor Tier, 3x Counter Spell"; - break; - // menus - case "totem-of-champion-rebirth": - case "totem-of-hero-rebirth": - case "totem-of-rebirth": - return "Select to show rebirth menu"; - break; - case "crafting-hammer": - return "Select to show crafting menu"; - break; - case "void-vessel": - return "Select to show void travel"; - break; - case "crafting-goggles": - return "Allows sorting and bulk crafting"; - break; - case "heros-guidance": - return "+44% All Stats, -75% Enemy Enchantment Resist, -50% Enemy Armor, +1 Weapon Tier, +50% Ranged Second Attack, +Max gold"; - break; - - case EnchantmentType.BonusStrength: - return "+30% Strength"; - break; - case EnchantmentType.BonusDexterity: - return "+30% Dexterity"; - break; - case EnchantmentType.BonusConstitution: - return "+30% Constitution"; - break; - case EnchantmentType.BonusIntelligence: - return "+30% Intelligence"; - break; - case EnchantmentType.BonusWisdom: - return "+30% Wisdom"; - break; - case EnchantmentType.BonusWillpower: - return "+30% Willpower"; - break; - case EnchantmentType.BonusLuck: - return "+30% Luck"; - break; - case EnchantmentType.BonusPhysical: - return "+20% Strength, Dexterity, Constitution"; - break; - case EnchantmentType.BonusMental: - return "+20% Intelligence, Wisdom, Willpower"; - break; - case EnchantmentType.BonusAllStats: - return "+20% All Stats"; - break; - case EnchantmentType.MinusEnemyArmor: - return "-50% Enemy Armor"; - break; - case EnchantmentType.BonusArmor: - return "+100% Armor"; - break; - case EnchantmentType.MinusEnemyStrength: - return "-20% Enemy Strength"; - break; - case EnchantmentType.MinusEnemyDexterity: - return "-20% Enemy Dexterity"; - break; - case EnchantmentType.MinusEnemyConstitution: - return "-20% Enemy Constitution"; - break; - case EnchantmentType.MinusEnemyIntelligence: - return "-20% Enemy Intelligence"; - break; - case EnchantmentType.MinusEnemyWisdom: - return "-20% Enemy Wisdom"; - break; - case EnchantmentType.MinusEnemyWillpower: - return "-20% Enemy Willpower"; - break; - case EnchantmentType.MinusEnemyPhysical: - return "-10% Enemy Strength, Dexterity, Constitution"; - break; - case EnchantmentType.MinusEnemyMental: - return "-10% Enemy Intelligence, Wisdom, Willpower"; - break; - case EnchantmentType.MinusEnemyAllStats: - return "-10% All Enemy Stats"; - break; - case EnchantmentType.LifeHeal: - return "Heal 10% Constitution"; - break; - case EnchantmentType.LifeDamage: - return "Damage 10% Constitution"; - break; - case EnchantmentType.LifeSteal: - return "Leech 10% Constitution"; - break; - case EnchantmentType.Vampirism: - return "Leech 20% Constitution, Steal 30% Constitution"; - break; - case EnchantmentType.BigMelee: - return "+100% Strength, Steal 40% Dexterity"; - break; - case EnchantmentType.BigCaster: - return "+100% Intelligence, Steal 40% Wisdom"; - break; - case EnchantmentType.WisDexWill: - return "+40% Wisdom, Dexterity, Willpower"; - break; - case EnchantmentType.StrengthSteal: - return "Steal 30% Strength"; - break; - case EnchantmentType.DexteritySteal: - return "Steal 30% Dexterity"; - break; - case EnchantmentType.ConstitutionSteal: - return "Steal 30% Constitution"; - break; - case EnchantmentType.IntelligenceSteal: - return "Steal 30% Intelligence"; - break; - case EnchantmentType.WisdomSteal: - return "Steal 30% Wisdom"; - break; - case EnchantmentType.WillpowerSteal: - return "Steal 30% Willpower"; - break; - case EnchantmentType.LuckSteal: - return "Steal 30% Luck"; - break; - case EnchantmentType.AllStatsSteal: - return "Steal 30% All Stats"; - break; - case EnchantmentType.CounterSpell: - return "Cancels out 1 enemy enchantment"; - break; - - case EnchantmentType.SuperDexterity: - return "+200% Dexterity, +50% Willpower/Wisdom, CounterSpell, Minus Armor, Bonus Armor"; - break; - case EnchantmentType.SuperWillpower: - return "+200% Willpower, +50% Dexterity/Wisdom, CounterSpell, Minus Armor, Bonus Armor"; - break; - case EnchantmentType.SuperWisdom: - return "+200% Wisdom, +50% Willpower/Dexterity, CounterSpell, Minus Armor, Bonus Armor"; - break; - case EnchantmentType.SuperMelee: - return "+250% Strength, Steal 80% Dexterity, CounterSpell, Minus Armor, Bonus Armor"; - break; - case EnchantmentType.SuperCaster: - return "+250% Intelligence, Steal 80% Wisdom, CounterSpell, Minus Armor, Bonus Armor"; - break; - case EnchantmentType.SuperMeleeVamp: - return "+200% Strength, Steal 50% Dexterity/Constitution, CounterSpell, Minus Armor, Bonus Armor"; - break; - case EnchantmentType.SuperSorcVamp: - return "+200% Intelligence, Steal 50% Wisdom/Constitution, CounterSpell, Minus Armor, Bonus Armor"; - break; - case EnchantmentType.SuperVamp: - return "Leech 50% Constitution, Steal 80% Constitution, CounterSpell, Minus Armor, Bonus Armor"; - break; - case EnchantmentType.SuperVampMelee: - return "+150% Strength, Steal 60% Dexterity/Constitution, CounterSpell, Minus Armor, Bonus Armor"; - break; - case EnchantmentType.SuperVampSorc: - return "+150% Intelligence, Steal 60% Wisdom/Constitution, CounterSpell, Minus Armor, Bonus Armor"; - break; - case EnchantmentType.SuperBattleMage: - return "+150% Strength/Intelligence, Steal 60% Dexterity/Wisdom, CounterSpell, Minus Armor, Bonus Armor"; - break; - case EnchantmentType.SuperAllStats: - return "+100% All Stats, Leech 20% Constitution, CounterSpell, Minus Armor, Bonus Armor"; - break; - default: - return "???"; - break; - } -} diff --git a/src/helpers.ts b/src/helpers.ts index 5fa2fd1..120ed53 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -69,6 +69,315 @@ export const EnchantmentNames: { [x in EnchantmentType]?: string } = { // [EnchantmentType.CanRebirth]: "Quest Reward", }; +export function getEnchantmentDisplay(enchantment: string): string { + switch (enchantment) { + // quest items + case "fishermans-strength": + return "+50% Strength"; + break; + case "fishermans-dexterity": + return "+50% Dexterity"; + break; + case "fishermans-constitution": + return "+50% Constitution"; + break; + case "fishermans-intelligence": + return "+50% Intelligence"; + break; + case "fishermans-wisdom": + return "+50% Wisdom"; + break; + case "fishermans-willpower": + return "+50% Willpower"; + break; + case "fishermans-luck": + return "+50% Luck"; + break; + case "totem-of-champion": + return "+Level cap, auto-battler, +100% XP"; + break; + case "totem-of-hero": + return "2x Leveling rate, +Level cap, auto-battler, +100% XP"; + break; + case "warriors-armlette": + return "Upgrades Fighter and Berserker classes"; + break; + case "tome-of-knowledge": + return "Upgrades Wizard and Warlock classes"; + break; + case "quiver-of-speed": + return "Upgrades Ranger class"; + break; + case "vampire-ring": + return "Upgrades Blood Mage class"; + break; + case "gambling-kit": + return "Upgrades Gambler class"; + break; + case "patrons-wisdom": + return "Upgrades Battle Mage class"; + break; + case "liturgical-censer": + return "Upgrades Paladin class"; + break; + case "dont-get-hit": + return "Double dodge, double accuracy"; + break; + case "aqua-lungs": + return "Allows water travel"; + break; + case "trophy-hellhound": + return "2x All Stats, +1 Weapon Tier"; + break; + case "trophy-hiddenstump": + return "2x All Stats, 2x Dodge"; + break; + case "trophy-steamgear": + return "2x All Stats, Improved auto-battler"; + break; + case "trophy-drowning": + return "2x All Stats, +1 Armor Tier"; + break; + + case "archers-impatience": + return "50% Double Shot"; + break; + case "archers-determination": + return "Ranged -20% Armor, 50% Double Shot"; + break; + case "archers-balance": + return "+1 Ranged Weapon Tier, Ranged -20% Armor, +50% Second Attack"; + break; + case "attackers-precision": + return "+30% Dexterity"; + break; + case "attackers-honor": + return "Melee -20% Armor, +30% Dexterity"; + break; + case "attackers-warbanner": + return "+1 Melee Weapon Tier, Melee -20% Armor, +30% Dexterity"; + break; + case "casters-book": + return "+30% Wisdom"; + break; + case "casters-wisdom": + return "Caster -20% Armor, +30% Wisdom"; + break; + case "casters-destiny": + return "+1 Spell Focus Tier, Caster -20% Armor, +30% Wisdom"; + break; + case "smiters-inspiration": + return "+30% Willpower"; + break; + case "smiters-calling": + return "Smite -20% Armor, +30% Willpower"; + break; + case "smiters-light": + return "+1 Shield Tier, Smite -20% Armor, +30% Willpower"; + break; + case "vampires-blood": + return "+30% Constitution"; + break; + case "vampires-gaze": + return "-50% Enemy Enchantment Resist, +30% Constitution"; + break; + case "vampires-darkness": + return "-75% Enemy Enchantment Resist, +30% Constitution"; + break; + case "naga-scale": + return "Cancels out 1 enemy enchantment"; + break; + case "unimaginable-gearbox": + return "Improved auto-battler"; + break; + case "circle-of-protection": + return "Counter Spell"; + break; + case "circle-of-hexing": + return "3x Counter Spell"; + break; + case "ashen-circle-of-hexing": + return "+1 Weapon Tier, 3x Counter Spell"; + break; + case "shadow-circle-of-hexing": + return "5x Counter Spell"; + break; + case "thorny-circle-of-hexing": + return "+1 Armor Tier, 3x Counter Spell"; + break; + // menus + case "totem-of-champion-rebirth": + case "totem-of-hero-rebirth": + case "totem-of-rebirth": + return "Select to show rebirth menu"; + break; + case "crafting-hammer": + return "Select to show crafting menu"; + break; + case "void-vessel": + return "Select to show void travel"; + break; + case "crafting-goggles": + return "Allows sorting and bulk crafting"; + break; + case "heros-guidance": + return "+44% All Stats, -75% Enemy Enchantment Resist, -50% Enemy Armor, +1 Weapon Tier, +50% Ranged Second Attack, +Max gold"; + break; + + case EnchantmentType.BonusStrength: + return "+30% Strength"; + break; + case EnchantmentType.BonusDexterity: + return "+30% Dexterity"; + break; + case EnchantmentType.BonusConstitution: + return "+30% Constitution"; + break; + case EnchantmentType.BonusIntelligence: + return "+30% Intelligence"; + break; + case EnchantmentType.BonusWisdom: + return "+30% Wisdom"; + break; + case EnchantmentType.BonusWillpower: + return "+30% Willpower"; + break; + case EnchantmentType.BonusLuck: + return "+30% Luck"; + break; + case EnchantmentType.BonusPhysical: + return "+20% Strength, Dexterity, Constitution"; + break; + case EnchantmentType.BonusMental: + return "+20% Intelligence, Wisdom, Willpower"; + break; + case EnchantmentType.BonusAllStats: + return "+20% All Stats"; + break; + case EnchantmentType.MinusEnemyArmor: + return "-50% Enemy Armor"; + break; + case EnchantmentType.BonusArmor: + return "+100% Armor"; + break; + case EnchantmentType.MinusEnemyStrength: + return "-20% Enemy Strength"; + break; + case EnchantmentType.MinusEnemyDexterity: + return "-20% Enemy Dexterity"; + break; + case EnchantmentType.MinusEnemyConstitution: + return "-20% Enemy Constitution"; + break; + case EnchantmentType.MinusEnemyIntelligence: + return "-20% Enemy Intelligence"; + break; + case EnchantmentType.MinusEnemyWisdom: + return "-20% Enemy Wisdom"; + break; + case EnchantmentType.MinusEnemyWillpower: + return "-20% Enemy Willpower"; + break; + case EnchantmentType.MinusEnemyPhysical: + return "-10% Enemy Strength, Dexterity, Constitution"; + break; + case EnchantmentType.MinusEnemyMental: + return "-10% Enemy Intelligence, Wisdom, Willpower"; + break; + case EnchantmentType.MinusEnemyAllStats: + return "-10% All Enemy Stats"; + break; + case EnchantmentType.LifeHeal: + return "Heal 10% Constitution"; + break; + case EnchantmentType.LifeDamage: + return "Damage 10% Constitution"; + break; + case EnchantmentType.LifeSteal: + return "Leech 10% Constitution"; + break; + case EnchantmentType.Vampirism: + return "Leech 20% Constitution, Steal 30% Constitution"; + break; + case EnchantmentType.BigMelee: + return "+100% Strength, Steal 40% Dexterity"; + break; + case EnchantmentType.BigCaster: + return "+100% Intelligence, Steal 40% Wisdom"; + break; + case EnchantmentType.WisDexWill: + return "+40% Wisdom, Dexterity, Willpower"; + break; + case EnchantmentType.StrengthSteal: + return "Steal 30% Strength"; + break; + case EnchantmentType.DexteritySteal: + return "Steal 30% Dexterity"; + break; + case EnchantmentType.ConstitutionSteal: + return "Steal 30% Constitution"; + break; + case EnchantmentType.IntelligenceSteal: + return "Steal 30% Intelligence"; + break; + case EnchantmentType.WisdomSteal: + return "Steal 30% Wisdom"; + break; + case EnchantmentType.WillpowerSteal: + return "Steal 30% Willpower"; + break; + case EnchantmentType.LuckSteal: + return "Steal 30% Luck"; + break; + case EnchantmentType.AllStatsSteal: + return "Steal 30% All Stats"; + break; + case EnchantmentType.CounterSpell: + return "Cancels out 1 enemy enchantment"; + break; + + case EnchantmentType.SuperDexterity: + return "+200% Dexterity, +50% Willpower/Wisdom, CounterSpell, Minus Armor, Bonus Armor"; + break; + case EnchantmentType.SuperWillpower: + return "+200% Willpower, +50% Dexterity/Wisdom, CounterSpell, Minus Armor, Bonus Armor"; + break; + case EnchantmentType.SuperWisdom: + return "+200% Wisdom, +50% Willpower/Dexterity, CounterSpell, Minus Armor, Bonus Armor"; + break; + case EnchantmentType.SuperMelee: + return "+250% Strength, Steal 80% Dexterity, CounterSpell, Minus Armor, Bonus Armor"; + break; + case EnchantmentType.SuperCaster: + return "+250% Intelligence, Steal 80% Wisdom, CounterSpell, Minus Armor, Bonus Armor"; + break; + case EnchantmentType.SuperMeleeVamp: + return "+200% Strength, Steal 50% Dexterity/Constitution, CounterSpell, Minus Armor, Bonus Armor"; + break; + case EnchantmentType.SuperSorcVamp: + return "+200% Intelligence, Steal 50% Wisdom/Constitution, CounterSpell, Minus Armor, Bonus Armor"; + break; + case EnchantmentType.SuperVamp: + return "Leech 50% Constitution, Steal 80% Constitution, CounterSpell, Minus Armor, Bonus Armor"; + break; + case EnchantmentType.SuperVampMelee: + return "+150% Strength, Steal 60% Dexterity/Constitution, CounterSpell, Minus Armor, Bonus Armor"; + break; + case EnchantmentType.SuperVampSorc: + return "+150% Intelligence, Steal 60% Wisdom/Constitution, CounterSpell, Minus Armor, Bonus Armor"; + break; + case EnchantmentType.SuperBattleMage: + return "+150% Strength/Intelligence, Steal 60% Dexterity/Wisdom, CounterSpell, Minus Armor, Bonus Armor"; + break; + case EnchantmentType.SuperAllStats: + return "+100% All Stats, Leech 20% Constitution, CounterSpell, Minus Armor, Bonus Armor"; + break; + default: + return "???"; + break; + } +} + export function pureEnchantmentDisplayName( enchantment: EnchantmentType, ): string {