ported from perforce
This commit is contained in:
35
RobotAndDonkey.Game/Cards/Patches/ModifyCardBase.cs
Normal file
35
RobotAndDonkey.Game/Cards/Patches/ModifyCardBase.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using RobotAndDonkey.Game.Board;
|
||||
using RobotAndDonkey.Game.Execution.Results;
|
||||
using RobotAndDonkey.Game.GameState;
|
||||
using RobotAndDonkey.Game.Intents;
|
||||
using RobotAndDonkey.Game.Modifiers;
|
||||
using RobotAndDonkey.Game.Pois;
|
||||
|
||||
namespace RobotAndDonkey.Game.Cards.Patches;
|
||||
|
||||
public abstract record ModifyCardBase(ECard Id, int ShopCost, int PlayCost, ERarity Rarity, EModifierId Modifier) : PatchCard(Id, ShopCost, PlayCost, Rarity)
|
||||
{
|
||||
protected override void CreateIntents(Cell avatarCell, Avatar avatar, CoreLoop coreLoop, Guid requestId, List<Intent> intents, List<Result> results)
|
||||
{
|
||||
var tape = coreLoop.GetTapeCards();
|
||||
var tapeIndex = tape.IndexOf(this);
|
||||
if (tapeIndex < 0)
|
||||
results.Add(new InvalidInstructionResult(requestId, EInvalidReason.NotFound, this, null));
|
||||
else
|
||||
{
|
||||
var corrupt = Modifiers.Any(m => m is CorruptModifierBase { DebuffSources.Count: 0 });
|
||||
for (var i = tapeIndex + 1; i < tape.Count; ++i)
|
||||
{
|
||||
var victim = tape[i];
|
||||
if (corrupt)
|
||||
intents.Add(new ImmunizeCard(this, victim, Modifier, EModifierDuration.Temporary, false));
|
||||
else
|
||||
intents.Add(new ModifyCard(victim, Modifier, EModifierDuration.Temporary, ECardLocation.Tape));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToolTip => $"All following instructions in tape become {Modifier} temporarily";
|
||||
|
||||
public override Modifier[] TooltipModifiers => [ModifyCard.Create(Modifier, EModifierDuration.Temporary)];
|
||||
}
|
||||
Reference in New Issue
Block a user