Exemplo n.º 1
0
        public override void OnTurnOn()
        {
            ModifiableValue value = base.Owner.Stats.GetStat(StatTypeToReplaceBastStatFor);

            if (value.GetType() == typeof(ModifiableValueSkill))
            {
                if (_oldStatType == null)
                {
                    _oldStatType = ((ModifiableValueSkill)value).BaseStat.Type;
                }

                ModifiableValueAttributeStat oldStat = base.Owner.Stats.GetStat <ModifiableValueAttributeStat>((StatType)_oldStatType);
                ModifiableValueAttributeStat newStat = base.Owner.Stats.GetStat <ModifiableValueAttributeStat>(NewBaseStatType);

                if (newStat.Bonus < oldStat.Bonus && only_if_greater)
                {
                    return;
                }

                Traverse traverse = Traverse.Create(value);
                traverse.Field("BaseStat").SetValue(newStat);
                newStat.AddDependentValue(value);
                oldStat.RemoveDependentValue(value);
                value.UpdateValue();
            }
        }
Exemplo n.º 2
0
    public ModifiableValue <T> Copy()
    {
        var b = new ModifiableValue <T>();

        b.m_defaultVal = this.m_defaultVal;
        b.m_customVal  = this.m_customVal;
        return(b);
    }
Exemplo n.º 3
0
        private void Awake()
        {
            _rb       = GetComponent <Rigidbody2D>();
            MoveSpeed = DefaultMoveSpeed;

            var health = GetComponent <HealthComponent>();

            health.OnHealthLost.AddListener(hp => Debug.Log(hp));
        }
        static bool Prefix(RulePartySkillCheck __instance, bool isTrigger, ref int ___m_D20, ref int ___m_StatValue, StatType ___m_StatType, int ___m_DifficultyClass)
        {
            ___m_StatValue = int.MinValue;
            var tr = Harmony12.Traverse.Create(__instance);

            tr.Property("Roller").SetValue(null);
            RuleSkillCheck selected_evt = null;

            foreach (UnitEntityData unitEntityData in Game.Instance.Player.Party)
            {
                if (unitEntityData.Descriptor.State.CanAct)
                {
                    ModifiableValue stat = unitEntityData.Stats.GetStat(___m_StatType);
                    ModifiableValueAttributeStat valueAttributeStat = stat as ModifiableValueAttributeStat;
                    int            num = valueAttributeStat != null ? valueAttributeStat.Bonus : stat.ModifiedValue;
                    RuleSkillCheck evt = new RuleSkillCheck(unitEntityData, ___m_StatType, ___m_DifficultyClass)
                    {
                        Voice         = __instance.Voice,
                        EnsureSuccess = __instance.EnsureSuccess
                    };

                    if (isTrigger)
                    {
                        evt.Silent = true;;
                        Rulebook.Trigger <RuleSkillCheck>(evt);
                        num += (int)evt.Bonus;
                    }

                    if (___m_StatValue < num)
                    {
                        ___m_StatValue = num;
                        tr.Property("Roller").SetValue(unitEntityData);
                        selected_evt = evt;
                    }
                }
            }
            if (__instance.Roller == null)
            {
                UberDebug.Log("Roller is null, in the party skillcheck", (object[])Array.Empty <object>());
            }
            else
            {
                if (!isTrigger)
                {
                    selected_evt.Calculate();
                }
                else
                {
                    selected_evt.Silent = false;
                    EventBus.RaiseEvent <IRollSkillCheckHandler>((Action <IRollSkillCheckHandler>)(h => h.HandleOnRuleSkillCheck(selected_evt)));
                    //Game.Instance?.UI?.BattleLogManager?.HandleUnitSkillCheckRolled(selected_evt);
                }
                ___m_D20 = selected_evt.D20;
            }
            return(false);
        }
