Add initial implementation of game mechanics and resources management

This commit is contained in:
2025-08-23 00:38:46 +02:00
commit e12acb0238
91 changed files with 2018 additions and 0 deletions

43
Scripts/Core/GameLogic.cs Normal file
View File

@@ -0,0 +1,43 @@
using System;
namespace ParasiticGod.Scripts.Core;
public class GameLogic
{
public void UpdateGameState(GameState state, double delta)
{
state.Faith += state.FaithPerSecond * delta;
for (var i = state.ActiveBuffs.Count - 1; i >= 0; i--)
{
var buff = state.ActiveBuffs[i];
buff.Duration -= delta;
if (buff.Duration <= 0)
{
state.ActiveBuffs.RemoveAt(i);
}
}
}
public bool TryToPerformMiracle(GameState state, MiracleDefinition miracle)
{
if (state.Faith < miracle.FaithCost || state.Followers < miracle.FollowersRequired)
{
return false;
}
state.Faith -= miracle.FaithCost;
if (miracle.Effects != null)
{
foreach (var effect in miracle.Effects)
{
effect.Execute(state);
}
}
state.Corruption = Math.Clamp(state.Corruption, 0, 100);
return true;
}
}