当前位置: 首页>>代码示例>>C#>>正文


C# Card.GetEntity方法代码示例

本文整理汇总了C#中Card.GetEntity方法的典型用法代码示例。如果您正苦于以下问题:C# Card.GetEntity方法的具体用法?C# Card.GetEntity怎么用?C# Card.GetEntity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Card的用法示例。


在下文中一共展示了Card.GetEntity方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HandleClickOnCardInBattlefield

        public static void HandleClickOnCardInBattlefield(Card c)
        {
            Entity e = c.GetEntity();

            InputManager input_mgr = InputManager.Get();
            MethodInfo dynMethod = input_mgr.GetType().GetMethod("HandleClickOnCardInBattlefield", BindingFlags.NonPublic | BindingFlags.Instance);
            dynMethod.Invoke(input_mgr, new object[] { e });
        }
开发者ID:sina-,项目名称:HearthstoneBot,代码行数:8,代码来源:PrivateHacker.cs

示例2: PlayEmergencyCard

        private static RockAction PlayEmergencyCard(int resource, List<Card> crads, Card hero, Card hero_enemy, int attack_count_enemy)
        {
            RockAction action = new RockAction();

            // best fit taunt
            foreach (Card card in crads)
            {
                if (resource < card.GetEntity().GetCost())
                {
                    continue;
                }
                if (card.GetEntity().IsMinion() && card.GetEntity().HasTaunt() && GameState.Get().GetFriendlySidePlayer().GetBattlefieldZone().GetCards().Count < 7 && (card.GetEntity().GetCost() == resource || ((card.GetEntity().GetCost() == resource - 2) && HeroSpellReady)))
                {
                    action.type = HEARTHROCK_ACTIONTYPE.PLAY;
                    action.card1 = card;
                    return action;
                }
            }

            // if hero has less health, need more emergency taunt
            if ((hero.GetEntity().GetHealth() - attack_count_enemy) < 10)
            {
                // not perfect fit taunt
                foreach (Card card in crads)
                {

                    if (resource < card.GetEntity().GetCost())
                    {
                        continue;
                    }
                    // waste a cost
                    if (card.GetEntity().IsMinion() && card.GetEntity().HasTaunt() && GameState.Get().GetFriendlySidePlayer().GetBattlefieldZone().GetCards().Count < 7 && (card.GetEntity().GetCost() == resource - 1 || ((card.GetEntity().GetCost() == resource - 3) && HeroSpellReady)))
                    {
                        action.type = HEARTHROCK_ACTIONTYPE.PLAY;
                        action.card1 = card;
                        return action;
                    }
                }
            }

            // if hero has more health, play as much charge as possible
            if ((hero.GetEntity().GetHealth() - hero_enemy.GetEntity().GetHealth()) > 10)
            {
                foreach (Card card in crads)
                {
                    if (resource < card.GetEntity().GetCost())
                    {
                        continue;
                    }

                    // waste a cost
                    if (card.GetEntity().IsMinion() && GameState.Get().GetFriendlySidePlayer().GetBattlefieldZone().GetCards().Count < 7)
                    {
                        if (card.GetEntity().HasCharge())
                        {
                            action.type = HEARTHROCK_ACTIONTYPE.PLAY;
                            action.card1 = card;
                            return action;
                        }
                    }
                }
            }
            return null;
        }
开发者ID:sunsrising,项目名称:hearthrock,代码行数:64,代码来源:HearthrockRobot.cs

