ported from perforce
This commit is contained in:
24
RobotAndDonkey.Game/Modifiers/EffectiveModifier.cs
Normal file
24
RobotAndDonkey.Game/Modifiers/EffectiveModifier.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using RobotAndDonkey.Game.Cards;
|
||||
using RobotAndDonkey.Game.Data;
|
||||
using RobotAndDonkey.Game.Execution.Results;
|
||||
using RobotAndDonkey.Game.GameState;
|
||||
using RobotAndDonkey.Game.Intents;
|
||||
|
||||
namespace RobotAndDonkey.Game.Modifiers;
|
||||
|
||||
public record EffectiveModifier(EModifierDuration Duration) : Modifier(EModifierKind.Card, EModifierId.Effective, Duration)
|
||||
{
|
||||
protected override EffectiveModifier CreateInstance() => new(Duration);
|
||||
|
||||
public override void Before(Guid requestId, ReadOnlySpan<Intent> intents, CoreLoop coreLoop, Entity owner, List<Intent> newIntents, List<Result> results)
|
||||
{
|
||||
if (coreLoop.Random.NextSingle() <= Balancing.Instance.EffectiveChance)
|
||||
{
|
||||
if (owner is Card card)
|
||||
results.Add(new ModifyCardResult(requestId, card.DeepClone(), EModifierId.Effective, ECardLocation.Tape));
|
||||
newIntents.AddRange(intents);
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToolTip => $"Has a {Balancing.Instance.EffectiveChance * 100:N0}% chance of working twice";
|
||||
}
|
||||
Reference in New Issue
Block a user