Exemplo n.º 5
0
        public void OnEventAboutToTrigger(RuleAttackRoll evt)
        {
            if (evt.Target.Descriptor.Resources.GetResourceAmount(resource) < cost)
            {
                return;
            }

            if ((base.Owner.Body.PrimaryHand.Weapon.Blueprint.Category == WeaponCategory.Dagger || base.Owner.Body.PrimaryHand.Weapon.Blueprint.Category == WeaponCategory.Starknife) && base.Owner.Body.PrimaryHand.Weapon.Blueprint.IsRanged)
            {
                ThrowAnything.toggleThrown(base.Owner.Body.PrimaryHand.Weapon, evt.Initiator);
                did_swap = true;
            }

            if (!evt.Weapon.Blueprint.IsMelee || evt.Parry != null || !base.Owner.Unit.IsEnemy(evt.Initiator))
            {
                return;
            }
            if (evt.Target != base.Owner.Unit)
            {
                return;
            }
            if (!base.Owner.Unit.IsReach(evt.Target, base.Owner.Body.PrimaryHand))
            {
                return;
            }
            //TODO - Conditions?

            /*
             * if (this.AttackerCondition.HasConditions)
             * {
             *  MechanicsContext maybeContext = base.Fact.MaybeContext;
             *  using ((maybeContext != null) ? maybeContext.GetDataScope(evt.Initiator) : null)
             *  {
             *      if (!this.AttackerCondition.Check(null))
             *      {
             *          return;
             *      }
             *  }
             * }
             */

            evt.TryParry(base.Owner.Unit, base.Owner.Body.PrimaryHand.Weapon, 0);
            if (evt.Parry == null)
            {
                return;
            }
            ModifiableValue additionalAttackBonus = base.Owner.Stats.AdditionalAttackBonus;
            int             num = evt.Initiator.Descriptor.State.Size - base.Owner.State.Size;

            if (num > 0)
            {
                int value = -2 * num;
                evt.AddTemporaryModifier(additionalAttackBonus.AddModifier(value, this, ModifierDescriptor.Penalty));
            }
        }
Exemplo n.º 6
0
    public AttackPackage(int hashID, float hitPointDamage, float enduranceDamage, float hitBackDistance, bool triggerGapStun, bool isChargedAttack, bool isMeleeAttack, Vector2 fromDirection)
    {
        _hashID          = hashID;
        _hitPointDamage  = new ModifiableValue(hitPointDamage);
        _enduranceDamage = new ModifiableValue(enduranceDamage);
        _hitBackDistance = new ModifiableValue(hitBackDistance);
        _triggerGapStun  = triggerGapStun;

        _isChargedAttack = isChargedAttack;
        _isMeleeAttack   = isMeleeAttack;
        _fromDirection   = fromDirection;
    }
        public override void OnTurnOn()
        {
            StatType statParam = Param.StatType.GetValueOrDefault();

            if (statParam == StatType.Unknown)
            {
                return;
            }
            ModifiableValue stat = Owner.Stats.GetStat(statParam);

            int bonus = stat.BaseValue >= 10 ? 4 : 2;

            m_Modifier = stat.AddModifier(bonus, this, Descriptor);
        }
Exemplo n.º 8
0
        public override void OnTurnOff()
        {
            ModifiableValue value = base.Owner.Stats.GetStat(StatTypeToReplaceBastStatFor);

            if (true)//value.GetType() == typeof(ModifiableValueSkill) && _oldStatType != null)
            {
                ModifiableValue oldStat = base.Owner.Stats.GetStat((StatType)_oldStatType);
                ModifiableValue newStat = base.Owner.Stats.GetStat(NewBaseStatType);

                Traverse traverse = Traverse.Create(value);
                traverse.Field("BaseStat").SetValue(oldStat);
                oldStat.AddDependentValue(value);
                newStat.RemoveDependentValue(value);
                value.UpdateValue();
            }
        }
        public static void mod_AddStatModifiers([NotNull] ModifiableValue stat)
        {
            foreach (ModifiableValue.Modifier displayModifier in stat.GetDisplayModifiers())
            {
                if (displayModifier.ModValue == 0)
                {
                    continue;
                }

                ModifierDescriptor descriptor = displayModifier.ModDescriptor == ModifierDescriptor.None ? ModifierDescriptor.Other : displayModifier.ModDescriptor;

                var bonusSource = (IUIDataProvider)(displayModifier.Source ?? (object)displayModifier.ItemSource);

                StatModifiersBreakdown.AddBonus(displayModifier.ModValue, bonusSource, descriptor);
            }
        }
