34 lines
1.2 KiB
C#
34 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using RobotAndDonkey.Game.Data;
|
|
using RobotAndDonkey.Game.Execution.Results;
|
|
using RobotAndDonkey.Game.GameState;
|
|
using RobotAndDonkey.Game.Intents;
|
|
|
|
namespace RobotAndDonkey.Game.Modifiers;
|
|
|
|
public record CourierOverspillModifier() : Modifier(EModifierKind.Robot, EModifierId.CourierOverspill, EModifierDuration.Permanent)
|
|
{
|
|
protected override CourierOverspillModifier CreateInstance() => new();
|
|
|
|
public override void After(Guid requestId, ReadOnlySpan<Intent> intents, CoreLoop coreLoop, Entity owner, List<Intent> newIntents, List<Result> results)
|
|
{
|
|
var deliveryPresent = false;
|
|
foreach (var intent in intents)
|
|
{
|
|
if (intent is not ModifyCurrency modifyCurrency)
|
|
return;
|
|
|
|
if (modifyCurrency.Delta is not { Delivery: > 0 })
|
|
continue;
|
|
|
|
deliveryPresent = true;
|
|
break;
|
|
}
|
|
|
|
if (deliveryPresent)
|
|
newIntents.Add(new ModifyCurrency(new(Balancing.Instance.CourierEnergyReplenishOnDelivery, 0, 0, 0, 0, 0)));
|
|
}
|
|
|
|
public override string ToolTip => $"Replenishes {Balancing.Instance.CourierEnergyReplenishOnDelivery} energy with every delivery";
|
|
} |