public override void RunAction()
        {
            var target    = this.Target.Unit;
            var initiator = this.Context.MaybeCaster;
            var result    = bonus + initiator.Descriptor.Progression.GetClassLevel(character_class) + initiator.Descriptor.Stats.GetStat <ModifiableValueAttributeStat>(stat_type).Bonus;

            if (!InspectUnitsHelper.IsInspectAllow(target))
            {
                return;
            }

            BlueprintUnit blueprintForInspection = target.Descriptor.BlueprintForInspection;

            InspectUnitsManager.UnitInfo info = Game.Instance.Player.InspectUnitsManager.GetInfo(blueprintForInspection);

            if (info == null)
            {
                return;
            }

            if (info.KnownPartsCount == 4)
            {
                return;
            }

            int dc = info.DC;

            Common.AddBattleLogMessage($"{initiator.CharacterName} forced DC {dc} monster lore check: {result}");
            info.SetCheck(result, initiator);
        }
예제 #2
0
        private static void RecruitCompanion(string parameters)
        {
            string        paramString = Utilities.GetParamString(parameters, 1, (string)null);
            bool?         paramBool   = Utilities.GetParamBool(parameters, 2, (string)null);
            BlueprintUnit blueprint   = Utilities.GetBlueprint <BlueprintUnit>(paramString);

            if (blueprint == null)
            {
                PFLog.SmartConsole.Log("Cant get companion with name '" + paramString + "'", (object[])Array.Empty <object>());
            }
            else if (!paramBool.HasValue || paramBool.Value)
            {
                UnitEntityData unitVacuum = Game.Instance.CreateUnitVacuum(blueprint);
                Game.Instance.State.PlayerState.CrossSceneState.AddEntityData((EntityDataBase)unitVacuum);
                unitVacuum.IsInGame = false;
                unitVacuum.Ensure <UnitPartCompanion>().SetState(CompanionState.ExCompanion);
            }
            else
            {
                Vector3            position        = Game.Instance.Player.MainCharacter.Value.Position;
                SceneEntitiesState crossSceneState = Game.Instance.State.PlayerState.CrossSceneState;
                UnitEntityData     unit            = Game.Instance.EntityCreator.SpawnUnit(blueprint, position, Quaternion.identity, crossSceneState);
                Game.Instance.Player.AddCompanion(unit);
                EventBus.RaiseEvent <IPartyHandler>((Action <IPartyHandler>)(h => h.HandleAddCompanion(unit)));
            }
        }
        public override void RunAction()
        {
            var target    = this.Target.Unit;
            var initiator = this.Context.MaybeCaster;
            var result    = bonus + value.Calculate(this.Context);

            if (!InspectUnitsHelper.IsInspectAllow(target))
            {
                return;
            }

            BlueprintUnit blueprintForInspection = target.Descriptor.BlueprintForInspection;

            InspectUnitsManager.UnitInfo info = Game.Instance.Player.InspectUnitsManager.GetInfo(blueprintForInspection);

            if (info == null)
            {
                return;
            }



            int dc = info.DC;

            Common.AddBattleLogMessage($"{initiator.CharacterName} forced DC {dc} monster lore check: {result}");
            if (info.KnownPartsCount < 4)
            {
                info.SetCheck(result, initiator);
                EventBus.RaiseEvent <IKnowledgeHandler>((Action <IKnowledgeHandler>)(h => h.HandleKnowledgeUpdated(info)));
            }
        }
예제 #4
0
파일: Summons.cs 프로젝트: cabarius/ToyBox
            public static void Prefix(UnitEntityData initiator, BlueprintUnit blueprint, Vector3 position, ref Rounds duration, ref int level, RuleSummonUnit __instance)
            {
                Mod.Debug($"old duration: {duration} level: {level} \n mult: {settings.summonDurationMultiplier1} levelInc: {settings.summonLevelModifier1}\n initiatior: {initiator} tweakTarget: {settings.summonTweakTarget1} shouldTweak: {UnitEntityDataUtils.CheckUnitEntityData(initiator, settings.summonTweakTarget1)}");
                if (UnitEntityDataUtils.CheckUnitEntityData(initiator, settings.summonTweakTarget1))
                {
                    if (settings.summonDurationMultiplier1 != 1)
                    {
                        duration = new Rounds(Convert.ToInt32(duration.Value * settings.summonDurationMultiplier1));
                    }
                    if (settings.summonLevelModifier1 != 0)
                    {
                        level = Math.Max(0, Math.Min(level + (int)settings.summonLevelModifier1, 20));
                    }
                }
                else if (UnitEntityDataUtils.CheckUnitEntityData(initiator, settings.summonTweakTarget2))
                {
                    if (settings.summonDurationMultiplier2 != 1)
                    {
                        duration = new Rounds(Convert.ToInt32(duration.Value * settings.summonDurationMultiplier2));
                    }
                    if (settings.summonLevelModifier2 >= 0)
                    {
                        level = Math.Max(0, Math.Min(level + (int)settings.summonLevelModifier1, 20));
                    }
                }
                Mod.Debug($"new duration: {duration} level: {level}");

                if (settings.toggleMakeSummmonsControllable)
                {
                    SummonedByPlayerFaction = initiator.IsPlayerFaction;
                }
                Mod.Debug("Initiator: " + initiator.CharacterName + $"(PlayerFaction : {initiator.IsPlayerFaction})" + "\nBlueprint: " + blueprint.CharacterName + "\nDuration: " + duration.Value);
            }