Exemplo n.º 10
0
        // Token: 0x060017AE RID: 6062 RVA: 0x0009E1E8 File Offset: 0x0009C3E8
        public override void OnTurnOn()
        {
            base.OnTurnOn();
            int classLevels = 0;

            foreach (var thisClass in this.classes)
            {
                classLevels += base.Owner.Progression.GetClassLevel(thisClass);
            }
            int             value = 1 + classLevels / 5;
            ModifiableValue stat  = base.Owner.Stats.GetStat(this.Stat);

            if (stat != null)
            {
                this.m_Modifier = stat.AddModifier(value, this, this.Descriptor);
            }
        }
        private void checkSkillRanks(ModifiableValue value, int i)
        {
            var LevelUp = Game.Instance.UI.CharacterBuildController.LevelUpController;

            if (base.Owner == LevelUp.Preview || base.Owner == LevelUp.Unit)
            {
                var @class = LevelUp.State.SelectedClass;

                int currentLevel              = base.Owner.Progression.GetClassLevel(@class);
                int currentLevelBABFromclass  = @class.BaseAttackBonus.GetBonus(currentLevel);
                int previeusLevelBABFromclass = @class.BaseAttackBonus.GetBonus(currentLevel - 1);
                int nextLevelBAB              = base.Owner.Stats.BaseAttackBonus.BaseValue - previeusLevelBABFromclass + currentLevelBABFromclass;

                if (value.BaseValue > nextLevelBAB)
                {
                    LevelUp.State.ExtraSkillPoints += (value.BaseValue - nextLevelBAB);
                    value.BaseValue = nextLevelBAB;
                }
            }
        }
Exemplo n.º 12
0
        AttackPackage(int hashID, float hitPointDamage, float enduranceDamage, float knockback,
                      float chargedPercent, float attackRate, bool triggerGapStun, AttackType attackType,
                      Faction faction, Vector2 fromDirection, string staggerAnimation, string gapStaggerAnimation,
                      AttackMove move)
        {
            _hashID            = hashID;
            _hitPointDamage    = new ModifiableValue(hitPointDamage);
            _enduranceDamage   = new ModifiableValue(enduranceDamage);
            _knockback         = new ModifiableValue(knockback);
            _chargedPercent    = new ModifiableValue(chargedPercent);
            _attackRate        = attackRate;
            _triggerGapStagger = triggerGapStun;

            _faction             = faction;
            _attackType          = attackType;
            _staggerAnimation    = staggerAnimation;
            _gapStaggerAnimation = gapStaggerAnimation;
            _fromDirection       = fromDirection;

            _move = move;
        }
Exemplo n.º 13
0
        private void triggerEffect()
        {
            int bonus = this.ContextValue.Calculate(this.Context);

            if (Stat != StatType.Unknown)
            {
                ModifiableValue    stat = this.Owner.Stats.GetStat(this.Stat);
                RuleDealStatDamage rule = new RuleDealStatDamage(this.Owner.Unit, this.Owner.Unit, this.Stat, DiceFormula.Zero, bonus);
                rule.Reason = (RuleReason)this.Fact;
                this.Context.TriggerRule <RuleDealStatDamage>(rule);
            }
            else
            {
                var hp_damage = new DamageBundle(new BaseDamage[1]
                {
                    (BaseDamage) new DirectDamage(new DiceFormula(0, DiceType.Zero), bonus)
                }
                                                 );
                RuleDealDamage rule = new RuleDealDamage(this.Owner.Unit, this.Owner.Unit, hp_damage);
                rule.Reason = (RuleReason)this.Fact;
                this.Context.TriggerRule <RuleDealDamage>(rule);
            }
        }
            internal static bool Prefix(ModifiableValue __instance, ModifiableValue.Modifier mod)
            {
                EventBus.RaiseEvent <IOnModifierAdd>((Action <IOnModifierAdd>)(h => h.onModifierAdd(mod)));

                return(true);
            }
