Game Objects

Troop

class coc.Troop

Represents a Troop object as returned by the API, optionally filled with game data.

name

The troop’s name.

Type:

str

village

The village type (home or builder base) where this troop belongs.

Type:

VillageType

is_home_base

Whether this troop belongs to the home village.

Type:

bool

is_builder_base

Whether this troop belongs to the builder base.

Type:

bool

max_level

The maximum level this troop can be upgraded to.

Type:

int

is_active

Whether this super troop is currently active/boosted.

Type:

bool

id

The troop’s unique identifier.

Type:

int

info

Description of the troop.

Type:

str

TID

The troop’s translation IDs for localization.

Type:

TID

production_building

The building type that produces this troop.

Type:

ProductionBuildingType

production_building_level

The required level of the production building to unlock this troop.

Type:

int

upgrade_resource

The resource type required to upgrade this troop.

Type:

Resource

is_flying

Whether this troop is an air unit.

Type:

bool

is_air_targeting

Whether this troop can target air units.

Type:

bool

is_ground_targeting

Whether this troop can target ground units.

Type:

bool

movement_speed

The troop’s movement speed.

Type:

int

attack_speed

The troop’s attack speed.

Type:

int

attack_range

The troop’s attack range.

Type:

int

housing_space

The housing space this troop occupies.

Type:

int

is_super_troop

Whether this is a super troop.

Type:

bool

is_seasonal

Whether this is a seasonal/temporary troop.

Type:

bool

is_siege_machine

Whether this is a siege machine.

Type:

bool

base_troop_id

The ID of the base troop (only for super troops).

Type:

int

base_troop_minimum_level

The minimum level of the base troop required to boost this super troop.

Type:

int

hitpoints

The troop’s hitpoints.

Type:

int

dps

The troop’s damage per second.

Type:

int

upgrade_time

The time required to upgrade to the next level.

Type:

TimeDelta

upgrade_cost

The cost to upgrade to the next level.

Type:

int

required_lab_level

The laboratory level required to upgrade to the next level.

Type:

Optional[int]

required_townhall

The townhall level required to upgrade to the next level.

Type:

int

strength_weight

The matchmaking strength weight of a troop

Type:

int

Hero

class coc.Hero

Represents a Hero object as returned by the API, optionally filled with game data.

name

The hero’s name.

Type:

str

village

The village type (home or builder base) where this hero belongs.

Type:

VillageType

is_home_base

Whether this hero belongs to the home village.

Type:

bool

is_builder_base

Whether this hero belongs to the builder base.

Type:

bool

max_level

The maximum level this hero can be upgraded to.

Type:

int

id

The hero’s unique identifier.

Type:

int

info

Description of the hero.

Type:

str

TID

The hero’s translation IDs for localization.

Type:

TID

production_building

The building type that produces this hero.

Type:

ProductionBuildingType

production_building_level

The required level of the production building to unlock this hero.

Type:

int

upgrade_resource

The resource type required to upgrade this hero.

Type:

Resource

is_flying

Whether this hero is an air unit.

Type:

bool

is_air_targeting

Whether this hero can target air units.

Type:

bool

is_ground_targeting

Whether this hero can target ground units.

Type:

bool

movement_speed

The hero’s movement speed.

Type:

int

attack_speed

The hero’s attack speed.

Type:

int

attack_range

The hero’s attack range.

Type:

int

hitpoints

The hero’s hitpoints.

Type:

int

dps

The hero’s damage per second.

Type:

int

upgrade_time

The time required to upgrade to the next level.

Type:

TimeDelta

upgrade_cost

The cost to upgrade to the next level.

Type:

int

required_hero_tavern_level

The hero tavern level required to upgrade to the next level.

Type:

Optional[int]

required_townhall

The townhall level required to upgrade to the next level.

Type:

int

strength_weight

The matchmaking strength weight of a hero

Type:

int

Pet

class coc.Pet

Represents a Pet object as returned by the API, optionally filled with game data.

name

The pet’s name.

Type:

str

village

The village type where this pet belongs.

Type:

VillageType

max_level

The maximum level this pet can be upgraded to.

Type:

