public CharacterAbilities(PcData pc) { this.pc = pc; PowerSlots = pc.Abilities.PowerSlots; SpellSlots = pc.Abilities.SpellSlots; traits = new List <Ability>(); availablePowers = new List <Ability>(); knownPowers = new List <Ability>(); memorizedPowers = new List <Ability>(); availableSpells = new List <Ability>(); knownSpells = new List <Ability>(); memorizedSpells = new List <Ability>(); for (int i = 0; i < pc.Abilities.Traits.Count; i++) { traits.Add(pc.Abilities.traits[i]); } for (int i = 0; i < pc.Abilities.AvailablePowers.Count; i++) { availablePowers.Add(pc.Abilities.AvailablePowers[i]); } for (int i = 0; i < pc.Abilities.KnownPowers.Count; i++) { knownPowers.Add(pc.Abilities.KnownPowers[i]); } for (int i = 0; i < pc.Abilities.MemorizedPowers.Count; i++) { memorizedPowers.Add(pc.Abilities.MemorizedPowers[i]); } for (int i = 0; i < pc.Abilities.AvailableSpells.Count; i++) { availableSpells.Add(pc.Abilities.availableSpells[i]); } for (int i = 0; i < pc.Abilities.KnownSpells.Count; i++) { knownSpells.Add(pc.Abilities.KnownSpells[i]); } for (int i = 0; i < pc.Abilities.MemorizedSpells.Count; i++) { memorizedSpells.Add(pc.Abilities.memorizedSpells[i]); } }
public PcData(PcData pc) { name = pc.Name; gender = pc.gender; wealth = pc.Wealth; upkeep = new UpkeepData(pc.Upkeep); background = new Background(pc.background); raceKey = pc.raceKey; professionKey = pc.professionKey; listIndex = pc.listIndex; partyIndex = pc.PartyIndex; hair = pc.hair; beard = pc.beard; description = pc.description; level = pc.Level; experience = pc.Experience; expToLevel = pc.ExpToLevel; maxExp = pc.MaxExp; expBonus = pc.ExpBonus; attributes = new AttributeManager(); for (int i = 0; i < (int)BaseAttribute.Number; i++) { attributes.AddAttribute(AttributeListType.Base, new Attribute(pc.attributes.GetAttribute(AttributeListType.Base, i))); } for (int i = 0; i < (int)DerivedAttribute.Number; i++) { attributes.AddAttribute(AttributeListType.Derived, new Attribute(pc.attributes.GetAttribute(AttributeListType.Derived, i))); } for (int i = 0; i < (int)DamageType.Number; i++) { attributes.AddAttribute(AttributeListType.Resistance, new Attribute(pc.attributes.GetAttribute(AttributeListType.Resistance, i))); } for (int i = 0; i < (int)Skill.Number; i++) { attributes.SetSkill(new Attribute(pc.attributes.GetSkill(i))); } abilities = new CharacterAbilities(pc); inventory = new CharacterInventory(pc.inventory); faction = Faction.Player; }
public CharacterAbilities(PcData pc, int power_slots, int spell_slots) { this.pc = pc; PowerSlots = power_slots; SpellSlots = spell_slots; traits = new List <Ability>(); availablePowers = new List <Ability>(); knownPowers = new List <Ability>(); memorizedPowers = new List <Ability>(); availableSpells = new List <Ability>(); knownSpells = new List <Ability>(); memorizedSpells = new List <Ability>(); }
public CharacterAbilities() { pc = null; PowerSlots = 0; SpellSlots = 0; MaxTraitSlots = 0; traits = new List <Ability>(); availablePowers = new List <Ability>(); knownPowers = new List <Ability>(); memorizedPowers = new List <Ability>(); availableSpells = new List <Ability>(); knownSpells = new List <Ability>(); memorizedSpells = new List <Ability>(); }
public static PcData Generate(int listIndex, Gender gender, string r, string p) { //if (availableRaces == null || availableProfessions == null) return null; string race_key = ""; if (r == "") { race_key = availableRaces[Random.Range(0, availableRaces.Count)]; } else { race_key = r; } string professionKey = ""; if (p == "") { professionKey = availableProfessions[Random.Range(0, availableProfessions.Count)]; } else { professionKey = p; } Race race = Database.GetRace(race_key); Profession profession = Database.GetProfession(professionKey); string hair = ""; string beard = ""; if (gender == Gender.None) { if (Random.Range(0, 100) < 50) { gender = Gender.Male; if (race.maleDefaultHair != "") { hair = "Hair " + Random.Range(1, 9); } if (race.maleDefaultBeard != "" && Random.Range(0, 100) < 50) { beard = "Beard " + Random.Range(1, 8); } } else { gender = Gender.Female; if (race.femaleDefaultHair != "") { hair = "Hair " + Random.Range(1, 17); } beard = race.femaleDefaultBeard; } } else if (gender == Gender.Male) { gender = Gender.Male; if (race.maleDefaultHair != "") { hair = "Hair " + Random.Range(1, 9); } if (race.maleDefaultBeard != "" && Random.Range(0, 100) < 50) { beard = "Beard " + Random.Range(1, 8); } } else if (gender == Gender.Female) { gender = Gender.Female; if (race.femaleDefaultHair != "") { hair = "Hair " + Random.Range(1, 17); } beard = race.femaleDefaultBeard; } PcData pc = new PcData(NameGenerator.Get(gender, race_key, professionKey), gender, 1, race_key, professionKey, hair, beard, listIndex, -1, 3 + GameValue.Roll(new GameValue(1, 3), false), 3 + GameValue.Roll(new GameValue(1, 3), false)); pc.Background = BackgroundGenerator.Generate(); pc.Personality = GeneratePersonality(); pc.Description = GenerateDescription(pc); pc.LevelUp(); pc.CalculateExp(); pc.AddExperience(Random.Range(0, 999), false); if (profession.StartingItems.Count > 0) { for (int i = 0; i < profession.StartingItems.Count; i++) { ItemData item = ItemGenerator.CreateItem(profession.StartingItems[i].ItemKey, profession.StartingItems[i].MaterialKey, profession.StartingItems[i].PlusKey, profession.StartingItems[i].PreKey, profession.StartingItems[i].PostKey, profession.StartingItems[i].StackSize); if (race.ArmorSlotAllowed((EquipmentSlot)item.Slot) == true) { pc.Inventory.EquipItem(item, ((EquipmentSlot)item.Slot)); } } } else { for (int i = 0; i < pc.Inventory.EquippedItems.Length; i++) { if (Database.GetRace(race_key).ArmorSlotAllowed(((EquipmentSlot)i)) == true) { int chanceForItem = 25; if (i == (int)EquipmentSlot.Right_Hand) { chanceForItem = 100; } else if (i == (int)EquipmentSlot.Body) { chanceForItem = 100; } else if (i == (int)EquipmentSlot.Feet) { chanceForItem = 100; } if (Random.Range(1, 101) <= chanceForItem) { ItemData item = ItemGenerator.CreateRandomItem(i, 25, 25); if (item != null) { pc.Inventory.EquippedItems[i] = new ItemData(item); } } } } } int numAccessories = Random.Range(1, 3); pc.Inventory.AccessoryLimit = numAccessories + Random.Range(0, 3); for (int i = 0; i < numAccessories; i++) { pc.Inventory.EquipAccessory(ItemGenerator.CreateRandomItem(ItemTypeAllowed.Accessory, 0, 0), -1); } for (int spell = 0; spell < pc.Abilities.KnownSpells.Count; spell++) { if (Random.Range(0, 100) < 100) { pc.Abilities.KnownSpells[spell].BoostRune = Helper.RandomValues <string, AbilityModifier>(Database.Runes).Key; } } string key = positiveQuirks[Random.Range(0, positiveQuirks.Count)]; pc.Abilities.AddTrait(new Ability(Database.GetAbility(key))); key = neutralQuirks[Random.Range(0, neutralQuirks.Count)]; pc.Abilities.AddTrait(new Ability(Database.GetAbility(key))); key = negativeQuirks[Random.Range(0, negativeQuirks.Count)]; pc.Abilities.AddTrait(new Ability(Database.GetAbility(key))); if (GameValue.Roll(1, 100) < 20) { key = woundQuirks[Random.Range(0, woundQuirks.Count)]; pc.Abilities.AddTrait(new Ability(Database.GetAbility(key))); } pc.CalculateAttributeModifiers(); pc.CalculateStartAttributes(true); pc.CalculateDerivedAttributes(); pc.CalculateStartSkills(); pc.CalculateResistances(); pc.CalculateExpCosts(); pc.Abilities.PowerSlots = (pc.Attributes.GetAttribute(AttributeListType.Derived, (int)BaseAttribute.Memory).Current / 5) + 1; pc.Abilities.SpellSlots = (pc.Attributes.GetAttribute(AttributeListType.Derived, (int)BaseAttribute.Memory).Current / 5) + 1; pc.Abilities.FindTraits(); pc.Abilities.FindAvailableAbilities(); //pc.AddExperience(Random.Range(0, 500) * 10, false); pc.CalculateUpkeep(); return(pc); }
public static string GenerateDescription(PcData pc) { string description = ""; return(description); }