Exemplo n.º 15
0
        public static void OnGUI()
        {
            var player        = Game.Instance.Player;
            var filterChoices = GetPartyFilterChoices();

            if (filterChoices == null)
            {
                return;
            }

            charToAdd    = null;
            charToRemove = null;
            var characterListFunc = UI.TypePicker <List <UnitEntityData> >(
                null,
                ref Main.settings.selectedPartyFilter,
                filterChoices
                );
            var characterList = characterListFunc.func();
            var mainChar      = GameHelper.GetPlayerCharacter();

            if (characterListFunc.name == "Nearby")
            {
                UI.Slider("Nearby Distance", ref nearbyRange, 1f, 200, 25, 0, " meters", UI.Width(250));
                characterList = characterList.OrderBy((ch) => ch.DistanceTo(mainChar)).ToList();
            }
            UI.Space(20);
            int chIndex = 0;

            respecableCount = 0;
            var  selectedCharacter = GetSelectedCharacter();
            bool isWide            = Main.IsWide;

            foreach (UnitEntityData ch in characterList)
            {
                var classData = ch.Progression.Classes;
                // TODO - understand the difference between ch.Progression and ch.Descriptor.Progression
                UnitProgressionData      progression = ch.Descriptor.Progression;
                BlueprintStatProgression xpTable     = BlueprintRoot.Instance.Progression.XPTable;
                int level       = progression.CharacterLevel;
                int mythicLevel = progression.MythicExperience;
                var spellbooks  = ch.Spellbooks;
                var spellCount  = spellbooks.Sum((sb) => sb.GetAllKnownSpells().Count());
                using (UI.HorizontalScope()) {
                    UI.Label(ch.CharacterName.orange().bold(), UI.Width(200));
                    UI.Space(25);
                    float distance = mainChar.DistanceTo(ch);;
                    UI.Label(distance < 1 ? "" : distance.ToString("0") + "m", UI.Width(75));
                    UI.Space(25);
                    UI.Label("lvl".green() + $": {level}", UI.Width(75));
                    // Level up code adapted from Bag of Tricks https://www.nexusmods.com/pathfinderkingmaker/mods/2
                    if (player.AllCharacters.Contains(ch))
                    {
                        if (progression.Experience < xpTable.GetBonus(level + 1) && level < 20)
                        {
                            UI.ActionButton("+1", () => {
                                progression.AdvanceExperienceTo(xpTable.GetBonus(level + 1), true);
                            }, UI.Width(70));
                        }
                        else if (progression.Experience >= xpTable.GetBonus(level + 1) && level < 20)
                        {
                            UI.Label("LvUp".cyan().italic(), UI.Width(70));
                        }
                        else
                        {
                            UI.Space(74);
                        }
                    }
                    else
                    {
                        UI.Space(74);
                    }
                    UI.Space(25);
                    UI.Label($"my".green() + $": {mythicLevel}", UI.Width(100));
                    if (player.AllCharacters.Contains(ch))
                    {
                        if (progression.MythicExperience < 10)
                        {
                            UI.ActionButton("+1", () => {
                                progression.AdvanceMythicExperience(progression.MythicExperience + 1, true);
                            }, UI.Width(70));
                        }
                        else
                        {
                            UI.Label("max".cyan(), UI.Width(70));
                        }
                    }
                    else
                    {
                        UI.Space(74);
                    }
                    UI.Space(35);
                    if (!isWide)
                    {
                        ActionsGUI(ch);
                    }
                    UI.Wrap(!Main.IsWide, 303, 0);
                    bool showClasses = ch == selectedCharacter && selectedToggle == ToggleChoice.Classes;
                    if (UI.DisclosureToggle($"{classData.Count} Classes", ref showClasses))
                    {
                        if (showClasses)
                        {
                            selectedCharacter = ch; selectedToggle = ToggleChoice.Classes; Logger.Log($"selected {ch.CharacterName}");
                        }
                        else
                        {
                            selectedToggle = ToggleChoice.None;
                        }
                    }
                    bool showStats = ch == selectedCharacter && selectedToggle == ToggleChoice.Stats;
                    if (UI.DisclosureToggle("Stats", ref showStats, true, isWide ? 150 : 200))
                    {
                        if (showStats)
                        {
                            selectedCharacter = ch; selectedToggle = ToggleChoice.Stats;
                        }
                        else
                        {
                            selectedToggle = ToggleChoice.None;
                        }
                    }
                    UI.Wrap(Main.IsNarrow, 279);
                    bool showFacts = ch == selectedCharacter && selectedToggle == ToggleChoice.Facts;
                    if (UI.DisclosureToggle("Facts", ref showFacts, true, isWide ? 150 : 200))
                    {
                        if (showFacts)
                        {
                            selectedCharacter = ch; selectedToggle = ToggleChoice.Facts;
                        }
                        else
                        {
                            selectedToggle = ToggleChoice.None;
                        }
                    }
                    bool showBuffs = ch == selectedCharacter && selectedToggle == ToggleChoice.Buffs;
                    if (UI.DisclosureToggle("Buffs", ref showBuffs, true, isWide ? 150 : 200))
                    {
                        if (showBuffs)
                        {
                            selectedCharacter = ch; selectedToggle = ToggleChoice.Buffs;
                        }
                        else
                        {
                            selectedToggle = ToggleChoice.None;
                        }
                    }
                    UI.Wrap(Main.IsNarrow, 304);
                    bool showAbilities = ch == selectedCharacter && selectedToggle == ToggleChoice.Abilities;
                    if (UI.DisclosureToggle("Abilities", ref showAbilities, true))
                    {
                        if (showAbilities)
                        {
                            selectedCharacter = ch; selectedToggle = ToggleChoice.Abilities;
                        }
                        else
                        {
                            selectedToggle = ToggleChoice.None;
                        }
                    }
                    UI.Space(25);
                    if (spellCount > 0)
                    {
                        bool showSpells = ch == selectedCharacter && selectedToggle == ToggleChoice.Spells;
                        if (UI.DisclosureToggle($"{spellCount} Spells", ref showSpells, true))
                        {
                            if (showSpells)
                            {
                                selectedCharacter = ch; selectedToggle = ToggleChoice.Spells;
                            }
                            else
                            {
                                selectedToggle = ToggleChoice.None;
                            }
                        }
                    }
                    else
                    {
                        UI.Space(180);
                    }
                    if (isWide)
                    {
                        ActionsGUI(ch);
                    }
                }
                if (!Main.IsWide)
                {
                    UI.Div(20, 20);
                }
                if (selectedCharacter != spellbookEditCharacter)
                {
                    editSpellbooks         = false;
                    spellbookEditCharacter = null;
                }
                if (selectedCharacter != multiclassEditCharacter)
                {
                    editMultiClass          = false;
                    multiclassEditCharacter = null;
                }
                if (ch == selectedCharacter && selectedToggle == ToggleChoice.Classes)
                {
#if DEBUG
                    UI.Div(100, 20);
                    using (UI.HorizontalScope()) {
                        UI.Space(100);
                        UI.Toggle("Multiple Classes On Level-Up", ref settings.toggleMulticlass, 0);
                        if (settings.toggleMulticlass)
                        {
                            UI.Space(39);
                            if (UI.DisclosureToggle("Config".orange().bold(), ref editMultiClass))
                            {
                                multiclassEditCharacter = selectedCharacter;
                            }
                            UI.Space(25);
                            UI.Label("Experimental Preview ".magenta() + "See 'Level Up + Multiclass' for more options".green());
                        }
                        else
                        {
                            UI.Space(50);  UI.Label("Experimental Preview ".magenta());
                        }
                    }
#endif
                    UI.Div(100, 20);
                    if (editMultiClass)
                    {
                        var multiclassSet = ch.GetMulticlassSet();
                        MulticlassPicker.OnGUI(multiclassSet);
                        ch.SetMulticlassSet(multiclassSet);
                    }
                    else
                    {
                        var prog = ch.Descriptor.Progression;
                        using (UI.HorizontalScope()) {
                            UI.Space(100);
                            UI.Label("Character Level".cyan(), UI.Width(250));
                            UI.ActionButton("<", () => prog.CharacterLevel = Math.Max(0, prog.CharacterLevel - 1), UI.AutoWidth());
                            UI.Space(25);
                            UI.Label("level".green() + $": {prog.CharacterLevel}", UI.Width(100f));
                            UI.ActionButton(">", () => prog.CharacterLevel = Math.Min(20, prog.CharacterLevel + 1), UI.AutoWidth());
                            UI.Space(25);
                            UI.ActionButton("Reset", () => ch.resetClassLevel(), UI.Width(125));
                            UI.Space(23);
                            UI.Label("This directly changes your character level but will not change exp or adjust any features associated with your character. To do a normal level up use +1 Lvl above".green());
                        }
                        UI.Div(0, 25);
                        using (UI.HorizontalScope()) {
                            UI.Space(100);
                            UI.Label("Mythic Level".cyan(), UI.Width(250));
                            UI.ActionButton("<", () => prog.MythicLevel = Math.Max(0, prog.MythicLevel - 1), UI.AutoWidth());
                            UI.Space(25);
                            UI.Label("my lvl".green() + $": {prog.MythicLevel}", UI.Width(100f));
                            UI.ActionButton(">", () => prog.MythicLevel = Math.Min(10, prog.MythicLevel + 1), UI.AutoWidth());
                            UI.Space(175);
                            UI.Label("This directly changes your mythic level but will not adjust any features associated with your character. To do a normal mythic level up use +1 my above".green());
                        }
                        foreach (var cd in classData)
                        {
                            UI.Div(100, 20);
                            using (UI.HorizontalScope()) {
                                UI.Space(100);
                                UI.Label(cd.CharacterClass.Name.orange(), UI.Width(250));
                                UI.ActionButton("<", () => cd.Level = Math.Max(0, cd.Level - 1), UI.AutoWidth());
                                UI.Space(25);
                                UI.Label("level".green() + $": {cd.Level}", UI.Width(100f));
                                var maxLevel = cd.CharacterClass.Progression.IsMythic ? 10 : 20;
                                UI.ActionButton(">", () => cd.Level = Math.Min(maxLevel, cd.Level + 1), UI.AutoWidth());
                                UI.Space(175);
                                UI.Label(cd.CharacterClass.Description.green(), UI.AutoWidth());
                            }
                        }
                    }
                }
                if (ch == selectedCharacter && selectedToggle == ToggleChoice.Stats)
                {
                    UI.Div(100, 20, 755);
                    var alignment = ch.Descriptor.Alignment.Value;
                    using (UI.HorizontalScope()) {
                        UI.Space(100);
                        UI.Label("Alignment", UI.Width(425));
                        UI.Label($"{alignment.Name()}".color(alignment.Color()).bold(), UI.Width(1250f));
                    }
                    using (UI.HorizontalScope()) {
                        UI.Space(528);
                        int alignmentIndex = Array.IndexOf(alignments, alignment);
                        var titles         = alignments.Select(
                            a => a.Acronym().color(a.Color()).bold()).ToArray();
                        if (UI.SelectionGrid(ref alignmentIndex, titles, 3, UI.Width(250f)))
                        {
                            ch.Descriptor.Alignment.Set(alignments[alignmentIndex]);
                        }
                    }
                    UI.Div(100, 20, 755);
                    using (UI.HorizontalScope()) {
                        UI.Space(100);
                        UI.Label("Size", UI.Width(425));
                        var size = ch.Descriptor.State.Size;
                        UI.Label($"{size}".orange().bold(), UI.Width(175));
                    }
                    using (UI.HorizontalScope()) {
                        UI.Space(528);
                        UI.EnumGrid(
                            () => ch.Descriptor.State.Size,
                            (s) => ch.Descriptor.State.Size = s,
                            3, UI.Width(600));
                    }
                    using (UI.HorizontalScope()) {
                        UI.Space(528);
                        UI.ActionButton("Reset", () => { ch.Descriptor.State.Size = ch.Descriptor.OriginalSize; }, UI.Width(197));
                    }
                    UI.Div(100, 20, 755);
                    foreach (StatType obj in Enum.GetValues(typeof(StatType)))
                    {
                        StatType        statType        = (StatType)obj;
                        ModifiableValue modifiableValue = ch.Stats.GetStat(statType);
                        if (modifiableValue != null)
                        {
                            String key         = $"{ch.CharacterName}-{statType.ToString()}";
                            var    storedValue = statEditorStorage.ContainsKey(key) ? statEditorStorage[key] : modifiableValue.BaseValue;
                            var    statName    = statType.ToString();
                            if (statName == "BaseAttackBonus" || statName == "SkillAthletics")
                            {
                                UI.Div(100, 20, 755);
                            }
                            using (UI.HorizontalScope()) {
                                UI.Space(100);
                                UI.Label(statName, UI.Width(400f));
                                UI.Space(25);
                                UI.ActionButton(" < ", () => {
                                    modifiableValue.BaseValue -= 1;
                                    storedValue = modifiableValue.BaseValue;
                                }, UI.AutoWidth());
                                UI.Space(20);
                                UI.Label($"{modifiableValue.BaseValue}".orange().bold(), UI.Width(50f));
                                UI.ActionButton(" > ", () => {
                                    modifiableValue.BaseValue += 1;
                                    storedValue = modifiableValue.BaseValue;
                                }, UI.AutoWidth());
                                UI.Space(25);
                                UI.ActionIntTextField(ref storedValue, statType.ToString(), (v) => {
                                    modifiableValue.BaseValue = v;
                                }, null, UI.Width(75));
                                statEditorStorage[key] = storedValue;
                            }
                        }
                    }
                }
                if (ch == selectedCharacter && selectedToggle == ToggleChoice.Facts)
                {
                    FactsEditor.OnGUI(ch, ch.Progression.Features.Enumerable.ToList());
                }
                if (ch == selectedCharacter && selectedToggle == ToggleChoice.Buffs)
                {
                    FactsEditor.OnGUI(ch, ch.Descriptor.Buffs.Enumerable.ToList());
                }
                if (ch == selectedCharacter && selectedToggle == ToggleChoice.Abilities)
                {
                    FactsEditor.OnGUI(ch, ch.Descriptor.Abilities.Enumerable.ToList());
                }
                if (ch == selectedCharacter && selectedToggle == ToggleChoice.Spells)
                {
                    UI.Space(20);
                    var names  = spellbooks.Select((sb) => sb.Blueprint.GetDisplayName()).ToArray();
                    var titles = names.Select((name, i) => $"{name} ({spellbooks.ElementAt(i).CasterLevel})").ToArray();
                    if (spellbooks.Any())
                    {
                        using (UI.HorizontalScope()) {
                            UI.SelectionGrid(ref selectedSpellbook, titles, 7, UI.Width(1581));
                            if (selectedSpellbook > names.Count())
                            {
                                selectedSpellbook = 0;
                            }
                            //                        UI.DisclosureToggle("Edit", ref editSpellbooks);
                        }
                        var spellbook = spellbooks.ElementAt(selectedSpellbook);
                        if (editSpellbooks)
                        {
                            spellbookEditCharacter = ch;
                            var blueprints = BlueprintExensions.GetBlueprints <BlueprintSpellbook>().OrderBy((bp) => bp.GetDisplayName());
                            BlueprintListUI.OnGUI(ch, blueprints, 100);
                        }
                        else
                        {
                            var maxLevel    = spellbook.Blueprint.MaxSpellLevel;
                            var casterLevel = spellbook.CasterLevel;
                            using (UI.HorizontalScope()) {
                                UI.EnumerablePicker <int>(
                                    "Spell Level".bold() + " (count)",
                                    ref selectedSpellbookLevel,
                                    Enumerable.Range(0, casterLevel + 1),
                                    0,
                                    (lvl) => {
                                    var levelText  = lvl <= casterLevel ? $"L{lvl}".bold() : $"L{lvl}".grey();
                                    var knownCount = spellbook.GetKnownSpells(lvl).Count();
                                    var countText  = knownCount > 0 ? $" ({knownCount})".white() : "";
                                    return(levelText + countText);
                                },
                                    UI.AutoWidth()
                                    );
                                if (casterLevel < maxLevel)
                                {
                                    UI.ActionButton("+1 Caster Level", () => spellbook.AddBaseLevel());
                                }
                            }
                            FactsEditor.OnGUI(ch, spellbook, selectedSpellbookLevel);
                        }
                    }
#if false
                    else
                    {
                        spellbookEditCharacter = ch;
                        editSpellbooks         = true;
                        var blueprints = BlueprintExensions.GetBlueprints <BlueprintSpellbook>().OrderBy((bp) => bp.GetDisplayName());
                        BlueprintListUI.OnGUI(ch, blueprints, 100);
                    }
#endif
                }
                if (selectedCharacter != GetSelectedCharacter())
                {
                    selectedCharacterIndex = characterList.IndexOf(selectedCharacter);
                }
                chIndex += 1;
            }
            UI.Space(25);
            if (respecableCount > 0)
            {
                UI.Label($"{respecableCount} characters".yellow().bold() + " can be respecced. Pressing Respec will close the mod window and take you to character level up".orange());
                UI.Label("WARNING".yellow().bold() + " this feature is ".orange() + "EXPERIMENTAL".yellow().bold() + " and uses unreleased and likely buggy code.".orange());
                UI.Label("BACK UP".yellow().bold() + " before playing with this feature.You will lose your mythic ranks but you can restore them in this Party Editor.".orange());
            }
            UI.Space(25);
            if (charToAdd != null)
            {
                UnitEntityDataUtils.AddCompanion(charToAdd);
            }
            if (charToRemove != null)
            {
                UnitEntityDataUtils.RemoveCompanion(charToRemove);
            }
        }