int

id

The pet’s unique identifier.

Type:

int

info

Description of the pet.

Type:

str

TID

The pet’s translation IDs for localization.

Type:

TID

production_building

The building type that produces this pet.

Type:

ProductionBuildingType

production_building_level

The required level of the production building to unlock this pet.

Type:

int

upgrade_resource

The resource type required to upgrade this pet.

Type:

Resource

is_flying

Whether this pet is an air unit.

Type:

bool

is_air_targeting

Whether this pet can target air units.

Type:

bool

is_ground_targeting

Whether this pet can target ground units.

Type:

bool

movement_speed

The pet’s movement speed.

Type:

int

attack_speed

The pet’s attack speed.

Type:

int

attack_range

The pet’s attack range.

Type:

int

hitpoints

The pet’s hitpoints.

Type:

int

dps

The pet’s damage per second.

Type:

int

upgrade_time

The time required to upgrade to the next level.

Type:

TimeDelta

upgrade_cost

The cost to upgrade to the next level.

Type:

int

required_pet_house_level

The pet house level required to upgrade to the next level.

Type:

Optional[int]

required_townhall

The townhall level required to upgrade to the next level.

Type:

int

strength_weight

The matchmaking strength weight of a pet

Type:

int

Spell

class coc.Spell

Represents a Spell object as returned by the API, optionally filled with game data.

name

The spell’s name.

Type:

str

village

The village type (home or builder base) where this spell belongs.

Type:

VillageType

max_level

The maximum level this spell can be upgraded to.

Type:

int

id

The spell’s unique identifier.

Type:

int

info

Description of the spell.

Type:

str

TID

The spell’s translation IDs for localization.

Type:

TID

production_building

The building type that produces this spell.

Type:

ProductionBuildingType

production_building_level

The required level of the production building to unlock this spell.

Type:

int

upgrade_resource

The resource type required to upgrade this spell.

Type:

Resource

housing_space

The housing space this spell occupies.

Type:

int

is_seasonal

Whether this is a seasonal/temporary spell.

Type:

bool

duration

The duration of the spell’s effect.

Type:

TimeDelta

damage

The damage dealt by the spell.

Type:

int

radius

The spell’s area of effect radius.

Type:

float

upgrade_time

The time required to upgrade to this level.

Type:

TimeDelta

upgrade_cost

The cost to upgrade to this level.

Type:

int

required_lab_level

The laboratory level required to upgrade to the next level.

Type:

int

required_townhall

The townhall level required to upgrade to the next level.

Type:

int

strength_weight

The matchmaking strength weight of a spell

Type:

int

Guardian

class coc.Guardian

Represents a Guardian character as returned by the API, optionally filled with game data.

id

The guardian’s unique identifier.

Type:

int

name

The guardian’s name.

Type:

str

info

Description of the guardian.

Type:

str

TID

The guardian’s translation IDs for localization.

Type:

TID

upgrade_resource

The resource type required to upgrade this guardian.

Type:

Resource

is_flying

Whether this guardian is an air unit.

Type:

bool

is_air_targeting

Whether this guardian can target air units.

Type:

bool

is_ground_targeting

Whether this guardian can target ground units.

Type:

bool

movement_speed

The guardian’s movement speed.

Type:

int

attack_speed

The guardian’s attack speed.

Type:

int

attack_range

The guardian’s attack range.

Type:

int

hitpoints

The guardian’s hitpoints.

Type:

int

dps

The guardian’s damage per second.

Type:

int

upgrade_time

The time required to upgrade to the next level.

Type:

TimeDelta

upgrade_cost

The cost to upgrade to the next level.

Type:

int

required_townhall

The townhall level required to upgrade to the next level.

Type:

int

Helper

class coc.Helper

Represents a Helper character as returned by the API, optionally filled with game data.

id

The helper’s unique identifier.

Type:

int

name

The helper’s name.

Type:

str

TID

The helper’s translation IDs for localization.

Type:

TID

upgrade_resource

The resource type required to upgrade this helper.

Type:

Resource

upgrade_cost

The cost to upgrade to the next level.

Type:

int

required_townhall

