public CombatWindow(Enemy e) { InitializeComponent(); d = new Dice(); //disable the main window Program.main.mainWindow.IsEnabled = false; //save the enemy enemy = e; //bind the Abililty picker ComboBox to the Player's Abilities. abilityPicker.ItemsSource = Program.main.player.combatAbilities; write("You have entered combat with a ", "Black", true); write(enemy.name, "LawnGreen", true); write(".", "Black", true); //update the enemt name label enemyName.Content = enemy.name; //if the Player is Human and the Enemy is stronger, buff him if (Program.main.player.pRace is Human && enemy.level > Program.main.player.level) { write(Program.main.player.name + "'s", "Black"); write(" Spark of Hope ", "Aqua", true); write(" has given " + Program.main.player.name + " determination to win!", "Black", true); int difference = Convert.ToInt32((enemy.level - Program.main.player.level) * 1.5); Program.main.player.atk += difference; Program.main.player.def += difference; Program.main.player.spd += difference; Program.main.player.intl += difference; } else if (Program.main.player.pRace is Orc && Program.main.player.hp != Program.main.player.maxhp) { float mod = 1.0f - (float)(Program.main.player.hp / Program.main.player.maxhp); Program.main.player.atk = Convert.ToInt32(Program.main.player.atk * mod); } //write the stats writeEnemyStats(); Program.main.writeStats(); //give the first turn to whoever is faster isPlayerTurn = Program.main.player.spd >= enemy.spd; if (isPlayerTurn) goButton.IsEnabled = true; else { goButton.IsEnabled = false; EnemyAttack(enemy); isPlayerTurn = true; goButton.IsEnabled = true; } }
/// <summary> /// 20% of putting the player into combat with a relevant Enemy. /// </summary> public void checkCombat() { Dice d = new Dice(); if (d.roll(1, 5) == 1) { Enemy e = getRelevantEnemy(); Program.main.EnterCombat(e); } }
public override int Attack(Player player, out string used) { Dice d = new Dice(); int dmg = 0; used = abilities[Program.random.Next(0, abilities.Count)]; switch(used) { case "Attack": dmg = Math.Max(d.roll(1, atk) - player.def, 1); break; case "Sticky Smash": dmg = Math.Max(d.roll(2, atk) - player.def, 1); break; } return dmg; }
public override int Execute(object target) { ((Enemy)target).effects.Add(new Blind(1)); return(Math.Max(1, Dice.roll(2, Program.main.player.spd) - (((Enemy)target).def / 2))); }
public override int Execute(object target) { //1D(atk + spd)/2 return(Math.Max((Dice.roll(1, (Program.main.player.atk + Program.main.player.spd) / 2)), 1)); }
public override int Execute(object target) { //(3Datk / 2) - enemydef damage return(Math.Max((Dice.roll(3, Program.main.player.atk / 2) - ((Enemy)target).def), 1)); }
public override int Execute(object target) { //(2Datk / 2) - (enemydef / 2) damage return(Math.Max((Dice.roll(2, Program.main.player.atk / 2) - ((Enemy)target).def / 2), 2)); }
public override int Execute(object target) { //(1Dint + 2) - (enemydef / 2) damage return(Math.Max((Dice.roll(1, Program.main.player.intl) + 2) - (((Enemy)target).def / 2), 1)); }
public override int Execute(object target) { //(1Datk + 4) - enemydef damage return(Math.Max((Dice.roll(1, Program.main.player.atk) + 4) - ((((Enemy)target).def * 3) / 4), 1)); }