예제 #5
0
        public static List <BlueprintUnit> SelectUnits(int cr, UnitTag tag)
        {
            int minCR = cr - 6;
            List <BlueprintUnit> list = BlueprintRoot.Instance.RE.UnitsForRandomEncounters.Where <BlueprintUnit>((Func <BlueprintUnit, bool>)(u => OwlcatRESelector.ContainsTag(u.GetComponent <AddTags>(), tag))).Where <BlueprintUnit>((Func <BlueprintUnit, bool>)(u => OwlcatRESelector.GetCR(u) >= minCR)).ToList <BlueprintUnit>();
            int xp         = OwlcatRESelector.GetXp(cr);
            int maxTotalXp = OwlcatRESelector.GetXp(cr + 1);
            int currentXp  = 0;
            List <BlueprintUnit> blueprintUnitList = new List <BlueprintUnit>();

            while (currentXp < xp)
            {
                list.RemoveAll((Predicate <BlueprintUnit>)(u => OwlcatRESelector.GetXp(u) > maxTotalXp - currentXp));
                if (list.Count != 0)
                {
                    BlueprintUnit unit = list.Random <BlueprintUnit>();
                    currentXp += OwlcatRESelector.GetXp(unit);
                    blueprintUnitList.Add(unit);
                }
                else
                {
                    break;
                }
            }
            return(blueprintUnitList);
        }
        public override void RunAction()
        {
            var target    = this.Target.Unit;
            var initiator = this.Context.MaybeCaster;

            if (!InspectUnitsHelper.IsInspectAllow(target))
            {
                return;
            }


            BlueprintUnit blueprintForInspection = target.Descriptor.BlueprintForInspection;

            InspectUnitsManager.UnitInfo info = Game.Instance.Player.InspectUnitsManager.GetInfo(blueprintForInspection);
            StatType statType = !(bool)((UnityEngine.Object)info.Blueprint.Type) ? StatType.SkillLoreNature : info.Blueprint.Type.KnowledgeStat;


            if (info == null)
            {
                return;
            }

            ModifiableValueSkill stat = initiator.Stats.GetStat <ModifiableValueSkill>(statType);
            int?nullable1;
            int?nullable2;

            if (stat == null)
            {
                nullable1 = new int?();
                nullable2 = nullable1;
            }
            else
            {
                nullable2 = new int?(stat.BaseValue);
            }
            nullable1 = nullable2;

            int dc    = info.DC;
            int bonus = value.Calculate(this.Context);

            if ((!nullable1.HasValue ? 0 : nullable1.Value) > 0 || (bool)initiator.Descriptor.State.Features.MakeKnowledgeCheckUntrained)
            {
                var skill_check = new RuleSkillCheck(initiator, statType, dc);
                skill_check.AddTemporaryModifier(initiator.Stats.GetStat(statType).AddModifier(bonus, null, descriptor));
                skill_check.IgnoreDifficultyBonusToDC = true;
                int rollResult = Rulebook.Trigger <RuleSkillCheck>(skill_check).RollResult;
                Common.AddBattleLogMessage($"{initiator.CharacterName} DC {dc} monster lore check: {rollResult}");

                if (dc <= rollResult && action_on_success != null)
                {
                    action_on_success.Run();
                }
                if (info.KnownPartsCount < 4)
                {
                    info.SetCheck(rollResult, initiator);
                    EventBus.RaiseEvent <IKnowledgeHandler>((Action <IKnowledgeHandler>)(h => h.HandleKnowledgeUpdated(info)));
                }
            }
        }
예제 #7
0
파일: Core.cs 프로젝트: Holic75/KingmakerAi
        static void fixClericCasters()
        {
            var cleric_caster          = Profiles.ProfileManager.getProfile("ClericCasterPositive");
            var cleric_caster_negative = Profiles.ProfileManager.getProfile("ClericCasterNegative");
            var features = library.GetAllBlueprints().OfType <BlueprintFeature>().Where <BlueprintScriptableObject>(f => f.name.Contains("BanditPositiveClericFeatureListLevel")).ToArray();

            var brain = library.Get <BlueprintBrain>("a19c889be3392b24a9890ffe5a196f0e");

            brain.Actions = cleric_caster.brain.Actions;

            var cleric_selections1 = new SelectionEntry[]
            {
                Profiles.ProfileManager.createFeatureSelection(Profiles.ProfileManager.FeatSelections.deity_selection, Profiles.ProfileManager.Deities.gorum),
                Profiles.ProfileManager.createFeatureSelection(Profiles.ProfileManager.FeatSelections.domain_selection, Profiles.ProfileManager.Domains.glory),
                Profiles.ProfileManager.createFeatureSelection(Profiles.ProfileManager.FeatSelections.domain_selection2, Profiles.ProfileManager.Domains.chaos2),
            };

            foreach (var f in features)
            {
                var old_acl = f.GetComponent <AddClassLevels>();
                Profiles.ProfileManager.replaceAcl(old_acl, cleric_caster.getAcl(old_acl.Levels, cleric_selections1));
                f.RemoveComponents <AddFacts>();
                f.AddComponent(Helpers.CreateAddFacts(cleric_caster.getFeatures(old_acl.Levels)));
            }


            //tsanna
            {
                var cunning_initiative = library.Get <BlueprintFeature>("6be8b4031d8b9fc4f879b72b5428f1e0");
                var tsanna_units       = new BlueprintUnit[] { library.Get <BlueprintUnit>("7c3e0ecea7956be46ad5d74e9b3fd4fb"),
                                                               library.Get <BlueprintUnit>("07e607f30d7de6c49a002339211d074f"),
                                                               library.Get <BlueprintUnit>("bd4bace18805d9f4e89821e7a4f0b173"),
                                                               library.Get <BlueprintUnit>("cf68a7bc6251d754d8ccd27f4dc59be8"),
                                                               library.Get <BlueprintUnit>("61bc44f3224a0c7449dc8e28c7cf3b9b"),
                                                               library.Get <BlueprintUnit>("546e1f3739476cd43aeb160cb2344320") };
                var tsanna_brain = tsanna_units[0].Brain;
                tsanna_brain.Actions = cleric_caster_negative.brain.Actions;
                var tsanna_selections1 = new SelectionEntry[]
                {
                    Profiles.ProfileManager.createFeatureSelection(Profiles.ProfileManager.FeatSelections.deity_selection, CallOfTheWild.Deities.lamashtu),
                    Profiles.ProfileManager.createFeatureSelection(Profiles.ProfileManager.FeatSelections.domain_selection, Profiles.ProfileManager.Domains.evil),
                    Profiles.ProfileManager.createFeatureSelection(Profiles.ProfileManager.FeatSelections.domain_selection2, Profiles.ProfileManager.Domains.chaos2),
                };

                foreach (var u in tsanna_units)
                {
                    var old_acl = u.GetComponent <AddClassLevels>();
                    Profiles.ProfileManager.replaceAcl(old_acl, cleric_caster_negative.getAcl(old_acl.Levels, tsanna_selections1));
                    u.RemoveComponents <AddFacts>();
                    u.AddFacts       = u.AddFacts.AddToArray(cleric_caster_negative.getFeatures(old_acl.Levels));
                    u.AddFacts       = u.AddFacts.AddToArray(cunning_initiative);
                    u.Body.Armor     = library.Get <BlueprintItemArmor>("ef5ee1c481c0139438a7097868685a88");              //replace her standard breastpalte with mithral brestplate +3
                    u.Body.Neck      = library.Get <BlueprintItemEquipmentNeck>("081a2ffe763320a469de20f1e9b1cd71");      //amulet of natural armor +3
                    u.Body.Shoulders = library.Get <BlueprintItemEquipmentShoulders>("9f3c56d5247154e47b5ca9500f4d86ce"); //cloak of resistance +3
                }
            }
        }
예제 #8
0
            public static void Prefix(ref BlueprintUnit unit)
            {
                ModelReplacers.spidersBegone    = settings.toggleSpiderBegone;
                ModelReplacers.vescavorsBegone  = settings.toggleVescavorsBegone;
                ModelReplacers.retrieversBegone = settings.toggleRetrieversBegone;
                ModelReplacers.derakniBegone    = settings.toggleDeraknisBegone;
                ModelReplacers.deskariBegone    = settings.toggleDeskariBegone;

                ModelReplacers.CheckAndReplace(ref unit);
            }
예제 #9
0
        public static int GetCR(BlueprintUnit unit)
        {
            var component = unit.GetComponent <Experience>();

            if ((UnityEngine.Object)component != (UnityEngine.Object)null)
            {
                return(component.CR);
            }
            return(0);
        }
