Click or drag to resize
AnimalCanAttack Method

Used to determine if your creature can attack another creature. This will return true all the time for a Carnivore since they can always attack.

For Herbivores this will return true if they are hungry enough to be aggressive. Herbivores may also attack a creature in the upcoming round if that creature attacked them in the previous round. The best place to attack a creature that is attacking you is to handle the Attacked event.

Namespace: Terrarium.Sdk.Classes.Creature
Assembly: Terrarium.Sdk (in Terrarium.Sdk.dll) Version: 1.1.0.0 (1.1.0.0)
Syntax
public bool CanAttack(
	AnimalState targetAnimal
)

Parameters

targetAnimal
Type: Terrarium.Sdk.Classes.StateAnimalState
AnimalState for the creature you would like to attack.

Return Value

Type: Boolean
True if your creature can attack the target creature, False otherwise.
Exceptions
ExceptionCondition
ArgumentNullException Thrown if the targetAnimal parameter is null.
See Also