Invader

Invaders are hostile Characters who enter the player's Sect map with nefarious intentions. Some of them aim to steal valuable items, others aim to destroy the sect.

## Invader Power

The difficulty of randomly generated Invaders depends on the Reputation of the Sect. The power level caps out at 20, with a Sect Reputation of 250,000.

## Invader Properties

### Allegiance

Invaders may be random bandits without a Sect, random Yaoguai, or from a specific Sect Faction.

Having high Favor with a Sect decreases the chance of Invaders from the Sect attacking.

Having high Reputation causes some Invaders to abort an invasion. For every Power Level above 10, there is a 7% chance that the Invaders do not attack. At the maximum Power Level, 70% of Invader events are cancelled due to Reputation.

### Sect Invaders

Each day, the game runs a check between every sect to determine what events will occur between them, including the player sect. By default, there's a 5% chance to potentially roll an event, and each day an inter-sect event doesn't occur, the chance increases by 3% the next day. If the event does occur, the chance resets to 5%, and a new random check is made.

30% of the time that check passes, information is gathered about the two involved sects and an event occurs. In the case of the player sect, there's a chance for either a "good" event, where a disciple from that sect will visit for some time, or a "bad" event, where some disciples from that sect will invade. The events are binary; one will always occur, and the odds are determined by the sect favor.

At 0 favor, the chance is 50% for a good or bad event. Each point of favor provides an additional 0.05% towards good or bad, depending on if it's positive or negative; in other words, every ±100 favor counts for 5% towards good or bad. At ±1000 favor, the good or bad event is guaranteed to roll, assuming all other checks pass.

### Law

Invaders always practice an Unorthodox Xiandao Law, with the exception of Daemonia Temple Invaders, who are always YaoGuai and always practice Ancestral Yaoguai Body. Invaders from certain Sects may also practice an Unorthodox Law invented by that specific Sect. The inventor of the Unorthodox Law has no effect on that Law's properties.

Invaders do not practice any form of Shendao law, or Physical Cultivation laws other than Ancestral Yaoguai Body.

### Equipment

The wealth of invaders, usually governed by the Event that triggers them, affects the quality of their equipment. Women invaders always have upper clothes while men only do 80% of the time, regardless of their wealth.

#### Base equipment

This is common to all invaders.

 richest

#### Xiandao equipment

Only Xiandao invaders can have those items.

* 0.1% chance to have a random Fortuitous Treasure equipped (though their wealth dictates its quality and tier) if they are Xiandao.
* Rich and Richest invaders have 1% chance to have a random tier, random effect, talisman between 10-70% quality.
* 30% chance to have a randomly generated Unorthodox Manual equipped of power depending on their strength level.
* 20% chance to have a (possibly 2nd) random tier, random effect, talisman between 10-70% quality.
* One random Artifact with a minimum tier equal to their strength level.

## Invader Behavior

### Leaving

Most Invaders aim to steal from the sect. Therefore, they will only attack your sect for a limited amount of time. If they are not defeated after a while, they will steal a random item not on a Display and leave the map.

Certain Invaders, most notably the Mysterious Assassin and other invaders generated by Tribulation IX options, have the `SetEnemyNeedKill` flag set. This means that they will not leave the map, and will continue destroying things until either they are killed or the sect is destroyed.

### Attack Delay

Most Invaders do not immediately attack the Sect once they enter the map. Instead, they wander around for a while at their spawn location before attacking. By default, an Invader will wander for 100 seconds before attacking.

Certain Invaders, such as the invaders generated by Tribulation IX options, Ancient Cultivators, and invaders attacks summoned by Spirit Roots do not wander around, and immediately attack a target close to their spawn point.

## References

1. ↑ `XiaWorld.GameDefine.SchoolScore2EnemeyLevel`
2. ↑ `num4` in `XiaWorld.Map.CallEnemies,` `ThingMgr.Instance.CallNpc`
3. ↑ `num` in `XiaWorld.Map.CallEnemies`:

Maximum score of invaders per wave, where Primordial Spirit = 4, Golden Core = 3, Core Shaping = 2, Qi Shaping and Outer Disciple = 1
4. ↑ `num3` in `XiaWorld.Map.CallEnemies`:

Number of "Super Invaders" that have additional bonuses, such as bonus Manuals learned or bonus Max Qi.
5. ↑ `array[4]` in `XiaWorld.Map.CallEnemies`:

Maximum number of additional Manuals learned by the Super Invader from their Unorthodox Law. The Super Invader will learn from 1 to N additional manuals.
6. ↑ `array[5]` in `XiaWorld.Map.CallEnemies`:

Lines 1860-1863, `XiaWorld.ThingMgr.EquptNpc`:

Bonus chance that the Golden Core Quality of the Super Enemy increases.

A regular Invader of Golden Core and above has a base Golden Core Quality between 1000 and 20,000. The Invader has a base chance of 40% of randomly increasing the GCQ by 1000 and 20,000. If this roll succeeds, the Invader can repeatedly roll again, until the roll fails. On average, this results in 7000 additional GCQ.

A Super Invader can have this chance boosted to 80%. On average, this results in 42,000 additional GCQ.
7. ↑ `array[6]` in `XiaWorld.Map.CallEnemies`:

Amount of bonus Base Max Qi applied to the Super Enemy. The Super Enemy receives Age\*N additional Base Max Qi.
8. ↑ 8.0 8.1 `XiaWorld.GameEventMgr.CheckSchoolEvent,` Settings\World\Events\SchoolEventList.txt
9. ↑ `XiaWorld.GameEventMgr.RandomEvent`
10. ↑ `XiaWorld.RandomGongMgr`
11. ↑ `XiaWorld.ThingMgr.EquptNpc()`
12. ↑ `XiaWorld.Map.AddEnemyAtKey`