コード例 #1
0
ファイル: Program.cs プロジェクト: Telorath/Capers
        static Character Newcharacter(string name)
        {
            Character C        = new Character();
            IEnergy   ERESERVE = C;

            C.Name = name;
            int chance = prng.Next(1, 101);

            if (chance > 30)
            {
                ERESERVE           = new EnergyReserve();
                ERESERVE.MaxEnergy = prng.Next(1, 9) * 10;
                ERESERVE.Energy    = ERESERVE.MaxEnergy;
                (ERESERVE as Power).calculatecost();
                (ERESERVE as Entity).Name        = "Energy Reserve";
                (ERESERVE as EnergyReserve).User = C;
                C.addpower((Power)ERESERVE);
            }
            chance = prng.Next(1, 101);
            if (chance > 20)
            {
                EnergyBlast EBLAST = new EnergyBlast();
                EBLAST.Name         = "Energy Blast";
                EBLAST.Dice         = prng.Next(1, 6);
                EBLAST.EnergySource = ERESERVE;
                EBLAST.DamageClass  = (damageclass)prng.Next(0, Enum.GetNames(typeof(damageclass)).Length + 1);
                EBLAST.DamageType   = (damagetype)prng.Next(0, Enum.GetNames(typeof(damagetype)).Length + 1);
                EBLAST.User         = C;
                EBLAST.calculatecost();
                C.addpower(EBLAST);
            }
            if (chance > 60)
            {
                Armor ARMORPOWER = new Armor();
                ARMORPOWER.Name         = "Armor";
                ARMORPOWER.REDEF        = prng.Next(1, 10);
                ARMORPOWER.RPDEF        = prng.Next(1, 10);
                ARMORPOWER.EnergySource = ERESERVE;
                ARMORPOWER.User         = C;
                ARMORPOWER.calculatecost();
                C.addpower(ARMORPOWER);
            }
            return(C);
        }
コード例 #2
0
 private void EditPowerButton_Click(object sender, EventArgs e)
 {
     if (SelectedType == selectiontype.Energy_Blast)
     {
         EnergyBlast         En       = (EnergyBlast)SelectedPower;
         EnergyBlastEditForm EditForm = new EnergyBlastEditForm(SelectedCharacter, En);
         if (EditForm.ShowDialog() == DialogResult.OK)
         {
             En.Name         = EditForm.name;
             En.Dice         = EditForm.dice;
             En.EnergySource = EditForm.energysource;
             En.calculatecost();
             CharCalcpoints();
         }
         EditForm.Dispose();
     }
     PowersListBox.DataSource = null;
     PowersListBox.DataSource = (CharactersListBox.SelectedItem as Character).Powers;
 }
コード例 #3
0
ファイル: Program.cs プロジェクト: Telorath/Capers
 static Character Newcharacter(string name)
 {
     Character C = new Character();
     IEnergy ERESERVE = C;
     C.Name = name;
     int chance = prng.Next(1, 101);
     if (chance > 30)
     {
         ERESERVE = new EnergyReserve();
         ERESERVE.MaxEnergy = prng.Next(1, 9) * 10;
         ERESERVE.Energy = ERESERVE.MaxEnergy;
         (ERESERVE as Power).calculatecost();
         (ERESERVE as Entity).Name = "Energy Reserve";
         (ERESERVE as EnergyReserve).User = C;
         C.addpower((Power)ERESERVE);
     }
     chance = prng.Next(1, 101);
     if (chance > 20)
     {
         EnergyBlast EBLAST = new EnergyBlast();
         EBLAST.Name = "Energy Blast";
         EBLAST.Dice = prng.Next(1, 6);
         EBLAST.EnergySource = ERESERVE;
         EBLAST.DamageClass = (damageclass)prng.Next(0, Enum.GetNames(typeof(damageclass)).Length + 1);
         EBLAST.DamageType = (damagetype)prng.Next(0, Enum.GetNames(typeof(damagetype)).Length + 1);
         EBLAST.User = C;
         EBLAST.calculatecost();
         C.addpower(EBLAST);
     }
     if (chance > 60)
     {
         Armor ARMORPOWER = new Armor();
         ARMORPOWER.Name = "Armor";
         ARMORPOWER.REDEF = prng.Next(1, 10);
         ARMORPOWER.RPDEF = prng.Next(1, 10);
         ARMORPOWER.EnergySource = ERESERVE;
         ARMORPOWER.User = C;
         ARMORPOWER.calculatecost();
         C.addpower(ARMORPOWER);
     }
     return C;
 }