示例3: Extract

        private static object Extract(Card card)
        {
            if (card == null) return null;
            var e = card.GetEntity();
            return new
            {
                hasTargets = GameState.Get().EntityHasTargets(e),
                hasSubOptions = GameState.Get().EntityHasSubOptions(e),
                //playSpell = Extract(card.GetPlaySpell()),

                //actorPowerUpSpell = Extract(card.GetActorSpell(SpellType.POWER_UP)),
                //actorAttackSpell = Extract(card.GetActorSpell(SpellType.ATTACK)),
                //actorAutoCast = Extract(card.GetActorSpell(SpellType.AUTO_CAST)),
                //actorBattlecrySpell = Extract(card.GetActorSpell(SpellType.BATTLECRY)),
                //actorChargeSpell = Extract(card.GetActorSpell(SpellType.CHARGE)),
                //actorDamageSpell = Extract(card.GetActorSpell(SpellType.DAMAGE)),
                //actorEnrageSpell = Extract(card.GetActorSpell(SpellType.ENRAGE)),
                //actorDeathSpell = Extract(card.GetActorSpell(SpellType.DEATH)),
                //attackSpell = Extract(card.GetAttackSpell()),
                //lifetimeSpell = Extract(card.GetLifetimeSpell()),
                //bestDeathSpell = Extract(card.GetBestDeathSpell()),
                //bestSpawnSpell = Extract(card.GetBestSpawnSpell()),
                //bestSummonSpell = Extract(card.GetBestSummonSpell()),
                name = e.GetName(),
                health = e.GetHealth(),
                remainingHealth = e.GetRemainingHealth(),
                armor = e.GetArmor(),
                attack = e.GetATK(),
                durability = e.GetDurability(),
                cost = e.GetCost(),
                controller = Extract(e.GetControllerSide()),
                debugName = e.GetDebugName(),
                canAttack = e.CanAttack(),
                numAttacksThisTurn = e.GetNumAttacksThisTurn(),
                numTurnsInPlay = e.GetNumTurnsInPlay(),
                race = e.GetRaceText(),
                //rarity = e.GetRarity(),
                spellpower = e.GetSpellPower(),
                windfury = e.GetWindfury(),
                zone_position = e.GetZonePosition(),
                tags = ExtractTags(e.GetTags()),
                // TODO: What is the difference between hasX and just X?
                hasAura = e.HasAura(),
                hasBattlecry = e.HasBattlecry(),
                hasCombo = e.HasCombo(),
                hasDeathrattle = e.HasDeathrattle(),
                hasDivineShield = e.HasDivineShield(),
                hasInspire = e.HasInspire(),
                // hasEvilGlow = e.HasEvilGlow(),
                hasCharge = e.HasCharge(), 
                hasOverload = e.HasOverload(),
                hasSpellpower = e.HasSpellPower(),
                hasSpellpowerDouble = e.HasSpellPowerDouble(),
                hasTaunt = e.HasTaunt(),
                hasWindfury = e.HasWindfury(),
                // TODO: referencesX rather than hasX?
                affectedBySpellpower = e.IsAffectedBySpellPower(),
                originalAttack = e.GetOriginalATK(),
                originalCharge = e.GetOriginalCharge(),
                originalCost = e.GetOriginalCost(),
                originalHealth = e.GetOriginalHealth(),
                isWeapon = e.IsWeapon(),
                //hasTargets = GameState.Get().EntityHasTargets(e),
                isAsleep = e.IsAsleep(),
                isDamaged = e.IsDamaged(),
                isEnchanted = e.IsEnchanted(),
                isElite = e.IsElite(),
                isEnraged = e.IsEnraged(),
                isFrozen = e.IsFrozen(),
                isFreeze = e.IsFreeze(),
                isPoisonous = e.IsPoisonous(),
                isSecret = e.IsSecret(),
                isStealthed = e.IsStealthed(),
                isToken = e.IsToken(),
                isMinion = e.IsMinion(),
                isImmune = e.IsImmune()

            };
        }
开发者ID:vlthr,项目名称:hearthomaton,代码行数:79,代码来源:State.cs

示例4: DoDropMinion

        public bool DoDropMinion(Card c)
        {
            Log.log("Dropping minion " + c.GetEntity().GetName());
            try
            {
                var destZone = myPlayer.GetBattlefieldZone();
                int slot = destZone.GetCards().Count + 1;
                gs.GetGameEntity().NotifyOfCardDropped(c.GetEntity());
                gs.SetSelectedOptionPosition(slot);
                if (InputManager.Get().DoNetworkResponse(c.GetEntity()))
                {
                    int zonePos = c.GetEntity().GetZonePosition();
                    ZoneMgr.Get().AddLocalZoneChange(c, destZone, slot);

                    myPlayer.GetHandZone().UpdateLayout(-1, true);
                    myPlayer.GetBattlefieldZone().SortWithSpotForHeldCard(-1);

                    if (gs.GetResponseMode() != GameState.ResponseMode.SUB_OPTION)
                    {
                        EnemyActionHandler.Get().NotifyOpponentOfCardDropped();
                    }
                    Log.log("Dropping minion succeeded");
                    return true;

                    // TARGETTING - perhaps spin this off to a separate step
                    /*
                    if (gs.EntityHasTargets(c.GetEntity()))
                    {
                        // do targetting
                        EnemyActionHandler.Get().NotifyOpponentOfTargetModeBegin(c);
                        Thread.Sleep(500);
                        gs.GetGameEntity().NotifyOfBattlefieldCardClicked(target.GetEntity(), true);
                        if (InputManager.Get().DoNetworkResponse(target.GetEntity()))
                        {
                            EnemyActionHandler.Get().NotifyOpponentOfTargetEnd();
                            return true;
                        }
                        return false;
                    }
                    else if (gs.GetResponseMode() != GameState.ResponseMode.SUB_OPTION)
                    {
                        EnemyActionHandler.Get().NotifyOpponentOfCardDropped();
                        return true;
                    }
                    else
                    {
                        // TODO: unsure when this happens
                        return true;
                    }
                    */
                }
                Log.log("Dropping minion failed (network response)");
                return false;
            }
            catch (Exception ex)
            {
                Log.log("Dropping minion failed (exception): " + ex.StackTrace.ToString());
                return false;
            }
            finally
            {
                Thread.Sleep(1000 * 2);
            }
        }
开发者ID:pgrimaud,项目名称:Sigmund,代码行数:64,代码来源:Plugin.cs