예제 #10
0
        public static int GetCR(BlueprintUnit unit)
        {
            Experience component = unit.GetComponent <Experience>();

            if (component != null)
            {
                return(component.CR);
            }
            return(0);
        }
        public bool CanTarget(UnitEntityData caster, TargetWrapper target)
        {
            UnitEntityData unit = target.Unit;
            BlueprintUnit  blueprintForInspection = unit.BlueprintForInspection;

            InspectUnitsManager.UnitInfo info = Game.Instance.Player.InspectUnitsManager.GetInfo(blueprintForInspection);
            if (info == null)
            {
                return(false);
            }
            return(info.KnownPartsCount >= min_inspection_level);
        }
예제 #12
0
        static public void Load()
        {
            BlueprintUnit irovetti = library.Get <BlueprintUnit>("8b2cbf4590ed9e84591cd9a1f55bbdb8");

            flagIsRisiaSpawned = Helpers.Create <BlueprintUnlockableFlag>();
            library.AddAsset(flagIsRisiaSpawned, "942339abe7b76dfb00324d433a0a9342");
            flagIsRisiaSpawned.Lock();
            flagIsRisiaSpawned.name = "flagIsRisiaSpawned";
            logger.Log("rua rua rua rua 1");
            spawner = HelpersNeu.CreateSpawner(irovetti, "c47dab2a47b4826ed16201142956d607",
                                               new UnityEngine.Vector3(11.77268f, 1.241176f, 1.633618f), UnityEngine.Quaternion.identity,
                                               false, false, new List <BlueprintSummonPool>());
            logger.Log("rua rua rua rua 2");

            /*EntityReference spawnerIrovettiRef = new EntityReference {
            *   UniqueId = "7d4ab0ca-92d9-4960-9225-c341558a47c8" //irovetti
            *  };
            *  UnitSpawner spawnerIrovetti = spawnerIrovettiRef.FindView() as UnitSpawner;
            *  spawner = UnityEngine.Object.Instantiate<UnitSpawner>(spawnerIrovetti);
            *  spawner.transform.SetPositionAndRotation(new UnityEngine.Vector3(11.77268f, 1.241176f, 1.633618f), UnityEngine.Quaternion.identity);
            *  spawner.UniqueId = "c47dab2a-47b4-826e-d162-01142956d607";*/
            EntityReference spawnerRef = new EntityReference {
                UniqueId = spawner.UniqueId
            };

            logger.Log("rua rua rua rua 3");
            BlueprintArea ElkTemple = library.Get <BlueprintArea>("340a310b850e1ed469a60388012734f9");

            logger.Log("rua rua rua rua 4");
            AreaDidLoadTrigger compNeu = Helpers.Create <AreaDidLoadTrigger>();

            compNeu.Conditions = new ConditionsChecker {
                Conditions = new Condition[] {
                    /*Helpers.Create<FlagUnlocked>(a => {
                     *  a.ConditionFlag = flagIsRisiaSpawned;
                     *  a.Not = true;
                     * })*/
                }
            };
            compNeu.Actions = new ActionList {
                Actions = new GameAction[] {
                    Helpers.Create <Spawn>(a => {
                        a.Spawners       = new EntityReference[] { spawnerRef };
                        a.ActionsOnSpawn = new ActionList();
                    }),
                    Helpers.Create <UnlockFlag>(a => a.flag = flagIsRisiaSpawned)
                }
            };
            logger.Log("rua rua rua rua 5");
            ElkTemple.AddComponent(compNeu);
            logger.Log("rua rua rua rua 6");
        }
예제 #13
0
        static void ShowDollRoom(UnitEntityData unit, bool pregenMode = true)
        {
            if (unit == null)
            {
                throw new Exception("ShowDollRoom received null unit");
            }
            var dollRoom = Game.Instance.UI.Common.DollRoom;

            if (dollRoom != null)
            {
                CharGenDollRoom component = Game.Instance.UI.Common.DollRoom.GetComponent <CharGenDollRoom>();
                if (component)
                {
                    component.CreateDolls();
                }
                else
                {
                    Main.Error("CharGenDollRoom is null");
                }
                dollRoom.SetUnit(unit);
                if (pregenMode)
                {
                    BlueprintUnit  blueprint      = unit.Blueprint;
                    UnitEntityView unitEntityView = blueprint.Prefab.Load(false);
                    if (unitEntityView != null)
                    {
                        Character characterComponent = unitEntityView.GetComponent <Character>();
                        Character character          = dollRoom.CreateAvatar(characterComponent, blueprint.name);
                        character.AnimationManager.IsInCombat = false;
                        dollRoom.SetAvatar(character);
                    }
                    else
                    {
                        Main.Error("ShowDollRoom.unitEntityView is null");
                    }
                }
                //dollRoom.Show(true);
                if (dollRoom.Unit == null)
                {
                    Main.Error("Failed to set DollRoom.Unit");
                }
                if (dollRoom.GetAvatar() == null)
                {
                    Main.Error("Failed to set DollRoom.Avatar");
                }
            }
            else
            {
                Main.Error("Game.Instance.UI.Common.DollRoom is null");
            }
        }
예제 #14
0
        private static void RemoveExcessiveLichImmunities()
        {
            //        "Blueprint:efe0344bca1290244a277ed5c45d9ff2:ImmunityToEnergyDrain",
            //"Blueprint:bd9df2d4a4cef274285b8827b6769bde:ImmunityToStun",
            //"Blueprint:c263f44f72df009489409af122b5eefc:ImmunityToSleep",
            //"Blueprint:7e3f3228be49cce49bda37f7901bf246:ImmunityToPoison",
            //            "Blueprint:52f8ef060a751a247964adae7fcb7e64:ImmunityToBleed",
            //            "Blueprint:3eb606c0564d0814ea01a824dbe42fb0:ImmunityToMindAffecting",
            //"Blueprint:ced0f4e5d02d5914a9f9ff74acacf26d:ImmunityToCritical",
            BlueprintUnitFact energyDrainImmunity   = library.Get <BlueprintUnitFact>("efe0344bca1290244a277ed5c45d9ff2");
            BlueprintUnitFact stunImmunity          = library.Get <BlueprintUnitFact>("bd9df2d4a4cef274285b8827b6769bde");
            BlueprintUnitFact sleepImmunity         = library.Get <BlueprintUnitFact>("c263f44f72df009489409af122b5eefc");
            BlueprintUnitFact poisonImmunity        = library.Get <BlueprintUnitFact>("7e3f3228be49cce49bda37f7901bf246");
            BlueprintUnitFact bleedImmunity         = library.Get <BlueprintUnitFact>("52f8ef060a751a247964adae7fcb7e64");
            BlueprintUnitFact mindAffectingImmunity = library.Get <BlueprintUnitFact>("3eb606c0564d0814ea01a824dbe42fb0");
            //BlueprintUnitFact undeadImmunities = library.Get<BlueprintUnitFact>("8a75eb16bfff86949a4ddcb3dd2f83ae");
            BlueprintUnit lich = library.Get <BlueprintUnit>("d58b4a0df3282b84c97b751590053bcf");

            foreach (BlueprintUnitFact buf in lich.AddFacts)
            {
                Main.logger.Log($"lich facts {buf.name}");
            }
            List <BlueprintUnitFact> lichFacts = new List <BlueprintUnitFact>();

            foreach (BlueprintUnitFact buf in lich.AddFacts)
            {
                if (buf != energyDrainImmunity &&
                    buf != stunImmunity &&
                    buf != sleepImmunity &&
                    buf != poisonImmunity &&
                    buf != bleedImmunity &&
                    buf != mindAffectingImmunity)
                {
                    //&& buf != undeadImmunities)
                    lichFacts.Add(buf);
                }
            }
            lich.AddFacts = lichFacts.ToArray();
            //lich.AddFacts.RemoveFromArray(energyDrainImmunity);
            //lich.AddFacts.RemoveFromArray(stunImmunity);
            //lich.AddFacts.RemoveFromArray(sleepImmunity);
            //lich.AddFacts.RemoveFromArray(poisonImmunity);
            //lich.AddFacts.RemoveFromArray(bleedImmunity);
            //lich.AddFacts.RemoveFromArray(mindAffectingImmunity);
            Main.logger.Log($"     lich facts after change");
            foreach (BlueprintUnitFact buf in lich.AddFacts)
            {
                Main.logger.Log($"lich facts {buf.name}");
            }
        }