The townhall level required to upgrade to the next level.

Type:

int

Building

class coc.Building

Represents a Building.

id

The building’s unique identifier.

Type:

int

name

The building’s name.

Type:

str

info

Description of the building.

Type:

str

TID

The building’s translation IDs for localization.

Type:

TID

type

The type of building.

Type:

BuildingType

upgrade_resource

The resource type required to upgrade this building.

Type:

Resource

village

The village type where this building belongs.

Type:

VillageType

width

The width of the building.

Type:

int

is_home_base

Whether this building belongs to the home village.

Type:

bool

is_builder_base

Whether this building belongs to the builder base.

Type:

bool

is_superchargeable

Whether this building can be supercharged.

Type:

bool

gear_up

The gear up requirements for this building.

Type:

Optional[GearUp]

seasonal_defenses

The list of seasonal defenses for this building (Crafting Station only).

Type:

List[SeasonalDefense]

weapon

The townhall weapon (only for townhall).

Type:

Optional[TownhallWeapon]

build_cost

The cost to build/upgrade to this level.

Type:

int

build_time

The time required to build/upgrade to this level.

Type:

TimeDelta

required_townhall

The townhall level required to build/upgrade to this level.

Type:

int

strength_weight

The matchmaking strength weight of a building

Type:

int

hitpoints

The building’s hitpoints.

Type:

int

dps

The building’s damage per second.

Type:

int

supercharge

The supercharge for this building.

Type:

Optional[Supercharge]

merge_requirement

The merge requirements for this building.

Type:

List[MergeRequirement]

unlocks

The unlocks provided by this building (only for townhall).

Type:

List[TownhallUnlock]

Note

To get the upgrade cost, access the build_cost of the next level.

SeasonalDefenseModule

class coc.SeasonalDefenseModule

Represents a Seasonal Defense Module.

id

The module’s unique identifier.

Type:

int

name

The module’s name.

Type:

str

TID

The module’s translation IDs for localization.

Type:

TID

upgrade_resource

The resource type required to upgrade this module.

Type:

Resource

max_level

The maximum level this module can be upgraded to.

Type:

int

build_cost

The cost to build/upgrade to this level.

Type:

int

build_time

The time required to build/upgrade to this level.

Type:

TimeDelta

ability_data

The ability data for this module.

Type:

dict

Note

To get the upgrade cost, access the build_cost of the next level.

SeasonalDefense

class coc.SeasonalDefense

Represents a Seasonal Defense.

id

The defense’s unique identifier.

Type:

int

name

The defense’s name.

Type:

str

info

Description of the defense.

Type:

str

TID

The defense’s translation IDs for localization.

Type:

TID

modules

The list of modules for this defense.

Type:

List[SeasonalDefenseModule]

level

The total level (sum of all module levels).

Type:

int

MergeRequirement

class coc.MergeRequirement

Represents a building merge requirement.

id

The building’s unique identifier.

Type:

int

name

The building’s name.

Type:

str

geared_up

Whether the building needs to be geared up.

Type:

bool

required_level

The required level of the building.

Type:

int

GearUp

class coc.GearUp

Represents a gear up requirement for a building.

required_level

The required level to gear up.

Type:

int

building_id

The building ID required for gear up.

Type:

int

resource

The resource type required for gear up.

Type:

Resource

TownhallUnlock

class coc.TownhallUnlock

Represents a building unlock at a townhall level.

name

The name of the unlocked item.

Type:

str

_id

The id of the unlocked building.

Type:

int

quantity

The quantity unlocked.

Type:

int

TownhallWeapon

class coc.TownhallWeapon

Represents a Townhall Weapon.

name

The weapon’s name.

Type:

str

info

Description of the weapon.

Type:

str

TID

The weapon’s translation IDs for localization.

Type:

TID

upgrade_resource

The resource type required to upgrade this weapon.

Type:

Resource

build_cost

The cost to build/upgrade to this level.

Type:

int

build_time

The time required to build/upgrade to this level.

Type:

TimeDelta

strength_weight

The matchmaking strength weight of a th weapon

Type:

int

dps

The weapon’s damage per second.

Type:

