コード例 #1
0
        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();
            }
        }
コード例 #2
0
        private void btRandomize_Click(object sender, EventArgs e)
        {
            Function.SoundManager.PlayButtonSound();
            if (choosenItem != null && player.Dust >= choosenItem.ItemLevel)
            {
                if (comboBoxAttribute.SelectedIndex != -1)
                {
                    this.player.Dust -= choosenItem.ItemLevel;
                    UpdateDustRemaining();
                    Random r        = new Random(DateTime.Now.Millisecond);
                    int    oldValue = choosenItem.stats.Find(x => x.Type.Equals(comboBoxAttribute.SelectedItem)).IntValue;
                    int    newValue = r.Next(0, choosenItem.ItemLevel + 1);

                    choosenItem.stats.Find(x => x.Type.Equals(comboBoxAttribute.SelectedItem)).IntValue = newValue;

                    labelChange.Text = choosenItem.ItemName + "'s " + choosenItem.stats.Find(x => x.Type.Equals(comboBoxAttribute.SelectedItem)).Type
                                       + " got changed from " + oldValue + " to " + newValue + "!" + Environment.NewLine + Environment.NewLine
                                       + "That's a change of " + (newValue - oldValue);
                    int index = comboBoxAttribute.SelectedIndex;
                    SetChoosenItemLabel();
                    comboBoxAttribute.SelectedIndex = index;
                }
            }
            else if (choosenItem == null)
            {
                RPG.UI.MessageForm mes = new RPG.UI.MessageForm("Choose and Item to change!");
                mes.ShowDialog();
            }
            else
            {
                RPG.UI.MessageForm mes = new RPG.UI.MessageForm("You dont have enough dust! Disenchant more items!");
                mes.ShowDialog();
            }
        }
コード例 #3
0
        private void checkBoxPlayer_CheckedChanged(object sender, EventArgs e)
        {
            if ((sender as CheckBox).Checked == true)
            {
                if (selectedAbility.DamageOrHealing == EnumActiveAbilityType.Damage)
                {
                    RPG.UI.MessageForm mes = new RPG.UI.MessageForm("This ability deals damage! Select the enemy!");
                    mes.ShowDialog();
                    (sender as CheckBox).Checked = false;
                }
                else
                {
                    friendTargets++;
                    if (ValidCheckFriendly())
                        checkBoxEnemy.Checked = false;
                    else 
                    {
                        (sender as CheckBox).Checked = false;
                        RPG.UI.MessageForm mes = new RPG.UI.MessageForm("You've selected too many targets! Choose at most " + selectedAbility.NumberOfTargets + " targets!");
                        mes.ShowDialog();
                        
                    }

                }
            }
            else
                friendTargets--;
            
        }
コード例 #4
0
 private void checkBoxEnemy_CheckedChanged(object sender, EventArgs e)
 {
     if ((sender as CheckBox).Checked == true)
     {
         if (selectedAbility.DamageOrHealing == EnumActiveAbilityType.Healing)
         {
             RPG.UI.MessageForm mes = new RPG.UI.MessageForm("This ability is beneficial! Select an ally!");
             mes.ShowDialog();
             (sender as CheckBox).Checked = false;
         }
         else
         {
             int some = groupBoxTargets.Controls.Count;
             foreach (var item in groupBoxTargets.Controls)
             {
                 if ((item as CheckBox).Checked == true && !(item.Equals(sender)))
                 {
                     (item as CheckBox).Checked = false;
                 }
             }
             (sender as CheckBox).Checked = true;
         }
     }
     
 }
コード例 #5
0
 private void btNewUser_Click(object sender, EventArgs e)
 {
     Function.SoundManager.PlayButtonSound();
     if (Function.GeneralFunctions.CheckTextForNonLettersAndNonDigits(textBoxPassword.Text) && Function.GeneralFunctions.CheckTextForNonLettersAndNonDigits(textBoxPlayerName.Text))
     {
         if (!IsUsernameTaken(textBoxPlayerName.Text))
         {
             loginPlayer.UserName = textBoxPlayerName.Text;
             loginPlayer.Password = textBoxPassword.Text;
             playerList.Add(loginPlayer);
             this.DialogResult = System.Windows.Forms.DialogResult.OK;
             this.Close();
         }
         else
         {
             RPG.UI.MessageForm mes = new RPG.UI.MessageForm("That Username is already taken.");
             mes.ShowDialog();
         }
     }
     else
     {
         RPG.UI.MessageForm mes = new RPG.UI.MessageForm("You may only use letters and digits for your Username and/or Password.");
         mes.ShowDialog();
     }
 }
