private void AddPowerButton_Click(object sender, EventArgs e) { if ((string)PowerTypeSelectionComboBox.SelectedItem == string.Empty) { return; } if (CharactersListBox.SelectedIndex < 0) { return; } if (string.Compare((string)PowerTypeSelectionComboBox.SelectedItem, "Energy Reserve") == 0) { EnergyReserve En = new EnergyReserve(); En.Name = "Energy Reserve"; (CharactersListBox.SelectedItem as Character).addpower(En); } if (string.Compare((string)PowerTypeSelectionComboBox.SelectedItem, "Armor") == 0) { Armor Arm = new Armor(); Arm.Name = "Armor"; (CharactersListBox.SelectedItem as Character).addpower(Arm); } if (string.Compare((string)PowerTypeSelectionComboBox.SelectedItem, "Energy Blast") == 0) { EnergyBlast En = new EnergyBlast(); En.Name = "Energy Blast"; En.EnergySource = SelectedCharacter; (CharactersListBox.SelectedItem as Character).addpower(En); } PowersListBox.DataSource = null; PowersListBox.DataSource = (CharactersListBox.SelectedItem as Character).Powers; }
static void Main(string[] args) { #if true Multipower MentalistTricks = new Multipower(); MentalistTricks.EnergySource = new EnergyReserve(); MentalistTricks.EnergySource.MaxEnergy = 100; MentalistTricks.EnergySource.Energy = 100; MentalistTricks.Name = "Mentalist Tricks"; EnergyBlast EnBlast = new EnergyBlast(); EnBlast.EnergySource = MentalistTricks.EnergySource; EnBlast.Dice = 2; EnBlast.Name = "Psi Blast"; EnergyBlast EffBolt = new EnergyBlast(); EffBolt.EnergySource = MentalistTricks.EnergySource; EffBolt.Dice = 8; EffBolt.Name = "EFF BOLT"; EnergyBlast OmegaCannon = new EnergyBlast(); OmegaCannon.Name = "Omega Cannon"; OmegaCannon.Dice = 15; OmegaCannon.EnergySource = MentalistTricks.EnergySource; MentalistTricks.Powers.Add(EnBlast); MentalistTricks.Powers.Add(EffBolt); MentalistTricks.Powers.Add(OmegaCannon); MentalistTricks.calculatecost(); foreach (Power p in MentalistTricks.Powers) { Console.WriteLine("--------------------------------------------------"); p.Display(); } Console.WriteLine("--------------------------------------------------"); Console.WriteLine("Point Cost: " + MentalistTricks.RealPointCost); #endif #if false Database Active = Database.GetActiveDatabase(); Active.AddCharacter(Newcharacter("Bob")); Active.AddCharacter(Newcharacter("Marie")); Active.AddCharacter(Newcharacter("Laura")); Active.AddCharacter(Newcharacter("Robert")); Active.AddCharacter(Newcharacter("Kerchik")); Active.AddCharacter(Newcharacter("Maldor")); Active.AddCharacter(Newcharacter("GALAVOR DESTROYER OF HUMANITY")); Active.Save(); #endif #if false Database.LoadDatabase(); Database.GetActiveDatabase().ReadCharacters(); Character_Editter_Form CHARFORM = new Character_Editter_Form(); Application.Run(CHARFORM); Event(); #endif Console.ReadLine(); }
public EnergyBlastEditForm(Character Chara, EnergyBlast Pow) { InitializeComponent(); ParentCharacter = Chara; SelectedEnergyBlast = Pow; EnergySourceComboBox.Items.Add(ParentCharacter); for (int i = 0; i < ParentCharacter.Powers.Count; i++) { if (ParentCharacter.Powers[i] is IEnergy) { EnergySourceComboBox.Items.Add(ParentCharacter.Powers[i]); } } EnergySourceComboBox.SelectedIndex = 0; name = SelectedEnergyBlast.Name; dice = SelectedEnergyBlast.Dice; pointcost = SelectedEnergyBlast.RealPointCost; }
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); }
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; }
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; }
private void AddPowerButton_Click(object sender, EventArgs e) { if ((string)PowerTypeSelectionComboBox.SelectedItem == string.Empty) { return; } if (CharactersListBox.SelectedIndex < 0) return; if (string.Compare((string)PowerTypeSelectionComboBox.SelectedItem, "Energy Reserve") == 0) { EnergyReserve En = new EnergyReserve(); En.Name = "Energy Reserve"; (CharactersListBox.SelectedItem as Character).addpower(En); } if (string.Compare((string)PowerTypeSelectionComboBox.SelectedItem, "Armor") == 0) { Armor Arm = new Armor(); Arm.Name = "Armor"; (CharactersListBox.SelectedItem as Character).addpower(Arm); } if (string.Compare((string)PowerTypeSelectionComboBox.SelectedItem, "Energy Blast") == 0) { EnergyBlast En = new EnergyBlast(); En.Name = "Energy Blast"; En.EnergySource = SelectedCharacter; (CharactersListBox.SelectedItem as Character).addpower(En); } PowersListBox.DataSource = null; PowersListBox.DataSource = (CharactersListBox.SelectedItem as Character).Powers; }