private void bnBattle_Click(object sender, EventArgs e) { Function.SoundManager.PlayButtonSound(); if (player.ControlledCharacters.Count > 0) { FindLocalBattleForm battlechoose = new FindLocalBattleForm(player); var result = battlechoose.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { List <Core.Units.Character> list = new List <Core.Units.Character>(); bool battleWasWon = false; foreach (var item in battlechoose.ReturnChars()) { list.Add(item); } BattleForm battle = new BattleForm(list, battlechoose.ReturnDifficulty(), player.Settings); if (battle.ShowDialog() == DialogResult.OK) { Function.SoundManager.PlayMain(true, this, player.Settings.SoundVolume); list = battle.ReturnChars(player); List <Item> loot = GenerateLoot(battlechoose.ReturnDifficulty(), ReturnAverageLevel(list), battle.ReturnNumberOfPlayers(), battle.ReturnedEnemy().UnitLevel); battleWasWon = true; } List <EnumCharClass> classesUsed = new List <EnumCharClass>(); foreach (var item in list) { classesUsed.Add(item.CharClass); } CheckForQuest(battlechoose.ReturnDifficulty(), battle.ReturnedEnemy(), battle.ReturnedHealingDone(), ReturnLowestPercent(list), classesUsed, battleWasWon); UpdateQuestVisual(); foreach (var item in list) { this.player.ControlledCharacters.RemoveAll(x => x.UnitName == item.UnitName); } this.player.ControlledCharacters.AddRange(battle.ReturnChars(player)); UpdateChars(); UpdateInventoryVisual(); } } else { RPG.UI.MessageForm mes = new RPG.UI.MessageForm("You dont have any characters to battle with!"); mes.ShowDialog(); } this.ResumeLayout(); }
public static void GiveEasyQuestReward(Player _player, EnumQuestRewardType _rewardType) { int xpReward = 0; Item itemReward = new Item(); int dustReward = 0; MessageForm mes = new MessageForm(""); Random r = new Random(); switch (_rewardType) { case EnumQuestRewardType.Experience: foreach (var item in _player.ControlledCharacters) { xpReward = (int)(item.CharXPToLevel * 0.10); item.CharRecieveXP(xpReward); mes = new MessageForm(item.UnitName + " received " + xpReward + " experience!"); mes.ShowDialog(); } break; case EnumQuestRewardType.Item: for (int i = 0; i < 2; i++) { int temp = r.Next(0, 101); int ilevel = _player.ControlledCharacters[r.Next(0,_player.ControlledCharacters.Count)].UnitLevel-2; if (ilevel < 1) ilevel = 1; if(temp >=85 && ilevel > 10) { itemReward = ItemGeneration.ReturnEpocalItem(ilevel); } else { itemReward = ItemGeneration.GenerateFabledItem(ilevel); } _player.AddItemToInventory(itemReward); mes = new MessageForm("You received an " + itemReward.ItemQuality + " item:" + Environment.NewLine + itemReward.ItemName); mes.ShowDialog(); } break; case EnumQuestRewardType.Dust: foreach (var item in _player.ControlledCharacters) { dustReward += (int)(item.UnitLevel * 2); } mes = new MessageForm("You received a total of " + dustReward + " Dust!"); _player.Dust += dustReward; mes.ShowDialog(); break; default: break; } }
private void btAddToAttribute_Click(object sender, EventArgs e) { Function.SoundManager.PlayButtonSound(); if (character.UnUsedAttributePoints.IntValue > 0) { if (comboBoxAttributes.SelectedItem.ToString().ToLower() == "strength") { if (character.BaseStrength.IntValue < character.UnitLevel * 3) { character.UnUsedAttributePoints.IntValue--; character.BaseStrength.IntValue++; character.ResetChar(); } else { MessageForm mes = new MessageForm("Your Base Strength is too high to be incremented at this moment!"); mes.ShowDialog(); } } else if (comboBoxAttributes.SelectedItem.ToString().ToLower() == "agility") { if (character.BaseAgility.IntValue < character.UnitLevel * 3) { character.UnUsedAttributePoints.IntValue--; character.BaseAgility.IntValue++; character.ResetChar(); } else { MessageForm mes = new MessageForm("Your Base Agility is too high to be incremented at this moment!"); mes.ShowDialog(); } } else if (comboBoxAttributes.SelectedItem.ToString().ToLower() == "intellect") { if (character.BaseIntellingence.IntValue < character.UnitLevel * 3) { character.UnUsedAttributePoints.IntValue--; character.BaseIntellingence.IntValue++; character.ResetChar(); } else { MessageForm mes = new MessageForm("Your Base Intellect is too high to be incremented at this moment!"); mes.ShowDialog(); } } SetAttributeLabels(); } else { MessageForm mes = new MessageForm("You dont have any unused Attribute Points!"); mes.ShowDialog(); } }
private void AttackButtonHealing(ucCharacterBattle control, Core.Abilities.ActiveAbility ab) { if (control.CheckBoxP1Status || control.CheckBoxP2Status || control.CheckBoxP3Status || control.CheckBoxP4Status || Function.CombatHandler.RequiresNoTarget(ab)) { List <int> indexes = new List <int>(); if (control.CheckBoxP1Status) { indexes.Add(0); } if (control.CheckBoxP2Status) { indexes.Add(1); } if (control.CheckBoxP3Status) { indexes.Add(2); } if (control.CheckBoxP4Status) { indexes.Add(3); } int previousHP = 0; int postHP = 0; foreach (var item in battleChars) { previousHP += item.CurrentHP.IntValue; } ab.UseAbility(control.Character(), battleChars, indexes, enemy); foreach (var item in battleChars) { postHP += item.CurrentHP.IntValue; } if (postHP > previousHP) { healingDone += Math.Abs(postHP - previousHP); } UpdateIndexedControls(indexes); Function.RichTextBoxExtensions.AppendText(richTextBoxActionbox, "[" + DateTime.Now.ToShortTimeString() + "] ", Color.DarkSeaGreen); Function.RichTextBoxExtensions.AppendText(richTextBoxActionbox, ab.ChatString + Environment.NewLine, Color.DarkOrange); } else { RPG.UI.MessageForm mes = new MessageForm("You have no target!"); mes.ShowDialog(); } }
private void btAddCharacter_Click(object sender, EventArgs e) { Function.SoundManager.PlayButtonSound(); if (this.player.ControlledCharacters.Count < 4) { CreateACharacter(); } else { RPG.UI.MessageForm mes = new RPG.UI.MessageForm("You already have 4 characters!"); mes.ShowDialog(); } }
private void btDone_Click(object sender, EventArgs e) { Function.SoundManager.PlayButtonSound(); if (!this.CheckNumberOfCheckedBoxes()) { SetNewCharacterAbilities(); this.Close(); } else { UI.MessageForm mes = new MessageForm("You have selected more than 4 active skills!"); mes.ShowDialog(); } }
private void btRandomizeStat_Click(object sender, EventArgs e) { Function.SoundManager.PlayButtonSound(); if ((this.player.InventoryOfPlayer.Count > 0 && listBoxInventory.SelectedIndex >= 0) || this.player.ControlledCharacters.Count > 0) { RandomizeStatForm rsform = new RandomizeStatForm(this.player); rsform.ShowDialog(); UpdateDustLabel(); UpdateChars(); } else { RPG.UI.MessageForm mes = new RPG.UI.MessageForm("You have not choosen an item or you have no items in your inventory!"); mes.ShowDialog(); } }
private void btDisenchant_Click(object sender, EventArgs e) { Function.SoundManager.PlayButtonSound(); if (listBoxInventory.SelectedItem != null) { int temp = listBoxInventory.SelectedIndex; this.player.Dust += GeneralFunctions.ReturnDust(this.player.InventoryOfPlayer[temp]); this.player.InventoryOfPlayer.Remove(this.player.InventoryOfPlayer[temp]); UpdateInventoryVisual(); listBoxInventory.SelectedIndex = listBoxInventory.Items.Count - 1; } else { RPG.UI.MessageForm mes = new RPG.UI.MessageForm("Please select an item to disenchant!"); mes.ShowDialog(); } }
private void AttackButtonDamage(ucCharacterBattle control, Core.Abilities.ActiveAbility ab) { if (control.CheckBoxEnemyStatus) { int previousHP = 0; int postHP = 0; int previousMonsterHP = 0; int postMonsterHP = 0; foreach (var item in battleChars) { previousHP += item.CurrentHP.IntValue; } previousMonsterHP = enemy.CurrentHP.IntValue; ab.UseAbility(control.Character(), battleChars, null, enemy); foreach (var item in battleChars) { postHP += item.CurrentHP.IntValue; } postMonsterHP = enemy.CurrentHP.IntValue; if (postHP > previousHP) { healingDone += Math.Abs(postHP - previousHP); } if (postMonsterHP > previousMonsterHP) { damageDone += Math.Abs(postMonsterHP - previousMonsterHP); } Function.RichTextBoxExtensions.AppendText(richTextBoxActionbox, "[" + DateTime.Now.ToShortTimeString() + "] ", Color.DarkSeaGreen); Function.RichTextBoxExtensions.AppendText(richTextBoxActionbox, ab.ChatString + Environment.NewLine, Color.DarkOrange); CheckPlayersHealth(); } else { RPG.UI.MessageForm mes = new MessageForm("You have no target!"); mes.ShowDialog(); } }
private void UseGearChangeForm() { if (listBoxInventory.Items.Count != 0 && listBoxInventory.SelectedIndex != -1) { try { int index = listBoxInventory.SelectedIndex; var currentItem = this.player.InventoryOfPlayer[index]; ChangeGearForm gear = new ChangeGearForm(currentItem, player); if (gear.ShowDialog() == System.Windows.Forms.DialogResult.OK) { UpdateChars(); UpdateInventoryVisual(); } } catch (Exception exp) { RPG.UI.MessageForm mes = new RPG.UI.MessageForm(exp.Message); mes.ShowDialog(); } finally { } } }
private void SetCharacterUserControl(int index) { flowLayoutPanelBattleChar.Controls.Clear(); foreach (var character in player.ControlledCharacters) { if (character.UnitName.Equals(comboBoxChooseChar.Items[index])) { choosechar = character; break; } } if (choosechar != null) { flowLayoutPanelBattleChar.Controls.Add(new ucCharacterInterface(choosechar, false)); } else { RPG.UI.MessageForm mes = new RPG.UI.MessageForm("Something truly horrible happened!"); mes.ShowDialog(); } }
private void btEquip_Click(object sender, EventArgs e) { Function.SoundManager.PlayButtonSound(); if (!(theItem.ItemLevel >= 60 && selectedChar.UnitLevel < 60)) { if ((selectedChar.UnitLevel + 4) >= theItem.ItemLevel) { if (!CheckEpochalBattleCharms()) { if (theItem.ItemType == EnumItemType.Battlecharm) { string oldname = theItem.ItemName; while (BattleCharmNeedsNewName()) { theItem.ItemName = Function.ItemGeneration.RandomizeNewName(theItem); } if (oldname != theItem.ItemName) { RPG.UI.MessageForm mes = new MessageForm("Because " + selectedChar.UnitName + " already had a Battlecharm with the name " + oldname + " the new battlecharm was renamed to " + theItem.ItemName + "!"); mes.ShowDialog(); } } var temp = this.player.InventoryOfPlayer.Find(x => x.Equals(theItem)); this.player.InventoryOfPlayer.Remove(temp); if (toBeReplaced != null) { this.player.InventoryOfPlayer.Add(toBeReplaced); } switch (theItem.ItemType) { case EnumItemType.Weapon: selectedChar.CharGear.AddOrRemoveWeapon((theItem as Core.Items.Weapon), true); break; case EnumItemType.Armor: if ((theItem as Core.Items.Armor).ArmorType == Core.Items.EnumArmorType.Chestarmor) { selectedChar.CharGear.AddOrRemoveChestArmor((theItem as Core.Items.Armor), true); } else if ((theItem as Core.Items.Armor).ArmorType == Core.Items.EnumArmorType.Headarmor) { selectedChar.CharGear.AddOrRemoveHeadArmor((theItem as Core.Items.Armor), true); } else if ((theItem as Core.Items.Armor).ArmorType == Core.Items.EnumArmorType.Legarmor) { selectedChar.CharGear.AddOrRemoveLegArmor((theItem as Core.Items.Armor), true); } break; case EnumItemType.Battlecharm: try { selectedChar.CharGear.AddOrRemoveBattleCharm((toBeReplaced as Core.Items.BattleCharm), false); } catch (Exception exp) { } finally { selectedChar.CharGear.AddOrRemoveBattleCharm((theItem as Core.Items.BattleCharm), true); } break; default: break; } RPG.UI.MessageForm messe = new MessageForm("Equipped " + theItem.ItemName + "!"); messe.ShowDialog(); this.DialogResult = System.Windows.Forms.DialogResult.OK; } else { RPG.UI.MessageForm mes = new MessageForm("You are not allowed to have two instances of the same Epochal Battlecharms equipped!"); mes.ShowDialog(); } } else { RPG.UI.MessageForm mes = new MessageForm(selectedChar.UnitName + " is 5 or more levels lower than " + theItem.ItemName + "'s item level and is not allowed to equip it!"); mes.ShowDialog(); } } else { RPG.UI.MessageForm mes = new MessageForm(selectedChar.UnitName + " must be level 60 to equip level 60+ items!"); mes.ShowDialog(); } }
public static void LaunchQuest(Player _player, int _difficulty) { int quest; #region Very Easy Quests if (_difficulty == -4) { quest = r.Next(0, 6); switch (quest) { case 0: _player.CurrentQuest = new VeryEasyDefeat5(); break; case 1: _player.CurrentQuest = new VeryEasyHealing(); break; case 2: _player.CurrentQuest = new VeryEasyDamage(); break; case 3: _player.CurrentQuest = new VeryEasyClass(); break; case 4: _player.CurrentQuest = new VeryEasyPercentRemaining(); break; case 5: _player.CurrentQuest = new VeryEasyNPCType(); break; default: break; } } #endregion #region Easy Quests if (_difficulty == -2) { quest = r.Next(0, 6); switch (quest) { case 0: _player.CurrentQuest = new EasyDefeat5(); break; case 1: _player.CurrentQuest = new EasyHealing(); break; case 2: _player.CurrentQuest = new EasyDamage(); break; case 3: _player.CurrentQuest = new EasyClass(); break; case 4: _player.CurrentQuest = new EasyPercentRemaining(); break; case 5: _player.CurrentQuest = new EasyNPCType(); break; default: break; } } #endregion #region NormalQuests if (_difficulty == 0) { quest = r.Next(0, 6); switch (quest) { case 0: _player.CurrentQuest = new NormalDefeat5(); break; case 1: _player.CurrentQuest = new NormalHealing(); break; case 2: _player.CurrentQuest = new NormalDamage(); break; case 3: _player.CurrentQuest = new NormalClass(); break; case 4: _player.CurrentQuest = new NormalPercentRemaining(); break; case 5: _player.CurrentQuest = new NormalNPCType(); break; default: break; } } #endregion #region Hard Quests if (_difficulty == 2) { quest = r.Next(0, 6); switch (quest) { case 0: _player.CurrentQuest = new HardDefeat5(); break; case 1: _player.CurrentQuest = new HardHealing(); break; case 2: _player.CurrentQuest = new HardDamage(); break; case 3: _player.CurrentQuest = new HardClass(); break; case 4: _player.CurrentQuest = new HardPercentRemaining(); break; case 5: _player.CurrentQuest = new HardNPCType(); break; default: break; } } #endregion #region Very Hard Quests if (_difficulty == 4) { quest = r.Next(0, 6); switch (quest) { case 0: _player.CurrentQuest = new VeryHardDefeat5(); break; case 1: _player.CurrentQuest = new VeryHardHealing(); break; case 2: _player.CurrentQuest = new VeryHardDamage(); break; case 3: _player.CurrentQuest = new VeryHardClass(); break; case 4: _player.CurrentQuest = new VeryHardPercentRemaining(); break; case 5: _player.CurrentQuest = new VeryHardNPCType(); break; default: break; } } #endregion _player.CurrentQuest.InitiateQuest(_player); MessageForm mes = new MessageForm("You have been given a new quest! " + Environment.NewLine + _player.CurrentQuest.QuestText); mes.ShowDialog(); }
private void SetCharacterUserControl(int index) { flowLayoutPanelBattleChar.Controls.Clear(); foreach (var character in player.ControlledCharacters) { if (character.UnitName.Equals(comboBoxChooseChar.Items[index])) { choosechar = character; break; } } if (choosechar != null) flowLayoutPanelBattleChar.Controls.Add(new ucCharacterInterface(choosechar, false)); else { RPG.UI.MessageForm mes = new RPG.UI.MessageForm("Something truly horrible happened!"); mes.ShowDialog(); } }
private void bnBattle_Click(object sender, EventArgs e) { Function.SoundManager.PlayButtonSound(); if (player.ControlledCharacters.Count > 0) { FindLocalBattleForm battlechoose = new FindLocalBattleForm(player); var result = battlechoose.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { List<Core.Units.Character> list = new List<Core.Units.Character>(); bool battleWasWon = false; foreach (var item in battlechoose.ReturnChars()) { list.Add(item); } Function.SoundManager.PauseMainMenuMusic(); BattleForm battle = new BattleForm(list, battlechoose.ReturnDifficulty(), player.Settings); if (battle.ShowDialog() == DialogResult.OK) { Function.SoundManager.ResumeMainMenuMusic(); list = battle.ReturnChars(player); List<Item> loot = GenerateLoot(battlechoose.ReturnDifficulty(), ReturnAverageLevel(list), battle.ReturnNumberOfPlayers(), battle.ReturnedEnemy().UnitLevel); battleWasWon = true; } List<EnumCharClass> classesUsed = new List<EnumCharClass>(); foreach (var item in list) { classesUsed.Add(item.CharClass); } CheckForQuest(battlechoose.ReturnDifficulty(), battle.ReturnedEnemy(), battle.ReturnedHealingDone(), ReturnLowestPercent(list), classesUsed, battleWasWon); UpdateQuestVisual(); foreach (var item in list) { this.player.ControlledCharacters.RemoveAll(x => x.UnitName == item.UnitName); } this.player.ControlledCharacters.AddRange(battle.ReturnChars(player)); UpdateChars(); UpdateInventoryVisual(); } } else { RPG.UI.MessageForm mes = new RPG.UI.MessageForm("You dont have any characters to battle with!"); mes.ShowDialog(); } this.ResumeLayout(); }
private void btSinglePlayer_Click(object sender, EventArgs e) { MessageForm form = new MessageForm("This mode is currently unavailable."); form.ShowDialog(); }
private void SetLabelsAndPictures(int index) { foreach (var character in player.ControlledCharacters) { if (character.UnitName.Equals(comboBoxChooseChar.Items[index])) { selectedChar = character; break; } } this.pictureBoxChar.Image = Function.GeneralFunctions.ReturnImageForClass(selectedChar); if (selectedChar != null) { switch (theItem.ItemType) { case EnumItemType.Weapon: toBeReplaced = selectedChar.CharGear.Weapon; break; case EnumItemType.Armor: if ((theItem as Core.Items.Armor).ArmorType == Core.Items.EnumArmorType.Chestarmor) { toBeReplaced = selectedChar.CharGear.ChestArmor; } else if ((theItem as Core.Items.Armor).ArmorType == Core.Items.EnumArmorType.Headarmor) { toBeReplaced = selectedChar.CharGear.HeadArmor; } else if ((theItem as Core.Items.Armor).ArmorType == Core.Items.EnumArmorType.Legarmor) { toBeReplaced = selectedChar.CharGear.LegArmor; } break; case EnumItemType.Battlecharm: try { toBeReplaced = selectedChar.CharGear.BattleCharms[battleCharmIndex]; } catch (Exception exp) { toBeReplaced = null; } finally { } break; default: break; } this.labelEquippedItem.Text = Function.GeneralFunctions.ReturnItemLabelString(toBeReplaced); if (toBeReplaced != null) { labelEquippedItem.ForeColor = Function.GeneralFunctions.ReturnProperColorForItem(toBeReplaced); if (toBeReplaced.ItemType == EnumItemType.Battlecharm) { this.labelEquippedItem.Text += Environment.NewLine + "Click here to see the next battlecharm!"; } } labelCharacterStats.Text = selectedChar.CharClass + "\nLevel: " + selectedChar.UnitLevel + "\nXP: " + selectedChar.CharCurrentXP + "/" + selectedChar.CharXPToLevel + "\nHealth: " + selectedChar.CurrentHP.IntValue + "/" + selectedChar.BuffedHP.IntValue + "\nStrength: " + selectedChar.BuffedStrength.IntValue + "\nAgility: " + selectedChar.BuffedAgility.IntValue + "\nIntellect: " + selectedChar.BuffedIntellingence.IntValue + "\nMelee: " + selectedChar.BuffedAttackDamage.IntValue + "\nArmor: " + selectedChar.BuffedArmor.IntValue; } else { RPG.UI.MessageForm mes = new MessageForm("Something truly horrible happened!"); mes.ShowDialog(); } }