Exemple #1
0
 public override void Unleash(Hero hero)
 {
     int mana = Dice.Throw(10);
     hero.Mana -= mana;
     this.Hero.Mana += mana;
     hero.Mana -= ManaConsumption;
     Combat.Log.Add(string.Format("{0} pontos de mana roubado de {1}. {2} Está com {3} pontos de mana e {1} com {4}.", mana, hero.Name, this.Hero.Name, this.Hero.Mana, hero.Mana));
 }
Exemple #2
0
        public override void Unleash(Hero hero)
        {
            int damage = Dice.Throw(30);
            hero.Defense -= damage;
            hero.Mana -= ManaConsumption;

            if (damage > 0)
                Combat.Log.Add(string.Format("{0} usou {1} em {2}. Dano: {3}; {4} pontos de mana gastos, restando {5}", this.Hero.Name, Name, hero.Name, damage, ManaConsumption, hero.Mana));
            else
                Combat.Log.Add(string.Format("{0} ERROU {1} em {2}. {3} pontos de mana gastos, restando {4}", this.Hero.Name, Name, hero.Name, ManaConsumption, hero.Mana));
        }
Exemple #3
0
        public override void Unleash(Hero hero)
        {
            int lifeToHeal = 0;
            for (int i=0; i<hero.Level; i++)
            {
                lifeToHeal += Dice.Throw(6);
            }

            hero.Life += lifeToHeal;
            if (hero.Life > hero.TotalLife) hero.Life = hero.TotalLife;
            hero.Mana -= ManaConsumption;
            Combat.Log.Add(string.Format("{0} teve {1} pontos de vida recuperados e perdeu {2} pontos de mana", Name, lifeToHeal, ManaConsumption));
        }
Exemple #4
0
        public override void Unleash(Hero hero)
        {
            int damage = Combat.Duel(hero.Attack, hero.Defense, hero.Damage, ref status);
            ResolveDamage(this.Hero, hero, damage, damage, status);
            hero.Mana -= ManaConsumption;

            #region LOG
            if (status == Combat.DuelResultStatus.Hit || status == Combat.DuelResultStatus.CriticalHit)
                Combat.Log.Add(string.Format("{0} usou {1} em {2}. Dano: {3}; {4} pontos de mana gastos, restando {5}", this.Hero.Name, Name, hero.Name, damage, ManaConsumption, hero.Mana));
            else if (status == Combat.DuelResultStatus.CriticalError)
                Combat.Log.Add(string.Format("{0} Errou {1} em {2} e se feriu. {3} pontos de mana gastos, restando {4}, {5} pontos de vida perdido", this.Hero.Name, Name, hero.Name, ManaConsumption, hero.Mana, damage));
            else
                Combat.Log.Add(string.Format("{0} ERROU {1} em {2}. {3} pontos de mana gastos, restando {4}", this.Hero.Name, Name, hero.Name, ManaConsumption, hero.Mana));
            #endregion
        }
Exemple #5
0
        public override void Unleash(Hero hero)
        {
            Combat.Duel(hero.Attack, hero.Defense, hero.Damage, ref status);
            ResolveDamage(this.Hero, hero, 100, 200, status);
            hero.Mana -= ManaConsumption;

            #region LOG
            if (status == Combat.DuelResultStatus.Hit)
                Combat.Log.Add(string.Format("{0} usou {1} em {2}. Dano: {3}; {4} pontos de mana gastos, restando {5}", this.Hero.Name, Name, hero.Name, "100", ManaConsumption, hero.Mana));
            else if (status == Combat.DuelResultStatus.CriticalHit)
                Combat.Log.Add(string.Format("{0} usou {1} em {2}. Dano: {3}; {4} pontos de mana gastos, restando {5}", this.Hero.Name, Name, hero.Name, "200", ManaConsumption, hero.Mana));
            else if (status == Combat.DuelResultStatus.CriticalError)
                Combat.Log.Add(string.Format("{0} usou {1} em {2} mas acabou <u>se ferindo no processo</u>. Dano: {3}; {4} pontos de mana gastos, restando {5}", this.Hero.Name, Name, hero.Name, "200", ManaConsumption, hero.Mana));
            else
                Combat.Log.Add(string.Format("{0} ERROU {1} em {2}. {3} pontos de mana gastos, restando {4}", this.Hero.Name, Name, hero.Name, ManaConsumption, hero.Mana));
            #endregion LOG
        }