예제 #15
0
        public static void SpawnFriendlyUnit(Vector3 position, string guid)
        {
            GameModeType currentMode = Game.Instance.CurrentMode;

            if (currentMode == GameModeType.Default || currentMode == GameModeType.Pause)
            {
                BlueprintUnit blueprintUnit = Utilities.GetBlueprintByGuid <BlueprintUnit>(guid);
                if (blueprintUnit != null)
                {
                    UnitEntityData player = Game.Instance.Player.MainCharacter.Value;
                    UnitEntityData unit   = Game.Instance.EntityCreator.SpawnUnit((BlueprintUnit)Utilities.GetBlueprintByGuid <BlueprintUnit>(guid), position, Quaternion.LookRotation(player.OrientationDirection), Game.Instance.CurrentScene.MainState);
                    unit.Descriptor.SwitchFactions(Game.Instance.BlueprintRoot.PlayerFaction, true);
                }
            }
        }
 public static void CheckAndReplace(ref BlueprintUnit blueprintUnit)
 {
     if (IsSpiderType(blueprintUnit.Type?.AssetGuidThreadSafe))
     {
         blueprintUnit.Prefab = Utilities.GetBlueprintByGuid <BlueprintUnit>(blueprintWolfStandardGUID).Prefab;
     }
     else if (IsSpiderSwarmType(blueprintUnit.Type?.AssetGuidThreadSafe))
     {
         blueprintUnit.Prefab = Utilities.GetBlueprintByGuid <BlueprintUnit>(blueprintCR2RatSwarmGUID).Prefab;
     }
     else if (IsSpiderBlueprintUnit(blueprintUnit.AssetGuidThreadSafe))
     {
         blueprintUnit.Prefab = Utilities.GetBlueprintByGuid <BlueprintUnit>(blueprintWolfStandardGUID).Prefab;
     }
 }
예제 #17
0
        public static void SpawnPassiveUnit(Vector3 position, string guid)
        {
            GameModeType currentMode = Game.Instance.CurrentMode;

            if (currentMode == GameModeType.Default || currentMode == GameModeType.Pause)
            {
                BlueprintUnit blueprintUnit = Utilities.GetBlueprintByGuid <BlueprintUnit>(guid);
                if (blueprintUnit != null)
                {
                    UnitEntityData player = Game.Instance.Player.MainCharacter.Value;
                    UnitEntityData unit   = Game.Instance.EntityCreator.SpawnUnit((BlueprintUnit)Utilities.GetBlueprintByGuid <BlueprintUnit>(guid), position, Quaternion.LookRotation(player.OrientationDirection), Game.Instance.CurrentScene.MainState);
                    unit.Descriptor.SwitchFactions(Utilities.GetBlueprintByGuid <BlueprintFaction>("d8de50cc80eb4dc409a983991e0b77ad"), true); // d8de50cc80eb4dc409a983991e0b77ad Neutrals
                    unit.AttackFactions.Clear();
                }
            }
        }
예제 #18
0
        public static void SpawnHostileUnit(Vector3 position, BlueprintUnit unit)
        {
            var currentMode = Game.Instance.CurrentMode;

            if (currentMode == GameModeType.Default || currentMode == GameModeType.Pause)
            {
                var player   = Game.Instance.Player;
                var target   = player.Party.Random <UnitEntityData>();
                var executor = Game.Instance.EntityCreator.SpawnUnit(unit, position,
                                                                     Quaternion.LookRotation(target.OrientationDirection), Game.Instance.CurrentScene.MainState);
                if (!executor.AttackFactions.Contains(Game.Instance.BlueprintRoot.PlayerFaction))
                {
                    executor.AttackFactions.Add(Game.Instance.BlueprintRoot.PlayerFaction);
                }
                executor.Commands.Run(UnitAttack.CreateAttackCommand(executor, target));
            }
        }
예제 #19
0
        public static void SpawnUnit(BlueprintUnit unit, int count)
        {
            Vector3 worldPosition = Game.Instance.ClickEventsController.WorldPosition;

            //           var worldPosition = Game.Instance.Player.MainCharacter.Value.Position;
            if (!(unit == null))
            {
                for (int i = 0; i < count; i++)
                {
                    Vector3 offset        = 5f * UnityEngine.Random.insideUnitSphere;
                    Vector3 spawnPosition = new Vector3(
                        worldPosition.x + offset.x,
                        worldPosition.y,
                        worldPosition.z + offset.z);
                    Game.Instance.EntityCreator.SpawnUnit(unit, spawnPosition, Quaternion.identity, Game.Instance.State.LoadedAreaState.MainState);
                }
            }
        }
예제 #20
0
        static public void Load()
        {
            if (ArcanistClass.arcanist == null)
            {
                throw new Exception("Wrong: Risia should be loaded after Arcanist is loaded");
            }
            Prepare();
            LoadNeutral();
            LoadBoss();
            BlueprintUnit risia_companion = library.Get <BlueprintUnit>("c2dc52c5fec84bc2a74e2cb34fdb566b");
            BlueprintUnit risia_neutral   = library.Get <BlueprintUnit>("d87f8e86724f46e798821d60f9d31eaf");
            BlueprintUnit risia_boss      = library.Get <BlueprintUnit>("95fb27a5b8ae40099bd727ea93de5b9b");



            BlueprintUnit octavia = library.Get <BlueprintUnit>("f9161aa0b3f519c47acbce01f53ee217");

            Main.logger.Log($"{(octavia.Faction == risia_companion.Faction ? "Yes, faction are the same" : "Nope!")}");
        }
        public void mod_OnClose()
        {
            if (!KingmakerPatchSettings.KingdomEvents.InstantComplete)
            {
                this.source_OnClose();
                return;
            }

            KingdomEventUIView previousView = this.alias_m_KingdomEventView;

            // deselects the view
            EventBus.RaiseEvent((IEventSceneHandler h) => h.OnEventSelected(null, this.alias_m_Cart));

            if (previousView == null)
            {
                return;
            }

            if (previousView.IsFinished || previousView.AssignedLeader == null || previousView.Blueprint.NeedToVisitTheThroneRoom)
            {
                return;
            }

            bool          inProgress = previousView.IsInProgress;
            BlueprintUnit leader     = previousView.AssignedLeader;

            if (!inProgress || leader == null)
            {
                return;
            }

            previousView.Event.Resolve(previousView.Task);

            if (previousView.RulerTimeRequired <= 0)
            {
                return;
            }

            foreach (UnitEntityData unitEntityData in Kingmaker.Game.Instance.Player.AllCharacters)
            {
                RestController.ApplyRest(unitEntityData.Descriptor);
            }
        }
