aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2022-01-31 17:52:57 +0100
committerNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2022-01-31 17:52:57 +0100
commita4cbe791eaa37a4a8039a112a881ce2757305dce (patch)
tree6bd67947d2ee659595aa9828694bb8ad15a04966
parentf55133c2e24ee782416a32619aa1a3b07811915f (diff)
downloadtacticians-client-adding_tonkadur.zip
tacticians-client-adding_tonkadur.tar.bz2
Fixes misses doing damage, missing animations, and some other modifications from a long time ago...adding_tonkadur
-rw-r--r--src/battle/src/Struct/Attack.elm6
-rw-r--r--src/battle/src/Update/Puppeteer/Hit.elm14
-rw-r--r--src/battle/src/View/MessageBoard/Attack.elm20
-rw-r--r--src/shared/tonkadur/Tonkadur/Compute.elm1
-rw-r--r--src/shared/tonkadur/Tonkadur/Execute.elm1
-rw-r--r--src/shared/tonkadur/Tonkadur/PlayerInput.elm2
-rw-r--r--src/shared/tonkadur/Tonkadur/Types.elm36
7 files changed, 64 insertions, 16 deletions
diff --git a/src/battle/src/Struct/Attack.elm b/src/battle/src/Struct/Attack.elm
index ee89427..2dc85ba 100644
--- a/src/battle/src/Struct/Attack.elm
+++ b/src/battle/src/Struct/Attack.elm
@@ -12,7 +12,8 @@ module Struct.Attack exposing
get_new_target_luck,
get_order,
get_precision,
- get_target_index
+ get_target_index,
+ hits
)
-- Elm -------------------------------------------------------------------------
@@ -118,3 +119,6 @@ decoder =
|> (Json.Decode.Pipeline.required "alk" Json.Decode.int)
|> (Json.Decode.Pipeline.required "dlk" Json.Decode.int)
)
+
+hits : Type -> Bool
+hits at = not (at.precision == Miss)
diff --git a/src/battle/src/Update/Puppeteer/Hit.elm b/src/battle/src/Update/Puppeteer/Hit.elm
index 4addab1..b84848c 100644
--- a/src/battle/src/Update/Puppeteer/Hit.elm
+++ b/src/battle/src/Update/Puppeteer/Hit.elm
@@ -38,10 +38,16 @@ forward : (
)
forward attack model =
(
- (apply_damage_to_character
- (Struct.Attack.get_damage attack)
- (Struct.Attack.get_target_index attack)
- model
+ (
+ if (Struct.Attack.hits attack)
+ then
+ (apply_damage_to_character
+ (Struct.Attack.get_damage attack)
+ (Struct.Attack.get_target_index attack)
+ model
+ )
+ else
+ model
),
[]
)
diff --git a/src/battle/src/View/MessageBoard/Attack.elm b/src/battle/src/View/MessageBoard/Attack.elm
index 1445c21..d87a7e9 100644
--- a/src/battle/src/View/MessageBoard/Attack.elm
+++ b/src/battle/src/View/MessageBoard/Attack.elm
@@ -126,9 +126,12 @@ get_attack_animation_class : (
String
)
get_attack_animation_class attack char =
- if (Struct.Attack.get_is_a_critical attack)
- then "animated-portrait-attack-critical"
- else "animated-portrait-attacks"
+ if (Struct.Attack.get_is_a_parry attack)
+ then "animated-portrait-parries"
+ else
+ if (Struct.Attack.get_is_a_critical attack)
+ then "animated-portrait-attack-critical"
+ else "animated-portrait-attacks"
get_defense_animation_class : (
Struct.Attack.Type ->
@@ -138,14 +141,13 @@ get_defense_animation_class : (
get_defense_animation_class attack char =
if ((Struct.Attack.get_damage attack) == 0)
then
- if ((Struct.Attack.get_precision attack) == Struct.Attack.Miss)
- then "animated-portrait-dodges"
- else "animated-portrait-undamaged"
+ "animated-portrait-undamaged"
else if ((Struct.Character.get_current_health char) > 0)
then
- if ((Struct.Attack.get_precision attack) == Struct.Attack.Graze)
- then "animated-portrait-grazed-damage"
- else "animated-portrait-damaged"
+ case (Struct.Attack.get_precision attack) of
+ Struct.Attack.Hit -> "animated-portrait-damaged"
+ Struct.Attack.Graze -> "animated-portrait-grazed-damage"
+ Struct.Attack.Miss -> "animated-portrait-dodges"
else
if ((Struct.Attack.get_precision attack) == Struct.Attack.Graze)
then "animated-portrait-grazed-death"
diff --git a/src/shared/tonkadur/Tonkadur/Compute.elm b/src/shared/tonkadur/Tonkadur/Compute.elm
index b22c3ac..92e5527 100644
--- a/src/shared/tonkadur/Tonkadur/Compute.elm
+++ b/src/shared/tonkadur/Tonkadur/Compute.elm
@@ -1,6 +1,7 @@
module Tonkadur.Compute exposing (compute)
-- Elm -------------------------------------------------------------------------
+import Dict
import List
-- Tonkadur --------------------------------------------------------------------
diff --git a/src/shared/tonkadur/Tonkadur/Execute.elm b/src/shared/tonkadur/Tonkadur/Execute.elm
index 6876e80..200d4a7 100644
--- a/src/shared/tonkadur/Tonkadur/Execute.elm
+++ b/src/shared/tonkadur/Tonkadur/Execute.elm
@@ -1,6 +1,7 @@
module Tonkadur.Execute exposing (execute)
-- Elm -------------------------------------------------------------------------
+import Dict
import List
-- Tonkadur --------------------------------------------------------------------
diff --git a/src/shared/tonkadur/Tonkadur/PlayerInput.elm b/src/shared/tonkadur/Tonkadur/PlayerInput.elm
index 0cd75aa..c5fd837 100644
--- a/src/shared/tonkadur/Tonkadur/PlayerInput.elm
+++ b/src/shared/tonkadur/Tonkadur/PlayerInput.elm
@@ -1,8 +1,8 @@
module Tonkadur.PlayerInput exposing (..)
-- Elm -------------------------------------------------------------------------
-import List
import Dict
+import List
-- Tonkadur --------------------------------------------------------------------
import Tonkadur.Types
diff --git a/src/shared/tonkadur/Tonkadur/Types.elm b/src/shared/tonkadur/Tonkadur/Types.elm
index 3393970..3c3806f 100644
--- a/src/shared/tonkadur/Tonkadur/Types.elm
+++ b/src/shared/tonkadur/Tonkadur/Types.elm
@@ -87,7 +87,9 @@ type alias State =
allocated_data : Int,
last_choice_index : Int,
available_options : (List.List Option),
- memorized_target : Value
+ memorized_target : Value,
+
+ last_instruction_effect : InstructionEffect
}
--------------------------------------------------------------------------------
@@ -223,3 +225,35 @@ get_default state type_name =
case (Dict.get other state.user_types) of
(Just default) -> default
Nothing -> (StringValue ("Unknown type '" + other + "'"))
+
+apply_at_address : (
+ (List.List String) ->
+ (
+ String ->
+ (Dict.Dict String Value) ->
+ (Dict.Dict String Value)
+ )
+ (Dict.Dict String Value) ->
+ (Dict.Dict String Value)
+ )
+apply_at_address address fun memory =
+ case address of
+ [] -> memory
+ (last_element :: []) -> (fun last_element memory)
+ (next_element :: next_address) ->
+ (Dict.update
+ next_element
+ (\maybe_value ->
+ case maybe_value of
+ (Just value) ->
+ (Just
+ (apply_at_address
+ next_address
+ fun
+ (Tonkadur.Types.value_to_dict value)
+ )
+ )
+
+ Nothing -> Nothing
+ )
+ )