public static void Start( BattleUnitStack from, IEnumerable <BattleUnitStack> to ) { CalculateStraightAttack(from, to); }
public void Doing(BattleUnitStack UsedUnit, BattleUnitStack OpposeUnit = null, Battle battle = null) { UsedUnit.bus.Damage.Item1 *= (int)1.2; UsedUnit.bus.Damage.Item2 *= (int)1.2; cooldown = 5; duration = 3; }
public bool Find(BattleUnitStack x) { if (x.ID == findID) { return(true); } return(false); }
public int Compare(BattleUnitStack x, BattleUnitStack y) { if (x.curInitiative == 0 || y.curInitiative == 0) { return(0); } // CompareTo() method return(y.curInitiative.CompareTo(x.curInitiative)); }
public void Doing(BattleUnitStack UsedUnit, BattleUnitStack OpposeUnit = null, Battle battle = null) { cooldown = 5; string res = battle.attack(UsedUnit, OpposeUnit); if ((res != "Killed") && (res != "Was Failed by")) { res = battle.attack(UsedUnit, OpposeUnit); } }
public void YourTurn(BattleUnitStack stack) { Console.WriteLine($"Your turn: {stack.Side}, choose your action\n" + $"1.Attack\n" + $"2.Cast\n" + $"3.Wait\n" + $"4.Defend\n" + $"5.Give up\n" + $"6.Show stats\n" + $"7.Show full log\n"); }
public bool First(BattleUnitStack x) { if (x.queueInitiative == -900) { return(false); } else { return(true); } }
public bool IsDead(BattleUnitStack Health) { if (Health.curHitPoints <= 0) { return(true); } else { return(false); } }
public int Add(BattleUnitStack NewStack) { if (Description.Count() == 9) { return(0); } Log log = Log.getInstance(); Description.Insert(Description.Count(), NewStack); log.sb.AppendLine($"{NewStack.minion.Type}:{NewStack.BasicAmount} join the battle!"); return(1); }
public override bool Spell(BattleUnitStack me, BattleUnitStack target) { if ((me.Side != target.Side) && (me.ID != target.ID)) { target.changeDefence(-12); return(true); } else { return(false); } }
public Attack( Player by, BattleUnitStack from, IEnumerable <BattleUnitStack> ally, IEnumerable <BattleUnitStack> enemy ) { _by = by; _from = from; _ally = ally; _enemy = enemy; }
public static int CalculateAttack(BattleUnitStack from, int attack, int enemyDefence) { var k = attack - enemyDefence; var random = new Random(); var result = (int) Math.Round(from.Number * random.Next(from.Unit.Damage.Item1, from.Unit.Damage.Item2) * (1 + k * 0.05) ); return(result < 1 ? 0 : result); }
private void attack(BattleUnitStack attacker, BattleUnitStack defender) { double defence = defender.curDefence; double Alive = (double)attacker.curHitPoints / attacker.minion.HitPoints; Alive = Math.Ceiling(Alive); int minDamage; int maxDamage; int damage; if (defender.isDefend == 1) { defence = Math.Ceiling(defender.curDefence * 1.3); } if (attacker.curAttack >= defence) { minDamage = Convert.ToInt32(Alive * attacker.minion.MinDamage * (1 + 0.05 * (attacker.curAttack - defence))); maxDamage = Convert.ToInt32(Alive * attacker.minion.MaxDamage * (1 + 0.05 * (attacker.curAttack - defence))); damage = random.Next(minDamage, maxDamage); } else { minDamage = Convert.ToInt32(Alive * attacker.minion.MinDamage * (1 + 0.05 / (defence - attacker.curAttack))); maxDamage = Convert.ToInt32(Alive * attacker.minion.MaxDamage * (1 + 0.05 / (defence - attacker.curAttack))); damage = random.Next(minDamage, maxDamage); } defender.changeHealth(-damage); if ((defender.curHitPoints != 0) && (defender.counter != 0)) //counter { Log log = Log.getInstance(); log.sb.AppendLine($"{defender.ID}:{defender.minion.Type} counter attack"); Alive = (double)defender.curHitPoints / defender.minion.HitPoints; Alive = Math.Ceiling(Alive); if (defender.curAttack >= attacker.curDefence) { minDamage = Convert.ToInt32(Alive * defender.minion.MinDamage * (1 + 0.05 * (defender.curAttack - defence))); maxDamage = Convert.ToInt32(Alive * defender.minion.MaxDamage * (1 + 0.05 * (defender.curAttack - defence))); damage = random.Next(minDamage, maxDamage); } else { minDamage = Convert.ToInt32(Alive * defender.minion.MinDamage * (1 + 0.05 / (defence - defender.curAttack))); maxDamage = Convert.ToInt32(Alive * defender.minion.MaxDamage * (1 + 0.05 / (defence - defender.curAttack))); damage = random.Next(minDamage, maxDamage); } attacker.changeHealth(-damage); defender.setCounter(0); } }
public override double UseAbility(BattleUnitStack attacking, BattleUnitStack defending) { double sumDamage; if (defending.PDefence >= attacking.PAttack) { sumDamage = attacking.PCount * attacking.PDmg * (1 + 0.05 * (attacking.PAttack - defending.PDefence)); } else { sumDamage = attacking.PCount * attacking.PDmg / (1 + 0.05 * (defending.PDefence - attacking.PAttack)); } //return damage deal //sumDamage = sumDamage; return(sumDamage); }
public override bool Spell(BattleUnitStack me, BattleUnitStack target) { if ((me.Side == target.Side) && (me.ID != target.ID)) { double buff = target.curInitiative * 0.4; target.changeInitiative(buff); if (target.queueInitiative > 0) { target.changeQueueInitiative(target.curInitiative); } return(true); } else { return(false); } }
public override bool Spell(BattleUnitStack me, BattleUnitStack target) { if ((me.Side == target.Side) && (me.ID != target.ID)) { if (target.minion.Tribe == "undead") { double Alive = (double)me.curHitPoints / me.minion.HitPoints; int casters = (int)Math.Ceiling(Alive); target.changeHealth(100 * casters); } return(true); } else { return(false); } }
// battlestats public void Show(BattleUnitStack target) { string stats = ""; double Alive = (double)target.curHitPoints / target.minion.HitPoints; Alive = Math.Ceiling(Alive); stats = $"ID: {target.ID}\n" + $"Name: {target.minion.Type}\n" + $"Amount: {Alive}\\{target.BasicAmount} HP: {target.curHitPoints - ((Alive - 1) * target.minion.HitPoints)}\\{target.minion.HitPoints}\n" + $"Attack: {target.minion.Attack} ({target.curAttack}) \n" + $"Damage: {target.minion.MinDamage} - {target.minion.MaxDamage}\n" + $"Defence: {target.minion.Defence} ({target.curDefence})\n" + $"Initiative: {target.minion.Initiative} ({target.curInitiative})\n" + $"Description:\n" + $"{target.minion.Description}\n"; Console.WriteLine(stats); }
public override double UseAbility(BattleUnitStack attacking, BattleUnitStack defending) { return(40); }
} //define your side yourself public virtual bool Spell(BattleUnitStack me, List <BattleUnitStack> queue) { return(true); }
public virtual bool Spell(BattleUnitStack me, BattleArmy red, BattleArmy blue) { return(true); } //define your side yourself
public virtual bool Spell(BattleUnitStack me, BattleUnitStack target) { return(true); }
public Weakening(BattleUnitStack from) => _from = from;
public static void NavigateTo( BattleUnitStack from, IEnumerable <BattleUnitStack> to, AttackMachineState nextState, (int, int) values
public DeathTouch(BattleUnitStack from) => _from = from;
public Haste(BattleUnitStack from) => _from = from;
public void Await(BattleUnitStack stack) => _awaitQueue.Add(stack);
public PunishmentStrike(BattleUnitStack from) => _from = from;
public Curse(BattleUnitStack from) => _from = from;
public Resurrection(BattleUnitStack from) => _from = from;
public abstract double UseAbility(BattleUnitStack attacking, BattleUnitStack defending);