Пример #1
0
    protected override QuestStage[] GenerateQuestStages()
    {
        if (base.reporter == null)
        {
            return(null);
        }
        QuestStage[] stages = new QuestStage[NUM_STAGES];

        List <string> exclude = new List <string>()
        {
            base.reporter.GetName()
        };

        exclude.AddRange(takenNpcNames);

        NPC[] targetNpcs1 = NPCSpawner.instance.GetRandomNpcs(1, exclude);
        stages[0] = new BeatdownQuestStage(targetNpcs1, 15);
        exclude.AddRange(targetNpcs1.Select(npc => npc.GetName()));

        NPC[] targetNpcs2 = NPCSpawner.instance.GetRandomNpcs(3, exclude);
        stages[1] = new BeatdownQuestStage(targetNpcs2, 25);

        takenNpcNames.AddRange(targetNpcs1.Select(npc => npc.GetName()));
        takenNpcNames.AddRange(targetNpcs2.Select(npc => npc.GetName()));

        targetNpcs1 = null;
        targetNpcs2 = null;

        return(stages);
    }
Пример #2
0
    public static BeatdownQuestStage LoadQuestStageFromData(BeatdownQuestStageData data)
    {
        BeatdownQuest.takenNpcNames.AddRange(data.npcRequirements.Where(req => !data.completedRequirements.Contains(req)));
        BeatdownQuestStage stage = new BeatdownQuestStage(data.npcRequirements, data.completedRequirements, data.reward);

        stage.originalDetails = data.originalDetails;
        return(stage);
    }
Пример #3
0
    public override void OnDefeatedNPC(NPC npc)
    {
        BeatdownQuestStage stage = GetCurrentStage <BeatdownQuestStage>();

        if (stage.FulfillsRequirement(npc))
        {
            CompleteQuestStage();
        }
    }
Пример #4
0
    public override void LoadFromData(QuestData data)
    {
        int numStages = data.stages.Length;

        this.stages = new BeatdownQuestStage[numStages];
        for (int i = 0; i < numStages; i++)
        {
            this.stages[i] = BeatdownQuestStage.LoadQuestStageFromData(data.stages[i] as BeatdownQuestStage.BeatdownQuestStageData);
        }

        this.currentStage = data.currentStage;
        this.active       = data.active;
    }
Пример #5
0
 public BeatdownQuestStageData(BeatdownQuestStage stage) : base(stage)
 {
     this.originalDetails       = stage.originalDetails;
     this.npcRequirements       = stage.npcRequirements;
     this.completedRequirements = stage.completedRequirements.ToArray();
 }