Erwan
- AI:increased percentage of chance to play an "unknown" Card - removed delay before displaying big card ingame - added 2 new AI Decks - Fixed a bug with afflict (see tests/afflict.txt)
This commit is contained in:
@@ -229,11 +229,11 @@ int AIPlayer::chooseAttackers(){
|
||||
int opponentCreatures = getCreaturesInfo(opponent(), INFO_NBCREATURES);
|
||||
int myForce = getCreaturesInfo(this,INFO_CREATURESPOWER,-1,1);
|
||||
int myCreatures = getCreaturesInfo(this, INFO_NBCREATURES, -1,1);
|
||||
bool attack = (myCreatures > opponentCreatures || myForce > opponentForce || myForce > 2*opponent()->life);
|
||||
bool attack = ((myCreatures > opponentCreatures) || (myForce > opponentForce) || (myForce > 2*opponent()->life));
|
||||
if (attack){
|
||||
CardDescriptor cd;
|
||||
cd.init();
|
||||
cd.setType("Creature");
|
||||
cd.setType("creature");
|
||||
MTGCardInstance * card = NULL;
|
||||
while((card = cd.nextmatch(game->inPlay, card))){
|
||||
GameObserver::GetInstance()->cardClick(card);
|
||||
@@ -433,7 +433,7 @@ MTGCardInstance * AIPlayerBaka::FindCardToPlay(ManaCost * potentialMana, const c
|
||||
if (shouldPlay == BAKA_EFFECT_GOOD){
|
||||
shouldPlayPercentage = 90;
|
||||
}else if(BAKA_EFFECT_DONTKNOW == shouldPlay){
|
||||
shouldPlayPercentage = 70;
|
||||
shouldPlayPercentage = 80;
|
||||
}
|
||||
if (rand() % 100 > shouldPlayPercentage) continue;
|
||||
}
|
||||
|
||||
@@ -84,7 +84,12 @@ void DeckStats::save(const char * filename){
|
||||
|
||||
void DeckStats::saveStats(Player *player, Player *opponent, GameObserver * game){
|
||||
int victory = 1;
|
||||
if (game->gameOver == player) victory = 0;
|
||||
if (!game->gameOver){
|
||||
if (player->life == opponent->life) return;
|
||||
if (player->life < opponent->life) victory = 0;
|
||||
}else if (game->gameOver == player) {
|
||||
victory = 0;
|
||||
}
|
||||
load(player);
|
||||
map<string,DeckStat *>::iterator it = stats.find(opponent->deckFile);
|
||||
if (it == stats.end()){
|
||||
|
||||
@@ -154,13 +154,13 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){
|
||||
}
|
||||
}
|
||||
|
||||
//Champion. Very basic, needs to be improved !
|
||||
found = s.find("champion(name:");
|
||||
//foreach. Very basic, needs to be improved !
|
||||
found = s.find("foreach(name:");
|
||||
if (found != string::npos){
|
||||
if (dryMode) return BAKA_EFFECT_GOOD;
|
||||
unsigned int end = s.find(")", found+14);
|
||||
unsigned int end = s.find(")", found+13);
|
||||
if (end != string::npos){
|
||||
string type = s.substr(found+14,end-found-14).c_str();
|
||||
string type = s.substr(found+13,end-found-13).c_str();
|
||||
game->addObserver(NEW APlagueRats(id,card,type.c_str()));
|
||||
result++;
|
||||
continue;
|
||||
@@ -365,7 +365,8 @@ int AbilityFactory::magicText(int id, Spell * spell, MTGCardInstance * card){
|
||||
found = s.find("/");
|
||||
if (found != string::npos){
|
||||
unsigned int start = s.find(":");
|
||||
if (start == string::npos) start = found-2;
|
||||
if (start == string::npos) start = s.find(" ");
|
||||
if (start == string::npos) start = -1;
|
||||
int power = atoi(s.substr(start+1,size-found).c_str());
|
||||
unsigned int end = s.find(" ",start);
|
||||
int toughness;
|
||||
|
||||
@@ -234,13 +234,13 @@ int MTGAllCards::readConfLine(std::ifstream &file, int set_id){
|
||||
if (s[s.size()-1] == '\r') s.erase(s.size()-1); //Handle DOS files
|
||||
switch(conf_read_mode) {
|
||||
case 0:
|
||||
if (s.find("[card]") != string::npos){
|
||||
if (s[0] == '['){
|
||||
collection[total_cards] = NEW MTGCard(mCache,set_id);
|
||||
conf_read_mode = 1;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (s.find("[/card]") != string::npos){
|
||||
if (s[0] == '[' && s[1] == '/'){
|
||||
conf_read_mode = 0;
|
||||
total_cards++;
|
||||
}else{
|
||||
|
||||
@@ -358,7 +358,7 @@ void MTGGuiPlay::Render(){
|
||||
|
||||
if (mCount && mObjects[mCurr] != NULL){
|
||||
mObjects[mCurr]->Render();
|
||||
if (hasFocus && mCurr >= offset && showBigCards && last_user_move > BIG_CARD_RENDER_TIME){
|
||||
if (hasFocus && mCurr >= offset && showBigCards){
|
||||
((CardGui *)mObjects[mCurr])->RenderBig(-1,-1,showBigCards-1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user