221 lines
7.8 KiB
C#
221 lines
7.8 KiB
C#
#nullable enable
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace ReplacedPerson.Core
|
|
{
|
|
public enum ReplacedEffectType
|
|
{
|
|
Attack = 0,
|
|
Dodge = 1,
|
|
Counter = 2
|
|
}
|
|
|
|
public enum ReplacedMatchPhase
|
|
{
|
|
AwaitingLead = 0,
|
|
AwaitingResponse = 1,
|
|
Resolving = 2,
|
|
Completed = 3
|
|
}
|
|
|
|
public enum ReplacedWinner
|
|
{
|
|
None = -1,
|
|
PlayerOne = 0,
|
|
PlayerTwo = 1,
|
|
Draw = 2
|
|
}
|
|
|
|
[Serializable]
|
|
public sealed class ReplacedCardDefinition
|
|
{
|
|
public string Id { get; set; } = string.Empty;
|
|
public string Name { get; set; } = string.Empty;
|
|
public string Description { get; set; } = string.Empty;
|
|
public ReplacedEffectType EffectType { get; set; }
|
|
public int Cost { get; set; }
|
|
public int BaseValue { get; set; }
|
|
public int Factor { get; set; }
|
|
public string SpecialEffectId { get; set; } = string.Empty;
|
|
}
|
|
|
|
[Serializable]
|
|
public sealed class ReplacedEndCardDefinition
|
|
{
|
|
public string Id { get; set; } = string.Empty;
|
|
public string Name { get; set; } = string.Empty;
|
|
public string Description { get; set; } = string.Empty;
|
|
public int Cost { get; set; }
|
|
public int[] SlotBase { get; set; } = new int[3];
|
|
public int[] SlotFactor { get; set; } = new int[3];
|
|
}
|
|
|
|
[Serializable]
|
|
public sealed class ReplacedEnemyDefinition
|
|
{
|
|
public string Id { get; set; } = string.Empty;
|
|
public string Name { get; set; } = string.Empty;
|
|
public int MaxHealth { get; set; } = 30;
|
|
public List<string> NormalDeck { get; set; } = new();
|
|
public List<string> EndDeck { get; set; } = new();
|
|
public List<string> RewardIds { get; set; } = new();
|
|
}
|
|
|
|
[Serializable]
|
|
public sealed class ReplacedDeck
|
|
{
|
|
public List<string> NormalCards { get; set; } = new();
|
|
public List<string> EndCards { get; set; } = new();
|
|
|
|
public ReplacedDeck Clone() => new()
|
|
{
|
|
NormalCards = new List<string>(NormalCards),
|
|
EndCards = new List<string>(EndCards)
|
|
};
|
|
}
|
|
|
|
[Serializable]
|
|
public sealed class ReplacedTurnSubmission
|
|
{
|
|
public bool Pass { get; set; }
|
|
public bool DiscardEndOnPass { get; set; }
|
|
public List<string> NormalCardIds { get; set; } = new();
|
|
public List<string> EndCardIds { get; set; } = new();
|
|
public int RerollSlot { get; set; } = -1;
|
|
|
|
public ReplacedTurnSubmission Clone() => new()
|
|
{
|
|
Pass = Pass,
|
|
DiscardEndOnPass = DiscardEndOnPass,
|
|
NormalCardIds = new List<string>(NormalCardIds),
|
|
EndCardIds = new List<string>(EndCardIds),
|
|
RerollSlot = RerollSlot
|
|
};
|
|
}
|
|
|
|
[Serializable]
|
|
public sealed class ReplacedMatchCommand
|
|
{
|
|
public long Sequence { get; set; }
|
|
public string IdempotencyToken { get; set; } = string.Empty;
|
|
public int PlayerIndex { get; set; }
|
|
public ReplacedTurnSubmission Submission { get; set; } = new();
|
|
|
|
public ReplacedMatchCommand Clone() => new()
|
|
{
|
|
Sequence = Sequence,
|
|
IdempotencyToken = IdempotencyToken,
|
|
PlayerIndex = PlayerIndex,
|
|
Submission = Submission.Clone()
|
|
};
|
|
}
|
|
|
|
[Serializable]
|
|
public sealed class ReplacedPlayerState
|
|
{
|
|
public string PlayerId { get; set; } = string.Empty;
|
|
public string DisplayName { get; set; } = string.Empty;
|
|
public int Health { get; set; } = 30;
|
|
public int MaxHealth { get; set; } = 30;
|
|
public int Cost { get; set; } = 10;
|
|
public int Defense { get; set; }
|
|
public int BonusNormalDraw { get; set; }
|
|
public bool GuaranteedDodge { get; set; }
|
|
public bool SkipNextEndDraw { get; set; }
|
|
public int SpentThisRound { get; set; }
|
|
public int EffectiveEffectsThisRound { get; set; }
|
|
public int DamageThisRound { get; set; }
|
|
public List<string> NormalDrawPile { get; set; } = new();
|
|
public List<string> NormalDiscard { get; set; } = new();
|
|
public List<string> NormalHand { get; set; } = new();
|
|
public List<string> EndDrawPile { get; set; } = new();
|
|
public List<string> EndDiscard { get; set; } = new();
|
|
public List<string> EndHand { get; set; } = new();
|
|
|
|
public ReplacedPlayerState Clone() => new()
|
|
{
|
|
PlayerId = PlayerId,
|
|
DisplayName = DisplayName,
|
|
Health = Health,
|
|
MaxHealth = MaxHealth,
|
|
Cost = Cost,
|
|
Defense = Defense,
|
|
BonusNormalDraw = BonusNormalDraw,
|
|
GuaranteedDodge = GuaranteedDodge,
|
|
SkipNextEndDraw = SkipNextEndDraw,
|
|
SpentThisRound = SpentThisRound,
|
|
EffectiveEffectsThisRound = EffectiveEffectsThisRound,
|
|
DamageThisRound = DamageThisRound,
|
|
NormalDrawPile = new List<string>(NormalDrawPile),
|
|
NormalDiscard = new List<string>(NormalDiscard),
|
|
NormalHand = new List<string>(NormalHand),
|
|
EndDrawPile = new List<string>(EndDrawPile),
|
|
EndDiscard = new List<string>(EndDiscard),
|
|
EndHand = new List<string>(EndHand)
|
|
};
|
|
}
|
|
|
|
[Serializable]
|
|
public sealed class ReplacedSlotResolution
|
|
{
|
|
public int SlotIndex { get; set; }
|
|
public ReplacedEffectType PlayerOneType { get; set; }
|
|
public ReplacedEffectType PlayerTwoType { get; set; }
|
|
public int PlayerOneRoll { get; set; }
|
|
public int PlayerTwoRoll { get; set; }
|
|
public int PlayerOneValue { get; set; }
|
|
public int PlayerTwoValue { get; set; }
|
|
public int DamageToPlayerOne { get; set; }
|
|
public int DamageToPlayerTwo { get; set; }
|
|
public bool PlayerOneRerolled { get; set; }
|
|
public bool PlayerTwoRerolled { get; set; }
|
|
public string Summary { get; set; } = string.Empty;
|
|
}
|
|
|
|
[Serializable]
|
|
public sealed class ReplacedMatchState
|
|
{
|
|
public int Round { get; set; }
|
|
public int LeadPlayer { get; set; }
|
|
public int InitiativeRoll { get; set; }
|
|
public ReplacedMatchPhase Phase { get; set; }
|
|
public ReplacedWinner Winner { get; set; } = ReplacedWinner.None;
|
|
public bool IsLastStand { get; set; }
|
|
public bool LastStandUsed { get; set; }
|
|
public ReplacedPlayerState[] Players { get; set; } = Array.Empty<ReplacedPlayerState>();
|
|
public ReplacedTurnSubmission?[] Submissions { get; set; } = new ReplacedTurnSubmission?[2];
|
|
public List<ReplacedSlotResolution> LastResolution { get; set; } = new();
|
|
public List<string> Log { get; set; } = new();
|
|
public long[] LastAcceptedSequence { get; set; } = new long[2];
|
|
public string ContentHash { get; set; } = string.Empty;
|
|
|
|
public ReplacedMatchState Clone() => new()
|
|
{
|
|
Round = Round,
|
|
LeadPlayer = LeadPlayer,
|
|
InitiativeRoll = InitiativeRoll,
|
|
Phase = Phase,
|
|
Winner = Winner,
|
|
IsLastStand = IsLastStand,
|
|
LastStandUsed = LastStandUsed,
|
|
Players = new[] { Players[0].Clone(), Players[1].Clone() },
|
|
Submissions = new ReplacedTurnSubmission?[] { Submissions[0]?.Clone(), Submissions[1]?.Clone() },
|
|
LastResolution = new List<ReplacedSlotResolution>(LastResolution),
|
|
Log = new List<string>(Log),
|
|
LastAcceptedSequence = (long[])LastAcceptedSequence.Clone(),
|
|
ContentHash = ContentHash
|
|
};
|
|
}
|
|
|
|
public sealed class ReplacedCommandResult
|
|
{
|
|
public bool Accepted { get; set; }
|
|
public bool Duplicate { get; set; }
|
|
public string ErrorCode { get; set; } = string.Empty;
|
|
public string Message { get; set; } = string.Empty;
|
|
public string StateHash { get; set; } = string.Empty;
|
|
}
|
|
}
|