コード例 #6
0
        private void UpdateClassSelection(int modifier)
        {
            classchoice += modifier;

            if (classchoice == -1)
            {
                classchoice = 5;
            }
            else if (classchoice == 6)
            {
                classchoice = 0;
            }

            switch (classchoice)
            {
            case 0:
                finalclass = Core.EnumCharClass.Warrior;
                labelClassDescription.Text = finalclass.ToString() + "\n\n" + Properties.Resources.DescriptionWarrior;
                pictureBoxClass.Image      = Properties.Resources.warrior;
                break;

            case 1:
                finalclass = Core.EnumCharClass.Paladin;
                labelClassDescription.Text = finalclass.ToString() + "\n\n" + Properties.Resources.DescriptionPaladin;
                pictureBoxClass.Image      = Properties.Resources.paladin;
                break;

            case 2:
                finalclass = Core.EnumCharClass.Wizard;
                labelClassDescription.Text = finalclass.ToString() + "\n\n" + Properties.Resources.DescriptionWizard;
                pictureBoxClass.Image      = Properties.Resources.wizard;
                break;

            case 3:
                finalclass = Core.EnumCharClass.Thief;
                labelClassDescription.Text = finalclass.ToString() + "\n\n" + Properties.Resources.DescriptionThief;
                pictureBoxClass.Image      = Properties.Resources.thief;
                break;

            case 4:
                finalclass = Core.EnumCharClass.Caretaker;
                labelClassDescription.Text = finalclass.ToString() + "\n\n" + Properties.Resources.DescriptionCaretaker;
                pictureBoxClass.Image      = Properties.Resources.caretaker;
                break;

            case 5:
                finalclass = Core.EnumCharClass.Synergist;
                labelClassDescription.Text = finalclass.ToString() + "\n\n" + Properties.Resources.DescriptionSynergist;
                pictureBoxClass.Image      = Properties.Resources.synergist;
                break;

            default:
                RPG.UI.MessageForm mes = new RPG.UI.MessageForm("An error occured!");
                mes.ShowDialog();
                break;
            }
        }
コード例 #7
0
 /// <summary>
 /// This function adds an Active Ability to the unit
 /// </summary>
 /// <param name="acab">The active ability to be added to the unit</param>
 public void AddActiveAbility(Abilities.ActiveAbility acab)
 {
     if (this.TypeOfUnit == UnitType.Character && this.unitActiveAbilities.Count() == 4)
     {
         RPG.UI.MessageForm mes = new RPG.UI.MessageForm("You have 4 active abilities already!" + Environment.NewLine + "Click 'Change Abilities' to change your active ones!");
         mes.ShowDialog();
     }
     else
     {
         this.unitActiveAbilities.Add(acab);
     }
 }
コード例 #8
0
 /// <summary>
 /// This Function is used to add a character to a player. A player may have a maximum of 6 characters.
 /// </summary>
 /// <param name="_character">The character to be added</param>
 public void AddCharacter(Units.Character _character)
 {
     if (this.ControlledCharacters.Count < 4)
     {
         this.ControlledCharacters.Add(_character);
     }
     else
     {
         RPG.UI.MessageForm mes = new RPG.UI.MessageForm("You cannot have more than 4 characters");
         mes.ShowDialog();
     }
 }
コード例 #9
0
 /// <summary>
 /// This Function is used to add an item to a players inventory. The inventory can hold a maximum of 30 items.
 /// </summary>
 /// <param name="_item">The item to be added</param>
 public void RemoveItemToInventory(Item _item)
 {
     if (this.inventoryOfPlayer.Contains(_item))
     {
         this.inventoryOfPlayer.Remove(_item);
     }
     else
     {
         RPG.UI.MessageForm mes = new RPG.UI.MessageForm("An error occured while trying to remove an item from the inventory");
         mes.ShowDialog();
     }
 }