int

Note

To get the upgrade cost, access the build_cost of the next level.

Supercharge

class coc.Supercharge

Represents a Supercharge for a building.

upgrade_resource

The resource type required to upgrade this supercharge.

Type:

Resource

build_cost

The cost to build/upgrade to this level.

Type:

int

build_time

The time required to build/upgrade to this level.

Type:

TimeDelta

hitpoints_buff

The hitpoints buff provided by this supercharge.

Type:

int

dps_buff

The damage per second buff provided by this supercharge.

Type:

int

Note

To get the upgrade cost, access the build_cost of the next level.

Trap

class coc.Trap

Represents a Trap.

id

The trap’s unique identifier.

Type:

int

name

The trap’s name.

Type:

str

TID

The trap’s translation IDs for localization.

Type:

TID

upgrade_resource

The resource type required to upgrade this trap.

Type:

Resource

village

The village type where this trap belongs.

Type:

VillageType

is_home_base

Whether this trap belongs to the home village.

Type:

bool

is_builder_base

Whether this trap belongs to the builder base.

Type:

bool

width

The width of the trap.

Type:

int

is_air_triggerable

Whether this trap can be triggered by air units.

Type:

bool

is_ground_triggerable

Whether this trap can be triggered by ground units.

Type:

bool

damage_radius

The damage radius of the trap.

Type:

int

trigger_radius

The trigger radius of the trap.

Type:

int

build_cost

The cost to build/upgrade to this level.

Type:

int

build_time

The time required to build/upgrade to this level.

Type:

TimeDelta

required_townhall

The townhall level required to build/upgrade to this level.

Type:

int

strength_weight

The matchmaking strength weight of a trap

Type:

int

damage

The damage dealt by the trap.

Type:

int

Note

To get the upgrade cost, access the build_cost of the next level.

Decoration

class coc.Decoration

Represents a Decoration.

id

The decoration’s unique identifier.

Type:

int

name

The decoration’s name.

Type:

str

TID

The decoration’s translation IDs for localization.

Type:

TID

width

The width of the decoration.

Type:

int

in_shop

Whether this decoration is available in the shop.

Type:

bool

pass_reward

Whether this decoration is a pass reward.

Type:

bool

max_count

The maximum number of this decoration that can be placed.

Type:

int

shop_resource

The resource type required to buy this decoration.

Type:

Resource

cost

The cost to buy/place this decoration.

Type:

int

village

The village type where this decoration belongs.

Type:

VillageType

Obstacle

class coc.Obstacle

Represents an Obstacle.

id

The obstacle’s unique identifier.

Type:

int

name

The obstacle’s name.

Type:

str

TID

The obstacle’s translation IDs for localization.

Type:

TID

width

The width of the obstacle.

Type:

int

clear_resource

The resource type required to clear this obstacle.

Type:

Resource

clear_cost

The cost to clear this obstacle.

Type:

int

loot_resource

The resource type obtained from clearing this obstacle.

Type:

Optional[Resource]

loot_count

The amount of loot obtained from clearing this obstacle.

Type:

Optional[int]

village

The village type where this obstacle belongs.

Type:

VillageType

Scenery

class coc.Scenery

Represents a Scenery.

id

The scenery’s unique identifier.

Type:

int

name

The scenery’s name.

Type:

str

TID

The scenery’s translation IDs for localization.

Type:

TID

village

The scenery type.

Type:

SceneryType

has_music

Whether this scenery has custom music.

Type:

bool

Skin

class coc.Skin

Represents a Hero Skin.

id

The skin’s unique identifier.

Type:

int

name

The skin’s name.

Type:

str

TID

The skin’s translation IDs for localization.

Type:

TID

tier

The tier/rarity of the skin.

Type:

str

hero

The hero this skin belongs to.

Type:

str

ClanCapitalHousePart

class coc.ClanCapitalHousePart

Represents a Clan Capital House Part.

id

The house part’s unique identifier.

Type:

int

name

The house part’s name.

Type:

str

slot_type

The type of house element slot.

Type:

PlayerHouseElementType

pass_reward

Whether this house part is a pass reward.

Type:

bool