S4 收尾
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# Id 列1 Title Description Options
|
||||
# int string string string
|
||||
# 事件编号 策划备注 事件题目 事件描述 事件选项
|
||||
1 赌马 一名商人邀请你下注。赢了就能赚一笔。 [{"optionText":"下注 100(金)- 稳健:70% 赢 150","requirements":[{"type":"GoldAtLeast","param":{"Count":100}}],"costEffects":[{"type":"AddGold","param":{"Count":-100}}],"rewardEffects":[{"type":"AddGold","param":{"Count":150}}],"probability":0.7},{"optionText":"下注 100(金)- 激进:30% 赢 250","requirements":[{"type":"GoldAtLeast","param":{"Count":100}}],"costEffects":[{"type":"AddGold","param":{"Count":-100}}],"rewardEffects":[{"type":"AddGold","param":{"Count":250}}],"probability":0.3}]
|
||||
2 工匠的熔炉 工匠以金币交换防御塔组件。 [{"optionText":"交出 3 个白色组件,获得 50 金币","requirements":[{"type":"CompCountAtLeast","param":{"Count":3,"Rarity":"White"}}],"costEffects":[{"type":"RemoveRandomComps","param":{"Count":3,"Rarity":"White"}}],"rewardEffects":[{"type":"AddGold","param":{"Count":50}}]},{"optionText":"交出 2 个绿色组件,获得 70 金币","requirements":[{"type":"CompCountAtLeast","param":{"Count":2,"Rarity":"Green"}}],"costEffects":[{"type":"RemoveRandomComps","param":{"Count":2,"Rarity":"Green"}}],"rewardEffects":[{"type":"AddGold","param":{"Count":70}}]},{"optionText":"交出 1 个蓝色组件,获得 80 金币","requirements":[{"type":"CompCountAtLeast","param":{"Count":1,"Rarity":"Blue"}}],"costEffects":[{"type":"RemoveRandomComps","param":{"Count":1,"Rarity":"Blue"}}],"rewardEffects":[{"type":"AddGold","param":{"Count":80}}]},{"optionText":"拒绝","rewardEffects":[]}]
|
||||
3 代价与回报 某种黑暗力量向你索取代价。 [{"optionText":"展示你的防御塔","requirements":[{"type":"TowerCountAtLeast","param":{"Count":2}}],"rewardEffects":[{"type":"AddGold","param":{"Count":50}}]},{"optionText":"离开","rewardEffects":[]}]
|
||||
1 赌马 一名商人邀请你下注。赢了就能赚一笔。 [{\"optionText\":\"下注 100(金)- 稳健:70% 赢 150\",\"requirements\":[{\"type\":\"GoldAtLeast\",\"param\":{\"Count\":100}}],\"costEffects\":[{\"type\":\"AddGold\",\"param\":{\"Count\":-100}}],\"rewardEffects\":[{\"type\":\"AddGold\",\"param\":{\"Count\":150}}],\"probability\":0.7},{\"optionText\":\"下注 100(金)- 激进:30% 赢 250\",\"requirements\":[{\"type\":\"GoldAtLeast\",\"param\":{\"Count\":100}}],\"costEffects\":[{\"type\":\"AddGold\",\"param\":{\"Count\":-100}}],\"rewardEffects\":[{\"type\":\"AddGold\",\"param\":{\"Count\":250}}],\"probability\":0.3}]
|
||||
2 工匠的熔炉 工匠以金币交换防御塔组件。 [{\"optionText\":\"交出 3 个白色组件,获得 50 金币\",\"requirements\":[{\"type\":\"CompCountAtLeast\",\"param\":{\"Count\":3,\"Rarity\":\"White\"}}],\"costEffects\":[{\"type\":\"RemoveRandomComps\",\"param\":{\"Count\":3,\"Rarity\":\"White\"}}],\"rewardEffects\":[{\"type\":\"AddGold\",\"param\":{\"Count\":50}}]},{\"optionText\":\"交出 2 个绿色组件,获得 70 金币\",\"requirements\":[{\"type\":\"CompCountAtLeast\",\"param\":{\"Count\":2,\"Rarity\":\"Green\"}}],\"costEffects\":[{\"type\":\"RemoveRandomComps\",\"param\":{\"Count\":2,\"Rarity\":\"Green\"}}],\"rewardEffects\":[{\"type\":\"AddGold\",\"param\":{\"Count\":70}}]},{\"optionText\":\"交出 1 个蓝色组件,获得 80 金币\",\"requirements\":[{\"type\":\"CompCountAtLeast\",\"param\":{\"Count\":1,\"Rarity\":\"Blue\"}}],\"costEffects\":[{\"type\":\"RemoveRandomComps\",\"param\":{\"Count\":1,\"Rarity\":\"Blue\"}}],\"rewardEffects\":[{\"type\":\"AddGold\",\"param\":{\"Count\":80}}]},{\"optionText\":\"拒绝\",\"rewardEffects\":[]}]
|
||||
3 代价与回报 某种黑暗力量向你索取代价。 [{\"optionText\":\"展示你的防御塔\",\"requirements\":[{\"type\":\"TowerCountAtLeast\",\"param\":{\"Count\":2}}],\"rewardEffects\":[{\"type\":\"AddGold\",\"param\":{\"Count\":50}}]},{\"optionText\":\"离开\",\"rewardEffects\":[]}]
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
# Id 列1 Name MinRarity Weight
|
||||
# int string RarityType int
|
||||
# Tag编号 策划备注 Tag名 获取最低稀有度 权重
|
||||
1 元素 Fire White 20
|
||||
2 元素 BurnSpread White 20
|
||||
3 元素 IgniteBurst Green 15
|
||||
4 元素 Inferno Purple 5
|
||||
5 控制 Ice White 1
|
||||
6 控制 FreezeMask White 20
|
||||
7 控制 Shatter Green 15
|
||||
8 控制 AbsoluteZero Purple 1
|
||||
9 穿透 Pierce White 20
|
||||
10 穿透 Crit White 20
|
||||
11 穿透 Overpenetrate Green 15
|
||||
12 穿透 Execution Purple 5
|
||||
# Id 列1 Name TagGroup MinRarity Weight IsImplemented
|
||||
# int string string RarityType int bool
|
||||
# Tag编号 策划备注 Tag名 Tag所属 获取最低稀有度 权重 是否启用
|
||||
1 元素 Fire Element White 20 True
|
||||
2 元素 BurnSpread Element White 20 False
|
||||
3 元素 IgniteBurst Element Green 15 False
|
||||
4 元素 Inferno Element Purple 5 True
|
||||
5 控制 Ice Control White 1 True
|
||||
6 控制 FreezeMask Control White 20 False
|
||||
7 控制 Shatter Control Green 15 True
|
||||
8 控制 AbsoluteZero Control Purple 1 True
|
||||
9 穿透 Pierce Penetrate White 20 False
|
||||
10 穿透 Crit Penetrate White 20 True
|
||||
11 穿透 Overpenetrate Penetrate Green 15 False
|
||||
12 穿透 Execution Penetrate Purple 5 True
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
# Id 列1 TagType TriggerPhase Description Param
|
||||
# int TagType TagTriggerPhase string string
|
||||
# Tag配置编号 策划备注 所属Tag类型 触发阶段 描述 参数Json
|
||||
1 元素 Fire OnAfterHit 持续对敌人造成<color=red>火</color>伤害 {"BurnDurationSeconds":3,"BurnDamagePerSecondPerStack":20,"MaxEffectiveStack":5}
|
||||
2 元素 BurnSpread None 燃烧向邻近敌人传播 {"SpreadRadius":2,"SpreadDamageRate":1}
|
||||
3 元素 IgniteBurst None 燃烧结束或击杀时爆炸 {"BurstRadius":1,"BurstDamageRate":0.5}
|
||||
4 元素 Inferno OnAfterHit 强化燃烧伤害或持续时间 {"BonusBurnDurationSeconds":0.1,"BonusBurnDamagePerSecondPerStack":0.1}
|
||||
5 控制 Ice OnAfterHit 命中附加减速 {"SlowDurationSeconds":2,"SlowRatioPerStack":0.2,"MinMoveSpeedMultiplier":0.4}
|
||||
6 控制 FreezeMask None 冻结积累条 / 冻结面具机制 {"FreezeBuildUpPerStack":0.1}
|
||||
7 控制 Shatter OnBeforeHit 对已减速 / 已冻结目标增伤 {"RequiresSlowedTarget":true,"DamageBonusPerStack":0.1}
|
||||
8 控制 AbsoluteZero OnAfterHit 强化减速,或提高冻结触发速度 {"BonusSlowDurationSeconds":0.1,"BonusSlowRatioPerStack":0.2}
|
||||
9 穿透 Pierce None 子弹贯穿多个目标 {"ExtraPierceCount":2}
|
||||
10 穿透 Crit OnBeforeHit 命中前按概率暴击 {"CritChancePerStack":0.1,"CritDamageMultiplier":1.5}
|
||||
11 穿透 Overpenetrate None 贯穿后保留部分伤害继续飞行 {"ExtraPenetrationCount":0.1,"RemainingDamageRate":0.2}
|
||||
12 穿透 Execution OnBeforeHit 对低血量目标增伤或直接处决 {"TargetHealthThreshold":0.3,"DamageBonusPerStack":0.5}
|
||||
1 元素 Fire OnAfterHit 持续对敌人造成<color=red>火</color>伤害 {\"BurnDurationSeconds\":3,\"BurnDamagePerSecondPerStack\":20,\"MaxEffectiveStack\":5}
|
||||
2 元素 BurnSpread None 燃烧向邻近敌人传播 {\"SpreadRadius\":2,\"SpreadDamageRate\":1}
|
||||
3 元素 IgniteBurst None 燃烧结束或击杀时爆炸 {\"BurstRadius\":1,\"BurstDamageRate\":0.5}
|
||||
4 元素 Inferno OnAfterHit 强化燃烧伤害或持续时间 {\"BonusBurnDurationSeconds\":0.1,\"BonusBurnDamagePerSecondPerStack\":0.1}
|
||||
5 控制 Ice OnAfterHit 命中附加减速 {\"SlowDurationSeconds\":2,\"SlowRatioPerStack\":0.2,\"MinMoveSpeedMultiplier\":0.4}
|
||||
6 控制 FreezeMask None 冻结积累条 / 冻结面具机制 {\"FreezeBuildUpPerStack\":0.1}
|
||||
7 控制 Shatter OnBeforeHit 对已减速 / 已冻结目标增伤 {\"RequiresSlowedTarget\":true,\"DamageBonusPerStack\":0.1}
|
||||
8 控制 AbsoluteZero OnAfterHit 强化减速,或提高冻结触发速度 {\"BonusSlowDurationSeconds\":0.1,\"BonusSlowRatioPerStack\":0.2}
|
||||
9 穿透 Pierce None 子弹贯穿多个目标 {\"ExtraPierceCount\":2}
|
||||
10 穿透 Crit OnBeforeHit 命中前按概率暴击 {\"CritChancePerStack\":0.1,\"CritDamageMultiplier\":1.5}
|
||||
11 穿透 Overpenetrate None 贯穿后保留部分伤害继续飞行 {\"ExtraPenetrationCount\":0.1,\"RemainingDamageRate\":0.2}
|
||||
12 穿透 Execution OnBeforeHit 对低血量目标增伤或直接处决 {\"TargetHealthThreshold\":0.3,\"DamageBonusPerStack\":0.5}
|
||||
|
||||
+3
-3
@@ -355,7 +355,7 @@ namespace GeometryTD.CustomComponent
|
||||
Rarity = rarity,
|
||||
Endurance = 100f,
|
||||
Constraint = config.Constraint,
|
||||
Tags = InventoryTagRuleService.ResolveComponentTags(
|
||||
Tags = ComponentTagGenerationService.ResolveComponentTags(
|
||||
config.PossibleTag,
|
||||
rarity,
|
||||
InventoryTagSourceType.Drop,
|
||||
@@ -393,7 +393,7 @@ namespace GeometryTD.CustomComponent
|
||||
Rarity = rarity,
|
||||
Endurance = 100f,
|
||||
Constraint = config.Constraint,
|
||||
Tags = InventoryTagRuleService.ResolveComponentTags(
|
||||
Tags = ComponentTagGenerationService.ResolveComponentTags(
|
||||
config.PossibleTag,
|
||||
rarity,
|
||||
InventoryTagSourceType.Drop,
|
||||
@@ -430,7 +430,7 @@ namespace GeometryTD.CustomComponent
|
||||
Rarity = rarity,
|
||||
Endurance = 100f,
|
||||
Constraint = config.Constraint,
|
||||
Tags = InventoryTagRuleService.ResolveComponentTags(
|
||||
Tags = ComponentTagGenerationService.ResolveComponentTags(
|
||||
config.PossibleTag,
|
||||
rarity,
|
||||
InventoryTagSourceType.Drop,
|
||||
|
||||
@@ -24,10 +24,14 @@ namespace GeometryTD.DataTable
|
||||
|
||||
public TagType TagType => (TagType)m_Id;
|
||||
|
||||
public string TagGroupText { get; private set; }
|
||||
|
||||
public RarityType MinRarity { get; private set; }
|
||||
|
||||
public int Weight { get; private set; }
|
||||
|
||||
public bool IsImplemented { get; private set; }
|
||||
|
||||
public override bool ParseDataRow(string dataRowString, object userData)
|
||||
{
|
||||
string[] columnStrings = dataRowString.Split(DataTableExtension.DataSplitSeparators);
|
||||
@@ -41,8 +45,22 @@ namespace GeometryTD.DataTable
|
||||
m_Id = int.Parse(columnStrings[index++]);
|
||||
index++;
|
||||
Name = columnStrings[index++];
|
||||
MinRarity = EnumUtility<RarityType>.Get(columnStrings[index++]);
|
||||
Weight = int.Parse(columnStrings[index++]);
|
||||
|
||||
bool hasExtendedColumns = columnStrings.Length - index >= 4;
|
||||
if (hasExtendedColumns)
|
||||
{
|
||||
TagGroupText = columnStrings[index++];
|
||||
MinRarity = EnumUtility<RarityType>.Get(columnStrings[index++]);
|
||||
Weight = int.Parse(columnStrings[index++]);
|
||||
IsImplemented = bool.Parse(columnStrings[index++]);
|
||||
}
|
||||
else
|
||||
{
|
||||
TagGroupText = string.Empty;
|
||||
MinRarity = EnumUtility<RarityType>.Get(columnStrings[index++]);
|
||||
Weight = int.Parse(columnStrings[index++]);
|
||||
IsImplemented = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ namespace GeometryTD.Definition
|
||||
None = 0,
|
||||
Status = 1,
|
||||
NumericModifier = 2,
|
||||
AttackShape = 3
|
||||
AttackShape = 3,
|
||||
// Enhances another applied status on the same hit, but does not create its own enemy-held state.
|
||||
StatusModifier = 4
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0f2ab8a7e488575498ac933a125360d1
|
||||
guid: 1c2505f2ce4cfd7499cdd3bc8c0e22eb
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eae63f0557814c14a9a2b9e6c8726404
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+3
-4
@@ -7,13 +7,12 @@ namespace GeometryTD.Definition
|
||||
{
|
||||
public static class EnemyStatusTagRegistry
|
||||
{
|
||||
// Only tags that create or tick enemy-held status state belong here.
|
||||
private static readonly Dictionary<TagType, IEnemyStatusTagEffect> EffectsByTag =
|
||||
new Dictionary<TagType, IEnemyStatusTagEffect>
|
||||
{
|
||||
[TagType.Fire] = new FireTagEffect(),
|
||||
[TagType.Inferno] = new InfernoTagEffect(),
|
||||
[TagType.Ice] = new IceTagEffect(),
|
||||
[TagType.AbsoluteZero] = new AbsoluteZeroTagEffect()
|
||||
[TagType.Ice] = new IceTagEffect()
|
||||
};
|
||||
|
||||
public static IReadOnlyDictionary<TagType, IEnemyStatusTagEffect> Effects => EffectsByTag;
|
||||
@@ -23,4 +22,4 @@ namespace GeometryTD.Definition
|
||||
return EffectsByTag.TryGetValue(tagType, out effect);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: df89bbfead1892c469024466c479bef1
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+1
-1
@@ -17,7 +17,7 @@ namespace GeometryTD.Definition
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!TagConfigRegistry.TryGetDefinition(runtime.TagType, out TagDefinitionData definition) ||
|
||||
if (!TagDefinitionRegistry.TryGetDefinition(runtime.TagType, out TagDefinition definition) ||
|
||||
definition == null ||
|
||||
definition.Category != TagCategory.AttackShape ||
|
||||
definition.TriggerPhase != triggerPhase ||
|
||||
+1
-1
@@ -30,7 +30,7 @@ namespace GeometryTD.Definition
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!TagConfigRegistry.TryGetDefinition(runtime.TagType, out TagDefinitionData definition) ||
|
||||
if (!TagDefinitionRegistry.TryGetDefinition(runtime.TagType, out TagDefinition definition) ||
|
||||
definition == null ||
|
||||
definition.Category != TagCategory.NumericModifier ||
|
||||
definition.TriggerPhase != TagTriggerPhase.OnBeforeHit ||
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: efece7a307e9a2c44b7247921e8b3194
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 343c21d630e34fc47a132c7d94f72bec
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+3
-3
@@ -11,7 +11,7 @@ namespace GeometryTD.Definition
|
||||
public override void Apply(AttackPayload attackPayload, EnemyTagStatusRuntime runtime,
|
||||
TagRuntimeData runtimeData)
|
||||
{
|
||||
Debug.Assert(TagConfigRegistry.TryGetDefinition(TagType, out TagDefinitionData definition));
|
||||
Debug.Assert(TagDefinitionRegistry.TryGetDefinition(TagType, out TagDefinition definition));
|
||||
|
||||
FireTagConfig config = definition.Config as FireTagConfig;
|
||||
Debug.Assert(config != null);
|
||||
@@ -72,7 +72,7 @@ namespace GeometryTD.Definition
|
||||
private static float GetInfernoBonusDuration(int infernoStack)
|
||||
{
|
||||
if (infernoStack <= 0 ||
|
||||
!TagConfigRegistry.TryGetDefinition(TagType.Inferno, out TagDefinitionData definition))
|
||||
!TagDefinitionRegistry.TryGetDefinition(TagType.Inferno, out TagDefinition definition))
|
||||
{
|
||||
return 0f;
|
||||
}
|
||||
@@ -89,7 +89,7 @@ namespace GeometryTD.Definition
|
||||
private static float GetInfernoBonusDamagePerSecond(int infernoStack)
|
||||
{
|
||||
if (infernoStack <= 0 ||
|
||||
!TagConfigRegistry.TryGetDefinition(TagType.Inferno, out TagDefinitionData definition))
|
||||
!TagDefinitionRegistry.TryGetDefinition(TagType.Inferno, out TagDefinition definition))
|
||||
{
|
||||
return 0f;
|
||||
}
|
||||
+3
-3
@@ -14,7 +14,7 @@ namespace GeometryTD.Definition
|
||||
_ = attackPayload;
|
||||
Debug.Assert(runtimeData != null);
|
||||
Debug.Assert(runtimeData.TotalStack > 0);
|
||||
Debug.Assert(TagConfigRegistry.TryGetDefinition(TagType, out TagDefinitionData definition));
|
||||
Debug.Assert(TagDefinitionRegistry.TryGetDefinition(TagType, out TagDefinition definition));
|
||||
|
||||
IceTagConfig config = definition.Config as IceTagConfig;
|
||||
Debug.Assert(config != null);
|
||||
@@ -53,7 +53,7 @@ namespace GeometryTD.Definition
|
||||
private static float GetAbsoluteZeroBonusDuration(int absoluteZeroStack)
|
||||
{
|
||||
if (absoluteZeroStack <= 0 ||
|
||||
!TagConfigRegistry.TryGetDefinition(TagType.AbsoluteZero, out TagDefinitionData definition))
|
||||
!TagDefinitionRegistry.TryGetDefinition(TagType.AbsoluteZero, out TagDefinition definition))
|
||||
{
|
||||
return 0f;
|
||||
}
|
||||
@@ -70,7 +70,7 @@ namespace GeometryTD.Definition
|
||||
private static float GetAbsoluteZeroBonusSlowRatio(int absoluteZeroStack)
|
||||
{
|
||||
if (absoluteZeroStack <= 0 ||
|
||||
!TagConfigRegistry.TryGetDefinition(TagType.AbsoluteZero, out TagDefinitionData definition))
|
||||
!TagDefinitionRegistry.TryGetDefinition(TagType.AbsoluteZero, out TagDefinition definition))
|
||||
{
|
||||
return 0f;
|
||||
}
|
||||
+1
-1
@@ -45,7 +45,7 @@ namespace GeometryTD.Definition
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!TagConfigRegistry.TryGetDefinition(tag.TagType, out TagDefinitionData definition) ||
|
||||
if (!TagDefinitionRegistry.TryGetDefinition(tag.TagType, out TagDefinition definition) ||
|
||||
definition == null ||
|
||||
definition.Category != TagCategory.Status ||
|
||||
definition.TriggerPhase != TagTriggerPhase.OnAfterHit ||
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1909b51822cc4368bc604674fd119123
|
||||
timeCreated: 1773105715
|
||||
@@ -1,9 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace GeometryTD.Definition
|
||||
{
|
||||
public sealed class AbsoluteZeroTagEffect : EnemyStatusTagEffectBase
|
||||
{
|
||||
public override TagType TagType => TagType.AbsoluteZero;
|
||||
}
|
||||
}
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: deecaa9a38c04725b5abeb5488cbe53f
|
||||
timeCreated: 1773106137
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace GeometryTD.Definition
|
||||
{
|
||||
public sealed class InfernoTagEffect : EnemyStatusTagEffectBase
|
||||
{
|
||||
public override TagType TagType => TagType.Inferno;
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2aa813ec42ea4dddb717ff28da764f15
|
||||
timeCreated: 1773106082
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 44a85dd6308e175428074070c55e1020
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+18
-18
@@ -5,7 +5,7 @@ using Random = System.Random;
|
||||
|
||||
namespace GeometryTD.Definition
|
||||
{
|
||||
public static class InventoryTagRuleService
|
||||
public static class ComponentTagGenerationService
|
||||
{
|
||||
public static TagType[] ResolveComponentTags(
|
||||
IReadOnlyList<TagType> possibleTags,
|
||||
@@ -13,10 +13,10 @@ namespace GeometryTD.Definition
|
||||
InventoryTagSourceType sourceType,
|
||||
long itemInstanceId,
|
||||
int configId,
|
||||
IReadOnlyDictionary<TagType, TagGenerationRuleData> rulesByTag = null,
|
||||
IReadOnlyDictionary<RarityType, RarityTagBudgetRuleData> rarityTagBudgetRulesByRarity = null)
|
||||
IReadOnlyDictionary<TagType, TagGenerationRule> rulesByTag = null,
|
||||
IReadOnlyDictionary<RarityType, RarityTagBudgetRule> rarityTagBudgetRulesByRarity = null)
|
||||
{
|
||||
IReadOnlyDictionary<TagType, TagGenerationRuleData> ruleLookup = rulesByTag ?? TagGenerationRuleRegistry.Rules;
|
||||
IReadOnlyDictionary<TagType, TagGenerationRule> ruleLookup = rulesByTag ?? TagGenerationRuleRegistry.Rules;
|
||||
TagType[] eligibleTags = GetEligibleTags(possibleTags, rarity, ruleLookup);
|
||||
if (eligibleTags.Length <= 0)
|
||||
{
|
||||
@@ -46,7 +46,7 @@ namespace GeometryTD.Definition
|
||||
public static TagType[] GetEligibleTags(
|
||||
IReadOnlyList<TagType> possibleTags,
|
||||
RarityType rarity,
|
||||
IReadOnlyDictionary<TagType, TagGenerationRuleData> rulesByTag = null)
|
||||
IReadOnlyDictionary<TagType, TagGenerationRule> rulesByTag = null)
|
||||
{
|
||||
if (possibleTags == null || possibleTags.Count <= 0)
|
||||
{
|
||||
@@ -54,7 +54,7 @@ namespace GeometryTD.Definition
|
||||
}
|
||||
|
||||
RarityType normalizedRarity = InventoryRarityRuleService.NormalizeComponentRarity(rarity);
|
||||
IReadOnlyDictionary<TagType, TagGenerationRuleData> ruleLookup = rulesByTag ?? TagGenerationRuleRegistry.Rules;
|
||||
IReadOnlyDictionary<TagType, TagGenerationRule> ruleLookup = rulesByTag ?? TagGenerationRuleRegistry.Rules;
|
||||
HashSet<TagType> uniqueTags = new HashSet<TagType>();
|
||||
|
||||
for (int i = 0; i < possibleTags.Count; i++)
|
||||
@@ -65,7 +65,7 @@ namespace GeometryTD.Definition
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!TryGetRule(tagType, ruleLookup, out TagGenerationRuleData rule))
|
||||
if (!TryGetRule(tagType, ruleLookup, out TagGenerationRule rule))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -92,11 +92,11 @@ namespace GeometryTD.Definition
|
||||
public static int ResolveRarityTagBudget(
|
||||
RarityType rarity,
|
||||
Random random,
|
||||
IReadOnlyDictionary<RarityType, RarityTagBudgetRuleData> rarityTagBudgetRulesByRarity = null)
|
||||
IReadOnlyDictionary<RarityType, RarityTagBudgetRule> rarityTagBudgetRulesByRarity = null)
|
||||
{
|
||||
RarityType normalizedRarity = InventoryRarityRuleService.NormalizeComponentRarity(rarity);
|
||||
IReadOnlyDictionary<RarityType, RarityTagBudgetRuleData> ruleLookup = rarityTagBudgetRulesByRarity ?? RarityTagBudgetRuleRegistry.Rules;
|
||||
RarityTagBudgetRuleData rule = GetRarityTagBudgetRule(normalizedRarity, ruleLookup);
|
||||
IReadOnlyDictionary<RarityType, RarityTagBudgetRule> ruleLookup = rarityTagBudgetRulesByRarity ?? RarityTagBudgetRuleRegistry.Rules;
|
||||
RarityTagBudgetRule rule = GetRarityTagBudgetRule(normalizedRarity, ruleLookup);
|
||||
|
||||
Debug.Assert(rule.MinCount >= 0);
|
||||
Debug.Assert(rule.MaxCount >= rule.MinCount);
|
||||
@@ -112,15 +112,15 @@ namespace GeometryTD.Definition
|
||||
|
||||
private static bool IsSupportedLaunchTag(TagType tagType)
|
||||
{
|
||||
return TagConfigRegistry.TryGetDefinition(tagType, out TagDefinitionData definition) &&
|
||||
return TagDefinitionRegistry.TryGetDefinition(tagType, out TagDefinition definition) &&
|
||||
definition.Config != null &&
|
||||
definition.Config.IsImplemented;
|
||||
}
|
||||
|
||||
private static bool TryGetRule(
|
||||
TagType tagType,
|
||||
IReadOnlyDictionary<TagType, TagGenerationRuleData> ruleLookup,
|
||||
out TagGenerationRuleData rule)
|
||||
IReadOnlyDictionary<TagType, TagGenerationRule> ruleLookup,
|
||||
out TagGenerationRule rule)
|
||||
{
|
||||
if (ruleLookup != null && ruleLookup.TryGetValue(tagType, out rule))
|
||||
{
|
||||
@@ -131,9 +131,9 @@ namespace GeometryTD.Definition
|
||||
return false;
|
||||
}
|
||||
|
||||
private static RarityTagBudgetRuleData GetRarityTagBudgetRule(
|
||||
private static RarityTagBudgetRule GetRarityTagBudgetRule(
|
||||
RarityType rarity,
|
||||
IReadOnlyDictionary<RarityType, RarityTagBudgetRuleData> ruleLookup)
|
||||
IReadOnlyDictionary<RarityType, RarityTagBudgetRule> ruleLookup)
|
||||
{
|
||||
Debug.Assert(ruleLookup != null);
|
||||
Debug.Assert(ruleLookup.TryGetValue(rarity, out _));
|
||||
@@ -142,13 +142,13 @@ namespace GeometryTD.Definition
|
||||
|
||||
private static int RollWeightedIndex(
|
||||
IReadOnlyList<TagType> pool,
|
||||
IReadOnlyDictionary<TagType, TagGenerationRuleData> ruleLookup,
|
||||
IReadOnlyDictionary<TagType, TagGenerationRule> ruleLookup,
|
||||
Random random)
|
||||
{
|
||||
int totalWeight = 0;
|
||||
for (int i = 0; i < pool.Count; i++)
|
||||
{
|
||||
TagGenerationRuleData rule = ruleLookup[pool[i]];
|
||||
TagGenerationRule rule = ruleLookup[pool[i]];
|
||||
Debug.Assert(rule.Weight > 0);
|
||||
totalWeight += rule.Weight;
|
||||
}
|
||||
@@ -159,7 +159,7 @@ namespace GeometryTD.Definition
|
||||
int cumulative = 0;
|
||||
for (int i = 0; i < pool.Count; i++)
|
||||
{
|
||||
TagGenerationRuleData rule = ruleLookup[pool[i]];
|
||||
TagGenerationRule rule = ruleLookup[pool[i]];
|
||||
cumulative += rule.Weight;
|
||||
if (roll <= cumulative)
|
||||
{
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
namespace GeometryTD.Definition
|
||||
{
|
||||
public sealed class RarityTagBudgetRuleData
|
||||
public sealed class RarityTagBudgetRule
|
||||
{
|
||||
public RarityType Rarity { get; set; }
|
||||
public int MinCount { get; set; }
|
||||
+8
-8
@@ -6,14 +6,14 @@ namespace GeometryTD.Definition
|
||||
{
|
||||
public static class RarityTagBudgetRuleRegistry
|
||||
{
|
||||
private static readonly Dictionary<RarityType, RarityTagBudgetRuleData> RulesByRarity = CreateDefaultRules();
|
||||
private static readonly Dictionary<RarityType, RarityTagBudgetRule> RulesByRarity = CreateDefaultRules();
|
||||
|
||||
public static IReadOnlyDictionary<RarityType, RarityTagBudgetRuleData> Rules => RulesByRarity;
|
||||
public static IReadOnlyDictionary<RarityType, RarityTagBudgetRule> Rules => RulesByRarity;
|
||||
|
||||
public static void ResetToDefaults()
|
||||
{
|
||||
RulesByRarity.Clear();
|
||||
foreach (KeyValuePair<RarityType, RarityTagBudgetRuleData> pair in CreateDefaultRules())
|
||||
foreach (KeyValuePair<RarityType, RarityTagBudgetRule> pair in CreateDefaultRules())
|
||||
{
|
||||
RulesByRarity.Add(pair.Key, pair.Value);
|
||||
}
|
||||
@@ -28,14 +28,14 @@ namespace GeometryTD.Definition
|
||||
}
|
||||
}
|
||||
|
||||
public static bool TryGetRule(RarityType rarity, out RarityTagBudgetRuleData rule)
|
||||
public static bool TryGetRule(RarityType rarity, out RarityTagBudgetRule rule)
|
||||
{
|
||||
return RulesByRarity.TryGetValue(rarity, out rule);
|
||||
}
|
||||
|
||||
private static Dictionary<RarityType, RarityTagBudgetRuleData> CreateDefaultRules()
|
||||
private static Dictionary<RarityType, RarityTagBudgetRule> CreateDefaultRules()
|
||||
{
|
||||
return new Dictionary<RarityType, RarityTagBudgetRuleData>
|
||||
return new Dictionary<RarityType, RarityTagBudgetRule>
|
||||
{
|
||||
[RarityType.White] = CreateRule(RarityType.White, 0, 1),
|
||||
[RarityType.Green] = CreateRule(RarityType.Green, 1, 1),
|
||||
@@ -45,13 +45,13 @@ namespace GeometryTD.Definition
|
||||
};
|
||||
}
|
||||
|
||||
private static RarityTagBudgetRuleData CreateRule(RarityType rarity, int minCount, int maxCount)
|
||||
private static RarityTagBudgetRule CreateRule(RarityType rarity, int minCount, int maxCount)
|
||||
{
|
||||
Debug.Assert(rarity >= RarityType.White && rarity <= RarityType.Red);
|
||||
Debug.Assert(minCount >= 0);
|
||||
Debug.Assert(maxCount >= minCount);
|
||||
|
||||
return new RarityTagBudgetRuleData
|
||||
return new RarityTagBudgetRule
|
||||
{
|
||||
Rarity = rarity,
|
||||
MinCount = minCount,
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
namespace GeometryTD.Definition
|
||||
{
|
||||
public sealed class TagGenerationRuleData
|
||||
public sealed class TagGenerationRule
|
||||
{
|
||||
public TagType TagType { get; set; }
|
||||
public RarityType MinRarity { get; set; }
|
||||
+8
-8
@@ -6,14 +6,14 @@ namespace GeometryTD.Definition
|
||||
{
|
||||
public static class TagGenerationRuleRegistry
|
||||
{
|
||||
private static readonly Dictionary<TagType, TagGenerationRuleData> RulesByTag = CreateDefaultRules();
|
||||
private static readonly Dictionary<TagType, TagGenerationRule> RulesByTag = CreateDefaultRules();
|
||||
|
||||
public static IReadOnlyDictionary<TagType, TagGenerationRuleData> Rules => RulesByTag;
|
||||
public static IReadOnlyDictionary<TagType, TagGenerationRule> Rules => RulesByTag;
|
||||
|
||||
public static void ResetToDefaults()
|
||||
{
|
||||
RulesByTag.Clear();
|
||||
foreach (KeyValuePair<TagType, TagGenerationRuleData> pair in CreateDefaultRules())
|
||||
foreach (KeyValuePair<TagType, TagGenerationRule> pair in CreateDefaultRules())
|
||||
{
|
||||
RulesByTag.Add(pair.Key, pair.Value);
|
||||
}
|
||||
@@ -28,14 +28,14 @@ namespace GeometryTD.Definition
|
||||
}
|
||||
}
|
||||
|
||||
public static bool TryGetRule(TagType tagType, out TagGenerationRuleData rule)
|
||||
public static bool TryGetRule(TagType tagType, out TagGenerationRule rule)
|
||||
{
|
||||
return RulesByTag.TryGetValue(tagType, out rule);
|
||||
}
|
||||
|
||||
private static Dictionary<TagType, TagGenerationRuleData> CreateDefaultRules()
|
||||
private static Dictionary<TagType, TagGenerationRule> CreateDefaultRules()
|
||||
{
|
||||
return new Dictionary<TagType, TagGenerationRuleData>
|
||||
return new Dictionary<TagType, TagGenerationRule>
|
||||
{
|
||||
[TagType.Fire] = CreateRule(TagType.Fire, RarityType.White, 20),
|
||||
[TagType.BurnSpread] = CreateRule(TagType.BurnSpread, RarityType.White, 20),
|
||||
@@ -52,9 +52,9 @@ namespace GeometryTD.Definition
|
||||
};
|
||||
}
|
||||
|
||||
private static TagGenerationRuleData CreateRule(TagType tagType, RarityType minRarity, int weight)
|
||||
private static TagGenerationRule CreateRule(TagType tagType, RarityType minRarity, int weight)
|
||||
{
|
||||
return new TagGenerationRuleData
|
||||
return new TagGenerationRule
|
||||
{
|
||||
TagType = tagType,
|
||||
MinRarity = minRarity,
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e6251ee2cac123b43899d056ed4ad544
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c6219bd01b665fd4cae6580656c1f127
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+1
-1
@@ -3,7 +3,7 @@ using System;
|
||||
namespace GeometryTD.Definition
|
||||
{
|
||||
[Serializable]
|
||||
public sealed class TagDefinitionData
|
||||
public sealed class TagDefinition
|
||||
{
|
||||
public TagType TagType { get; set; }
|
||||
public TagCategory Category { get; set; }
|
||||
+35
-12
@@ -5,16 +5,16 @@ using UnityEngine;
|
||||
|
||||
namespace GeometryTD.Definition
|
||||
{
|
||||
public static class TagConfigRegistry
|
||||
public static class TagDefinitionRegistry
|
||||
{
|
||||
private static readonly Dictionary<TagType, TagDefinitionData> DefinitionsByTag = CreateDefaultDefinitions();
|
||||
private static readonly Dictionary<TagType, TagDefinition> DefinitionsByTag = CreateDefaultDefinitions();
|
||||
|
||||
public static IReadOnlyDictionary<TagType, TagDefinitionData> Definitions => DefinitionsByTag;
|
||||
public static IReadOnlyDictionary<TagType, TagDefinition> Definitions => DefinitionsByTag;
|
||||
|
||||
public static void ResetToDefaults()
|
||||
{
|
||||
DefinitionsByTag.Clear();
|
||||
foreach (KeyValuePair<TagType, TagDefinitionData> pair in CreateDefaultDefinitions())
|
||||
foreach (KeyValuePair<TagType, TagDefinition> pair in CreateDefaultDefinitions())
|
||||
{
|
||||
DefinitionsByTag.Add(pair.Key, pair.Value);
|
||||
}
|
||||
@@ -29,23 +29,36 @@ namespace GeometryTD.Definition
|
||||
}
|
||||
}
|
||||
|
||||
public static bool TryGetDefinition(TagType tagType, out TagDefinitionData definition)
|
||||
public static bool TryGetDefinition(TagType tagType, out TagDefinition definition)
|
||||
{
|
||||
return DefinitionsByTag.TryGetValue(tagType, out definition);
|
||||
}
|
||||
|
||||
private static Dictionary<TagType, TagDefinitionData> CreateDefaultDefinitions()
|
||||
public static void ApplyTagRows(IEnumerable<DRTag> rows)
|
||||
{
|
||||
return new Dictionary<TagType, TagDefinitionData>
|
||||
if (rows == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (DRTag row in rows)
|
||||
{
|
||||
ApplyTagRow(row);
|
||||
}
|
||||
}
|
||||
|
||||
private static Dictionary<TagType, TagDefinition> CreateDefaultDefinitions()
|
||||
{
|
||||
return new Dictionary<TagType, TagDefinition>
|
||||
{
|
||||
[TagType.Fire] = CreateDefinition(TagType.Fire, TagCategory.Status, TagTriggerPhase.OnAfterHit, new FireTagConfig(true)),
|
||||
[TagType.BurnSpread] = CreateDefinition(TagType.BurnSpread, TagCategory.AttackShape, TagTriggerPhase.OnKill, new BurnSpreadTagConfig(false)),
|
||||
[TagType.IgniteBurst] = CreateDefinition(TagType.IgniteBurst, TagCategory.AttackShape, TagTriggerPhase.OnKill, new IgniteBurstTagConfig(false)),
|
||||
[TagType.Inferno] = CreateDefinition(TagType.Inferno, TagCategory.Status, TagTriggerPhase.OnAfterHit, new InfernoTagConfig(true)),
|
||||
[TagType.Inferno] = CreateDefinition(TagType.Inferno, TagCategory.StatusModifier, TagTriggerPhase.OnAfterHit, new InfernoTagConfig(true)),
|
||||
[TagType.Ice] = CreateDefinition(TagType.Ice, TagCategory.Status, TagTriggerPhase.OnAfterHit, new IceTagConfig(true)),
|
||||
[TagType.FreezeMask] = CreateDefinition(TagType.FreezeMask, TagCategory.AttackShape, TagTriggerPhase.OnAfterHit, new FreezeMaskTagConfig(false)),
|
||||
[TagType.Shatter] = CreateDefinition(TagType.Shatter, TagCategory.NumericModifier, TagTriggerPhase.OnBeforeHit, new ShatterTagConfig(true)),
|
||||
[TagType.AbsoluteZero] = CreateDefinition(TagType.AbsoluteZero, TagCategory.Status, TagTriggerPhase.OnAfterHit, new AbsoluteZeroTagConfig(true)),
|
||||
[TagType.AbsoluteZero] = CreateDefinition(TagType.AbsoluteZero, TagCategory.StatusModifier, TagTriggerPhase.OnAfterHit, new AbsoluteZeroTagConfig(true)),
|
||||
[TagType.Pierce] = CreateDefinition(TagType.Pierce, TagCategory.AttackShape, TagTriggerPhase.OnHit, new PierceTagConfig(false)),
|
||||
[TagType.Crit] = CreateDefinition(TagType.Crit, TagCategory.NumericModifier, TagTriggerPhase.OnBeforeHit, new CritTagConfig(true)),
|
||||
[TagType.Overpenetrate] = CreateDefinition(TagType.Overpenetrate, TagCategory.AttackShape, TagTriggerPhase.OnHit, new OverpenetrateTagConfig(false)),
|
||||
@@ -53,13 +66,13 @@ namespace GeometryTD.Definition
|
||||
};
|
||||
}
|
||||
|
||||
private static TagDefinitionData CreateDefinition(
|
||||
private static TagDefinition CreateDefinition(
|
||||
TagType tagType,
|
||||
TagCategory category,
|
||||
TagTriggerPhase triggerPhase,
|
||||
TagConfigBase config)
|
||||
{
|
||||
return new TagDefinitionData
|
||||
return new TagDefinition
|
||||
{
|
||||
TagType = tagType,
|
||||
Category = category,
|
||||
@@ -72,7 +85,7 @@ namespace GeometryTD.Definition
|
||||
private static void ApplyRow(DRTagConfig row)
|
||||
{
|
||||
Debug.Assert(row != null);
|
||||
Debug.Assert(DefinitionsByTag.TryGetValue(row.TagType, out TagDefinitionData definition));
|
||||
Debug.Assert(DefinitionsByTag.TryGetValue(row.TagType, out TagDefinition definition));
|
||||
|
||||
definition.TriggerPhase = row.TriggerPhase;
|
||||
definition.Description = row.Description ?? string.Empty;
|
||||
@@ -109,6 +122,16 @@ namespace GeometryTD.Definition
|
||||
}
|
||||
}
|
||||
|
||||
private static void ApplyTagRow(DRTag row)
|
||||
{
|
||||
Debug.Assert(row != null);
|
||||
Debug.Assert(row.Id > 0);
|
||||
Debug.Assert(DefinitionsByTag.TryGetValue(row.TagType, out TagDefinition definition));
|
||||
Debug.Assert(definition.Config != null);
|
||||
|
||||
definition.Config.IsImplemented = row.IsImplemented;
|
||||
}
|
||||
|
||||
private static void ApplyFireConfig(FireTagConfig config, JObject param)
|
||||
{
|
||||
config.BurnDurationSeconds = ReadFloat(param, nameof(FireTagConfig.BurnDurationSeconds), config.BurnDurationSeconds);
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9f3ef8704ccb98147a21c03330278743
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+1
-1
@@ -163,7 +163,7 @@ namespace GeometryTD.CustomUtility
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
if (TagConfigRegistry.TryGetDefinition(tagType, out TagDefinitionData definition) &&
|
||||
if (TagDefinitionRegistry.TryGetDefinition(tagType, out TagDefinition definition) &&
|
||||
!string.IsNullOrWhiteSpace(definition.Description))
|
||||
{
|
||||
return definition.Description;
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c90264b23a9c45c0b21bc627a6109282
|
||||
timeCreated: 1773105821
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6fb08c76711246c2afa02d60769d76ef
|
||||
timeCreated: 1773106291
|
||||
@@ -202,7 +202,7 @@ namespace GeometryTD.Procedure
|
||||
var tagConfigTable = GameEntry.DataTable.GetDataTable<DRTagConfig>();
|
||||
if (tagConfigTable != null)
|
||||
{
|
||||
TagConfigRegistry.LoadFromRows(tagConfigTable.GetAllDataRows());
|
||||
TagDefinitionRegistry.LoadFromRows(tagConfigTable.GetAllDataRows());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,7 +211,9 @@ namespace GeometryTD.Procedure
|
||||
var tagTable = GameEntry.DataTable.GetDataTable<DRTag>();
|
||||
if (tagTable != null)
|
||||
{
|
||||
TagGenerationRuleRegistry.LoadFromRows(tagTable.GetAllDataRows());
|
||||
DRTag[] rows = tagTable.GetAllDataRows();
|
||||
TagGenerationRuleRegistry.LoadFromRows(rows);
|
||||
TagDefinitionRegistry.ApplyTagRows(rows);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ namespace GeometryTD.UI
|
||||
Rarity = normalizedRarity,
|
||||
Endurance = 100f,
|
||||
Constraint = config.Constraint,
|
||||
Tags = InventoryTagRuleService.ResolveComponentTags(
|
||||
Tags = ComponentTagGenerationService.ResolveComponentTags(
|
||||
config.PossibleTag,
|
||||
normalizedRarity,
|
||||
InventoryTagSourceType.Shop,
|
||||
@@ -211,7 +211,7 @@ namespace GeometryTD.UI
|
||||
Rarity = normalizedRarity,
|
||||
Endurance = 100f,
|
||||
Constraint = config.Constraint,
|
||||
Tags = InventoryTagRuleService.ResolveComponentTags(
|
||||
Tags = ComponentTagGenerationService.ResolveComponentTags(
|
||||
config.PossibleTag,
|
||||
normalizedRarity,
|
||||
InventoryTagSourceType.Shop,
|
||||
@@ -236,7 +236,7 @@ namespace GeometryTD.UI
|
||||
Rarity = normalizedRarity,
|
||||
Endurance = 100f,
|
||||
Constraint = config.Constraint,
|
||||
Tags = InventoryTagRuleService.ResolveComponentTags(
|
||||
Tags = ComponentTagGenerationService.ResolveComponentTags(
|
||||
config.PossibleTag,
|
||||
normalizedRarity,
|
||||
InventoryTagSourceType.Shop,
|
||||
|
||||
@@ -189,7 +189,7 @@ namespace GeometryTD.CustomUtility
|
||||
|
||||
private static TagType[] ResolveSeedTags(TagType[] possibleTags, RarityType rarity, long instanceId, int configId)
|
||||
{
|
||||
return InventoryTagRuleService.ResolveComponentTags(
|
||||
return ComponentTagGenerationService.ResolveComponentTags(
|
||||
possibleTags,
|
||||
rarity,
|
||||
InventoryTagSourceType.Seed,
|
||||
|
||||
+44
-44
@@ -6,34 +6,34 @@ using NUnit.Framework;
|
||||
|
||||
namespace GeometryTD.Tests.EditMode
|
||||
{
|
||||
public sealed class InventoryTagRuleServiceTests
|
||||
public sealed class ComponentTagGenerationServiceTests
|
||||
{
|
||||
private static readonly IReadOnlyDictionary<TagType, TagGenerationRuleData> RulesByTag =
|
||||
new Dictionary<TagType, TagGenerationRuleData>
|
||||
private static readonly IReadOnlyDictionary<TagType, TagGenerationRule> RulesByTag =
|
||||
new Dictionary<TagType, TagGenerationRule>
|
||||
{
|
||||
{ TagType.Fire, new TagGenerationRuleData { TagType = TagType.Fire, MinRarity = RarityType.White, Weight = 20 } },
|
||||
{ TagType.Ice, new TagGenerationRuleData { TagType = TagType.Ice, MinRarity = RarityType.White, Weight = 20 } },
|
||||
{ TagType.Crit, new TagGenerationRuleData { TagType = TagType.Crit, MinRarity = RarityType.White, Weight = 20 } },
|
||||
{ TagType.Shatter, new TagGenerationRuleData { TagType = TagType.Shatter, MinRarity = RarityType.Green, Weight = 15 } },
|
||||
{ TagType.Inferno, new TagGenerationRuleData { TagType = TagType.Inferno, MinRarity = RarityType.Purple, Weight = 5 } },
|
||||
{ TagType.AbsoluteZero, new TagGenerationRuleData { TagType = TagType.AbsoluteZero, MinRarity = RarityType.Purple, Weight = 5 } },
|
||||
{ TagType.Execution, new TagGenerationRuleData { TagType = TagType.Execution, MinRarity = RarityType.Purple, Weight = 5 } },
|
||||
{ TagType.Fire, new TagGenerationRule { TagType = TagType.Fire, MinRarity = RarityType.White, Weight = 20 } },
|
||||
{ TagType.Ice, new TagGenerationRule { TagType = TagType.Ice, MinRarity = RarityType.White, Weight = 20 } },
|
||||
{ TagType.Crit, new TagGenerationRule { TagType = TagType.Crit, MinRarity = RarityType.White, Weight = 20 } },
|
||||
{ TagType.Shatter, new TagGenerationRule { TagType = TagType.Shatter, MinRarity = RarityType.Green, Weight = 15 } },
|
||||
{ TagType.Inferno, new TagGenerationRule { TagType = TagType.Inferno, MinRarity = RarityType.Purple, Weight = 5 } },
|
||||
{ TagType.AbsoluteZero, new TagGenerationRule { TagType = TagType.AbsoluteZero, MinRarity = RarityType.Purple, Weight = 5 } },
|
||||
{ TagType.Execution, new TagGenerationRule { TagType = TagType.Execution, MinRarity = RarityType.Purple, Weight = 5 } },
|
||||
};
|
||||
|
||||
private static readonly IReadOnlyDictionary<RarityType, RarityTagBudgetRuleData> RarityTagBudgetRulesByRarity =
|
||||
new Dictionary<RarityType, RarityTagBudgetRuleData>
|
||||
private static readonly IReadOnlyDictionary<RarityType, RarityTagBudgetRule> RarityTagBudgetRulesByRarity =
|
||||
new Dictionary<RarityType, RarityTagBudgetRule>
|
||||
{
|
||||
{ RarityType.White, new RarityTagBudgetRuleData { Rarity = RarityType.White, MinCount = 0, MaxCount = 1 } },
|
||||
{ RarityType.Green, new RarityTagBudgetRuleData { Rarity = RarityType.Green, MinCount = 1, MaxCount = 1 } },
|
||||
{ RarityType.Blue, new RarityTagBudgetRuleData { Rarity = RarityType.Blue, MinCount = 1, MaxCount = 2 } },
|
||||
{ RarityType.Purple, new RarityTagBudgetRuleData { Rarity = RarityType.Purple, MinCount = 2, MaxCount = 2 } },
|
||||
{ RarityType.Red, new RarityTagBudgetRuleData { Rarity = RarityType.Red, MinCount = 2, MaxCount = 3 } },
|
||||
{ RarityType.White, new RarityTagBudgetRule { Rarity = RarityType.White, MinCount = 0, MaxCount = 1 } },
|
||||
{ RarityType.Green, new RarityTagBudgetRule { Rarity = RarityType.Green, MinCount = 1, MaxCount = 1 } },
|
||||
{ RarityType.Blue, new RarityTagBudgetRule { Rarity = RarityType.Blue, MinCount = 1, MaxCount = 2 } },
|
||||
{ RarityType.Purple, new RarityTagBudgetRule { Rarity = RarityType.Purple, MinCount = 2, MaxCount = 2 } },
|
||||
{ RarityType.Red, new RarityTagBudgetRule { Rarity = RarityType.Red, MinCount = 2, MaxCount = 3 } },
|
||||
};
|
||||
|
||||
[Test]
|
||||
public void GetEligibleTags_Filters_Invalid_Unsupported_And_HighRarity_Tags()
|
||||
{
|
||||
TagType[] result = InventoryTagRuleService.GetEligibleTags(
|
||||
TagType[] result = ComponentTagGenerationService.GetEligibleTags(
|
||||
new[]
|
||||
{
|
||||
TagType.None,
|
||||
@@ -52,7 +52,7 @@ namespace GeometryTD.Tests.EditMode
|
||||
[Test]
|
||||
public void ResolveComponentTags_Is_Deterministic_For_Same_Context()
|
||||
{
|
||||
TagType[] first = InventoryTagRuleService.ResolveComponentTags(
|
||||
TagType[] first = ComponentTagGenerationService.ResolveComponentTags(
|
||||
new[] { TagType.Fire, TagType.Ice, TagType.Crit, TagType.Shatter },
|
||||
RarityType.Blue,
|
||||
InventoryTagSourceType.Shop,
|
||||
@@ -60,7 +60,7 @@ namespace GeometryTD.Tests.EditMode
|
||||
7,
|
||||
RulesByTag);
|
||||
|
||||
TagType[] second = InventoryTagRuleService.ResolveComponentTags(
|
||||
TagType[] second = ComponentTagGenerationService.ResolveComponentTags(
|
||||
new[] { TagType.Fire, TagType.Ice, TagType.Crit, TagType.Shatter },
|
||||
RarityType.Blue,
|
||||
InventoryTagSourceType.Shop,
|
||||
@@ -74,7 +74,7 @@ namespace GeometryTD.Tests.EditMode
|
||||
[Test]
|
||||
public void ResolveComponentTags_Uses_Purple_Budget_And_Does_Not_Repeat()
|
||||
{
|
||||
TagType[] result = InventoryTagRuleService.ResolveComponentTags(
|
||||
TagType[] result = ComponentTagGenerationService.ResolveComponentTags(
|
||||
new[] { TagType.Fire, TagType.Ice, TagType.Crit, TagType.Shatter, TagType.Inferno, TagType.Execution },
|
||||
RarityType.Purple,
|
||||
InventoryTagSourceType.Drop,
|
||||
@@ -90,7 +90,7 @@ namespace GeometryTD.Tests.EditMode
|
||||
[Test]
|
||||
public void ResolveComponentTags_Falls_Back_When_Eligible_Count_Is_Lower_Than_Budget()
|
||||
{
|
||||
TagType[] result = InventoryTagRuleService.ResolveComponentTags(
|
||||
TagType[] result = ComponentTagGenerationService.ResolveComponentTags(
|
||||
new[] { TagType.Fire, TagType.BurnSpread },
|
||||
RarityType.Red,
|
||||
InventoryTagSourceType.Seed,
|
||||
@@ -105,15 +105,15 @@ namespace GeometryTD.Tests.EditMode
|
||||
[Test]
|
||||
public void ResolveComponentTags_Uses_Weight_Within_EligiblePool()
|
||||
{
|
||||
IReadOnlyDictionary<TagType, TagGenerationRuleData> weightedRules =
|
||||
new Dictionary<TagType, TagGenerationRuleData>
|
||||
IReadOnlyDictionary<TagType, TagGenerationRule> weightedRules =
|
||||
new Dictionary<TagType, TagGenerationRule>
|
||||
{
|
||||
{ TagType.Fire, new TagGenerationRuleData { TagType = TagType.Fire, MinRarity = RarityType.White, Weight = 100 } },
|
||||
{ TagType.Ice, new TagGenerationRuleData { TagType = TagType.Ice, MinRarity = RarityType.White, Weight = 1 } },
|
||||
{ TagType.Crit, new TagGenerationRuleData { TagType = TagType.Crit, MinRarity = RarityType.White, Weight = 1 } },
|
||||
{ TagType.Fire, new TagGenerationRule { TagType = TagType.Fire, MinRarity = RarityType.White, Weight = 100 } },
|
||||
{ TagType.Ice, new TagGenerationRule { TagType = TagType.Ice, MinRarity = RarityType.White, Weight = 1 } },
|
||||
{ TagType.Crit, new TagGenerationRule { TagType = TagType.Crit, MinRarity = RarityType.White, Weight = 1 } },
|
||||
};
|
||||
|
||||
TagType[] result = InventoryTagRuleService.ResolveComponentTags(
|
||||
TagType[] result = ComponentTagGenerationService.ResolveComponentTags(
|
||||
new[] { TagType.Fire, TagType.Ice, TagType.Crit },
|
||||
RarityType.Green,
|
||||
InventoryTagSourceType.Shop,
|
||||
@@ -129,19 +129,19 @@ namespace GeometryTD.Tests.EditMode
|
||||
[Test]
|
||||
public void ResolveComponentTags_Prefers_HighWeight_Tag_In_ExpandedPool()
|
||||
{
|
||||
IReadOnlyDictionary<TagType, TagGenerationRuleData> weightedRules =
|
||||
new Dictionary<TagType, TagGenerationRuleData>
|
||||
IReadOnlyDictionary<TagType, TagGenerationRule> weightedRules =
|
||||
new Dictionary<TagType, TagGenerationRule>
|
||||
{
|
||||
{ TagType.Fire, new TagGenerationRuleData { TagType = TagType.Fire, MinRarity = RarityType.White, Weight = 500 } },
|
||||
{ TagType.Ice, new TagGenerationRuleData { TagType = TagType.Ice, MinRarity = RarityType.White, Weight = 1 } },
|
||||
{ TagType.Crit, new TagGenerationRuleData { TagType = TagType.Crit, MinRarity = RarityType.White, Weight = 1 } },
|
||||
{ TagType.Shatter, new TagGenerationRuleData { TagType = TagType.Shatter, MinRarity = RarityType.White, Weight = 1 } },
|
||||
{ TagType.Fire, new TagGenerationRule { TagType = TagType.Fire, MinRarity = RarityType.White, Weight = 500 } },
|
||||
{ TagType.Ice, new TagGenerationRule { TagType = TagType.Ice, MinRarity = RarityType.White, Weight = 1 } },
|
||||
{ TagType.Crit, new TagGenerationRule { TagType = TagType.Crit, MinRarity = RarityType.White, Weight = 1 } },
|
||||
{ TagType.Shatter, new TagGenerationRule { TagType = TagType.Shatter, MinRarity = RarityType.White, Weight = 1 } },
|
||||
};
|
||||
|
||||
int fireCount = 0;
|
||||
for (int i = 0; i < 32; i++)
|
||||
{
|
||||
TagType[] result = InventoryTagRuleService.ResolveComponentTags(
|
||||
TagType[] result = ComponentTagGenerationService.ResolveComponentTags(
|
||||
new[] { TagType.Fire, TagType.Ice, TagType.Crit, TagType.Shatter },
|
||||
RarityType.Green,
|
||||
InventoryTagSourceType.Shop,
|
||||
@@ -168,7 +168,7 @@ namespace GeometryTD.Tests.EditMode
|
||||
|
||||
TagGenerationRuleRegistry.LoadFromRows(new[] { fireRow });
|
||||
|
||||
Assert.That(TagGenerationRuleRegistry.TryGetRule(TagType.Fire, out TagGenerationRuleData rule), Is.True);
|
||||
Assert.That(TagGenerationRuleRegistry.TryGetRule(TagType.Fire, out TagGenerationRule rule), Is.True);
|
||||
Assert.That(rule.MinRarity, Is.EqualTo(RarityType.Green));
|
||||
Assert.That(rule.Weight, Is.EqualTo(33));
|
||||
|
||||
@@ -178,15 +178,15 @@ namespace GeometryTD.Tests.EditMode
|
||||
[Test]
|
||||
public void ResolveRarityTagBudget_Uses_TableDriven_Range_Rules()
|
||||
{
|
||||
int whiteBudget = InventoryTagRuleService.ResolveRarityTagBudget(
|
||||
int whiteBudget = ComponentTagGenerationService.ResolveRarityTagBudget(
|
||||
RarityType.White,
|
||||
new System.Random(0),
|
||||
RarityTagBudgetRulesByRarity);
|
||||
int greenBudget = InventoryTagRuleService.ResolveRarityTagBudget(
|
||||
int greenBudget = ComponentTagGenerationService.ResolveRarityTagBudget(
|
||||
RarityType.Green,
|
||||
new System.Random(0),
|
||||
RarityTagBudgetRulesByRarity);
|
||||
int redBudget = InventoryTagRuleService.ResolveRarityTagBudget(
|
||||
int redBudget = ComponentTagGenerationService.ResolveRarityTagBudget(
|
||||
RarityType.Red,
|
||||
new System.Random(0),
|
||||
RarityTagBudgetRulesByRarity);
|
||||
@@ -199,10 +199,10 @@ namespace GeometryTD.Tests.EditMode
|
||||
[Test]
|
||||
public void ResolveComponentTags_Uses_Custom_Purple_Budget_From_Rules()
|
||||
{
|
||||
IReadOnlyDictionary<RarityType, RarityTagBudgetRuleData> customBudgetRules =
|
||||
new Dictionary<RarityType, RarityTagBudgetRuleData>(RarityTagBudgetRulesByRarity)
|
||||
IReadOnlyDictionary<RarityType, RarityTagBudgetRule> customBudgetRules =
|
||||
new Dictionary<RarityType, RarityTagBudgetRule>(RarityTagBudgetRulesByRarity)
|
||||
{
|
||||
[RarityType.Purple] = new RarityTagBudgetRuleData
|
||||
[RarityType.Purple] = new RarityTagBudgetRule
|
||||
{
|
||||
Rarity = RarityType.Purple,
|
||||
MinCount = 3,
|
||||
@@ -210,7 +210,7 @@ namespace GeometryTD.Tests.EditMode
|
||||
}
|
||||
};
|
||||
|
||||
TagType[] result = InventoryTagRuleService.ResolveComponentTags(
|
||||
TagType[] result = ComponentTagGenerationService.ResolveComponentTags(
|
||||
new[] { TagType.Fire, TagType.Ice, TagType.Crit, TagType.Shatter, TagType.Inferno, TagType.Execution },
|
||||
RarityType.Purple,
|
||||
InventoryTagSourceType.Drop,
|
||||
@@ -231,7 +231,7 @@ namespace GeometryTD.Tests.EditMode
|
||||
|
||||
RarityTagBudgetRuleRegistry.LoadFromRows(new[] { purpleRow });
|
||||
|
||||
Assert.That(RarityTagBudgetRuleRegistry.TryGetRule(RarityType.Purple, out RarityTagBudgetRuleData rule), Is.True);
|
||||
Assert.That(RarityTagBudgetRuleRegistry.TryGetRule(RarityType.Purple, out RarityTagBudgetRule rule), Is.True);
|
||||
Assert.That(rule.MinCount, Is.EqualTo(3));
|
||||
Assert.That(rule.MaxCount, Is.EqualTo(3));
|
||||
|
||||
@@ -278,7 +278,7 @@ namespace GeometryTD.Tests.EditMode
|
||||
public sealed class EnemyStatusTagRegistryTests
|
||||
{
|
||||
[Test]
|
||||
public void Registry_Registers_All_Status_Tags()
|
||||
public void Registry_Registers_Only_Independent_Status_Tags()
|
||||
{
|
||||
Assert.That(EnemyStatusTagRegistry.TryGetEffect(TagType.Fire, out IEnemyStatusTagEffect fireEffect), Is.True);
|
||||
Assert.That(fireEffect, Is.TypeOf<FireTagEffect>());
|
||||
@@ -286,50 +286,49 @@ namespace GeometryTD.Tests.EditMode
|
||||
Assert.That(EnemyStatusTagRegistry.TryGetEffect(TagType.Ice, out IEnemyStatusTagEffect iceEffect), Is.True);
|
||||
Assert.That(iceEffect, Is.TypeOf<IceTagEffect>());
|
||||
|
||||
Assert.That(EnemyStatusTagRegistry.TryGetEffect(TagType.Inferno, out IEnemyStatusTagEffect infernoEffect), Is.True);
|
||||
Assert.That(infernoEffect, Is.TypeOf<InfernoTagEffect>());
|
||||
|
||||
Assert.That(EnemyStatusTagRegistry.TryGetEffect(TagType.AbsoluteZero, out IEnemyStatusTagEffect absoluteZeroEffect), Is.True);
|
||||
Assert.That(absoluteZeroEffect, Is.TypeOf<AbsoluteZeroTagEffect>());
|
||||
Assert.That(EnemyStatusTagRegistry.TryGetEffect(TagType.Inferno, out _), Is.False);
|
||||
Assert.That(EnemyStatusTagRegistry.TryGetEffect(TagType.AbsoluteZero, out _), Is.False);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class TagConfigRegistryTests
|
||||
public sealed class TagDefinitionRegistryTests
|
||||
{
|
||||
[Test]
|
||||
public void Definitions_Register_All_Twelve_Tags()
|
||||
{
|
||||
Assert.That(TagConfigRegistry.Definitions.Count, Is.EqualTo(12));
|
||||
Assert.That(TagConfigRegistry.TryGetDefinition(TagType.Fire, out _), Is.True);
|
||||
Assert.That(TagConfigRegistry.TryGetDefinition(TagType.Execution, out _), Is.True);
|
||||
Assert.That(TagConfigRegistry.TryGetDefinition(TagType.Overpenetrate, out _), Is.True);
|
||||
Assert.That(TagDefinitionRegistry.Definitions.Count, Is.EqualTo(12));
|
||||
Assert.That(TagDefinitionRegistry.TryGetDefinition(TagType.Fire, out _), Is.True);
|
||||
Assert.That(TagDefinitionRegistry.TryGetDefinition(TagType.Execution, out _), Is.True);
|
||||
Assert.That(TagDefinitionRegistry.TryGetDefinition(TagType.Overpenetrate, out _), Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Definitions_Assign_Documented_Categories_And_Phases()
|
||||
{
|
||||
AssertDefinition(TagType.Fire, TagCategory.Status, TagTriggerPhase.OnAfterHit);
|
||||
AssertDefinition(TagType.Inferno, TagCategory.StatusModifier, TagTriggerPhase.OnAfterHit);
|
||||
AssertDefinition(TagType.Crit, TagCategory.NumericModifier, TagTriggerPhase.OnBeforeHit);
|
||||
AssertDefinition(TagType.Pierce, TagCategory.AttackShape, TagTriggerPhase.OnHit);
|
||||
AssertDefinition(TagType.BurnSpread, TagCategory.AttackShape, TagTriggerPhase.OnKill);
|
||||
AssertDefinition(TagType.AbsoluteZero, TagCategory.StatusModifier, TagTriggerPhase.OnAfterHit);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Definitions_Mark_FirstBatch_SevenTags_AsImplemented()
|
||||
{
|
||||
Assert.That(TagConfigRegistry.TryGetDefinition(TagType.Shatter, out TagDefinitionData shatter), Is.True);
|
||||
Assert.That(TagDefinitionRegistry.TryGetDefinition(TagType.Shatter, out TagDefinition shatter), Is.True);
|
||||
Assert.That(shatter.Config, Is.TypeOf<ShatterTagConfig>());
|
||||
Assert.That(((ShatterTagConfig)shatter.Config).IsImplemented, Is.True);
|
||||
|
||||
Assert.That(TagConfigRegistry.TryGetDefinition(TagType.Inferno, out TagDefinitionData inferno), Is.True);
|
||||
Assert.That(TagDefinitionRegistry.TryGetDefinition(TagType.Inferno, out TagDefinition inferno), Is.True);
|
||||
Assert.That(inferno.Config, Is.TypeOf<InfernoTagConfig>());
|
||||
Assert.That(((InfernoTagConfig)inferno.Config).IsImplemented, Is.True);
|
||||
|
||||
Assert.That(TagConfigRegistry.TryGetDefinition(TagType.AbsoluteZero, out TagDefinitionData absoluteZero), Is.True);
|
||||
Assert.That(TagDefinitionRegistry.TryGetDefinition(TagType.AbsoluteZero, out TagDefinition absoluteZero), Is.True);
|
||||
Assert.That(absoluteZero.Config, Is.TypeOf<AbsoluteZeroTagConfig>());
|
||||
Assert.That(((AbsoluteZeroTagConfig)absoluteZero.Config).IsImplemented, Is.True);
|
||||
|
||||
Assert.That(TagConfigRegistry.TryGetDefinition(TagType.Pierce, out TagDefinitionData pierce), Is.True);
|
||||
Assert.That(TagDefinitionRegistry.TryGetDefinition(TagType.Pierce, out TagDefinition pierce), Is.True);
|
||||
Assert.That(pierce.Config, Is.TypeOf<PierceTagConfig>());
|
||||
Assert.That(((PierceTagConfig)pierce.Config).IsImplemented, Is.False);
|
||||
}
|
||||
@@ -341,9 +340,9 @@ namespace GeometryTD.Tests.EditMode
|
||||
bool parsed = fireRow.ParseDataRow("\t1\t元素\tFire\tOnAfterHit\t火焰测试描述\t{\"BurnDurationSeconds\":4,\"BurnDamagePerSecondPerStack\":25,\"MaxEffectiveStack\":3}", null);
|
||||
Assert.That(parsed, Is.True);
|
||||
|
||||
TagConfigRegistry.LoadFromRows(new[] { fireRow });
|
||||
TagDefinitionRegistry.LoadFromRows(new[] { fireRow });
|
||||
|
||||
Assert.That(TagConfigRegistry.TryGetDefinition(TagType.Fire, out TagDefinitionData fire), Is.True);
|
||||
Assert.That(TagDefinitionRegistry.TryGetDefinition(TagType.Fire, out TagDefinition fire), Is.True);
|
||||
Assert.That(fire.TriggerPhase, Is.EqualTo(TagTriggerPhase.OnAfterHit));
|
||||
Assert.That(fire.Description, Is.EqualTo("火焰测试描述"));
|
||||
Assert.That(fire.Config, Is.TypeOf<FireTagConfig>());
|
||||
@@ -353,7 +352,23 @@ namespace GeometryTD.Tests.EditMode
|
||||
Assert.That(config.BurnDamagePerSecondPerStack, Is.EqualTo(25f).Within(0.001f));
|
||||
Assert.That(config.MaxEffectiveStack, Is.EqualTo(3));
|
||||
|
||||
TagConfigRegistry.ResetToDefaults();
|
||||
TagDefinitionRegistry.ResetToDefaults();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ApplyTagRows_Overrides_IsImplemented_From_TagTable()
|
||||
{
|
||||
DRTag pierceRow = new DRTag();
|
||||
Assert.That(pierceRow.ParseDataRow("\t9\t穿透\tPierce\tPenetrate\tWhite\t20\tTrue", null), Is.True);
|
||||
|
||||
TagDefinitionRegistry.ResetToDefaults();
|
||||
TagDefinitionRegistry.ApplyTagRows(new[] { pierceRow });
|
||||
|
||||
Assert.That(TagDefinitionRegistry.TryGetDefinition(TagType.Pierce, out TagDefinition pierce), Is.True);
|
||||
Assert.That(pierce.Config, Is.TypeOf<PierceTagConfig>());
|
||||
Assert.That(((PierceTagConfig)pierce.Config).IsImplemented, Is.True);
|
||||
|
||||
TagDefinitionRegistry.ResetToDefaults();
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -364,14 +379,14 @@ namespace GeometryTD.Tests.EditMode
|
||||
Assert.That(fireRow.ParseDataRow("\t1\t元素\tFire\tOnAfterHit\t持续燃烧\t{\"BurnDurationSeconds\":3,\"BurnDamagePerSecondPerStack\":20,\"MaxEffectiveStack\":5}", null), Is.True);
|
||||
Assert.That(shatterRow.ParseDataRow("\t7\t控制\tShatter\tOnBeforeHit\t对减速目标增伤\t{\"RequiresSlowedTarget\":true,\"DamageBonusPerStack\":0.25}", null), Is.True);
|
||||
|
||||
TagConfigRegistry.LoadFromRows(new[] { fireRow, shatterRow });
|
||||
TagDefinitionRegistry.LoadFromRows(new[] { fireRow, shatterRow });
|
||||
|
||||
string description = TagDisplayUtility.BuildTagDescriptionText(new[] { TagType.Fire, TagType.Shatter });
|
||||
|
||||
Assert.That(description, Does.Contain("持续燃烧"));
|
||||
Assert.That(description, Does.Contain("对减速目标增伤"));
|
||||
|
||||
TagConfigRegistry.ResetToDefaults();
|
||||
TagDefinitionRegistry.ResetToDefaults();
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -380,7 +395,7 @@ namespace GeometryTD.Tests.EditMode
|
||||
DRTagConfig iceRow = new DRTagConfig();
|
||||
Assert.That(iceRow.ParseDataRow("\t5\t控制\tIce\tOnAfterHit\t命中附加减速\t{\"SlowDurationSeconds\":2,\"SlowRatioPerStack\":0.2,\"MinMoveSpeedMultiplier\":0.4}", null), Is.True);
|
||||
|
||||
TagConfigRegistry.LoadFromRows(new[] { iceRow });
|
||||
TagDefinitionRegistry.LoadFromRows(new[] { iceRow });
|
||||
|
||||
string description = TagDisplayUtility.BuildTagDescriptionText(new[]
|
||||
{
|
||||
@@ -390,7 +405,7 @@ namespace GeometryTD.Tests.EditMode
|
||||
Assert.That(description, Does.Contain("Ice x2"));
|
||||
Assert.That(description, Does.Contain("命中附加减速"));
|
||||
|
||||
TagConfigRegistry.ResetToDefaults();
|
||||
TagDefinitionRegistry.ResetToDefaults();
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -418,7 +433,7 @@ namespace GeometryTD.Tests.EditMode
|
||||
|
||||
private static void AssertDefinition(TagType tagType, TagCategory expectedCategory, TagTriggerPhase expectedPhase)
|
||||
{
|
||||
Assert.That(TagConfigRegistry.TryGetDefinition(tagType, out TagDefinitionData definition), Is.True);
|
||||
Assert.That(TagDefinitionRegistry.TryGetDefinition(tagType, out TagDefinition definition), Is.True);
|
||||
Assert.That(definition, Is.Not.Null);
|
||||
Assert.That(definition.Category, Is.EqualTo(expectedCategory));
|
||||
Assert.That(definition.TriggerPhase, Is.EqualTo(expectedPhase));
|
||||
|
||||
Reference in New Issue
Block a user