Exemple #1
0
        float calcDamageValue(THHGame game, THHPlayer player, THHPlayer opponent, Card target, int damage)
        {
            float value = 0;

            if (target == opponent.master)
            {
                value = target.getCurrentLife(game) > damage ? damage : float.MaxValue;
            }
            else if (opponent.field.Contains(target))
            {
                value = target.getCurrentLife(game) > damage?target.getAttack(game) * damage : target.getAttack(game) * target.getCurrentLife(game) + 1;
            }
            return(value);
        }
Exemple #2
0
        float calcBuffValue(THHGame game, THHPlayer player, THHPlayer opponent, Card target, int attack, int life)
        {
            float value = 0;

            if (target == player.master)
            {
                value = attack * target.getCurrentLife(game) + life;
            }
            else if (player.field.Contains(target))
            {
                value = calcServantValue(game, player, opponent, target.getAttack(game) + attack, target.getCurrentLife(game) + life)
                        - calcServantValue(game, player, opponent, target.getAttack(game), target.getLife(game));
            }
            return(value);
        }
Exemple #3
0
        public void update(TouhouCardEngine.Card card, CardSkinData skin)
        {
            this.card = card;

            Image.sprite = skin.image;
            if (card.getAttack() > 0)
            {
                AttackText.text = card.getAttack().ToString();
                AttackImage.gameObject.SetActive(true);
            }
            else
            {
                AttackImage.gameObject.SetActive(false);
            }
            DurabilityText.text = card.getCurrentLife().ToString();
        }
        public void update(Table table, THHPlayer player, TouhouCardEngine.Card card, CardSkinData skin)
        {
            this.card = card;

            Image.sprite = skin.image;
            HpText.text  = card.getCurrentLife().ToString();
            //if (card.getCurrentLife() == card.getLife())
            //    HpText.color = Color.white;
            //else
            //    HpText.color = Color.red;
            if (card.getAttack() > 0)
            {
                AttackText.text    = card.getAttack().ToString();
                AttackText.enabled = true;
            }
            else
            {
                AttackText.enabled = false;
            }
            if (card.getArmor() > 0)
            {
                ArmorText.text    = card.getArmor().ToString();
                ArmorText.enabled = true;
            }
            else
            {
                ArmorText.enabled = false;
            }

            if (table.selectableTargets != null && table.selectableTargets.Contains(this))
            {
                HighlightController = Highlight.Yellow;
            }
            else if (table.player == player && table.game.currentPlayer == player && card.canAttack(table.game, player))
            {
                HighlightController = Highlight.Green;
            }
            else
            {
                HighlightController = Highlight.None;
            }
        }
Exemple #5
0
 float calcServantValue(THHGame game, THHPlayer player, THHPlayer opponent, Card servant)
 {
     return(calcServantValue(game, player, opponent, servant.getAttack(game), servant.getCurrentLife(game)));
 }
Exemple #6
0
        float calcActionValue(Response response, THHGame game, THHPlayer player, THHPlayer opponent)
        {
            float value = 0;

            if (response is UseResponse use)
            {
                Card card   = game.getCard(use.cardId);
                Card target = use.targetsId.Length > 0 ? game.getCard(use.targetsId[0]) : null;
                value = card.getCost(game);
                if (card.define is LuckyCoin)
                {
                    value = 1;
                }
                else if (card.define is SummerFire)
                {
                    value = calcDamageValue(game, player, opponent, target, 1);
                }
                else if (card.define is AutumnEdge)
                {
                    value = calcRandomDamageValue(game, player, opponent, opponent.field, 2);
                }
                else if (card.define is SpringWind)
                {
                    value = calcBuffValue(game, player, opponent, target, 0, 2);
                }
                else if (card.define is WinterElement)
                {
                    value = calcFreezeValue(game, player, opponent, target);
                }
                else if (card.define is SummerFire)
                {
                    value = calcBuffValue(game, player, opponent, target, 2, 0);
                }
                else if (card.define is DoyouSpear)
                {
                    value = calcServantValue(game, player, opponent, 1, 1);
                }
                else if (card.define is MultiCast)
                {
                    value = player.hand.Where(c => c.isSpell() && c.getCost(game) > 1).Count() > 0 ? 2 : 0;
                }
                else if (card.define is TheGreatLibrary)
                {
                    value = 1;
                }
                else if (card.define is BestMagic)
                {
                    value = 5;
                }
                else if (card.define is ArcaneKnowledge)
                {
                    value = 4;
                }
                else if (card.define is PhilosopherStone)
                {
                    value = 2;
                }
                else if (card.define is MetalFatigue)
                {
                    value = calcAOEDamageValue(game, player, opponent, opponent.field, 3);
                }
                else if (card.define is SylphyHorn)
                {
                    value = calcBuffValue(game, player, opponent, target, 3, 6);
                }
                else if (card.define is PrincessUndine)
                {
                    value = calcAOEDamageValue(game, player, opponent, player.field, 3);
                }
                else if (card.define is AgniShine)
                {
                    value = calcDamageValue(game, player, opponent, target, 7);
                }
                else if (card.define is TrilithonShake)
                {
                    value = calcServantValue(game, player, opponent, 3, 9);
                }
                else if (card.define is RoyalFlare)
                {
                    value = calcDamageValue(game, player, opponent, opponent.master, 15);
                }
                else if (card.define is SilentSelene)
                {
                    value = calcServantsValue(game, player, opponent, opponent.field);
                }
                else if (card.define is ElementalHarvester)
                {
                    value = calcAOEDamageValue(game, player, opponent, opponent.field, 2);
                }
                else if (card.define is BurgeoningRise)
                {
                    value = calcBuffValue(game, player, opponent, target, 3, 3) + (target.getOwner() == player ? calcServantValue(game, player, opponent, target) - 1 : 0);
                }
                else if (card.define is PhlogisticRain)
                {
                    value = calcRandomDamageValue(game, player, opponent, opponent.field.Append(opponent.master), 1) * 6;
                }
                else if (card.define is StElmoPillar)
                {
                    value = calcDamageValue(game, player, opponent, target, 6);
                }
                else if (card.define is NoachianDeluge)
                {
                    value = calcServantValue(game, player, opponent, 2, 2) + 1;
                }
                else if (card.define is MercuryPoison)
                {
                    value = calcAOEDamageValue(game, player, opponent, opponent.field, 3);
                }
                else if (card.define is ForestBlaze)
                {
                    value = calcBuffAllValue(game, player, opponent, player.field, 2, 2) + calcRandomDamageValue(game, player, opponent, opponent.field, 1) * player.field.count;
                }
                else if (card.define is WaterElf)
                {
                    value = calcBuffValue(game, player, opponent, target, 3, 6 + target.getLife(game) - target.getCurrentLife(game)) + 1;
                }
                else if (card.define is LavaCromlech)
                {
                    value = (calcServantValue(game, player, opponent, 2, 2) + calcRandomDamageValue(game, player, opponent, opponent.field, 2)) * 3;
                }
                else if (card.define is GingerGust)
                {
                    value = (calcServantValue(game, player, opponent, 3, 1) + 1) * opponent.field.count;
                }
            }
            return(value);
        }