Esempio n. 1
0
        public override void OnAttack(Board board, Card attacker, Card target)
        {
            bool IsAttackingWithHero   = (attacker.Id == board.HeroFriend.Id);
            bool IsAttackingWithWeapon = (board.WeaponFriend != null && attacker.Id == board.WeaponFriend.Id);

            if ((IsAttackingWithHero || IsAttackingWithWeapon) && board.WeaponFriend != null)            //If we attack with weapon equipped
            {
                switch (board.WeaponFriend.Template.Id)
                {
                }
            }

            if (!IsAttackingWithHero && !IsAttackingWithWeapon)
            {
                if (target != null && target.CurrentAtk >= attacker.CurrentHealth && !attacker.IsDivineShield)
                {
                    OnMinionDeath(board, attacker);
                }
            }

            if (BoardHelper.IsFirstMove(board))
            {
                OnFirstAction(board, attacker, target, false, true, false);
            }

            //DebugLog("ATTACKER: " + attacker.Template.Name + ", standard value: " + GetCardValue(board, attacker) + ", added cost: " + WeaponAttackGlobalCost + "; TARGET: " + ", standard value: " + GetCardValue(board, target));
            //DebugBestLog("BEST ATTACKER: " + attacker.Template.Name + ", standard value: " + GetCardValue(board, attacker) + ", added cost: " + WeaponAttackGlobalCost + "; TARGET: " + ", standard value: " + GetCardValue(board, target));
        }
Esempio n. 2
0
        public override void OnCastWeapon(Board board, Card weapon, Card target)
        {
            switch (weapon.Template.Id)
            {
            case Card.Cards.FP1_021:    //Death's Bite, ID: FP1_021
                if (board.WeaponFriend != null && GetThreatModifier(target) == 0)
                {
                    WeaponCastGlobalCost += 10;
                }

                WeaponCastGlobalValue += board.MinionFriend.FindAll(x => _enrageableMinions.Contains(x.Template.Id) && x.CurrentHealth > 1).Count;
                WeaponCastGlobalValue += board.Hand.FindAll(x => _enrageableMinions.Contains(x.Template.Id) && board.ManaAvailable + 1 >= x.CurrentCost).Count;
                break;

            case Card.Cards.CS2_106:    //Fiery War Axe, ID: CS2_106
                if (board.WeaponFriend != null)
                {
                    WeaponCastGlobalCost += 10;
                }
                break;
            }

            if (BoardHelper.IsFirstMove(board))
            {
                OnFirstAction(board, weapon, target, false, false, false);
            }

            //DebugLog("WEAPON: " + weapon.Template.Name + ", standard value: " + GetCardValue(board, weapon) + ", added value: " + WeaponCastGlobalValue + ", added cost: " + WeaponCastGlobalCost + "; TARGET: " + ", standard value: " + GetCardValue(board, target));
            //DebugBestLog("BEST WEAPON: " + weapon.Template.Name + ", standard value: " + GetCardValue(board, weapon) + ", added value: " + WeaponCastGlobalValue + ", added cost: " + WeaponCastGlobalCost + "; TARGET: " + ", standard value: " + GetCardValue(board, target));
        }
Esempio n. 3
0
        public override void OnCastAbility(Board board, Card ability, Card target)
        {
            if (BoardHelper.GetOwnHP(board) <= 15)
            {
                HeroPowerGlobalCost -= 10;
            }
            if (board.TurnCount < 2)
            {
                HeroPowerGlobalCost += 10;
            }
            HeroPowerGlobalCost += 2;

            if (BoardHelper.IsFirstMove(board))
            {
                OnFirstAction(board, ability, target, false, false, true);
            }

            //DebugLog("ABILITY: " + ability.Template.Name + ", standard value: " + GetCardValue(board, ability) + ", added cost: " + HeroPowerGlobalCost + "; TARGET: " + ", standard value: " + GetCardValue(board, target));
            //DebugBestLog("BEST ABILITY: " + ability.Template.Name + ", standard value: " + GetCardValue(board, ability) + ", added cost: " + HeroPowerGlobalCost + "; TARGET: " + ", standard value: " + GetCardValue(board, target));
        }