示例5: DoAttack

        public bool DoAttack(Card attacker, Card attackee)
        {
            Log.log("Attack " + attacker.GetEntity().GetName() + " -> " + attackee.GetEntity().GetName());

            try
            {
                // pick up minion
                gs.GetGameEntity().NotifyOfCardGrabbed(attacker.GetEntity());
                if (InputManager.Get().DoNetworkResponse(attacker.GetEntity()))
                {
                    EnemyActionHandler.Get().NotifyOpponentOfCardPickedUp(attacker);

                    Thread.Sleep(500);

                    Log.log("attacking with picked up minion");
                    // attack with picked up minion
                    EnemyActionHandler.Get().NotifyOpponentOfTargetModeBegin(attacker);
                    Thread.Sleep(500);
                    gs.GetGameEntity().NotifyOfBattlefieldCardClicked(attackee.GetEntity(), true);
                    if (InputManager.Get().DoNetworkResponse(attackee.GetEntity()))
                    {
                        EnemyActionHandler.Get().NotifyOpponentOfTargetEnd();

                        myPlayer.GetHandZone().UpdateLayout(-1, true);
                        myPlayer.GetBattlefieldZone().UpdateLayout();
                        Log.log("DoAttack succeeded");
                        return true;
                    }
                }
                return false;
            }
            catch (Exception ex)
            {
                Log.log("DoAttack failed" + ex.StackTrace.ToString());
                return false;
            }
            finally
            {
                Thread.Sleep(1000 * 2);
            }
        }
开发者ID:pgrimaud,项目名称:Sigmund,代码行数:41,代码来源:Plugin.cs

示例6: HandleClickOnCardInBattlefield

 public static void HandleClickOnCardInBattlefield(Card c)
 {
     call_private_method(InputManager.Get(), "HandleClickOnCardInBattlefield", new object[] { c.GetEntity() });
 }
开发者ID:bood,项目名称:HearthstoneBot,代码行数:4,代码来源:PrivateHacker.cs

示例7: attack

        public static void attack(Card c)
        {
            Log.log("Attack: " + c.GetEntity().GetName());

            PrivateHacker.HandleClickOnCardInBattlefield(c);
        }
开发者ID:resaka,项目名称:HearthstoneBot,代码行数:6,代码来源:API.cs

示例8: drop_card

        public static bool drop_card(Card c, bool pickup)
        {
            Log.log("Dropped card: " + c.GetEntity().GetName());

            if (pickup)
            {
                PrivateHacker.GrabCard(c);
            }
            else
            {
                return drop_held_card();
            }
            return false;
        }
开发者ID:resaka,项目名称:HearthstoneBot,代码行数:14,代码来源:API.cs

示例9: __csharp_is_card_tank

 public bool __csharp_is_card_tank(Card c)
 {
     Entity entity = c.GetEntity();
     return entity.HasTaunt();
 }
开发者ID:hemotox,项目名称:HearthstoneBot,代码行数:5,代码来源:API.cs

示例10: __csharp_convert_to_entity

 public Entity __csharp_convert_to_entity(Card c)
 {
     return c.GetEntity();
 }
开发者ID:resaka,项目名称:HearthstoneBot,代码行数:4,代码来源:API.cs

示例11: __csharp_is_card_a_minion

 public bool __csharp_is_card_a_minion(Card c)
 {
     Entity entity = c.GetEntity();
     return (entity.GetCardType() == TAG_CARDTYPE.MINION);
 }
开发者ID:hemotox,项目名称:HearthstoneBot,代码行数:5,代码来源:API.cs

示例12: __csharp_get_card_cost

 public int __csharp_get_card_cost(Card c)
 {
     Entity entity = c.GetEntity();
     return entity.GetCost();
 }
开发者ID:hemotox,项目名称:HearthstoneBot,代码行数:5,代码来源:API.cs

示例13: drop_card

        public static bool drop_card(Card c, bool pickup)
        {
            Log.log("Dropped card: " + c.GetEntity().GetName());

            InputManager input_mgr = InputManager.Get();
            if (pickup)
            {
                GameObject ob = c.gameObject;

                MethodInfo dynMethod = input_mgr.GetType().GetMethod("GrabCard", BindingFlags.NonPublic | BindingFlags.Instance);
                dynMethod.Invoke(input_mgr, new object[] { ob });
            }
            else
            {
                MethodInfo dynMethod = input_mgr.GetType().GetMethod("DropHeldCard", BindingFlags.NonPublic | BindingFlags.Instance, null, new Type[]{}, null);
                return (bool) dynMethod.Invoke(input_mgr, null);
            }
            return false;
        }
开发者ID:hemotox,项目名称:HearthstoneBot,代码行数:19,代码来源:API.cs

示例14: HandleClickOnSubOption

 public static void HandleClickOnSubOption(Card card)
 {
     // takes entity
     call(InputManager.Get(), "HandleClickOnSubOption", card.GetEntity(), false);
 }
开发者ID:vlthr,项目名称:hearthomaton,代码行数:5,代码来源:ActionUtil.cs

示例15: HandleClickOnCardInBattlefield

 public static void HandleClickOnCardInBattlefield(Card card)
 {
     // takes entity
     call(InputManager.Get(), "HandleClickOnCardInBattlefield", card.GetEntity());
 }
开发者ID:vlthr,项目名称:hearthomaton,代码行数:5,代码来源:ActionUtil.cs


注:本文中的Card.GetEntity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。