Prior residency improves the performance of a habitat specialist in a degrading environment

The effect of habitat loss on the decline of habitat specialists has been well documented in coral reef fishes, since they have a restricted habitat preference. However, the different competitive advantages of specialists and generalists can impact their performance within varying habitat conditions. The order in which species arrive into a community influences competitive outcomes; these ‘priority effects’ may modify communities within degrading resource scenarios as individuals migrate in search of higher quality resources. In this study, we investigated: how sequence and timing of arrival affects interactions between a habitat generalist and a specialist in healthy and degrading environments, and how prior residency interacts with habitat quality and species identity to affect propensity to migrate. We conducted manipulative field studies using the damselfishes Pomacentrus amboinensis, a habitat generalist, and Pomacentrus moluccensis, a live coral specialist, on live or dead coral habitats, with timing of arrival differing between early and late arrivers (residents and intruders, respectively) by 1, 3 or 24 h. Our results demonstrated that the strength of priority effects (i.e., aggression intensity) increased with increasing timing of arrival when the P. moluccensis arrived after P. amboinensis, suggesting that as the perceived value of the habitat patch increased (owing to increasing ownership duration and defence investment), the tendency to defend it increased. Propensity to migrate from dead to live coral was greater for P. moluccensis compared to P. amboinensis; however, arriving after P. amboinensis significantly reduced willingness to migrate to its preferred live coral habitat, indicating an inhibitory priority effect, directly affecting future persistence. The degree that ecological versatility and priority effects combine to modify competitive outcomes in coral reef fishes has important consequences for the persistence of specialist species in the face of environmental degradation, and has implications for predicting how our changing environment will affect fish communities.


