Add new miracles: Divine Mandate and Prosperity Boom; update buff application logic and game state calculations
This commit is contained in:
@@ -23,7 +23,9 @@ public partial class ApplyBuffEffect : Effect
|
||||
{
|
||||
Name = $"{TargetStat} x{Multiplier}",
|
||||
Multiplier = Multiplier,
|
||||
Duration = Duration
|
||||
Duration = Duration,
|
||||
TargetStat = TargetStat,
|
||||
BuffId = BuffId
|
||||
};
|
||||
|
||||
gameState.ActiveBuffs.Add(newBuff);
|
||||
|
@@ -4,9 +4,10 @@ namespace ParasiticGod.Scripts.Core.Effects;
|
||||
|
||||
public class Buff
|
||||
{
|
||||
public Guid InstanceId { get; } = Guid.NewGuid(); // Unique identifier
|
||||
public string BuffId { get; set; } // Identifier for the type of buff
|
||||
public string Name { get; set; } // For display purposes
|
||||
public Guid InstanceId { get; } = Guid.NewGuid();
|
||||
public string BuffId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public Stat TargetStat { get; set; }
|
||||
public float Multiplier { get; set; } = 1.0f;
|
||||
public double Duration { get; set; }
|
||||
}
|
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using ParasiticGod.Scripts.Singletons;
|
||||
|
||||
namespace ParasiticGod.Scripts.Core;
|
||||
@@ -12,12 +13,29 @@ public class GameLogic
|
||||
{
|
||||
totalMultiplier *= buff.Multiplier;
|
||||
}
|
||||
var faithPerSecond = state.Get(Stat.Followers) * state.Get(Stat.FaithPerFollower) * totalMultiplier;
|
||||
|
||||
var faithMultiplier = state.ActiveBuffs
|
||||
.Where(b => b.TargetStat == Stat.FaithPerFollower)
|
||||
.Aggregate(1.0f, (acc, buff) => acc * buff.Multiplier);
|
||||
var productionMultiplier = state.ActiveBuffs
|
||||
.Where(b => b.TargetStat == Stat.ProductionPerSecond)
|
||||
.Aggregate(1.0f, (acc, buff) => acc * buff.Multiplier);
|
||||
var followerMultiplier = state.ActiveBuffs
|
||||
.Where(b => b.TargetStat == Stat.FollowersPerSecond)
|
||||
.Aggregate(1.0f, (acc, buff) => acc * buff.Multiplier);
|
||||
var corruptionMultiplier = state.ActiveBuffs
|
||||
.Where(b => b.TargetStat == Stat.CorruptionPerSecond)
|
||||
.Aggregate(1.0f, (acc, buff) => acc * buff.Multiplier);
|
||||
|
||||
var faithPerSecond = state.Get(Stat.Followers) * state.Get(Stat.FaithPerFollower) * faithMultiplier;
|
||||
var productionPerSecond = state.Get(Stat.ProductionPerSecond) * productionMultiplier;
|
||||
var followersPerSecond = state.Get(Stat.FollowersPerSecond) * followerMultiplier;
|
||||
var corruptionPerSecond = state.Get(Stat.CorruptionPerSecond) * corruptionMultiplier;
|
||||
|
||||
state.Modify(Stat.Faith, faithPerSecond * delta);
|
||||
state.Modify(Stat.Production, state.Get(Stat.ProductionPerSecond) * delta);
|
||||
state.Modify(Stat.Corruption, state.Get(Stat.CorruptionPerSecond) * delta);
|
||||
state.Modify(Stat.Followers, state.Get(Stat.FollowersPerSecond) * delta);
|
||||
state.Modify(Stat.Production, productionPerSecond * delta);
|
||||
state.Modify(Stat.Corruption, corruptionPerSecond * delta);
|
||||
state.Modify(Stat.Followers, followersPerSecond * delta);
|
||||
|
||||
for (var i = state.ActiveBuffs.Count - 1; i >= 0; i--)
|
||||
{
|
||||
|
@@ -24,6 +24,7 @@ public class GameState
|
||||
Set(Stat.FaithPerFollower, 0.5);
|
||||
Set(Stat.ProductionPerSecond, 0.0);
|
||||
Set(Stat.CorruptionPerSecond, 0.01);
|
||||
Set(Stat.FollowersPerSecond, 0);
|
||||
}
|
||||
|
||||
public double Get(Stat stat) => _stats[stat].Value;
|
||||
|
Reference in New Issue
Block a user