예제 #22
0
        public static void SpawnHostileUnit(Vector3 position, string guid)
        {
            GameModeType currentMode = Game.Instance.CurrentMode;

            if (currentMode == GameModeType.Default || currentMode == GameModeType.Pause)
            {
                BlueprintUnit blueprintUnit = Utilities.GetBlueprintByGuid <BlueprintUnit>(guid);
                if (blueprintUnit != null)
                {
                    Player         player   = Game.Instance.Player;
                    UnitEntityData target   = player.Party.Random <UnitEntityData>();
                    UnitEntityData executor = Game.Instance.EntityCreator.SpawnUnit((BlueprintUnit)Utilities.GetBlueprintByGuid <BlueprintUnit>(guid), position, Quaternion.LookRotation(target.OrientationDirection), Game.Instance.CurrentScene.MainState);
                    if (!executor.AttackFactions.Contains(Game.Instance.BlueprintRoot.PlayerFaction))
                    {
                        executor.AttackFactions.Add(Game.Instance.BlueprintRoot.PlayerFaction);
                    }
                    executor.Commands.Run(UnitAttack.CreateAttackCommand(executor, target));
                }
            }
        }
예제 #23
0
        static public UnitSpawner CreateSpawner(BlueprintUnit unitBlue, string guid, Vector3 Position, Quaternion rotation, bool isCompanion, bool isRestoreCompanion, List <BlueprintSummonPool> summonPools)
        {
            GameObject  obj = GameObject.CreatePrimitive(PrimitiveType.Cube);
            UnitSpawner ans = obj.AddComponent <UnitSpawner>();

            obj.SetActive(true);
            ans.UniqueId = new Guid(guid).ToString();

            logger.Log("rua rua 1");
            ans.transform.SetPositionAndRotation(Position, rotation);
            logger.Log("rua rua 2");
            UnitSpawner_Blueprint_Setter(ans, unitBlue);
            logger.Log("rua rua 3");
            UnitSpawner_IsCompanionSetter(ans, isCompanion);
            logger.Log("rua rua 4");
            UnitSpawner_RestoreCompanionOnReload_Setter(ans, isRestoreCompanion);
            logger.Log("rua rua 5");
            UnitSpawner_SummonPools_Setter(ans, summonPools);
            logger.Log("rua rua 6");
            ans.OnSpawned = new UnitSpawner.UnitSpawnedEvent();
            logger.Log("rua rua 7");
            return(ans);
        }