Exemplo n.º 16
0
 private void Awake()
 {
     _timeSinceStart = 0f;
     Speed           = BaseSpeed;
 }
Exemplo n.º 17
0
            public override void OnTurnOn()
            {
                ModifiableValue stat = base.Owner.Wielder.Stats.GetStat(this.Stat);

                if (stat != null)
                {
                    if (base.Owner.Wielder.HasFact(middleage))
                    {
                        if (base.Owner.Wielder.HasFact(immortality))
                        {
                            if (Stat == StatType.Strength || Stat == StatType.Dexterity || Stat == StatType.Constitution)
                            {
                                this.m_Modifier = stat.AddItemModifier(0, this, base.Owner, ModifierDescriptor.Profane);
                            }

                            if (Stat == StatType.Intelligence || Stat == StatType.Wisdom || Stat == StatType.Charisma)
                            {
                                this.m_Modifier = stat.AddItemModifier(1, this, base.Owner, ModifierDescriptor.Profane);
                            }
                            return;
                        }

                        else
                        {
                            if (Stat == StatType.Strength || Stat == StatType.Dexterity || Stat == StatType.Constitution)
                            {
                                this.m_Modifier = stat.AddItemModifier(-2, this, base.Owner, ModifierDescriptor.Profane);
                            }

                            if (Stat == StatType.Intelligence || Stat == StatType.Wisdom || Stat == StatType.Charisma)
                            {
                                this.m_Modifier = stat.AddItemModifier(1, this, base.Owner, ModifierDescriptor.Profane);
                            }
                            return;
                        }
                    }
                    if (base.Owner.Wielder.HasFact(oldage) || base.Owner.Wielder.HasFact(venerableage))
                    {
                        this.m_Modifier = stat.AddItemModifier(0, this, base.Owner, ModifierDescriptor.Profane);
                        return;
                    }

                    if (base.Owner.Wielder.HasFact(immortality))
                    {
                        if (Stat == StatType.Strength || Stat == StatType.Dexterity || Stat == StatType.Constitution)
                        {
                            this.m_Modifier = stat.AddItemModifier(0, this, base.Owner, ModifierDescriptor.Profane);
                        }

                        if (Stat == StatType.Intelligence || Stat == StatType.Wisdom || Stat == StatType.Charisma)
                        {
                            this.m_Modifier = stat.AddItemModifier(2, this, base.Owner, ModifierDescriptor.Profane);
                        }
                        return;
                    }

                    else
                    {
                        if (Stat == StatType.Strength || Stat == StatType.Dexterity || Stat == StatType.Constitution)
                        {
                            this.m_Modifier = stat.AddItemModifier(-3, this, base.Owner, ModifierDescriptor.Profane);
                        }

                        if (Stat == StatType.Intelligence || Stat == StatType.Wisdom || Stat == StatType.Charisma)
                        {
                            this.m_Modifier = stat.AddItemModifier(2, this, base.Owner, ModifierDescriptor.Profane);
                        }
                    }
                }
            }
 public void CreateAttribute(PlayerStatsController statsController_, int baseValue)
 {
     statsController = statsController_;
     value           = new ModifiableValue(baseValue);
 }