Variables

read onlybefriends:ReadOnlyArray<Player>

The list of players befriended by the faction.

read onlyethnicity:Int

The index of the faction's ethnicity. An ethnicity change the name and some lore oriented text of the faction. It can also alter the gift received by the faction on befriending.

read onlygiftedPlayers:ReadOnlyArray<Player>

The list of players who received gifts from the faction, such as resources or free units.

read onlykilledBy:Player

The player who killed the last unit of the faction. Set only once the faction is defeated.

read onlykind:NeutralKind

The Neutral kind this faction is related to.

read onlyunits:ReadOnlyArray<Unit>

The units in the faction.

read onlyzones:ReadOnlyArray<Zone>

The zones owned by the faction.

Methods

befriendWith(p:Player):Bool

[HostOnly] set a player as befriend.

Parameters:

p

The player to befriend.

Returns:

Bool false if the player was already befriend, else true.

canBefriend(p:Player):Bool

Is the player allowed to befriend the faction.

Parameters:

p

The player to test.

Returns:

Bool true if the player can befriend the faction.

canFight(with:Player, ?zone:Zone):Bool

can the faction's units attack the specified player.

Parameters:

with

The player to test.

zone

[Optional] Do the test in the specified zone.

Returns:

Bool

getAlignmentStepWith(with:Player):AlignmentStepKind

Get the current alignment step the faction is taking toward the given player.

Parameters:

with

The player to test.

Returns:

AlignmentStepKind

isBefriendedWith(p:Player):Bool

Is the faction befriended with the player.

Parameters:

p

The player to test.

Returns:

Bool

isBefriendedWithEnemyOf(p:Player):Bool

Is the faction befriended with one of the player's enemy.

Parameters:

p

The player to test.

Returns:

Bool

isBefriendedWithTeamOf(p:Player):Bool

Is the faction befriended with the player's team.

Parameters:

p

The player to test.

Returns:

Bool

@:value({ force : false })tryGiftPlayer(p:Player, force:Bool = false):Bool

Give the faction's gift to the player, if the faction didn't already gave it.

Parameters:

p

The player to give a gift.

force

[Optional] If true, will skip the test and always give the gift.

Returns:

Bool true if the player received the gift.

unbefriend(p:Player):Void

Remove the player from the befriend list. Doesn't reset its alignment nor its gifts.