卡牌更新
This commit is contained in:
@@ -11,12 +11,15 @@ using UnityEngine;
|
||||
namespace Continentis.Mods.Basic.Cards
|
||||
{
|
||||
/// <summary>
|
||||
/// 命令术:对目标执行一次感知检定:
|
||||
/// <para>对敌人:若感知低于{PerceptionThreshold_Remove},随机移除一个意图;若低于{PerceptionThreshold_Change},随机改变一个意图</para>
|
||||
/// <para>对玩家英雄:若感知检定未通过,将一张"扼制"卡牌放入目标的抽牌堆</para>
|
||||
/// 命令术:根据使用者与目标的等级差产生不同效果:
|
||||
/// <para>对敌人:等级差达到 High 门槛时随机移除一个意图;达到 Low 门槛时随机改变一个意图。</para>
|
||||
/// <para>对玩家英雄:等级差达到 High 门槛时将"扼制"卡牌放入目标抽牌堆;达到 Low 门槛时将"干扰"卡牌放入目标抽牌堆。</para>
|
||||
/// </summary>
|
||||
public class Command : CardLogicBase
|
||||
{
|
||||
private const string LEVEL_GAP_LOW = "LevelGap_Low";
|
||||
private const string LEVEL_GAP_HIGH = "LevelGap_High";
|
||||
|
||||
private static readonly Color HintGreen = new Color(0.2f, 0.85f, 0.3f);
|
||||
private static readonly Color HintRed = new Color(0.9f, 0.2f, 0.2f);
|
||||
|
||||
@@ -48,7 +51,7 @@ namespace Continentis.Mods.Basic.Cards
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查场上是否存在感知低于阈值的可用目标。
|
||||
/// 检查场上是否存在等级差达到 Low 门槛的可用目标。
|
||||
/// 有可用目标时返回绿色,无可用目标时返回红色。
|
||||
/// </summary>
|
||||
public override Color? GetHintColor()
|
||||
@@ -58,36 +61,43 @@ namespace Continentis.Mods.Basic.Cards
|
||||
card.DetectTargetsValidity(out List<CharacterBase> valid, out _, out _);
|
||||
if (valid.Count == 0) return HintRed;
|
||||
|
||||
int changeThreshold = GetAttribute("Perception_Threshold_High");
|
||||
int userLevel = user.GetAttribute(CharacterAttributes.Level);
|
||||
int gapLow = GetAttribute(LEVEL_GAP_LOW);
|
||||
bool hasEffectiveTarget = valid.Any(t =>
|
||||
t.GetAttribute(CharacterAttributes.Perception) < changeThreshold);
|
||||
userLevel - t.GetAttribute(CharacterAttributes.Level) >= gapLow);
|
||||
|
||||
return hasEffectiveTarget ? HintGreen : HintRed;
|
||||
}
|
||||
|
||||
/// <summary>对敌方目标:根据感知检定移除或改变意图。</summary>
|
||||
/// <summary>计算使用者与目标的等级差。</summary>
|
||||
private int GetLevelGap(CharacterBase target)
|
||||
{
|
||||
return user.GetAttribute(CharacterAttributes.Level) - target.GetAttribute(CharacterAttributes.Level);
|
||||
}
|
||||
|
||||
/// <summary>对敌方目标:等级差达到 High 时移除意图,达到 Low 时改变意图。</summary>
|
||||
private void PlayEffectOnEnemy(CharacterBase target)
|
||||
{
|
||||
int removeThreshold = GetAttribute("Perception_Threshold_Low");
|
||||
int changeThreshold = GetAttribute("Perception_Threshold_High");
|
||||
int perception = target.GetAttribute(CharacterAttributes.Perception);
|
||||
int levelGap = GetLevelGap(target);
|
||||
int gapHigh = GetAttribute(LEVEL_GAP_HIGH);
|
||||
int gapLow = GetAttribute(LEVEL_GAP_LOW);
|
||||
|
||||
if (perception < removeThreshold)
|
||||
if (levelGap >= gapHigh)
|
||||
target.intentionSubmodule.RemoveRandomIntendedCard();
|
||||
else if (perception < changeThreshold)
|
||||
else if (levelGap >= gapLow)
|
||||
target.intentionSubmodule.ChangeRandomIntendedCard();
|
||||
}
|
||||
|
||||
/// <summary>对玩家英雄:感知检定未通过时,向目标抽牌堆塞入一张"扼制"卡牌。</summary>
|
||||
/// <summary>对玩家英雄:等级差达到 High 时塞入扼制,达到 Low 时塞入干扰。</summary>
|
||||
private void PlayEffectOnPlayer(CharacterBase target)
|
||||
{
|
||||
int stifleThreshold = GetAttribute("Perception_Threshold_Low");
|
||||
int disruptionThreshold = GetAttribute("Perception_Threshold_High");
|
||||
int perception = target.GetAttribute(CharacterAttributes.Perception);
|
||||
int levelGap = GetLevelGap(target);
|
||||
int gapHigh = GetAttribute(LEVEL_GAP_HIGH);
|
||||
int gapLow = GetAttribute(LEVEL_GAP_LOW);
|
||||
|
||||
if (perception < stifleThreshold)
|
||||
if (levelGap >= gapHigh)
|
||||
CardInstance.GenerateCardInstance(GetDerivativeCardData(0), target, Piles.Draw);
|
||||
else if (perception < disruptionThreshold)
|
||||
else if (levelGap >= gapLow)
|
||||
CardInstance.GenerateCardInstance(GetDerivativeCardData(1), target, Piles.Draw);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user