private void AbilityLabel() { lProgressBar.Text = ProgressBarSpecialAbility.Value + "/" + ProgressBarSpecialAbility.Maximum; if (character is Warrior) { Warrior warrior = character as Warrior; ProgressBarSpecialAbility.Value = warrior.Rage; ProgressBarSpecialAbility.Maximum = 100; } else if (character is Mage) { Mage mage = character as Mage; ProgressBarSpecialAbility.Step = 1; ProgressBarSpecialAbility.PerformStep(); ProgressBarSpecialAbility.Maximum = 200; } else if (character is Summoner) { Summoner summoner = character as Summoner; summoner.Cooldown++; ProgressBarSpecialAbility.Step = 1; ProgressBarSpecialAbility.PerformStep(); ProgressBarSpecialAbility.Maximum = 30; } }
private void btnSpecialAbility_Click(object sender, EventArgs e) { int dmg = 0; if (character is Summoner) { Summoner summoner = character as Summoner; if (summoner.Cooldown >= 30) { summoner.Cooldown = 0; summoner.SummonMinion(summoner.Cooldown, (summoner.ClickDamage + character.GetUpgradeValue("ClickDamage"))); ProgressBarSpecialAbility.Step = -30; ProgressBarSpecialAbility.PerformStep(); AbilityLabel(); } else { MessageBox.Show("It's still on cooldown, please wait " + (30 - summoner.Cooldown) + " seconds"); } } if (character is Warrior) { Warrior warrior = character as Warrior; if (warrior.Rage > 0) { ProgressBarSpecialAbility.Value = 0; AbilityLabel(); dmg = warrior.UseRage(warrior.Rage); } else { MessageBox.Show("You need rage to cast this"); } } if (character is Mage) { Mage mage = character as Mage; if (mage.Mana >= 40) { ProgressBarSpecialAbility.Step = -40; ProgressBarSpecialAbility.PerformStep(); dmg = mage.UseSpell(40); AbilityLabel(); } else { MessageBox.Show("Not enough mana"); } } DamageEnemy(dmg); }
private void pbClickDmg_Click(object sender, EventArgs e) { DamageEnemy(character.Attack()); if (character is Warrior) { Warrior warrior = character as Warrior; ProgressBarSpecialAbility.Value = warrior.Rage; ProgressBarSpecialAbility.Maximum = 100; if (warrior.Rage < 100) { ProgressBarSpecialAbility.Step = 1; ProgressBarSpecialAbility.PerformStep(); ProgressBarSpecialAbility.Value = warrior.Rage; warrior.Rage++; } } }
/// <summary> /// Own Functions /// </summary> private void abilities() { if (character is Summoner) { Summoner summoner = character as Summoner; if (summoner.Cooldown > 0) { summoner.Cooldown--; } } if (character is Mage) { Mage mage = character as Mage; if (mage.Mana < 200) { ProgressBarSpecialAbility.Step = 1; ProgressBarSpecialAbility.PerformStep(); AbilityLabel(); mage.Mana++; } } }