fix Bell-Handling
This commit is contained in:
parent
6bc79b0102
commit
49a03a8fbb
|
|
@ -22,6 +22,7 @@ public record BeforeThrowState(
|
||||||
/// <param name="IsStrike">Whether all 9 pins were knocked down.</param>
|
/// <param name="IsStrike">Whether all 9 pins were knocked down.</param>
|
||||||
/// <param name="IsGutter">Whether the throw was a gutter (Rinne).</param>
|
/// <param name="IsGutter">Whether the throw was a gutter (Rinne).</param>
|
||||||
/// <param name="IsCleared">Whether all remaining pins are hit (Abgeräumt).</param>
|
/// <param name="IsCleared">Whether all remaining pins are hit (Abgeräumt).</param>
|
||||||
|
/// <param name="IsBell">Whether bell was active in this throw.</param>
|
||||||
public record AfterThrowState(
|
public record AfterThrowState(
|
||||||
ThrowPanelSnapshot ThrowPanel,
|
ThrowPanelSnapshot ThrowPanel,
|
||||||
Guid CurrentPlayerId,
|
Guid CurrentPlayerId,
|
||||||
|
|
@ -29,7 +30,8 @@ public record AfterThrowState(
|
||||||
bool IsCircle,
|
bool IsCircle,
|
||||||
bool IsStrike,
|
bool IsStrike,
|
||||||
bool IsGutter,
|
bool IsGutter,
|
||||||
bool IsCleared
|
bool IsCleared,
|
||||||
|
bool IsBell
|
||||||
);
|
);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -162,11 +164,13 @@ public static class GameProgressExtensions
|
||||||
/// <param name="beforeThrow">Snapshot before the throw.</param>
|
/// <param name="beforeThrow">Snapshot before the throw.</param>
|
||||||
/// <param name="playerId">Current player ID.</param>
|
/// <param name="playerId">Current player ID.</param>
|
||||||
/// <param name="isGutter">Whether the throw went into the gutter (from user input).</param>
|
/// <param name="isGutter">Whether the throw went into the gutter (from user input).</param>
|
||||||
|
/// <param name="isBell">Whether the throw activated the bell (from user input).</param>
|
||||||
public static AfterThrowState CreateAfterThrowState(
|
public static AfterThrowState CreateAfterThrowState(
|
||||||
this ThrowPanelSnapshot afterThrow,
|
this ThrowPanelSnapshot afterThrow,
|
||||||
ThrowPanelSnapshot beforeThrow,
|
ThrowPanelSnapshot beforeThrow,
|
||||||
Guid playerId,
|
Guid playerId,
|
||||||
bool isGutter = false)
|
bool isGutter = false,
|
||||||
|
bool isBell = false)
|
||||||
{
|
{
|
||||||
var pinsKnockedBefore = beforeThrow.PinCount();
|
var pinsKnockedBefore = beforeThrow.PinCount();
|
||||||
var pinsKnockedAfter = afterThrow.PinCount();
|
var pinsKnockedAfter = afterThrow.PinCount();
|
||||||
|
|
@ -179,7 +183,8 @@ public static class GameProgressExtensions
|
||||||
IsCircle: afterThrow.IsCircle(),
|
IsCircle: afterThrow.IsCircle(),
|
||||||
IsStrike: afterThrow.IsStrike(),
|
IsStrike: afterThrow.IsStrike(),
|
||||||
IsGutter: isGutter,
|
IsGutter: isGutter,
|
||||||
IsCleared: afterThrow.IsCleared()
|
IsCleared: afterThrow.IsCleared(),
|
||||||
|
IsBell: isBell
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ public class TrainingGameLogicService : IGameLogicService
|
||||||
stats.ClearedCount++;
|
stats.ClearedCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (afterThrow.ThrowPanel.BellValue)
|
if (afterThrow.IsBell)
|
||||||
{
|
{
|
||||||
stats.BellCount++;
|
stats.BellCount++;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,13 @@ else if (_stats != null)
|
||||||
SeriesType="SeriesType.Bar"
|
SeriesType="SeriesType.Bar"
|
||||||
XValue="e => e.Name"
|
XValue="e => e.Name"
|
||||||
YValue="e => e.TotalCleared" />
|
YValue="e => e.TotalCleared" />
|
||||||
|
|
||||||
|
<ApexPointSeries TItem="MyData"
|
||||||
|
Items="Data"
|
||||||
|
Name="Klingel"
|
||||||
|
SeriesType="SeriesType.Bar"
|
||||||
|
XValue="e => e.Name"
|
||||||
|
YValue="e => e.TotalBells" />
|
||||||
</ApexChart>
|
</ApexChart>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -88,6 +95,7 @@ else if (_stats != null)
|
||||||
public int TotalStrikes { get; set; }
|
public int TotalStrikes { get; set; }
|
||||||
public int TotalCircles { get; set; }
|
public int TotalCircles { get; set; }
|
||||||
public int TotalCleared { get; set; }
|
public int TotalCleared { get; set; }
|
||||||
|
public int TotalBells { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -111,7 +119,8 @@ else if (_stats != null)
|
||||||
TotalThrows = s.TotalThrows,
|
TotalThrows = s.TotalThrows,
|
||||||
TotalStrikes = s.TotalStrikes,
|
TotalStrikes = s.TotalStrikes,
|
||||||
TotalCircles = s.TotalCircles,
|
TotalCircles = s.TotalCircles,
|
||||||
TotalCleared = s.TotalCleared
|
TotalCleared = s.TotalCleared,
|
||||||
|
TotalBells = s.TotalBells
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -363,7 +363,8 @@ public class GameEffects
|
||||||
// Create AfterThrowState for game logic with updated counters
|
// Create AfterThrowState for game logic with updated counters
|
||||||
var beforeSnapshot = CreateThrowPanelSnapshot(action.BeforeThrowState);
|
var beforeSnapshot = CreateThrowPanelSnapshot(action.BeforeThrowState);
|
||||||
var afterSnapshot = CreateThrowPanelSnapshot(newThrowPanel);
|
var afterSnapshot = CreateThrowPanelSnapshot(newThrowPanel);
|
||||||
var afterThrowState = afterSnapshot.CreateAfterThrowState(beforeSnapshot, currentPlayerId.Value, action.IsGutter);
|
var afterThrowState = afterSnapshot.CreateAfterThrowState(beforeSnapshot,
|
||||||
|
currentPlayerId.Value, action.IsGutter, action.AfterThrowState.BellValue);
|
||||||
|
|
||||||
// Default values
|
// Default values
|
||||||
bool shouldRotatePlayer = false;
|
bool shouldRotatePlayer = false;
|
||||||
|
|
@ -440,7 +441,7 @@ public class GameEffects
|
||||||
|
|
||||||
// Fire expense triggers for special throw events
|
// Fire expense triggers for special throw events
|
||||||
// Note: Use action.AfterThrowState.BellValue since afterThrowState has BellValue reset to false
|
// Note: Use action.AfterThrowState.BellValue since afterThrowState has BellValue reset to false
|
||||||
await FireThrowTriggersAsync(state, currentPlayerId.Value, action, afterThrowState, action.AfterThrowState.BellValue, dispatcher);
|
await FireThrowTriggersAsync(state, currentPlayerId.Value, action, afterThrowState, dispatcher);
|
||||||
|
|
||||||
// Record player statistics (game-type independent)
|
// Record player statistics (game-type independent)
|
||||||
await RecordPlayerStatisticsAsync(state, currentPlayerId.Value, afterThrowState);
|
await RecordPlayerStatisticsAsync(state, currentPlayerId.Value, afterThrowState);
|
||||||
|
|
@ -893,7 +894,6 @@ public class GameEffects
|
||||||
Guid currentPlayerId,
|
Guid currentPlayerId,
|
||||||
RecordThrowAction action,
|
RecordThrowAction action,
|
||||||
AfterThrowState afterThrowState,
|
AfterThrowState afterThrowState,
|
||||||
bool bellValue,
|
|
||||||
IDispatcher dispatcher)
|
IDispatcher dispatcher)
|
||||||
{
|
{
|
||||||
// Skip if no day or game context
|
// Skip if no day or game context
|
||||||
|
|
@ -991,7 +991,7 @@ public class GameEffects
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for Bell hit
|
// Check for Bell hit
|
||||||
if (bellValue)
|
if (afterThrowState.IsBell)
|
||||||
{
|
{
|
||||||
var expenses = await _gameEventService.RegisterBellAsync(
|
var expenses = await _gameEventService.RegisterBellAsync(
|
||||||
currentPlayerId,
|
currentPlayerId,
|
||||||
|
|
@ -1016,7 +1016,7 @@ public class GameEffects
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trigger GIF playback for special events
|
// Trigger GIF playback for special events
|
||||||
await TriggerGifForEventsAsync(state, gameId, action, afterThrowState, bellValue, dispatcher);
|
await TriggerGifForEventsAsync(state, gameId, action, afterThrowState, dispatcher);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
@ -1034,7 +1034,6 @@ public class GameEffects
|
||||||
Guid gameId,
|
Guid gameId,
|
||||||
RecordThrowAction action,
|
RecordThrowAction action,
|
||||||
AfterThrowState afterThrowState,
|
AfterThrowState afterThrowState,
|
||||||
bool bellValue,
|
|
||||||
IDispatcher dispatcher)
|
IDispatcher dispatcher)
|
||||||
{
|
{
|
||||||
var clubId = _clubContext.ClubId;
|
var clubId = _clubContext.ClubId;
|
||||||
|
|
@ -1049,7 +1048,7 @@ public class GameEffects
|
||||||
{
|
{
|
||||||
triggeredEvent = ThrowEventType.Circle;
|
triggeredEvent = ThrowEventType.Circle;
|
||||||
}
|
}
|
||||||
else if (bellValue)
|
else if (afterThrowState.IsBell)
|
||||||
{
|
{
|
||||||
triggeredEvent = ThrowEventType.Bell;
|
triggeredEvent = ThrowEventType.Bell;
|
||||||
}
|
}
|
||||||
|
|
@ -1188,7 +1187,7 @@ public class GameEffects
|
||||||
afterThrowState.IsGutter,
|
afterThrowState.IsGutter,
|
||||||
afterThrowState.IsCircle,
|
afterThrowState.IsCircle,
|
||||||
afterThrowState.IsStrike,
|
afterThrowState.IsStrike,
|
||||||
afterThrowState.ThrowPanel.BellValue);
|
afterThrowState.IsBell);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue