Update flavor text and balance some stuff
This commit is contained in:
@@ -6,7 +6,7 @@ using KernelPanic.Data;
|
||||
|
||||
namespace KernelPanic.Combat
|
||||
{
|
||||
public enum PythonOperation { Print, Loop, Draw, List, Zip, Async, Inspect, Install, Unattended, Cinnamon, Update, Timeshift }
|
||||
public enum PythonOperation { Print, Loop, Draw, List, Zip, Async, Inspect, Install, Unattended, Cinnamon, Update, Timeshift, Shield }
|
||||
|
||||
public sealed class PythonEffect : ICardEffect
|
||||
{
|
||||
@@ -75,17 +75,16 @@ namespace KernelPanic.Combat
|
||||
{
|
||||
if (previous == card) break;
|
||||
if (!IsPythonCard(previous.Definition)) continue;
|
||||
string id = previous.Definition.Id;
|
||||
if (id == "lang_py_for_loop") loops++;
|
||||
else if (id == "shop_py_zip") areas++;
|
||||
if (HasOperation(previous.Definition, PythonOperation.Loop)) loops++;
|
||||
else if (HasOperation(previous.Definition, PythonOperation.Zip)) areas++;
|
||||
else if (IsPayload(previous.Definition))
|
||||
{
|
||||
if (loops > 0) loops--;
|
||||
if (id is "lang_py_print" or "shop_py_list_append") { if (areas > 0) areas--; }
|
||||
if (id != "mint_cinnamon") damage = true;
|
||||
if (HasOperation(previous.Definition, PythonOperation.Print, PythonOperation.List) && areas > 0) areas--;
|
||||
if (HasOperation(previous.Definition, PythonOperation.Print, PythonOperation.List, PythonOperation.Update)) damage = true;
|
||||
}
|
||||
}
|
||||
return (loops > 0 ? 2 : 1, areas > 0 && card.Definition.Id is "lang_py_print" or "shop_py_list_append", damage, automated);
|
||||
return (loops > 0 ? 2 : 1, areas > 0 && HasOperation(card.Definition, PythonOperation.Print, PythonOperation.List), damage, automated);
|
||||
}
|
||||
public IEnumerable<string> Readout => new[] { $"Python: repeat {_loops.Count} | area {_areas.Count} | scripts {_scripts.Count}/2" }
|
||||
.Concat(_scripts.Select(s => s.Waiting ? $"{s.Name}: waiting for payload"
|
||||
@@ -130,9 +129,12 @@ namespace KernelPanic.Combat
|
||||
public static bool IsPythonCard(CardDefinition card) => card != null && card.Language == Language.Python
|
||||
&& !card.Effects.Any(e => e != null) && CardCatalog.TryGet(card.Id, out var entry)
|
||||
&& entry.Effects.Any(e => e.Kind == CardEffectKind.Python);
|
||||
public static bool IsPayload(CardDefinition card) => IsPythonCard(card)
|
||||
&& card.Id is "lang_py_print" or "shop_py_list_append" or "mint_cinnamon" or "mint_update_manager";
|
||||
public static bool IsAsync(CardDefinition card) => IsPythonCard(card) && card.Id == "shop_py_async_def";
|
||||
private static bool HasOperation(CardDefinition card, params PythonOperation[] operations) => IsPythonCard(card)
|
||||
&& CardCatalog.TryGet(card.Id, out var entry)
|
||||
&& entry.Effects.Any(effect => effect.Kind == CardEffectKind.Python && operations.Contains((PythonOperation)effect.SecondaryAmount));
|
||||
public static bool IsPayload(CardDefinition card) => HasOperation(card,
|
||||
PythonOperation.Print, PythonOperation.List, PythonOperation.Cinnamon, PythonOperation.Update, PythonOperation.Shield);
|
||||
public static bool IsAsync(CardDefinition card) => HasOperation(card, PythonOperation.Async);
|
||||
|
||||
public static int InspectCount(string distroId, int version) =>
|
||||
string.Equals(distroId, "ubuntu", StringComparison.OrdinalIgnoreCase) && version >= 3 ? 5 : 3;
|
||||
@@ -176,14 +178,14 @@ namespace KernelPanic.Combat
|
||||
public void Execute(CombatContext context, PythonOperation operation, int amount)
|
||||
{
|
||||
Bind(context.CombatManager);
|
||||
if (operation is PythonOperation.Print or PythonOperation.List or PythonOperation.Cinnamon or PythonOperation.Update)
|
||||
if (operation is PythonOperation.Print or PythonOperation.List or PythonOperation.Cinnamon or PythonOperation.Update or PythonOperation.Shield)
|
||||
{
|
||||
int value = amount;
|
||||
if (operation == PythonOperation.List) value = CardScaling.Add(value, (int)Math.Min(int.MaxValue, 2L * Math.Max(0, context.Card.QueuePlayCount - 1)));
|
||||
if (operation == PythonOperation.Cinnamon && DamageThisPhase) value = 5;
|
||||
if (operation == PythonOperation.Update && AutomationRan) value = 5;
|
||||
var payload = new Payload { Card = context.Card.CopyForCombat(), Target = context.Targets.FirstOrDefault(), All = operation == PythonOperation.Update };
|
||||
if (operation == PythonOperation.Cinnamon) payload.Shield = CardShieldExecutor.ScaleAmount(value, context);
|
||||
if (operation is PythonOperation.Cinnamon or PythonOperation.Shield) payload.Shield = CardShieldExecutor.ScaleAmount(value, context);
|
||||
else payload.Damage = CardDamageExecutor.ScaleAmount(value, context);
|
||||
// Capture the operation once, before applying any temporary repeat/area transformations.
|
||||
foreach (var script in _scripts.Where(s => s.Waiting))
|
||||
@@ -244,10 +246,11 @@ namespace KernelPanic.Combat
|
||||
}
|
||||
private void Inspect(CombatContext context)
|
||||
{
|
||||
string source = context.Card.Definition.DisplayName;
|
||||
var cards = context.DeckController.PeekTop(InspectCount(_combat.RunConfig?.Distro?.Id, _combat.RunConfig?.DistroVersion ?? 1)).ToArray();
|
||||
if (cards.Length == 0) { _combat.ReportEffectResult("ask ubuntu: draw pile empty"); return; }
|
||||
if (!cards.Any(context.HandController.CanAdd)) { _combat.ReportEffectResult("ask ubuntu: not enough RAM"); return; }
|
||||
Offer("ask ubuntu: choose one card; the others keep their order", cards.Select(c =>
|
||||
if (cards.Length == 0) { _combat.ReportEffectResult(source + ": draw pile empty"); return; }
|
||||
if (!cards.Any(context.HandController.CanAdd)) { _combat.ReportEffectResult(source + ": not enough RAM"); return; }
|
||||
Offer(source + ": choose one card; the others keep their order", cards.Select(c =>
|
||||
new PythonChoiceOption(c, _combat.GetDisplayedPlayCost(c),
|
||||
context.HandController.CanAdd(c) ? $"> take card / {HandController.GetRamCost(c)} RAM" : $"needs {HandController.GetRamCost(c)} free RAM",
|
||||
context.HandController.CanAdd(c))),
|
||||
|
||||
Reference in New Issue
Block a user