static void chenjesu_intelligence (ELEMENT *ShipPtr, EVALUATE_DESC *ObjectsOfConcern, COUNT ConcernCounter) { EVALUATE_DESC *lpEvalDesc; STARSHIP *StarShipPtr; GetElementStarShip (ShipPtr, &StarShipPtr); StarShipPtr->ship_input_state &= ~SPECIAL; lpEvalDesc = &ObjectsOfConcern[ENEMY_SHIP_INDEX]; if (lpEvalDesc->ObjectPtr) { STARSHIP *EnemyStarShipPtr; GetElementStarShip (lpEvalDesc->ObjectPtr, &EnemyStarShipPtr); if ((lpEvalDesc->which_turn <= 16 && MANEUVERABILITY ( &EnemyStarShipPtr->RaceDescPtr->cyborg_control ) >= MEDIUM_SHIP) || (MANEUVERABILITY ( &EnemyStarShipPtr->RaceDescPtr->cyborg_control ) <= SLOW_SHIP && WEAPON_RANGE ( &EnemyStarShipPtr->RaceDescPtr->cyborg_control ) >= LONG_RANGE_WEAPON * 3 / 4 && (EnemyStarShipPtr->RaceDescPtr->ship_info.ship_flags & SEEKING_WEAPON))) lpEvalDesc->MoveState = PURSUE; } if (StarShipPtr->special_counter == 1 && ObjectsOfConcern[ENEMY_WEAPON_INDEX].ObjectPtr && ObjectsOfConcern[ENEMY_WEAPON_INDEX].MoveState == ENTICE && ObjectsOfConcern[ENEMY_WEAPON_INDEX].which_turn <= 8) { lpEvalDesc = &ObjectsOfConcern[ENEMY_WEAPON_INDEX]; } ship_intelligence (ShipPtr, ObjectsOfConcern, ConcernCounter); if (lpEvalDesc->ObjectPtr) { HELEMENT h, hNext; ELEMENT *CrystalPtr; h = (StarShipPtr->old_status_flags & WEAPON) ? GetTailElement () : (HELEMENT)0; for (; h; h = hNext) { LockElement (h, &CrystalPtr); hNext = GetPredElement (CrystalPtr); if (!(CrystalPtr->state_flags & NONSOLID) && CrystalPtr->next.image.farray == StarShipPtr->RaceDescPtr->ship_data.weapon && CrystalPtr->preprocess_func && CrystalPtr->life_span > 0 && elementsOfSamePlayer (CrystalPtr, ShipPtr)) { if (ObjectsOfConcern[ENEMY_SHIP_INDEX].ObjectPtr) { COUNT which_turn; if ((which_turn = PlotIntercept (CrystalPtr, ObjectsOfConcern[ENEMY_SHIP_INDEX].ObjectPtr, CrystalPtr->life_span, FRAGMENT_RANGE / 2)) == 0 || (which_turn == 1 && PlotIntercept (CrystalPtr, ObjectsOfConcern[ENEMY_SHIP_INDEX].ObjectPtr, CrystalPtr->life_span, 0) == 0)) StarShipPtr->ship_input_state &= ~WEAPON; else if (StarShipPtr->weapon_counter == 0) { StarShipPtr->ship_input_state |= WEAPON; lpEvalDesc = &ObjectsOfConcern[ENEMY_SHIP_INDEX]; } UnlockElement (h); break; } hNext = 0; } UnlockElement (h); } if (h == 0) { if (StarShipPtr->old_status_flags & WEAPON) { StarShipPtr->ship_input_state &= ~WEAPON; if (lpEvalDesc == &ObjectsOfConcern[ENEMY_WEAPON_INDEX]) StarShipPtr->weapon_counter = 3; } else if (StarShipPtr->weapon_counter == 0 && ship_weapons (ShipPtr, lpEvalDesc->ObjectPtr, FRAGMENT_RANGE / 2)) StarShipPtr->ship_input_state |= WEAPON; } } if (StarShipPtr->special_counter < MAX_DOGGIES) { if (lpEvalDesc->ObjectPtr && StarShipPtr->RaceDescPtr->ship_info.energy_level <= SPECIAL_ENERGY_COST && !(StarShipPtr->ship_input_state & WEAPON)) StarShipPtr->ship_input_state |= SPECIAL; } }
static void androsynth_intelligence (ELEMENT *ShipPtr, EVALUATE_DESC *ObjectsOfConcern, COUNT ConcernCounter) { EVALUATE_DESC *lpEvalDesc; STARSHIP *StarShipPtr; GetElementStarShip (ShipPtr, &StarShipPtr); lpEvalDesc = &ObjectsOfConcern[ENEMY_WEAPON_INDEX]; /* in blazer form */ if (ShipPtr->next.image.farray == StarShipPtr->RaceDescPtr->ship_data.special) { ObjectsOfConcern[CREW_OBJECT_INDEX].ObjectPtr = 0; if (lpEvalDesc->ObjectPtr && lpEvalDesc->MoveState == ENTICE) { if ((lpEvalDesc->ObjectPtr->state_flags & FINITE_LIFE) && !(lpEvalDesc->ObjectPtr->state_flags & CREW_OBJECT)) lpEvalDesc->MoveState = AVOID; else lpEvalDesc->ObjectPtr = 0; } ship_intelligence (ShipPtr, ObjectsOfConcern, ConcernCounter); } else { STARSHIP *pEnemyStarShip = NULL; lpEvalDesc = &ObjectsOfConcern[ENEMY_SHIP_INDEX]; if (lpEvalDesc->ObjectPtr) { GetElementStarShip (lpEvalDesc->ObjectPtr, &pEnemyStarShip); // JMS_GFX if (lpEvalDesc->which_turn <= 16 && (StarShipPtr->special_counter > 0 || StarShipPtr->RaceDescPtr->ship_info.energy_level < MAX_ENERGY / 3 || ((WEAPON_RANGE (&pEnemyStarShip->RaceDescPtr->cyborg_control) <= (CLOSE_RANGE_WEAPON << RESOLUTION_FACTOR) && lpEvalDesc->ObjectPtr->crew_level > BLAZER_DAMAGE) || (lpEvalDesc->ObjectPtr->crew_level > (BLAZER_DAMAGE * 3) && MANEUVERABILITY (&pEnemyStarShip->RaceDescPtr->cyborg_control) > SLOW_SHIP)))) lpEvalDesc->MoveState = ENTICE; } ship_intelligence (ShipPtr, ObjectsOfConcern, ConcernCounter); if (StarShipPtr->special_counter == 0) { StarShipPtr->ship_input_state &= ~SPECIAL; // JMS_GFX if ((ObjectsOfConcern[ENEMY_WEAPON_INDEX].ObjectPtr && ObjectsOfConcern[ENEMY_WEAPON_INDEX].which_turn <= 4) || (lpEvalDesc->ObjectPtr && StarShipPtr->RaceDescPtr->ship_info.energy_level >= MAX_ENERGY / 3 && (WEAPON_RANGE (&pEnemyStarShip->RaceDescPtr->cyborg_control) >= WEAPON_RANGE (&StarShipPtr->RaceDescPtr->cyborg_control) << 1 || (lpEvalDesc->which_turn < 16 && (WEAPON_RANGE (&pEnemyStarShip->RaceDescPtr->cyborg_control) > (CLOSE_RANGE_WEAPON << RESOLUTION_FACTOR) || lpEvalDesc->ObjectPtr->crew_level <= BLAZER_DAMAGE) && (lpEvalDesc->ObjectPtr->crew_level <= (BLAZER_DAMAGE * 3) || MANEUVERABILITY (&pEnemyStarShip->RaceDescPtr->cyborg_control) <= SLOW_SHIP))))) StarShipPtr->ship_input_state |= SPECIAL; } if (!(StarShipPtr->ship_input_state & SPECIAL) && StarShipPtr->weapon_counter == 0 && lpEvalDesc->ObjectPtr) { if (lpEvalDesc->which_turn <= 4) StarShipPtr->ship_input_state |= WEAPON; else if (lpEvalDesc->MoveState != PURSUE && lpEvalDesc->which_turn <= 12) { COUNT travel_facing, direction_facing; SIZE delta_x, delta_y, ship_delta_x, ship_delta_y, other_delta_x, other_delta_y; GetCurrentVelocityComponents (&ShipPtr->velocity, &ship_delta_x, &ship_delta_y); GetCurrentVelocityComponents (&lpEvalDesc->ObjectPtr->velocity, &other_delta_x, &other_delta_y); delta_x = ship_delta_x - other_delta_x; delta_y = ship_delta_y - other_delta_y; travel_facing = ARCTAN (delta_x, delta_y); delta_x = lpEvalDesc->ObjectPtr->next.location.x - ShipPtr->next.location.x; delta_y = lpEvalDesc->ObjectPtr->next.location.y - ShipPtr->next.location.y; direction_facing = ARCTAN (delta_x, delta_y); if (NORMALIZE_ANGLE (travel_facing - direction_facing + OCTANT) <= QUADRANT) StarShipPtr->ship_input_state |= WEAPON; } } } }
static void mmrnmhrm_intelligence (ELEMENT *ShipPtr, EVALUATE_DESC *ObjectsOfConcern, COUNT ConcernCounter) { BOOLEAN CanTransform; EVALUATE_DESC *lpEvalDesc; STARSHIP *StarShipPtr; STARSHIP *EnemyStarShipPtr; GetElementStarShip (ShipPtr, &StarShipPtr); CanTransform = (BOOLEAN)(StarShipPtr->special_counter == 0 && StarShipPtr->RaceDescPtr->ship_info.energy_level >= StarShipPtr->RaceDescPtr->characteristics.special_energy_cost); lpEvalDesc = &ObjectsOfConcern[ENEMY_SHIP_INDEX]; if (lpEvalDesc->ObjectPtr) { GetElementStarShip (lpEvalDesc->ObjectPtr, &EnemyStarShipPtr); } ship_intelligence (ShipPtr, ObjectsOfConcern, ConcernCounter); StarShipPtr->ship_input_state &= ~SPECIAL; if (CanTransform && lpEvalDesc->ObjectPtr && !(StarShipPtr->ship_input_state & WEAPON)) { SIZE delta_x, delta_y; COUNT travel_angle, direction_angle; GetCurrentVelocityComponents (&lpEvalDesc->ObjectPtr->velocity, &delta_x, &delta_y); if (delta_x == 0 && delta_y == 0) direction_angle = travel_angle = 0; else { delta_x = lpEvalDesc->ObjectPtr->current.location.x - ShipPtr->current.location.x; delta_y = lpEvalDesc->ObjectPtr->current.location.y - ShipPtr->current.location.y; direction_angle = ARCTAN (-delta_x, -delta_y); travel_angle = GetVelocityTravelAngle ( &lpEvalDesc->ObjectPtr->velocity ); } if (ShipPtr->next.image.farray == StarShipPtr->RaceDescPtr->ship_data.ship) { if (lpEvalDesc->which_turn > 8) { if (MANEUVERABILITY (&EnemyStarShipPtr->RaceDescPtr->cyborg_control) <= SLOW_SHIP || NORMALIZE_ANGLE ( direction_angle - travel_angle + QUADRANT ) > HALF_CIRCLE) StarShipPtr->ship_input_state |= SPECIAL; } } else { SIZE ship_delta_x, ship_delta_y; GetCurrentVelocityComponents (&ShipPtr->velocity, &ship_delta_x, &ship_delta_y); delta_x -= ship_delta_x; delta_y -= ship_delta_y; travel_angle = ARCTAN (delta_x, delta_y); if (lpEvalDesc->which_turn < 16) { if (lpEvalDesc->which_turn <= 8 || NORMALIZE_ANGLE ( direction_angle - travel_angle + OCTANT ) <= QUADRANT) StarShipPtr->ship_input_state |= SPECIAL; } else if (lpEvalDesc->which_turn > 32 && NORMALIZE_ANGLE ( direction_angle - travel_angle + QUADRANT ) > HALF_CIRCLE) StarShipPtr->ship_input_state |= SPECIAL; } } if (ShipPtr->current.image.farray == StarShipPtr->RaceDescPtr->ship_data.special) { if (!(StarShipPtr->ship_input_state & SPECIAL) && lpEvalDesc->ObjectPtr) StarShipPtr->ship_input_state |= WEAPON; else StarShipPtr->ship_input_state &= ~WEAPON; } }