Exemple #6
0
        public int Fight(HeroPower power, Hero defender, List<Unit> defenders)
        {
            if (this.Life <= 0)
                Combat.Log.Add("Erro de lógica: herói morto tentando atacar");

            int unitsAffected = 0;
            string defenderName = "unidades";
            if (defender != null)
                defenderName = defender.Name;

            Combat.Log.Add(string.Format("<span class='{3}'>{0}</span> luta contra <span class='{4}'>{1}</span>. Preparando poder <span class='powerName'>{2}</span>", Name, power.PriorityTarget == HeroPower.TargetType.hero? defenderName : "unidades inimigas", power.Name, this.PositionInCombat == Character.CombatPosition.attacker? "attacker" : "defender", this.PositionInCombat == Character.CombatPosition.attacker? "defender" : "attacker"));

            if (Mana - power.ManaConsumption >= 0){
                if (power.PriorityTarget == HeroPower.TargetType.hero)
                {
                    if (defender != null && defender.Life > 0)
                    {
                        power.Unleash(defender);
                        if (defender != null && defender.Life <=0) Combat.Log.Add(string.Format("<div class='rip'>{0} morreu pelas mãos de {1}</div>", defender.Name, this.Name));
                    }
                    else if (defenders.Count > 0) unitsAffected = power.Unleash(defenders);
                }
                else
                {
                    if (defenders.Count > 0)
                        unitsAffected = power.Unleash(defenders);
                    else if (defender != null && defender.Life > 0)
                        power.Unleash(defender);
                }
            }
            else
            {
                Combat.Log.Add(string.Format("{0} não possui mana suficiente ({1}/{2})", Name, Mana, power.ManaConsumption));
                AttackEnemy(defender);
            }

            power.Executed = true;

            if (this.Life <= 0) Combat.Log.Add(string.Format("<div class='rip'>{0} morreu por um erro crítico de combate</div>", this.Name));

            return unitsAffected;
        }
Exemple #7
0
        public static Hero GetHero(int type, string name)
        {
            Hero hero = null;
            switch (type)
            {
                case 1:
                    hero = new Hero(50, 50, 500, 200, 20, type, name);
                    break;
                case 2:
                    hero = new Hero(10, 10, 400, 170, 30, type, name);
                    break;
                case 3:
                    hero = new Hero(200, 30, 100, 40, 300, type, name);
                    break;
                case 4:
                    hero = new Hero(100, 100, 100, 100, 100, type, name);
                    break;
                case 5:
                    hero = new Hero(90, 150, 200, 30, 200, type, name);
                    break;
            }

            return hero;
        }
Exemple #8
0
 public Lightning(Hero hero, TargetType target)
     : base(target)
 {
     StartInstance(hero);
 }
Exemple #9
0
 public virtual void Unleash(Hero hero)
 {
     throw new NotImplementedException ();
 }
Exemple #10
0
 public MagicArrow(Hero hero)
 {
     StartInstance(hero);
 }
Exemple #11
0
 public DrainMana(Hero hero)
 {
     StartInstance(hero);
 }
Exemple #12
0
 private void StartInstance(Hero hero)
 {
     this.Name = "Enfraquecimento";
     this.Hero = hero;
     this.ManaConsumption = 20;
 }
Exemple #13
0
        public void RemoveHeroPowersFromList(Hero hero)
        {
            for (int i = Powers.Count - 1; i >= 0; i--) {
                if (Powers[i].Hero == hero) Powers.RemoveAt(i);
            }

            //this.Heroes.Remove(hero);
        }
Exemple #14
0
 public Heal(Hero hero)
 {
     StartInstance(hero);
 }
Exemple #15
0
 public Weaken(Hero hero, TargetType target)
     : base(target)
 {
     StartInstance(hero);
 }
Exemple #16
0
 protected void ResolveDamage(Hero attacker, Hero defender, int damage, int criticalDamage, Combat.DuelResultStatus status)
 {
     if (status == Combat.DuelResultStatus.Hit)
         defender.Life -= damage;
     else if (status == Combat.DuelResultStatus.CriticalHit)
         defender.Life -= criticalDamage;
     else if (status == Combat.DuelResultStatus.CriticalError)
         attacker.Life -= damage;
 }