コード例 #10
0
 /// <summary>
 /// This Function is used to add an item to a players inventory. The inventory can hold a maximum of 30 items.
 /// </summary>
 /// <param name="_item">The item to be added</param>
 public void AddItemToInventory(Item _item)
 {
     if (this.inventoryOfPlayer.Count < 30)
     {
         this.inventoryOfPlayer.Add(_item);
     }
     else
     {
         RPG.UI.MessageForm mes = new RPG.UI.MessageForm("You cannot have more than 30 items in your inventory");
         mes.ShowDialog();
     }
 }
コード例 #11
0
 /// <summary>
 /// This Function is used to remove a character from a player.
 /// </summary>
 /// <param name="_character">The character to be removed</param>
 public void RemoveCharacter(Units.Character _character)
 {
     if (this.ControlledCharacters.Contains(_character))
     {
         this.ControlledCharacters.Remove(_character);
     }
     else
     {
         RPG.UI.MessageForm mes = new RPG.UI.MessageForm("An error occured while trying to remove a character");
         mes.ShowDialog();
     }
 }
コード例 #12
0
 private void btCancel_Click(object sender, EventArgs e)
 {
     Function.SoundManager.PlayButtonSound();
     if (this.player.ControlledCharacters.Count != 0)
     {
         this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
         this.Close();
     }
     else
     {
         RPG.UI.MessageForm mes = new RPG.UI.MessageForm("You must to have at least one character.");
         mes.ShowDialog();
     }
 }
コード例 #13
0
ファイル: CharacterCreationForm.cs プロジェクト: Tonaplo/RPG
 private void btCancel_Click(object sender, EventArgs e)
 {
     Function.SoundManager.PlayButtonSound();
     if (this.player.ControlledCharacters.Count != 0)
     {
         this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
         this.Close();
     }
     else
     {
         RPG.UI.MessageForm mes = new RPG.UI.MessageForm("You must to have at least one character.");
         mes.ShowDialog();
     }
 }
コード例 #14
0
        private void btAttack_Click(object sender, EventArgs e)
        {
            if (checkBoxPlayer1.Checked == false
                    && checkBoxPlayer2.Checked == false
                    && checkBoxPlayer3.Checked == false
                    && checkBoxPlayer4.Checked == false
                    && checkBoxEnemy.Checked == false)
            {
                MessageForm mes = new MessageForm("You havent choosen any targets!");
                mes.ShowDialog();
            }
            else
            {
                if (character.CurrentTurnPoints.IntValue >= selectedAbility.TurnPointCost)
                {
                    if (checkBoxEnemy.Checked == true & selectedAbility.DamageOrHealing == EnumActiveAbilityType.Damage)
                    {
                        character.CurrentTurnPoints.IntValue -= selectedAbility.TurnPointCost;
                        if (AttackClicked != null)
                            AttackClicked(this, EventArgs.Empty);

                        lbTurnpoints.Text = character.CurrentTurnPoints.IntValue.ToString() + " Turnpoints left";
                    }
                    else if ((checkBoxPlayer1.Checked == true
                        || checkBoxPlayer2.Checked == true
                        || checkBoxPlayer3.Checked == true
                        || checkBoxPlayer4.Checked == true)
                        & selectedAbility.DamageOrHealing == EnumActiveAbilityType.Healing
                        )
                    {
                        character.CurrentTurnPoints.IntValue -= selectedAbility.TurnPointCost;
                        if (AttackClicked != null)
                            AttackClicked(this, EventArgs.Empty);

                        lbTurnpoints.Text = character.CurrentTurnPoints.IntValue.ToString() + " Turnpoints left";
                    }
                }
                else
                {
                    RPG.UI.MessageForm mes = new RPG.UI.MessageForm("You dont have enough turnpoints!");
                    mes.ShowDialog();
                }
            }
        }
コード例 #15
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();
            }
        }
コード例 #16
0
 private bool UserExists(string _username, string _password)
 {
     if (playerList.Any(x => x.UserName.ToLower() == _username.ToLower()))
     {
         Player potentialLoginPlayer = playerList.Find(x => x.UserName.ToLower() == _username.ToLower());
         if (potentialLoginPlayer.Password.ToLower() == _password.ToLower())
         {
             loginPlayer = potentialLoginPlayer;
             return(true);
         }
         else
         {
             RPG.UI.MessageForm mes = new RPG.UI.MessageForm("The password does not match the Username!");
             mes.ShowDialog();
             return(false);
         }
     }
     else
     {
         RPG.UI.MessageForm mes = new RPG.UI.MessageForm("No user with that username found!");
         mes.ShowDialog();
         return(false);
     }
 }
