void prepareMotive() { //revenge just requires one NPC to hate another if (motive == Motives.revenge) { int m = Random.Range(0, number_of_characters); setMurderer(npcs[m]); int v = 0; while (victim == null) { v = Random.Range(0, number_of_characters); if (npcs[v] != murderer) { setVictim(npcs[v]); } } //Make murderer hate victim relationships[m, v] = -3; bool historyChosen = false; while (!historyChosen) { int r = Random.Range(0, 4); switch (r) { case 0: { History history = new FiredBy(1, npcs[m], npcs[v]); npcs[m].addHistory(history); npcs[v].addHistory(history); historyChosen = true; SpreadTruth(history); break; } case 1: { //Histories added in the family feud method if (npcs[m].family != null && npcs[v].family != null) { createFamilyFeud(npcs[m].family, npcs[v].family); historyChosen = true; } break; } case 2: { History history = new PutOutOfBusiness(1, npcs[m], npcs[v]); npcs[m].addHistory(history); npcs[v].addHistory(history); historyChosen = true; SpreadTruth(history); break; } case 3: { History history = new Nemeses(0, npcs[m], npcs[v]); relationships[v, m] = -3; npcs[m].addHistory(history); npcs[v].addHistory(history); historyChosen = true; SpreadTruth(history); break; } } } } //inheritance for now just means an NPC killing their sibling to inherit from their (wealthy) parents later. Could later include murdering a spouse else if (motive == Motives.inheritance) { Npc[] siblings = findSiblings(); setMurderer(siblings[0]); setVictim(siblings[1]); } else if (motive == Motives.loverRevenge) { setMurderer(npcs[Random.Range(0, npcs.Count)]); setVictim(findPotentialLover(murderer)); //Now manipulate the m & v's affections for eachother int m = npcs.IndexOf(murderer); int v = npcs.IndexOf(victim); relationships[m, v] = 3; relationships[v, m] = randomRelationshipValue(-3, 2, 0); //Set to anything OTHER than love int r = Random.Range(0, 2); History history; if (r == 0) { history = new RejectedLove(1, npcs[m], npcs[v]); } else if (r == 1) { history = new BadBreakup(0, npcs[m], npcs[v]); } else { history = null; } npcs[m].addHistory(history); npcs[v].addHistory(history); SpreadTruth(history); } else if (motive == Motives.jealousLove) { //Randomly choose murderer //Find opposite gendered counterpart, same as with lover revenge //Give THEM a randomly chosen gendered counterpart and make them the victim setMurderer(npcs[Random.Range(0, npcs.Count)]); Npc stalkee = findPotentialLover(murderer); setVictim(findPotentialLover(stalkee)); //Now manipulate the m & v's affections for eachother int m = npcs.IndexOf(murderer); int s = npcs.IndexOf(stalkee); int v = npcs.IndexOf(victim); relationships[m, s] = 3; relationships[s, m] = randomRelationshipValue(-3, 2, 0); //Set to anything OTHER than love relationships[v, s] = 3; relationships[v, m] = randomRelationshipValue(-3, 2, 0); //Set to anything other than love again relationships[m, v] = randomRelationshipValue(-3, -2, -2); //Make the murderer strongly dislike the victim int r = Random.Range(0, 2); History history; if (r == 0) { relationships[s, v] = 3; history = new StoleLover(1, npcs[m], npcs[v], npcs[s]); npcs[m].addHistory(history); npcs[v].addHistory(history); npcs[s].addHistory(history); } else if (r == 1) { history = new CompetingForLove(0, npcs[m], npcs[v], npcs[s]); npcs[m].addHistory(history); npcs[v].addHistory(history); npcs[s].addHistory(history); } else { history = null; } SpreadTruth(history); } }
bool createAndSpreadHistory(System.Type historyType) { bool suitableNPC = false; List<Npc> tempNpcs = new List<Npc>(npcs); while (!suitableNPC && tempNpcs.Count > 0) { Npc npc = randomNPCfromList(tempNpcs); tempNpcs.Remove(npc); if (npc != victim && npc != murderer && npc.family != victim.family) { suitableNPC = true; History redHerring = null; if (historyType == typeof(FiredBy)) redHerring = new FiredBy(1, npc, victim); else if (historyType == typeof(Nemeses)) redHerring = new Nemeses(1, npc, victim); else if (historyType == typeof(PutOutOfBusiness)) redHerring = new PutOutOfBusiness(1, npc, victim); else if (historyType == typeof(BadBreakup)) redHerring = new BadBreakup(1, npc, victim); //TODO - Try and make Love-based red herrings. Difficuly because need to find plausible lovers npc.addHistory(redHerring); victim.addHistory(redHerring); SpreadRumour(redHerring, npc); return true; } } return false; }