From 28a67b8f0c5f187da85a165221d8657de23324d4 Mon Sep 17 00:00:00 2001 From: nsensfel Date: Thu, 31 May 2018 18:07:50 +0200 Subject: Adds "coef" factor to equipment for more variety. --- src/battlemap/src/Data/Weapons.elm | 26 +++++++++++++++ src/battlemap/src/Struct/Armor.elm | 64 +++++++++++++++++++------------------ src/battlemap/src/Struct/Weapon.elm | 60 ++++++++++++++++++++++------------ 3 files changed, 99 insertions(+), 51 deletions(-) diff --git a/src/battlemap/src/Data/Weapons.elm b/src/battlemap/src/Data/Weapons.elm index e74d89e..03ce4a1 100644 --- a/src/battlemap/src/Data/Weapons.elm +++ b/src/battlemap/src/Data/Weapons.elm @@ -18,6 +18,7 @@ dataset = (Struct.Weapon.new 0 "None" + 1.0 Struct.Weapon.Melee Struct.Weapon.Short Struct.Weapon.Blunt @@ -29,6 +30,7 @@ dataset = (Struct.Weapon.new 1 "Dagger" + 1.0 Struct.Weapon.Melee Struct.Weapon.Short Struct.Weapon.Slash @@ -40,6 +42,7 @@ dataset = (Struct.Weapon.new 2 "Sword" + 1.0 Struct.Weapon.Melee Struct.Weapon.Short Struct.Weapon.Slash @@ -51,6 +54,7 @@ dataset = (Struct.Weapon.new 3 "Claymore" + 1.0 Struct.Weapon.Melee Struct.Weapon.Long Struct.Weapon.Slash @@ -62,6 +66,7 @@ dataset = (Struct.Weapon.new 4 "Bardiche" + 1.0 Struct.Weapon.Melee Struct.Weapon.Long Struct.Weapon.Slash @@ -73,6 +78,7 @@ dataset = (Struct.Weapon.new 5 "Stiletto" + 1.0 Struct.Weapon.Melee Struct.Weapon.Short Struct.Weapon.Pierce @@ -84,6 +90,7 @@ dataset = (Struct.Weapon.new 6 "Pickaxe" + 1.0 Struct.Weapon.Melee Struct.Weapon.Short Struct.Weapon.Pierce @@ -95,6 +102,7 @@ dataset = (Struct.Weapon.new 7 "Rapier" + 1.0 Struct.Weapon.Melee Struct.Weapon.Long Struct.Weapon.Pierce @@ -106,6 +114,7 @@ dataset = (Struct.Weapon.new 8 "Pike" + 1.0 Struct.Weapon.Melee Struct.Weapon.Long Struct.Weapon.Pierce @@ -117,6 +126,7 @@ dataset = (Struct.Weapon.new 9 "Club" + 1.0 Struct.Weapon.Melee Struct.Weapon.Short Struct.Weapon.Blunt @@ -128,6 +138,7 @@ dataset = (Struct.Weapon.new 10 "Mace" + 1.0 Struct.Weapon.Melee Struct.Weapon.Short Struct.Weapon.Blunt @@ -139,6 +150,7 @@ dataset = (Struct.Weapon.new 11 "Staff" + 1.0 Struct.Weapon.Melee Struct.Weapon.Long Struct.Weapon.Blunt @@ -150,6 +162,7 @@ dataset = (Struct.Weapon.new 12 "War Hammer" + 1.0 Struct.Weapon.Melee Struct.Weapon.Long Struct.Weapon.Blunt @@ -161,6 +174,7 @@ dataset = (Struct.Weapon.new 13 "Short Bow (Broadhead)" + 1.0 Struct.Weapon.Ranged Struct.Weapon.Short Struct.Weapon.Slash @@ -172,6 +186,7 @@ dataset = (Struct.Weapon.new 14 "Short Bow (Blunt)" + 1.0 Struct.Weapon.Ranged Struct.Weapon.Short Struct.Weapon.Blunt @@ -183,6 +198,7 @@ dataset = (Struct.Weapon.new 15 "Short Bow (Bodkin Point)" + 1.0 Struct.Weapon.Ranged Struct.Weapon.Short Struct.Weapon.Pierce @@ -194,6 +210,7 @@ dataset = (Struct.Weapon.new 16 "Long Bow (Broadhead)" + 1.0 Struct.Weapon.Ranged Struct.Weapon.Long Struct.Weapon.Slash @@ -205,6 +222,7 @@ dataset = (Struct.Weapon.new 17 "Long Bow (Blunt)" + 1.0 Struct.Weapon.Ranged Struct.Weapon.Long Struct.Weapon.Blunt @@ -216,6 +234,7 @@ dataset = (Struct.Weapon.new 18 "Long Bow (Bodkin Point)" + 1.0 Struct.Weapon.Ranged Struct.Weapon.Long Struct.Weapon.Pierce @@ -227,6 +246,7 @@ dataset = (Struct.Weapon.new 19 "Crossbow (Broadhead)" + 1.0 Struct.Weapon.Ranged Struct.Weapon.Short Struct.Weapon.Slash @@ -238,6 +258,7 @@ dataset = (Struct.Weapon.new 20 "Crossbow (Blunt)" + 1.0 Struct.Weapon.Ranged Struct.Weapon.Short Struct.Weapon.Blunt @@ -249,6 +270,7 @@ dataset = (Struct.Weapon.new 21 "Crossbow (Bodkin Point)" + 1.0 Struct.Weapon.Ranged Struct.Weapon.Short Struct.Weapon.Pierce @@ -260,6 +282,7 @@ dataset = (Struct.Weapon.new 22 "Arbalest (Broadhead)" + 1.0 Struct.Weapon.Ranged Struct.Weapon.Long Struct.Weapon.Slash @@ -271,6 +294,7 @@ dataset = (Struct.Weapon.new 23 "Arbalest (Blunt)" + 1.0 Struct.Weapon.Ranged Struct.Weapon.Long Struct.Weapon.Blunt @@ -282,6 +306,7 @@ dataset = (Struct.Weapon.new 24 "Arbalest (Bodkin Point)" + 1.0 Struct.Weapon.Ranged Struct.Weapon.Long Struct.Weapon.Pierce @@ -302,6 +327,7 @@ none = (Struct.Weapon.new 0 "None" + 1.0 Struct.Weapon.Melee Struct.Weapon.Short Struct.Weapon.Blunt diff --git a/src/battlemap/src/Struct/Armor.elm b/src/battlemap/src/Struct/Armor.elm index 92d68f7..1ec4671 100644 --- a/src/battlemap/src/Struct/Armor.elm +++ b/src/battlemap/src/Struct/Armor.elm @@ -69,43 +69,45 @@ get_resistance_to dmg_type ar = ( ar.coef * - ( - case (dmg_type, ar.category) of - (Struct.Weapon.Slash, Kinetic) -> 0.0 - (Struct.Weapon.Slash, Leather) -> 0.5 - (Struct.Weapon.Slash, Chain) -> 1.0 - (Struct.Weapon.Slash, Plate) -> 1.0 - (Struct.Weapon.Blunt, Kinetic) -> 1.0 - (Struct.Weapon.Blunt, Leather) -> 0.5 - (Struct.Weapon.Blunt, Chain) -> 0.5 - (Struct.Weapon.Blunt, Plate) -> 0.5 - (Struct.Weapon.Pierce, Kinetic) -> 0.5 - (Struct.Weapon.Pierce, Leather) -> 0.5 - (Struct.Weapon.Pierce, Chain) -> 0.5 - (Struct.Weapon.Pierce, Plate) -> 1.0 + (toFloat + ( + case (dmg_type, ar.category) of + (Struct.Weapon.Slash, Kinetic) -> 0 + (Struct.Weapon.Slash, Leather) -> 5 + (Struct.Weapon.Slash, Chain) -> 10 + (Struct.Weapon.Slash, Plate) -> 10 + (Struct.Weapon.Blunt, Kinetic) -> 10 + (Struct.Weapon.Blunt, Leather) -> 5 + (Struct.Weapon.Blunt, Chain) -> 5 + (Struct.Weapon.Blunt, Plate) -> 5 + (Struct.Weapon.Pierce, Kinetic) -> 5 + (Struct.Weapon.Pierce, Leather) -> 5 + (Struct.Weapon.Pierce, Chain) -> 5 + (Struct.Weapon.Pierce, Plate) -> 10 + ) ) ) ) apply_to_attributes : Type -> Struct.Attributes.Type -> Struct.Attributes.Type apply_to_attributes ar atts = - case ar.category of - Kinetic -> atts - Leather -> atts - Chain -> - (Struct.Attributes.mod_dexterity - -10 - (Struct.Attributes.mod_speed -10 atts) - ) + let + impact = (ceiling (-20.0 * ar.coef)) + in + case ar.category of + Kinetic -> (Struct.Attributes.mod_mind impact atts) + Leather -> (Struct.Attributes.mod_dexterity impact atts) + Chain -> + (Struct.Attributes.mod_dexterity + impact + (Struct.Attributes.mod_speed impact atts) + ) - Plate -> - (Struct.Attributes.mod_dexterity - -10 - (Struct.Attributes.mod_speed - -10 - (Struct.Attributes.mod_strength - -10 - atts + Plate -> + (Struct.Attributes.mod_dexterity + impact + (Struct.Attributes.mod_speed + impact + (Struct.Attributes.mod_strength impact atts) ) ) - ) diff --git a/src/battlemap/src/Struct/Weapon.elm b/src/battlemap/src/Struct/Weapon.elm index d1d5807..ff6e52c 100644 --- a/src/battlemap/src/Struct/Weapon.elm +++ b/src/battlemap/src/Struct/Weapon.elm @@ -29,6 +29,7 @@ type alias Type = { id : Int, name : String, + coef : Float, range_type : RangeType, range_mod : RangeModifier, dmg_type : DamageType, @@ -65,13 +66,13 @@ get_ranges rt rm = (Melee, Long) -> (0, 2) (Melee, Short) -> (0, 1) -get_damages : RangeType -> DamageModifier -> (Int, Int) -get_damages rt dm = +get_damages : Float -> RangeType -> DamageModifier -> (Int, Int) +get_damages coef rt dm = case (rt, dm) of - (Ranged, Heavy) -> (10, 25) - (Ranged, Light) -> (5, 20) - (Melee, Heavy) -> (20, 35) - (Melee, Light) -> (15, 30) + (Ranged, Heavy) -> ((ceiling (10.0 * coef)), (ceiling (25.0 * coef))) + (Ranged, Light) -> ((ceiling (5.0 * coef)), (ceiling (20.0 * coef))) + (Melee, Heavy) -> ((ceiling (20.0 * coef)), (ceiling (35.0 * coef))) + (Melee, Light) -> ((ceiling (15.0 * coef)), (ceiling (30.0 * coef))) -------------------------------------------------------------------------------- -- EXPORTED -------------------------------------------------------------------- @@ -79,6 +80,7 @@ get_damages rt dm = new : ( Int -> String -> + Float -> RangeType -> RangeModifier -> DamageType -> @@ -86,17 +88,18 @@ new : ( Type ) new - id name + id name coef range_type range_mod dmg_type dmg_mod = let (def_range, atk_range) = (get_ranges range_type range_mod) - (dmg_min, dmg_max) = (get_damages range_type dmg_mod) + (dmg_min, dmg_max) = (get_damages coef range_type dmg_mod) in { id = id, name = name, + coef = coef, range_type = range_type, range_mod = range_mod, dmg_type = dmg_type, @@ -136,15 +139,32 @@ get_min_damage wp = wp.dmg_min apply_to_attributes : Type -> Struct.Attributes.Type -> Struct.Attributes.Type apply_to_attributes wp atts = - case (wp.range_mod, wp.dmg_mod) of - (Long, Heavy) -> - (Struct.Attributes.mod_dexterity - -20 - (Struct.Attributes.mod_speed -20 atts) - ) - - (Long, Light) -> (Struct.Attributes.mod_dexterity -20 atts) - - (Short, Heavy) -> (Struct.Attributes.mod_speed -20 atts) - - (Short, Light) -> atts + let + impact = (-20.0 * wp.coef) + full_impact = (ceiling impact) + quarter_impact = (ceiling (impact / 4.0)) + in + case (wp.range_mod, wp.dmg_mod) of + (Long, Heavy) -> + (Struct.Attributes.mod_dexterity + full_impact + (Struct.Attributes.mod_speed full_impact atts) + ) + + (Long, Light) -> + (Struct.Attributes.mod_dexterity + full_impact + (Struct.Attributes.mod_speed quarter_impact atts) + ) + + (Short, Heavy) -> + (Struct.Attributes.mod_dexterity + quarter_impact + (Struct.Attributes.mod_speed full_impact atts) + ) + + (Short, Light) -> + (Struct.Attributes.mod_dexterity + quarter_impact + (Struct.Attributes.mod_speed quarter_impact atts) + ) -- cgit v1.2.3-70-g09d2