コード例 #17
0
ファイル: CharacterCreationForm.cs プロジェクト: Tonaplo/RPG
        private void UpdateClassSelection(int modifier)
        {
            classchoice += modifier;

            if (classchoice == -1)
                classchoice = 5;
            else if (classchoice == 6)
                classchoice = 0;

            switch (classchoice)
            {
                case 0:
                    finalclass = Core.EnumCharClass.Warrior;
                    labelClassDescription.Text = finalclass.ToString() + "\n\n" + Properties.Resources.DescriptionWarrior;
                    pictureBoxClass.Image = Properties.Resources.warrior;
                    break;
                case 1:
                    finalclass = Core.EnumCharClass.Paladin;
                    labelClassDescription.Text = finalclass.ToString() + "\n\n" + Properties.Resources.DescriptionPaladin;
                    pictureBoxClass.Image = Properties.Resources.paladin;
                    break;
                case 2:
                    finalclass = Core.EnumCharClass.Wizard;
                    labelClassDescription.Text = finalclass.ToString() + "\n\n" + Properties.Resources.DescriptionWizard;
                    pictureBoxClass.Image = Properties.Resources.wizard;
                    break;
                case 3:
                    finalclass = Core.EnumCharClass.Thief;
                    labelClassDescription.Text = finalclass.ToString() + "\n\n" + Properties.Resources.DescriptionThief;
                    pictureBoxClass.Image = Properties.Resources.thief;
                    break;
                case 4:
                    finalclass = Core.EnumCharClass.Caretaker;
                    labelClassDescription.Text = finalclass.ToString() + "\n\n" + Properties.Resources.DescriptionCaretaker;
                    pictureBoxClass.Image = Properties.Resources.caretaker;
                    break;
                case 5:
                    finalclass = Core.EnumCharClass.Synergist;
                    labelClassDescription.Text = finalclass.ToString() + "\n\n" + Properties.Resources.DescriptionSynergist;
                    pictureBoxClass.Image = Properties.Resources.synergist;
                    break;
                default:
                    RPG.UI.MessageForm mes = new RPG.UI.MessageForm("An error occured!");
                    mes.ShowDialog();
                    break;
            }
        }
コード例 #18
0
ファイル: CharacterCreationForm.cs プロジェクト: Tonaplo/RPG
        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();
            }
        }
コード例 #19
0
ファイル: ucCharacterBattle.cs プロジェクト: Tonaplo/RPG
        private void checkBoxPlayer_CheckedChanged(object sender, EventArgs e)
        {
            if ((sender as CheckBox).Checked == true)
            {
                if (selectedAbility.DamageOrHealing == EnumActiveAbilityType.Damage)
                {
                    RPG.UI.MessageForm mes = new RPG.UI.MessageForm("This ability deals damage! Select the enemy!");
                    mes.ShowDialog();
                    (sender as CheckBox).Checked = false;
                }
                else
                {
                    friendTargets++;
                    if (ValidCheckFriendly())
                        checkBoxEnemy.Checked = false;
                    else
                    {
                        (sender as CheckBox).Checked = false;
                        RPG.UI.MessageForm mes = new RPG.UI.MessageForm("You've selected too many targets! Choose at most " + selectedAbility.NumberOfTargets + " targets!");
                        mes.ShowDialog();

                    }

                }
            }
            else
                friendTargets--;
        }
コード例 #20
0
ファイル: ucCharacterBattle.cs プロジェクト: Tonaplo/RPG
 private void checkBoxEnemy_CheckedChanged(object sender, EventArgs e)
 {
     if ((sender as CheckBox).Checked == true)
     {
         if (selectedAbility.DamageOrHealing == EnumActiveAbilityType.Healing)
         {
             RPG.UI.MessageForm mes = new RPG.UI.MessageForm("This ability is beneficial! Select an ally!");
             mes.ShowDialog();
             (sender as CheckBox).Checked = false;
         }
         else
         {
             int some = groupBoxTargets.Controls.Count;
             foreach (var item in groupBoxTargets.Controls)
             {
                 if ((item as CheckBox).Checked == true && !(item.Equals(sender)))
                 {
                     (item as CheckBox).Checked = false;
                 }
             }
             (sender as CheckBox).Checked = true;
         }
     }
 }
