Пример #1
0
        public void createNewAnimal(ref Mercenary merc, PawnKindDef race)
        {
            Pawn newPawn = PawnGenerator.GeneratePawn(FCPawnGenerator.AnimalRequest(race));

            //merc = (Mercenary)newPawn;

            merc.squad      = this;
            merc.settlement = settlement;
            //Log.Message(newPawn.Name + "   State: Dead - " + newPawn.health.Dead + "    Apparel Count: " + newPawn.apparel.WornApparel.Count());
            merc.pawn = newPawn;
        }
Пример #2
0
        public void generateDefaultPawn()
        {
            List <Apparel>        apparel   = new List <Apparel>();
            List <ThingWithComps> equipment = new List <ThingWithComps>();

            if (defaultPawn != null)
            {
                apparel.AddRange(defaultPawn.apparel.WornApparel);
                equipment.AddRange(defaultPawn.equipment.AllEquipmentListForReading);

Reset:
                foreach (Apparel cloth in defaultPawn.apparel.WornApparel)
                {
                    defaultPawn.apparel.Remove(cloth);
                    goto Reset;
                }

                foreach (ThingWithComps weapon in defaultPawn.equipment.AllEquipmentListForReading)
                {
                    defaultPawn.equipment.Remove(weapon);
                    goto Reset;
                }

                defaultPawn.Destroy();
            }

            defaultPawn = PawnGenerator.GeneratePawn(FCPawnGenerator.WorkerOrMilitaryRequest(pawnKind));
            defaultPawn.health.forceIncap           = true;
            defaultPawn.mindState.canFleeIndividual = false;
            defaultPawn.apparel.DestroyAll();

            foreach (Apparel clothes in apparel)
            {
                //Log.Message(clothes.Label);
                defaultPawn.apparel.Wear(clothes);
            }

            foreach (ThingWithComps weapon in equipment)
            {
                //Log.Message(weapon.Label);
                equipWeapon(weapon);
            }
        }
Пример #3
0
        public void createNewPawn(ref Mercenary merc, PawnKindDef race)
        {
            PawnKindDef raceChoice = race;
            FactionFC   factionFc  = Find.World.GetComponent <FactionFC>();

            if (race == null || !factionFc.raceFilter.Allows(raceChoice.race))
            {
                raceChoice = FactionColonies.getPlayerColonyFaction().RandomPawnKind();
            }

            Pawn newPawn = PawnGenerator.GeneratePawn(FCPawnGenerator.WorkerOrMilitaryRequest(raceChoice));

            newPawn.apparel?.DestroyAll();
            newPawn.equipment?.DestroyAllEquipment();
            //merc = (Mercenary)newPawn;
            merc.squad      = this;
            merc.settlement = settlement;
            //Log.Message(newPawn.Name + "   State: Dead - " + newPawn.health.Dead + "    Apparel Count: " + newPawn.apparel.WornApparel.Count());
            merc.pawn = newPawn;
        }
