private void CheckTurnPlayer() { if (tp.turnEnd) { // begin enemy turn IsPlayerTurn = false; tp = new TurnPress(d.enemyTurns * 2); CombatLog.AppendText("Player turn over, it is now the enemy's turn."); CombatLog.AppendText(Environment.NewLine); CombatLog.AppendText(Environment.NewLine); TurnBox.Text = tp.PrintIcons(); UseSkillButton.Enabled = false; UseItemButton.Enabled = false; UseRelic.Enabled = false; IsPlayerTurn = false; if (!d.IsDungeonComplete()) { eTurn = 0; timer.Start(); } } else { TurnBox.Text = tp.PrintIcons(); } }
private void UseSelectedSkill() { Skill s = Skills.SelectedItem as Skill; CombatLog.AppendText($"{p.Name} used {s.Name}"); CombatLog.AppendText(Environment.NewLine); int h = r.Next(0, 100); if (h < 95) { try { if (d.isBoss) { ReduceBar(BossBar, 0, s, BossName); } else { DealDamageToEnemies(s); } } catch (Exception) { } } else { CombatLog.AppendText("The attack missed."); CombatLog.AppendText(Environment.NewLine); CombatLog.AppendText(Environment.NewLine); tp.Miss(); CheckTurnPlayer(); } }
private void DamageBoss(Enemy target, int damage) { if (BossBar.Value - damage <= 0) { if (bc.subbars == 0) { BossBar.Value = 0; CombatLog.AppendText($"{target.name} died!"); CombatLog.AppendText(Environment.NewLine); CombatLog.AppendText(Environment.NewLine); mm.StopBoss(); mm.SetBossSong(r.Next(1, d.tier)); mm.ResumeSong(); DungeonCheck(); } else { damage -= damage - BossBar.Value; BossBar.Value = bc.hp_default; sbars[bc.subbars - 1].Value = 0; bc.subbars--; DamageBoss(target, damage); } } else { BossBar.Value -= damage; } }
private void UseRelicButton() { if (relic != null && tp.icons > 1) { int h = r.Next(0, 100); if (h < 95) { switch (relic.RelicType) { case 0: int hp = (int)(relic.Damage * .01); if ((PlayerHealth.Value + hp) >= PlayerHealth.Maximum) { PlayerHealth.Value = PlayerHealth.Maximum; } else { PlayerHealth.Value += hp; } DealDamageRelic(relic.Damage, 0); break; case 1: int damage = relic.Damage * 2; DealDamageRelic(damage, 0); break; default: int accuracy = 100; DealDamageRelic(relic.Damage, accuracy); break; } } else { CombatLog.AppendText("The attack missed."); CombatLog.AppendText(Environment.NewLine); CombatLog.AppendText(Environment.NewLine); tp.Miss(); CheckTurnPlayer(); } } }
private void useElderKeyToolStripMenuItem_Click(object sender, EventArgs e) { if (MessageBox.Show("You are about to summon an Elder God. Do you wish to continue with this decision?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { p.GodLordKeys--; d.isElderGod = true; DisableUseKeys(); CombatLog.AppendText($"An Elder God approaches. May God have mercy on your soul."); CombatLog.AppendText(Environment.NewLine); CombatLog.AppendText(Environment.NewLine); } }
private void useEXBountyKeyToolStripMenuItem_Click(object sender, EventArgs e) { if (MessageBox.Show("You are about to summon an EX Bounty Boss. Do you wish to continue with this decision?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { p.EXBountyKeys.Remove(d.tier); d.isBountyBoss = true; d.isEXInvader = true; DisableUseKeys(); CombatLog.AppendText($"You have used an EX Bounty Key for Tier {d.tier}. The next boss you face will be an EX Bounty Boss."); CombatLog.AppendText(Environment.NewLine); CombatLog.AppendText(Environment.NewLine); } }
private bool IsCritHit() { int c = r.Next(0, 100); if (c < 25) { CombatLog.AppendText("A critical was hit."); CombatLog.AppendText(Environment.NewLine); return(true); } else { return(false); } }
private void DamageEnemy(Enemy target, ProgressBar bar, int damage, int index) { RadioButton[] c_boxes = { Target1, Target2, Target3 }; string log; if (bar.Value - damage <= 0) { log = $"It hit for {damage} damage. {target.name} died!"; bar.Value = 0; target.hp = 0; d.enemyTurns--; c_boxes[index].Enabled = false; c_boxes[index].Checked = false; if (target.isEx) { DistributeRewards(d.GetArmorRewards(1, true, r)); } if (target.name.Equals("Pot of Greed")) { DistributeRewards(d.GetArmorRewards(r.Next(1, 3), false, r)); } foreach (RadioButton rb in c_boxes) { if (rb.Enabled && !rb.Checked) { rb.Checked = true; break; } } } else { log = $"It hit for {damage} damage."; bar.Value -= damage; target.hp -= damage; } CombatLog.AppendText(log); CombatLog.AppendText(Environment.NewLine); CombatLog.AppendText(Environment.NewLine); }
private void CheckTurnEnemies() { if (tp.turnEnd) { timer.Stop(); // begin player turn IsPlayerTurn = true; tp = new TurnPress(p.Turns + p.stats[Stat.TURNS]); UseSkillButton.Enabled = true; UseItemButton.Enabled = true; UseRelic.Enabled = true; IsPlayerTurn = true; CombatLog.AppendText($"Enemy turn over, it is now {p.Name}'s turn."); CombatLog.AppendText(Environment.NewLine); CombatLog.AppendText(Environment.NewLine); TurnBox.Text = tp.PrintIcons(); } else { TurnBox.Text = tp.PrintIcons(); } }
private void DungeonCheck() { d.EndFight(); bool f = d.IsDungeonComplete(); if (!f) { CombatLog.AppendText($"All enemies killed. Remaining fights: {d.GetFights()}"); int m = d.tier * r.Next(50, 61) + 1000; CombatLog.AppendText(Environment.NewLine); FightsLeft.Text = $"Fights remaining: {d.GetFights()}"; CurrentFight.Text = $"Current Fight: {d.GetCurrentFight()}"; PlayerHealth.Value = PlayerHealth.Maximum; if (d.isBoss) { bc.ResetBars(); m = d.tier * r.Next(80, 101); foreach (ProgressBar sb in sbars) { sb.Visible = false; } if (d.isEXBoss) { p.Set.ReserveSkills.AddRange(d.GetPassiveReserveSkillRewards()); d.isEXBoss = false; m += 5000; } if (d.isInvader) { p.Set.ReserveSkills.AddRange(d.GetPassiveReserveSkillRewards()); SaveManager.SaveGame(p); d.isInvader = false; d.isEXInvader = false; m += 8000; } if (d.isBountyBoss) { p.Set.ReserveSkills.AddRange(d.GetPassiveReserveSkillRewards()); SaveManager.SaveGame(p); d.isBountyBoss = false; d.isEXInvader = false; m += 10000; } if (d.isElderGod) { p.AddDellenCoin(m + 50000); d.ForceEnd(); DungeonCheck(); } if (p.BountyKeys.Contains(d.tier) && d.CanUseBountyKey()) { useBountyKeyToolStripMenuItem.Enabled = true; } if (p.EXBountyKeys.Contains(d.tier) && d.CanUseBountyKey()) { useEXBountyKeyToolStripMenuItem.Enabled = true; } if (p.GodLordKeys > 0 && d.CanUseBountyKey()) { useElderKeyToolStripMenuItem.Enabled = true; } } CombatLog.AppendText($"Money earned: {m}"); CombatLog.AppendText(Environment.NewLine); CombatLog.AppendText(Environment.NewLine); p.AddDellenCoin(m); SaveManager.SaveGame(p); CreateEnemies(); } else { mm.Stop(); mm.StopBoss(); p.ResetElementalMods(); if (d.tier == 500) { // show epilogue here Visible = false; string[] d = { "After a long journey, you've finally done it.", "You have completed one of the most nonsensically grindy journies of all time.", "After days of training, the last great challenge of the Endless Dungeon has fallen before you.", "As a reward for your efforts, you will now receive the answer you seek.", "The Endless Dungeon is not truly endless. No, it is a finite labyrinth meant as a test.", "Once every eon, it manifests itself in your world, looking for challengers who can best it.", "Those who are willing to take on the tower underestimate its size.", "They enter confident and leave in despair.", "The reason why the tower imposes a challenge of this magnitude upon those who enter it...", "...is because it seeks a new master.", "When the last eon draws to an end, the old master must resign his position onto to the worthy few who best him.", "Now that you have accomplished this feat, you will assume the role of the new master.", "And, next time the challenge rises once more... you must be prepared to fight for your position.", "Unless you cheated to get this far, then you suck.", "THE END" }; DialogBox db = new DialogBox(d); db.StartPosition = FormStartPosition.Manual; db.Location = Location; db.ShowDialog(); db.ShowDialog(); Visible = true; } else { MessageBox.Show("Dungeon Complete."); } // receive inventory rewards List <Armor> rewards = d.GetArmorRewards(r.Next(2, 4), false, r); foreach (Armor a in rewards) { if (p.Inventory.Count < 100) { p.Inventory.Add(a); } else { p.ReserveArmor.Add(a); } } // receive additional rewards (passives) int passive = r.Next(0, 100); if (passive < 5) { p.Set.ReserveSkills.AddRange(d.GetPassiveReserveSkillRewards()); } if (d.tier == p.Tier && d.tier != 500) { p.Tier++; } Run(); } }
private void EnemyAttack() { if (eTurn == d.enemies.Count) { eTurn = 0; } Enemy attacker = d.enemies[eTurn]; if (attacker.hp > 0) { Skill s = attacker.active[r.Next(0, attacker.active.Count)]; CombatLog.AppendText($"{attacker.name} used {s.Name}"); CombatLog.AppendText(Environment.NewLine); int h = r.Next(0, 100); if (h < 95) { int damage = SkillManager.CalculateDamage(s.Damage, s.Multiplier); damage -= p.resistances[s.Element]; bool crit = IsCritHit(); if (crit) { damage = (damage * 2); // crit damage tp.HalfTurn(); } else { tp.FullTurn(); } string log; if (PlayerHealth.Value - damage <= 0) { timer.Stop(); PlayerHealth.Value = 0; tp.turnEnd = true; log = "You died! Returning you back to the Select Dungeon screen..."; MessageBox.Show(log); Run(); } else { log = $"It hit for {damage} damage."; int v = PlayerHealth.Value - damage; if (v >= PlayerHealth.Maximum) { PlayerHealth.Value = PlayerHealth.Maximum; } else { PlayerHealth.Value -= damage; } CombatLog.AppendText(log); CombatLog.AppendText(Environment.NewLine); CombatLog.AppendText(Environment.NewLine); } } else { CombatLog.AppendText("The attack missed."); CombatLog.AppendText(Environment.NewLine); CombatLog.AppendText(Environment.NewLine); tp.Miss(); } CheckTurnEnemies(); } eTurn++; }
private void ReduceBar(ProgressBar bar, int index, Skill skill, TextBox e_box) { Enemy target = d.enemies[index]; // generalize this for boss battle bool critWeak = false; int damage = SkillManager.CalculateDamage(skill.Damage, skill.Multiplier) + p.stats[Stat.ATTACK]; if (p.elementalAttackModifier[skill.Element] == 1) { damage += (int)(damage * .25); } int c = r.Next(0, 100); if (c < 25) { damage = (damage * 2) + p.stats[Stat.CRITS]; // crit damge + critboost CombatLog.AppendText("A critical was hit."); CombatLog.AppendText(Environment.NewLine); critWeak = true; } if (d.enemies[index].weakness.Contains(skill.Element)) { damage = (damage * 2) + p.stats[Stat.CRITS]; // treated like crits too CombatLog.AppendText($"A weakness was hit! {target.name} was weak to {SkillManager.ElementToString(skill.Element)}!"); if (d.IsNewWeakness(target.image, skill.Element)) { d.NewWeaknessFound(target, skill.Element); e_box.Text = target.weakName; UpdateTextBoxes(); } CombatLog.AppendText(Environment.NewLine); critWeak = true; } if (d.isBoss) { DamageBoss(target, damage); CombatLog.AppendText($"It hit for {damage} damage."); CombatLog.AppendText(Environment.NewLine); CombatLog.AppendText(Environment.NewLine); } else { DamageEnemy(target, bar, damage, index); } if (critWeak) { tp.HalfTurn(); } else { tp.FullTurn(); } if (!d.isBoss) { CheckHP(); } CheckTurnPlayer(); }
private void ReduceBarRelic(ProgressBar bar, int index, int damage, TextBox e_box, int accuracy) { Enemy target = d.enemies[index]; damage += p.stats[Stat.ATTACK]; foreach (int elem in relic.Elements) { if (p.elementalAttackModifier[elem] == 1) { damage += (int)(damage * .25); } } int c = r.Next(0, 100); if (c < 25 + accuracy) { damage = (damage * 2) + p.stats[Stat.CRITS]; // crit damge + critboost CombatLog.AppendText("A critical was hit."); CombatLog.AppendText(Environment.NewLine); } foreach (int elem in relic.Elements) { if (d.enemies[index].weakness.Contains(elem)) { damage = (damage * 2) + p.stats[Stat.CRITS]; // treated like crits too CombatLog.AppendText($"A weakness was hit! {target.name} was weak to {SkillManager.ElementToString(elem)}!"); if (d.IsNewWeakness(target.image, elem)) { d.NewWeaknessFound(target, elem); e_box.Text = target.weakName; UpdateTextBoxes(); } CombatLog.AppendText(Environment.NewLine); } } if (d.isBoss) { DamageBoss(target, damage); CombatLog.AppendText($"It hit for {damage} damage."); CombatLog.AppendText(Environment.NewLine); CombatLog.AppendText(Environment.NewLine); } else { DamageEnemy(target, bar, damage, index); } for (int i = 0; i < 3; i++) { tp.FullTurn(); } if (!d.isBoss) { CheckHP(); } CheckTurnPlayer(); }
private void UpdateLog(string log) { CombatLog.AppendText(log); CombatLog.AppendText(Environment.NewLine); CombatLog.AppendText(Environment.NewLine); }