// Public interactions void Awake() { seasonNumber = 1; yearNumber = 1; sacrificeCandidates = new List<PersonReference>(); cultistCandidates = new List<PersonReference>(); currentTarget = YearTargetFactory.GetYearTargets(yearNumber); peoplePool = new PeoplePool(); traitPool = new TraitPool(); flavourPool = new FlavourPool(); cultists = new Cultist[NUMBER_OF_CULTISTS]; var cultistAssets = new List<SearchableAsset> { new SearchableAsset() { Profession = Profession.None, Sin = Sin.None, Virtue = Virtue.None } }; // Create the starting Cultists numberOfCultists = 2; currentPeoplePoolIndex = 2; peoplePool.GeneratePeople(numberOfCultists, cultistAssets, false, false); cultists[0] = new Cultist() { PersonID = peoplePool.activePool[1].PersonID, Instruction = null }; cultists[1] = new Cultist() { PersonID = peoplePool.activePool[2].PersonID, Instruction = null }; GetNewPools(currentTarget.SacrificeTargets, cultistAssets, 20); gameWillEnd = false; }
public void ProcessSuccess(SuccessRating rating, Instruction action) { if (action != null) { ResultTextList.Add(string.Format("{0} at {1}", rating.ToString(), action.Action.ToString())); action.IsSuccess = rating; switch (action.Action) { case ActionType.Abduct: switch (action.IsSuccess) { case SuccessRating.GoodSuccess: case SuccessRating.GreatSuccess: case SuccessRating.NormalSuccess: int newIndex = 0; for (int i = 0; i < 8; i++) { newIndex = i; if (cultists[i] == null) { i = 10; } } cultists[newIndex] = new Cultist() { PersonID = (int)action.TargetID, Instruction = null }; ++numberOfCultists; sacrificeCandidates.Remove(sacrificeCandidates.Find(sa => sa.PersonID == action.TargetID)); break; case SuccessRating.BadFailure: case SuccessRating.TerribleFailure: case SuccessRating.Failure: break; } peoplePool.activePool[(int)action.TargetID].Active = false; break; case ActionType.Investigate: switch (action.IsSuccess) { case SuccessRating.GoodSuccess: case SuccessRating.GreatSuccess: case SuccessRating.NormalSuccess: if (sacrificeCandidates.Exists(sa => sa.PersonID == action.TargetID)) { var sacrifice = sacrificeCandidates.Find(sa => sa.PersonID == action.TargetID); sacrifice.IndepthInvestigated = true; Person sac = GetPerson(sacrifice.PersonID); sac.FlavourText = flavourPool.GetInvestigationValue(sac.assets.Profession, sac.assets.Sin) + " " + flavourPool.GetInvestigationValue(sac.assets.Profession, sac.assets.Virtue); } else { var cultist = cultistCandidates.Find(cult => cult.PersonID == action.TargetID); cultist.IndepthInvestigated = true; Person cu = GetPerson(cultist.PersonID); cu.FlavourText = flavourPool.GetInvestigationValue(cu.assets.Profession, cu.assets.Sin) + " " + flavourPool.GetInvestigationValue(cu.assets.Profession, cu.assets.Virtue); } break; case SuccessRating.BadFailure: case SuccessRating.TerribleFailure: case SuccessRating.Failure: break; } break; case ActionType.Recruit: switch (action.IsSuccess) { case SuccessRating.GoodSuccess: case SuccessRating.GreatSuccess: case SuccessRating.NormalSuccess: int newIndex = 0; for (int i = 0; i < 8; i++) { newIndex = i; if (cultists[i] == null) { i = 10; } } cultists[newIndex] = new Cultist() { PersonID = (int)action.TargetID, Instruction = null }; ++numberOfCultists; break; case SuccessRating.BadFailure: case SuccessRating.TerribleFailure: case SuccessRating.Failure: break; } peoplePool.activePool[(int)action.TargetID].Active = false; cultistCandidates.Remove(cultistCandidates.Find(cult => cult.PersonID == action.TargetID)); break; case ActionType.None: break; default: break; } } }
public int GetSkillDifference(Cultist cultist) { Person attacker = GetPerson(cultist.PersonID); Person defender; int result = 0; if (cultist.Instruction != null && cultist.Instruction.Action != null) { switch (cultist.Instruction.Action) { case ActionType.Abduct: if (cultist.Instruction.TargetID.HasValue) { defender = GetPerson(cultist.Instruction.TargetID.Value); result = attacker.Abduction - defender.AbductionDefense + traitPool.GetTraitValue(attacker.assets, defender.assets); } break; case ActionType.Investigate: if (cultist.Instruction.TargetID.HasValue) { defender = GetPerson(cultist.Instruction.TargetID.Value); result = attacker.Investigation - defender.InvestigationDefense + traitPool.GetTraitValue(attacker.assets, defender.assets); } else { result = attacker.Investigation; } break; case ActionType.Recruit: if (cultist.Instruction.TargetID.HasValue) { defender = GetPerson(cultist.Instruction.TargetID.Value); result = attacker.Recruitment - defender.RecruitmentDefense + traitPool.GetTraitValue(attacker.assets, defender.assets); } break; case ActionType.None: break; default: break; } } return result; }
public string GetSkillText(Cultist cultist, System.Random randomNumber) { Person attacker = GetPerson(cultist.PersonID); Person defender; int attackertResult = 0; int defenderResult = 0; switch (cultist.Instruction.Action) { case ActionType.Abduct: if (cultist.Instruction.TargetID.HasValue) { defender = GetPerson(cultist.Instruction.TargetID.Value); attackertResult = attacker.Abduction + traitPool.GetTraitValue(attacker.assets, defender.assets); defenderResult = defender.AbductionDefense; } break; case ActionType.Investigate: if (cultist.Instruction.TargetID.HasValue) { defender = GetPerson(cultist.Instruction.TargetID.Value); attackertResult = attacker.Investigation + traitPool.GetTraitValue(attacker.assets, defender.assets); defenderResult = defender.InvestigationDefense; } else { attackertResult = attacker.Investigation; defenderResult = 0; } break; case ActionType.Recruit: if (cultist.Instruction.TargetID.HasValue) { defender = GetPerson(cultist.Instruction.TargetID.Value); attackertResult = attacker.Recruitment + traitPool.GetTraitValue(attacker.assets, defender.assets); defenderResult = defender.RecruitmentDefense; } break; case ActionType.None: break; default: break; } string attackerString = ""; if (attackertResult > 80) { attackerString = flavourPool.AmazingList[randomNumber.Next(0, flavourPool.AmazingList.Count)]; } else if (attackertResult > 60) { attackerString = flavourPool.GoodList[randomNumber.Next(0, flavourPool.GoodList.Count)]; } else if (attackertResult > 40) { attackerString = flavourPool.NormalList[randomNumber.Next(0, flavourPool.NormalList.Count)]; } else if (attackertResult > 20) { attackerString = flavourPool.BadList[randomNumber.Next(0, flavourPool.BadList.Count)]; } else { attackerString = flavourPool.TerribleList[randomNumber.Next(0, flavourPool.TerribleList.Count)]; } return attackerString; }
public void AddCultist(int personID, int cultistIndex) { cultists[cultistIndex] = new Cultist() { PersonID = personID, Instruction = null }; }