Exemple #17
0
 private void StartInstance(Hero hero)
 {
     this.Hero = hero;
     this.Name = "Cura";
     this.ManaConsumption = 2;
 }
Exemple #18
0
 public Heal(Hero hero, TargetType target)
     : base(target)
 {
     StartInstance(hero);
 }
Exemple #19
0
 public MagicArrow(Hero hero, TargetType target)
     : base(target)
 {
     StartInstance(hero);
 }
Exemple #20
0
        private void AttackEnemy(Hero defender)
        {
            if (defender != null)
            {
                int damage = Combat.Duel(Attack, defender.Defense, Damage, ref status);

                if (status == Combat.DuelResultStatus.Hit || status == Combat.DuelResultStatus.CriticalHit){
                    defender.Life -= damage;
                    Combat.Log.Add(string.Format("<span class='heroAttacker'>{0}</span> agredindo <span class='heroDefender'> {1}</span>. Dano: {2}", Name, defender.Name, damage));
                }
                else if (status == Combat.DuelResultStatus.CriticalError){
                    this.Life -= damage;
                    Combat.Log.Add(string.Format("<span class='heroAttacker'>{0}</span> tentou agredir <span class='heroDefender'> {1}</span>, mas acabou se ferindo.", Name, defender.Name));
                }
                else Combat.Log.Add(string.Format("<span class='heroAttacker'>{0}</span> tentou agredir <span class='heroDefender'> {1}</span>, mas o adversário esquivou-se.", Name, defender.Name));
            }
        }
Exemple #21
0
 private void StartInstance(Hero hero)
 {
     Name = "Relâmpago";
     this.Hero = hero;
     this.ManaConsumption = 10;
 }
Exemple #22
0
 private void StartInstance(Hero hero)
 {
     Name = "Chicote de rosas";
     this.Hero = hero;
     this.ManaConsumption = 16;
 }
Exemple #23
0
 public Lightning(Hero hero)
 {
     StartInstance(hero);
 }
Exemple #24
0
 public DrainMana(Hero hero, TargetType target)
     : base(target)
 {
     StartInstance(hero);
 }
Exemple #25
0
 public RoseWhip(Hero hero)
 {
     StartInstance(hero);
 }
Exemple #26
0
 protected void ResolveDamage(Hero hero, Unit unit, int damage, int criticalDamage, Combat.DuelResultStatus status)
 {
     if (status == Combat.DuelResultStatus.Hit)
         unit.Life -= damage;
     else if (status == Combat.DuelResultStatus.CriticalHit)
         unit.Life -= criticalDamage;
     else if (status == Combat.DuelResultStatus.CriticalError)
         hero.Life -= damage;
 }
Exemple #27
0
 public Weaken(Hero hero)
 {
     StartInstance(hero);
 }
Exemple #28
0
 private void StartInstance(Hero hero)
 {
     Name = "Roubo de mana";
     this.Hero = hero;
     this.ManaConsumption = 5;
 }
Exemple #29
0
 private void PreparePowers(Hero hero)
 {
     hero.Powers = new List<HeroPower>();
     switch (hero.Type)
     {
         case 1: hero.Powers.Add(new Lightning(hero));    hero.Powers.Add(new Weaken(hero)); break;
         case 2: hero.Powers.Add(new RoseWhip(hero));     hero.Powers.Add(new Weaken(hero, HeroPower.TargetType.units)); break;
         case 3: hero.Powers.Add(new MagicAttack(hero));  hero.Powers.Add(new Weaken(hero)); break;
         case 4: hero.Powers.Add(new MagicArrow(hero));   hero.Powers.Add(new Heal(hero, HeroPower.TargetType.units)); hero.Powers.Add(new MagicAttack(hero)); break;
         case 5: hero.Powers.Add(new MagicAttack(hero, HeroPower.TargetType.units));  hero.Powers.Add(new Heal(hero, HeroPower.TargetType.units));break;
     }
 }
Exemple #30
0
 private void StartInstance(Hero hero)
 {
     Name = "Flechas mágicas";
     this.Hero = hero;
     this.ManaConsumption = 12;
 }