Beispiel #1
0
void Engine::do_ai() {
    vector<Positionable*> mobs = map->get_all_mobiles_by_dist_to_player();
    for (unsigned i = 0; i < mobs.size(); i++) {
        Mobile* current = (Mobile*) mobs.at(i);
        if (current->is_turn()) {
            current->take_turn();
        }

    }
}
Beispiel #2
0
bool Engine::detect_player_and_mob_turns() {
    //check players turn, set state and break
    if (player->is_turn()) {
        state = PLAYER_TURN;
        return true;
    }

    //check ai turn, set state and break
    vector<Positionable*> mobs = map->get_all_mobiles_by_dist_to_player();
    for (unsigned i = 0; i < mobs.size(); i++) {
        Mobile* current = (Mobile*) mobs.at(i);
        if (current->is_turn()) {
            state = MOB_TURN;
            return true;
        }
    }

    return false;
}