Пример #1
0
        public void enemyplaysACard(Handmanager.Handcard hc, Minion target, int position, int choice, int penality)
        {
            //Handmanager.Handcard hc = new Handmanager.Handcard(c);
            //hc.entity = this.getNextEntity();
            //Helpfunctions.Instance.logg("play crd " + c.name + " entitiy# " + cardEntity + " mana " + hc.getManaCost(this) + " trgt " + target);
            CardDB.Card c = hc.card;
            if (logging) Helpfunctions.Instance.logg("enemy play crd " + c.name + " trgt " + target);
            this.playerSecond.evaluatePenality += penality;
            int manaCost = hc.getManaCost(this, false);
            if (manaCost == 0 && hc.card.cost == 4 && this.playerSecond.enemyMillhouse == 0)
            {
                int debug = 1;
                debugMinions();
                hc.getManaCost(this, false);
            }

            this.playerSecond.mana = this.playerSecond.mana - manaCost;
            removeCard(hc, false);// remove card from hand

            this.triggerACardWillBePlayed(hc, false);
            this.triggerCardsChanged(false);
            this.doDmgTriggers();

            int newTarget = secretTrigger_SpellIsPlayed(target, c.type == CardDB.cardtype.SPELL, false);
            if (newTarget >= 1)
            {
                //search new target!
                foreach (Minion m in this.playerFirst.ownMinions)
                {
                    if (m.entitiyID == newTarget)
                    {
                        target = m;
                        break;
                    }
                }
                foreach (Minion m in this.playerSecond.ownMinions)
                {
                    if (m.entitiyID == newTarget)
                    {
                        target = m;
                        break;
                    }
                }
                if (this.playerFirst.ownHero.entitiyID == newTarget) target = this.playerFirst.ownHero;
                if (this.playerSecond.ownHero.entitiyID == newTarget) target = this.playerSecond.ownHero;
            }
            if (newTarget != -2) // trigger spell-secrets!
            {
                if (c.type == CardDB.cardtype.MOB)
                {
                    //todo mob playing
                    this.placeAmobSomewhere(hc, false, target, choice, position);
                    this.playerSecond.mobsplayedThisTurn++;                  
                }
                else
                {
                    c.sim_card.onCardPlay(this, false, target, choice);
                    this.doDmgTriggers();
                    //secret trigger? do here
                }
            }

            GraveYardItem gyi = new GraveYardItem(c.cardIDenum, hc.entity, false);
            graveYard.Add(gyi);
            this.playerSecond.cardsPlayedThisTurn++;

        }
Пример #2
0
        //public void updateMoveList(Action action)
        //{
        //    Helpfunctions.Instance.logg("Action:------------------------------------");
        //    action.print();
        //    printMoveList();
        //    if (this.moveTrigger.tauntChanged || this.moveTrigger.manaChanged)
        //    {
        //        this.moveList = Movegenerator.Instance.getMoveList(this, false, true, true);
        //    }
        //    else
        //    {
        //        Movegenerator.Instance.getMoveListForPlayfield(this, false);
        //    }
        //    if (this.isOwnTurn)
        //    {
        //        Helpfunctions.Instance.logg("player 1 Mana: " + this.playerFirst.mana + "/" + this.playerFirst.ownMaxMana);
        //    }
        //    else
        //    {
        //        Helpfunctions.Instance.logg("player 2 Mana: " + this.playerSecond.mana + "/" + this.playerSecond.ownMaxMana);
        //    }
        //    printMoveList();
        //}

        //play a minion trigger stuff:
        // 1 whenever you play a card whatever triggers
        // 2 Auras
        // 5 whenever you summon a minion triggers (like starving buzzard)
        // 3 battlecry
        // 3.5 place minion
        // 3.75 dmg/died/dthrttl triggers
        // 4 secret: minion is played
        // 4.5 dmg/died/dthrttl triggers
        // 5 after you summon a minion triggers
        // 5.5 dmg/died/dthrttl triggers
        public void playACard(Handmanager.Handcard hc, Minion target, int position, int choice, int penality)
        {
            CardDB.Card c = hc.card;
            this.playerFirst.evaluatePenality += penality;
            int manaCost = hc.getManaCost(this, true);
            if (manaCost == 0 && hc.card.cost == 4 && this.playerFirst.enemyMillhouse == 0)
            {
                int debug = 1;
                debugMinions();
            }
            this.playerFirst.mana = this.playerFirst.mana - manaCost;

            if (this.playerFirst.mana < 0)
            {
                int debug = 1;
            }

            removeCard(hc, true);// remove card from hand

            this.triggerCardsChanged(true);

            if (c.type == CardDB.cardtype.SPELL)
            {
                this.playerFirst.playedPreparation = false;
                if (target != null && target.name == CardDB.cardName.dragonkinsorcerer && target.own) this.minionGetBuffed(target, 1, 1);
            }

            if (c.Secret)
            {
                this.playerFirst.ownSecretsIDList.Add(c.cardIDenum);
                this.playerFirst.playedmagierinderkirintor = false;
            }


            //Helpfunctions.Instance.logg("play crd " + c.name + " entitiy# " + cardEntity + " mana " + hc.getManaCost(this) + " trgt " + target);
            if (logging) Helpfunctions.Instance.logg("play crd " + c.name + " entitiy# " + hc.entity + " mana " + hc.getManaCost(this, true) + " trgt " + target);


            this.triggerACardWillBePlayed(hc, true);
            this.triggerCardsChanged(true);
            this.doDmgTriggers();

            int newTarget = secretTrigger_SpellIsPlayed(target, c.type == CardDB.cardtype.SPELL, true);
            if (newTarget >= 1)
            {
                //search new target!
                foreach (Minion m in this.playerFirst.ownMinions)
                {
                    if (m.entitiyID == newTarget)
                    {
                        target = m;
                        break;
                    }
                }
                foreach (Minion m in this.playerSecond.ownMinions)
                {
                    if (m.entitiyID == newTarget)
                    {
                        target = m;
                        break;
                    }
                }
                if (this.playerFirst.ownHero.entitiyID == newTarget) target = this.playerFirst.ownHero;
                if (this.playerSecond.ownHero.entitiyID == newTarget) target = this.playerSecond.ownHero;
            }
            if (newTarget != -2) // trigger spell-secrets!
            {

                if (c.type == CardDB.cardtype.MOB)
                {
                    this.placeAmobSomewhere(hc, true, target, choice, position);
                    this.playerFirst.mobsplayedThisTurn++;                             
                }
                else
                {

                    c.sim_card.onCardPlay(this, true, target, choice);
                    this.doDmgTriggers();
                    //secret trigger? do here
                }
            }

            GraveYardItem gyi = new GraveYardItem(c.cardIDenum, hc.entity, true);
            graveYard.Add(gyi);
            //this.ueberladung += c.recallValue;
            this.playerFirst.cardsPlayedThisTurn++;

        }