foundry.core.warnings package#
Submodules#
foundry.core.warnings.EnemyCompatibilityWarning module#
- class EnemyCompatibilityWarning#
Bases:
Warning
A warning to ensure that an that checks that the graphics of enemies do not conflict.
- check_object(obj: EnemyObject, level=None, index=0, *args, **kwargs) bool #
Determines if the object should emit a warning for having graphical conflicts.
- Parameters:
- objEnemyObject
The object to check.
- levelPydanticLevel
The level the object is housed inside.
- indexint
The index into the level enemies obj is housed.
- Returns:
- bool
If the object should emit a warning.
- get_message(obj: ObjectLike) str #
Provides a message for an object with a warning.
- Parameters:
- objObjectLike
The object to provide a warning for.
- Returns:
- str
The warning for the object.
- pydantic model PydanticEnemyCompatibilityWarning#
Bases:
PydanticWarning
A JSON model of a warning that checks that the graphics of enemies do not conflict.
Show JSON schema
{ "title": "PydanticEnemyCompatibilityWarning", "description": "A JSON model of a warning that checks that the graphics of enemies do not conflict.", "type": "object", "properties": { "type": { "$ref": "#/definitions/WarningType" } }, "required": [ "type" ], "definitions": { "WarningType": { "title": "WarningType", "description": "An enumeration.", "enum": [ "INVALID OBJECT", "INVALID POSITION", "INVALID SIZE", "INVALID EXTENSION TO GROUND", "OUTSIDE LEVEL BOUNDS", "ENEMY COMPATIBILITY", "INVALID WARP" ], "type": "string" } } }
- Config:
use_enum_values: bool = True
- Fields:
- find_incompatibilities(enemies: list[foundry.game.gfx.objects.EnemyItem.EnemyObject]) tuple[bool, bool] #
Determines if there are any incompatibilities with enemy graphics.
- Parameters:
- enemieslist[EnemyObject]
The enemies to check compatibility of.
- Returns:
- tuple[bool, bool]
If there are any incompatibilities between the 5th and 6th page, respectively.
foundry.core.warnings.ExtendToGroundWarning module#
- class ExtendToGroundWarning#
Bases:
Warning
A warning to ensure that an object does not extend to the ground.
- check_object(obj: LevelObject, *args, **kwargs) bool #
Determines if the object should emit a warning for extending to the ground.
- Parameters:
- objLevelObject
The object to check.
- Returns:
- bool
If the object should emit a warning.
- get_message(obj: ObjectLike) str #
Provides a message for an object with a warning.
- Parameters:
- objObjectLike
The object to provide a warning for.
- Returns:
- str
The warning for the object.
- pydantic model PydanticExtendToGroundWarning#
Bases:
PydanticWarning
A JSON model of a warning that checks that an object does not extend to the ground.
Show JSON schema
{ "title": "PydanticExtendToGroundWarning", "description": "A JSON model of a warning that checks that an object does not extend to the ground.", "type": "object", "properties": { "type": { "$ref": "#/definitions/WarningType" } }, "required": [ "type" ], "definitions": { "WarningType": { "title": "WarningType", "description": "An enumeration.", "enum": [ "INVALID OBJECT", "INVALID POSITION", "INVALID SIZE", "INVALID EXTENSION TO GROUND", "OUTSIDE LEVEL BOUNDS", "ENEMY COMPATIBILITY", "INVALID WARP" ], "type": "string" } } }
- Config:
use_enum_values: bool = True
- Fields:
foundry.core.warnings.InvalidObjectWarning module#
- class InvalidObjectWarning#
Bases:
Warning
A warning for an object that is invalid.
- get_message(obj: ObjectLike, *args, **kwargs) str #
Provides a message for an object with a warning.
- Parameters:
- objObjectLike
The object to provide a warning for.
- Returns:
- str
The warning for the object.
- pydantic model PydanticInvalidObjectWarning#
Bases:
PydanticWarning
A JSON model of a warning that notifies the user of an invalid object.
Show JSON schema
{ "title": "PydanticInvalidObjectWarning", "description": "A JSON model of a warning that notifies the user of an invalid object.", "type": "object", "properties": { "type": { "$ref": "#/definitions/WarningType" } }, "required": [ "type" ], "definitions": { "WarningType": { "title": "WarningType", "description": "An enumeration.", "enum": [ "INVALID OBJECT", "INVALID POSITION", "INVALID SIZE", "INVALID EXTENSION TO GROUND", "OUTSIDE LEVEL BOUNDS", "ENEMY COMPATIBILITY", "INVALID WARP" ], "type": "string" } } }
- Config:
use_enum_values: bool = True
- Fields:
foundry.core.warnings.InvalidPositionWarning module#
- class InvalidPositionWarning(max_x: int | None = None, min_x: int | None = None, max_y: int | None = None, min_y: int | None = None)#
Bases:
Warning
A warning for an object exceeding its valid positional range.
- check_object(obj: ObjectLike, *args, **kwargs) bool #
Determines if the object should emit a warning for having an invalid point.
- Parameters:
- objObjectLike
The object to check.
- Returns:
- bool
If the object should emit a warning.
- get_message(obj: ObjectLike) str #
Provides a message for an object with a warning.
- Parameters:
- objObjectLike
The object to provide a warning for.
- Returns:
- str
The warning for the object.
- pydantic model PydanticInvalidPositionWarning#
Bases:
PydanticWarning
A JSON model of a warning that checks for an object being in a positional range.
Show JSON schema
{ "title": "PydanticInvalidPositionWarning", "description": "A JSON model of a warning that checks for an object being in a positional range.", "type": "object", "properties": { "type": { "$ref": "#/definitions/WarningType" }, "max_x": { "title": "Max X", "type": "integer" }, "min_x": { "title": "Min X", "type": "integer" }, "max_y": { "title": "Max Y", "type": "integer" }, "min_y": { "title": "Min Y", "type": "integer" } }, "required": [ "type" ], "definitions": { "WarningType": { "title": "WarningType", "description": "An enumeration.", "enum": [ "INVALID OBJECT", "INVALID POSITION", "INVALID SIZE", "INVALID EXTENSION TO GROUND", "OUTSIDE LEVEL BOUNDS", "ENEMY COMPATIBILITY", "INVALID WARP" ], "type": "string" } } }
- Config:
use_enum_values: bool = True
- Fields:
foundry.core.warnings.InvalidSizeWarning module#
- class InvalidSizeWarning(max_width: int | None = None, min_width: int | None = None, max_height: int | None = None, min_height: int | None = None)#
Bases:
Warning
A warning for an object exceeding its valid size range.
- check_object(obj: LevelObject, *args, **kwargs) bool #
Determines if the object should emit a warning for having an invalid size.
- Parameters:
- objObjectLike
The object to check.
- Returns:
- bool
If the object should emit a warning.
- get_message(obj: LevelObject) str #
Provides a message for an object with a warning.
- Parameters:
- objObjectLike
The object to provide a warning for.
- Returns:
- str
The warning for the object.
- pydantic model PydanticInvalidSizeWarning#
Bases:
PydanticWarning
A JSON model of a warning that checks for an object being in a size range.
Show JSON schema
{ "title": "PydanticInvalidSizeWarning", "description": "A JSON model of a warning that checks for an object being in a size range.", "type": "object", "properties": { "type": { "$ref": "#/definitions/WarningType" }, "max_width": { "title": "Max Width", "type": "integer" }, "min_width": { "title": "Min Width", "type": "integer" }, "max_height": { "title": "Max Height", "type": "integer" }, "min_height": { "title": "Min Height", "type": "integer" } }, "required": [ "type" ], "definitions": { "WarningType": { "title": "WarningType", "description": "An enumeration.", "enum": [ "INVALID OBJECT", "INVALID POSITION", "INVALID SIZE", "INVALID EXTENSION TO GROUND", "OUTSIDE LEVEL BOUNDS", "ENEMY COMPATIBILITY", "INVALID WARP" ], "type": "string" } } }
- Config:
use_enum_values: bool = True
- Fields:
foundry.core.warnings.InvalidWarpWarning module#
- class InvalidWarpWarning#
Bases:
Warning
A warning for jumps not having a valid warp.
- check_object(obj: Jump, level=None, *args, **kwargs) bool #
Determines if a jump should emit a warning for not having a place to warp to.
- Parameters:
- objJump
The jump to check.
- levelOptional[PydanticLevel]
The level to check the warps of.
- Returns:
- bool
If the jump should emit a warning.
Notes
If not level is provided, no warning will be emitted.
- get_message(obj: ObjectLike) str #
Provides a message for an object with a warning.
- Parameters:
- objObjectLike
The object to provide a warning for.
- Returns:
- str
The warning for the object.
- pydantic model PydanticInvalidWarpWarning#
Bases:
PydanticWarning
A JSON model of a warning that ensures that for a given jump it has a place to warp to.
Show JSON schema
{ "title": "PydanticInvalidWarpWarning", "description": "A JSON model of a warning that ensures that for a given jump it has a place to warp to.", "type": "object", "properties": { "type": { "$ref": "#/definitions/WarningType" } }, "required": [ "type" ], "definitions": { "WarningType": { "title": "WarningType", "description": "An enumeration.", "enum": [ "INVALID OBJECT", "INVALID POSITION", "INVALID SIZE", "INVALID EXTENSION TO GROUND", "OUTSIDE LEVEL BOUNDS", "ENEMY COMPATIBILITY", "INVALID WARP" ], "type": "string" } } }
- Config:
use_enum_values: bool = True
- Fields:
foundry.core.warnings.OutsideLevelBoundsWarning module#
- class OutsideLevelBoundsWarning#
Bases:
Warning
A warning for objects going outside the level bounds.
- check_object(obj: ObjectLike, level=None, *args, **kwargs) bool #
Determines if an object should emit a warning for being outside the level bounds.
- Parameters:
- objObjectLike
The object to check.
- levelOptional[PydanticLevel]
The level to check the bounds of.
- Returns:
- bool
If the object should emit a warning.
Notes
If not level is provided, no warning will be emitted.
- get_message(obj: ObjectLike) str #
Provides a message for an object with a warning.
- Parameters:
- objObjectLike
The object to provide a warning for.
- Returns:
- str
The warning for the object.
- pydantic model PydanticOutsideLevelBoundsWarning#
Bases:
PydanticWarning
A JSON model of a warning that ensures that an object is inside the bounds of the level.
Show JSON schema
{ "title": "PydanticOutsideLevelBoundsWarning", "description": "A JSON model of a warning that ensures that an object is inside the bounds of the level.", "type": "object", "properties": { "type": { "$ref": "#/definitions/WarningType" } }, "required": [ "type" ], "definitions": { "WarningType": { "title": "WarningType", "description": "An enumeration.", "enum": [ "INVALID OBJECT", "INVALID POSITION", "INVALID SIZE", "INVALID EXTENSION TO GROUND", "OUTSIDE LEVEL BOUNDS", "ENEMY COMPATIBILITY", "INVALID WARP" ], "type": "string" } } }
- Config:
use_enum_values: bool = True
- Fields:
foundry.core.warnings.Warning module#
- pydantic model PydanticWarning#
Bases:
BaseModel
A JSON model of a generic Warning through Pydantic
- Attributes:
- type: WarningType
The type of warning.
Show JSON schema
{ "title": "PydanticWarning", "description": "A JSON model of a generic Warning through Pydantic\n\nAttributes\n----------\ntype: WarningType\n The type of warning.", "type": "object", "properties": { "type": { "$ref": "#/definitions/WarningType" } }, "required": [ "type" ], "definitions": { "WarningType": { "title": "WarningType", "description": "An enumeration.", "enum": [ "INVALID OBJECT", "INVALID POSITION", "INVALID SIZE", "INVALID EXTENSION TO GROUND", "OUTSIDE LEVEL BOUNDS", "ENEMY COMPATIBILITY", "INVALID WARP" ], "type": "string" } } }
- Config:
use_enum_values: bool = True
- Fields:
- field type: WarningType [Required]#
foundry.core.warnings.WarningCreator module#
- pydantic model WarningCreator#
Bases:
BaseModel
Show JSON schema
{ "title": "WarningCreator", "type": "object", "properties": {} }
- classmethod generate_warning(v: dict) PydanticWarning #
The constructor for each specific warning.
- Parameters:
- vdict
The dictionary to create the warning.
- Returns:
- Warning
The created warning as defined by v[“type”]
- Raises:
- NotImplementedError
If the constructor does not have a valid constructor for v[“type”].
- classmethod validate(v)#
foundry.core.warnings.WarningType module#
- class WarningType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)#
-
- enemy_compatibility = 'ENEMY COMPATIBILITY'#
- classmethod has_value(value: str) bool #
A convenience method to quickly determine if a value is a valid enumeration.
- Parameters:
- valuestr
The value to check against the enumeration.
- Returns:
- bool
If the value is inside the enumeration.
- invalid_extension_to_ground = 'INVALID EXTENSION TO GROUND'#
- invalid_position = 'INVALID POSITION'#
- invalid_size = 'INVALID SIZE'#
- invalid_type = 'INVALID OBJECT'#
- invalid_warp = 'INVALID WARP'#
- outside_level_bounds = 'OUTSIDE LEVEL BOUNDS'#
foundry.core.warnings.util module#
- convert_pydantic_to_warning(warning: PydanticWarning) type[foundry.core.warnings.Warning.Warning] #
Provides the class alternative for a given pydantic warning.
- Parameters:
- warningPydanticWarning
The pydantic warning to find the warning alternative of.
- Returns:
- Type[Warning]
The class that represents the pydantic warning.
- type_to_pydantic_warning() dict[foundry.core.warnings.WarningType.WarningType, type[foundry.core.warnings.Warning.PydanticWarning]] #
Provide a dictionary to easily convert between a given warning type and pydantic warning
- Returns:
- dict[WarningType, Type[PydanticWarning]]
A dict containing a warning type and its corresponding pydantic warning.
- type_to_warning() dict[foundry.core.warnings.WarningType.WarningType, type[foundry.core.warnings.Warning.Warning]] #
Provide a dictionary to easily convert between a given warning type and warning
- Returns:
- dict[WarningType, Type[Warning]]
A dict containing a warning type and its corresponding warning.