Пример #1
0
        private IEnumerable <DiaOption> GetDiaOptions(Pawn usedBy)
        {
            foreach (Trait trait in usedBy.story.traits.allTraits)
            {
                DiaOption diaOption = new DiaOption(trait.LabelCap)
                {
                    action = delegate
                    {
                        Trait reTrait = new Trait(trait.def, trait.Degree);
                        PolarisUtility.GainSkillsExtra(usedBy, trait.CurrentData.skillGains, false);
                        usedBy.story.traits.allTraits.Remove(trait);

                        //this.RefreshPawnStat(usedBy);
                        PolarisUtility.RefreshPawnStat(usedBy);

                        this.parent.GetComp <CompTraitreleaser>().trait = reTrait;
                        this.parent.GetComp <CompTraitreleaser>().availableTimes--;
                        Messages.Message("PolarisTraitreleaserUsedRemovedTrait".Translate(usedBy.LabelShort, trait.LabelCap), usedBy, MessageTypeDefOf.PositiveEvent);
                    },
                    resolveTree = true
                };
                yield return(diaOption);
            }
            yield break;
        }
Пример #2
0
        private IEnumerable <DebugMenuOption> GenDebugMenuOptions(Pawn usedBy)
        {
            foreach (Trait trait in usedBy.story.traits.allTraits)
            {
                DebugMenuOption option = new DebugMenuOption(string.Concat(new object[]
                {
                    trait.LabelCap,
                    " (",
                    trait.Degree,
                    ")"
                }), DebugMenuOptionMode.Action, delegate()
                {
                    Trait reTrait = new Trait(trait.def, trait.Degree);
                    PolarisUtility.GainSkillsExtra(usedBy, trait.CurrentData.skillGains, false);
                    usedBy.story.traits.allTraits.Remove(trait);
                    PolarisUtility.RefreshPawnStat(usedBy);
                    this.parent.GetComp <CompTraitreleaser>().trait = reTrait;
                    this.parent.GetComp <CompTraitreleaser>().availableTimes--;
                    Messages.Message("PolarisTraitreleaserUsedRemovedTrait".Translate(usedBy.LabelShort, trait.LabelCap), usedBy, MessageTypeDefOf.PositiveEvent);
                });
                yield return(option);
            }

            yield break;
        }
        public override void DoEffect(Pawn usedBy)
        {
            base.DoEffect(usedBy);
            MemResetMode memResetMode   = this.parent.GetComp <CompMomeryRester>().memResetMode;
            Backstory    childhoodStory = this.parent.GetComp <CompMomeryRester>().childhoodStory;
            Backstory    adulthoodStory = this.parent.GetComp <CompMomeryRester>().adulthoodStory;

            if (memResetMode == MemResetMode.childhood)
            {
                if (usedBy.story.childhood != null)
                {
                    Messages.Message("PolarisMomeryResterStorySuccessfullyChanged".Translate(usedBy.LabelShort, usedBy.story.childhood.title, childhoodStory.title), usedBy, MessageTypeDefOf.PositiveEvent);
                    PolarisUtility.GainSkillsExtra(usedBy, usedBy.story.childhood.skillGainsResolved, false);
                    PolarisUtility.GainSkillsExtra(usedBy, childhoodStory.skillGainsResolved, true);
                    usedBy.story.childhood = childhoodStory;
                    PolarisUtility.RefreshPawnStat(usedBy);
                }
                else
                {
                    Messages.Message("PolarisMomeryResterHaveNoAvaliableStory".Translate(usedBy.LabelShort, childhoodStory.title), usedBy, MessageTypeDefOf.NegativeEvent);
                    PolarisUtility.GainSkillsExtra(usedBy, childhoodStory.skillGainsResolved, true);
                    usedBy.story.childhood = childhoodStory;
                    PolarisUtility.RefreshPawnStat(usedBy);
                }
            }
            else if (memResetMode == MemResetMode.adulthood)
            {
                if (usedBy.story.adulthood != null)
                {
                    Messages.Message("PolarisMomeryResterStorySuccessfullyChanged".Translate(usedBy.LabelShort, usedBy.story.adulthood.title, adulthoodStory.title), usedBy, MessageTypeDefOf.PositiveEvent);
                    PolarisUtility.GainSkillsExtra(usedBy, usedBy.story.adulthood.skillGainsResolved, false);
                    PolarisUtility.GainSkillsExtra(usedBy, adulthoodStory.skillGainsResolved, true);
                    usedBy.story.adulthood = adulthoodStory;
                    PolarisUtility.RefreshPawnStat(usedBy);
                }
                else
                {
                    Messages.Message("PolarisMomeryResterHaveNoAvaliableStory".Translate(usedBy.LabelShort, adulthoodStory.title), usedBy, MessageTypeDefOf.NegativeEvent);
                    PolarisUtility.GainSkillsExtra(usedBy, adulthoodStory.skillGainsResolved, true);
                    usedBy.story.adulthood = adulthoodStory;
                    PolarisUtility.RefreshPawnStat(usedBy);
                }
            }
            else
            {
                Messages.Message("PolarisMomeryResterUnknownError".Translate(), MessageTypeDefOf.NegativeEvent);
            }
        }