add missing files

This commit is contained in:
2026-10-24 00:54:13 +02:00
parent ec3e784683
commit ce564c10a3
237 changed files with 5733 additions and 0 deletions
+45
View File
@@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using KernelPanic.Data;
using KernelPanic.Meta;
namespace KernelPanic.Combat
{
/// <summary>Pure package pricing shared by actual plays and hypothetical card previews.</summary>
public static class PackageCostRules
{
public static int Apply(int cost, IReadOnlyList<PackageInstance> packages, string distroId,
int cardsPlayedThisTurn, int cardsPlayedThisWave, List<string> breakdown = null)
{
if (cost <= 0 || packages == null) return cost;
int nextTurnCard = cardsPlayedThisTurn + 1;
int nextWaveCard = cardsPlayedThisWave + 1;
foreach (var package in packages)
{
if (package?.Definition == null) continue;
int before = Math.Max(0, cost);
foreach (var effect in package.EffectsFor(distroId))
{
switch (effect.Kind)
{
case PackageEffectKind.FirstCardEachRoundDiscountAndShield:
if (nextTurnCard == 1) cost -= 1;
break;
case PackageEffectKind.FirstCardEachWaveCostReduction:
if (nextWaveCard == 1) cost -= Math.Max(0, effect.Amount);
break;
case PackageEffectKind.EveryNthCardEachWaveFree:
if (effect.Threshold > 0 && nextWaveCard % effect.Threshold == 0) cost = 0;
break;
case PackageEffectKind.FirstCardsEachTurnCostReduction:
if (nextTurnCard <= Math.Max(0, effect.Threshold)) cost -= Math.Max(0, effect.Amount);
break;
}
}
int reduction = before - Math.Max(0, cost);
if (reduction > 0) breakdown?.Add($"{package.Definition.DisplayName}: -{reduction}");
}
return cost;
}
}
}