Beispiel #1
0
        public override bool TryMerge(ScenPart other)
        {
            ScenPart_SetNeedLevel scenPart_SetNeedLevel = other as ScenPart_SetNeedLevel;

            if (scenPart_SetNeedLevel != null && need == scenPart_SetNeedLevel.need)
            {
                chance = GenMath.ChanceEitherHappens(chance, scenPart_SetNeedLevel.chance);
                return(true);
            }
            return(false);
        }
        public override bool TryMerge(ScenPart other)
        {
            ScenPart_ThingCount scenPart_ThingCount = other as ScenPart_ThingCount;

            if (scenPart_ThingCount != null && base.GetType() == scenPart_ThingCount.GetType() && this.thingDef == scenPart_ThingCount.thingDef && this.stuff == scenPart_ThingCount.stuff && this.count >= 0 && scenPart_ThingCount.count >= 0)
            {
                this.count += scenPart_ThingCount.count;
                return(true);
            }
            return(false);
        }
Beispiel #3
0
        public override bool TryMerge(ScenPart other)
        {
            ScenPart_ForcedHediff scenPart_ForcedHediff = other as ScenPart_ForcedHediff;

            if (scenPart_ForcedHediff != null && this.hediff == scenPart_ForcedHediff.hediff)
            {
                base.chance = GenMath.ChanceEitherHappens(base.chance, scenPart_ForcedHediff.chance);
                return(true);
            }
            return(false);
        }
Beispiel #4
0
        public override bool TryMerge(ScenPart other)
        {
            ScenPart_StatFactor scenPart_StatFactor = other as ScenPart_StatFactor;

            if (scenPart_StatFactor != null && scenPart_StatFactor.stat == this.stat)
            {
                this.factor *= scenPart_StatFactor.factor;
                return(true);
            }
            return(false);
        }
 private static bool CanAddPart(Scenario scen, ScenPart newPart)
 {
     for (int i = 0; i < scen.parts.Count; i++)
     {
         if (!newPart.CanCoexistWith(scen.parts[i]))
         {
             return(false);
         }
     }
     return(true);
 }
        public override bool TryMerge(ScenPart other)
        {
            ScenPart_StartingAnimal scenPart_StartingAnimal = other as ScenPart_StartingAnimal;

            if (scenPart_StartingAnimal != null && scenPart_StartingAnimal.animalKind == animalKind)
            {
                count += scenPart_StartingAnimal.count;
                return(true);
            }
            return(false);
        }
        public override bool CanCoexistWith(ScenPart other)
        {
            if (gameCondition == null)
            {
                return(true);
            }
            ScenPart_PermaGameCondition scenPart_PermaGameCondition = other as ScenPart_PermaGameCondition;

            if (scenPart_PermaGameCondition != null && !gameCondition.CanCoexistWith(scenPart_PermaGameCondition.gameCondition))
            {
                return(false);
            }
            return(true);
        }
Beispiel #8
0
        public void Reorder(ScenPart part, ReorderDirection dir)
        {
            int num = parts.IndexOf(part);

            parts.RemoveAt(num);
            if (dir == ReorderDirection.Up)
            {
                parts.Insert(num - 1, part);
            }
            if (dir == ReorderDirection.Down)
            {
                parts.Insert(num + 1, part);
            }
        }
Beispiel #9
0
        public override bool TryMerge(ScenPart other)
        {
            ScenPart_ForcedHediff scenPart_ForcedHediff = other as ScenPart_ForcedHediff;
            bool result;

            if (scenPart_ForcedHediff != null && this.hediff == scenPart_ForcedHediff.hediff)
            {
                this.chance = GenMath.ChanceEitherHappens(this.chance, scenPart_ForcedHediff.chance);
                result      = true;
            }
            else
            {
                result = false;
            }
            return(result);
        }
Beispiel #10
0
        public override bool TryMerge(ScenPart other)
        {
            ScenPart_StatFactor scenPart_StatFactor = other as ScenPart_StatFactor;
            bool result;

            if (scenPart_StatFactor != null && scenPart_StatFactor.stat == this.stat)
            {
                this.factor *= scenPart_StatFactor.factor;
                result       = true;
            }
            else
            {
                result = false;
            }
            return(result);
        }
Beispiel #11
0
        public override bool TryMerge(ScenPart other)
        {
            ScenPart_SetNeedLevel scenPart_SetNeedLevel = other as ScenPart_SetNeedLevel;
            bool result;

            if (scenPart_SetNeedLevel != null && this.need == scenPart_SetNeedLevel.need)
            {
                this.chance = GenMath.ChanceEitherHappens(this.chance, scenPart_SetNeedLevel.chance);
                result      = true;
            }
            else
            {
                result = false;
            }
            return(result);
        }
        public override bool TryMerge(ScenPart other)
        {
            ScenPart_StartingAnimal scenPart_StartingAnimal = other as ScenPart_StartingAnimal;
            bool result;

            if (scenPart_StartingAnimal != null && scenPart_StartingAnimal.animalKind == this.animalKind)
            {
                this.count += scenPart_StartingAnimal.count;
                result      = true;
            }
            else
            {
                result = false;
            }
            return(result);
        }
Beispiel #13
0
 public override bool CanCoexistWith(ScenPart other)
 {
     if (other is ScenPart_LandShip || other is ScenPart_StartingAnimal || (other is ScenPart_StartingThing_Defined || other is ScenPart_ScatterThingsNearPlayerStart))
     {
         return(false);
     }
     if (other is ScenPart_ConfigPage_ConfigureStartingPawns)
     {
         Find.Scenario.RemovePart(other);
     }
     if (other is ScenPart_PlayerPawnsArriveMethod)
     {
         Find.Scenario.RemovePart(other);
     }
     return(true);
 }
