Beeg fixpack
This commit is contained in:
@@ -77,6 +77,8 @@ public partial class Game : Node3D, IGame
|
||||
private IPlayer _player;
|
||||
private IMap _map;
|
||||
|
||||
private Timer _doubleExpTimer;
|
||||
|
||||
[Signal] private delegate void OnLoadLevelRequestEventHandler();
|
||||
|
||||
public Game()
|
||||
@@ -184,22 +186,17 @@ public partial class Game : Node3D, IGame
|
||||
|
||||
PauseMenu.ExitGamePressed += OnQuit;
|
||||
|
||||
_doubleExpTimer = new Timer();
|
||||
_doubleExpTimer.WaitTime = 30;
|
||||
_doubleExpTimer.Timeout += EndDoubleExpTimer;
|
||||
AddChild(_doubleExpTimer);
|
||||
|
||||
GameRepo.IsPaused.Sync += IsPaused_Sync;
|
||||
InGameUI.PlayerInfoUI.Activate();
|
||||
InGameUI.Show();
|
||||
GameRepo.Resume();
|
||||
}
|
||||
|
||||
private void GameRepo_EnemyDied(IEnemy obj)
|
||||
{
|
||||
DropRestorative(obj.GlobalPosition);
|
||||
}
|
||||
|
||||
private void BroadcastMessage(string obj)
|
||||
{
|
||||
InGameUI.InventoryMessageUI.DisplayMessage(obj);
|
||||
}
|
||||
|
||||
public void LoadExistingGame() => SaveFile.Load().ContinueWith((_) => CallDeferred(nameof(FinishedLoadingSaveFile)));
|
||||
|
||||
public async Task InitializeGame()
|
||||
@@ -264,6 +261,15 @@ public partial class Game : Node3D, IGame
|
||||
RemoveItemOrSubtractFromItemCount(item);
|
||||
}
|
||||
|
||||
public void DoubleExp()
|
||||
{
|
||||
GameRepo.AnnounceMessageOnMainScreen("Experience points temporarily doubled.");
|
||||
if (_doubleExpTimer.TimeLeft == 0)
|
||||
_player.ExperiencePointsComponent.ModifyExpGainRate(_player.ExperiencePointsComponent.ExpGainRate.Value * 2);
|
||||
|
||||
_doubleExpTimer.Start();
|
||||
}
|
||||
|
||||
public IDungeonFloor CurrentFloor => _map.CurrentFloor;
|
||||
|
||||
public async void GameOver()
|
||||
@@ -315,6 +321,7 @@ public partial class Game : Node3D, IGame
|
||||
GameRepo.Pause();
|
||||
InGameUI.InventoryMenu.Show();
|
||||
InGameUI.InventoryMenu.SetProcessInput(true);
|
||||
SfxDatabase.Instance.Play(SoundEffect.OpenInventory);
|
||||
})
|
||||
.Handle((in GameState.Output.CloseInventoryMenu _) =>
|
||||
{
|
||||
@@ -549,11 +556,14 @@ public partial class Game : Node3D, IGame
|
||||
case UsableItemTag.LowerLevel:
|
||||
_effectService.LowerLevel();
|
||||
break;
|
||||
case UsableItemTag.LowerCurrentDefenseArmor:
|
||||
_effectService.LowerCurrentArmorDefense();
|
||||
break;
|
||||
case UsableItemTag.RandomEffect:
|
||||
_effectService.RandomEffect(effectItem);
|
||||
break;
|
||||
case UsableItemTag.DoubleExp:
|
||||
GameRepo.StartDoubleEXP(TimeSpan.FromSeconds(30));
|
||||
_effectService.DoubleExp();
|
||||
GameRepo.CloseInventory();
|
||||
break;
|
||||
case UsableItemTag.TeleportToRandomLocation:
|
||||
@@ -577,11 +587,11 @@ public partial class Game : Node3D, IGame
|
||||
SfxDatabase.Instance.Play(SoundEffect.IncreaseStat);
|
||||
break;
|
||||
case UsableItemTag.DecreaseAttack:
|
||||
_player.AttackComponent.LowerMaximumAttack(effectItem.Stats.BonusAttack);
|
||||
_player.AttackComponent.Reduce(effectItem.Stats.BonusAttack);
|
||||
SfxDatabase.Instance.Play(SoundEffect.DecreaseStat);
|
||||
break;
|
||||
case UsableItemTag.DecreaseDefense:
|
||||
_player.DefenseComponent.LowerMaximumDefense(effectItem.Stats.BonusDefense);
|
||||
_player.DefenseComponent.Reduce(effectItem.Stats.BonusDefense);
|
||||
SfxDatabase.Instance.Play(SoundEffect.DecreaseStat);
|
||||
break;
|
||||
case UsableItemTag.DecreaseLuck:
|
||||
@@ -589,8 +599,8 @@ public partial class Game : Node3D, IGame
|
||||
SfxDatabase.Instance.Play(SoundEffect.DecreaseStat);
|
||||
break;
|
||||
case UsableItemTag.DecreaseAllStats:
|
||||
_player.AttackComponent.LowerMaximumAttack(effectItem.Stats.BonusAttack);
|
||||
_player.DefenseComponent.LowerMaximumDefense(effectItem.Stats.BonusDefense);
|
||||
_player.AttackComponent.Reduce(effectItem.Stats.BonusAttack);
|
||||
_player.DefenseComponent.Reduce(effectItem.Stats.BonusDefense);
|
||||
_player.LuckComponent.DecreaseLuck(effectItem.Stats.BonusLuck);
|
||||
SfxDatabase.Instance.Play(SoundEffect.DecreaseStat);
|
||||
break;
|
||||
@@ -598,6 +608,10 @@ public partial class Game : Node3D, IGame
|
||||
_effectService.MeltAllEquipment(_player);
|
||||
SfxDatabase.Instance.Play(SoundEffect.DecreaseStat);
|
||||
break;
|
||||
case UsableItemTag.RestoreStats:
|
||||
_effectService.RestoreParameters(_player);
|
||||
SfxDatabase.Instance.Play(SoundEffect.IncreaseStat);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -611,6 +625,23 @@ public partial class Game : Node3D, IGame
|
||||
|
||||
public void ShowDebugInfo(bool show) => InGameUI.DebugInfo.Visible = show;
|
||||
|
||||
private void EndDoubleExpTimer()
|
||||
{
|
||||
GameRepo.AnnounceMessageOnMainScreen("Experience points effect wore off.");
|
||||
SfxDatabase.Instance.Play(SoundEffect.MoveUI);
|
||||
_player.ExperiencePointsComponent.ModifyExpGainRate(_player.ExperiencePointsComponent.ExpGainRate.Value / 2);
|
||||
}
|
||||
|
||||
private void GameRepo_EnemyDied(IEnemy obj)
|
||||
{
|
||||
DropRestorative(obj.GlobalPosition);
|
||||
}
|
||||
|
||||
private void BroadcastMessage(string obj)
|
||||
{
|
||||
InGameUI.InventoryMessageUI.DisplayMessage(obj);
|
||||
}
|
||||
|
||||
private void MovePlayer((Vector3 Rotation, Vector3 Position) spawnPoint) => _player.TeleportPlayer(spawnPoint);
|
||||
|
||||
private void OnNewGame()
|
||||
|
||||
Reference in New Issue
Block a user