88using GLADIATE . scripts . battle . target ;
99using GLADIATE . scripts . XmlParsing ;
1010using Godot ;
11- using Godot . Collections ;
12- using Array = Godot . Collections . Array ;
1311
1412namespace GLADIATE . scripts . battle ;
1513
@@ -24,36 +22,34 @@ public partial class Battle : Control {
2422 private List < TextureRect > _comboArts = new ( ) ;
2523
2624 private List < Enemy > _allEnemies ;
27- private System . Collections . Generic . Dictionary < string , List < string > > _allDecks ;
25+ private Dictionary < string , List < string > > _allDecks ;
2826
2927 public string Id { get ; set ; }
3028 public string BattleName { get ; set ; }
3129 public string Music { get ; set ; }
3230
33- AudioEngine _audioEngine ;
34- autoloads . SceneLoader _sceneLoader ;
31+ private AudioEngine _audioEngine ;
32+ private SceneLoader _sceneLoader ;
3533
36- Control cardGlossary ;
37- ComboGlossary comboGlossary ;
34+ private Control _cardGlossary ;
35+ private ComboGlossary _comboGlossary ;
3836
39- AnimationPlayer animation ;
37+ private AnimationPlayer _animation ;
4038
4139 public override void _Ready ( ) {
4240 _audioEngine = GetNode < AudioEngine > ( "/root/audio_engine" ) ;
43- _sceneLoader = GetNode < autoloads . SceneLoader > ( "/root/SceneLoader" ) ;
41+ _sceneLoader = GetNode < SceneLoader > ( "/root/SceneLoader" ) ;
4442
4543 _allEnemies = EnemyXmlParser . ParseAllEnemies ( ) ;
4644 _allDecks = DeckXmlParser . ParseAllDecks ( ) ;
4745 _allDecks . TryGetValue ( _sceneLoader . DeckSelected , out List < string > playerCardIds ) ;
4846
49-
50- //UIScaling();
5147 UIScaling ( ) ;
5248
53- animation = GetNode < AnimationPlayer > ( "AnimationPlayer" ) ;
54- animation . Play ( "RESET" ) ;
49+ _animation = GetNode < AnimationPlayer > ( "AnimationPlayer" ) ;
50+ _animation . Play ( "RESET" ) ;
5551
56- System . Collections . Generic . Dictionary < string , dynamic > battleData = _sceneLoader . GetCurrentBattleData ( ) ;
52+ Dictionary < string , dynamic > battleData = _sceneLoader . GetCurrentBattleData ( ) ;
5753 Id = battleData [ "battle_id" ] ;
5854 BattleName = battleData [ "battle_name" ] ;
5955 Music = battleData [ "music" ] ;
@@ -62,11 +58,10 @@ public override void _Ready() {
6258 InitialiseGameState ( playerCardIds , enemies ) ;
6359 InitialiseHud ( ) ;
6460
65- comboGlossary = GetNode < ComboGlossary > ( "HUD/ComboGlossary" ) ;
66- comboGlossary . Initialize ( _gameState . Hand . Deck , _gameState . AllCombos ) ;
67-
68- cardGlossary = GetNode < Control > ( "HUD/CardGlossary" ) ;
61+ _comboGlossary = GetNode < ComboGlossary > ( "HUD/ComboGlossary" ) ;
62+ _comboGlossary . Initialize ( _gameState . Hand . Deck , _gameState . AllCombos ) ;
6963
64+ _cardGlossary = GetNode < Control > ( "HUD/CardGlossary" ) ;
7065
7166 GetNode < Label > ( "HUD/VsLabel" ) . Text = BattleName ;
7267
@@ -84,7 +79,7 @@ public override void _Process(double delta) {
8479
8580 //this line is needed to prevent a lock situation where bote glossaries and escape menu are opended.
8681 // when the pause menu is closed, the pause state is removed, so glossary stop processing and it is impossible to exit.
87- if ( cardGlossary . Visible || comboGlossary . Visible ) { GetTree ( ) . Paused = true ; }
82+ if ( _cardGlossary . Visible || _comboGlossary . Visible ) { GetTree ( ) . Paused = true ; }
8883
8984 if ( SceneLoader . BossBattleId == Id ) {
9085 foreach ( Enemy enemy in _gameState . Enemies ) {
@@ -129,7 +124,7 @@ private void InitialiseGameState(List<string> playerCardIds, List<Enemy> enemies
129124 _gameState . AllEnemiesDefeatedCustomEvent += WinBattle ;
130125 _gameState . ComboPlayedCustomEvent += DisplayPlayedCombo ;
131126 _gameState . Hand . Deck . DeckShuffledCustomEvent += OnDeckShuffled ;
132- _gameState . Player . PlayerModifierChangedCustomEvent += OnPlayerMofifierChanged ;
127+ _gameState . Player . PlayerModifierChangedCustomEvent += OnPlayerModifierChanged ;
133128 _gameState . Player . Statuses . PlayerStatusesChangedCustomEvent += UpdateStatusesToolTip ;
134129
135130
@@ -142,18 +137,17 @@ private void InitialiseGameState(List<string> playerCardIds, List<Enemy> enemies
142137 public void UpdateStatusesToolTip ( object sender , EventArgs e ) {
143138 TextureRect statusIndicator = GetNode < TextureRect > ( "HUD/StatusIndicator" ) ;
144139 string statusString = "" ;
145-
146140 foreach ( Utils . StatusEnum status in _gameState . Player . Statuses ) { statusString += status + "\n " ; }
147141 statusIndicator . TooltipText = statusString ;
148142 if ( statusString . Length > 0 ) { statusIndicator . Show ( ) ; } else { statusIndicator . Hide ( ) ; }
149143 }
150144
151- private void OnPlayerMofifierChanged ( object sender , EventArgs e ) {
152- TextureRect PlayerModifierIcon = GetNode < TextureRect > ( "HUD/PlayerModifierIcon" ) ;
153- if ( _gameState . Player . Modifier == Utils . ModifierEnum . None ) { PlayerModifierIcon . Visible = false ; } else {
154- PlayerModifierIcon . Texture =
145+ private void OnPlayerModifierChanged ( object sender , EventArgs e ) {
146+ TextureRect playerModifierIcon = GetNode < TextureRect > ( "HUD/PlayerModifierIcon" ) ;
147+ if ( _gameState . Player . Modifier == Utils . ModifierEnum . None ) { playerModifierIcon . Visible = false ; } else {
148+ playerModifierIcon . Texture =
155149 ( Texture2D ) GD . Load ( $ "res://assets/images/ModifierIcons/{ _gameState . Player . Modifier } .png") ;
156- PlayerModifierIcon . Visible = true ;
150+ playerModifierIcon . Visible = true ;
157151 }
158152 }
159153
@@ -260,7 +254,7 @@ private void OnPlayButtonPressed() {
260254 private void EndTurn ( ) { _gameState . EndTurn ( ) ; }
261255
262256 private void WinBattle ( object sender , EventArgs eventArgs ) {
263- EmitSignal ( Battle . SignalName . BattleWon , _gameState . Player ) ;
257+ EmitSignal ( SignalName . BattleWon , _gameState . Player ) ;
264258
265259 if ( Id != SceneLoader . PreBossBattleId ) { _audioEngine . PlaySoundFx ( "victory-jingle.wav" ) ; } else {
266260 _audioEngine . PlaySoundFx ( "male-hurt-1.ogg" ) ;
@@ -295,9 +289,9 @@ private void MoveSelectedIndicator(object sender, EventArgs e) {
295289 private void OnPlayerHealthChanged ( ) {
296290 Player playerObject = _gameState . Player ;
297291 if ( playerObject . Health <= 0 ) {
298- EmitSignal ( Battle . SignalName . BattleLost ) ;
292+ EmitSignal ( SignalName . BattleLost ) ;
299293
300- _sceneLoader = GetNode < autoloads . SceneLoader > ( "/root/SceneLoader" ) ;
294+ _sceneLoader = GetNode < SceneLoader > ( "/root/SceneLoader" ) ;
301295 _audioEngine . PlayMusic ( "Lil_tune.wav" ) ;
302296 _sceneLoader . GoToScene ( "res://scenes/sub/GameOver.tscn" ) ;
303297 }
@@ -444,6 +438,7 @@ private void UIScaling() {
444438
445439 Path2D hand = GetNode < Path2D > ( "Hand" ) ;
446440 hand . Scale = scaleFactor ;
441+
447442 Path2D enemies = GetNode < Path2D > ( "Enemies" ) ;
448443 enemies . Scale = scaleFactor ;
449444
0 commit comments