Esempio n. 4
0
        public override void OnCastSpell(Board board, Card spell, Card target)
        {
            switch (spell.Template.Id)
            {
            case Card.Cards.EX1_392:                    //Battle Rage
                SpellsCastGlobalCost  += 3;
                SpellsCastGlobalValue += board.MinionFriend.FindAll(x => x.CurrentHealth < x.MaxHealth).Count *FriendCardDrawMultiplier + (board.HeroFriend.CurrentHealth < 30 ? 1 : 0) * FriendCardDrawMultiplier;
                break;

            case Card.Cards.CS2_108:                    //Execute
                SpellsCastGlobalCost += MIN_VALUE_EXECUTE;
                break;

            case Card.Cards.EX1_607:                    //Inner Rage
                if (board.MinionEnemy.Contains(target))
                {
                    SpellsCastGlobalCost += 10;
                }
                if (board.MinionFriend.Contains(target))
                {
                    SpellsCastGlobalCost += 8;
                }
                if (board.MinionFriend.Contains(target) && BoardHelper.CanBeEnraged(target, _enrageableMinions) && target.CanAttack)
                {
                    SpellsCastGlobalValue += 4;
                }
                if (board.MinionFriend.Contains(target) && BoardHelper.CanBeEnraged(target, _bestEnrageableMinions) && target.CanAttack)
                {
                    SpellsCastGlobalValue += 10;
                }
                break;

            case Card.Cards.EX1_391:                    //Slam
                if (board.MinionEnemy.Contains(target) && BoardHelper.CanImmediatelyKill(target, spell.CurrentAtk))
                {
                    SpellsCastGlobalCost += 6;
                }
                if (board.MinionEnemy.Contains(target) && !BoardHelper.CanImmediatelyKill(target, spell.CurrentAtk))
                {
                    SpellsCastGlobalCost += 4;
                }

                if (board.MinionFriend.Contains(target) && BoardHelper.CanImmediatelyKill(target, spell.CurrentAtk))
                {
                    SpellsCastGlobalCost += NEVER_PLAY;
                }
                if (board.MinionFriend.Contains(target) && !BoardHelper.CanBeEnraged(target, _bestEnrageableMinions) && board.Hand.Count > 1)
                {
                    SpellsCastGlobalCost += NEVER_PLAY;
                }

                if (board.MinionFriend.Contains(target) && BoardHelper.CanBeEnraged(target, _bestEnrageableMinions))
                {
                    SpellsCastGlobalValue += 2;
                }
                break;

            case Card.Cards.EX1_400:    //Whirlwind
                SpellsCastGlobalCost  += 6;
                SpellsCastGlobalValue += board.MinionEnemy.FindAll(x => x.CurrentHealth == 1).Count * 2 - board.MinionFriend.FindAll(x => x.CurrentHealth == 1).Count * 2;
                SpellsCastGlobalValue += board.MinionFriend.FindAll(x => _enrageableMinions.Contains(x.Template.Id) && !_bestEnrageableMinions.Contains(x.Template.Id) && x.CurrentHealth > 1).Count * 2;
                SpellsCastGlobalValue += board.MinionFriend.FindAll(x => _bestEnrageableMinions.Contains(x.Template.Id) && x.CurrentHealth > 1).Count * 3;
                break;

            case Card.Cards.GAME_005:                    //The Coin
                SpellsCastGlobalCost += GetCoinValue(board);
                break;
            }

            if (BoardHelper.IsFirstMove(board))
            {
                OnFirstAction(board, spell, target, true, false, false);
            }

            //DebugLog("SPELL: " + spell.Template.Name + ", standard value: " + GetCardValue(board, spell) + ", added value: " + SpellsCastGlobalValue + ", added cost: " + SpellsCastGlobalCost + "; TARGET: " + ", standard value: " + GetCardValue(board, target));
            //DebugBestLog("BEST SPELL: " + spell.Template.Name + ", standard value: " + GetCardValue(board, spell) + ", added value: " + SpellsCastGlobalValue + ", added cost: " + SpellsCastGlobalCost + "; TARGET: " + ", standard value: " + GetCardValue(board, target));
        }
