diff options
-rw-r--r-- | CHANGELOG.md | 10 | ||||
-rw-r--r-- | app/lib/activity_processor.rb | 28 | ||||
-rw-r--r-- | app/models/character.rb | 24 | ||||
-rw-r--r-- | app/models/item_infix.rb | 4 | ||||
-rw-r--r-- | data/activities.yml | 117 |
5 files changed, 155 insertions, 28 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index c08461d..acc3268 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,10 +3,16 @@ All notable changes to this project will be documented in this file. ## [Unreleased] -### Skills +### General +- Any items equipped which provide a speed increase to a skill now have a chance to break when performing that skill. + The break chance is based on the equip slot of the item, and uses the same numbers as the combat equipment break + chance. The combat equipment break check process is unchanged. - Omenbind has been implemented. Omens can be bound once a character has constructed a binding array in their hearth. Omens are tradable items that can be infixed to a particular skill via the new skills UI (see the UI section of this - changelog). Omens can be removed and re-infixed at will. + changelog). Omens can be removed and re-infixed at will. All omens infixed in a skill have a chance to fade away and + be permanently lost when performing that skill (like equipment breakage). The chance of an infixed omen fading away + is 1/1000. You do not need to actively be getting a bonus from an infixed omen for it to have a chance to fade away. + When performing a skill, all omens infixed in that skill have the same chance to fade away. - Havencast has been implemented. Spells can be cast from a new "Spells" view, accessible with the navigation. Spells typically require that a certain amount of mana is available. Mana can be made available by infixing certain omens. diff --git a/app/lib/activity_processor.rb b/app/lib/activity_processor.rb index 9b03f55..e211db4 100644 --- a/app/lib/activity_processor.rb +++ b/app/lib/activity_processor.rb @@ -115,6 +115,24 @@ class ActivityProcessor end end + # Note: This will result in equipment being checked for breakage twice (after combat, and now) if it provides the + # `beastslay_speed` stat. At the time of this writing, that stat doesn't exist. + # But just something to keep in mind. + # Note: This will result in equipment being checked twice if it provides two speed stats. + # Fine for now since no equipment gives two skill speed stats, but may want to refine in the future. + if @activity.whatnot[:requirements].any? + required_skill_gids = @activity.whatnot[:requirements].select { |r| r[:type] == "skill" }.map { |r| r[:gid] }.uniq + required_skill_gids.each do |required_skill_gid| + skill = Skill.find_by_gid(required_skill_gid) + @character.do_skill_based_equipment_break_checks(skill).each do |broken_item| + @results.push({ type: "warning", message: "Your #{broken_item.name} was damaged beyond repair!" }) + end + @character.do_skill_based_item_infix_break_checks(skill).each do |broken_item| + @results.push({ type: "warning", message: "Your #{broken_item.name} omen faded away." }) + end + end + end + if @character.activity && @character.queued_actions if @character.queued_actions > 0 @character.queued_actions -= 1 @@ -282,7 +300,9 @@ class ActivityProcessor end if char_hp < 1 || mon_hp < 1 - break_check + @character.do_equipment_break_checks.each do |broken_item| + @results.push({ type: "warning", message: "Your #{broken_item.name} was damaged beyond repair!" }) + end if monster_spawn hp_lost = monster_spawn.remaining_hp - mon_hp @@ -325,10 +345,4 @@ class ActivityProcessor end end end - - def break_check - @character.do_equipment_break_checks.each do |broken_item| - @results.push({ type: "warning", message: "Your #{broken_item.name} was damaged beyond repair!" }) - end - end end diff --git a/app/models/character.rb b/app/models/character.rb index 5ff067c..0f2c5b3 100644 --- a/app/models/character.rb +++ b/app/models/character.rb @@ -116,6 +116,30 @@ class Character < ApplicationRecord end end + def do_skill_based_equipment_break_checks(skill) + skill = Skill.find_by_gid(skill) if skill.is_a? String + broken_items = [] + # TODO: HACK: Should check other stats besides speed stat in the future. + # TODO: HACK: May not want a chance to break if speed is _reduced_. Though no equipment does this yet. + equipment.all.select { |eq| eq.effects.select { |ef| ef[:gid] == "#{skill.gid}_speed" }.any? }.each do |equipment| + if equipment.break_check + broken_items.push(equipment.item) + end + end + broken_items + end + + def do_skill_based_item_infix_break_checks(skill) + skill = Skill.find_by_gid(skill) if skill.is_a? String + broken_items = [] + item_infixes.where(skill: skill).each do |ii| + if ii.break_check + broken_items.push(ii.item) + end + end + broken_items + end + def do_equipment_break_checks(exclude_slots: []) broken_items = [] equipment.where.not(slot: exclude_slots).each do |equipment| diff --git a/app/models/item_infix.rb b/app/models/item_infix.rb index 3167320..47b6aa4 100644 --- a/app/models/item_infix.rb +++ b/app/models/item_infix.rb @@ -9,6 +9,10 @@ class ItemInfix < ApplicationRecord self.item.whatnot[:infix_effects] end + def break_check + rand > 0.999 ? destroy : false + end + private def check_max_infixes current_infixes = character.item_infixes.where(skill: skill) diff --git a/data/activities.yml b/data/activities.yml index ec82b38..2940973 100644 --- a/data/activities.yml +++ b/data/activities.yml @@ -322,6 +322,9 @@ plant_mudtub_seed: - type: "hearth_amenity" gid: "loamspire" level: 1 + - type: "skill" + gid: "magiculture" + level: 1 duration: base: 120 scaling: @@ -345,6 +348,9 @@ harvest_mudtub: - type: "hearth_amenity" gid: "loamspire" level: 1 + - type: "skill" + gid: "magiculture" + level: 1 duration: base: 120 scaling: @@ -536,6 +542,9 @@ craft_crude_iron_ingot: - type: "hearth_amenity" gid: "forge" level: 1 + - type: "skill" + gid: "otherforge" + level: 1 duration: base: 50 minimum: 35 @@ -564,6 +573,9 @@ craft_iron_ingot: - type: "hearth_amenity" gid: "forge" level: 1 + - type: "skill" + gid: "otherforge" + level: 1 duration: base: 60 minimum: 35 @@ -716,6 +728,9 @@ craft_iron_lockpicks: - type: "hearth_amenity" gid: "forge" level: 1 + - type: "skill" + gid: "otherforge" + level: 1 duration: base: 50 minimum: 35 @@ -744,6 +759,9 @@ craft_iron_dagger: - type: "hearth_amenity" gid: "forge" level: 1 + - type: "skill" + gid: "otherforge" + level: 1 duration: base: 50 minimum: 35 @@ -834,6 +852,9 @@ craft_iron_buckler: - type: "hearth_amenity" gid: "forge" level: 1 + - type: "skill" + gid: "otherforge" + level: 1 duration: base: 100 minimum: 35 @@ -1392,6 +1413,9 @@ craft_iron_pickaxe: - type: "hearth_amenity" gid: "forge" level: 1 + - type: "skill" + gid: "otherforge" + level: 1 duration: base: 75 minimum: 35 @@ -1423,6 +1447,9 @@ craft_iron_axe: - type: "hearth_amenity" gid: "forge" level: 1 + - type: "skill" + gid: "otherforge" + level: 1 duration: base: 75 minimum: 35 @@ -1454,6 +1481,9 @@ craft_iron_spade: - type: "hearth_amenity" gid: "forge" level: 1 + - type: "skill" + gid: "otherforge" + level: 1 duration: base: 75 minimum: 35 @@ -1630,6 +1660,9 @@ craft_mending_salve: - type: "hearth_amenity" gid: "laboratory" level: 1 + - type: "skill" + gid: "fluxseethe" + level: 1 duration: base: 90 minimum: 35 @@ -1942,6 +1975,10 @@ planequarry_floret_mines: description: "Planequarry at the Floret Mines." location: "floret_region" whatnot: + requirements: + - type: "skill" + gid: "planequarry" + level: 1 duration: base: 130 minimum: 35 @@ -2079,6 +2116,10 @@ planequarry_brine_trench: description: "Planequarry in the south Floret brine trench." location: "floret_region" whatnot: + requirements: + - type: "skill" + gid: "planequarry" + level: 1 duration: base: 60 minimum: 25 @@ -2108,6 +2149,10 @@ beastslay_killing_fields: description: "Hunt monsters in the Killing Fields." location: "floret_region" whatnot: + requirements: + - type: "skill" + gid: "beastslay" + level: 1 duration: base: 60 minimum: 35 @@ -2132,6 +2177,10 @@ beastslay_hopegraves: description: "Hunt monsters in the Hopegraves." location: "floret_region" whatnot: + requirements: + - type: "skill" + gid: "beastslay" + level: 1 duration: base: 70 minimum: 35 @@ -2154,6 +2203,10 @@ wealdreap_twil_woods: description: "Wealdreap within Twil Woods." location: "floret_region" whatnot: + requirements: + - type: "skill" + gid: "wealdreap" + level: 1 duration: base: 120 minimum: 35 @@ -2289,6 +2342,12 @@ manatrawl_sor_well: description: "Manatrawl within Sor Well." location: "floret_region" whatnot: + requirements: + - type: "skill" + gid: "manatrawl" + level: 1 + - type: "equipment" + gid: "aethermesh" duration: base: 60 minimum: 35 @@ -2299,9 +2358,6 @@ manatrawl_sor_well: - type: "stat" gid: "manatrawl_speed" scale_value: 1 - requirements: - - type: "equipment" - gid: "aethermesh" results: - type: "item" chance: 1 @@ -2330,6 +2386,12 @@ manatrawl_sor_well_depths: description: "Manatrawl deep within Sor Well." location: "floret_region" whatnot: + requirements: + - type: "skill" + gid: "manatrawl" + level: 7 + - type: "equipment" + gid: "aethermesh" duration: base: 70 minimum: 35 @@ -2340,12 +2402,6 @@ manatrawl_sor_well_depths: - type: "stat" gid: "manatrawl_speed" scale_value: 1 - requirements: - - type: "skill" - gid: "manatrawl" - level: 7 - - type: "equipment" - gid: "aethermesh" results: - type: "item" chance: 1 @@ -2374,6 +2430,12 @@ synthsever_rusted_lockbox: name: "Unlock Rusted Lockbox" description: "Unseal the lock on a rusted lockbox." whatnot: + requirements: + - type: "equipment" + gid: "iron_lockpicks" + - type: "skill" + gid: "synthsever" + level: 1 duration: base: 180 minimum: 35 @@ -2381,9 +2443,6 @@ synthsever_rusted_lockbox: - type: "skill" gid: "synthsever" scale_value: 1 - requirements: - - type: "equipment" - gid: "iron_lockpicks" cost: - type: "item" gid: "rusted_lockbox" @@ -2433,6 +2492,10 @@ wildscour_crumbling_ruins: description: "Wildscour within the crumbling ruins." location: "floret_region" whatnot: + requirements: + - type: "skill" + gid: "wildscour" + level: 1 duration: base: 60 minimum: 35 @@ -2483,6 +2546,9 @@ craft_gem_dust_from_red_beryl: - type: "hearth_amenity" gid: "laboratory" level: 1 + - type: "skill" + gid: "fluxseethe" + level: 1 duration: base: 60 minimum: 15 @@ -2511,6 +2577,9 @@ craft_gem_dust_from_tourmaline: - type: "hearth_amenity" gid: "laboratory" level: 1 + - type: "skill" + gid: "fluxseethe" + level: 1 duration: base: 60 minimum: 15 @@ -2573,6 +2642,9 @@ craft_mudtub_mash: - type: "hearth_amenity" gid: "spicebench" level: 1 + - type: "skill" + gid: "spicework" + level: 1 duration: base: 60 minimum: 35 @@ -2696,6 +2768,10 @@ beastslay_leviathan_floret_region: name: "Hunt a Leviathan in the Floret Region" description: "You are hunting down a leviathan ravaging the Floret Region." whatnot: + requirements: + - type: "skill" + gid: "beastslay" + level: 1 duration: base: 80 minimum: 40 @@ -2718,6 +2794,9 @@ craft_faint_mana: - type: "hearth_amenity" gid: "binding_array" level: 1 + - type: "skill" + gid: "omenbind" + level: 1 duration: base: 60 minimum: 35 @@ -2748,13 +2827,6 @@ havencast_light: tags: - "spell" - "cantrip" - duration: - base: 30 - minimum: 10 - scaling: - - type: "skill" - gid: "havencast" - scale_value: 1 requirements: - type: "skill" gid: "havencast" @@ -2762,6 +2834,13 @@ havencast_light: - type: "stat" gid: "mana" value: 1 + duration: + base: 30 + minimum: 10 + scaling: + - type: "skill" + gid: "havencast" + scale_value: 1 results: - type: "condition" gid: "light" |