summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2019-01-23 18:43:13 +0100
committernsensfel <SpamShield0@noot-noot.org>2019-01-23 18:43:13 +0100
commit14e79da8b8d45ef242aee34cf4376d220846f690 (patch)
treee263b48464dd95adae6fb37e25d121869c5e4b77 /src/battle/game-logic/btl_turn_actions.erl
parent366b7e737d74a79e035d6e1a40b041c015f89baa (diff)
Cleaning up a bit...
Diffstat (limited to 'src/battle/game-logic/btl_turn_actions.erl')
-rw-r--r--src/battle/game-logic/btl_turn_actions.erl99
1 files changed, 0 insertions, 99 deletions
diff --git a/src/battle/game-logic/btl_turn_actions.erl b/src/battle/game-logic/btl_turn_actions.erl
deleted file mode 100644
index 4e469f1..0000000
--- a/src/battle/game-logic/btl_turn_actions.erl
+++ /dev/null
@@ -1,99 +0,0 @@
--module(btl_turn_actions).
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% EXPORTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--export
-(
- [
- handle/2,
- handle_max_health_changes/2
- ]
-).
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--spec mod_current_health
- (
- non_neg_integer(),
- non_neg_integer(),
- btl_character_turn_update:type()
- )
- -> btl_character_turn_update:type().
-mod_current_health (CurrentMaxHealth, PreviousMaxHealth, Update) ->
- Data = btl_character_turn_update:get_data(Update),
- Character = btl_character_turn_data:get_character(Data),
- CharacterIX = btl_character_turn_data:get_character_ix(Data),
- PreviousHealth = btl_character:get_current_health(Character),
-
- PreviousHealthRatio = (PreviousHealth / PreviousMaxHealth),
- NewHealth =
- min
- (
- CurrentMaxHealth,
- max(1, round(PreviousHealthRatio * CurrentMaxHealth))
- ),
-
- UpdatedCharacter = btl_character:set_current_health(NewHealth, Character),
- UpdatedData = btl_character_turn_data:set_character(UpdatedCharacter, Data),
- S0Update = btl_character_turn_update:set_data(UpdatedData, Update),
-
- DBQuery =
- ataxic:update_field
- (
- btl_battle:get_characters_field(),
- ataxic_sugar:update_orddict_element
- (
- CharacterIX,
- ataxic:update_field
- (
- btl_character:get_current_health_field(),
- ataxic:constant(NewHealth)
- )
- )
- ),
-
- S1Update = btl_character_turn_update:add_to_db(DBQuery, S0Update),
-
- S1Update.
-
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--spec handle
-(
- btl_battle_action:type(),
- btl_character_turn_update:type()
-)
--> btl_character_turn_update:type().
-handle (BattleAction, Update) ->
- case btl_battle_action:get_category(BattleAction) of
- move -> btl_turn_actions_move:handle(BattleAction, Update);
- switch_weapon -> btl_turn_actions_switch_weapon:handle(Update);
- attack -> btl_turn_actions_attack:handle(BattleAction, Update)
- end.
-
--spec handle_max_health_changes
- (
- btl_character_current_data:type(),
- btl_character_turn_update:type()
- )
- -> btl_character_turn_update:type().
-handle_max_health_changes (PreviousData, Update) ->
- Data = btl_character_turn_update:get_data(Update),
- CurrentData = btl_character_turn_data:get_character_current_data(Data),
- CurrentStats = btl_character_current_data:get_statistics(CurrentData),
- PreviousStats = btl_character_current_data:get_statistics(PreviousData),
-
- CurrentMaxHealth = shr_statistics:get_health(CurrentStats),
- PreviousMaxHealth = shr_statistics:get_health(PreviousStats),
-
- case (CurrentMaxHealth == PreviousMaxHealth) of
- true -> Update;
- _ -> mod_current_health(CurrentMaxHealth, PreviousMaxHealth, Update)
- end.