Esempio n. 5
0
        public override void OnCastMinion(Board board, Card minion, Card target)
        {
            switch (minion.Template.Id)
            {
            case Card.Cards.EX1_007:                    //Acolyte of Pain, ID: EX1_007
                if (BoardHelper.CanBeImmediatelyKilledByEnemy(board, minion) && board.Hand.Count < CARDS_IN_HAND_THRESHHOLD)
                {
                    MinionCastGlobalCost += GetCardValue(board, minion) * 0.3f;
                }
                break;

            case Card.Cards.EX1_402:                     //Armorsmith, ID: EX1_402
                if (BoardHelper.CanBeImmediatelyKilledByEnemy(board, minion) && !BoardHelper.CanPlayCard(board, _enragingSpells, minion.CurrentCost))
                {
                    MinionCastGlobalCost += GetCardValue(board, minion) * 0.5f;
                }
                break;

            case Card.Cards.EX1_012:                                                                                                                                                                    //Bloodmage Thalnos, ID: EX1_012
                if (BoardHelper.CanBeImmediatelyKilledByEnemy(board, minion) || board.Hand.Count > CARDS_IN_HAND_THRESHHOLD || !BoardHelper.CanPlayCard(board, Card.Cards.EX1_400, minion.CurrentCost)) // EX1_400 - whirlwind
                {
                    MinionCastGlobalCost += GetCardValue(board, minion) * 0.5f;
                }
                break;

            case Card.Cards.EX1_603:                     //Cruel Taskmaster, ID: EX1_603
                if ((target.CurrentHealth == 1 && !BoardHelper.IsOwnMinion(board, target)) || BoardHelper.CanEnrageOrGetArmor(board, _enragingSpells, _enrageableMinions) || BoardHelper.CanExecute(board, MIN_VALUE_EXECUTE, minion.CurrentCost))
                {
                    MinionCastGlobalValue += 0;     // GetCardValue(board, minion) * 1.3f;
                }
                else
                {
                    MinionCastGlobalCost += GetCardValue(board, minion) * 0.5f;
                }
                break;

            case Card.Cards.NEW1_022:                    //Dread Corsair, ID: NEW1_022
                if (BoardHelper.CanPlayDreadCorsair(board, minion))
                {
                    MinionCastGlobalValue += GetCardValue(board, minion) * 1.3f;
                }
                else
                {
                    MinionCastGlobalCost += GetCardValue(board, minion) * 0.5f;
                }
                break;

            case Card.Cards.GVG_110:                    //Dr. Boom
                break;

            case Card.Cards.EX1_604:    //Frothing Berserker
                if (BoardHelper.CanBeImmediatelyKilledByEnemy(board, minion) && !BoardHelper.CanCharge(board, minion) && !BoardHelper.CanPlayTaunt(board, minion.CurrentCost))
                {
                    MinionCastGlobalCost += GetCardValue(board, minion) * 0.5f;
                }
                if (!BoardHelper.CanBePlayedAndEnraged(board, _enragingSpells, minion) || !BoardHelper.CanCharge(board, minion) || !BoardHelper.CanPlayTaunt(board, minion.CurrentCost))
                {
                    MinionCastGlobalCost += GetCardValue(board, minion) * 0.3f;
                }
                break;

            case Card.Cards.CS2_147:    //Gnomish Inventor
                break;

            case Card.Cards.BRM_019:    //Grim Patron
                if ((BoardHelper.CanBeImmediatelyKilledByEnemy(board, minion) && !BoardHelper.CanBePlayedAndEnraged(board, _enragingSpells, minion)) || !(BoardHelper.CanCharge(board, minion) && BoardHelper.AnyEnemyTargets(board, 2)))
                {
                    MinionCastGlobalCost += GetCardValue(board, minion) * 2f;
                }
                break;

            case Card.Cards.EX1_084:    //Warsong Commander
                if (!BoardHelper.CanPlayWarsongCommander(board, minion))
                {
                    MinionCastGlobalCost += GetCardValue(board, minion) * 2f;
                }
                break;

            case Card.Cards.BRMA03_1:    //Emperor Thaurissan
                if (board.Hand.Count < 3)
                {
                    MinionCastGlobalCost += GetCardValue(board, minion) * 0.5f;
                }
                if (board.Hand.Count > 5)
                {
                    MinionCastGlobalValue += GetCardValue(board, minion) * 1.2f;
                }
                break;

            case Card.Cards.EX1_414:    //Grommash Hellscream, ID: EX1_414
                if (!BoardHelper.CanBePlayedAndEnraged(board, _enragingSpells, minion))
                {
                    MinionCastGlobalCost += GetCardValue(board, minion) * 0.5f;
                }
                break;

            case Card.Cards.FP1_024:    //Unstable Ghoul, ID: FP1_024
                if (board.MinionEnemy.Count == 0 || !BoardHelper.CanEnrageOrGetArmor(board, _enragingSpells, _enrageableMinions))
                {
                    MinionCastGlobalCost += GetCardValue(board, minion) * 0.5f;
                }
                break;
            }

            if (BoardHelper.IsFirstMove(board))
            {
                OnFirstAction(board, minion, target, true, false, false);
            }

            //DebugLog("MINION: " + minion.Template.Name + ", standard value: " + GetCardValue(board, minion) + ", added value: " + MinionCastGlobalValue + ", added cost: " + MinionCastGlobalCost + "; TARGET: " + ", standard value: " + GetCardValue(board, target));
            //DebugBestLog("BEST MINION: " + minion.Template.Name + ", standard value: " + GetCardValue(board, minion) + ", added value: " + MinionCastGlobalValue + ", added cost: " + MinionCastGlobalCost + "; TARGET: " + ", standard value: " + GetCardValue(board, target));
        }