Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
 }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 19
0
 private static IEnumerable <Page> < GetFirstConfigPage > m__4(ScenPart p)
 {
     return(p.GetConfigPages());
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 22
0
 private static float <GetFullInformationText> m__0(ScenPart p)
 {
     return(p.def.summaryPriority);
 }
Ejemplo n.º 23
0
        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));
        }
Ejemplo n.º 24
0
 private static string <GetFullInformationText> m__1(ScenPart p)
 {
     return(p.def.defName);
 }
Ejemplo n.º 25
0
 public virtual bool CanCoexistWith(ScenPart other)
 {
     return(true);
 }
Ejemplo n.º 26
0
 public virtual bool TryMerge(ScenPart other)
 {
     return(false);
 }
Ejemplo n.º 27
0
 private static bool <GetFullInformationText> m__2(ScenPart p)
 {
     return(p.visible);
 }
Ejemplo n.º 28
0
 private static ScenPart <CopyForEditing> m__3(ScenPart p)
 {
     return(p.CopyForEditing());
 }
Ejemplo n.º 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));
        }
Ejemplo n.º 30
0
 private static bool <ExposeData> m__0(ScenPart x)
 {
     return(x == null);
 }