private void AddCharButton_Click(object sender, EventArgs e) { Character C = new Character(); C.Name = "New Character"; Database.GetActiveDatabase().AddCharacter(C); CharactersListBox.DataSource = null; CharactersListBox.DataSource = Database.GetActiveDatabase().CharList(); }
public Character_Editter_Form() { InitializeComponent(); CharactersListBox.DataSource = Database.GetActiveDatabase().CharList(); CharactersListBox.SelectedIndex = -1; PowerTypeSelectionComboBox.Items.Add("Energy Reserve"); PowerTypeSelectionComboBox.Items.Add("Armor"); PowerTypeSelectionComboBox.Items.Add("Energy Blast"); CharacterGroupBox.Visible = false; EnergyReserveGroupBox.Visible = false; }
private void DeleteCharButton_Click(object sender, EventArgs e) { if (CharactersListBox.SelectedIndex < 0) { return; } Character c = (Character)CharactersListBox.SelectedItem; Database.GetActiveDatabase().RemoveCharacter(c); CharactersListBox.DataSource = null; CharactersListBox.DataSource = Database.GetActiveDatabase().CharList(); }
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(); }
private void ApplyButton_Click(object sender, EventArgs e) { if (SelectedType == selectiontype.Character) { int index = CharactersListBox.SelectedIndex; Character c = (Character)CharactersListBox.SelectedItem; c.Name = CharNameTextBox.Text; c.Str = (int)CharStrUpDown.Value; c.Con = (int)CharConUpDown.Value; c.End = (int)CharEndUpDown.Value; c.Agi = (int)CharAgiUpDown.Value; c.Intel = (int)CharIntUpDown.Value; c.Wil = (int)CharWilUpDown.Value; c.Cha = (int)CharChaUpDown.Value; CharactersListBox.DataSource = null; CharactersListBox.DataSource = Database.GetActiveDatabase().CharList(); CharactersListBox.SelectedIndex = index; } else if (SelectedType == selectiontype.Energy_Reserve) { int index = PowersListBox.SelectedIndex; EnergyReserve EnRes = (EnergyReserve)PowersListBox.SelectedItem; EnRes.Name = EnergyReserveNameTextBox.Text; EnRes.MaxEnergy = (int)EnergyReserveMaxEnergyUpDown.Value; EnRes.Recovery = (int)EnergyReserveRecoveryUpDown.Value; PowersListBox.DataSource = null; PowersListBox.DataSource = (CharactersListBox.SelectedItem as Character).Powers; PowersListBox.SelectedIndex = index; } else if (SelectedType == selectiontype.Armor) { int index = PowersListBox.SelectedIndex; Armor Arm = (Armor)PowersListBox.SelectedItem; Arm.Name = ArmorNameTextBox.Text; Arm.Remove((Character)CharactersListBox.SelectedItem); Arm.RPDEF = (int)ArmorRPDefUpDown.Value; Arm.REDEF = (int)ArmorREDefUpDown.Value; Arm.Apply((Character)CharactersListBox.SelectedItem); PowersListBox.DataSource = null; PowersListBox.DataSource = (CharactersListBox.SelectedItem as Character).Powers; PowersListBox.SelectedIndex = index; } else { int index = PowersListBox.SelectedIndex; Power p = (Power)PowersListBox.SelectedItem; p.Name = CharNameTextBox.Text; PowersListBox.DataSource = null; PowersListBox.DataSource = (CharactersListBox.SelectedItem as Character).Powers; PowersListBox.SelectedIndex = index; } }
static void Event() { List <Character> CHARDATABASE = Database.GetActiveDatabase().CharList(); if (CHARDATABASE.Count < 2) { return; } for (int i = 0; i < CHARDATABASE.Count; i++) { if (CHARDATABASE[i].SPD == 0) { CHARDATABASE[i].SPD = 2; } } Character First = CHARDATABASE[prng.Next(0, CHARDATABASE.Count)]; Character Other; while (true) { Other = CHARDATABASE[prng.Next(0, CHARDATABASE.Count)]; if (Other != First) { break; } } int var = prng.Next(1, 101); if (var < 1) { Console.WriteLine("You meet up with " + Other.Name + " and some stuff happens. Nobody kills each other though!"); } else { Console.WriteLine("You run into " + Other.Name + " out on the street and a fight breaks out between you!"); First.FullHeal(); Other.FullHeal(); MockBattle(First, Other); } }
private void SaveButton_Click(object sender, EventArgs e) { Database.GetActiveDatabase().Save(); }