add C++, Typescript and more stuff
This commit is contained in:
@@ -89,7 +89,7 @@ namespace KernelPanic.Combat
|
||||
CardEffectKind.ConsultWiki => new ConsultWikiEffect(),
|
||||
CardEffectKind.RandomCommonLanguageCard => new RandomCommonLanguageCardEffect(),
|
||||
CardEffectKind.MinimalInstall => new MinimalInstallEffect(),
|
||||
CardEffectKind.SizeofDamage => new SizeofDamageEffect(),
|
||||
CardEffectKind.SizeofDamage => Language == Language.CPlusPlus ? new CppSizeofDamageEffect() : new SizeofDamageEffect(),
|
||||
CardEffectKind.RepairCorruptedCards => new RepairCorruptedCardsEffect(Amount),
|
||||
_ => throw new InvalidOperationException($"Unsupported authored effect {Kind}.")
|
||||
};
|
||||
@@ -174,7 +174,7 @@ namespace KernelPanic.Combat
|
||||
/// Each built-in card ID is authored once here. Asset IDs and serialized effect overrides
|
||||
/// stay unchanged; adding a card no longer requires parallel effect, targeting and rules switches.
|
||||
/// </summary>
|
||||
public static class CardCatalog
|
||||
public static partial class CardCatalog
|
||||
{
|
||||
private const CardTargeting None = CardTargeting.None;
|
||||
private const CardTargeting Single = CardTargeting.SingleEnemy;
|
||||
@@ -322,6 +322,7 @@ namespace KernelPanic.Combat
|
||||
Add("shop_java_system_gc", None, false, "uses 2 RAM. repair up to {amount:0} corrupted cards in your active deck. gain {shield:1} Shield. advances JIT warmup.", Fx(CardEffectKind.RepairCorruptedCards, 2), Shield(4));
|
||||
Add("shop_java_jit_compile", Single, true, "uses 2 RAM. deal {amount:0}. Java cards cost 1 less this turn." + Jit, Fx(CardEffectKind.FirstToPackage, 8, language: Language.Java));
|
||||
|
||||
AddEvolvedCards(entries);
|
||||
var byId = new Dictionary<string, CardCatalogEntry>(StringComparer.Ordinal);
|
||||
foreach (CardCatalogEntry entry in entries) byId.Add(entry.Id, entry);
|
||||
Entries = entries.AsReadOnly();
|
||||
|
||||
@@ -46,6 +46,8 @@ namespace KernelPanic.Combat
|
||||
{
|
||||
int capacity = request.Target == null ? 0 : CardDamageLanguageRules.GetDamageCapacity(request.Target, request.TrueDamage);
|
||||
DamageResult result = context.DamagePipeline.DealDamage(request);
|
||||
if (ReferenceEquals(request.Source, context.CombatManager.PlayerState) && !ReferenceEquals(request.Target, request.Source))
|
||||
GameEvents.RaiseCardContribution(new CardContributionEvent(context.Card, result.UptimeDamage, result.ShieldDamage));
|
||||
// Preserve ordering: shield conversion precedes enemy death payloads, then spill follows removal queuing.
|
||||
if (request.IsCardDamage)
|
||||
CardDamageLanguageRules.ApplyOverkillShield(context, result, capacity, request.Language, overkillToShield);
|
||||
|
||||
@@ -48,8 +48,8 @@ namespace KernelPanic.Combat
|
||||
private static bool IsSpillDamage(CombatContext context, Language language)
|
||||
{
|
||||
Language cardLanguage = context.Card?.Definition?.Language ?? language;
|
||||
return language == Language.C || language == Language.Java
|
||||
|| cardLanguage == Language.C || cardLanguage == Language.Java;
|
||||
return language is Language.C or Language.CPlusPlus or Language.Java
|
||||
|| cardLanguage is Language.C or Language.CPlusPlus or Language.Java;
|
||||
}
|
||||
|
||||
private static bool SpillOverkillDamage(CombatContext context, CombatantState firstTarget,
|
||||
@@ -87,7 +87,10 @@ namespace KernelPanic.Combat
|
||||
context.CombatManager.ReportEffectResult($"overkill shield blocked: {overkill}");
|
||||
return;
|
||||
}
|
||||
int before = context.Source.Shield;
|
||||
context.CombatManager.GrantPlayerShield(overkill, reason);
|
||||
GameEvents.RaiseCardContribution(new CardContributionEvent(context.Card,
|
||||
shieldGranted: System.Math.Max(0, context.Source.Shield - before)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,7 +203,8 @@ namespace KernelPanic.Combat
|
||||
damage = true;
|
||||
break;
|
||||
case CardEffectKind.SizeofDamage:
|
||||
low = high = effect.Amount * HandAfterPlay(combat, card).Count(c => c.Definition?.Language == Language.C);
|
||||
low = high = effect.Amount * HandAfterPlay(combat, card).Count(c => c.Definition?.Language == Language.C
|
||||
|| effect.Language == Language.CPlusPlus && c.Definition?.Language == Language.CPlusPlus);
|
||||
damage = true;
|
||||
break;
|
||||
case CardEffectKind.ShieldRepeatDamage:
|
||||
@@ -334,7 +335,8 @@ namespace KernelPanic.Combat
|
||||
if (hitCount > 1) notes.Add($"{hitCount} hits in total; later hits can stop when a target dies or combat ends.");
|
||||
if (trueDamage) notes.Add("True damage bypasses Shield.");
|
||||
if (random) notes.Add("Random amounts show the full normal range.");
|
||||
if (critical) notes.Add($"Critical chance: C {CombatTuning.CCriticalChancePercent}%, other languages 25%; each hit rolls independently.");
|
||||
if (critical) notes.Add($"Critical chance: C {CombatTuning.CCriticalChancePercent}%, C++ {CombatTuning.CCriticalChancePercent}%, other languages 25%; each hit rolls independently.");
|
||||
if (card.Definition.Language == Language.CPlusPlus) notes.Add("C++ spills all remaining excess damage. No segfault recoil.");
|
||||
if (card.Definition.Language == Language.C)
|
||||
notes.Add($"C spills {CombatTuning.COverkillSpillPercent}% of remaining overkill per jump, rounded down; spill cannot crit or reapply source bonuses.");
|
||||
if (rust) notes.Add(source.ForceMaxRolls
|
||||
|
||||
@@ -17,7 +17,10 @@ namespace KernelPanic.Combat
|
||||
return;
|
||||
}
|
||||
|
||||
int before = context.Source.Shield;
|
||||
context.CombatManager.GrantPlayerShield(context.ScaleExplicitShield(amount), label);
|
||||
Core.GameEvents.RaiseCardContribution(new Core.CardContributionEvent(context.Card,
|
||||
shieldGranted: System.Math.Max(0, context.Source.Shield - before)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using KernelPanic.Core;
|
||||
|
||||
namespace KernelPanic.Combat
|
||||
{
|
||||
public sealed class ExecutionAction
|
||||
{
|
||||
public string Stage { get; internal set; }
|
||||
public string Label { get; internal set; }
|
||||
public bool Complete { get; internal set; }
|
||||
public long UptimeDamage { get; internal set; }
|
||||
public long ShieldDamage { get; internal set; }
|
||||
public long ShieldGranted { get; internal set; }
|
||||
public long PlayerUptimeLost { get; internal set; }
|
||||
public long PlayerShieldBlocked { get; internal set; }
|
||||
public List<string> Details { get; } = new();
|
||||
}
|
||||
|
||||
/// <summary>A bounded journal of observed actions. Never predicts or executes combat.</summary>
|
||||
public sealed class CombatExecutionTrace : IDisposable
|
||||
{
|
||||
private readonly List<ExecutionAction> _actions = new();
|
||||
private readonly Stack<ExecutionAction> _active = new();
|
||||
private readonly CombatManager _combat;
|
||||
public IReadOnlyList<ExecutionAction> Actions => _actions;
|
||||
public string Stage { get; private set; } = "Native";
|
||||
public event Action Changed;
|
||||
|
||||
public CombatExecutionTrace(CombatManager combat)
|
||||
{
|
||||
_combat = combat;
|
||||
GameEvents.CardResolving += BeginCard;
|
||||
GameEvents.CardResolved += EndCard;
|
||||
GameEvents.BackgroundAction += Background;
|
||||
GameEvents.EnemyWouldAct += BeginEnemy;
|
||||
GameEvents.EnemyActed += EndEnemy;
|
||||
GameEvents.DamageDealt += Damage;
|
||||
GameEvents.CardContribution += Contribution;
|
||||
GameEvents.PhaseChanged += Phase;
|
||||
if (_combat != null) _combat.CombatLog += Detail;
|
||||
}
|
||||
|
||||
private void Begin(string stage, string label)
|
||||
{
|
||||
Stage = stage;
|
||||
var action = new ExecutionAction { Stage = stage, Label = label };
|
||||
_actions.Add(action); _active.Push(action);
|
||||
if (_actions.Count > 12) _actions.RemoveAt(0);
|
||||
Changed?.Invoke();
|
||||
}
|
||||
private void End()
|
||||
{
|
||||
if (_active.Count > 0) _active.Pop().Complete = true;
|
||||
Changed?.Invoke();
|
||||
}
|
||||
private void BeginCard(CardResolvedEvent value) => Begin(value.Track switch
|
||||
{ ResolutionTrack.InterpreterQueue => "FIFO", ResolutionTrack.LazyStack => "LIFO", _ => "Native" }, value.Card?.Definition?.DisplayName ?? "Card");
|
||||
private void EndCard(CardResolvedEvent value) => End();
|
||||
private void Background(BackgroundActionEvent value)
|
||||
{ if (value.Started) Begin(value.Stage, value.Label); else End(); }
|
||||
private void BeginEnemy(EnemyWouldActEvent value) => Begin("Enemies", value.Enemy.Name + " / " + value.Enemy.DisplayIntent.DisplayText);
|
||||
private void EndEnemy(EnemyActedEvent value) => End();
|
||||
private void Damage(DamageDealtEvent value)
|
||||
{
|
||||
bool standalone = _active.Count == 0;
|
||||
if (standalone) Begin(Stage, value.Cause ?? "Status or passive damage");
|
||||
var action = _active.Peek();
|
||||
if (_combat != null && ReferenceEquals(value.Target, _combat.PlayerState))
|
||||
{
|
||||
action.PlayerUptimeLost += Math.Max(0, value.UptimeDamage);
|
||||
action.PlayerShieldBlocked += Math.Max(0, value.ShieldDamage);
|
||||
}
|
||||
else
|
||||
{
|
||||
action.UptimeDamage += Math.Max(0, value.UptimeDamage);
|
||||
action.ShieldDamage += Math.Max(0, value.ShieldDamage);
|
||||
}
|
||||
if (standalone) End();
|
||||
Changed?.Invoke();
|
||||
}
|
||||
private void Contribution(CardContributionEvent value)
|
||||
{
|
||||
if (_active.Count == 0) return;
|
||||
_active.Peek().ShieldGranted += Math.Max(0, value.ShieldGranted);
|
||||
Changed?.Invoke();
|
||||
}
|
||||
private void Detail(string text)
|
||||
{
|
||||
if (_active.Count == 0 || string.IsNullOrWhiteSpace(text)) return;
|
||||
var details = _active.Peek().Details;
|
||||
if (details.Count == 3) details.RemoveAt(0);
|
||||
details.Add(text);
|
||||
Changed?.Invoke();
|
||||
}
|
||||
private void Phase(PhaseChangedEvent value)
|
||||
{
|
||||
if (value.NextPhase == TurnPhase.Boot) { _actions.Clear(); _active.Clear(); }
|
||||
Stage = value.NextPhase switch
|
||||
{
|
||||
TurnPhase.Interpret => "Go", TurnPhase.EnemyProcess => "Enemies",
|
||||
TurnPhase.GarbageCollection => "Cleanup", _ => "Native"
|
||||
};
|
||||
// Completed results stay readable during the next planning phase.
|
||||
Changed?.Invoke();
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
GameEvents.CardResolving -= BeginCard; GameEvents.CardResolved -= EndCard;
|
||||
GameEvents.BackgroundAction -= Background;
|
||||
GameEvents.EnemyWouldAct -= BeginEnemy; GameEvents.EnemyActed -= EndEnemy;
|
||||
GameEvents.DamageDealt -= Damage; GameEvents.CardContribution -= Contribution;
|
||||
GameEvents.PhaseChanged -= Phase;
|
||||
if (_combat != null) _combat.CombatLog -= Detail;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6022b4bda31aa9a48a5e9db43f5713e7
|
||||
@@ -129,6 +129,7 @@ namespace KernelPanic.Combat
|
||||
CardScaling.Add(_playerState?.FlatEffectBonus ?? 0, _playerState?.FlatCardDamageBonus ?? 0));
|
||||
internal void ResolveGoroutineTick(Goroutine work)
|
||||
{
|
||||
using var observed = new ObservedBackgroundAction(work.SourceCard, "Go", $"PID {work.Id:000} / {work.SourceCard.Definition.DisplayName}");
|
||||
if (!IsLiveGoTarget(work.Target)) work.Target = FirstLivingGoTarget();
|
||||
StateChanged?.Invoke();
|
||||
if (work.Target == null) { Log($"[go] PID {work.Id:000} skipped / no living target"); return; }
|
||||
|
||||
@@ -1479,6 +1479,7 @@ namespace KernelPanic.Combat
|
||||
|
||||
private void GarbageCollect()
|
||||
{
|
||||
using var observed = new ObservedBackgroundAction(null, "Cleanup", "Status ticks and delayed effects");
|
||||
_selectedEnemyIndex = -1;
|
||||
_pendingTargetCard = null;
|
||||
_statusEffects.Tick(_playerState, StatusTickTiming.EndOfTurn, _playerState, _damagePipeline);
|
||||
|
||||
@@ -19,6 +19,9 @@ namespace KernelPanic.Combat
|
||||
public int ShieldBlocked { get; private set; }
|
||||
public string KillingAction { get; private set; }
|
||||
public Func<bool> SurrenderRequested { get; set; }
|
||||
private readonly RunPerformanceSnapshot _performance = new();
|
||||
public Func<RunPerformanceSnapshot> PerformanceSource { get; set; }
|
||||
private RunPerformanceSnapshot Performance => PerformanceSource?.Invoke() ?? _performance;
|
||||
public IReadOnlyCollection<string> IncomingHits => _hits;
|
||||
|
||||
public CombatRunTelemetry(Func<CombatantState> player, Func<CombatantState, string> describeSource)
|
||||
@@ -28,8 +31,13 @@ namespace KernelPanic.Combat
|
||||
GameEvents.PhaseChanged += OnPhaseChanged;
|
||||
GameEvents.DamageDealt += ObserveDamage;
|
||||
GameEvents.WaveAdvanced += OnWaveAdvanced;
|
||||
GameEvents.CardPlayed += ObservePlay;
|
||||
GameEvents.CardContribution += ObserveContribution;
|
||||
}
|
||||
|
||||
private void ObservePlay(CardPlayedEvent payload) => Performance.RecordPlay(payload.Card);
|
||||
private void ObserveContribution(CardContributionEvent payload) => Performance.Record(payload);
|
||||
|
||||
public void BeginRound()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(KillingAction)) return;
|
||||
@@ -70,6 +78,8 @@ namespace KernelPanic.Combat
|
||||
{
|
||||
DamageTaken += Math.Max(0, payload.UptimeDamage);
|
||||
ShieldBlocked += Math.Max(0, payload.ShieldDamage);
|
||||
Performance.damageTaken += Math.Max(0, payload.UptimeDamage);
|
||||
Performance.shieldBlocked += Math.Max(0, payload.ShieldDamage);
|
||||
string cause = !string.IsNullOrWhiteSpace(payload.Cause) ? payload.Cause
|
||||
: _describeSource?.Invoke(payload.Source) ?? "Unattributed system damage";
|
||||
string hit = $"{cause}: {payload.UptimeDamage} uptime / {payload.ShieldDamage} shield" +
|
||||
@@ -83,7 +93,10 @@ namespace KernelPanic.Combat
|
||||
KillingAction = hit;
|
||||
}
|
||||
else if (ReferenceEquals(payload.Source, player))
|
||||
{
|
||||
DamageDealt += Math.Max(0, payload.UptimeDamage);
|
||||
Performance.damageDealt += Math.Max(0, payload.UptimeDamage);
|
||||
}
|
||||
}
|
||||
|
||||
public void FillReport(RunHistoryEntry entry)
|
||||
@@ -94,6 +107,7 @@ namespace KernelPanic.Combat
|
||||
entry.shieldBlocked = ShieldBlocked;
|
||||
entry.cause = entry.surrendered ? "Shutdown signal accepted." : KillingAction ?? "Uptime reached 0; no damaging action recorded.";
|
||||
entry.finalHits = new List<string>(_hits);
|
||||
entry.performance = Performance.Copy();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
@@ -101,6 +115,8 @@ namespace KernelPanic.Combat
|
||||
GameEvents.PhaseChanged -= OnPhaseChanged;
|
||||
GameEvents.DamageDealt -= ObserveDamage;
|
||||
GameEvents.WaveAdvanced -= OnWaveAdvanced;
|
||||
GameEvents.CardPlayed -= ObservePlay;
|
||||
GameEvents.CardContribution -= ObserveContribution;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,13 +239,13 @@ namespace KernelPanic.Combat
|
||||
return amount;
|
||||
}
|
||||
|
||||
int critChance = request.Language == Language.C ? CombatTuning.CCriticalChancePercent : 25;
|
||||
int critChance = request.Language is Language.C or Language.CPlusPlus ? CombatTuning.CCriticalChancePercent : 25;
|
||||
wasCritical = RandomRoll.RollRange(1, 100, new RollContext(request.Source)) <= critChance;
|
||||
return wasCritical ? ScaleCritical(amount) : amount;
|
||||
}
|
||||
|
||||
private static bool CanRollCritical(DamageRequest request, int amount) =>
|
||||
request.CanCrit && amount > 0 && amount != int.MaxValue && !(request.Source?.ForceMaxRolls ?? false);
|
||||
request.CanCrit && request.Language != Language.TypeScript && amount > 0 && amount != int.MaxValue && !(request.Source?.ForceMaxRolls ?? false);
|
||||
|
||||
private static int ScaleCritical(int amount) =>
|
||||
(int)System.Math.Min(int.MaxValue, ((long)amount * 3 + 1) / 2);
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace KernelPanic.Combat
|
||||
// A stable integer mixer, independent of both gameplay random streams and runtime hash codes.
|
||||
public static EncounterPlan Plan(int wave, WaveRoute route, int seed, int revision)
|
||||
{
|
||||
if (revision >= 3 && wave >= 5 && wave <= 9) return VariedCampaignPlan(wave, route, seed);
|
||||
if (revision >= 2) return CampaignPlan(wave, route, seed);
|
||||
if (revision == 0) return Plan(wave, route);
|
||||
uint hash = unchecked((uint)seed ^ ((uint)wave * 0x9E3779B9u));
|
||||
@@ -125,6 +126,37 @@ namespace KernelPanic.Combat
|
||||
return new EncounterPlan(title, advice, Math.Max(0, wave - 1) * CombatTuning.EnemyUptimeGrowthPerWave, enemies);
|
||||
}
|
||||
|
||||
private static EncounterPlan VariedCampaignPlan(int wave, WaveRoute route, int seed)
|
||||
{
|
||||
uint hash = unchecked((uint)seed ^ ((uint)wave * 0x9E3779B9u));
|
||||
hash ^= hash >> 16; hash = unchecked(hash * 0x7FEB352Du); hash ^= hash >> 15;
|
||||
int variant = (int)(hash % 3);
|
||||
if (variant == 0) return CampaignPlan(wave, route, seed);
|
||||
var baseline = CampaignPlan(wave, route, seed);
|
||||
var (title, advice, enemies) = (wave, variant) switch
|
||||
{
|
||||
(5, 1) => ("Replicating privileges", "Fork Bomb copies itself after acting. Kill it early to expose Rootkit, which resists damage while allies remain.", new[] { "rootkit", "fork_bomb", "zombie_process" }),
|
||||
(5, _) => ("Scheduled escalation", "Cron Job counts down while Memory Leak grows. Remove urgent threats to expose Rootkit.", new[] { "rootkit", "cron_job", "memory_leak" }),
|
||||
(6, 1) => ("Protected telemetry", "Firewalld protects Telemetry Collector. Break through Shield before resource interference wears down your build.", new[] { "telemetry_collector", "firewalld", "zombie_process" }),
|
||||
(6, _) => ("Scheduled collection", "Telemetry Collector interferes with resources while two Cron Jobs count down. Front-load damage or prepare defense for their heavy attacks.", new[] { "telemetry_collector", "cron_job", "cron_job" }),
|
||||
(7, 1) => ("Growing restrictions", "DRM Guardian and Firewalld shelter a growing Memory Leak. Pick a target you can finish before its next turn.", new[] { "drm_guardian", "firewalld", "memory_leak" }),
|
||||
(7, _) => ("Licensed replication", "Fork Bomb multiplies behind DRM Guardian's defenses. Segfault leaves a death payload; reserve damage for the process it creates.", new[] { "drm_guardian", "fork_bomb", "segfault" }),
|
||||
(8, 1) => ("Leaking concurrency", "Race partners can swap order and the survivor enrages. Memory Leak grows each round; balance paired kills against stopping its growth.", new[] { "race_condition", "race_condition", "memory_leak" }),
|
||||
(8, _) => ("Veiled concurrency", "Damage the Daemon to reveal its committed action. Race partners can swap order; killing one enrages the survivor.", new[] { "race_condition", "race_condition", "daemon" }),
|
||||
(9, 1) => ("Leaking kernel", "Kernel Panic pressures RAM while Memory Leak grows. Firewalld adds defense; use efficient attacks and leave room to draw.", new[] { "kernel_panic", "memory_leak", "firewalld" }),
|
||||
_ => ("Scheduled panic", "Kernel Panic pressures RAM, Cron Job counts down, and Segfault leaves a death payload. Save a follow-up for the new process.", new[] { "kernel_panic", "cron_job", "segfault" })
|
||||
};
|
||||
var composition = new List<string>(enemies);
|
||||
if (route == WaveRoute.Challenge)
|
||||
{
|
||||
composition.Add("daemon"); title += " (elite)";
|
||||
advice += baseline.EscortShield > 0 ? " Extra Daemon: 6 starting Shield, hidden intent."
|
||||
: baseline.EscortUptime > 0 ? " Extra Daemon: +4 Uptime, hidden intent." : " Extra Daemon: hidden intent.";
|
||||
}
|
||||
return new EncounterPlan(title, advice, baseline.UptimeBonus, composition.ToArray())
|
||||
{ EscortShield = baseline.EscortShield, EscortUptime = baseline.EscortUptime };
|
||||
}
|
||||
|
||||
private static EncounterPlan CampaignPlan(int wave, WaveRoute route, int seed)
|
||||
{
|
||||
// Keep introductory encounters familiar; introduce the heavier systems before the final boss.
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using KernelPanic.Core;
|
||||
|
||||
namespace KernelPanic.Combat
|
||||
{
|
||||
public sealed class CppSizeofDamageEffect : ICardEffect
|
||||
{
|
||||
public void Execute(CombatContext context)
|
||||
{
|
||||
int count = context.HandController.Cards.Count(c => c.Definition?.Language is Language.C or Language.CPlusPlus);
|
||||
new DealDamageEffect(6 * count, 6 * count, Language.CPlusPlus).Execute(context);
|
||||
}
|
||||
}
|
||||
|
||||
public static partial class CardCatalog
|
||||
{
|
||||
private static void AddEvolvedCards(List<CardCatalogEntry> entries)
|
||||
{
|
||||
const string cpp = " Full overkill spills. No segfault recoil.";
|
||||
void Add(string id, CardTargeting target, bool bleeding, string rules, params CardEffectSpec[] effects)
|
||||
=> entries.Add(new CardCatalogEntry(id, target, bleeding, rules, effects));
|
||||
CardEffectSpec Typed(int amount, bool all = false) => new(CardEffectKind.Damage, amount,
|
||||
language: Language.TypeScript, allEnemies: all, canCrit: false);
|
||||
Add("lang_cpp_malloc", Single, true, "deal {amount:0}." + cpp, Damage(15, Language.CPlusPlus));
|
||||
Add("lang_cpp_printf", Single, true, "deal {amount:0}. repair {amount:1} corrupted cards." + cpp,
|
||||
Damage(6, Language.CPlusPlus), Fx(CardEffectKind.RepairCorruptedCards, 2));
|
||||
Add("lang_cpp_pointer", Single, true, "deal {amount:0}; {secondary:0} if the previous card was C++." + cpp,
|
||||
Fx(CardEffectKind.PreviousLanguageDamage, 12, secondary: 20, language: Language.CPlusPlus));
|
||||
Add("shop_cpp_free", Single, true, "deal {amount:0}. repair {amount:1} corrupted cards. draw 2 (fixed)." + cpp,
|
||||
Damage(22, Language.CPlusPlus), Fx(CardEffectKind.RepairCorruptedCards, 2), Fx(CardEffectKind.FixedDraw, 2));
|
||||
Add("shop_cpp_sizeof", Single, true, "deal 6 x C and C++ cards in hand." + cpp,
|
||||
Fx(CardEffectKind.SizeofDamage, 6, language: Language.CPlusPlus));
|
||||
Add("shop_cpp_kernel_exploit", Single, true, "deal {amount:0} ignoring Shield." + cpp, Damage(40, Language.CPlusPlus, trueDamage: true));
|
||||
Add("shop_cpp_gdb", None, false, "repair {amount:0} corrupted cards. draw {amount:1}.", Fx(CardEffectKind.RepairCorruptedCards, 3), Draw(2));
|
||||
Add("shop_cpp_valgrind", None, false, "repair {amount:0} corrupted cards. gain {shield:1} Shield.", Fx(CardEffectKind.RepairCorruptedCards, 4), Shield(9));
|
||||
Add("shop_cpp_memcpy", Single, true, "deal {amount:0}. draw 1 (fixed)." + cpp, Damage(9, Language.CPlusPlus), Fx(CardEffectKind.FixedDraw, 1));
|
||||
Add("shop_cpp_memset", All, true, "deal {amount:0} to all enemies." + cpp, Damage(6, Language.CPlusPlus, all: true));
|
||||
Add("shop_cpp_realloc", Single, true, "deal {amount:0}. repair {amount:1} corrupted cards." + cpp, Damage(16, Language.CPlusPlus), Fx(CardEffectKind.RepairCorruptedCards, 3));
|
||||
const string fixedHit = " Fixed damage; no critical roll.";
|
||||
Add("lang_ts_console_log", Single, true, "deal {amount:0}." + fixedHit, Typed(9));
|
||||
Add("lang_ts_fetch", Single, true, "deal {amount:0}." + fixedHit, Typed(13));
|
||||
Add("lang_ts_typeof", Single, true, "deal {amount:0}. Always succeeds." + fixedHit, Typed(16));
|
||||
Add("shop_ts_math_random", Single, true, "deal {amount:0}." + fixedHit, Typed(20));
|
||||
Add("shop_ts_promise_all", Single, true, "deal {amount:0} three times." + fixedHit, Typed(10), Typed(10), Typed(10));
|
||||
Add("shop_ts_spread", None, false, "copy the lowest-cost card in hand. gain {shield:1} Shield.", Fx(CardEffectKind.CopyLowestCostHandCard), Shield(3));
|
||||
Add("shop_ts_array_map", All, true, "deal {amount:0} to each enemy." + fixedHit, Typed(6, true));
|
||||
Add("shop_ts_promise_resolve", Single, true, "deal {amount:0}." + fixedHit, Typed(5));
|
||||
Add("shop_ts_try_catch", None, false, "gain {shield:0} Shield. cleanse harmful statuses.", Shield(8), Fx(CardEffectKind.Cleanse));
|
||||
Add("shop_ts_json_parse", Single, true, "deal {amount:0}. draw 1 (fixed)." + fixedHit, Typed(9), Fx(CardEffectKind.FixedDraw, 1));
|
||||
Add("shop_ts_eval", Single, true, "deal {amount:0}." + fixedHit, Typed(30));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 04b71832a8f90724d9e23cc2e64797cd
|
||||
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
|
||||
namespace KernelPanic.Combat
|
||||
{
|
||||
public enum NixGovernorSwitchBlockReason
|
||||
{
|
||||
None,
|
||||
InvalidGovernor,
|
||||
Inactive,
|
||||
AlreadySelected,
|
||||
AlreadySwitchedThisRound,
|
||||
InsufficientCycles,
|
||||
SwitchingInProgress,
|
||||
TutorialActive,
|
||||
OutsideExecutePhase,
|
||||
CombatUnavailable,
|
||||
NoLivingTarget
|
||||
}
|
||||
|
||||
public static class NixGovernorSwitchFeedback
|
||||
{
|
||||
public static string GetMessage(this NixGovernorSwitchBlockReason reason) => reason switch
|
||||
{
|
||||
NixGovernorSwitchBlockReason.None => null,
|
||||
NixGovernorSwitchBlockReason.InvalidGovernor => "unknown governor",
|
||||
NixGovernorSwitchBlockReason.Inactive => "CPU governors are unavailable for this wave",
|
||||
NixGovernorSwitchBlockReason.AlreadySelected => "this governor is already active",
|
||||
NixGovernorSwitchBlockReason.AlreadySwitchedThisRound => "already switched governor this turn",
|
||||
NixGovernorSwitchBlockReason.InsufficientCycles => "not enough Cycles to switch governor",
|
||||
NixGovernorSwitchBlockReason.SwitchingInProgress => "a governor switch is resolving",
|
||||
NixGovernorSwitchBlockReason.TutorialActive => "governor switching is unavailable during the tutorial",
|
||||
NixGovernorSwitchBlockReason.OutsideExecutePhase => "governors can only be switched during Execute",
|
||||
NixGovernorSwitchBlockReason.CombatUnavailable => "governor switching is unavailable while combat is resolving or inactive",
|
||||
NixGovernorSwitchBlockReason.NoLivingTarget => "performance requires a living enemy for its specialisation",
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(reason), reason, "Unknown switch rejection reason.")
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9dd0a76aad8942d48a5e52cc28879d79
|
||||
@@ -150,6 +150,7 @@ namespace KernelPanic.Combat
|
||||
if (script.Waiting || script.Restore || round < script.FirstRound || round <= script.LastRunRound) continue;
|
||||
script.LastRunRound = round;
|
||||
AutomationRan = true;
|
||||
using var observed = new ObservedBackgroundAction(script.Payload.Card, "Automation", script.Name + " / " + script.Payload.Card.Definition.DisplayName);
|
||||
Run(script.Payload, script.Payload.All);
|
||||
if (--script.Remaining == 0) _scripts.Remove(script);
|
||||
if (_combat.RunFinished || _combat.AwaitingWaveContinue || _combat.PlayerState.IsDefeated) break;
|
||||
|
||||
Reference in New Issue
Block a user