private void CalculateCounterDef() { int MONSTER_DAM_COUNTER = Convert.ToInt32(monster.Damage * 10 / 100); int PERCENT = Math.Abs(Convert.ToInt32(player.CurrentHP * 20 / 100)); int damage = PERCENT + MONSTER_DAM_COUNTER; monster.CurrentHP -= damage; UpdateHPBar(false, damage); txtProgress.AppendText("You countered " + damage + " damage!\r\n"); if (monster.CurrentHP <= 0) { txtProgress.AppendText(monster.Name + " dead...\r\n"); GainExperience(); if (nemesisActivated) { monster = MonsterGenerator.GenerateNemesis(player); nemesisActivated = false; } else if (bossActivated) { monster = MonsterGenerator.GenerateBoss(player); bossActivated = false; } else { monster = MonsterGenerator.GenerateMonster(player); } UpdateNewMonster(); } }
private void btnStrAtk_Click(object sender, EventArgs e) { if (player.CurrentHP > 0 && monster.CurrentHP > 0) { string brawlBonusText = ""; string text = ""; int damage = 0; if (player.GetType().Equals(typeof(Mage))) { damage = MageBurstOption(ref text); damage = NukeDamage(damage); } else { damage = CalculateStrongDamage(ref text); } if (player.GetType().Equals(typeof(MainChar.Fighter))) { damage = FighterBrawlIncreaseDamage(damage, ref brawlBonusText); } monster.CurrentHP -= damage; UpdateHPBar(false, damage); txtProgress.AppendText(text + "You did " + damage + brawlBonusText + " damage!\r\n"); if (monster.CurrentHP <= 0) { txtProgress.AppendText(monster.Name + " dead...\r\n"); GainExperience(); if (player.GetType().Equals(typeof(MainChar.Fighter))) { FighterAftermath(); } if (nemesisActivated) { monster = MonsterGenerator.GenerateNemesis(player); nemesisActivated = false; } else if (bossActivated) { monster = MonsterGenerator.GenerateBoss(player); bossActivated = false; } else { monster = MonsterGenerator.GenerateMonster(player); } UpdateNewMonster(); } else { int MONSTER_DAM_DICE = rand.Next(monster.Level); damage = monster.Damage + MONSTER_DAM_DICE; if (player.GetType().Equals(typeof(Knight))) { damage = KnightReduceDamage(damage); } player.CurrentHP -= damage; UpdateHPBar(true, damage); txtProgress.AppendText(monster.Name + " did " + damage + " damage...\r\n"); if (player.CurrentHP <= 0) { MessageBox.Show("You dissipated! What a shame!"); this.Dispose(); this.Close(); } } } }