コード例 #21
0
ファイル: ucCharacterBattle.cs プロジェクト: Tonaplo/RPG
        private void btAttack_Click(object sender, EventArgs e)
        {
            if (checkBoxPlayer1.Checked == false
                    && checkBoxPlayer2.Checked == false
                    && checkBoxPlayer3.Checked == false
                    && checkBoxPlayer4.Checked == false
                    && checkBoxEnemy.Checked == false)
            {
                MessageForm mes = new MessageForm("You havent choosen any targets!");
                mes.ShowDialog();
            }
            else
            {
                if (character.CurrentTurnPoints.IntValue >= selectedAbility.TurnPointCost)
                {
                    if (checkBoxEnemy.Checked == true & selectedAbility.DamageOrHealing == EnumActiveAbilityType.Damage)
                    {
                        character.CurrentTurnPoints.IntValue -= selectedAbility.TurnPointCost;
                        if (AttackClicked != null)
                            AttackClicked(this, EventArgs.Empty);

                        lbTurnpoints.Text = character.CurrentTurnPoints.IntValue.ToString() + " Turnpoints left";
                    }
                    else if ((checkBoxPlayer1.Checked == true
                        || checkBoxPlayer2.Checked == true
                        || checkBoxPlayer3.Checked == true
                        || checkBoxPlayer4.Checked == true)
                        & selectedAbility.DamageOrHealing == EnumActiveAbilityType.Healing
                        )
                    {
                        character.CurrentTurnPoints.IntValue -= selectedAbility.TurnPointCost;
                        if (AttackClicked != null)
                            AttackClicked(this, EventArgs.Empty);

                        lbTurnpoints.Text = character.CurrentTurnPoints.IntValue.ToString() + " Turnpoints left";
                    }
                }
                else
                {
                    RPG.UI.MessageForm mes = new RPG.UI.MessageForm("You dont have enough turnpoints!");
                    mes.ShowDialog();
                }
            }
        }
コード例 #22
0
ファイル: Player.cs プロジェクト: Tonaplo/RPG
 /// <summary>
 /// This Function is used to add a character to a player. A player may have a maximum of 6 characters.
 /// </summary>
 /// <param name="_character">The character to be added</param>
 public void AddCharacter(Units.Character _character)
 {
     if (this.ControlledCharacters.Count < 4)
         this.ControlledCharacters.Add(_character);
     else
     {
         RPG.UI.MessageForm mes = new RPG.UI.MessageForm("You cannot have more than 4 characters");
         mes.ShowDialog();
     }
 }
コード例 #23
0
ファイル: LoginForm.cs プロジェクト: Tonaplo/RPG
 private bool UserExists(string _username, string _password)
 {
     if (playerList.Any(x => x.UserName.ToLower() == _username.ToLower()))
     {
         Player potentialLoginPlayer = playerList.Find(x => x.UserName.ToLower() == _username.ToLower());
         if (potentialLoginPlayer.Password.ToLower() == _password.ToLower())
         {
             loginPlayer = potentialLoginPlayer;
             return true;
         }
         else
         {
             RPG.UI.MessageForm mes = new RPG.UI.MessageForm("The password does not match the Username!");
             mes.ShowDialog();
             return false;
         }
     }
     else
     {
         RPG.UI.MessageForm mes = new RPG.UI.MessageForm("No user with that username found!");
         mes.ShowDialog();
         return false;
     }
 }
コード例 #24
0
ファイル: Character.cs プロジェクト: Tonaplo/RPG
 /// <summary>
 /// This functions adds or removes a weapon to or from the characters gear. Set "modifier" appropiately to add or remove. NOTE: This function DELETES the current item in the slot!
 /// </summary>
 /// <param name="_weapon">The Weapon to be added</param>
 /// <param name="add">Set this value to "true" to add the weapon and "false" to remove it.</param>
 public void AddOrRemoveWeapon(Items.Weapon _weapon, bool modifier)
 {
     if (modifier && ((_weapon as Item).ItemType == EnumItemType.Weapon))
         this.weapon = _weapon;
     else if (!modifier)
         this.weapon = null;
     else
     {
         RPG.UI.MessageForm mes = new RPG.UI.MessageForm("Wrong Itemtype! Attempted to insert " + (_weapon as Item).ItemType + " when Weapon was expected");
         mes.ShowDialog();
     }
 }
