Example #1
0
 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;
 }
Example #3
0
 public bool Find(BattleUnitStack x)
 {
     if (x.ID == findID)
     {
         return(true);
     }
     return(false);
 }
Example #4
0
    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);
            }
        }
Example #6
0
 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");
 }
Example #7
0
 public bool First(BattleUnitStack x)
 {
     if (x.queueInitiative == -900)
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
Example #8
0
 public bool IsDead(BattleUnitStack Health)
 {
     if (Health.curHitPoints <= 0)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Example #9
0
    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);
    }
Example #10
0
 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);
     }
 }
Example #11
0
 public Attack(
     Player by,
     BattleUnitStack from,
     IEnumerable <BattleUnitStack> ally,
     IEnumerable <BattleUnitStack> enemy
     )
 {
     _by    = by;
     _from  = from;
     _ally  = ally;
     _enemy = enemy;
 }
Example #12
0
        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);
        }
Example #13
0
    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);
        }
Example #15
0
 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);
     }
 }
Example #16
0
 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);
     }
 }
Example #17
0
    // 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);
 }
Example #19
0
    }                                                                                               //define your side yourself

    public virtual bool Spell(BattleUnitStack me, List <BattleUnitStack> queue)
    {
        return(true);
    }
Example #20
0
 public virtual bool Spell(BattleUnitStack me, BattleArmy red, BattleArmy blue)
 {
     return(true);
 }                                                                                               //define your side yourself
Example #21
0
 public virtual bool Spell(BattleUnitStack me, BattleUnitStack target)
 {
     return(true);
 }
Example #22
0
 public Weakening(BattleUnitStack from) => _from = from;
Example #23
0
 public static void NavigateTo(
     BattleUnitStack from,
     IEnumerable <BattleUnitStack> to,
     AttackMachineState nextState,
     (int, int) values
Example #24
0
 public DeathTouch(BattleUnitStack from) => _from = from;
Example #25
0
 public Haste(BattleUnitStack from) => _from = from;
Example #26
0
 public void Await(BattleUnitStack stack) => _awaitQueue.Add(stack);
Example #27
0
 public PunishmentStrike(BattleUnitStack from) => _from = from;
Example #28
0
 public Curse(BattleUnitStack from) => _from = from;
Example #29
0
 public Resurrection(BattleUnitStack from) => _from = from;
 public abstract double UseAbility(BattleUnitStack attacking, BattleUnitStack defending);