private Minion createNewMinion(Handmanager.Handcard hc, int id) { Minion m = new Minion { handcard = new Handmanager.Handcard(hc), zonepos = id + 1, entitiyID = hc.entity, Angr = hc.card.Attack, Hp = hc.card.Health, maxHp = hc.card.Health, name = hc.card.name, playedThisTurn = true, numAttacksThisTurn = 0 }; if (hc.card.windfury) m.windfury = true; if (hc.card.tank) m.taunt = true; if (hc.card.Charge) { m.Ready = true; m.charge = 1; } if (hc.card.Shield) m.divineshild = true; if (hc.card.poisionous) m.poisonous = true; if (hc.card.Stealth) m.stealth = true; if (m.name == CardDB.cardName.lightspawn && !m.silenced) { m.Angr = m.Hp; } return m; }
public void placeAmobSomewhere(Handmanager.Handcard hc, bool own, Minion target, int choice, int zonepos) { int mobplace = zonepos; //create the new minion + trigger Summon effects + buffs it Minion m = createNewMinion(hc, mobplace, own); //trigger the battlecry! m.handcard.card.sim_card.getBattlecryEffect(this, m, target, choice); //add minion to list + do triggers + do secret trigger + minion was played trigger addMinionToBattlefield(m); secretTrigger_MinionIsPlayed(m); if (logging) Helpfunctions.Instance.logg("added " + m.handcard.card.name); }
public void removeCard(Handmanager.Handcard hcc, bool own) { Player mPlayer; if (own) { mPlayer = this.playerFirst; } else { mPlayer = this.playerSecond; } int cardPos = 1; int cardNum = 0; Handmanager.Handcard hcTmp = null; foreach (Handmanager.Handcard hc in mPlayer.owncards) { if (hc.entity == hcc.entity) { hcTmp = hc; cardNum++; continue; } mPlayer.owncards[cardNum].position = cardPos; cardNum++; cardPos++; } if (hcTmp != null) mPlayer.owncards.Remove(hcTmp); }
public Minion createNewMinion(Handmanager.Handcard hc, int zonepos, bool own) { Minion m = new Minion(); Handmanager.Handcard handc = new Handmanager.Handcard(hc); //Handmanager.Handcard handc = hc; // new Handcard(hc)? m.handcard = handc; m.own = own; m.isHero = false; m.entitiyID = hc.entity; m.Angr = hc.card.Attack + hc.addattack; m.Hp = hc.card.Health + hc.addHp; hc.addattack = 0; hc.addHp = 0; m.maxHp = hc.card.Health; m.name = hc.card.name; m.playedThisTurn = true; m.numAttacksThisTurn = 0; m.zonepos = zonepos; m.windfury = hc.card.windfury; m.taunt = hc.card.tank; m.charge = (hc.card.Charge) ? 1 : 0; m.divineshild = hc.card.Shield; m.poisonous = hc.card.poisionous; m.stealth = hc.card.Stealth; m.updateReadyness(); if (m.name == CardDB.cardName.lightspawn) { m.Angr = m.Hp; } //trigger on summon effect! this.triggerAMinionIsSummoned(m); //activate onAura effect m.handcard.card.sim_card.onAuraStarts(this, m); //buffs minion this.minionGetOrEraseAllAreaBuffs(m, true); return m; }
public void triggerACardWillBePlayed(Handmanager.Handcard hc, bool own) { Player mPlayer, ePlayer; if (own) { mPlayer = playerFirst; ePlayer = playerSecond; } else { mPlayer = playerSecond; ePlayer = playerFirst; } //if (own) //{ if (mPlayer.anzOwnDragonConsort > 0 && (TAG_RACE)hc.card.race == TAG_RACE.DRAGON) mPlayer.anzOwnDragonConsort = 0; int violetteacher = 0; //we count violetteacher to avoid copying ownminions int illidan = 0; int burly = 0; foreach (Minion m in mPlayer.ownMinions) { if (m.silenced) continue; if (m.name == CardDB.cardName.illidanstormrage) { illidan++; continue; } if (m.name == CardDB.cardName.violetteacher) { if (hc.card.type == CardDB.cardtype.SPELL) { violetteacher++; } continue; } if (m.name == CardDB.cardName.hobgoblin) { if (hc.card.type == CardDB.cardtype.MOB && hc.card.Attack == 1) { hc.addattack += 2; hc.addHp += 2; } continue; } m.handcard.card.sim_card.onCardIsGoingToBePlayed(this, hc.card, own, m); } foreach (Minion m in ePlayer.ownMinions) { if (m.name == CardDB.cardName.troggzortheearthinator) { burly++; } if (m.name == CardDB.cardName.felreaver) { m.handcard.card.sim_card.onCardIsGoingToBePlayed(this, hc.card, own, m); } } for (int i = 0; i < violetteacher; i++) { int pos = mPlayer.ownMinions.Count; this.callKid(CardDB.Instance.teacherminion, pos, own); } for (int i = 0; i < illidan; i++) { int pos = mPlayer.ownMinions.Count; this.callKid(CardDB.Instance.illidanminion, pos, own); } for (int i = 0; i < burly; i++)//summon for enemy ! { int pos = ePlayer.ownMinions.Count; this.callKid(CardDB.Instance.burlyrockjaw, pos, !own); } //} //else //{ // if (playerSecond.anzOwnDragonConsort > 0 && (TAG_RACE)hc.card.race == TAG_RACE.DRAGON) playerSecond.anzOwnDragonConsort = 0; // int violetteacher = 0; //we count violetteacher to avoid copying ownminions // int illidan = 0; // int burly = 0; // foreach (Minion m in this.playerSecond.ownMinions) // { // if (m.silenced) continue; // if (!own && m.name == CardDB.cardName.illidanstormrage) // { // illidan++; // continue; // } // if (!own && m.name == CardDB.cardName.violetteacher) // { // if (hc.card.type == CardDB.cardtype.SPELL) // { // violetteacher++; // } // continue; // } // if (!own && m.name == CardDB.cardName.hobgoblin) // { // if (hc.card.type == CardDB.cardtype.MOB && hc.card.Attack == 1) // { // hc.addattack += 2; // hc.addHp += 2; // } // continue; // } // m.handcard.card.sim_card.onCardIsGoingToBePlayed(this, hc.card, own, m); // } // foreach (Minion m in this.playerFirst.ownMinions) // { // if (m.name == CardDB.cardName.troggzortheearthinator) // { // burly++; // } // if (m.name == CardDB.cardName.felreaver) // { // m.handcard.card.sim_card.onCardIsGoingToBePlayed(this, hc.card, own, m); // } // } // for (int i = 0; i < violetteacher; i++) // { // int pos = this.playerSecond.ownMinions.Count; // this.callKid(CardDB.Instance.teacherminion, pos, own); // } // for (int i = 0; i < illidan; i++) // { // int pos = this.playerSecond.ownMinions.Count; // this.callKid(CardDB.Instance.illidanminion, pos, own); // } // for (int i = 0; i < burly; i++)//summon for us // { // int pos = this.playerFirst.ownMinions.Count; // this.callKid(CardDB.Instance.burlyrockjaw, pos, own); // } //} }
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++; }
//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++; }
public void deleteHcFromMoveList(Handmanager.Handcard hc, int targetId) { //Need implementation for shadowmadness Player mPlayer; if (this.isOwnTurn) { mPlayer = this.playerFirst; } else { mPlayer = this.playerSecond; } if (targetId != -1) { List<Minion> trgts = hc.card.getTargetsForCard(this, false, this.isOwnTurn); foreach (Minion m in trgts) { Tuple<int, int> key = new Tuple<int, int>(hc.entity, m.entitiyID); moveList.RemoveAt(moveMap[key]); moveMap.Remove(key); } } else { Tuple<int, int> key = new Tuple<int, int>(hc.entity, -1); moveList.RemoveAt(moveMap[key]); moveMap.Remove(key); } }