add C++, Typescript and more stuff
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using KernelPanic.Combat;
|
||||
|
||||
namespace KernelPanic.Core
|
||||
{
|
||||
public sealed class ObservedBackgroundAction : IDisposable
|
||||
{
|
||||
private readonly CardInstance _card;
|
||||
private readonly string _stage, _label;
|
||||
public ObservedBackgroundAction(CardInstance card, string stage, string label)
|
||||
{
|
||||
_card = card; _stage = stage; _label = label;
|
||||
GameEvents.RaiseBackgroundAction(new BackgroundActionEvent(card, stage, label, true));
|
||||
}
|
||||
public void Dispose() => GameEvents.RaiseBackgroundAction(new BackgroundActionEvent(_card, _stage, _label, false));
|
||||
}
|
||||
|
||||
public static partial class GameEvents
|
||||
{
|
||||
// Observation only. These never replay card-play/equipment hooks.
|
||||
public static event Action<CardContributionEvent> CardContribution;
|
||||
public static event Action<BackgroundActionEvent> BackgroundAction;
|
||||
public static void RaiseCardContribution(CardContributionEvent value) => CardContribution?.Invoke(value);
|
||||
public static void RaiseBackgroundAction(BackgroundActionEvent value) => BackgroundAction?.Invoke(value);
|
||||
}
|
||||
|
||||
public readonly struct CardContributionEvent
|
||||
{
|
||||
public CardContributionEvent(CardInstance card, int uptimeDamage = 0, int shieldDamage = 0, int shieldGranted = 0)
|
||||
{ Card = card; UptimeDamage = uptimeDamage; ShieldDamage = shieldDamage; ShieldGranted = shieldGranted; }
|
||||
public CardInstance Card { get; }
|
||||
public int UptimeDamage { get; }
|
||||
public int ShieldDamage { get; }
|
||||
public int ShieldGranted { get; }
|
||||
}
|
||||
|
||||
public readonly struct BackgroundActionEvent
|
||||
{
|
||||
public BackgroundActionEvent(CardInstance card, string stage, string label, bool started)
|
||||
{ Card = card; Stage = stage; Label = label; Started = started; }
|
||||
public CardInstance Card { get; }
|
||||
public string Stage { get; }
|
||||
public string Label { get; }
|
||||
public bool Started { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a60e1bc59f36f3944b9698abf0fa29d0
|
||||
@@ -7,7 +7,7 @@ namespace KernelPanic.Core
|
||||
/// <summary>
|
||||
/// Provides runtime events for gameplay systems that need to observe combat and run milestones.
|
||||
/// </summary>
|
||||
public static class GameEvents
|
||||
public static partial class GameEvents
|
||||
{
|
||||
public static event Action<CardPlayedEvent> CardPlayed;
|
||||
public static event Action<CardResolvedEvent> CardResolved;
|
||||
|
||||
Reference in New Issue
Block a user