public void Fight(double[] damages, string TypeofFunc) { UpdateDamages(damages, TypeofFunc); TurnSubtract(); if (monster.Health < 0) { GameAction_Textbox.Text += $"\nCurrent HP:\nHero - {String.Format("{0:0.00}", hero.Health)} \nMonster - 0"; } else { GameAction_Textbox.Text += $"\nCurrent HP:\nHero - {String.Format("{0:0.00}", hero.Health)} \nMonster - {String.Format("{0:0.00}", monster.Health)}"; } if (hero.Health <= 0) { GameAction_Textbox.Text += "\nDrats! You lost!"; CheckForDrops(); MakeResetAvailableAfterGame(); } else if (monster.Health <= 0) { GameAction_Textbox.Text += "\nCongrats! You've won!"; hero.EXP += monster.EXP; MakeResetAvailableAfterGame(); } GameAction_Textbox.ScrollToEnd(); HeroStats tempHero = Hero.CheckHeroLevel(hero.EXP, hero.Level); hero.EXP = tempHero.EXP; hero.Level = tempHero.Level; HeroLevel_Label.Content = $"Hero Level: {hero.Level}"; HeroEXP_Label.Content = $"Hero EXP: {hero.EXP}"; }
public Inventory(List <object> HeroInventory, HeroStats hero_stats, MonsterStats monster_stats) { InitializeComponent(); inventoryInUse = HeroInventory; DisplayInventoryItems(); itemSelected = 0; PopulateItems(); InventoryCount(); hero = hero_stats; monster = monster_stats; }
private void UseItem_Button_Click(object sender, RoutedEventArgs e) { List <object> HeroMonsterList; if (inventoryInUse[itemSelected] is InventoryConsumable) { HeroMonsterList = Functions.FuncUseInventoryConsumable(itemSelected, hero, monster, (InventoryConsumable)inventoryInUse[itemSelected], inventoryInUse);//Sending values to UseInventoryItem in functions hero = ((HeroStats)HeroMonsterList[0]); monster = ((MonsterStats)HeroMonsterList[1]); inventoryInUse = (List <object>)HeroMonsterList[2]; } else if ((inventoryInUse[itemSelected] is InventoryArmor)) { } }
public GameWindow(HeroStats hero_stats) { InitializeComponent(); GameAction_Textbox.Text = ""; GameAction_Textbox.Text += "Base Stats for Level 1"; GameAction_Textbox.Text += $"\nNo. - Name - Health (Low-High) - Attack (Low-High) - Defense (Low-High) - Monster EXP (Low-High)"; GameAction_Textbox.Text += $"\n1 - {monsterObject.snake_Stats.NameofMonster} - {monsterObject.snake_Stats.Health * 8 / 10} - {monsterObject.snake_Stats.Health * 12 / 10} - {monsterObject.snake_Stats.Attack * 8 / 10} - {monsterObject.snake_Stats.Attack * 12 / 10} - {monsterObject.snake_Stats.Defense * 8 / 10} - {monsterObject.snake_Stats.Defense * 12 / 10} - {monsterObject.snake_Stats.EXP * 8 / 10} - {monsterObject.snake_Stats.EXP * 12 / 10} "; GameAction_Textbox.Text += $"\n2 - {monsterObject.dragon_Stats.NameofMonster} - {monsterObject.dragon_Stats.Health * 8 / 10} - {monsterObject.dragon_Stats.Health * 12 / 10} - {monsterObject.dragon_Stats.Attack * 8 / 10} - {monsterObject.dragon_Stats.Attack * 12 / 10} - {monsterObject.dragon_Stats.Defense * 8 / 10} - {monsterObject.dragon_Stats.Defense * 12 / 10} - {monsterObject.dragon_Stats.EXP * 8 / 10} - {monsterObject.dragon_Stats.EXP * 12 / 10} "; GameAction_Textbox.Text += $"\n3 - {monsterObject.scorpion_Stats.NameofMonster} - {monsterObject.scorpion_Stats.Health * 8 / 10} - {monsterObject.scorpion_Stats.Health * 12 / 10} - {monsterObject.scorpion_Stats.Attack * 8 / 10} - {monsterObject.scorpion_Stats.Attack * 12 / 10} - {monsterObject.scorpion_Stats.Defense * 8 / 10} - {monsterObject.scorpion_Stats.Defense * 12 / 10} - {monsterObject.scorpion_Stats.EXP * 8 / 10} - {monsterObject.scorpion_Stats.EXP * 12 / 10} "; hero = hero_stats; HeroLevel_Label.Content = $"Hero Level: {hero.Level}"; HeroEXP_Label.Content = $"Hero EXP: {hero.EXP}"; HeroName_Label.Content = $"Hero Name: {hero.NameofHero}"; MakeResetAvailableAfterGame(); Hero_Image.Source = new BitmapImage(new Uri(@"\Resources\Hero\Default\HeroPixelArt 64 pixel.png", UriKind.Relative)); }
public static HeroStats CheckHeroLevel(int inEXP, int inlevel) { int level_requirements = inlevel * 100 + inlevel * (inlevel - 1) * 25; // Calculation of Sum of Arithmetic Progression with first term = 100 EXP and increase in EXP = 50 EXP if (level_requirements < inEXP) { inEXP -= level_requirements; inlevel += 1; } HeroStats heroEXPLevel = new HeroStats() { EXP = inEXP, Level = inlevel }; return(heroEXPLevel); }
private void ProceedButton_Click(object sender, RoutedEventArgs e) { hero = Hero.SetHero(hero); try { level_monster = Convert.ToInt32(MonsterLevel_Textbox.Text); if (level_monster < 1) { GameAction_Textbox.Text += "\nPlease input a level."; } } catch (Exception) { GameAction_Textbox.Text += "\nPlease input a level greater than 1."; } try { type_monster = Convert.ToInt32(MonsterType_Textbox.Text); if (type_monster < 1 || type_monster > 3) { GameAction_Textbox.Text += "\nPlease input a level from 1 - 3."; } else { monster = monsterObject.PickMonster(level_monster, type_monster); string imageSource = Monsters.SetImageSource(type_monster); Monster_Image.Source = new BitmapImage(new Uri(imageSource, UriKind.Relative)); Proceed_Button.Visibility = Visibility.Hidden; MonsterLevel_Textbox.Visibility = Visibility.Hidden; MonsterType_Textbox.Visibility = Visibility.Hidden; MonsterType_Label.Visibility = Visibility.Hidden; MonsterLevel_Label.Visibility = Visibility.Hidden; GameAction_Textbox.Text += $"\nCurrent HP:\nHero - {String.Format("{0:0.00}", hero.Health)} \nMonster - {String.Format("{0:0.00}", monster.Health)}"; FuncAttack_Button.Visibility = Visibility.Visible; FuncDefend_Button.Visibility = Visibility.Visible; FuncHeal_Button.Visibility = Visibility.Visible; FuncRetreat_Button.Visibility = Visibility.Visible; } } catch (Exception) { GameAction_Textbox.Text += "\nPlease input a type from 1 - 3."; } }
public static List <object> FuncUseInventoryConsumable(int selecteditem, HeroStats hero, MonsterStats monster, InventoryConsumable item, List <object> currentInventory) { List <object> temp_list = new List <object>(); switch (item.ItemIndex) { case 11: monster.turnConfusedStatus = item.effectTurns; if (item.numberofuses == 1) //Remove item from current inventory if one use item { currentInventory.RemoveAt(selecteditem); } break; default: break; } temp_list[0] = hero; temp_list[1] = monster; temp_list[2] = currentInventory; return(temp_list); }
public static HeroStats SetHero(HeroStats temphero) { HeroStats hero = new HeroStats() { Health = 100.0 * temphero.Level, Attack = 10.0 * temphero.Level, Defense = 10.0 * temphero.Level, Agility = 10.0 * temphero.Level, Level = temphero.Level, EXP = temphero.EXP, NameofHero = temphero.NameofHero, turnConfusedStatus = temphero.turnConfusedStatus, turnPoisonedStatus = temphero.turnPoisonedStatus, turnStunnedStatus = temphero.turnStunnedStatus, turnBurnedStatus = temphero.turnBurnedStatus, turnFrozenStatus = temphero.turnFrozenStatus, turnAttackUpStatus = temphero.turnAttackUpStatus, turnHealthUpStatus = temphero.turnHealthUpStatus, turnDefenseUpStatus = temphero.turnDefenseUpStatus, turnAgilityUpStatus = temphero.turnAgilityUpStatus }; return(hero); }
public static double[] FuncFailedRetreat(HeroStats hero, MonsterStats monster) { double[] damage_dealt = new double[] { CalculateDamage(monster.Attack, hero.Defense), 0 }; // Index 1 - Damage to Hero Index 2 - Damage to Monster return(damage_dealt); }
public static double[] FuncDefend(HeroStats hero, MonsterStats monster) { double[] damage_dealt = new double[] { 1, 0 };// Index 1 - Damage to Hero Index 2 - Damage to Monster return(damage_dealt); }
public static void Get_Hero_Values(HeroStats temphero) { hero.EXP = temphero.EXP; hero.Level = temphero.Level; }