コード例 #25
0
ファイル: Character.cs プロジェクト: Tonaplo/RPG
 /// <summary>
 /// This functions adds or removes a legarmor to or from the characters gear. Set "modifier" appropiately to add or remove. NOTE: This function DELETES the current item in the slot!
 /// </summary>
 /// <param name="_weapon">The legarmor to be added</param>
 /// <param name="add">Set this value to "true" to add the legarmor and "false" to remove it.</param>
 public void AddOrRemoveLegArmor(Items.Armor _armor, bool modifier)
 {
     if (modifier && ((_armor as Item).ItemType == EnumItemType.Armor))
         this.legArmor = _armor;
     else if (!modifier)
         this.legArmor = null;
     else
     {
         RPG.UI.MessageForm mes = new RPG.UI.MessageForm("Wrong Itemtype! Attempted to insert " + (_armor as Item).ItemType + " when LegArmor was expected");
         mes.ShowDialog();
     }
 }
コード例 #26
0
ファイル: Character.cs プロジェクト: Tonaplo/RPG
 /// <summary>
 /// This functions adds or removes a BattleCharm to or from the characters gear. Set "modifier" appropiately to add or remove. A Character may only hold 4 BattleCharms
 /// </summary>
 /// <param name="_weapon">The legarmor to be added</param>
 /// <param name="add">Set this value to "true" to add the battlecharm and "false" to remove it.</param>
 public void AddOrRemoveBattleCharm(Items.BattleCharm _bc, bool modifier)
 {
     if (modifier && this.battleCharms.Count < 2)
         this.battleCharms.Add(_bc);
     else if (modifier && this.battleCharms.Count >= 2)
     {
         RPG.UI.MessageForm mes = new RPG.UI.MessageForm("This character allready has 2 BattleCharms! You must remove one before you can add this one!");
         mes.ShowDialog();
     }
     else if (!modifier && this.battleCharms.Contains(_bc))
         this.battleCharms.Remove(_bc);
 }
コード例 #27
0
ファイル: Unit.cs プロジェクト: Tonaplo/RPG
 /// <summary>
 /// This function adds an Active Ability to the unit
 /// </summary>
 /// <param name="acab">The active ability to be added to the unit</param>
 public void AddActiveAbility(Abilities.ActiveAbility acab)
 {
     if (this.TypeOfUnit == UnitType.Character && this.unitActiveAbilities.Count() == 4)
     {
         RPG.UI.MessageForm mes = new RPG.UI.MessageForm("You have 4 active abilities already!" + Environment.NewLine + "Click 'Change Abilities' to change your active ones!");
         mes.ShowDialog();
     }
     else
     {
         this.unitActiveAbilities.Add(acab);
     }
 }
コード例 #28
0
ファイル: Player.cs プロジェクト: Tonaplo/RPG
 /// <summary>
 /// This Function is used to add an item to a players inventory. The inventory can hold a maximum of 30 items.
 /// </summary>
 /// <param name="_item">The item to be added</param>
 public void AddItemToInventory(Item _item)
 {
     if (this.inventoryOfPlayer.Count < 30)
         this.inventoryOfPlayer.Add(_item);
     else
     {
         RPG.UI.MessageForm mes = new RPG.UI.MessageForm("You cannot have more than 30 items in your inventory");
         mes.ShowDialog();
     }
 }
コード例 #29
0
ファイル: Player.cs プロジェクト: Tonaplo/RPG
 /// <summary>
 /// This Function is used to remove a character from a player.
 /// </summary>
 /// <param name="_character">The character to be removed</param>
 public void RemoveCharacter(Units.Character _character)
 {
     if (this.ControlledCharacters.Contains(_character))
         this.ControlledCharacters.Remove(_character);
     else
     {
         RPG.UI.MessageForm mes = new RPG.UI.MessageForm("An error occured while trying to remove a character");
         mes.ShowDialog();
     }
 }
