void GetOtherSentinels(Unit* who) { bool *chosenAbilities = new bool[9]; memset(chosenAbilities, 0, 9*sizeof(bool)); selectAbility(pickAbilityRandom(chosenAbilities)); ClearBuddyList(); AddSentinelsNear(me); int bli; for (bli = 0; bli < 3; ++bli) { if (!NearbyGUID[bli]) break; Creature* pNearby = Unit::GetCreature(*me, NearbyGUID[bli]); if (!pNearby) break; AddSentinelsNear(pNearby); CAST_AI(aqsentinelAI, pNearby->AI())->gatherOthersWhenAggro = false; CAST_AI(aqsentinelAI, pNearby->AI())->selectAbility(pickAbilityRandom(chosenAbilities)); } /*if (bli < 3) DoYell("I dont have enough buddies.", LANG_NEUTRAL, 0);*/ SendMyListToBuddies(); CallBuddiesToAttack(who); delete[] chosenAbilities; }
bool MTGPlayer_tap(MTGPlayer* player,Permanent* permanent) { List* options = InitList(); char buffer[256]; char* c = buffer; for (unsigned int i=0;i<permanent->abilities->size;i++) { char* s = c; Ability* a = permanent->abilities->entries[i]; for (unsigned int j=0;j<a->manaCost->size;j++) { Manacost* m = a->manaCost->entries[j]; char color; switch (m->color1) { case WHITE: color = 'W'; break; case BLUE: color = 'U'; break; case BLACK: color = 'B'; break; case RED: color = 'R'; break; case GREEN: color = 'G'; break; case COLORLESS: color = ' '; break; } c += sprintf(c,"{%d%c}",m->num,color); } c += sprintf(c,"%s",a->needs_tap?"{T}":"") + 1; AppendToList(options, s); } if (permanent->subtypes.is_land) { if (permanent->subtypes.is_plains) AppendToList(options, "W"); if (permanent->subtypes.is_island) AppendToList(options, "U"); if (permanent->subtypes.is_swamp) AppendToList(options, "B"); if (permanent->subtypes.is_mountain) AppendToList(options, "R"); if (permanent->subtypes.is_forest) AppendToList(options, "G"); if (permanent->source == cd.DarksteelCitadel) AppendToList(options, "C"); permanent->is_tapped = true; } if (options->size > 1) { if (player == player1) selectAbility(permanent,options); else AI_selectAbility(permanent,options); DeleteList(options); return false; } else { permanent->selectedAbility = 1; DeleteList(options); return true; } }
void GetOtherSentinels(Unit* who) { bool *chosenAbilities = new bool[9]; memset(chosenAbilities, 0, 9*sizeof(bool)); selectAbility(pickAbilityRandom(chosenAbilities)); ClearBudyList(); AddSentinelsNear(me); int bli; for (bli = 0; bli < 3; ++bli) { if (!nearby[bli]) break; AddSentinelsNear(nearby[bli]); ((aqsentinelAI *)nearby[bli]->AI())->gatherOthersWhenAggro = false; ((aqsentinelAI *)nearby[bli]->AI())->selectAbility(pickAbilityRandom(chosenAbilities)); } /*if (bli < 3) DoYell("I dont have enough buddies.", LANG_NEUTRAL, 0);*/ SendMyListToBuddies(); CallBuddiesToAttack(who); }
int AIMomirPlayer::computeActions() { //Part of the strategy goes here. When should we put a land into play ? /* Another gift from Alex Majlaton on my first day playing Momir, and it has served me well ever since. It goes a little something like this: (a) if you are on the play, hit your Two through Four, skip your Five, and then hit all the way to Eight; (b) if you are on the draw and your opponent skips his One, you make Two through Eight; (c) if you are on the draw and your opponent hits a One, you match him drop-for-drop for the rest of the game. You skip your Five on the play because it is the weakest drop. There are plenty of serviceable guys there, but very few bombs compared to other drops the general rule is this: if you want to get to Eight, you have to skip two drops on the play and one drop on the draw. */ Player * p = observer->currentPlayer; if (!(observer->currentlyActing() == this)) return 0; if (chooseTarget()) return 1; int currentGamePhase = observer->getCurrentGamePhase(); if (observer->isInterrupting == this) { // interrupting selectAbility(); return 1; } else if (p == this && observer->mLayers->stackLayer()->count(0, NOT_RESOLVED) == 0) { //standard actions CardDescriptor cd; MTGCardInstance * card = NULL; switch (currentGamePhase) { case MTG_PHASE_FIRSTMAIN: { ManaCost * potentialMana = getPotentialMana(); int converted = potentialMana->getConvertedCost(); SAFE_DELETE(potentialMana); if (converted < 8 || game->hand->nb_cards > 1) { //Attempt to put land into play cd.init(); cd.setColor(Constants::MTG_COLOR_LAND); card = cd.match(game->hand); int canPutLandsIntoPlay = game->playRestrictions->canPutIntoZone(card, game->inPlay); if (card && (canPutLandsIntoPlay == PlayRestriction::CAN_PLAY)) { MTGAbility * putIntoPlay = observer->mLayers->actionLayer()->getAbility(MTGAbility::PUT_INTO_PLAY); AIAction * a = NEW AIAction(this, putIntoPlay, card); //TODO putinplay action clickstream.push(a); return 1; } } momir(); return 1; break; } case MTG_PHASE_SECONDMAIN: selectAbility(); return 1; break; default: return AIPlayerBaka::computeActions(); break; } } return AIPlayerBaka::computeActions(); }