示例#1
0
        public attackProfile generateAttackProfile(attacker attack, defender defence)
        {
            attackProfile returnStructure;

            returnStructure.attacks = attack.myWeapon.attacks;
            returnStructure.toHit   = attack.bs;
            if (returnStructure.toHit > 5)
            {
                returnStructure.toHit = 5;
            }

            if (attack.myWeapon.strength - 2 >= defence.toughness)
            {
                returnStructure.toWound = 5;
            }
            else if (attack.myWeapon.strength - 1 == defence.toughness)
            {
                returnStructure.toWound = 4;
            }
            else if (attack.myWeapon.strength == defence.toughness)
            {
                returnStructure.toWound = 3;
            }
            else if (attack.myWeapon.strength + 1 == defence.toughness)
            {
                returnStructure.toWound = 2;
            }
            else if (attack.myWeapon.strength + 4 <= defence.toughness)
            {
                returnStructure.toWound = 0;
            }
            else
            {
                returnStructure.toWound = 1;
            }

            if (defence.invulnerableSave < defence.save)
            {
                returnStructure.toSave = 7 - defence.invulnerableSave;
            }
            else if (defence.save < attack.myWeapon.ap)
            {
                returnStructure.toSave = 0;
            }
            else
            {
                returnStructure.toSave = defence.save;
            }
            return(returnStructure);
        }
示例#2
0
        private void btnAttackerAdd_Click(object sender, EventArgs e)
        {
            attacker newAttacker = new attacker();

            newAttacker.name = txtAttackerName.Text;
            newAttacker.ws   = int.Parse(txtAttackerWS.Text);
            newAttacker.bs   = int.Parse(txtAttackerBS.Text);
            newAttacker.myWeapon.strength = int.Parse(txtAttackerStrength.Text);
            newAttacker.myWeapon.ap       = int.Parse(txtAttackerAP.Text);
            newAttacker.myWeapon.attacks  = int.Parse(txtAttackerAttacks.Text);

            attackerList.Add(newAttacker);
            lbAttackers.Items.Add(txtAttackerName.Text);
        }
示例#3
0
        private void btnAttackerSave_Click(object sender, EventArgs e)
        {
            if (lbAttackers.SelectedIndex >= 0)
            {
                attacker newAttacker = new attacker();
                newAttacker.name = txtAttackerName.Text;
                newAttacker.ws   = int.Parse(txtAttackerWS.Text);
                newAttacker.bs   = int.Parse(txtAttackerBS.Text);
                newAttacker.myWeapon.strength = int.Parse(txtAttackerStrength.Text);
                newAttacker.myWeapon.ap       = int.Parse(txtAttackerAP.Text);
                newAttacker.myWeapon.attacks  = int.Parse(txtAttackerAttacks.Text);

                attackerList[lbAttackers.SelectedIndex]      = newAttacker;
                lbAttackers.Items[lbAttackers.SelectedIndex] = txtAttackerName.Text;
            }
        }