public Character CreateCharacter(Ship ship, int job_id, int mother_id = 0, int father_id = 0, string last_name = null) { Character NewChar = new Character(); int gender = r.Next(1, 100); if (gender < 50) { NewChar.gender = 0; } else { NewChar.gender = 1; } if (last_name == null) { last_name = ShowCharacterNames.GetName(0, NewChar.gender); } NewChar.idkey = ship.Characters.Count; string first_name = ShowCharacterNames.GetName(1, NewChar.gender); NewChar.name = first_name + " " + last_name; NewChar.age = r.Next(864, 1728); NewChar.spouse_id = 0; NewChar.mother_id = mother_id; NewChar.father_id = father_id; NewChar.job_id = job_id; NewChar.job_skill = r.Next(1, 7); NewChar.dorm_id = 0; NewChar.sleep_shift = 0; NewChar.stress = (float)5; NewChar.happiness = (float)5; NewChar.anxiety = (float)5; int val = r.Next(3, 7); NewChar.strength = (float)val; val = r.Next(3, 7); NewChar.reflexes = (float)val; val = r.Next(3, 8); NewChar.constitution = (float)val; NewChar.stamina = (float)5; NewChar.sanity = (float)5; NewChar.mood = (float)5; NewChar.Personality = new List <CharacterPersonality>(); foreach (var p in ShowPersonalityTypes.GetPersonalitys()) { var newper = new CharacterPersonality(); val = r.Next(0, 10); if (val > 8) { val = r.Next(0, 10); } if (val < 2) { val = r.Next(0, 10); } newper.idkey = (p.idkey - 1); newper.value = (float)val; newper.value_mods = (float)0; if (val > 8 || val < 2) { newper.discovered = true; } else { newper.discovered = false; } NewChar.Personality.Add(newper); } NewChar.Needs = new List <CharacterNeeds>(); for (int i = 0; i < 9; i++) { var newneed = new CharacterNeeds(); newneed.idkey = i; newneed.value = (float)r.Next(5, 10); newneed.value_mods = (float)0; NewChar.Needs.Add(newneed); } NewChar.Wants = new List <CharacterWants>(); NewChar.Modifiers = new List <CharacterModifiers>(); NewChar.Memories = new List <CharacterMemories>(); NewChar.Relationships = new List <CharacterRelationship>(); NewChar.current_building = 22; NewChar.pos_x = 0; NewChar.pos_y = 0; NewChar.current_task = "dorm"; NewChar.dest_x = 0; NewChar.dest_y = 0; NewChar.hired = false; NewChar.dead = false; ship.Characters.Add(NewChar); GameService gs = new GameService(); gs.SaveGame(ship); return(NewChar); }
private void SpawnCharacterEncounter(GameObject obj, Vector3 spawnPos, CharacterPersonality type) {// maybe create enemy class here then add it as a component to the gameobject? _currentEncounterThing = Instantiate(obj, spawnPos, Quaternion.identity); obj.GetComponent <BaseEnemy>().InitialiseThingPersonality(type); }
public Character(string CharacterPath, ContentManager Content, Dictionary <string, BaseSkillRequirement> DicRequirement, Dictionary <string, BaseEffect> DicEffect, Dictionary <string, AutomaticSkillTargetType> DicAutomaticSkillTarget, Dictionary <string, ManualSkillTarget> DicManualSkillTarget) : this() { FileStream FS = new FileStream("Content/Characters/" + CharacterPath + ".pec", FileMode.Open, FileAccess.Read); BinaryReader BR = new BinaryReader(FS, Encoding.UTF8); BR.BaseStream.Seek(0, SeekOrigin.Begin); //Init variables. Name = BR.ReadString(); PortraitPath = BR.ReadString(); ArrayPortraitBustPath = new string[BR.ReadInt32()]; for (int B = 0; B < ArrayPortraitBustPath.Length; ++B) { ArrayPortraitBustPath[B] = BR.ReadString(); } ArrayPortraitBoxPath = new string[BR.ReadInt32()]; for (int B = 0; B < ArrayPortraitBoxPath.Length; ++B) { ArrayPortraitBoxPath[B] = BR.ReadString(); } Tags = BR.ReadString(); FullName = CharacterPath; EXPValue = BR.ReadInt32(); CanPilot = BR.ReadBoolean(); BattleThemeName = BR.ReadString(); string AceBonus = BR.ReadString(); string PersonalityName = BR.ReadString(); string SlaveName = BR.ReadString(); Personality = new CharacterPersonality(PersonalityName); if (!string.IsNullOrWhiteSpace(SlaveName) && SlaveName != "None") { Slave = new Character(SlaveName, Content, DicRequirement, DicEffect, DicAutomaticSkillTarget, DicManualSkillTarget); } Int32 SpiritListCount = BR.ReadInt32(); ArrayPilotSpirit = new ManualSkill[SpiritListCount]; for (int S = 0; S < SpiritListCount; ++S) { ArrayPilotSpirit[S] = new ManualSkill("Content/Characters/Spirits/" + BR.ReadString() + ".pecs", DicRequirement, DicEffect, DicAutomaticSkillTarget, DicManualSkillTarget); ArrayPilotSpirit[S].SPCost = BR.ReadInt32(); ArrayPilotSpirit[S].LevelRequirement = BR.ReadInt32(); } Int32 SkillListCount = BR.ReadInt32(); ArrayPilotSkill = new BaseAutomaticSkill[SkillListCount]; ArrayPilotSkillLocked = new bool[SkillListCount]; ArrayPilotSkillLevels = new SkillLevels[SkillListCount]; for (int S = 0; S < SkillListCount; ++S) { string RelativePath = BR.ReadString(); ArrayPilotSkill[S] = new BaseAutomaticSkill("Content/Characters/Skills/" + RelativePath + ".pecs", RelativePath, DicRequirement, DicEffect, DicAutomaticSkillTarget); ArrayPilotSkillLocked[S] = BR.ReadBoolean(); Int32 SkillLevelsCount = BR.ReadInt32(); ArrayPilotSkillLevels[S] = new SkillLevels(BR, SkillLevelsCount); } Int32 RelationshipBonusCount = BR.ReadInt32(); ArrayRelationshipBonus = new BaseAutomaticSkill[RelationshipBonusCount]; for (int S = 0; S < RelationshipBonusCount; ++S) { string RelationshipBonusName = BR.ReadString(); int RelationshipLevel = BR.ReadInt32(); ArrayRelationshipBonus[S] = new BaseAutomaticSkill("Content/Characters/Relationships/" + RelationshipBonusName + ".pecr", RelationshipBonusName, DicRequirement, DicEffect, DicAutomaticSkillTarget); ArrayRelationshipBonus[S].CurrentLevel = RelationshipLevel; for (int L = 0; L < ArrayRelationshipBonus[S].ListSkillLevel.Count; ++L) { BaseSkillRequirement NewSkillRequirement = BaseSkillRequirement.LoadCopy(BR, DicRequirement); ArrayRelationshipBonus[S].ListSkillLevel[L].ListActivation[0].ListRequirement.Add(NewSkillRequirement); } } //If it's a pilot, read its stats. if (CanPilot) { MaxLevel = BR.ReadInt32(); ArrayLevelMEL = new int[MaxLevel]; ArrayLevelRNG = new int[MaxLevel]; ArrayLevelDEF = new int[MaxLevel]; ArrayLevelSKL = new int[MaxLevel]; ArrayLevelEVA = new int[MaxLevel]; ArrayLevelHIT = new int[MaxLevel]; ArrayLevelMaxSP = new int[MaxLevel]; for (int L = 0; L < MaxLevel; ++L) { ArrayLevelMEL[L] = BR.ReadInt32(); ArrayLevelRNG[L] = BR.ReadInt32(); ArrayLevelDEF[L] = BR.ReadInt32(); ArrayLevelSKL[L] = BR.ReadInt32(); ArrayLevelEVA[L] = BR.ReadInt32(); ArrayLevelHIT[L] = BR.ReadInt32(); ArrayLevelMaxSP[L] = BR.ReadInt32(); } int TerrainGradeAir = BR.ReadInt32(); int TerrainGradeLand = BR.ReadInt32(); int TerrainGradeSea = BR.ReadInt32(); int TerrainGradeSpace = BR.ReadInt32(); TerrainGrade = new TerrainGrades(TerrainGradeAir, TerrainGradeLand, TerrainGradeSea, TerrainGradeSpace); } int ListQuoteSetVersusNameCount = BR.ReadInt32(); for (int Q = 0; Q < ListQuoteSetVersusNameCount; Q++) { ListQuoteSetVersusName.Add(BR.ReadString()); } //Base quotes for (int I = 0; I < 6; I++) { ArrayBaseQuoteSet[I] = new QuoteSet(); int ListQuoteCount = BR.ReadInt32(); for (int Q = 0; Q < ListQuoteCount; Q++) { ArrayBaseQuoteSet[I].ListQuote.Add(BR.ReadString()); } //Versus quotes. int ListQuoteVersusCount = BR.ReadInt32(); for (int Q = 0; Q < ListQuoteVersusCount; Q++) { ArrayBaseQuoteSet[I].ListQuoteVersus.Add(BR.ReadString()); } ArrayBaseQuoteSet[I].PortraitPath = BR.ReadString(); } int DicAttackQuoteSetCount = BR.ReadInt32(); for (int i = 0; i < DicAttackQuoteSetCount; i++) { QuoteSet NewQuoteSet = new QuoteSet(); string QuoteSetName = BR.ReadString(); int ListQuoteCount = BR.ReadInt32(); for (int Q = 0; Q < ListQuoteCount; Q++) { NewQuoteSet.ListQuote.Add(BR.ReadString()); } int ListQuoteVersusCount = BR.ReadInt32(); for (int Q = 0; Q < ListQuoteVersusCount; Q++) { NewQuoteSet.ListQuoteVersus.Add(BR.ReadString()); } NewQuoteSet.PortraitPath = BR.ReadString(); DicAttackQuoteSet.Add(QuoteSetName, NewQuoteSet); } FS.Close(); BR.Close(); if (Content != null) { string SpritePath = Path.GetFileNameWithoutExtension(CharacterPath); if (!string.IsNullOrEmpty(PortraitPath)) { SpritePath = PortraitPath; } if (File.Exists("Content\\Visual Novels\\Portraits\\" + SpritePath + ".xnb")) { this.sprPortrait = Content.Load <Texture2D>("Visual Novels\\Portraits\\" + SpritePath); } else { this.sprPortrait = Content.Load <Texture2D>("Characters\\Portraits\\Default"); } } }
public void InitialiseThingPersonality(CharacterPersonality type) { //GenDialogueLines = type.GeneralDialogueLines; //CbtDialogueLines = type.CombatDialogueLines; }