本文整理汇总了C#中HREngine.Bots.Playfield.playCard方法的典型用法代码示例。如果您正苦于以下问题:C# Playfield.playCard方法的具体用法?C# Playfield.playCard怎么用?C# Playfield.playCard使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HREngine.Bots.Playfield
的用法示例。
在下文中一共展示了Playfield.playCard方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: simmulateWholeTurnandPrint
public void simmulateWholeTurnandPrint()
{
help.ErrorLog("");
help.ErrorLog("what would silverfish do?---------");
help.ErrorLog("");
//this.bestboard.printActions();
Playfield tempbestboard = new Playfield();
if (bestmove != null) // save the guessed move, so we doesnt need to recalc!
{
tempbestboard.printActionforDummies(bestmove);
if (bestmove.cardplay)
{
//pf.playCard(c, hc.position - 1, hc.entity, trgt.target, trgt.targetEntity, 0, bestplace, cardplayPenality);
Handmanager.Handcard hc = tempbestboard.owncards.Find(x => x.entity == bestmove.cardEntitiy);
if (bestmove.owntarget >= 0 && bestmove.enemytarget >= 0 && bestmove.enemytarget <= 9 && bestmove.owntarget < bestmove.enemytarget)
{
tempbestboard.playCard(bestmove.handcard, hc.position - 1, hc.entity, bestmove.enemytarget - 1, bestmove.enemyEntitiy, bestmove.druidchoice, bestmove.owntarget, 0);
}
else
{
tempbestboard.playCard(bestmove.handcard, hc.position - 1, hc.entity, bestmove.enemytarget, bestmove.enemyEntitiy, bestmove.druidchoice, bestmove.owntarget, 0);
}
}
if (bestmove.minionplay)
{
//.attackWithMinion(m, trgt.target, trgt.targetEntity, attackPenality);
Minion mm = tempbestboard.ownMinions.Find(x => x.entitiyID == bestmove.ownEntitiy);
tempbestboard.attackWithMinion(mm, bestmove.enemytarget, bestmove.enemyEntitiy, 0);
}
if (bestmove.heroattack)
{
tempbestboard.attackWithWeapon(bestmove.enemytarget, bestmove.enemyEntitiy, 0);
}
if (bestmove.useability)
{
//.activateAbility(p.ownHeroAblility, trgt.target, trgt.targetEntity, abilityPenality);
tempbestboard.activateAbility(this.nextMoveGuess.ownHeroAblility, bestmove.enemytarget, bestmove.enemyEntitiy, 0);
}
}
else
{
tempbestboard.mana = -1;
help.ErrorLog("end turn");
}
foreach (Action bestmovee in bestboard.playactions)
{
tempbestboard.printActionforDummies(bestmovee);
if (bestmovee != null) // save the guessed move, so we doesnt need to recalc!
{
bestmovee.print();
if (bestmovee.cardplay)
{
//pf.playCard(c, hc.position - 1, hc.entity, trgt.target, trgt.targetEntity, 0, bestplace, cardplayPenality);
Handmanager.Handcard hc = tempbestboard.owncards.Find(x => x.entity == bestmovee.cardEntitiy);
if (bestmovee.owntarget >= 0 && bestmovee.enemytarget >= 0 && bestmovee.enemytarget <= 9 && bestmovee.owntarget < bestmovee.enemytarget)
{
tempbestboard.playCard(bestmovee.handcard, hc.position - 1, hc.entity, bestmovee.enemytarget - 1, bestmovee.enemyEntitiy, bestmovee.druidchoice, bestmovee.owntarget, 0);
}
else
{
tempbestboard.playCard(bestmovee.handcard, hc.position - 1, hc.entity, bestmovee.enemytarget, bestmovee.enemyEntitiy, bestmovee.druidchoice, bestmovee.owntarget, 0);
}
}
if (bestmovee.minionplay)
{
//.attackWithMinion(m, trgt.target, trgt.targetEntity, attackPenality);
Minion mm = tempbestboard.ownMinions.Find(x => x.entitiyID == bestmovee.ownEntitiy);
tempbestboard.attackWithMinion(mm, bestmovee.enemytarget, bestmovee.enemyEntitiy, 0);
}
if (bestmovee.heroattack)
{
tempbestboard.attackWithWeapon(bestmovee.enemytarget, bestmovee.enemyEntitiy, 0);
}
if (bestmovee.useability)
{
//.activateAbility(p.ownHeroAblility, trgt.target, trgt.targetEntity, abilityPenality);
tempbestboard.activateAbility(this.nextMoveGuess.ownHeroAblility, bestmovee.enemytarget, bestmovee.enemyEntitiy, 0);
}
}
else
{
tempbestboard.mana = -1;
help.ErrorLog("end turn");
}
}
}
示例2: doallmoves
private void doallmoves(bool test, Bot botBase, bool isLethalCheck)
{
bool havedonesomething = true;
List<Playfield> temp = new List<Playfield>();
int deep = 0;
while (havedonesomething)
{
help.logg("ailoop");
GC.Collect();
temp.Clear();
temp.AddRange(this.posmoves);
havedonesomething = false;
Playfield bestold = null;
int bestoldval = -20000000;
foreach (Playfield p in temp)
{
if (p.complete)
{
continue;
}
//take a card and play it
List<string> playedcards = new List<string>();
foreach (Handmanager.Handcard hc in p.owncards)
{
CardDB.Card c = hc.card;
//help.logg("try play crd" + c.name + " " + c.getManaCost(p) + " " + c.canplayCard(p));
if (playedcards.Contains(c.name)) continue; // dont play the same card in one loop
playedcards.Add(c.name);
if (c.choice)
{
if (doAllChoices(p, hc, isLethalCheck))
{
havedonesomething = true;
}
}
else
{
int bestplace = p.getBestPlace(c);
if (hc.canplayCard(p))
{
havedonesomething = true;
List<targett> trgts = c.getTargetsForCard(p);
if (isLethalCheck && (penman.DamageTargetDatabase.ContainsKey(c.name) || penman.DamageTargetSpecialDatabase.ContainsKey(c.name)))// only target enemy hero during Lethal check!
{
targett trg = trgts.Find(x => x.target == 200);
if (trg != null)
{
trgts.Clear();
trgts.Add(trg);
}
else
{
// no enemy hero -> enemy have taunts ->kill the taunts from left to right
if (trgts.Count >= 1)
{
trg = trgts[0];
trgts.Clear();
trgts.Add(trg);
}
}
}
int cardplayPenality = 0;
if (trgts.Count == 0)
{
if (usePenalityManager)
{
cardplayPenality = penman.getPlayCardPenality(c, -1, p, 0, isLethalCheck);
if (cardplayPenality <= 499)
{
Playfield pf = new Playfield(p);
havedonesomething = true;
pf.playCard(hc, hc.position - 1, hc.entity, -1, -1, 0, bestplace, cardplayPenality);
this.posmoves.Add(pf);
}
}
else
{
Playfield pf = new Playfield(p);
havedonesomething = true;
pf.playCard(hc, hc.position - 1, hc.entity, -1, -1, 0, bestplace, cardplayPenality);
this.posmoves.Add(pf);
}
}
else
{
if (isLethalCheck)// only target enemy hero during Lethal check!
{
targett trg = trgts.Find(x => x.target == 200);
if (trg != null)
{
trgts.Clear();
trgts.Add(trg);
//.........这里部分代码省略.........
示例3: simmulateWholeTurn
public void simmulateWholeTurn()
{
help.logg("simulate best board");
//this.bestboard.printActions();
Playfield tempbestboard = new Playfield();
if (bestmove != null) // save the guessed move, so we doesnt need to recalc!
{
bestmove.print();
if (bestmove.cardplay)
{
help.logg("card");
//pf.playCard(c, hc.position - 1, hc.entity, trgt.target, trgt.targetEntity, 0, bestplace, cardplayPenality);
Handmanager.Handcard hc = tempbestboard.owncards.Find(x => x.entity == bestmove.cardEntitiy);
if (bestmove.owntarget >= 0 && bestmove.enemytarget >= 0 && bestmove.enemytarget <= 9 && bestmove.owntarget < bestmove.enemytarget)
{
tempbestboard.playCard(bestmove.handcard, hc.position - 1, hc.entity, bestmove.enemytarget - 1, bestmove.enemyEntitiy, bestmove.druidchoice, bestmove.owntarget, 0);
}
else
{
tempbestboard.playCard(bestmove.handcard, hc.position - 1, hc.entity, bestmove.enemytarget, bestmove.enemyEntitiy, bestmove.druidchoice, bestmove.owntarget, 0);
}
}
if (bestmove.minionplay)
{
help.logg("min");
//.attackWithMinion(m, trgt.target, trgt.targetEntity, attackPenality);
Minion mm = tempbestboard.ownMinions.Find(x => x.entitiyID == bestmove.ownEntitiy);
tempbestboard.attackWithMinion(mm, bestmove.enemytarget, bestmove.enemyEntitiy, 0);
}
if (bestmove.heroattack)
{
help.logg("hero");
tempbestboard.attackWithWeapon(bestmove.enemytarget, bestmove.enemyEntitiy, 0);
}
if (bestmove.useability)
{
help.logg("abi");
//.activateAbility(p.ownHeroAblility, trgt.target, trgt.targetEntity, abilityPenality);
tempbestboard.activateAbility(this.nextMoveGuess.ownHeroAblility, bestmove.enemytarget, bestmove.enemyEntitiy, 0);
}
}
else
{
tempbestboard.mana = -1;
}
help.logg("-------------");
tempbestboard.printBoard();
foreach (Action bestmovee in bestboard.playactions)
{
help.logg("stepp");
if (bestmovee != null) // save the guessed move, so we doesnt need to recalc!
{
bestmovee.print();
if (bestmovee.cardplay)
{
help.logg("card");
//pf.playCard(c, hc.position - 1, hc.entity, trgt.target, trgt.targetEntity, 0, bestplace, cardplayPenality);
Handmanager.Handcard hc = tempbestboard.owncards.Find(x => x.entity == bestmovee.cardEntitiy);
if (bestmovee.owntarget >= 0 && bestmovee.enemytarget >= 0 && bestmovee.enemytarget <= 9 && bestmovee.owntarget < bestmovee.enemytarget)
{
tempbestboard.playCard(bestmovee.handcard, hc.position - 1, hc.entity, bestmovee.enemytarget - 1, bestmovee.enemyEntitiy, bestmovee.druidchoice, bestmovee.owntarget, 0);
}
else
{
tempbestboard.playCard(bestmovee.handcard, hc.position - 1, hc.entity, bestmovee.enemytarget, bestmovee.enemyEntitiy, bestmovee.druidchoice, bestmovee.owntarget, 0);
}
}
if (bestmovee.minionplay)
{
help.logg("min");
//.attackWithMinion(m, trgt.target, trgt.targetEntity, attackPenality);
Minion mm = tempbestboard.ownMinions.Find(x => x.entitiyID == bestmovee.ownEntitiy);
tempbestboard.attackWithMinion(mm, bestmovee.enemytarget, bestmovee.enemyEntitiy, 0);
}
if (bestmovee.heroattack)
{
help.logg("hero");
tempbestboard.attackWithWeapon(bestmovee.enemytarget, bestmovee.enemyEntitiy, 0);
}
if (bestmovee.useability)
{
help.logg("abi");
//.activateAbility(p.ownHeroAblility, trgt.target, trgt.targetEntity, abilityPenality);
tempbestboard.activateAbility(this.nextMoveGuess.ownHeroAblility, bestmovee.enemytarget, bestmovee.enemyEntitiy, 0);
}
}
//.........这里部分代码省略.........
示例4: simmulateWholeTurn
public void simmulateWholeTurn()
{
help.logg("simulate best board");
//this.bestboard.printActions();
Playfield tempbestboard = new Playfield();
if (bestmove != null) // save the guessed move, so we doesnt need to recalc!
{
bestmove.print();
if (bestmove.cardplay)
{
help.logg("card");
//pf.playCard(c, hc.position - 1, hc.entity, trgt.target, trgt.targetEntity, 0, bestplace, cardplayPenality);
Handmanager.Handcard hc = tempbestboard.owncards.Find(x => x.entity == bestmove.cardEntitiy);
if (bestmove.owntarget >= 0 && bestmove.enemytarget >= 0 && bestmove.enemytarget <= 9 && bestmove.owntarget < bestmove.enemytarget)
{
tempbestboard.playCard(bestmove.handcard, hc.position - 1, hc.entity, bestmove.enemytarget - 1, bestmove.enemyEntitiy, bestmove.druidchoice, bestmove.owntarget, 0);
}
else
{
tempbestboard.playCard(bestmove.handcard, hc.position - 1, hc.entity, bestmove.enemytarget, bestmove.enemyEntitiy, bestmove.druidchoice, bestmove.owntarget, 0);
}
}
if (bestmove.minionplay)
{
help.logg("min");
//.attackWithMinion(m, trgt.target, trgt.targetEntity, attackPenality);
Minion mm = tempbestboard.ownMinions.Find(x => x.entitiyID == bestmove.ownEntitiy);
help.logg("min");
tempbestboard.attackWithMinion(mm, bestmove.enemytarget, bestmove.enemyEntitiy, 0);
help.logg("min");
}
if (bestmove.heroattack)
{
help.logg("hero");
tempbestboard.attackWithWeapon(bestmove.enemytarget, bestmove.enemyEntitiy, 0);
}
if (bestmove.useability)
{
help.logg("abi");
//.activateAbility(p.ownHeroAblility, trgt.target, trgt.targetEntity, abilityPenality);
tempbestboard.activateAbility(this.nextMoveGuess.ownHeroAblility, bestmove.enemytarget, bestmove.enemyEntitiy, 0);
}
}
else
{
tempbestboard.mana = -1;
}
help.logg("-------------");
help.logg("OwnMinions:");
foreach (Minion m in tempbestboard.ownMinions)
{
help.logg(m.name + " id " + m.id + " zp " + m.zonepos + " " + " e:" + m.entitiyID + " " + " A:" + m.Angr + " H:" + m.Hp + " mH:" + m.maxHp + " rdy:" + m.Ready + " tnt:" + m.taunt + " frz:" + m.frozen + " silenced:" + m.silenced + " divshield:" + m.divineshild + " ptt:" + m.playedThisTurn + " wndfr:" + m.windfury + " natt:" + m.numAttacksThisTurn + " sil:" + m.silenced + " stl:" + m.stealth + " poi:" + m.poisonous + " imm:" + m.immune + " ex:" + m.exhausted + " chrg:" + m.charge);
foreach (Enchantment e in m.enchantments)
{
help.logg(e.CARDID + " " + e.creator + " " + e.controllerOfCreator);
}
}
help.logg("EnemyMinions:");
foreach (Minion m in tempbestboard.enemyMinions)
{
help.logg(m.name + " id " + m.id + " zp " + m.zonepos + " " + " e:" + m.entitiyID + " " + " A:" + m.Angr + " H:" + m.Hp + " mH:" + m.maxHp + " rdy:" + m.Ready + " tnt:" + m.taunt + " frz:" + m.frozen + " silenced:" + m.silenced + " divshield:" + m.divineshild + " wndfr:" + m.windfury + " sil:" + m.silenced + " stl:" + m.stealth + " poi:" + m.poisonous + " imm:" + m.immune + " ex:" + m.exhausted);
foreach (Enchantment e in m.enchantments)
{
help.logg(e.CARDID + " " + e.creator + " " + e.controllerOfCreator);
}
}
foreach (Action bestmovee in bestboard.playactions)
{
help.logg("stepp");
if (bestmovee != null) // save the guessed move, so we doesnt need to recalc!
{
bestmovee.print();
if (bestmovee.cardplay)
{
help.logg("card");
//pf.playCard(c, hc.position - 1, hc.entity, trgt.target, trgt.targetEntity, 0, bestplace, cardplayPenality);
Handmanager.Handcard hc = tempbestboard.owncards.Find(x => x.entity == bestmovee.cardEntitiy);
if (bestmovee.owntarget >= 0 && bestmovee.enemytarget >= 0 && bestmovee.enemytarget <= 9 && bestmovee.owntarget < bestmovee.enemytarget)
{
tempbestboard.playCard(bestmovee.handcard, hc.position - 1, hc.entity, bestmovee.enemytarget - 1, bestmovee.enemyEntitiy, bestmovee.druidchoice, bestmovee.owntarget, 0);
}
else
{
tempbestboard.playCard(bestmovee.handcard, hc.position - 1, hc.entity, bestmovee.enemytarget, bestmovee.enemyEntitiy, bestmovee.druidchoice, bestmovee.owntarget, 0);
}
}
if (bestmovee.minionplay)
{
help.logg("min");
//.........这里部分代码省略.........
示例5: doAllChoices
private bool doAllChoices( Playfield p, Handmanager.Handcard hc, bool lethalcheck)
{
bool havedonesomething = false;
for (int i = 1; i < 3; i++)
{
CardDB.Card c = hc.card;
if (c.name == "starfall")
{
if (i == 1)
{
c = CardDB.Instance.getCardDataFromID("NEW1_007b");
}
if (i == 2)
{
c = CardDB.Instance.getCardDataFromID("NEW1_007a");
}
}
if (c.name == "ancientoflore")
{
if (i == 1)
{
c = CardDB.Instance.getCardDataFromID("NEW1_008a");
}
if (i == 2)
{
c = CardDB.Instance.getCardDataFromID("NEW1_008b");
}
}
if (hc.canplayCard(p))
{
havedonesomething = true;
int bestplace = p.getBestPlace(c);
List<targett> trgts = c.getTargetsForCard(p);
int cardplayPenality = 0;
if (trgts.Count == 0)
{
if (usePenalityManager)
{
cardplayPenality = penman.getPlayCardPenality(c, -1, p, i, lethalcheck);
if (cardplayPenality <= 499)
{
Playfield pf = new Playfield(p);
pf.playCard(hc, hc.position - 1, hc.entity, -1, -1, i, bestplace, cardplayPenality);
this.posmoves.Add(pf);
}
}
else
{
Playfield pf = new Playfield(p);
pf.playCard(hc, hc.position - 1, hc.entity, -1, -1, i, bestplace, cardplayPenality);
this.posmoves.Add(pf);
}
}
else
{
foreach (targett trgt in trgts)
{
if (usePenalityManager)
{
cardplayPenality = penman.getPlayCardPenality(c, -1, p, i, lethalcheck);
if (cardplayPenality <= 499)
{
Playfield pf = new Playfield(p);
pf.playCard(hc, hc.position - 1, hc.entity, trgt.target, trgt.targetEntity, i, bestplace, cardplayPenality);
this.posmoves.Add(pf);
}
}
else
{
Playfield pf = new Playfield(p);
pf.playCard(hc, hc.position - 1, hc.entity, trgt.target, trgt.targetEntity, i, bestplace, cardplayPenality);
this.posmoves.Add(pf);
}
}
}
}
}
return havedonesomething;
}
示例6: doAllChoices
//.........这里部分代码省略.........
}
if (c.name == CardDB.cardName.markofnature)
{
if (i == 1)
{
c = CardDB.Instance.getCardDataFromID(CardDB.cardIDEnum.EX1_155a);
}
if (i == 2)
{
c = CardDB.Instance.getCardDataFromID(CardDB.cardIDEnum.EX1_155b);
}
}
if (c.name == CardDB.cardName.nourish)
{
if (i == 1)
{
c = CardDB.Instance.getCardDataFromID(CardDB.cardIDEnum.EX1_164a);
}
if (i == 2)
{
c = CardDB.Instance.getCardDataFromID(CardDB.cardIDEnum.EX1_164b);
}
}
if (c.name == CardDB.cardName.wrath)
{
if (i == 1)
{
c = CardDB.Instance.getCardDataFromID(CardDB.cardIDEnum.EX1_154a);
}
if (i == 2)
{
c = CardDB.Instance.getCardDataFromID(CardDB.cardIDEnum.EX1_154b);
}
}
if (c.canplayCard(p, hc.manacost))
{
havedonesomething = true;
int bestplace = p.getBestPlace(c, lethalcheck);
List<targett> trgts = c.getTargetsForCard(p);
int cardplayPenality = 0;
if (trgts.Count == 0)
{
if (usePenalityManager)
{
cardplayPenality = pen.getPlayCardPenality(hc.card, -1, p, i, lethalcheck);
if (cardplayPenality <= 499)
{
//help.logg(hc.card.name + " is played");
Playfield pf = new Playfield(p);
pf.playCard(hc, hc.position - 1, hc.entity, -1, -1, i, bestplace, cardplayPenality);
addToPosmoves(pf);
}
}
else
{
Playfield pf = new Playfield(p);
pf.playCard(hc, hc.position - 1, hc.entity, -1, -1, i, bestplace, cardplayPenality);
addToPosmoves(pf);
}
}
else
{
foreach (targett trgt in trgts)
{
if (usePenalityManager)
{
cardplayPenality = pen.getPlayCardPenality(hc.card, trgt.target, p, 0, lethalcheck);
if (cardplayPenality <= 499)
{
//help.logg(hc.card.name + " is played");
Playfield pf = new Playfield(p);
pf.playCard(hc, hc.position - 1, hc.entity, trgt.target, trgt.targetEntity, i, bestplace, cardplayPenality);
addToPosmoves(pf);
}
}
else
{
Playfield pf = new Playfield(p);
pf.playCard(hc, hc.position - 1, hc.entity, trgt.target, trgt.targetEntity, i, bestplace, cardplayPenality);
addToPosmoves(pf);
}
}
}
}
}
return havedonesomething;
}
示例7: doallmoves
public int doallmoves(Playfield playf, bool isLethalCheck)
{
//Helpfunctions.Instance.logg("NXTTRN" + playf.mana);
if (botBase == null) botBase = Ai.Instance.botBase;
bool test = false;
this.posmoves.Clear();
this.addToPosmoves(playf);
bool havedonesomething = true;
List<Playfield> temp = new List<Playfield>();
int deep = 0;
//Helpfunctions.Instance.logg("NXTTRN" + playf.mana + " " + posmoves.Count);
this.calculated = 0;
while (havedonesomething)
{
if (this.printNormalstuff) Helpfunctions.Instance.logg("ailoop");
GC.Collect();
temp.Clear();
temp.AddRange(this.posmoves);
havedonesomething = false;
Playfield bestold = null;
int bestoldval = -20000000;
foreach (Playfield p in temp)
{
if (p.complete || p.ownHeroHp <= 0)
{
continue;
}
//take a card and play it
if (!p.attacked)
{
List<CardDB.cardName> playedcards = new List<CardDB.cardName>();
foreach (Handmanager.Handcard hc in p.owncards)
{
if (this.calculated > this.totalboards) continue;
CardDB.Card c = hc.card;
//help.logg("try play crd" + c.name + " " + c.getManaCost(p) + " " + c.canplayCard(p));
if (playedcards.Contains(c.name)) continue; // dont play the same card in one loop
playedcards.Add(c.name);
if (c.choice)
{
if (doAllChoices(p, hc, isLethalCheck))
{
havedonesomething = true;
}
}
else
{
int bestplace = p.getBestPlace(c, isLethalCheck);
if (hc.canplayCard(p))
{
havedonesomething = true;
List<targett> trgts = c.getTargetsForCard(p);
if (isLethalCheck && (pen.DamageTargetDatabase.ContainsKey(c.name) || pen.DamageTargetSpecialDatabase.ContainsKey(c.name)))// only target enemy hero during Lethal check!
{
targett trg = trgts.Find(x => x.target == 200);
if (trg != null)
{
trgts.Clear();
trgts.Add(trg);
}
else
{
// no enemy hero -> enemy have taunts ->kill the taunts from left to right
if (trgts.Count >= 1)
{
trg = trgts[0];
trgts.Clear();
trgts.Add(trg);
}
}
}
int cardplayPenality = 0;
if (trgts.Count == 0)
{
if (usePenalityManager)
{
cardplayPenality = pen.getPlayCardPenality(c, -1, p, 0, isLethalCheck);
if (cardplayPenality <= 499)
{
Playfield pf = new Playfield(p);
havedonesomething = true;
pf.playCard(hc, hc.position - 1, hc.entity, -1, -1, 0, bestplace, cardplayPenality);
addToPosmoves(pf);
}
}
else
{
Playfield pf = new Playfield(p);
havedonesomething = true;
pf.playCard(hc, hc.position - 1, hc.entity, -1, -1, 0, bestplace, cardplayPenality);
//.........这里部分代码省略.........
示例8: Workthread
private void Workthread(object to)
{
threadobject trob = (threadobject)to;
bool test = trob.test;
Bot botBase = trob.botBase;
bool isLethalCheck = trob.isLethalCheck;
List<Playfield> tasks = trob.playfieldsTasklist;
int threadNumber = trob.threadnumber;
aitask retval = new aitask();
//help.logg("hello im " + threadNumber);
bool havedonesomething = false;
Playfield bestold = null;
int bestoldval = -20000000;
foreach (Playfield p in tasks)
{
if (p.complete)
{
/*if (botBase.getPlayfieldValue(p) > bestoldval)
{
bestoldval = botBase.getPlayfieldValue(p);
bestold = p;
}*/
retval.finishedStuff.Add(p);
continue;
}
//take a card and play it
List<string> playedcards = new List<string>();
foreach (Handmanager.Handcard hc in p.owncards)
{
CardDB.Card c = hc.card;
//help.logg("try play crd" + c.name + " " + c.getManaCost(p) + " " + c.canplayCard(p));
if (playedcards.Contains(c.name)) continue; // dont play the same card in one loop
playedcards.Add(c.name);
if (c.choice)
{
if (doAllChoices(c, p, hc))
{
havedonesomething = true;
}
}
else
{
int bestplace = p.getBestPlace(c);
if (c.canplayCard(p))
{
havedonesomething = true;
List<targett> trgts = c.getTargetsForCard(p);
if (isLethalCheck && (penman.DamageTargetDatabase.ContainsKey(c.name) || penman.DamageTargetSpecialDatabase.ContainsKey(c.name)))// only target enemy hero during Lethal check!
{
targett trg = trgts.Find(x => x.target == 200);
if (trg != null)
{
trgts.Clear();
trgts.Add(trg);
}
else
{
// no enemy hero -> enemy have taunts ->kill the taunts from left to right
if (trgts.Count >= 1)
{
trg = trgts[0];
trgts.Clear();
trgts.Add(trg);
}
}
}
int cardplayPenality = 0;
if (trgts.Count == 0)
{
Playfield pf = new Playfield(p);
if (usePenalityManager)
{
cardplayPenality = penman.getPlayCardPenality(c, -1, pf, 0);
if (cardplayPenality <= 499)
{
havedonesomething = true;
pf.playCard(c, hc.position - 1, hc.entity, -1, -1, 0, bestplace, cardplayPenality);
retval.newStuff.Add(pf);
}
}
else
{
havedonesomething = true;
pf.playCard(c, hc.position - 1, hc.entity, -1, -1, 0, bestplace, cardplayPenality);
retval.newStuff.Add(pf);
}
}
else
{
//.........这里部分代码省略.........
示例9: doallmoves
private void doallmoves(bool test, Bot botBase)
{
bool havedonesomething = true;
List<Playfield> temp = new List<Playfield>();
int deep = 0;
while (havedonesomething)
{
help.logg("ailoop");
GC.Collect();
temp.Clear();
temp.AddRange(this.posmoves);
havedonesomething = false;
Playfield bestold = null;
int bestoldval = -20000000;
foreach (Playfield p in temp)
{
if (p.complete)
{
continue;
}
//take a card and play it
List<string> playedcards = new List<string>();
foreach (Handmanager.Handcard hc in p.owncards)
{
CardDB.Card c = hc.card;
//help.logg("try play crd" + c.name + " " + c.getManaCost(p) + " " + c.canplayCard(p));
if (playedcards.Contains(c.name)) continue; // dont play the same card in one loop
playedcards.Add(c.name);
if (c.choice)
{
if (doAllChoices(c, p, hc))
{
havedonesomething = true;
}
}
else
{
int bestplace = p.getBestPlace(c);
if (c.canplayCard(p))
{
havedonesomething = true;
List<targett> trgts = c.getTargetsForCard(p);
if (trgts.Count == 0)
{
Playfield pf = new Playfield(p);
pf.playCard(c, hc.position - 1, hc.entity, -1, -1, 0,bestplace);
this.posmoves.Add(pf);
}
else
{
foreach (targett trgt in trgts)
{
Playfield pf = new Playfield(p);
pf.playCard(c, hc.position - 1, hc.entity, trgt.target, trgt.targetEntity, 0,bestplace);
this.posmoves.Add(pf);
}
}
}
}
}
//attack with a minion
foreach (Minion m in p.ownMinions)
{
if (m.Ready && m.Angr >= 1 && !m.frozen)
{
List<targett> trgts = p.getAttackTargets();
havedonesomething = true;
foreach (targett trgt in trgts)
{
Playfield pf = new Playfield(p);
pf.attackWithMinion(m, trgt.target, trgt.targetEntity);
this.posmoves.Add(pf);
}
}
}
// attack with hero
if (p.ownHeroReady)
{
List<targett> trgts = p.getAttackTargets();
havedonesomething = true;
foreach (targett trgt in trgts)
{
Playfield pf = new Playfield(p);
pf.attackWithWeapon(trgt.target, trgt.targetEntity);
this.posmoves.Add(pf);
}
}
// use ability
/// TODO check if ready after manaup
//.........这里部分代码省略.........
示例10: doAllChoices
private bool doAllChoices(CardDB.Card card, Playfield p, Handmanager.Handcard hc)
{
bool havedonesomething = false;
for (int i = 1; i < 3; i++)
{
CardDB.Card c = card;
if (card.name == "sternenregen")
{
if (i == 1)
{
c = CardDB.Instance.getCardDataFromID("NEW1_007b");
}
if (i == 2)
{
c = CardDB.Instance.getCardDataFromID("NEW1_007a");
}
}
if (card.name == "urtumderlehren")
{
if (i == 1)
{
c = CardDB.Instance.getCardDataFromID("NEW1_008a");
}
if (i == 2)
{
c = CardDB.Instance.getCardDataFromID("NEW1_008b");
}
}
if (c.canplayCard(p))
{
havedonesomething = true;
int bestplace = p.getBestPlace(c);
List<targett> trgts = c.getTargetsForCard(p);
if (trgts.Count == 0)
{
Playfield pf = new Playfield(p);
pf.playCard(card, hc.position - 1, hc.entity, -1, -1, i, bestplace);
this.posmoves.Add(pf);
}
else
{
foreach (targett trgt in trgts)
{
Playfield pf = new Playfield(p);
pf.playCard(card, hc.position - 1, hc.entity, trgt.target, trgt.targetEntity, i, bestplace);
this.posmoves.Add(pf);
}
}
}
}
return havedonesomething;
}