コード例 #1
0
 //display before and after stats to demonstrate changes to user
 private void displayStats(PartyMemberCraft craftStats)
 {
     menuBox.DataSource = null;
     menuBox.Items.Clear();
     menuBox.DataSource = craftStats.comparison;
     foreach (string i in craftStats.comparison)
     {
         menuBox.DisplayMember = i;
     }
 }
コード例 #2
0
        private void confirmButton_Click(object sender, EventArgs e)
        {
            //can only craft with two or more parts
            if (parts >= 2)
            {
                frontPage = false;
                //if final page, add new stats to party member
                if (finalPage == true)
                {
                    selectedWeapon.health        = craftStats.stats[0];
                    selectedWeapon.meleeAttack   = craftStats.stats[1];
                    selectedWeapon.meleeDefence  = craftStats.stats[2];
                    selectedWeapon.rangedAttack  = craftStats.stats[3];
                    selectedWeapon.rangedDefence = craftStats.stats[4];
                    selectedWeapon.movementSpeed = craftStats.stats[5];
                    selectedWeapon.attackSpeed   = craftStats.stats[6];
                    selectedWeapon.status        = craftStats.status;

                    //store weapon in inventory database, then clear all temporary variables & loop back to start
                    storeWeapon(selectedWeapon);
                    displayParts();
                    craftStats.comparison.Clear();
                    craftStats.stats.Clear();

                    finalPage = false;
                    frontPage = true;
                }

                //if chip page, save current chip in case of back button, then display list of party members to craft the weapon
                else if (chipPage == true)
                {
                    ElementChip current = menuBox.SelectedItem as ElementChip;
                    inventoryParts.Remove(current);
                    deletedChip = current;
                    getWeapon(value, current.element);
                    //displayPartyMembers
                    insertPartyMembersCraft();
                    displayPartyMemberCraft();
                    partyMemberPage = true;
                    chipPage        = false;
                    finalPage       = false;
                }

                //if party member page, multiply crafted weapon stats by party members crafting modifiers
                else if (partyMemberPage == true)
                {
                    PartyMemberCraft p = menuBox.SelectedItem as PartyMemberCraft;
                    getStats(p.name);

                    //use blank party member craft to store weapon stats
                    craftStats.addStats(selectedWeapon.health, stats[0].health);
                    craftStats.addStats(selectedWeapon.meleeAttack, stats[0].meleeAttack);
                    craftStats.addStats(selectedWeapon.meleeDefence, stats[0].meleeDefence);
                    craftStats.addStats(selectedWeapon.rangedAttack, stats[0].rangedAttack);
                    craftStats.addStats(selectedWeapon.rangedDefence, stats[0].rangedDefence);
                    craftStats.addStats(selectedWeapon.movementSpeed, stats[0].movementSpeed);
                    craftStats.addStats(selectedWeapon.attackSpeed, stats[0].attackSpeed);
                    craftStats.addStatus(selectedWeapon.status, stats[0].status);

                    //print out before and after stats to demonstrate changes to user
                    displayStats(craftStats);

                    partyMemberPage = false;
                    finalPage       = true;
                }
                else
                {
                    partPage = false;
                    insertChips();
                    sortChips(chipList);
                    displayChips();
                    //frontPage = false;
                    chipPage = true;
                }
            }
        }