예제 #24
0
파일: Tweaks.cs 프로젝트: ThyWoof/ToyBox
            public static void Postfix(bool __state, KingdomEventUIView ___m_KingdomEventView, KingdomEventHandCartController ___m_Cart)
            {
                if (__state)
                {
                    if (___m_KingdomEventView != null)
                    {
                        EventBus.RaiseEvent((IEventSceneHandler h) => h.OnEventSelected(null, ___m_Cart));

                        if (___m_KingdomEventView.IsFinished || ___m_KingdomEventView.AssignedLeader == null || ___m_KingdomEventView.Blueprint.NeedToVisitTheThroneRoom)
                        {
                            return;
                        }

                        bool          inProgress = ___m_KingdomEventView.IsInProgress;
                        BlueprintUnit leader     = ___m_KingdomEventView.AssignedLeader.Blueprint;

                        if (!inProgress || leader == null)
                        {
                            return;
                        }

                        ___m_KingdomEventView.Event.Resolve(___m_KingdomEventView.Task);

                        if (___m_KingdomEventView.RulerTimeRequired <= 0)
                        {
                            return;
                        }

                        foreach (UnitEntityData unitEntityData in player.AllCharacters)
                        {
                            RestController.ApplyRest(unitEntityData.Descriptor);
                        }

                        new KingdomTimelineManager().MaybeUpdateTimeline();
                    }
                }
            }
        // Token: 0x06000038 RID: 56 RVA: 0x0000227B File Offset: 0x0000047B
        private static bool Prefix(EntityCreationController __instance, BlueprintUnit unit, UnitEntityView prefab, Vector3 position, Quaternion rotation, SceneEntitiesState state, ref UnitEntityData __result)
        {
            if (!Main.modEnabled)
            {
                return(true);
            }
            if (unit == null)
            {
                Main.DebugLog("Trying to spawn null unit.");
                return(false);
            }
            if (prefab == null)
            {
                Main.DebugLog("Trying to spawn unit without prefab");
                return(false);
            }


            // Main.DebugLog("SpawnUnit() -  " + unit.CharacterName + " - " + unit.name + " - " + unit.AssetGuid);


            prefab.UniqueId = Guid.NewGuid().ToString();



            UnitEntityView unitEntityView = UnityEngine.Object.Instantiate <UnitEntityView>(prefab, position, rotation);



            //  string texfullpath = "";
            //if (!string.IsNullOrEmpty(__instance.Descriptor.CustomPrefabGuid))
            if (unit.CustomizationPreset != null)
            {
                // texfullpath = Main.randomPool(unit, "");
            }

            //unitEntityView = Main.unitEntityViewTexReplacer(unitEntityView, texfullpath);


            /*
             * string origtexname = "";
             * string texfullpath = "";
             *
             *
             * if (unitEntityView.GetComponentsInChildren<SkinnedMeshRenderer>().Count() > 0)
             * {
             *  foreach (SkinnedMeshRenderer smr in unitEntityView.GetComponentsInChildren<SkinnedMeshRenderer>())
             *  {
             *
             *      if (smr.material != null && !string.IsNullOrEmpty(smr.material?.mainTexture?.name))
             *      {
             *
             *          if (Main.texOnDiskInfoList == null || Main.texOnDiskInfoList.Count() == 0)
             *          {
             *              Main.Init();
             *          }
             *
             *          if (Main.texOnDiskInfoList.Keys.Any(key => key.Contains(!string.IsNullOrEmpty(smr.material?.mainTexture?.name) ? smr.material?.mainTexture?.name : "noname")))
             *          {
             *
             *              texfullpath = Path.Combine(Main.hqTexPath, smr.material.mainTexture.name + ".png");
             *
             *              origtexname = smr.material.mainTexture.name;
             *
             *
             *              break;
             *          }
             *
             *      }
             *
             *  }
             *
             *
             *  if (!string.IsNullOrEmpty(texfullpath) && !string.IsNullOrEmpty(origtexname))
             *  {
             *
             *      try
             *      {
             *          byte[] array = File.ReadAllBytes(texfullpath);
             *          Vector2Int v2 = Main.texOnDiskInfoList[texfullpath];
             *
             *          Texture2D texture2D = new Texture2D(v2.x, v2.y, TextureFormat.ARGB32, false);
             *          texture2D.filterMode = FilterMode.Point;
             *
             *          texture2D.anisoLevel = 9;
             *          ImageConversion.LoadImage(texture2D, array);
             *
             *          RenderTexture renderTex = RenderTexture.GetTemporary(
             *                               texture2D.width,
             *                               texture2D.height,
             *                               32,
             *                               RenderTextureFormat.ARGB32,
             *                               RenderTextureReadWrite.sRGB);
             *
             *          renderTex.antiAliasing = 8;
             *          renderTex.anisoLevel = 9;
             *
             *          renderTex.filterMode = FilterMode.Trilinear;
             *          Graphics.Blit(texture2D, renderTex);
             *          RenderTexture previous = RenderTexture.active;
             *          RenderTexture.active = renderTex;
             *
             *          Texture2D readableText = new Texture2D(texture2D.width, texture2D.height);
             *          readableText.ReadPixels(new Rect(0, 0, renderTex.width, renderTex.height), 0, 0);
             *          readableText.Apply();
             *          RenderTexture.active = previous;
             *          RenderTexture.ReleaseTemporary(renderTex);
             *
             *
             *          if (texture2D != null)
             *          {
             *
             *              string tname = "";
             *
             *              unitEntityView.GetComponentsInChildren<SkinnedMeshRenderer>().First(x => ((tname = x.material.mainTexture.name) == origtexname)).material.mainTexture = readableText;
             *          }
             *      }
             *      catch (Exception x) { Main.DebugLog(x.ToString()); }
             *  }
             * }
             * else { Main.DebugLog("no renderers in unitentityview"); }
             */



            unitEntityView.Blueprint = unit;

            __result = (UnitEntityData)__instance.SpawnEntityWithView(unitEntityView, state);

            return(false);
        }
        // Token: 0x06000038 RID: 56 RVA: 0x0000227B File Offset: 0x0000047B
        private static bool Prefix(EntityCreationController __instance, BlueprintUnit unit, Vector3 position, Quaternion rotation, SceneEntitiesState state, ref UnitEntityData __result)
        {
            if (unit == null)
            {
                Main.DebugLog("Trying to spawn null unit");
                return(true);
            }
            if (unit.CustomizationPreset != null)
            {
                // Main.DebugLog("a");

                UnitCustomizationVariation unitCustomizationVariation;
#if DEBUG
                /*if (!first)
                 * {
                 * unitCustomizationVariation = unit.CustomizationPreset.SelectVariation(unit, null);
                 *
                 *
                 * }
                 * else
                 * {
                 *  unitCustomizationVariation = Main.preset;
                 * }*/
#endif
                unitCustomizationVariation = unit.CustomizationPreset.SelectVariation(unit, null);

                if (unitCustomizationVariation == null)
                {
                    //

                    Main.DebugLog($"Failed to select customization variation for unit {unit.name} (preset = {unit.CustomizationPreset.name})");

                    if (Main.allVariations == null || Main.allVariations.Count() == 0)
                    {
                        Main.Init();
                    }


                    if (Main.allVariations.ContainsKey(unit.Prefab))
                    {
                        //ucv.Prefab == blueprintUnit.Prefab
                        Main.preset = Main.allVariations[unit.Prefab];
//                        Main.DebugLog(Main.preset.Prefab.AssetId);
                    }
                    else
                    {
                        Main.notRandom = true;
                    }


                    UnitEntityView prefab2 = unit.Prefab.Load(false);
                    //  Main.DebugLog("g");
                    __result = __instance.SpawnUnit(unit, prefab2, position, rotation, state);



                    return(false);
                }

                /*
                 * if (unitCustomizationVariation == null)
                 * {
                 *
                 *  List<UnitCustomizationPreset> presets = ResourcesLibrary.GetBlueprints<UnitCustomizationPreset>().ToList();
                 *
                 *  foreach (UnitCustomizationPreset preset in presets.Where(x => x.name != unit.CustomizationPreset.name))
                 *  {
                 *
                 *      unitCustomizationVariation = preset.SelectVariation(unit, null);
                 *
                 *      if (unitCustomizationVariation != null)
                 *      {
                 *          break;
                 *      }
                 *
                 * }
                 *
                 *
                 *
                 * }
                 */
                Main.preset = unitCustomizationVariation;


                BlueprintUnitAsksList voice = unit.CustomizationPreset.SelectVoice(unitCustomizationVariation.Gender);
                //  Main.DebugLog("c");
                bool leftHanded = unit.CustomizationPreset.SelectLeftHanded();
                //  Main.DebugLog("d");
                using (unitCustomizationVariation.CreateSpawningData(voice, leftHanded))
                {
                    // Main.DebugLog("e");
                    UnitEntityView prefab = unitCustomizationVariation.Prefab.Load(false);
                    // Main.DebugLog("Spawn1: "+prefab.name);
                    //   Main.DebugLog("f");
                    __result = __instance.SpawnUnit(unit, prefab, position, rotation, state);
                    return(false);
                }
            }
            else
            {
                Main.notRandom = true;
                //  Main.DebugLog("NO CUSTOMPRESET!!!");
            }


            UnitEntityView prefab3 = unit.Prefab.Load(false);
            //  Main.DebugLog("g");
            __result = __instance.SpawnUnit(unit, prefab3, position, rotation, state);


            return(false);
        }
        // Token: 0x06000038 RID: 56 RVA: 0x0000227B File Offset: 0x0000047B
        private static bool Prefix(EntityCreationController __instance, BlueprintUnit unit, UnitEntityView prefab, Vector3 position, Quaternion rotation, SceneEntitiesState state, ref UnitEntityData __result)
        {
            /*  if (!Main.first)
             * {
             *    return true;
             * }*/

            if (unit == null)
            {
                Main.DebugLog("Trying to spawn null unit.");
                // Main.OrigTexName = null;
                //   Main.ReadableText = null;


                Main.preset    = null;
                Main.notRandom = false;
                return(true);
            }
            if (prefab == null)
            {
                Main.DebugLog("Trying to spawn unit without prefab");
                // Main.OrigTexName = null;
                // Main.ReadableText = null;


                Main.preset    = null;
                Main.notRandom = false;
                return(true);
            }


            Main.DebugLog("SpawnUnit() -  " + unit.CharacterName + " - " + unit.name + " - " + unit.AssetGuid);


            prefab.UniqueId = Guid.NewGuid().ToString();

            bool isprefab = false;

            //if (prefab.Renderers !=null && prefab.Renderers.Count() > 0)
            if (prefab.GetComponentsInChildren <Component>().Count() > 0)
            {
                //prefab.Renderers.ForEach(x => Main.DebugLog("tex? "+x.material?.mainTexture?.name));
                isprefab = true;

                //prefab.GetComponentsInChildren<SkinnedMeshRenderer>().ToList().ForEach(x => Main.DebugLog("tex? " + x.material?.mainTexture?.name));

                Tuple <string, string> result2 = new Tuple <string, string>("", "");
                //if (!string.IsNullOrEmpty(__instance.Descriptor.CustomPrefabGuid))
                // if (unit.CustomizationPreset != null || Main.customPrefabUnits.ContainsKey(unit.name))
                // {

                result2 = Main.randomPool(unit, prefab);
                //   }

                prefab = Main.unitEntityViewTexReplacer(prefab, result2.Item1, result2.Item2);
            }
            else
            {
                Main.DebugLog("noren");
            }

            //var named = (first: "one", second: "two");



            UnitEntityView unitEntityView = UnityEngine.Object.Instantiate <UnitEntityView>(prefab, position, rotation);

            if (!isprefab)
            {
                Tuple <string, string> result = new Tuple <string, string>("", "");
                //if (!string.IsNullOrEmpty(__instance.Descriptor.CustomPrefabGuid))
                //   if (unit.CustomizationPreset != null || Main.customPrefabUnits.ContainsKey(unit.name))
                //   {

                result = Main.randomPool(unit, unitEntityView);
                //    }

                unitEntityView = Main.unitEntityViewTexReplacer(unitEntityView, result.Item1, result.Item2);
            }


            //  unitEntityView.Destroy();



#if DEBUG
            Main.DebugLog("SpawnUnit(): Main.OrigTexName: " + Main.OrigTexName);
            if (unit.AddFacts.Length > 0)
            {
                Array.Clear(unit.AddFacts, 0, unit.AddFacts.Length);
            }
#endif



            unitEntityView.Blueprint = unit;

            __result = (UnitEntityData)__instance.SpawnEntityWithView(unitEntityView, state);

            /*
             * if (__result.View.CharacterAvatar != null)
             * {
             *
             *  if (__result.View.CharacterAvatar != null && __result.View.CharacterAvatar.BakedCharacter != null && __result.View.CharacterAvatar.BakedCharacter.RendererDescriptions.Count() > 0 && __result.View.CharacterAvatar.BakedCharacter.RendererDescriptions.Any(x => (x.Material?.mainTexture?.width < 500 || x.Material?.mainTexture?.height < 500) && x.Material?.mainTexture?.name == Main.OrigTexName))
             *  {
             *      Main.DebugLog("SpawnUnit/ after SpawnEntityView CHARAVATAR TRIGGERED");
             *      foreach (RendererDescription rd in __result.View.CharacterAvatar.BakedCharacter.RendererDescriptions)
             *      {
             *          if (rd.Material?.mainTexture?.name == Main.OrigTexName)
             *          {
             *              rd.Material.mainTexture = Main.ReadableText;
             *              rd.Material.mainTexture.name = Main.OrigTexName;
             *          }
             *
             *      }
             *
             *  }
             *
             * }
             * Main.OrigTexName = null;
             */



            // Main.ReadableText = null;


            Main.preset    = null;
            Main.notRandom = false;

            return(false);
        }
        private static BlueprintFeature AddSpiderCompanion()
        {
            PortraitData portraitData = new PortraitData("AdvancedMartialArtsSpider");

            BlueprintPortrait portrait = Helpers.Create <BlueprintPortrait>();

            portrait.Data = portraitData;
            Main.library.AddAsset(portrait, Helpers.getGuid("GiantSpiderPortrait"));

            BlueprintUnitFact reducedReachFact = Main.library.Get <BlueprintUnitFact>("c33f2d68d93ceee488aa4004347dffca");
            BlueprintFeature  weaponFinesse    = Main.library.Get <BlueprintFeature>("90e54424d682d104ab36436bd527af09");

            BlueprintFeature animalCompanionUpgradeCentipede = Main.library.Get <BlueprintFeature>("c938099ca0438b242b3edecfa9083e9f");
            BlueprintUnit    animalCompanionUnitCentipede    = Main.library.Get <BlueprintUnit>("f9df16ffd0c8cec4d99a0ae6f025a3f8");

            BlueprintUnit giantSpider = Main.library.CopyAndAdd <BlueprintUnit>("c4b33e5fd3d3a6f46b2aade647b0bf25", "GiantSpiderCompanion", Helpers.getGuid("GiantSpiderCompanion"));

            BlueprintItemWeapon Bite1d6         = Main.library.Get <BlueprintItemWeapon>("a000716f88c969c499a535dadcf09286");
            BlueprintItemWeapon EmptyHandWeapon = Main.library.Get <BlueprintItemWeapon>("20375b5a0c9243d45966bd72c690ab74");

            giantSpider.Brain           = animalCompanionUnitCentipede.Brain;
            giantSpider.ComponentsArray = animalCompanionUnitCentipede.ComponentsArray;
            giantSpider.Body            = animalCompanionUnitCentipede.Body;
            giantSpider.AddFacts        = giantSpider.AddFacts.AddToArray(weaponFinesse);
            giantSpider.Faction         = Main.library.Get <BlueprintFaction>("d8de50cc80eb4dc409a983991e0b77ad"); // Neutral faction

            Helpers.SetField(giantSpider, "m_Portrait", portrait);

            BlueprintUnitAsksList giantSpiderBarks = Main.library.CopyAndAdd <BlueprintUnitAsksList>("7d340f75a57c47d45b0e79200a6b5eac", "SpiderAnimalCompanionBarks", Helpers.getGuid("SpiderAnimalCompanionBarks"));
            UnitAsksComponent     component        = giantSpiderBarks.GetComponent <UnitAsksComponent>();

            foreach (var componentAnimationBark in component.AnimationBarks)
            {
                if (componentAnimationBark.AnimationEvent == MappedAnimationEventType.AlertSound1 || componentAnimationBark.AnimationEvent == MappedAnimationEventType.AlertSound2)
                {
                    componentAnimationBark.Cooldown = 10f;
                    componentAnimationBark.DelayMin = 5f;
                }
            }

            ChangeUnitSize unitSize = Helpers.Create <ChangeUnitSize>(x => x.SizeDelta = 1);

            FieldInfo typeField = unitSize.GetType().GetField("m_Type", BindingFlags.NonPublic | BindingFlags.Instance);
            object    delta     = unitSize.GetType().GetNestedType("ChangeType", BindingFlags.NonPublic).GetField("Delta").GetValue(unitSize);

            typeField.SetValue(unitSize, delta);

            AddMechanicsFeature addMechanicsFeature = Helpers.Create <AddMechanicsFeature>();

            Traverse traverse = Traverse.Create(addMechanicsFeature);

            traverse.Field("m_Feature").SetValue(AddMechanicsFeature.MechanicsFeatureType.IterativeNaturalAttacks);


            typeField.SetValue(unitSize, delta);

            BlueprintFeature animalCompanionFeatureSpider = Main.library.CopyAndAdd <BlueprintFeature>("f9ef7717531f5914a9b6ecacfad63f46", "AnimalCompanionFeatureGiantSpider", Helpers.getGuid("AnimalCompanionFeatureGiantSpider"));

            animalCompanionFeatureSpider.SetNameDescription("Animal Companion — Giant Spider", "Size Medium\nSpeed 30 ft.\nAC +1 natural armor\nAttack bite (1d6 plus poison)\nAbility Scores Str 11, Dex 17, Con 12, Int 1, Wis 10, Cha 2\nSpecial Attacks poison (frequency 1 round (4); effect 1d2 Str damage; cure 1 save; Con-based DC)\nCMD +8 vs. trip.\nAt 7th level size becomes Large, Str +2, Dex +8, Con +4, +2 natural armor.");

            AddPet addPetFact = animalCompanionFeatureSpider.ComponentsArray.OfType <AddPet>().First();

            animalCompanionFeatureSpider.RemoveComponent(addPetFact);
            addPetFact = UnityEngine.Object.Instantiate(addPetFact);
            animalCompanionFeatureSpider.AddComponent(addPetFact);

            addPetFact.Pet            = giantSpider;
            addPetFact.UpgradeFeature = Helpers.CreateFeature(
                "AnimalCompanionUpgradeGiantSpider",
                "",
                "",
                Helpers.getGuid("AnimalCompanionUpgradeGiantSpider"),
                animalCompanionUpgradeCentipede.Icon,
                FeatureGroup.None,
                unitSize,
                Helpers.Create <AddStatBonus>(x =>
            {
                x.Stat       = StatType.AC;
                x.Value      = 2;
                x.Descriptor = ModifierDescriptor.NaturalArmor;
            }),
                Helpers.Create <AddStatBonus>(x =>
            {
                x.Stat  = StatType.Strength;
                x.Value = 2;
            }),
                Helpers.Create <AddStatBonus>(x =>
            {
                x.Stat  = StatType.Dexterity;
                x.Value = 8;
            }),
                Helpers.Create <AddStatBonus>(x =>
            {
                x.Stat  = StatType.Constitution;
                x.Value = 4;
            }),
                addMechanicsFeature,
                Helpers.CreateAddFacts(reducedReachFact)
                );
            addPetFact.UpgradeLevel = 7;
            return(animalCompanionFeatureSpider);
        }
