public HistoricalFigure GenerateChild(FactionHandler.FactionArray factionArray, int familyPref) { HistoricalFigure littleBaby = new HistoricalFigure(); littleBaby.gender = Mathf.RoundToInt(Random.Range(1, 3)); if (littleBaby.gender == 1) { littleBaby.name = cultures[factionArray.culture].possibleFemaleNames[Mathf.RoundToInt(Random.Range(0, cultures[factionArray.culture].possibleFemaleNames.Count - 1))]; } else if (littleBaby.gender == 2) { littleBaby.name = cultures[factionArray.culture].possibleMaleNames[Mathf.RoundToInt(Random.Range(0, cultures[factionArray.culture].possibleMaleNames.Count - 1))]; } else if (littleBaby.gender == 3) { littleBaby.name = cultures[factionArray.culture].allNames[Mathf.RoundToInt(Random.Range(0, cultures[factionArray.culture].allNames.Count - 1))]; } littleBaby.age = 1; littleBaby.mind = new PhysicalProperties.Mind(); littleBaby.mind.personality = (PhysicalProperties.PersonalityType)Mathf.RoundToInt(Random.Range(0, System.Enum.GetNames(typeof(PhysicalProperties.PersonalityType)).Length - 1)); littleBaby.factionID = factionArray.factionID; littleBaby.familyID = familyPref; littleBaby.name = littleBaby.name + " " + cultures[factionArray.culture].surnames[littleBaby.familyID]; return(littleBaby); }
public void PrepareFactions(WorldData worldData) { foreach (WorldData.DummyFaction f in worldData.livingSchools) { if ((int)f.schoolType == 1) { FactionHandler.FactionArray tempSchool = new FactionHandler.FactionArray(); tempSchool.schoolType = (FactionHandler.SchoolType) 1; tempSchool.factionType = (FactionHandler.FactionType) 1; tempSchool.factionID = f.factionID; tempSchool.overallStrength = f.overallStrength; tempSchool.knownSpells = f.knownSpells; tempSchool.spellSystemEffect = (SpellEffect)f.spellSystemEffect; tempSchool.primaryElementAssociation = (PixelType)f.primaryElementAssociation; tempSchool.secondaryElementAssociation = (PixelType)f.secondaryElementAssociation; livingSchools.Add(tempSchool); } } }
public void SendNode() { faction = FactionHandler.instance.factionArray[0]; school = FactionHandler.instance.factionArray[0]; float magicThreshold = Random.Range(1, 100); if (magicThreshold > 75f) { int pCount = Mathf.RoundToInt(Random.Range(1, 5)); magicResource = (PixelType)pCount; } else { magicResource = (PixelType)0; } naturalWealth = Random.Range(1, 100); Node node = new Node(); corX = Mathf.RoundToInt((this.gameObject.transform.position.x) / 14.5f); if (corX % 2 == 1) { z = corX; corY = Mathf.RoundToInt((this.gameObject.transform.position.y + 8.5f) / 17f + ((z / 2) - 0.5f)); } else { z = corX; corY = Mathf.RoundToInt((this.gameObject.transform.position.y) / 17f + (z / 2)); } this.gameObject.name = "Tile" + corX + "/" + corY; node.x = Mathf.RoundToInt(corX); node.y = Mathf.RoundToInt(corY); node.worldObject = this.gameObject; thisNode = node; MapGeneration.instance.grid[node.x, node.y] = node; }
public HistoricalFigure GenerateHistoricalFigure(FactionHandler.FactionArray factionArray, int agePref, int genderPref, int personPref, int familyPref) { HistoricalFigure newFigure = new HistoricalFigure(); newFigure.factionID = factionArray.factionID; if (genderPref == 0) { newFigure.gender = Mathf.RoundToInt(Random.Range(1, 3)); } else { newFigure.gender = genderPref; } if (newFigure.gender == 1) { newFigure.name = cultures[factionArray.culture].possibleFemaleNames[Mathf.RoundToInt(Random.Range(0, cultures[factionArray.culture].possibleFemaleNames.Count - 1))]; } else if (newFigure.gender == 2) { newFigure.name = cultures[factionArray.culture].possibleMaleNames[Mathf.RoundToInt(Random.Range(0, cultures[factionArray.culture].possibleMaleNames.Count - 1))]; } else if (newFigure.gender == 3) { newFigure.name = cultures[factionArray.culture].allNames[Mathf.RoundToInt(Random.Range(0, cultures[factionArray.culture].allNames.Count - 1))]; } if (agePref == 0) { newFigure.age = Mathf.RoundToInt(Random.Range(16, 30)); } else { newFigure.age = agePref; } if (personPref == 0) { newFigure.mind = new PhysicalProperties.Mind(); newFigure.mind.personality = (PhysicalProperties.PersonalityType)Mathf.RoundToInt(Random.Range(0, System.Enum.GetNames(typeof(PhysicalProperties.PersonalityType)).Length - 1)); } else { newFigure.mind = new PhysicalProperties.Mind(); newFigure.mind.personality = (PhysicalProperties.PersonalityType)personPref - 1; } newFigure.importance = 0; if (familyPref == -1) { newFigure.familyID = Mathf.RoundToInt(Random.Range(1, cultures[factionArray.culture].surnames.Count - 1)); } else { newFigure.familyID = familyPref; } newFigure.name = newFigure.name + " " + cultures[factionArray.culture].surnames[newFigure.familyID]; historicalFigures.Add(newFigure); factionArray.relatedFigures.Add(newFigure); factionArray.livingFigures.Add(newFigure); return(newFigure); }
void GenerateDeadSpells(FactionHandler.FactionArray spellFaction) { bool spellTendency = true; if ((int)spellFaction.schoolType == 0) { spellTendency = true; } else if ((int)spellFaction.schoolType == 1) { spellTendency = false; } SpellEffect systemEffect = (SpellEffect)Mathf.RoundToInt(Random.Range(0, System.Enum.GetNames(typeof(SpellEffect)).Length - 1)); spellFaction.spellSystemEffect = systemEffect; SpellComponent systemComponent = (SpellComponent)Mathf.RoundToInt(Random.Range(0, System.Enum.GetNames(typeof(SpellComponent)).Length - 1)); SpellQuirk systemQuirk = (SpellQuirk)Mathf.RoundToInt(Random.Range(0, System.Enum.GetNames(typeof(SpellQuirk)).Length - 1)); for (int i = 1; i <= 12; i++) { Spell freshSpell = new Spell(); if (spellTendency == false) { float elementType = Random.Range(1, 10); if (elementType < 5) { freshSpell.element = spellFaction.primaryElementAssociation; } else { freshSpell.element = spellFaction.secondaryElementAssociation; } freshSpell.spellEffect = systemEffect; freshSpell.specificEffect = Mathf.RoundToInt(Random.Range(1, 12)); freshSpell.spellComponent = systemComponent; freshSpell.spellQuirk = systemQuirk; freshSpell.tier = Mathf.RoundToInt(Random.Range(1, 5)); freshSpell.statRequirement = (4 + freshSpell.tier) * Random.Range(1, freshSpell.tier); freshSpell.cost = Mathf.RoundToInt(i * Random.Range(i, i * 2)); freshSpell.modifier = freshSpell.tier + Mathf.RoundToInt(Random.Range(3, 8)); } if (spellTendency == true) { float elementType = Random.Range(1, 10); if (elementType < 5) { freshSpell.element = spellFaction.primaryElementAssociation; } else { freshSpell.element = spellFaction.secondaryElementAssociation; } freshSpell.spellEffect = systemEffect; freshSpell.specificEffect = Mathf.RoundToInt(Random.Range(1, 12)); freshSpell.spellComponent = systemComponent; freshSpell.spellQuirk = systemQuirk; freshSpell.tier = Mathf.RoundToInt(Random.Range(1, 5)); freshSpell.statRequirement = (4 + freshSpell.tier) * Random.Range(1, freshSpell.tier); freshSpell.cost = Mathf.RoundToInt(i * Random.Range(i, i * 2)); freshSpell.modifier = freshSpell.tier + Mathf.RoundToInt(Random.Range(3, 8)); } string prefix = ""; string halfName = ""; string secondHalfName = ""; string suffix = ""; if (freshSpell.modifier < 3) { prefix = "Lesser "; } else if (freshSpell.modifier > 7) { prefix = "Greater "; } if ((int)freshSpell.element == 1) { halfName = "Ethereal "; } else if ((int)freshSpell.element == 2) { halfName = "Infernal "; } else if ((int)freshSpell.element == 3) { halfName = "Necrotic "; } else if ((int)freshSpell.element == 4) { halfName = "Sanguine "; } else if ((int)freshSpell.element == 5) { halfName = "Fabled "; } else if ((int)freshSpell.element == 6) { halfName = "Frigid "; } if ((int)freshSpell.spellEffect == 0) { if ((int)freshSpell.specificEffect == 1) { secondHalfName = "Rejuvenation "; } else if ((int)freshSpell.specificEffect == 2) { secondHalfName = "Healing "; } else if ((int)freshSpell.specificEffect == 3) { secondHalfName = "Cleansing "; } else if ((int)freshSpell.specificEffect == 4) { secondHalfName = "Mending "; } else if ((int)freshSpell.specificEffect == 5) { secondHalfName = "Withering "; } else if ((int)freshSpell.specificEffect == 6) { secondHalfName = "Piercing "; } else if ((int)freshSpell.specificEffect == 7) { secondHalfName = "Blight "; } else if ((int)freshSpell.specificEffect == 8) { secondHalfName = "Rending "; } else if ((int)freshSpell.specificEffect == 9) { secondHalfName = "Self-Rejuvenation "; } else if ((int)freshSpell.specificEffect == 10) { secondHalfName = "Self-Healing "; } else if ((int)freshSpell.specificEffect == 11) { secondHalfName = "Self-Cleansing "; } else if ((int)freshSpell.specificEffect == 12) { secondHalfName = "Self-Mending "; } } else if ((int)freshSpell.spellEffect == 1) { if ((int)freshSpell.specificEffect == 1) { secondHalfName = "Featherstep "; } else if ((int)freshSpell.specificEffect == 2) { secondHalfName = "Levitation "; } else if ((int)freshSpell.specificEffect == 3) { secondHalfName = "Burdening "; } else if ((int)freshSpell.specificEffect == 4) { secondHalfName = "Rooting "; } else if ((int)freshSpell.specificEffect == 5) { secondHalfName = "Force "; } else if ((int)freshSpell.specificEffect == 6) { secondHalfName = "Drawing "; } else if ((int)freshSpell.specificEffect == 7) { secondHalfName = "Swift Approach "; } else if ((int)freshSpell.specificEffect == 8) { secondHalfName = "Uncanny Flight "; } else if ((int)freshSpell.specificEffect == 9) { secondHalfName = "Self-Featherstep "; } else if ((int)freshSpell.specificEffect == 10) { secondHalfName = "Self-Levitation "; } else if ((int)freshSpell.specificEffect == 11) { secondHalfName = "Self-Burdening "; } else if ((int)freshSpell.specificEffect == 12) { secondHalfName = "Self-Rooting "; } } else { halfName = "Something Cool"; } float wackySuffix = Random.Range(1, 100); if (wackySuffix > 50) { if (wackySuffix < 55) { suffix = " of the Deep"; } else if (wackySuffix < 60) { suffix = " of the Old World"; } else if (wackySuffix < 65) { suffix = " of the Otherworld"; } else if (wackySuffix < 70) { suffix = " of Yore"; } else if (wackySuffix < 75) { suffix = " of the Arcanum"; } else if (wackySuffix < 80) { suffix = " of the Witchqueen"; } else if (wackySuffix < 85) { suffix = " of the Dead King"; } else if (wackySuffix < 90) { suffix = " of the Huntsman"; } else if (wackySuffix < 95) { suffix = " of the Outrider"; } else if (wackySuffix < 99) { suffix = " of the Fae"; } else if (wackySuffix == 100) { suffix = " TM"; } } freshSpell.name = prefix + halfName + secondHalfName + suffix; freshSpell.lost = true; spellList.Add(freshSpell); float isTrulyLost = Random.Range(1, 10); if (isTrulyLost > 8) { spellFaction.knownSpells.Add(freshSpell); } freshSpell.schoolOfOrigin = spellFaction.factionID; } if (spellNumber < deadSchools.Count - 1) { Invoke("StepUpDeadGen", 0.01f); } else { hasGenerated = true; spellNumber = spellList.Count; Manager.instance.useWorldButton.interactable = true; Manager.instance.reloadButton.interactable = true; } }
public void UsePlayer() { float tempStrength = -10000; FactionHandler.FactionArray startingFaction = null; foreach (FactionHandler.FactionArray f in livingSchools) { if ((int)f.spellSystemEffect == CreationHandler.instance.chosenElement && f.overallStrength > tempStrength && (int)f.schoolType == 1) { tempStrength = f.overallStrength; startingFaction = f; } } if (startingFaction != null) { player.GetComponent <CharacterData>().factionID = startingFaction.factionID; } else { tempStrength = -10000; foreach (FactionHandler.FactionArray f in livingSchools) { if (f.overallStrength > tempStrength && (int)f.factionType == 1) { tempStrength = f.overallStrength; startingFaction = f; } } } if (startingFaction != null) { player.GetComponent <CharacterData>().factionID = startingFaction.factionID; } else { player.GetComponent <CharacterData>().factionID = 8; } player.GetComponent <CharacterData>().factionID = startingFaction.factionID; for (int i = 1; i <= 5; i++) { player.GetComponent <CharacterData>().knownSpells.Add(startingFaction.knownSpells[i]); } player.GetComponent <CharacterData>().charName = CreationHandler.instance.charName; player.GetComponent <CharacterData>().alignMod = new Vector3(0.005f, 0.1f, 0f); player.GetComponent <CharacterData>().strength = CreationHandler.instance.allocatedStrength; player.GetComponent <CharacterData>().dexterity = CreationHandler.instance.allocatedDexterity; player.GetComponent <CharacterData>().fortitude = CreationHandler.instance.allocatedFortitude; player.GetComponent <CharacterData>().charm = CreationHandler.instance.allocatedCharm; player.GetComponent <CharacterData>().intelligence = CreationHandler.instance.allocatedIntelligence; player.GetComponent <CharacterData>().empathy = CreationHandler.instance.allocatedEmpathy; player.GetComponent <CharacterData>().martial = CreationHandler.instance.allocatedMartial; player.GetComponent <CharacterData>().athletics = CreationHandler.instance.allocatedAthletics; player.GetComponent <CharacterData>().evasion = CreationHandler.instance.allocatedEvasion; player.GetComponent <CharacterData>().stealth = CreationHandler.instance.allocatedStealth; player.GetComponent <CharacterData>().endurance = CreationHandler.instance.allocatedEndurance; player.GetComponent <CharacterData>().regeneration = CreationHandler.instance.allocatedRegeneration; player.GetComponent <CharacterData>().persuasion = CreationHandler.instance.allocatedPersuasion; player.GetComponent <CharacterData>().ego = CreationHandler.instance.allocatedEgo; player.GetComponent <CharacterData>().creativity = CreationHandler.instance.allocatedCreativity; player.GetComponent <CharacterData>().logic = CreationHandler.instance.allocatedLogic; player.GetComponent <CharacterData>().attunement = CreationHandler.instance.allocatedAttunement; player.GetComponent <CharacterData>().zeal = CreationHandler.instance.allocatedZeal; player.GetComponent <CharacterData>().maxHealth = player.GetComponent <CharacterData>().endurance * 2; player.GetComponent <CharacterData>().health = player.GetComponent <CharacterData>().endurance * 2; player.GetComponent <CharacterData>().acquiredQuirks = CreationHandler.instance.acquiredQuirks; foreach (QuirkSlot.Quirk q in CreationHandler.instance.acquiredQuirks) { if (q.quirkID == 2) { player.GetComponent <CharacterData>().missRightArm = true; } } SaveSystem.SavePlayer(seed, player); PlayerPrefs.SetInt("GameState", 2); SceneManager.LoadScene("SampleScene"); }