summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/battlemap/src/Struct/Character.elm33
-rw-r--r--src/battlemap/src/Struct/Statistics.elm24
2 files changed, 44 insertions, 13 deletions
diff --git a/src/battlemap/src/Struct/Character.elm b/src/battlemap/src/Struct/Character.elm
index f361501..5ff8a60 100644
--- a/src/battlemap/src/Struct/Character.elm
+++ b/src/battlemap/src/Struct/Character.elm
@@ -58,7 +58,9 @@ type alias PartiallyDecoded =
att : Struct.Attributes.Type,
awp : Int,
swp : Int,
- ar : Int
+ ar : Int,
+ mvt : Int,
+ mhp : Int
}
type Rank =
@@ -109,7 +111,14 @@ finish_decoding add_char =
location = add_char.lc,
health = add_char.hea,
attributes = add_char.att,
- statistics = (Struct.Statistics.new add_char.att weapon_set armor),
+ statistics =
+ (Struct.Statistics.new
+ add_char.att
+ weapon_set
+ armor
+ add_char.mhp
+ add_char.mvt
+ ),
player_ix = add_char.pla,
enabled = add_char.ena,
defeated = add_char.dea,
@@ -194,7 +203,14 @@ set_weapons : Struct.WeaponSet.Type -> Type -> Type
set_weapons weapons char =
{char |
weapons = weapons,
- statistics = (Struct.Statistics.new char.attributes weapons char.armor)
+ statistics =
+ (Struct.Statistics.new
+ char.attributes
+ weapons
+ char.armor
+ (Struct.Statistics.get_max_health char.statistics)
+ (Struct.Statistics.get_movement_points char.statistics)
+ )
}
decoder : (Json.Decode.Decoder (Type, Int, Int, Int))
@@ -217,6 +233,8 @@ decoder =
|> (Json.Decode.Pipeline.required "awp" Json.Decode.int)
|> (Json.Decode.Pipeline.required "swp" Json.Decode.int)
|> (Json.Decode.Pipeline.required "ar" Json.Decode.int)
+ |> (Json.Decode.Pipeline.required "mvt" Json.Decode.int)
+ |> (Json.Decode.Pipeline.required "mhp" Json.Decode.int)
)
)
@@ -232,7 +250,14 @@ fill_missing_equipment awp swp ar char =
weapon_set = (Struct.WeaponSet.new awp swp)
in
{char |
- statistics = (Struct.Statistics.new char.attributes weapon_set ar),
+ statistics =
+ (Struct.Statistics.new
+ char.attributes
+ weapon_set
+ ar
+ (Struct.Statistics.get_max_health char.statistics)
+ (Struct.Statistics.get_movement_points char.statistics)
+ ),
weapons = weapon_set,
armor = ar
}
diff --git a/src/battlemap/src/Struct/Statistics.elm b/src/battlemap/src/Struct/Statistics.elm
index 5b7eb87..24634ac 100644
--- a/src/battlemap/src/Struct/Statistics.elm
+++ b/src/battlemap/src/Struct/Statistics.elm
@@ -113,9 +113,11 @@ new : (
Struct.Attributes.Type ->
Struct.WeaponSet.Type ->
Struct.Armor.Type ->
+ Int ->
+ Int ->
Type
)
-new att wp_set ar =
+new att wp_set ar max_health max_mvt =
let
active_weapon = (Struct.WeaponSet.get_active_weapon wp_set)
actual_att =
@@ -132,14 +134,18 @@ new att wp_set ar =
dmg_bmod = (damage_base_mod (toFloat strength))
in
{
- movement_points =
- (gentle_squared_growth_f
- (average [mind, constitution, constitution, speed, speed, speed])
- ),
- max_health =
- (gentle_squared_growth_f
- (average [constitution, constitution, constitution, mind])
- ),
+ movement_points = max_mvt,
+ -- Operation is not deterministic, yet can't afford to differ from the
+ -- server's value. As a result, we have to rely on the server's value.
+-- (gentle_squared_growth_f
+-- (average [mind, constitution, constitution, speed, speed, speed])
+-- ),
+ max_health = max_health,
+ -- Operation is not deterministic, yet can't afford to differ from the
+ -- server's value. As a result, we have to rely on the server's value.
+-- (gentle_squared_growth_f
+-- (average [constitution, constitution, constitution, mind])
+-- ),
dodges =
(clamp
0