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;
 }
 private void CharactersListBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (CharactersListBox.SelectedIndex < 0)
     {
         SelectedCharacter = null;
         return;
     }
     SelectedCharacter = (Character)CharactersListBox.Items[CharactersListBox.SelectedIndex];
     PowersListBox.DataSource = SelectedCharacter.Powers;
     PowersListBox.SelectedIndex = -1;
     CharNameTextBox.Text = SelectedCharacter.Name;
     CharStrUpDown.Value = SelectedCharacter.Str;
     CharConUpDown.Value = SelectedCharacter.End;
     CharEndUpDown.Value = SelectedCharacter.End;
     CharAgiUpDown.Value = SelectedCharacter.Agi;
     CharIntUpDown.Value = SelectedCharacter.Intel;
     CharWilUpDown.Value = SelectedCharacter.Wil;
     CharChaUpDown.Value = SelectedCharacter.Cha;
     CharCalcpoints();
     SelectedType = selectiontype.Character;
     CharacterGroupBox.Visible = true;
     EnergyReserveGroupBox.Visible = false;
     ArmorGroupBox.Visible = false;
 }
Exemple #3
0
 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;
 }
Exemple #4
0
 static void AttackRound(Character Attacker, Character Defender)
 {
     IDealsDamage Attack = Attacker.DefaultAttack;
     HitStruct Hit = new HitStruct();
     for (int i = 0; i < Attacker.Powers.Count; i++)
     {
         if (Attacker.Powers[i] is IDealsDamage && Attacker.Powers[i].CanUse())
         {
             Attack = (IDealsDamage)Attacker.Powers[i];
             break;
         }
     }
     if (Attack != null && (Attack as Power).CanUse())
     {
         Hit = Attack.GetDamage();
         if (Attacker.Attackroll(Defender))
         {
             Hit = Defender.ApplyDefense(Hit);
             Console.WriteLine(Attacker + " attacks " + Defender + " with " + Attack + " dealing " + Hit.HealthDamage + "(" + Hit.StunDamage + " Stun) damage!");
             Defender.GetHit(Hit);
         }
         else
         {
             Console.WriteLine(Attacker + " attacks " + Defender + " with " + Attack + ", but misses!");
         }
     }
     else
     {
         Console.WriteLine(Attacker + " was too tired to use any abilities this turn and used a recovery instead!");
         Attacker.TakeRecovery();
     }
 }
Exemple #5
0
 static void MockBattle(Character Combatant1, Character Combatant2)
 {
     bool Combat = true;
     int turn = 1;
     bool turntaken = false;
     while (Combat)
     {
         if (turn % 13 + 1 <= Combatant1.SPD)
         {
             turntaken = true;
             AttackRound(Combatant1, Combatant2);
         }
         if (turn % 13 + 1 <= Combatant2.SPD)
         {
             turntaken = true;
             AttackRound(Combatant2, Combatant1);
         }
         if (turn % 12 == 0)
         {
             Combatant1.TakeRecovery();
             Combatant2.TakeRecovery();
         }
         if (turntaken)
         {
             Combatant1.Display();
             Combatant2.Display();
             turntaken = false;
         }
         if (Combatant1.KO || Combatant1.Dead || Combatant2.Dead || Combatant2.KO)
         {
             Combat = false;
         }
         turn++;
     }
 }
Exemple #6
0
 public void RemoveCharacter(Character c)
 {
     Characters.Remove(c);
 }
Exemple #7
0
 public void AddCharacter(Character C)
 {
     Characters.Add(C);
 }
Exemple #8
0
 public bool Attackroll(Character Other)
 {
     int Attackroll = Program.prng.Next((this.mAgi / 10), this.mAgi + 1);
     int Defenseroll = Program.prng.Next((Other.mAgi / 10), Other.mAgi + 1);
     if (Attackroll >= Defenseroll)
     {
         return true;
     }
     else
         return false;
 }
Exemple #9
0
 public override void Remove(Character Target)
 {
     Target.RPDEF -= RPDEF;
     Target.REDEF -= REDEF;
 }
Exemple #10
0
 public override void Apply(Character Target)
 {
     Target.RPDEF += RPDEF;
     Target.REDEF += REDEF;
 }
Exemple #11
0
 public virtual void Remove(Character Target)
 {
     //Exists to be overrriden
 }
Exemple #12
0
 public virtual void Apply(Character Target)
 {
     //Exists to be overriden;
 }
 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();
 }