diff --git a/1.6/Assemblies/WulaFallenEmpire.dll b/1.6/Assemblies/WulaFallenEmpire.dll index 140a677b..8941d0b0 100644 Binary files a/1.6/Assemblies/WulaFallenEmpire.dll and b/1.6/Assemblies/WulaFallenEmpire.dll differ diff --git a/1.6/Defs/ThingDefs/WULA_Item.xml b/1.6/Defs/ThingDefs/WULA_Item.xml index 78871d87..c79434b5 100644 --- a/1.6/Defs/ThingDefs/WULA_Item.xml +++ b/1.6/Defs/ThingDefs/WULA_Item.xml @@ -513,4 +513,238 @@ + + + + + + WULA_Syhth_Passion_Trainer_Melee + + +
  • + UseNeurotrainer + 使用数据包激发格斗兴趣 + true + Wula_Synth +
  • +
  • + + Melee + + Major + + 0~1 +
  • +
    +
    + + + + WULA_Syhth_Passion_Trainer_Shooting + + +
  • + UseNeurotrainer + 使用数据包激发射击兴趣 + true + Wula_Synth +
  • +
  • + Shooting + Major + 0~1 +
  • +
    +
    + + + + WULA_Syhth_Passion_Trainer_Construction + + +
  • + UseNeurotrainer + 使用数据包激发建造兴趣 + true + Wula_Synth +
  • +
  • + Construction + Major + 0~1 +
  • +
    +
    + + + + WULA_Syhth_Passion_Trainer_Mining + + +
  • + UseNeurotrainer + 使用数据包激发采矿兴趣 + true + Wula_Synth +
  • +
  • + Mining + Major + 0~1 +
  • +
    +
    + + + + WULA_Syhth_Passion_Trainer_Cooking + + +
  • + UseNeurotrainer + 使用数据包激发烹饪兴趣 + true + Wula_Synth +
  • +
  • + Cooking + Major + 0~1 +
  • +
    +
    + + + + WULA_Syhth_Passion_Trainer_Plants + + +
  • + UseNeurotrainer + 使用数据包激发种植兴趣 + true + Wula_Synth +
  • +
  • + Plants + Major + 0~1 +
  • +
    +
    + + + + WULA_Syhth_Passion_Trainer_Animals + + +
  • + UseNeurotrainer + 使用数据包激发驯兽兴趣 + true + Wula_Synth +
  • +
  • + Animals + Major + 0~1 +
  • +
    +
    + + + + WULA_Syhth_Passion_Trainer_Crafting + + +
  • + UseNeurotrainer + 使用数据包激发手工兴趣 + true + Wula_Synth +
  • +
  • + Crafting + Major + 0~1 +
  • +
    +
    + + + + WULA_Syhth_Passion_Trainer_Artistic + + +
  • + UseNeurotrainer + 使用数据包激发艺术兴趣 + true + Wula_Synth +
  • +
  • + Artistic + Major + 0~1 +
  • +
    +
    + + + + WULA_Syhth_Passion_Trainer_Medicine + + +
  • + UseNeurotrainer + 使用数据包激发医疗兴趣 + true + Wula_Synth +
  • +
  • + Medicine + Major + 0~1 +
  • +
    +
    + + + + WULA_Syhth_Passion_Trainer_Social + + +
  • + UseNeurotrainer + 使用数据包激发社交兴趣 + true + Wula_Synth +
  • +
  • + Social + Major + 0~1 +
  • +
    +
    + + + + WULA_Syhth_Passion_Trainer_Intellectual + + +
  • + UseNeurotrainer + 使用数据包激发智识兴趣 + true + Wula_Synth +
  • +
  • + Intellectual + Major + 0~1 +
  • +
    +
    + diff --git a/Languages/ChineseSimplified (简体中文)/Keyed/WULA_SkillTrainer.xml b/Languages/ChineseSimplified (简体中文)/Keyed/WULA_SkillTrainer.xml index da581b7f..40a7d72b 100644 --- a/Languages/ChineseSimplified (简体中文)/Keyed/WULA_SkillTrainer.xml +++ b/Languages/ChineseSimplified (简体中文)/Keyed/WULA_SkillTrainer.xml @@ -8,4 +8,13 @@ {0}不是机械乌拉,无法使用此修理套件。 机械乌拉修理套件 + + {0}对{1}技能燃起了新的热情! + 作为代价,{0}失去了对{1}技能的热情。 + + + {0}没有技能系统,无法使用。 + 该训练器未指定目标技能。 + 目标技能已被禁用,无法学习。 + diff --git a/Source/WulaFallenEmpire/.vs/WulaFallenEmpire/v17/.suo b/Source/WulaFallenEmpire/.vs/WulaFallenEmpire/v17/.suo index c247e730..0308adc5 100644 Binary files a/Source/WulaFallenEmpire/.vs/WulaFallenEmpire/v17/.suo and b/Source/WulaFallenEmpire/.vs/WulaFallenEmpire/v17/.suo differ diff --git a/Source/WulaFallenEmpire/CompUseEffect_PassionTrainer.cs b/Source/WulaFallenEmpire/CompUseEffect_PassionTrainer.cs new file mode 100644 index 00000000..07137ca6 --- /dev/null +++ b/Source/WulaFallenEmpire/CompUseEffect_PassionTrainer.cs @@ -0,0 +1,87 @@ +using RimWorld; +using Verse; +using System.Collections.Generic; +using System.Linq; + +namespace WulaFallenEmpire +{ + public class CompProperties_UseEffect_PassionTrainer : CompProperties_UseEffect + { + public SkillDef skill; + public Passion passionGained = Passion.Major; // 可配置获得的热情等级,默认为大火 + public IntRange passionsLostRange = new IntRange(1, 1); // 可配置失去热情的技能数量范围 + + public CompProperties_UseEffect_PassionTrainer() + { + compClass = typeof(CompUseEffect_PassionTrainer); + } + } + + public class CompUseEffect_PassionTrainer : CompUseEffect + { + public CompProperties_UseEffect_PassionTrainer Props => (CompProperties_UseEffect_PassionTrainer)props; + + public override void DoEffect(Pawn usedBy) + { + base.DoEffect(usedBy); + + if (usedBy.skills == null || Props.skill == null) + { + return; + } + + // 1. 为指定技能设置热情 + SkillRecord targetSkillRecord = usedBy.skills.GetSkill(Props.skill); + if (targetSkillRecord != null && !targetSkillRecord.TotallyDisabled) + { + if (targetSkillRecord.passion != Props.passionGained) + { + targetSkillRecord.passion = Props.passionGained; + Messages.Message("WULA_PassionGained".Translate(usedBy.LabelShort, targetSkillRecord.def.label), usedBy, MessageTypeDefOf.PositiveEvent); + } + } + + // 2. 确定要移除的热情数量 + int numToLose = Props.passionsLostRange.RandomInRange; + if (numToLose <= 0) + { + return; // 如果随机到0或更少,则不移除任何热情 + } + + // 3. 找到所有其他拥有热情的技能 + List skillsWithPassion = usedBy.skills.skills + .Where(s => s.def != Props.skill && s.passion > Passion.None && !s.TotallyDisabled) + .ToList(); + + skillsWithPassion.Shuffle(); // 打乱列表以实现随机性 + + // 4. 移除指定数量技能的热情 + int passionsRemoved = 0; + foreach (var skillToLosePassion in skillsWithPassion) + { + if (passionsRemoved >= numToLose) break; + + skillToLosePassion.passion = Passion.None; + Messages.Message("WULA_PassionLost".Translate(usedBy.LabelShort, skillToLosePassion.def.label), usedBy, MessageTypeDefOf.NegativeEvent); + passionsRemoved++; + } + } + + public override AcceptanceReport CanBeUsedBy(Pawn p) + { + if (p.skills == null) + { + return "PawnHasNoSkills".Translate(p.LabelShort); + } + if (Props.skill == null) + { + return "SkillTrainerHasNoSkill".Translate(parent.LabelShort); + } + if (p.skills.GetSkill(Props.skill).TotallyDisabled) + { + return "SkillDisabled".Translate(); + } + return base.CanBeUsedBy(p); + } + } +} diff --git a/Source/WulaFallenEmpire/WulaFallenEmpire.csproj b/Source/WulaFallenEmpire/WulaFallenEmpire.csproj index 162ed79a..e68fb724 100644 --- a/Source/WulaFallenEmpire/WulaFallenEmpire.csproj +++ b/Source/WulaFallenEmpire/WulaFallenEmpire.csproj @@ -86,6 +86,7 @@ +