Beispiel #14
0
        public bool CanReorder(ScenPart part, ReorderDirection dir)
        {
            if (!part.def.PlayerAddRemovable)
            {
                return(false);
            }
            int num = this.parts.IndexOf(part);

            if (dir == ReorderDirection.Up)
            {
                return(num != 0 && (num <= 0 || this.parts[num - 1].def.PlayerAddRemovable));
            }
            if (dir == ReorderDirection.Down)
            {
                return(num != this.parts.Count - 1);
            }
            throw new NotImplementedException();
        }
        private static IEnumerable <ScenPart> RandomScenPartsOfCategory(Scenario scen, ScenPartCategory cat, int count)
        {
            if (count <= 0)
            {
                yield break;
            }
            IEnumerable <ScenPartDef> allowedParts = from d in ScenarioMaker.AddableParts(scen)
                                                     where d.category == cat
                                                     select d;
            int numYielded = 0;
            int numTries   = 0;

            while (numYielded < count)
            {
                if (!allowedParts.Any <ScenPartDef>())
                {
                    yield break;
                }
                ScenPartDef def     = allowedParts.RandomElementByWeight((ScenPartDef d) => d.selectionWeight);
                ScenPart    newPart = ScenarioMaker.MakeScenPart(def);
                if (ScenarioMaker.CanAddPart(scen, newPart))
                {
                    yield return(newPart);

                    numYielded++;
                }
                numTries++;
                if (numTries > 100)
                {
                    Log.Error(string.Concat(new object[]
                    {
                        "Could not add ScenPart of category ",
                        cat,
                        " to scenario ",
                        scen,
                        " after 50 tries."
                    }), false);
                    yield break;
                }
            }
            yield break;
        }
        public override bool CanCoexistWith(ScenPart other)
        {
            bool result;

            if (this.gameCondition == null)
            {
                result = true;
            }
            else
            {
                ScenPart_PermaGameCondition scenPart_PermaGameCondition = other as ScenPart_PermaGameCondition;
                if (scenPart_PermaGameCondition != null)
                {
                    if (!this.gameCondition.CanCoexistWith(scenPart_PermaGameCondition.gameCondition))
                    {
                        return(false);
                    }
                }
                result = true;
            }
            return(result);
        }
Beispiel #17
0
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                switch (num)
                {
                case 0u:
                    this.$current = this.playerFaction;
                    if (!this.$disposing)
                    {
                        this.$PC = 1;
                    }
                    return(true);

                case 1u:
                    i = 0;
                    break;

                case 2u:
                    i++;
                    break;

                default:
                    return(false);
                }
                if (i < this.parts.Count)
                {
                    this.$current = this.parts[i];
                    if (!this.$disposing)
                    {
                        this.$PC = 2;
                    }
                    return(true);
                }
                this.$PC = -1;
                return(false);
            }
        public override bool CanCoexistWith(ScenPart other)
        {
            ScenPart_IncidentBase scenPart_IncidentBase = other as ScenPart_IncidentBase;

            return(scenPart_IncidentBase == null || scenPart_IncidentBase.Incident != this.incident);
        }
Beispiel #19
0
 private static IEnumerable <Page> < GetFirstConfigPage > m__4(ScenPart p)
 {
     return(p.GetConfigPages());
 }
Beispiel #20
0
        public override bool TryMerge(ScenPart other)
        {
            ScenPart_DisallowBuilding scenPart_DisallowBuilding = other as ScenPart_DisallowBuilding;

            return(scenPart_DisallowBuilding != null && scenPart_DisallowBuilding.building == this.building);
        }
        public override bool TryMerge(ScenPart other)
        {
            ScenPart_IncidentBase scenPart_IncidentBase = other as ScenPart_IncidentBase;

            return(scenPart_IncidentBase != null && scenPart_IncidentBase.Incident == this.incident);
        }
Beispiel #22
0
 private static float <GetFullInformationText> m__0(ScenPart p)
 {
     return(p.def.summaryPriority);
 }
        public override bool CanCoexistWith(ScenPart other)
        {
            ScenPart_ForcedTrait scenPart_ForcedTrait = other as ScenPart_ForcedTrait;

            return(scenPart_ForcedTrait == null || this.trait != scenPart_ForcedTrait.trait || !this.context.OverlapsWith(scenPart_ForcedTrait.context));
        }
Beispiel #24
0
 private static string <GetFullInformationText> m__1(ScenPart p)
 {
     return(p.def.defName);
 }
Beispiel #25
0
 public virtual bool CanCoexistWith(ScenPart other)
 {
     return(true);
 }
Beispiel #26
0
 public virtual bool TryMerge(ScenPart other)
 {
     return(false);
 }
Beispiel #27
0
 private static bool <GetFullInformationText> m__2(ScenPart p)
 {
     return(p.visible);
 }
Beispiel #28
0
 private static ScenPart <CopyForEditing> m__3(ScenPart p)
 {
     return(p.CopyForEditing());
 }
Beispiel #29
0
        public override bool CanCoexistWith(ScenPart other)
        {
            ScenPart_GameCondition scenPart_GameCondition = other as ScenPart_GameCondition;

            return(scenPart_GameCondition == null || scenPart_GameCondition.def.gameCondition.CanCoexistWith(this.def.gameCondition));
        }
 private static bool <ExposeData> m__0(ScenPart x)
 {
     return(x == null);
 }