예제 #29
0
 public static int GetXp(BlueprintUnit unit)
 {
     return(OwlcatRESelector.GetXp(OwlcatRESelector.GetCR(unit)));
 }
예제 #30
0
        static public void LoadOnLibraryLoaded()
        {
            if (loaded)
            {
                return;
            }
            flagIsRisiaSpawned     = Helpers.Create <BlueprintUnlockableFlag>();
            flagIsRisiaBossSpawned = Helpers.Create <BlueprintUnlockableFlag>();
            library.AddAsset(flagIsRisiaSpawned, "942339abe7b76dfb00324d433a0a9342");
            library.AddAsset(flagIsRisiaBossSpawned, "942339abe7b76dfb00324d433a0a9343");
            flagIsRisiaSpawned.Lock();
            flagIsRisiaSpawned.name = "flagIsRisiaSpawned";
            flagIsRisiaBossSpawned.Lock();
            flagIsRisiaBossSpawned.name = "flagIsRisiaBossSpawned";

            FastGetter    portrait_Getter    = Helpers.CreateFieldGetter <BlueprintUnit>("m_Portrait");
            PortraitData  risia_portraitData = CreatePortraitData("Risia");
            BlueprintUnit risia_companion    = library.Get <BlueprintUnit>("c2dc52c5fec84bc2a74e2cb34fdb566b");
            BlueprintUnit risia_neutral      = library.Get <BlueprintUnit>("d87f8e86724f46e798821d60f9d31eaf");
            BlueprintUnit risia_boss         = library.Get <BlueprintUnit>("95fb27a5b8ae40099bd727ea93de5b9b");

            foreach (var unit in new BlueprintUnit[] { risia_companion, risia_neutral, risia_boss })
            {
                BlueprintPortrait portraitBlue = portrait_Getter(unit) as BlueprintPortrait;
                portraitBlue.Data = risia_portraitData;
            }
            RisiaAddSpecialSpells.LoadSpecialSpells();
            RisiaAddLevels.Load();
            RisiaAddSpecialSpells.CreateFeats();
            RisiaAddBrain.Load();

            List <BlueprintFeature> risiaNeutralAddFacts = new List <BlueprintFeature>();

            risiaNeutralAddFacts.AddRange(RisiaAddLevels.RisiaAddFacts);
            risiaNeutralAddFacts.Add(RisiaAddSpecialSpells.addSpecialSpellListFeat);
            risiaNeutralAddFacts.Add(RisiaAddSpecialSpells.addSpecialSpellFeat);
            List <BlueprintFeature> risiaBossAddFacts = new List <BlueprintFeature>();

            risiaBossAddFacts.AddRange(RisiaAddLevels.RisiaBossAddFacts);
            risiaBossAddFacts.Add(RisiaAddSpecialSpells.addSpecialSpellListFeat);
            risiaBossAddFacts.Add(RisiaAddSpecialSpells.addSpecialSpellFeat);

            var risiaFeatureList = Helpers.CreateFeature("RisiaFeatureList", "", "",
                                                         OtherUtils.GetMd5("Risia.FeatureList"),
                                                         IconSet.elvenmagic,
                                                         FeatureGroup.None,
                                                         //RisiaAddLevels.compNeutral,
                                                         Helpers.Create <AddFacts>(a => a.Facts = risiaNeutralAddFacts.ToArray()));
            var risiaBossFeatureList = Helpers.CreateFeature("RisiaBossFeatureList", "", "",
                                                             OtherUtils.GetMd5("Risia.Boss.FeatureList"),
                                                             IconSet.elvenmagic,
                                                             FeatureGroup.None,
                                                             //RisiaAddLevels.compBoss,
                                                             Helpers.Create <AddFacts>(a => a.Facts = risiaBossAddFacts.ToArray()));

            risia_neutral.AddComponent(RisiaAddLevels.compNeutral);
            risia_companion.AddComponent(RisiaAddLevels.compNeutral);
            risia_boss.AddComponent(RisiaAddLevels.compBoss);
            var tmpList = risia_neutral.AddFacts.ToList();

            tmpList.Add(risiaFeatureList);
            risia_neutral.AddFacts = tmpList.ToArray();
            var tmpList2 = risia_companion.AddFacts.ToList();

            tmpList2.Add(risiaFeatureList);
            risia_companion.AddFacts = tmpList2.ToArray();
            var tmpList3 = risia_boss.AddFacts.ToList();

            tmpList3.Add(risiaBossFeatureList);
            risia_boss.AddFacts = tmpList3.ToArray();

            RisiaAddDispelAura.AddToRisia(ref risia_boss);
            loaded = true;
        }