コード例 #1
0
        private void TraitObjectModifier(TraitObject traitObject, Color color, Hero hero, string trait, int amount, int xp, bool display)
        {
            if (xp == 0)
            {
                int currentTraitLevel = hero.GetTraitLevel(traitObject);
                int newNumber         = currentTraitLevel + amount;
                if (newNumber < 0)
                {
                    newNumber = 0;
                }


                hero.SetTraitLevel(traitObject, newNumber);

                if (!display)
                {
                    return;
                }
                TextObject textObject = GameTexts.FindText("str_CE_trait_level");
                textObject.SetTextVariable("HERO", hero.Name);
                textObject.SetTextVariable("POSITIVE", newNumber >= 0 ? 1 : 0);
                textObject.SetTextVariable("TRAIT", CEStrings.FetchTraitString(trait));
                InformationManager.DisplayMessage(new InformationMessage(textObject.ToString(), color));
            }
            else if (hero == Hero.MainHero)
            {
                Campaign.Current.PlayerTraitDeveloper.AddTraitXp(traitObject, xp);
            }
        }
 public HeroAdminDevelopTraitItemVM(TraitObject traitObject, int value, Action <TraitObject, int> onTraitChange)
 {
     this._traitObject    = traitObject;
     this._attributeValue = value;
     this._onTraitChange  = onTraitChange;
     this._nameText       = traitObject.Name.ToString();
 }
コード例 #3
0
        private void ApplyPersonalityTraitConsequence()
        {
            if (PersonalityTrait == null)
            {
                return;
            }

            var value = GetModifierValue();
            var hero  = IdentifySubject().ToHero();

            if (PersonalityTrait == PersonalityTraits.MERCY)
            {
                hero.SetTraitLevel(TraitObject.FindFirst(n => n.StringId.ToUpper() == "MERCY"), hero.GetHeroTraits().Mercy + value);
            }
            if (PersonalityTrait == PersonalityTraits.GENEROSITY)
            {
                hero.SetTraitLevel(TraitObject.FindFirst(n => n.StringId.ToUpper() == "GENEROSITY"), hero.GetHeroTraits().Generosity + value);
            }
            if (PersonalityTrait == PersonalityTraits.HONOR)
            {
                hero.SetTraitLevel(TraitObject.FindFirst(n => n.StringId.ToUpper() == "HONOR"), hero.GetHeroTraits().Honor + value);
            }
            if (PersonalityTrait == PersonalityTraits.VALOR)
            {
                hero.SetTraitLevel(TraitObject.FindFirst(n => n.StringId.ToUpper() == "VALOR"), hero.GetHeroTraits().Valor + value);
            }
        }
コード例 #4
0
        public void SetTraitLevel(TraitObject traitObject, int newLevel)
        {
            HeroAdminCharacterTrait result = Traits.FirstOrDefault(tr => tr.StringId.Equals(traitObject.StringId));

            if (null != result)
            {
                result.Level = newLevel;
            }
        }
コード例 #5
0
        public static void InitTrait(Hero hero)
        {
            Random randomTraits = new Random();

            hero.SetTraitLevel(TraitObject.Find("Valor"), randomTraits.Next(0, 5));
            hero.SetTraitLevel(TraitObject.Find("Manager"), randomTraits.Next(0, 5));
            hero.SetTraitLevel(TraitObject.Find("Calculating"), randomTraits.Next(0, 5));
            hero.SetTraitLevel(TraitObject.Find("Politician"), randomTraits.Next(0, 5));
            hero.SetTraitLevel(TraitObject.Find("Commander"), randomTraits.Next(0, 5));
            hero.SetTraitLevel(TraitObject.Find("HopliteFightingSkills"), randomTraits.Next(0, 5));
        }
コード例 #6
0
        public int GetTraitLevel(TraitObject traitObject)
        {
            HeroAdminCharacterTrait trait = Traits.FirstOrDefault(tr => tr.StringId.Equals(traitObject.StringId));

            if (null != trait)
            {
                return(trait.Level);
            }

            return(0);
        }
コード例 #7
0
        public static void SyncCompanionTraitLevel(Hero hero, TraitObject trait)
        {
            float num  = hero.GetRelationWithPlayer() / 100f;
            bool  flag = num > 0f;

            if (flag)
            {
                float num2 = 1f - num;
                hero.SetTraitLevel(trait, (int)((float)hero.GetTraitLevel(trait) * num2 + (float)Hero.MainHero.GetTraitLevel(trait) * num));
            }
        }
コード例 #8
0
 public Trait(TraitObject t)
 {
     name          = t.name;
     traitPolarity = t.traitPolarity;
     tier          = t.tier;
     modifiers     = new List <TraitModifier>();
     foreach (TraitModifier m in t.modifiers)
     {
         modifiers.Add(m);
     }
     description = t.description;
     sprite      = t.sprite;
 }
コード例 #9
0
 private void OnTraitChange(TraitObject trait, int newLevel)
 {
     this._hero.SetTraitLevel(trait, newLevel);
 }
コード例 #10
0
 public static int GetCharacterTraitLevel(this Hero hero, CharacterTrait characterTrait)
 {
     return(hero.GetTraitLevel(TraitObject.Find(characterTrait.ToString())));
 }
コード例 #11
0
 public static void UpdateTrait(TraitObject trait, int xpValue, ActionNotes context = ActionNotes.DefaultNote, Hero?referenceHero = null)
 {
     AddPlayerTraitXPAndLogEntry(trait, xpValue, context, referenceHero !);
 }
 public PlayerCharacterTraitEventExperience(int experience, TraitObject trait)
 {
     Experience = experience;
     Trait      = trait;
 }