static int RollInitiative(int DexMod) { int Initiative = DiceRoller.RollDice(12) + DexMod; Initiatives.Add(Initiative); return(Initiative); }
static void AttackEnemy(int TargetEnemy, string AttackType) { int Attack = DiceRoller.RollDice(12) + Player.GetAtkBonus(); if (Attack >= EncounterNPCs[TargetEnemy].AC) { Events.NewEvent("AttackRoll", Attack - Player.GetStrMod() - (Player.GetLevel() / 3), Player.GetStrMod(), Player.GetLevel() / 3, Attack, EncounterNPCs[TargetEnemy].AC, Player.GetName(), EncounterNPCs[TargetEnemy].Name, "HIT"); Attack = DamageEnemy(AttackType, EncounterNPCs[TargetEnemy]); bool Dead = EncounterNPCs[TargetEnemy].TakeDamage(Attack); if (Dead) { Events.NewEvent("NPCDeath", ES1: Player.GetName(), ES2: EncounterNPCs[TargetEnemy].Name); string Update = "You strike down " + EncounterNPCs[TargetEnemy].Name + "!"; IO.GameUpdate(Update); FightOrder.Remove(EncounterNPCs[TargetEnemy]); EncounterNPCs.Remove(EncounterNPCs[TargetEnemy]); } else { string Update = "You strike " + EncounterNPCs[TargetEnemy].Name + " for " + Attack + " Damage!"; IO.GameUpdate(Update); } IO.NPCs(EncounterNPCs); } else { Events.NewEvent("AttackRoll", Attack - Player.GetStrMod() - (Player.GetLevel() / 3), Player.GetStrMod(), Player.GetLevel() / 3, Attack, EncounterNPCs[TargetEnemy].AC, Player.GetName(), EncounterNPCs[TargetEnemy].Name, "MISS"); string Update = "Your attack missed!"; IO.GameUpdate(Update); } }
public int HealthRegen() { int Regen = 0; for (int x = 0; x < DiceNum; x++) { Regen += DiceRoller.RollDice(DiceSize); } Regen += Modifier; return(Regen); }
public static string GenerateAdventureType() { if (DataLoaded) { return(AdventureTypes[DiceRoller.RollDice(AdventureTypes.Count) - 1].GetAdventureType()); } else { return(null); } }
public static List <Cities> GenerateCities() { List <Cities> CityList = new List <Cities>(); int CityCount = DiceRoller.RandomRange(3, 5); Cities[] Temp = new Cities[CityCount]; for (int Count = 0; Count < CityCount; Count++) { Temp[Count] = new Cities(); } foreach (Cities City in Temp) { CityList.Add(City); } return(CityList); }
static List <EnemyNPC> SelectEnemies() { List <EnemyNPC> EnemyNPCs = new List <EnemyNPC>(); if (Player.GetLevel() == 1) { int Ran = DiceRoller.RollDice(2) - 1; EnemyNPC Foe = new EnemyNPC(); Foe = GameObjects.NPCs[Ran]; EnemyNPCs.Add(Foe); } else { int Ran = DiceRoller.RollDice(6); switch (Ran) { case 1: case 2: Ran = Player.GetLevel() - 1; break; case 3: case 4: case 5: Ran = Player.GetLevel(); break; case 6: Ran = Player.GetLevel() + 1; break; } List <EnemyNPC> Temp = new List <EnemyNPC>(); foreach (EnemyNPC NPC in GameObjects.NPCs) { if (NPC.DifBonus == Ran) { Temp.Add(NPC); } } Ran = DiceRoller.RollDice(Temp.Count); EnemyNPC Foe = Temp[Ran]; EnemyNPCs.Add(Foe); } return(EnemyNPCs); }
public static string NameGenerator(string Arg, string NPCName) { string Name = ""; string[] consonants = { "b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "l", "n", "p", "q", "r", "s", "sh", "zh", "t", "v", "w", "x" }; string[] vowels = { "a", "e", "i", "o", "u", "ae", "y" }; Name += consonants[DiceRoller.RollDice(consonants.Length - 1)].ToUpper(); Name += vowels[DiceRoller.RollDice(vowels.Length - 1)]; int Length = DiceRoller.RollDice(6) + 2; int LetterCount = 2; while (LetterCount < Length) { Name += consonants[DiceRoller.RollDice(consonants.Length - 1)]; LetterCount++; Name += vowels[DiceRoller.RollDice(vowels.Length - 1)]; LetterCount++; } switch (Arg) { case null: return(Name); case "City": return("City of " + Name); case "BlackSmith": Name = EditName(Name, Names.GetFromBlackSmith(DiceRoller.RandomRange(0, Names.GetCountBlackSmith() - 1))); break; case "Armourer": Name = EditName(Name, Names.GetFromArmourer(DiceRoller.RandomRange(0, Names.GetCountArmourer() - 1))); break; case "PotionBrewer": Name = EditName(Name, Names.GetFromPotionBrewer(DiceRoller.RandomRange(0, Names.GetCountPotionBrewer() - 1))); break; default: Debug.Log("Name Generation Error -> Arg: " + Arg); break; } return(Name); }
static void AttackPlayer(EnemyNPC NPC, byte AttackType) { int Attack = DiceRoller.RollDice(12) + NPC.StrMod + (NPC.DifBonus / 3); if (Attack >= Player.GetAC()) { Events.NewEvent("AttackRoll", Attack - (NPC.StrMod + NPC.DifBonus), NPC.StrMod, NPC.DifBonus, Attack, Player.GetAC(), NPC.Name, Player.GetName(), "HIT"); DamagePlayer(NPC, AttackType); } else { Events.NewEvent("AttackRoll", Attack - (NPC.StrMod + NPC.DifBonus), NPC.StrMod, NPC.DifBonus, Attack, Player.GetAC(), NPC.Name, Player.GetName(), "MISS"); string Update = NPC.Name + " attacked you and missed!"; IO.GameUpdate(Update); } Thread.Sleep(Settings.GetPauseTime()); }
static int DamageEnemy(string AttackType, EnemyNPC NPC) { int Damage = DiceRoller.RollDice(Player.Weapon.Damage) + Player.GetStrMod(); int Damage2 = Damage; if (AttackType == "Light") { Damage2 = (Damage / 3) * 2; Events.NewEvent("LightDamageRoll", EN1: Damage - Player.GetStrMod(), EN2: Player.GetStrMod(), EN3: Damage2, ES1: Player.GetName(), ES2: NPC.Name); } else { Events.NewEvent("HeavyDamageRoll", EN1: Damage - Player.GetStrMod(), EN2: Player.GetStrMod(), EN3: Damage2, ES1: Player.GetName(), ES2: NPC.Name); } return(Damage2); }
static void DamagePlayer(EnemyNPC NPC, byte AttackType) { int Damage = DiceRoller.RollDice(NPC.Weapon.Damage) + NPC.StrMod; int Damage2 = Damage; if (AttackType == 1) { Damage2 = (Damage / 3) * 2; Events.NewEvent("LightDamageRoll", EN1: Damage - NPC.StrMod, EN2: NPC.StrMod, EN3: Damage2, ES1: NPC.Name, ES2: Player.GetName()); } else { Events.NewEvent("HeavyDamageRoll", EN1: Damage - NPC.StrMod, EN2: NPC.StrMod, EN3: Damage, ES1: NPC.Name, ES2: Player.GetName()); } Player.SetHP(Player.GetHP() - Damage2); string Update = NPC.Name + " attacked you for " + Damage2 + " Damage!"; IO.PlayerHP(Player.GetHP(), Player.GetMaxHP()); IO.GameUpdate(Update); }
public void CreateCharacter() { Dead = false; Name = IO.GetPlayerName(); Level = 1; Str = 1; Dex = 1; Con = 1; int Count = 27; while (Count > 0) { int Stat = DiceRoller.RollDice(3); switch (Stat) { case 1: Str += 1; if (Str > 15) { Str = 15; Count++; } break; case 2: Dex += 1; if (Dex > 15) { Dex = 15; Count++; } break; case 3: Con += 1; if (Con > 15) { Con = 15; Count++; } break; default: Str += 1; break; } Count--; } UpdateAbilityModifiers(); MaxHP = 10 + ConMod; HP = MaxHP; StaminaMax = 4 + (2 * DexMod); if (StaminaMax < 7) { StaminaMax = 7; } Stamina = StaminaMax; SetAtkBonus(); AC = DexMod; XP = 0; LU = 50; Armour.UpdateArmourString(""); Weapon.UpdateWeaponString("Shortsword"); UpdatePlayerAC(); }
public Tavern() { Name = ProGen.NameGenerator(null, null); BarKeep = new NPCS(); Patrons = ProGen.GenerateNPCS(DiceRoller.RandomRange(2, 5)); }