diff --git a/src/nature/species/wolpertinger.jl b/src/nature/species/wolpertinger.jl index cee2c3b08071feb3ba6641a9382bd44bbd508623..c3b59303bb5ddd97a423b4a6e7022aad88ad2bd4 100644 --- a/src/nature/species/wolpertinger.jl +++ b/src/nature/species/wolpertinger.jl @@ -35,7 +35,7 @@ and occasionally reproduce by spontaneous parthenogenesis... end """ -Wolpertingers are ephemeral creatures that require no special initialisation. +Wolpertingers are mythical creatures that require no special initialisation. """ @create Wolpertinger begin @debug "$(animalid(self)) created." diff --git a/src/nature/species/wyvern.jl b/src/nature/species/wyvern.jl index 9fa3d7e962b4d899ffb5b24feeb99180e58384c5..e18b99fe0ce514177fd7a2ecaf49b535a3cce8e8 100644 --- a/src/nature/species/wyvern.jl +++ b/src/nature/species/wyvern.jl @@ -10,71 +10,80 @@ Beware the wyvern! This evolutionary cousin of the dragon may only have two legs, but that doesn't make it any less dangerous... """ @species Wyvern begin - popsize = 10 fecundity = 0.02 maxage = 365 speed = 20 vision = 50 aggression = 0.2 huntsuccess = 0.8 +end - @initialise(winter, - habitat=@habitat(@landcover() in (grass, soil, agriculture, builtup)), - popsize=popsize) +""" +Wyverns are mythical creatures that require no special initialisation. +""" +@create Wyvern begin + @debug "$(animalid(self)) created." end """ Wyverns are ferocious hunters, scouring the landscape for their favourite prey: wolpertingers... """ -@phase Wyvern.summer begin - for a in @neighbours(self.speed) +@phase Wyvern summer begin + for a in @neighbours(self.speed, false) # check if a wolpertinger is in pouncing distance if typeof(a) == Wolpertinger - move_agent!(self, a.pos, model) + @move(a.pos) if @rand() < self.huntsuccess @debug "$(animalid(self)) killed $(animalid(a))." - kill!(a, model) + @killother(a, 1.0, "predation") @goto reproduce + else + @debug "$(animalid(self)) failed to kill $(animalid(a))." end elseif typeof(a) == Wyvern && @rand() < self.aggression # wyverns also fight against each other if they get too close - move_agent!(self, a.pos, model) + @move(a.pos) outcome = @rand() if outcome < 0.4 @debug "$(animalid(self)) killed $(animalid(a)) in a fight." - kill_agent!(a, model) + @killother(a, 1.0, "fighting") elseif outcome < 0.8 - @kill 1.0 "wounds sustained in a fight" + @kill(1.0, "wounds sustained in a fight") end @goto reproduce end end # check if a wolpertinger is in seeing distance, or walk in a random direction - direction = Tuple(@rand([-1,1], 2)) + direction = @randomdirection(self.speed) for a in @neighbours(self.vision) if typeof(a) == Wolpertinger - direction = get_direction(self.pos, a.pos, model) + direction = @directionto(a) break end - end - for i in 1:self.speed - walk!(animal, direction, model; ifempty=false) end + @walk(direction, self.speed) # reproduce every once in a blue moon @label reproduce - (@rand() < self.fecundity) && @reproduce(-1) + (@rand() < self.fecundity) && @reproduce() # hibernate from November to March month(model.date) >= 11 && (@setphase(winter)) - (self.age == maxage) && @kill(1.0, "old age") + (self.age == self.maxage) && @kill(1.0, "old age") end """ Fortunately, wyverns hibernate in winter. """ -@phase Wyvern.winter begin +@phase Wyvern winter begin # hibernate from November to March if month(model.date) >= 3 @setphase(summer) end end + +@populate Wyvern begin + asexual = true + popsize = 20 + phase = winter + habitat = @habitat(@landcover() in (grass, soil, agriculture, builtup)) +end diff --git a/src/parameters.toml b/src/parameters.toml index 60397d728fc19a58334bb77cfa73dc052eb507a0..c3d9f57600a718ac1dc7d9a3423ed68d62bdf915 100644 --- a/src/parameters.toml +++ b/src/parameters.toml @@ -30,7 +30,7 @@ weatherfile = "data/regions/jena-small/weather.csv" # location of the weather da farmmodel = "FieldManager" # which version of the farm model to use (not yet implemented) [nature] -targetspecies = ["Wolpertinger"]#, "Wyvern"]#["Skylark"] # list of target species to simulate +targetspecies = ["Wolpertinger", "Wyvern"]#["Skylark"] # list of target species to simulate popoutfreq = "daily" # output frequency population-level data, daily/monthly/yearly/end/never indoutfreq = "end" # output frequency individual-level data, daily/monthly/yearly/end/never insectmodel = ["season", "habitat", "pesticides", "weather"] # factors affecting insect growth