Introduction
Environmental and anthropogenic-induced changes are causing increased stress to natural systems, resulting in a decline, and in extreme events a loss, of species worldwide (Ceballos et al. 2017; Sanchez-Bayo and Wyckhuys 2019; Smale et al. 2019;Kleypas et al. 2021). This loss of biodiversity has emphasised the importance of determining which species are most at risk, the factors directly influencing the decline in abundance of vulnerable species, and how their decline alters the dynamics of communities (Feary et al. 2014;Madin et al. 2016;McKenzie et al. 2016;Gladstone-Gallagher et al. 2019). The survival and future persistence of species within a changing environment are reliant on successful acclimation or adaptation to new, and often degrading, resources (Huey et al. 2012). Ecological versatility, 'the degree to which organisms can fully exploit the available resources in their local environment' (MacNally 1995), is one mechanism that explains how species will perform under changing resource scenarios (Colles et al. 2009). How specialised an organism is in its dependency on key resources may determine the likelihood of its extinction in the face of resource decline (Clavel et al. 2011). Species with a high level of habitat specialisation (specialists) are restricted to a small number of preferred habitats, whilst species that are versatile in their habitat use (generalists) use a range of different habitat types within their local environment (Feary 2007;Berkström et al. 2012).
As marine habitats continue to degrade and decline (Stuart-Smith et al. 2018), so too will the organisms that rely on these for food and shelter (Pihl et al. 2006). In coral reef ecosystems, the loss of coral following bleaching events, crown of thorns starfish outbreaks, cyclones (De'ath et al. 2012;Cheal et al. 2017), pollution (Fabricius 2005), and many other impacts, has flow-on effects to the associated fish communities (Jones et al. 2004). Several studies have documented the decline of habitat specialist fish species as a result of coral loss (Graham 2007;Wilson et al. 2008;Pratchett et al. 2012), but few studies have concurrently examined other factors that may modify this process. As individuals seek higher quality habitats, the structure of assemblages will be disrupted and altered, but the different competitive advantages of generalists and specialists in particular habitats will influence who persists (Morris 1996). Alternate or adaptive behaviours that reduce conflict can result in multiple social niches thereby increasing an individual's fitness. These niches stem from differences in resource distribution, social hierarchy structure and spatial or temporal variation in resource use, allowing varied behavioural responses and thus promoting cooperation (Bergmüller and Taborsky 2010).
Temporal differences in the use of habitats between competitors may alter interspecific competition by either facilitating or inhibiting coexistence (Lawler and Morin 1993;Rollins and Benard 2020). The sequence and timing in arrival of species into a community can have a profound effect on competition and subsequent community structure (Hodge et al. 1996); however, few studies have examined how the strength of these 'priority effects' are affected in degrading resource scenarios, particularly in the marine environment. Of these, there is conflicting evidence about how habitat quality or complexity affects competition between prior residents and new arrivers in coral reef fishes, by either having no effect (Geange and Stier 2010) or by ameliorating its effects (Adam 2011). Terrestrial studies have demonstrated that the magnitude of priority effects depends on resource condition and/or availability (Kardol et al. 2013;Tucker and Fukami 2014), and that priority effects strengthen as timing of arrival for late-arriving species increases following environmental disturbance events (Symons and Arnott 2014). For instance, Rudolf and McCrory (2018) experimentally manipulated the relative arrival time of two competing tadpole species across a food availability gradient and found that delaying the relative arrival of a species to a pond reduced the interaction asymmetry between species and could reverse competitive dominance. Prior residents gain several advantages from arriving early (such as knowledge of the habitat layout and assemblage), but most importantly they may gain competitive dominance over late-arriving individuals if no other significant asymmetries exist (such as body size), which can override priority effects (Evans and Shehadi-Moacdieh 1988;Beaugrand et al. 1996;Poulos and McCormick 2014). Therefore, it becomes important to understand how priority effects relate to other deterministic factors in structuring local communities, so that predictions about future community dynamics are accurate in the face of environmental change.
Our study used an ambitious series of field experiments to investigate the role of priority effects and ecological versatility in coral reef fish community dynamics, within a degrading environment. As a foundation for future studies, we compared how two species with different levels of habitat specialisation interacted in healthy and degraded coral habitats with respect to sequence and timing of arrival, and evaluated what their behaviour and propensity to migrate told us about the modified structure of fish communities within the altered environment. It was predicted that the habitat specialist (the species that preferred live coral habitats) would perform poorly in degraded habitats, but it was unknown whether (and how) priority effects could modify this outcome. Specifically, we tested the following: (1) how does the sequence (i.e., order of arrival) and timing of arrival (i.e., duration of priority) affect interactions between the two fish species in healthy and degrading habitats? (2) how does prior residency interact with habitat quality to affect propensity for the two fish species to migrate; and (3) how does habitat quality, prior residency, and migration affect survival?

Study system, species and site
Coral reefs are degrading worldwide (Hughes et al. 2017), and degradation occurs in ways that are often spatially patchy at local, within-site scales due to agents of change that include coral thermal or freshwater bleaching and crown of thorns starfish feeding (De'ath et al. 2012). Fish communities are replenished by the input of new individuals that metamorphose, settle and join the reef population at the end of a larval phase that averages 2 to 3 weeks in duration (Leis and McCormick 2002). This flood of new juvenile individuals comes onto a reef in lunar pulses with peaks that vaguely coincide with the new moon for damselfish (Dixon et al. 1999). These pulses of juveniles may extend for 2 weeks per month, during which inputs can fluctuate markedly in magnitude between consecutive days. Most settlement appears to occur overnight in coral reef fishes (Dufour and Galzin 1993;Schmitt and Holbrook 1999), but it is currently unknown the extent to which behavioural dynamics that occur at night affect subsequent dynamics. Schmitt and Holbrook (1999) studied the settlement dynamics of humbug damselfishes over 14d using infra-red video and managed to get information on 25 recruits. All recruits were found to remain on the microhabitats to which they had settled and all survived until daylight. This suggests that although interactions may have established hierarchies in the dark, the results of those interactions (i.e., social hierarchy) would be evident in daylight hours. While the current study manipulated settlement dynamics during daylight hours, it is likely that the behavioural processes are similar to those of naturally settled fish, though further studies are warranted to test this assumption.
While it is typical for most juveniles to be strongly site attached during the initial few days or months after settlement, there is some immediate renegotiation of space through migration (Lewis 1997), and some species also undergo a series of habitat and species associations before having a longer term association with a particular home range (McCormick and Makey 1997). For damselfish, one of the most speciose families of tropical fishes, it is typical for fish to settle to an area that will form the core of their life-long home range. While many display strong preference for habitat at settlement (Ö hman et al. 1998;Coker et al. 2014), these preferences are often modified by the presence of other species already resident on the habitat patch. For example, research has shown that the selection of a settlement habitat patch can be influenced by the presence of resident predators (Vail and McCormick 2011), the presence of adults of similar or different species (Ö hman et al. 1998), and the presence of other juvenile fishes (Sweatman 1985(Sweatman , 1988. Research suggests that late larval-stage fishes settle to the reef mostly at night (Dufour and Galzin 1993) and that events that occur within the first few days after settlement have a dramatic influence on subsequent behaviour (Poulos and McCormick 2014;Ferrari et al. 2015), growth trajectories Goldstein and Sponaugle 2020), abundance patterns of later life stages (Williams et al. 1994;Booth et al. 2000;McCormick 2012) and fitness (McCormick et al. 2010b).
Juvenile damselfishes, Pomacentrus amboinensis and P. moluccensis, were used in this study. The Ambon damselfish, P. amboinensis, is a habitat generalist, equally selecting live or dead coral habitats at the time of settlement (Ö hman et al. 1998), but can also show a greater preference for live coral (McCormick et al. 2010a;Pratchett et al. 2012) on which it exhibits a slightly lower mortality rate (McCormick 2012). The lemon damselfish, P. moluccensis, is a habitat specialist, preferentially selecting live coral habitats (Ö hman et al. 1998;McCormick et al. 2010a), and showing significantly greater mortality on dead coral than live coral habitats (McCormick 2012). Both species coexist as juveniles, have similar morphologies, but differ slightly in their habitat use and behaviour (McCormick and Weaver 2012). It is unclear what P. moluccensis obtains from the live coral other than shelter, but when P. moluccensis are caged on thermally bleached coral their body condition slowly declines (McCormick et al. 2010a). In the present study, these species were caught in light traps (Meekan et al. 2001) deployed overnight off Lizard Island (northern Great Barrier Reef, Australia) and carefully transported to the laboratory immediately upon collection at dawn where they were placed in 25L flow-through aquarium tanks without habitat. Individuals caught in light traps are near the end of their larval phase, and having not yet settled on the reef they are naive to reef-based dynamics.
Small patch reefs (approximately 0.3 m 3 ) of the hard bushy coral Pocillopora damicornis were constructed in a grid of two lines of 10 reefs 3-4 m apart on bare sand, 50 m from the nearest reef edge, at the shallow backreef of Lizard Island. Treatments were alternated on reefs. Half the patch reefs consisted of 100% live coral and the other half of 100% dead-degraded algal-covered coral (e.g., see Fig. 1 in McCormick and Lönnstedt 2016). Both patch types had similar structural complexity. Fishes were transported to the field site after being held in the laboratory for at least 24 h and up to 48 h (to recover from the stress of capture) and then placed on patch reefs according to the following experimental procedures.

Experiment 1: competition
The four factors manipulated in a large field experiment were: (a) species (P. amboinensis and P. moluccensis), (b) sequence of arrival (early or late-arrival), (c) timing of arrival (i.e., the temporal period between the arrival of the early and late individuals at the patch reef; 1 h, 3 h or 24 h priority periods), (d) habitat quality (live or dead coral patch reefs), with 10 to 22 replicates (mean 17) of each scenario (see Fig. 2 legend for n). Thus, at each level of timing of arrival (1, 3 or 24 h), the following interactions were staged on live coral and on dead coral (with different individuals): P. moluccensis arrived early (known as the 'resident') and P. amboinensis arrived late (known as the 'intruder'), or vice versa. Individuals on each patch were size-matched (mean difference in size ± SE: 0.29 ± 0.04 mm; mean size ± SE: 13.91 ± 0.08 mm SL); fish were placed into a small zip-lock plastic bag of aerated seawater and measured for standard length using dial calipers. Fish were transported out to the study site in individually labelled plastic bags filled with aerated seawater within a 60L seawater-filled bin covered with shade cloth to reduce stress. All patches were vacant of any other fish that naturally recruited or migrated there. After the early arriver was placed on the patch reef (* 10:00 h) and had been there for the appropriate time (1, 3, or 24 h), the late arriver was added and then both individuals were given a 30 min acclimation before behavioural observations were conducted. After a further 1 min acclimation period, a scuba diver (DEP) situated at least 1 m from the patch reef observed each fish sequentially (in random order with respect to treatment) for 3 min, recording the following variables: the height of the fish on the patch reef (recorded as the percentage of time spent at the bottom, middle and top of the patch; found to be a useful measure of risk -McCormick (2012)), and the number of chases towards the other individual (as per McCormick 2009; as a measure of aggression). Previous studies have found that behaviour of these species is sufficiently consistent to enable the characterisation of individual behaviour through a single three min observation period, demonstrating high levels of repeatability (McCormick 2009;White et al. 2015).  To assess propensity to migrate between habitats differing in their quality, sets of two patch reefs (one live coral and one dead coral) were set up 0.4 m apart and a non-transparent black plastic divider was placed between them to prevent a fish from seeing and moving to the adjacent patch (as per McCormick (2009)). In the first part of this study, the early arriver was placed on either the live or dead patch reef, followed by the late arriver 3 h later, to the same patch, according to the following four treatments: (1) P. amboinensis placed on the live coral patch reef followed by P. moluccensis 3 h later, (2) P. moluccensis placed on the live coral patch reef followed by P. amboinensis 3 h later, and (3) and (4) as per treatments one and two, except both fish placed on the dead coral patch reef rather than live. A 30 min acclimation period was given after the late arriver was added, and then the plastic divider was removed so that the adjacent patch reef could be seen by both fish. A further 30 min acclimation period was given before divers recorded the presence and location (i.e., dead or live coral) of each fish.

Experiment 2: survival
Using the same patch reef setup as above, we tested survival of a single species (P. amboinensis, the generalist) in relation to migration, habitat quality, and sequence and timing of arrival. To test survival, one P. amboinensis individual was placed on the live coral patch reef and one on the dead coral simultaneously -these were the early arrivers. A 24 h priority was given to these fish before one more P. amboinensis individual was added to each of the live and dead coral patch reefs (the late arrivers). This simulated fish arriving on consecutive days within a recruitment pulse. Each of the four fish were tagged a different colour with a subcutaneous elastomer tag (as in (Hoey and McCormick 2004)) one day prior to transportation to patch reefs, in order to identify between individuals as well as to distinguish between our study fish and those that may have naturally recruited to the patch reefs. All individuals on the same patch reef were size-matched (as per the competition experiment; mean difference in size ± SE: 0.58 ± 0.05 mm). Natural settlement was low during the study period and any new recruits were removed daily from patch reefs using a hand net. Migration and survival of each tagged individual were monitored daily at approx. 10:00 h for six days. Mortality was defined as not finding a fish on its allocated patch reef, or on any of the neighbouring patch reefs.

Statistical analyses
To compare the rate of chases towards competitors, general linear models (GLM) were undertaken for each species incorporating four factors: Status (Early arriver, Late arriver), Priority (timing of arrival: 1, 3, 24 h) and Habitat type (Live, Dead). Type III sums of squares were used to account for unequal replication. Significant interactions were explored using Tukey's HSD for unequal sample sizes. 'Chases per minute' was log 10 transformed to meet the assumptions of GLM, which were examined with residual analysis.
Difference in relative height on the patch reef was compared between Late-arriving species (P. moluccensis or P. amboinensis), Habitat (Live, Dead) and Priority (timing of arrival: 1, 3, 24 h) with GLM. Relative height on the patch was summarized as a cumulative proportion of the time spent at varying heights over the 3 min observation period, with the top of the patch taken as height of 1, midpatch a height of 0.5, and bottom a height of 0 (McCormick 2009). The difference in relative height between 'early' and 'late' arriving individuals was further calculated from the perspective of the early arriver, i.e., relative height of early individual minus relative height of late individual. Effect sizes are given as partial-eta-squared (g p 2 ), which represents the proportion of the total variance in a dependent variable that is associated with the membership of different groups. The number of independent replicates for each of 3 prior residency periods by 2 early-arriving Fig. 2 Difference in relative height on the patch reef (± SE) between early and late-arriving (i.e., resident and intruder) Pomacentrus moluccensis and P. amboinensis on live and dead coral, when timing of arrival for late individuals is 1, 3 or 24 h. White bars represent differences in height between early P. moluccensis and late P. amboinensis and grey bars represent differences in height between early P. amboinensis and late P. moluccensis. Differences are calculated from the perspective of the early-arriver, i.e., relative height of the early-arriver individual minus relative height of the latearriver. Therefore a positive value indicates the early-arriver was higher on the patch reef than the late-arriver, and vice versa. Numbers of replicates from left to right: 20, 16, 18, 22, 17, 10, 15, 18, 14, 17, 19, 19 Coral Reefs (2022) 41:423-433 427 species by 2 habitats (i.e., 12 combinations) varied from 10 to 22 (mean 17). Percentage migration from dead to live coral for early or late arriving P. amboinensis and P. moluccensis was compared using chi-square (v 2 ) tests. Survival trajectories of P. amboinensis individuals arriving early or late to live or dead coral (and either remaining there or migrating from dead to live coral) were compared using the Kaplan-Meier product-limit method. Projected survival trajectories were compared across all six treatment combinations (grouped by the same habitat association, but difference in sequence of arrival) using a generalization of Gehan's generalized Wilcoxon test, Peto and Peto's generalized Wilcoxon test, and the log-rank test (Statistica version 13). Planned contrasts between particular treatment pairs were undertaken to explore the nature of the overall significance among treatments using a Cox's F-tests.

Experiment 1: competition
The way in which habitat, timing of arrival and priority time influenced aggression (as measured by the number of chases) differed between species (Fig. 1a, b; Supplementary Table S1a, b). The number of chases undertaken by P. moluccensis was affected by their status (i.e., whether they were the early or late-arriver) and the habitat type they were on (Status 9 Habitat interaction, F 1,190 = 9.50, p = 0.002). In live coral early-arrivers were more aggressive than late-arrivers, while this was not the case when on dead coral (Fig. 1a). In contrast, for P. amboinensis the story was more complex with aggression being affected by a significant three way interaction (Status x Habitat x Prior time, F 2,190 = 4.24, p = 0.016). This was caused by P. amboinensis becoming more aggressive with residence time, and early-arrivers that had been on the patch for an hour tending to be more aggressive on dead coral than live (Fig. 1b). When the effect sizes (g p 2 ) were examined, residence status played a more important role in influencing aggressive behaviour for P. amboinensis than P. moluccensis (Sup Table S1; 0.19 vs. 0.1).
The difference in relative height between the early and late arriver on the patch reef was affected only by which species was first (F 1,190 = 29.26, p \ 0.001, g p 2 = 0.13; Fig. 2), and not by the priority period or habitat type (F 2,190 = 0.31, p = 0.73 and F 1,190 = 0.32, p = 0.57, respectively; Fig. 2, Table S2). When P. moluccensis arrived early, they occupied higher areas on the patch reef than the late-arriving P. amboinensis (indicated by the positive values). Conversely, when P. amboinensis arrived early they continued to occupy lower areas of the habitat than late-arriving P. moluccensis (indicated by the negative values); however, the difference in height between species was reduced (Fig. 2). This trend is likely a result of heightened aggression by P. amboinensis when arriving early, leading the species to interact more frequently and thus leading to a decrease in height separation on the patch.

Experiment 2: migration
There was no migration from live to dead coral for either species and only one fish of any pair moved patches. Migration from dead to live coral occurred almost immediately (within 30 min of the dividers being lifted so they could see the alternative habitat), and was equal for early P. amboinensis and late-arriving P. moluccensis (25% for both species; v 2 1,32 \ 0.0001, p = 1.000; Fig. 3). When P. moluccensis was the early and P. amboinensis the latearriver, migration from dead to live coral was significantly higher for P. moluccensis (73% compared to 0%; v 2 1, 30 = 17.368, p \ 0.001; Fig. 3).

Experiment 2: survival
In a separate experiment using a single species (P. amboinensis), migration of individuals occurred from dead Fig. 3 Percentage migration from dead to live coral for Pomacentrus amboinensis (habitat generalist) and P. moluccensis (live coral specialist) arriving early or late. The prior residency period was 3 h to live coral, but not from live to dead coral. Individuals that migrated did so in less than one day and remained on that patch (i.e., did not return to the original patch) until they died or until the experiment was terminated (after six days).
Survival trajectories of newly-settled P. amboinensis were affected by habitat type and order of arrival overall (v 2 5 = 16.191, p = 0.006, Fig. 4), and the extent of these influences were further examined for specific treatment pairs. Mortality was not affected by prior residency for fish arriving at and migrating to the same habitat type [Earlyarrival to live coral ('Early-Live') vs late-arrival to live coral ('Late-Live'): Cox's F-test, F 18,18 = 1.343, p = 0.269; Early-arrival to dead coral ('Early-Dead') vs late-arrival to dead coral ('Late-Dead'): Cox's F-test, F 22,24 = 1.706, p = 0.102; Early-arrival to dead coral then migrated to live coral ('Early-Dead-Live') vs late-arrival to dead then migrated to live coral ('Late-Dead-Live'): Cox's F-test, F 10,12 = 1.430, p = 0.312, Fig. 4]. This suggests habitat types is the major driver of the overall significant difference in mortality trajectories among treatment combinations.
Mortality of fish on live coral was not affected by migration (i.e., mortality was similar between fish that arrived to live coral and fish that migrated from dead to live coral), regardless of whether they arrived early or late (Early-Live and Early-Dead-Live: Cox's F-test, F 22,10 = 1.219, p = 0.431; Late-Live and Late-Dead-Live: Cox's F-test, F 20,10 = 1.856, p = 0.188, Fig. 4). However, mortality of fish that arrived to dead coral was affected by migration and order of arrival; fish that stayed on dead coral experienced significantly higher mortality than fish that migrated from dead to live coral, but only if they arrived early (Early-Dead-Dead vs Early-Dead-Live: Cox's F-test, F 10,28 = 2.456, p = 0.0439; Late-Dead-Dead vs Late-Dead-Live: Cox's F-test, F 10,24 = 1.789, p = 0.134, Fig. 4).
The survival of individuals who arrived simultaneously to different habitats and did not migrate was affected by habitat type, with individuals surviving better on live coral than dead coral (Early-Live and Early-Dead: F 18,24 = 2.537, p = 0.0171; Fig. 4). Despite a lower survival rate for late-arrivers overall, the same trend was still evident, with late-arriving individuals to live coral doing better than late-arriving individuals to dead coral (Late-Live and Late-Dead: F 18,22 = 3.002, p = 0.008; Fig. 4). The fish that arrived late to dead coral and did not migrate were the only treatment in which all fish died prior to termination of the experiment (Fig. 4).

Discussion
Community dynamics are not only frequently altered by spatial and temporal variation in the arrival of new settlers and the emigration or mortality of residents (Shulman 1985;Dayton and Fitzgerald 2005;Booth and Beretta 2021), but also permanently impacted by environmental change (Herkert 1994;Tylianakis et al. 2008). The ways in which particular species respond to such change are a function of their life history characteristics, behaviour and versatility in the face of disruption (Gilchrist 1995;Caley Fig. 4 Kaplan-Meier survival trajectories for Pomacentrus amboinensis arriving early or late (timing of arrival = 24 h) to live or dead coral, with some individuals migrating from dead to live coral. (For example, 'Early-Live-Live' is an individual that arrived early to live coral and stayed on live; 'Early-Dead-Live' is an individual that arrived early to dead coral and migrated to live coral) Coral Reefs (2022) 41:423-433 429 andMunday 2003;Devictor et al. 2008;McCormick et al. 2017). Understanding the complex nature of how these factors interact is essential for understanding how habitat degradation will affect communities of organisms. The present study demonstrates that priority effects modify how two species, which differ in their ecological versatility, perform in healthy and degrading habitats. The strength of priority effects intensified with increasing time since arrival, emphasising that resources become increasingly more valuable with lengthy prior residencies (also see (Geange and Stier 2009), but this only occurred for P. amboinensis (a habitat generalist). Early-arriving P. moluccensis (a specialist) defended its favourable habitat (live coral) only when given a 3 h priority, and conversely suffered increased aggression from P. amboinensis even when arriving early to dead coral habitats, suggesting that the priority advantage was overridden by the unfavourable (degraded) habitat type. Furthermore, after arriving 24 h late to dead coral, P. amboinensis displayed significantly more aggression towards P. moluccensis than was returned, indicating a low motivation or ability of this live coral specialist to compete in a degraded habitat, despite a significant prior residency advantage. These results are in keeping with the trade-off theory whereby specialists will display superior performance in preferred habitats, but inferior performance in other habitats (Berkström et al. 2014). Previous studies suggest that interspecific competition and habitat preference interact to influence post-settlement success (Bonin et al. 2009); however, the intensity of aggression (a result of sequence and timing of arrival) from direct competitors can further exacerbate these effects (Geange and Stier 2010). Habitat use was affected by sequence of arrival, with the high level of aggression displayed by early P. amboinensis resulting in a reduced height separation between competitors on the patch reef, compared to when P. moluccensis arrived early. Previous studies have demonstrated similar resource partitioning between these species, where P. moluccensis generally occupies higher areas of the reef than P. amboinensis (McCormick 2012;McCormick and Weaver 2012); however, the present study suggests that increased aggression from the early-arriving P. amboinensis can disrupt this. This breakdown of resource partitioning has consequences for coexistence and the persistence of P. moluccensis, when arriving late. Although a variety of mechanisms exist by which species can coexist (Munday et al. 2001;Amarasekare 2002), previous studies have demonstrated the importance of interspecific competition in structuring communities (Bonin et al. 2015).
Propensity to migrate in search of higher quality habitat was affected by species identity as well as order of arrival. Early-arrivers were more likely to migrate from dead to live coral than late arrivers and P. moluccensis (a live coral specialist) was more likely to migrate to live coral than P. amboinensis, emphasising the value of live coral habitat to the specialist species. This is in contrast with the findings of Feary (2007) which showed specialist gobies to have a significantly lower propensity to migrate away from degrading habitat than generalist gobies, suggesting that the ability to survive in a partially degraded coral may have outweighed the potential increased predation risk of leaving. In the present study, arriving late reduced the propensity of P. moluccensis to migrate to live coral by almost 50%, highlighting how sequence of arrival has significant implications for vulnerable juveniles by disrupting their ability or willingness to successfully seek higher quality (preferred) resources. This represents evidence of an inhibitory priority effect, whereby early-arriving P. amboinensis inhibits late-arriving P. moluccensis from migrating to adjacent favourable habitats. Additionally, P. amboinensis individuals that arrived to dead coral and did not migrate to live coral suffered higher mortality than those who did migrate, but this was only for earlyarriving individuals; late-arriving fish to dead coral and late-arriving fish that migrated to live coral experienced similarly high mortalities. This research emphasises the important role that high quality resources have on the persistence of organisms (Adam 2011;Kardol et al. 2013;Rudolf and McCrory 2018), even for those who are ecologically versatile; however, it also presents evidence of a priority effect whereby the disadvantage of arriving late overrides the advantage of migrating to live coral.
Evidence of an inhibitory priority effect in the migration component of the present study demonstrates the clear advantage of priority of access to valuable resources, particularly for P. moluccensis whose preferred live coral resource may be severely limited. Our results showed that willingness to seek out such resources was impeded by prior residents; however, the mechanisms by which this occurs are not clear. It is likely that P. moluccensis was competitively subordinate to P. amboinensis, particularly when it arrived late to dead coral, but also possibly when it arrived early to dead coral (as demonstrated by the competition experiment in our study). This suggests P. moluccensis may have been pushed out of the dead coral habitat by P. amboinensis (as we tend to see in competitive interactions between these and other species; Medeiros et al. 2010;McCormick and Weaver 2012)), if P. amboinensis chose to stay and not migrate, making the option to migrate a good alternative for P. moluccensis. Based on the direction of aggression in the competition experiment, aggression by P. amboinensis was likely stronger when P. moluccensis arrived late in the migration experiment, yet fewer P. moluccensis individuals chose to migrate when they arrived after P. amboinensis compared to when they arrived prior to P. amboinensis. Therefore, migration due to competitive subordinance does not appear to be the reason for choosing to migrate to preferred habitats, although it may still play a role. An alternative explanation for a larger proportion of P. moluccensis choosing to migrate from dead to live coral when they were prior residents (arriving 3 h before P. amboinensis), may be a result of their 3-h association with the dead coral habitat; a long enough period to fully explore the detrimental aspects of their new habitat. By contrast, when P. moluccensis arrived late, they were only subject to a 30 min acclimation before being able to migrate, and this shorter period may not have instilled the same level of dislike, resulting in fewer individuals migrating away from it. The competition experiment was suggestive of this with early-arriving P. moluccensis subject to significantly more aggression from P. amboinensis after inhabiting the dead coral habitat for 24 h, compared to 1 h and 3 h. It appears that the dead coral interferes with the ability of P. moluccensis to compete and even to locate more favourable habitat; however, this effect is further exacerbated by priority effects, severely disadvantaging late-arriving P. moluccensis. Coker et al. ) suggests a willingness to remain on dead coral habitats is a result of aggressive dominance from individuals on neighbouring habitats, yet in the present study only 25% of P. amboinensis prior residents migrated, meaning a large proportion of neighbouring habitats were vacant of any competitors.
This study demonstrates both the negative and positive implications for a specialist in the face of resource degradation, whereby priority effects have the ability to either enhance or alleviate the effects of habitat degradation on this specialist species. Perhaps the most significant finding is that prior residency can mitigate the negative effects of habitat degradation on this habitat specialist and increase its propensity to migrate to higher quality habitats. Of course, this relies on live coral persisting under the currents threats to coral reefs; a dramatic decline would no doubt make specialist species highly susceptible to extinction simply as a result of their limited versatility (Munday 2004;Graham 2007;Wilson et al. 2008). The degree to which ecological versatility and priority effects modify competitive outcomes in coral reef fishes is important to understand, in order to predict how the changing environment will impact fish community dynamics. The present study was limited to incorporating only one specialist and one generalist species, so future research should examine a greater range of species with varying levels of resource specialisation, and across projected habitat degradation scenarios.
Acknowledgements Thank you to L. Pedini and S. Gardner for assistance with data collection, as well as staff at the Lizard Island Research Station (Australian Museum) for logistical support.
Funding Open Access funding enabled and organized by CAUL and its Member Institutions.

Declarations
Conflict of interest On behalf of all authors, the corresponding author states that there is no conflict of interest.
Ethical approval All research was conducted in accordance with the James Cook. University (JCU) Animal Ethics guidelines with approval from the JCU Animal Ethics Committee (approvals A1720 and A2080).
Data Accessibility Data are available on FigShare https://doi.org/10. 6084/m9.figshare.12637379 Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons. org/licenses/by/4.0/.