public ucCharacterBattle(Core.Units.Character _character, int _numberOfCharacters) { InitializeComponent(); this.BackColor = Color.Transparent; character = _character; numberOfChars = _numberOfCharacters; friendTargets = 0; labelHealthRemaining.Width = flpHealthBar.Width; labelHealthRemaining.Text = character.CurrentHP.IntValue + "/" + character.BuffedHP.IntValue + " (100%)"; lbTurnpoints.Text = character.CurrentTurnPoints.IntValue.ToString() + " Turnpoints left"; lbCharStats.Text = Function.GeneralFunctions.ReturnCharBattleString(this.character); pictureBoxChar.Image = Function.GeneralFunctions.ReturnImageForClass(character); foreach (var item in character.UnitActiveAbilities) { comboBoxAbilities.Items.Add(item.AbilityName); } selectedAbility = character.UnitActiveAbilities.First(); comboBoxAbilities.SelectedIndex = 0; labelAbilityDescription.Text = selectedAbility.Description; if (selectedAbility.DamageOrHealing == EnumActiveAbilityType.Damage) checkBoxEnemy.Checked = true; else checkBoxPlayer1.Checked = false; HideInvalidCheckboxes(); }
private void btCreate_Click(object sender, EventArgs e) { Function.SoundManager.PlayButtonSound(); if (textBoxCharacterName.Text != "" && GeneralFunctions.CheckTextForNonLetters(textBoxCharacterName.Text)) { if (!this.player.ControlledCharacters.Any(x => x.UnitName.ToLower().Equals(textBoxCharacterName.Text.ToLower()))) { returnedCharacter = new Core.Units.Character(textBoxCharacterName.Text, 1, 10, 10, finalclass, 0, 1, 1, 1, 1, 0, 0, null); returnedCharacter.CharGear = GiveCharGear(returnedCharacter); returnedCharacter.AddActiveAbility(new Core.Abilities.MeleeAttack(returnedCharacter, "", "", null, EnumAbilityClassReq.ANY)); returnedCharacter.AddPassiveAbility(new Core.Abilities.MeleeAttack(returnedCharacter, "", "", null, EnumAbilityClassReq.ANY)); this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } else { RPG.UI.MessageForm mes = new RPG.UI.MessageForm("You already have a character with that name!"); mes.ShowDialog(); } } else if (textBoxCharacterName.Text != "") { RPG.UI.MessageForm mes = new RPG.UI.MessageForm("Please only use Letters for you Character Name"); mes.ShowDialog(); } else { RPG.UI.MessageForm mes = new RPG.UI.MessageForm("Please choose a suitable name!"); mes.ShowDialog(); } }
public ucCharacterInterface(Core.Units.Character _character, bool _withGear) { InitializeComponent(); character = _character; lbCharName.Text = character.UnitName; this.BackColor = Color.Transparent; character.ResetChar(); lbCharStats.Text = Function.GeneralFunctions.ReturnCharInterfaceString(this.character); pictureBoxChar.Image = Function.GeneralFunctions.ReturnImageForClass(character); if (!_withGear) { btCharacter.Enabled = false; btCharacter.Visible = false; flpAbilitiesAndPassives.Height += 31; } foreach (var item in _character.UnitActiveAbilities) { this.flpAbilitiesAndPassives.Controls.Add(new ucAbilityIcon(item)); } }
private void CreateACharacter() { CharacterCreationForm form = new CharacterCreationForm(player); var result = form.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { Core.Units.Character c = form.ReturnCharacter(); c.Owner = player.UserName; player.AddCharacter(c); this.flpCharacters.Controls.Add(new ucCharacterInterface(form.ReturnCharacter(), true)); } }
private Core.Units.Gear GiveCharGear(Core.Units.Character character) { Core.Units.Gear gear = new Core.Units.Gear(); switch (character.CharClass) { case RPG.Core.EnumCharClass.Warrior: gear.AddOrRemoveWeapon(new RPG.Core.Items.Weapon("Warrior's Axe", EnumItemType.Weapon, EnumItemQuality.Normal, 1, Core.Items.EnumWeaponType.Axe, 1), true); gear.AddOrRemoveChestArmor(new RPG.Core.Items.Armor("Warrior's Chestarmor", EnumItemType.Armor, EnumItemQuality.Normal, 1, Core.Items.EnumArmorType.Chestarmor, 1), true); break; case RPG.Core.EnumCharClass.Paladin: gear.AddOrRemoveWeapon(new RPG.Core.Items.Weapon("Paladin's Sword", EnumItemType.Weapon, EnumItemQuality.Normal, 1, Core.Items.EnumWeaponType.Sword, 1), true); gear.AddOrRemoveChestArmor(new RPG.Core.Items.Armor("Paladin's Chestarmor", EnumItemType.Armor, EnumItemQuality.Normal, 1, Core.Items.EnumArmorType.Chestarmor, 1), true); break; case RPG.Core.EnumCharClass.Wizard: gear.AddOrRemoveWeapon(new RPG.Core.Items.Weapon("Wizard's Staff", EnumItemType.Weapon, EnumItemQuality.Normal, 1, Core.Items.EnumWeaponType.Staff, 1), true); gear.AddOrRemoveChestArmor(new RPG.Core.Items.Armor("Wizard's Chestarmor", EnumItemType.Armor, EnumItemQuality.Normal, 1, Core.Items.EnumArmorType.Chestarmor, 1), true); break; case RPG.Core.EnumCharClass.Thief: gear.AddOrRemoveWeapon(new RPG.Core.Items.Weapon("Thief's Dagger", EnumItemType.Weapon, EnumItemQuality.Normal, 1, Core.Items.EnumWeaponType.Dagger, 1), true); gear.AddOrRemoveChestArmor(new RPG.Core.Items.Armor("Thief's Chestarmor", EnumItemType.Armor, EnumItemQuality.Normal, 1, Core.Items.EnumArmorType.Chestarmor, 1), true); break; case RPG.Core.EnumCharClass.Caretaker: gear.AddOrRemoveWeapon(new RPG.Core.Items.Weapon("Caretaker's Mace", EnumItemType.Weapon, EnumItemQuality.Normal, 1, Core.Items.EnumWeaponType.Mace, 1), true); gear.AddOrRemoveChestArmor(new RPG.Core.Items.Armor("Caretaker's Chestarmor", EnumItemType.Armor, EnumItemQuality.Normal, 1, Core.Items.EnumArmorType.Chestarmor, 1), true); break; case RPG.Core.EnumCharClass.Synergist: gear.AddOrRemoveWeapon(new RPG.Core.Items.Weapon("Synergist's Bow", EnumItemType.Weapon, EnumItemQuality.Normal, 1, Core.Items.EnumWeaponType.Bow, 1), true); gear.AddOrRemoveChestArmor(new RPG.Core.Items.Armor("Synergist's Chestarmor", EnumItemType.Armor, EnumItemQuality.Normal, 1, Core.Items.EnumArmorType.Chestarmor, 1), true); break; default: break; } gear.AddOrRemoveBattleCharm(new Core.Items.BattleCharm("Copper Coin", EnumItemType.Battlecharm, EnumItemQuality.Normal, 1), true); gear.AddOrRemoveBattleCharm(new Core.Items.BattleCharm("Metal Coin", EnumItemType.Battlecharm, EnumItemQuality.Normal, 1), true); gear.BattleCharms[0].AddAttributeToItem(EnumAttributeType.Health, 1); gear.BattleCharms[1].AddAttributeToItem(EnumAttributeType.Health, 1); gear.AddOrRemoveHeadArmor(new Core.Items.Armor("Headcloth", EnumItemType.Armor, EnumItemQuality.Normal, 1, Core.Items.EnumArmorType.Headarmor, 0), true); gear.AddOrRemoveLegArmor(new Core.Items.Armor("Loincloth", EnumItemType.Armor, EnumItemQuality.Normal, 1, Core.Items.EnumArmorType.Legarmor, 0), true); return(gear); }
public ChangeGearForm(Item _item, Player _player) { InitializeComponent(); this.StartPosition = FormStartPosition.CenterParent; this.BackgroundImage = RPG.Function.GeneralFunctions.ResizeImage(Properties.Resources.background, labelBackgroundIGNORE.Size); this.theItem = _item; this.player = _player; this.selectedChar = player.ControlledCharacters[0]; foreach (var item in player.ControlledCharacters) { comboBoxChooseChar.Items.Add(item.UnitName); } this.labelCurrentItem.Text = Function.GeneralFunctions.ReturnItemLabelString(theItem); labelCurrentItem.ForeColor = Function.GeneralFunctions.ReturnProperColorForItem(theItem); comboBoxChooseChar.SelectedIndex = 0; }
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 comboBoxChooseChar_SelectedIndexChanged(object sender, EventArgs e) { selectedCharacter = this.player.ControlledCharacters[comboBoxChooseChar.SelectedIndex]; SetListBoxGear(); }
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(); } }
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(); } }