ported from perforce
This commit is contained in:
34
RobotAndDonkey.Game/Modifiers/CourierOverspillModifier.cs
Normal file
34
RobotAndDonkey.Game/Modifiers/CourierOverspillModifier.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
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";
|
||||
}
|
||||
Reference in New Issue
Block a user