Пример #4
0
        private void DrawFactionButtons(int buttonSize)         //Used to draw a list of buttons from the 'buttons' list
        {
            Text.Anchor = TextAnchor.MiddleCenter;
            Text.Font   = GameFont.Small;
            for (int i = 0; i < buttons.Count; i++)
            {
                if (Widgets.ButtonText(new Rect(140, 110 + ((buttonSize + 5) * i), 170, buttonSize), buttons[i]))
                {
                    if (buttons[i] == "FCOverview".Translate())
                    {
                        Find.WindowStack.Add(new FCWindow_Overview());
                    }


                    if (buttons[i] == "Military".Translate())
                    {
                        if (FactionColonies.getPlayerColonyFaction() == null)
                        {
                            Messages.Message(new Message("NoFactionForMilitary".Translate(), MessageTypeDefOf.RejectInput));
                        }
                        else
                        {
                            Find.WindowStack.Add(new MilitaryCustomizationWindowFc());
                        }
                    }

                    if (buttons[i] == "Actions".Translate())
                    {
                        List <FloatMenuOption> list = new List <FloatMenuOption>
                        {
                            new FloatMenuOption("TaxDeliveryMap".Translate(), delegate
                            {
                                List <FloatMenuOption> list2 = new List <FloatMenuOption> {
                                    new FloatMenuOption("SetMap".Translate(), delegate
                                    {
                                        List <FloatMenuOption> settlementList = new List <FloatMenuOption>();

                                        foreach (Map map in Find.Maps)
                                        {
                                            if (map.IsPlayerHome)
                                            {
                                                settlementList.Add(new FloatMenuOption(map.Parent.LabelCap, delegate
                                                {
                                                    faction.taxMap = map;
                                                    Find.LetterStack.ReceiveLetter("Map Set!", "The tax delivery map has been set to the player colony of " + map.Parent.LabelCap + ".\n All taxes and other goods will be delivered there", LetterDefOf.NeutralEvent);
                                                }
                                                                                       ));
                                            }
                                        }

                                        if (settlementList.Count == 0)
                                        {
                                            settlementList.Add(new FloatMenuOption("No valid settlements to use.", null));
                                        }

                                        FloatMenu floatMenu2 = new FloatMenu(settlementList);
                                        Find.WindowStack.Add(floatMenu2);
                                    })
                                };

                                FloatMenu floatMenu = new FloatMenu(list2);
                                Find.WindowStack.Add(floatMenu);
                            }),

                            new FloatMenuOption("SetCapital".Translate(), delegate
                            {
                                faction.setCapital();
                            }),

                            new FloatMenuOption("ActivateResearch".Translate(), delegate
                            {
                                faction.updateDailyResearch();
                            }),

                            new FloatMenuOption("ResearchLevel".Translate(), delegate
                            {
                                Messages.Message("CurrentResearchLevel".Translate(faction.techLevel.ToString(), faction.returnNextTechToLevel()), MessageTypeDefOf.NeutralEvent);
                            }),

                            new FloatMenuOption("FCOpenPatchNotes".Translate(), () => DebugActionsMisc.PatchNotesDisplayWindow())
                        };

                        if (faction.hasPolicy(FCPolicyDefOf.technocratic))
                        {
                            list.Add(new FloatMenuOption("FCSendResearchItems".Translate(), delegate
                            {
                                if (Find.ColonistBar.GetColonistsInOrder().Count > 0)
                                {
                                    Pawn playerNegotiator = Find.ColonistBar.GetColonistsInOrder()[0];
                                    //Log.Message(playerNegotiator.Name + " Negotiator");

                                    FCTrader_Research trader = new FCTrader_Research();

                                    Find.WindowStack.Add(new Dialog_Trade(playerNegotiator, trader));
                                }
                                else
                                {
                                    Log.Error("Couldn't find any colonists to trade with");
                                }
                            }));
                        }

                        if (faction.hasPolicy(FCPolicyDefOf.feudal))
                        {
                            list.Add(new FloatMenuOption("FCRequestMercenary".Translate(), delegate
                            {
                                if (faction.traitFeudalBoolCanUseMercenary)
                                {
                                    faction.traitFeudalBoolCanUseMercenary   = false;
                                    faction.traitFeudalTickLastUsedMercenary = Find.TickManager.TicksGame;

                                    PawnGenerationRequest request        = FCPawnGenerator.WorkerOrMilitaryRequest();
                                    request.ColonistRelationChanceFactor = 20f;
                                    Pawn pawn = PawnGenerator.GeneratePawn(request);

                                    IncidentParms parms = new IncidentParms
                                    {
                                        target  = Find.CurrentMap,
                                        faction = FactionColonies.getPlayerColonyFaction(),
                                        points  = 999,
                                        raidArrivalModeForQuickMilitaryAid = true,
                                        raidNeverFleeIndividual            = true,
                                        raidForceOneIncap = true,
                                        raidArrivalMode   = PawnsArrivalModeDefOf.CenterDrop,
                                        raidStrategy      = RaidStrategyDefOf.ImmediateAttackFriendly
                                    };
                                    parms.raidArrivalModeForQuickMilitaryAid = true;
                                    PawnsArrivalModeWorker_EdgeWalkIn worker = new PawnsArrivalModeWorker_EdgeWalkIn();
                                    worker.TryResolveRaidSpawnCenter(parms);
                                    worker.Arrive(new List <Pawn> {
                                        pawn
                                    }, parms);

                                    Find.LetterStack.ReceiveLetter("FCMercenaryJoined".Translate(), "FCMercenaryJoinedText".Translate(pawn.NameFullColored), LetterDefOf.PositiveEvent, new LookTargets(pawn));
                                    pawn.SetFaction(Faction.OfPlayer);
                                }
                                else
                                {
                                    Messages.Message("FCActionMercenaryOnCooldown".Translate(((faction.traitFeudalTickLastUsedMercenary + GenDate.TicksPerSeason) - Find.TickManager.TicksGame).ToTimeString()), MessageTypeDefOf.RejectInput);
                                }
                            }));
                        }


                        FloatMenu menu = new FloatMenu(list);
                        Find.WindowStack.Add(menu);
                    }
                }
            }
        }