34 lines
1.3 KiB
C#
34 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using RobotAndDonkey.Game.Board;
|
|
using RobotAndDonkey.Game.Data;
|
|
using RobotAndDonkey.Game.Execution.Results;
|
|
using RobotAndDonkey.Game.GameState;
|
|
using RobotAndDonkey.Game.Intents;
|
|
using RobotAndDonkey.Game.Pois;
|
|
|
|
namespace RobotAndDonkey.Game.Modifiers;
|
|
|
|
public record RangerFertileRestModifier() : Modifier(EModifierKind.Robot, EModifierId.RangerFertileRest, EModifierDuration.Permanent)
|
|
{
|
|
protected override RangerFertileRestModifier CreateInstance() => new();
|
|
|
|
public override void Before(Guid requestId, ReadOnlySpan<Intent> intents, CoreLoop coreLoop, Entity owner, List<Intent> newIntents, List<Result> results)
|
|
{
|
|
var avatarCell = coreLoop.Board.Cells.First(c => c.Poi is Avatar);
|
|
if (avatarCell.Type != ECellType.Fertile)
|
|
return;
|
|
|
|
foreach (var intent in intents)
|
|
{
|
|
if (intent is ModifyCurrency { Delta.Energy: > 0 })
|
|
{
|
|
newIntents.Add(new ModifyCurrency(new(Balancing.Instance.RangerFertileRestEnergyDelta, 0, 0, 0, 0, 0)));
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
public override string ToolTip => $"Replenishes an extra {Balancing.Instance.RangerFertileRestEnergyDelta} energy when resting on fertile ground";
|
|
} |