Ejemplo n.º 1
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;
        }
Ejemplo n.º 2
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;
        }
Ejemplo n.º 3
0
        private void AddTrait(Pawn usedBy, Trait trait, List <Trait> traits)
        {
            List <Trait> ctraits = this.ConflictTraits(traits, trait);

            if (!ctraits.NullOrEmpty())
            {
                string textConflitTraits = string.Empty;
                for (int i = 0; i < traits.Count; i++)
                {
                    if (ctraits.Contains(traits[i]))
                    {
                        textConflitTraits += traits[i].LabelCap + " ";
                        traits.Remove(traits[i]);
                        i--;
                    }
                }
                usedBy.story.traits.GainTrait(trait);
                //traits.Add(trait);
                Messages.Message("PolarisTraitreleaserUsedReplaceConflitTraits".Translate(usedBy.LabelShort, trait.LabelCap, textConflitTraits), usedBy, MessageTypeDefOf.PositiveEvent);
            }

            /*else if (traits.Count >= 8)
             * {
             *  Messages.Message("PolarisTraitreleaserUsedHasNoEnoughSlots".Translate(usedBy.LabelShort), usedBy, MessageTypeDefOf.NegativeEvent);
             * }*/
            else
            {
                //traits.Add(trait);
                usedBy.story.traits.GainTrait(trait);
                Messages.Message("PolarisTraitreleaserUsedAddTrait".Translate(usedBy.LabelShort, trait.LabelCap), usedBy, MessageTypeDefOf.PositiveEvent);
            }
            PolarisUtility.GainSkillsExtra(usedBy, trait.CurrentData.skillGains, true);
        }
        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);
            }
        }
        private static void RemoveTrait(Pawn pawn)
        {
            List <DebugMenuOption> list = new List <DebugMenuOption>();

            foreach (Trait trait in pawn.story.traits.allTraits)
            {
                list.Add(new DebugMenuOption(string.Concat(new object[]
                {
                    trait.LabelCap,
                    " (",
                    trait.Degree,
                    ")"
                }), DebugMenuOptionMode.Action, delegate()
                {
                    PolarisUtility.GainSkillsExtra(pawn, trait.CurrentData.skillGains, false);
                    pawn.story.traits.RemoveTrait(trait);
                    DebugActionsUtility.DustPuffFrom(pawn);
                }));
            }
            Find.WindowStack.Add(new Dialog_DebugOptionListLister(list));
        }