Beispiel #1
0
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            Alliance alliance = parms.target as Alliance;

            if (alliance.Factions.Count == 0)
            {
                return(false);
            }

            FactionInteraction factionInteraction = alliance.Factions.RandomElement();

            if (!Find.WorldObjects.Settlements.Where(x => x.Faction == factionInteraction.Faction &&
                                                     CaravanArrivalTimeEstimator.EstimatedTicksToArrive(Find.AnyPlayerHomeMap.Tile, x.Tile, null).TicksToDays() < 7).TryRandomElement(out Settlement settlement))
            {
                return(false);
            }

            var research     = Find.ResearchManager.currentProj;
            int pointsReward = (int)((research.baseCost - Find.ResearchManager.GetProgress(research)) * 0.3f);
            Alliance_Quest_ResearchSharing quest = new Alliance_Quest_ResearchSharing(factionInteraction.Faction, SkillDef, pointsReward);

            quest.id          = QuestsManager.Communications.UniqueIdManager.GetNextQuestID();
            quest.TicksToPass = 6 * 60000;
            quest.IncidentDef = def;
            QuestSite questSite = quest.CreateSiteFor(settlement.Tile, quest.Faction);

            Find.WorldObjects.Add(questSite);

            QuestsManager.Communications.AddQuest(quest, null);

            SendStandardLetter(parms, questSite, factionInteraction.Faction.Name, pointsReward.ToString());

            return(true);
        }
Beispiel #2
0
 public CaravanArrivalAction_StartResearchSharing(MapParent mapParent, Alliance_Quest_ResearchSharing quest)
 {
     this.mapParent = mapParent;
     this.quest     = quest;
 }