silverfish
silverfish copied to clipboard
Preparation card randomly played at end of turn
The bot seems to randomly play preparation, as if it has the wrong effect, as it gets played at the end of the turn. And most of the time, let's say for a Sprint or another good card to do play Preparation on before hand, the bot doesn't play the card at all.
#######################################################################
start calculations, current time: 21:24:34:7023 V116.38 face 18000 face 30 twoturnsim 100 ntss 6 200 200 ets 50 ets2 100 ents 100 secret
#######################################################################
mana 8/8
emana 7
own secretsCount: 0
enemy secretsCount: 0 ;
player:
0 0 0 1 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0
ownhero:
thief 13 30 0 False False 4 True 0 False 3 0
weapon: 3 1 wickedknife
ability: True CS2_083b 2
osecrets:
enemyhero:
thief 18 30 0 False False 36
weapon: 1 2 wickedknife
ability: True CS2_083b 0
fatigue: 17 0 17 0
OwnMinions:
EnemyMinions:
nerubian AT_036t zp:1 e:84 A:4 H:4 mH:4 rdy:True natt:0 ex
coldlightoracle EX1_050 zp:2 e:59 A:2 H:2 mH:2 rdy:False natt:0 ex ptt
nerubian AT_036t zp:3 e:87 A:4 H:4 mH:4 rdy:False natt:0 ex ptt
nerubian AT_036t zp:4 e:88 A:4 H:4 mH:4 rdy:False natt:0 ex ptt
Own Handcards:
pos 1 saltydog 5 entity 35 GVG_070 0 0
pos 2 preparation 0 entity 16 EX1_145 0 0
pos 3 eviscerate 2 entity 10 EX1_124 0 0
pos 4 bloodsailraider 2 entity 8 NEW1_018 0 0
pos 5 shadydealer 3 entity 7 AT_032 0 0
pos 6 coldblood 1 entity 29 CS2_073 0 0
Enemy cards: 3
ownDiedMinions:
enemyDiedMinions:
og: 485,2;1248,2;44,1;822,1;829,2;40,1;304,1;
eg: 1018,2;303,1;586,1;49,2;304,1;500,1;425,1;
received 21:24:34:7023 actions to do:
play id 8 pos 1
play id 10 target 88 pos 1
play id 7 pos 2
play id 16 pos 1
heroattack 36
set best action-----------------------------------
-a-
play id 8 pos 1
-a-
play id 10 target 88 pos 1
-a-
play id 7 pos 2
-a-
play id 16 pos 1
-a-
attack with hero, enemy: 36
nmgsim-
nmgsime-
play id 8 pos 1
playcard: Bloodsail Raider choice: 0 place1
noRecalcNeeded!!!-----------------------------------
nmgsim-
nmgsime-
play id 10 target 88 pos 1
playcard: Eviscerate target: Nerubian choice: 0 place1
noRecalcNeeded!!!-----------------------------------
nmgsim-
nmgsime-
play id 7 pos 2
playcard: Shady Dealer choice: 0 place2
noRecalcNeeded!!!-----------------------------------
nmgsim-
nmgsime-
play id 16 pos 1
playcard: Preparation choice: 0 place1
noRecalcNeeded!!!-----------------------------------
nmgsim-
nmgsime-
attack with hero, enemy: 36
attackWithHero: Valeera Sanguinar target: Valeera Sanguinar choice: 0 place0
Tentative solution with limited testing, so far it hasn't been used wrongly or randomly:
if (card.name == CardDB.cardName.preparation)
{
int spellCostcount = 0;
bool prepBefore = false;
foreach (Action a in p.playactions)
{
if (a.card != null && a.card.card.type == CardDB.cardtype.SPELL && a.card.getManaCost(p) >= 1 && prepBefore)
{
spellCostcount = a.card.getManaCost(p);
break;
}
if (a.card != null && a.card.card.name == CardDB.cardName.preparation && !prepBefore) prepBefore = true;
}
return spellCostcount == 0 ? 500 : 30 - spellCostcount * 20;
}
After further testing and even adding this to Playfield.cs under PlayACard function:
if (c.type == CardDB.cardtype.SPELL && this.playedPreparation)
{
hc.manacost = hc.getManaCost(this) >= 4 ? hc.getManaCost(this) - 3 : 0;
this.playedPreparation = false;
}
Added this into Playfield, because I did not see anywhere else that specifies the preparation effect to the bot. Preparation still doesn't get played :/