コード例 #30
0
ファイル: LoginForm.cs プロジェクト: Tonaplo/RPG
 private void btNewUser_Click(object sender, EventArgs e)
 {
     Function.SoundManager.PlayButtonSound();
     if (Function.GeneralFunctions.CheckTextForNonLettersAndNonDigits(textBoxPassword.Text) && Function.GeneralFunctions.CheckTextForNonLettersAndNonDigits(textBoxPlayerName.Text))
     {
         if (!IsUsernameTaken(textBoxPlayerName.Text))
         {
             loginPlayer.UserName = textBoxPlayerName.Text;
             loginPlayer.Password = textBoxPassword.Text;
             playerList.Add(loginPlayer);
             this.DialogResult = System.Windows.Forms.DialogResult.OK;
             this.Close();
         }
         else
         {
             RPG.UI.MessageForm mes = new RPG.UI.MessageForm("That Username is already taken.");
             mes.ShowDialog();
         }
     }
     else
     {
         RPG.UI.MessageForm mes = new RPG.UI.MessageForm("You may only use letters and digits for your Username and/or Password.");
         mes.ShowDialog();
     }
 }
コード例 #31
0
ファイル: RandomizeStatForm.cs プロジェクト: Tonaplo/RPG
        private void btRandomize_Click(object sender, EventArgs e)
        {
            Function.SoundManager.PlayButtonSound();
            if (choosenItem != null && player.Dust >= choosenItem.ItemLevel)
            {
                if (comboBoxAttribute.SelectedIndex != -1)
                {
                    this.player.Dust -= choosenItem.ItemLevel;
                    UpdateDustRemaining();
                    Random r = new Random(DateTime.Now.Millisecond);
                    int oldValue = choosenItem.stats.Find(x => x.Type.Equals(comboBoxAttribute.SelectedItem)).IntValue;
                    int newValue = r.Next(0, choosenItem.ItemLevel+1);

                    choosenItem.stats.Find(x => x.Type.Equals(comboBoxAttribute.SelectedItem)).IntValue = newValue;

                    labelChange.Text = choosenItem.ItemName + "'s " + choosenItem.stats.Find(x => x.Type.Equals(comboBoxAttribute.SelectedItem)).Type
                                        + " got changed from " + oldValue + " to " + newValue + "!" + Environment.NewLine + Environment.NewLine
                                        + "That's a change of " + (newValue - oldValue);
                    int index = comboBoxAttribute.SelectedIndex;
                    SetChoosenItemLabel();
                    comboBoxAttribute.SelectedIndex = index;
                }
            }
            else if (choosenItem == null)
            {
                RPG.UI.MessageForm mes = new RPG.UI.MessageForm("Choose and Item to change!");
                mes.ShowDialog();
            }
            else
            {
                RPG.UI.MessageForm mes = new RPG.UI.MessageForm("You dont have enough dust! Disenchant more items!");
                mes.ShowDialog();
            }
        }
コード例 #32
0
ファイル: Character.cs プロジェクト: Tonaplo/RPG
 /// <summary>
 /// This function levels up a character. It only increases the BASE values of the characters attributes
 /// </summary>
 public void CharLevelUp()
 {
     this.BaseHP.IntValue += 2;
     int temp = this.UnitLevel+1;
     this.baseCrit.IntValue = temp;
     this.baseSpeed.IntValue = temp;
     this.UnUsedAttributePoints.IntValue += 4;
     this.UnitLevel++;
     this.baseTurnPoints.IntValue = (this.UnitLevel / 10) + 1;
     RPG.UI.MessageForm mes = new RPG.UI.MessageForm("Your character " + this.UnitName + " leveled up!" + Environment.NewLine + this.UnitName + " is now level " + this.UnitLevel + "!");
     mes.ShowDialog();
     this.LevelUpClassAbilties(charClass, false);
     this.LevelUpAnyClassAbilties(false);
 }
コード例 #33
0
ファイル: DeleteCharForm.cs プロジェクト: Tonaplo/RPG
        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();
            }
        }
コード例 #34
0
ファイル: Player.cs プロジェクト: Tonaplo/RPG
 /// <summary>
 /// This Function is used to add an item to a players inventory. The inventory can hold a maximum of 30 items.
 /// </summary>
 /// <param name="_item">The item to be added</param>
 public void RemoveItemToInventory(Item _item)
 {
     if (this.inventoryOfPlayer.Contains(_item))
         this.inventoryOfPlayer.Remove(_item);
     else
     {
         RPG.UI.MessageForm mes = new RPG.UI.MessageForm("An error occured while trying to remove an item from the inventory");
         mes.ShowDialog();
     }
 }