public AdventurerModel GenerateRandom(ref GameObject roomObject, int level, Enums.UnitRarity rarity) { //GameObject newAdventurer = new GameObject (); AdventurerModel adventurerScript = roomObject.AddComponent <AdventurerModel> (); NameData name = dataBase.GetRandomName(); adventurerScript._unitName = name.title; adventurerScript._unitDescription = name.subtitle; adventurerScript._unitNameDelim = (name.delimiter == "/" ? ", " : " "); int statMod = 0, healthMod = 0; float statMult = 1.0f, healthMult = 1.0f; statMod += (5 + level); healthMod += level * 5; switch (rarity) { case Enums.UnitRarity.e_rarity_COMMON: statMult = 1f; healthMult = 1f; break; case Enums.UnitRarity.e_rarity_RARE: statMult = 1.1f; healthMult = 1.1f; break; case Enums.UnitRarity.e_rarity_EPIC: statMult = 1.3f; healthMult = 1.3f; break; case Enums.UnitRarity.e_rarity_LEGEND: statMult = 1.5f; healthMult = 1.5f; break; } adventurerScript.totalHealth = (int)(Random.Range(healthMod, healthMod + healthMod) * healthMult); adventurerScript.dexterity = (int)(Random.Range(statMod, statMod + statMod) * statMult); adventurerScript.strength = (int)(Random.Range(statMod, statMod + statMod) * statMult); adventurerScript.wisdom = (int)(Random.Range(statMod, statMod + statMod) * statMult); adventurerScript.attack_damage = (int)(Random.Range(statMod, statMod + statMod) * statMult); adventurerScript.rarity = rarity; adventurerScript.level = level; adventurerScript.currentHealth = adventurerScript.totalHealth; roomObject.name = adventurerScript._unitName + adventurerScript._unitNameDelim + adventurerScript._unitDescription; return(adventurerScript); }
public AdventurerModel Generate(string name = "Default", string description = "Default Description", Enums.UnitRarity rarity = Enums.UnitRarity.e_rarity_COMMON, int totalHealth = 10, int dex = 1, int str = 1, int wis = 1, int atk = 0, int level = 1) { GameObject newAdventurer = new GameObject(); AdventurerModel adventurerScript = newAdventurer.AddComponent <AdventurerModel> (); adventurerScript._unitName = name; adventurerScript._unitDescription = description; adventurerScript.rarity = rarity; adventurerScript.totalHealth = totalHealth; adventurerScript.dexterity = dex; adventurerScript.strength = str; adventurerScript.wisdom = wis; adventurerScript.attack_damage = atk; adventurerScript.level = level; return(adventurerScript); }
public AdventurerData GetRandomAdventurerByRarity(Enums.UnitRarity rarity) { List <AdventurerData> adventurers = new List <AdventurerData>(); foreach (KeyValuePair <string, AdventurerData> entry in adventurerList) { if (EnumUtility.StringToRarity(entry.Value.rarity) == rarity) { adventurers.Add(entry.Value); } } if (adventurers.Count > 0) { return(adventurers[Random.Range(0, adventurers.Count)]); } else { return(null); } }
public RoomData GetRandomBossRoomByRarity(Enums.UnitRarity rarity) { List <RoomData> rooms = new List <RoomData> (); foreach (KeyValuePair <string, RoomData> entry in roomList) { if (EnumUtility.StringToRarity(entry.Value.rarity) == rarity && entry.Value.is_boss) { rooms.Add(entry.Value); } } if (rooms.Count > 0) { return(rooms [Random.Range(0, rooms.Count)]); } else { return(null); } }
public RoomModel Generate (string name = "Default", string description = "Default Description", string success = "You succeeded", string failure = "You failed", Enums.UnitRarity rarity = Enums.UnitRarity.e_rarity_COMMON, int dex = 1, int str = 1, int wis = 1, int atk = 0, int timer = 10, int passReq = 1) { GameObject newRoom = new GameObject (); RoomModel roomScript = newRoom.AddComponent<RoomModel> (); roomScript.room_name = name; roomScript.description = description; roomScript.rarity = rarity; roomScript.success = success; roomScript.failure = failure; roomScript.dexterity_challenge = dex; roomScript.strength_challenge = str; roomScript.wisdom_challenge = wis; roomScript.room_attack = atk; roomScript._isBossRoom = false; roomScript.timer_frequency = timer; roomScript.pass_req = passReq; return roomScript; }