Modifiers are at the heart of gameplay effects in Civilization VII. They define how game elements interact with each other and enable you to create unique gameplay mechanics for your mod. A modifier consists of several key components:
Collection: What entities the modifier affects (units, cities, players, etc.)
Effect: What the modifier actually does (adjust combat strength, change yields, etc.)
Requirements: Optional conditions that must be met for the modifier to apply
Arguments: Values that configure how the effect works
Localization: Text descriptions that explain the modifier to players
Collections define what game entities are affected by a modifier. Here are some commonly used collections:
import { COLLECTION } from "civ7-modding-tools";// Available collectionsconst collections = { // Units PLAYER_UNITS: COLLECTION.PLAYER_UNITS, // All units belonging to the player // Cities PLAYER_CITIES: COLLECTION.PLAYER_CITIES, // All cities belonging to the player ALL_CITIES: COLLECTION.ALL_CITIES, // All cities in the game CITY_SELF: COLLECTION.CITY_SELF, // The city itself (for city-specific effects) // Players OWNER: COLLECTION.OWNER, // The player who owns the entity ALL_PLAYERS: COLLECTION.ALL_PLAYERS, // All players in the game // Tiles ADJACENT_PLOTS: COLLECTION.ADJACENT_PLOTS, // Plots adjacent to a specific location PLAYER_PLOTS: COLLECTION.PLAYER_PLOTS // All plots controlled by the player};
Effects define what the modifier actually does. Here are some commonly used effects:
import { EFFECT } from "civ7-modding-tools";// Unit effectsconst unitEffects = { ADJUST_COMBAT_STRENGTH: EFFECT.UNIT_ADJUST_COMBAT_STRENGTH, // Change unit combat strength ADJUST_MOVEMENT: EFFECT.UNIT_ADJUST_MOVEMENT, // Change unit movement points ADJUST_SIGHT: EFFECT.UNIT_ADJUST_SIGHT, // Change unit sight range ADJUST_MAINTENANCE: EFFECT.UNIT_ADJUST_MAINTENANCE // Change unit maintenance cost};// City effectsconst cityEffects = { ADJUST_YIELD: EFFECT.CITY_ADJUST_YIELD, // Change city yield (production, food, etc.) ADJUST_GROWTH: EFFECT.CITY_ADJUST_GROWTH, // Change city growth rate ADJUST_BUILDING_PRODUCTION: EFFECT.CITY_ADJUST_BUILDING_PRODUCTION // Change production for buildings};// Player effectsconst playerEffects = { ADJUST_CONSTRUCTIBLE_YIELD: EFFECT.PLAYER_ADJUST_CONSTRUCTIBLE_YIELD, // Change yields from constructibles ENABLE_UNIT: EFFECT.PLAYER_ENABLE_UNIT, // Allow the player to build a unit ENABLE_BUILDING: EFFECT.PLAYER_ENABLE_BUILDING // Allow the player to build a building};
Requirements define conditions that must be met for the modifier to apply:
import { REQUIREMENT } from "civ7-modding-tools";// Unit requirementsconst unitRequirements = { UNIT_TAG_MATCHES: REQUIREMENT.UNIT_TAG_MATCHES, // Unit has a specific tag UNIT_IS_DEFENDING: REQUIREMENT.UNIT_IS_DEFENDING, // Unit is in a defensive position UNIT_IS_ATTACKING: REQUIREMENT.UNIT_IS_ATTACKING // Unit is attacking};// Terrain requirementsconst terrainRequirements = { COMBAT_IS_IN_HILLS: REQUIREMENT.COMBAT_IS_IN_HILLS, // Combat occurs in hills PLOT_IS_TERRAIN_TYPE: REQUIREMENT.PLOT_IS_TERRAIN_TYPE, // Plot is a specific terrain type PLOT_HAS_FEATURE: REQUIREMENT.PLOT_HAS_FEATURE // Plot has a feature (forest, etc.)};// Player requirementsconst playerRequirements = { PLAYER_IS_CIVILIZATION_TYPE: REQUIREMENT.PLAYER_IS_CIVILIZATION_TYPE, // Player is a specific civilization PLAYER_IS_AT_WAR: REQUIREMENT.PLAYER_IS_AT_WAR, // Player is at war PLAYER_IS_IN_AGE: REQUIREMENT.PLAYER_IS_IN_AGE // Player is in a specific age};// City requirementsconst cityRequirements = { CITY_HAS_BUILDING: REQUIREMENT.CITY_HAS_BUILDING, // City has a specific building CITY_HAS_UNIQUE_QUARTER: REQUIREMENT.CITY_HAS_UNIQUE_QUARTER // City has a specific unique quarter};
Modifiers generally need to be bound to game elements to take effect:
import { CivilizationBuilder, ModifierBuilder, TraditionBuilder, UnitBuilder} from "civ7-modding-tools";// Create a civilizationconst dacia = new CivilizationBuilder({ // Configuration...});// Create a modifierconst dacianBonus = new ModifierBuilder({ // Combat strength bonus configuration...});// Bind the modifier to the civilizationdacia.bind([dacianBonus]);// Example: Binding to a traditionconst tradition = new TraditionBuilder({ // Configuration...});tradition.bind([dacianBonus]);// Example: Binding to a unitconst unit = new UnitBuilder({ // Configuration...});unit.bind([dacianBonus]);
Modifiers and effects are powerful tools for creating unique gameplay mechanics in your Civilization VII mods. By combining different collections, effects, requirements, and arguments, you can create a wide variety of gameplay alterations that make your mod stand out.