Combat

From pipecat-ai/gradient-bang · View interactive version

Combat is an AI agent skill from the GitHub repository pipecat-ai/gradient-bang. Initiates a combat encounter for testing. Calls the `combat_initiate` edge function to start combat in the sector of a given character/ship.

How to use this skill

Skill file

Combat

Initiates a combat encounter for testing. Calls the combat_initiate edge function to start combat in the sector of a given character/ship.

Parameters

If not provided, ask the user for a character name or ship ID.

Steps

1. Source environment variables

set -a && source .env.supabase && set +a

2. Resolve the character and ship

If target is a character name:

Look up the character by name:

curl -s "${SUPABASE_URL}/rest/v1/characters?name=eq.<character_name>&select=character_id,name,current_ship_id,corporation_id" \
  -H "apikey: ${SUPABASE_SERVICE_ROLE_KEY}" \
  -H "Authorization: Bearer ${SUPABASE_SERVICE_ROLE_KEY}"

If no result, report that the character was not found and stop. Save character_id and current_ship_id.

Then look up the ship to get the sector:

curl -s "${SUPABASE_URL}/rest/v1/ship_instances?ship_id=eq.<current_ship_id>&select=ship_id,ship_type,ship_name,current_sector,current_fighters,current_shields" \
  -H "apikey: ${SUPABASE_SERVICE_ROLE_KEY}" \
  -H "Authorization: Bearer ${SUPABASE_SERVICE_ROLE_KEY}"

If target is a ship UUID:

Look up the ship and its associated character:

curl -s "${SUPABASE_URL}/rest/v1/ship_instances?ship_id=eq.<ship_id>&destroyed_at=is.null&select=ship_id,ship_type,ship_name,current_sector,owner_type,owner_character_id,owner_corporation_id" \
  -H "apikey: ${SUPABASE_SERVICE_ROLE_KEY}" \
  -H "Authorization: Bearer ${SUPABASE_SERVICE_ROLE_KEY}"

For owner_type = "character", use owner_character_id as the character_id.

For owner_type = "corporation", the pseudo-character has character_id = ship_id.

Then look up the character:

curl -s "${SUPABASE_URL}/rest/v1/characters?character_id=eq.<character_id>&select=character_id,name,current_ship_id" \
  -H "apikey: ${SUPABASE_SERVICE_ROLE_KEY}" \
  -H "Authorization: Bearer ${SUPABASE_SERVICE_ROLE_KEY}"

Verify the character exists and current_ship_id matches the ship. If not, report the mismatch and stop.

3. Show sector context

Before initiating, show what's in the sector so the user knows what opponents are present:

curl -s "${SUPABASE_URL}/rest/v1/ship_instances?current_sector=eq.<sector>&destroyed_at=is.null&in_hyperspace=eq.false&select=ship_id,ship_type,ship_name,owner_type,owner_character_id,current_fighters,current_shields,is_escape_pod" \
  -H "apikey: ${SUPABASE_SERVICE_ROLE_KEY}" \
  -H "Authorization: Bearer ${SUPABASE_SERVICE_ROLE_KEY}"

Display a summary table of ships in the sector (name, type, fighters, shields). Highlight the initiating ship.

4. Call combat_initiate

curl -s -X POST "${SUPABASE_URL}/functions/v1/combat_initiate" \
  -H "Content-Type: application/json" \
  -H "x-api-token: ${EDGE_API_TOKEN}" \
  -d '{
    "character_id": "<character_id>",
    "admin_override": true
  }'

If EDGE_API_TOKEN is not set in the environment, omit the x-api-token header (local dev without JWT verification allows all requests).

5. Report the result

Show the user:

Important notes

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.