Silly Bug Game
Model was written in NetLogo 6.1.1
•
Viewed 233 times
•
Downloaded 14 times
•
Run 0 times
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
Comments and Questions
Please start the discussion about this model!
(You'll first need to log in.)
Click to Run Model
;Silly Bug Game ;Israel Alderete ;Start Date: 8/19/21 ;Most Recent Update: 10/22/21 globals [mapgentype colora colorb rbudget bbudget rresources bresources rgen bgen] patches-own [sspawntime center? colormemory blueweb redweb rednest bluenest antlionn antlionsp rs1spawn rs2spawn rs3spawn bs1spawn bs2spawn bs3spawn bselected?? rselected?? bselect rselect] turtles-own [bx by building? switching? spawntime speed damage dmemory health selected? poisoned? dusted? speedmemory ramming facememory labelmemory rival blindtime paralyzetime maxhealth thorns shield flying? effectiverange ermemory hitradius nestnumber recovering? rhost? bhost?] breed [lleaves lleaf] ;=========Gamemode Breeds========= breed [nests nest];finished breed [points point] ;=========Building Breeds========== breed [bugs_nests bugs_nest];finished breed [health_givers health_giver];finished breed [bug_decoys bug_decoy];finished breed [chemical_swaps chemical_swap];finished breed [pollen_flowers pollen_flower];finished ;===========Bug Breeds============== breed [ants ant];finished breed [bees bee];finished breed [spiders spider];finished breed [butterflies butterfly];finished breed [moths moth];finished breed [bugs bug];finished breed [caterpillars caterpillar];finished breed [dragonflies dragonfly];finished breed [beetles beetle];finished breed [venomspitters venomspitter] breed [poisons poison];finished breed [grasshoppers grasshopper];finished breed [thornbugs thornbug];finished breed [mantises mantis];finished breed [pillbugs pillbug];finished breed [antlions antlion];finished breed [cicadas cicada];finished breed [wasps wasp];finished breed [bedbugs bedbug];finished breed [stickbug stickbugs] breed [blinds blind];finished breed [tarantulahawks tarantulahawk];finished' breed [screwworms screwworm] breed [larvaes larvae];finished breed [termites termite];finished ;============Other Breeds============= breed [leaves leaf] to setup __change-topology true true ca set mapgentype 1 + (random 7) set colora 30.5 + ((random 7) / 2) set colorb (colora + 2) if mapgentype = 1 [ create-turtles 1 [ setxy 0 0 set heading 90 forward 2 repeat 8 [ repeat 3 [ repeat 6 [ repeat 3 [ forward 1 ask patch-here [ set pcolor colora ] ] repeat 3 [ forward 1 ask patch-here [ set pcolor colorb ] ] ] right 90 forward 1 left 90 ] repeat 3 [ repeat 6 [ repeat 3 [ forward 1 ask patch-here [ set pcolor colorb ] ] repeat 3 [ forward 1 ask patch-here [ set pcolor colora ] ] ] right 90 forward 1 left 90 ] ] ] ask turtles [die] ] if mapgentype = 2 [ create-turtles 48 [ setxy (0) (0 - who) set heading 90 repeat 6 [ repeat 3 [ ask patch-here [set pcolor colora] forward 1 ] repeat 3 [ ask patch-here [set pcolor colorb] forward 1 ] ] ] ask turtles [die] ] if mapgentype = 3 [ create-turtles 48 [ setxy (0) (0 - who) set heading 90 repeat 3 [ repeat 6 [ ask patch-here [set pcolor colora] forward 1 ] repeat 6 [ ask patch-here [set pcolor colorb] forward 1 ] ] ] ask turtles [die] ] if mapgentype = 4 [ create-turtles 48 [ setxy (0) (0 - who) set heading 90 repeat 2 [ repeat 9 [ ask patch-here [set pcolor colora] forward 1 ] repeat 9 [ ask patch-here [set pcolor colorb] forward 1 ] ] ] ask turtles [die] ] if mapgentype = 5 [ create-turtles 1 [ setxy 0 0 set heading 90 forward 8 repeat 8 [ repeat 3 [ repeat 2 [ repeat 9 [ forward 1 ask patch-here [ set pcolor colora ] ] repeat 9 [ forward 1 ask patch-here [ set pcolor colorb ] ] ] right 90 forward 1 left 90 ] repeat 3 [ repeat 2 [ repeat 9 [ forward 1 ask patch-here [ set pcolor colorb ] ] repeat 9 [ forward 1 ask patch-here [ set pcolor colora ] ] ] right 90 forward 1 left 90 ] ] ] ask turtles [die] ] if mapgentype = 6 [ create-turtles 1 [ setxy 0 0 set heading 90 forward -1 repeat 8 [ repeat 3 [ repeat 1 [ repeat 36 [ forward 1 ask patch-here [ set pcolor colora ] ] ] right 90 forward 1 left 90 ] repeat 3 [ repeat 1 [ repeat 36 [ forward 1 ask patch-here [ set pcolor colorb ] ] ] right 90 forward 1 left 90 ] ] ] ask turtles [die] ] if mapgentype = 7 [ create-turtles 1 [ setxy 0 0 set heading 90 forward -1 repeat 2 [ repeat 12 [ repeat 1 [ repeat 36 [ forward 1 ask patch-here [ set pcolor colora ] ] ] right 90 forward 1 left 90 ] repeat 12 [ repeat 1 [ repeat 36 [ forward 1 ask patch-here [ set pcolor colorb ] ] ] right 90 forward 1 left 90 ] ] ] ask turtles [die] ] center ask patches [ set colormemory [pcolor] of self set blueweb false set redweb false set rednest false set bluenest false set antlionn false set antlionsp false ] if Nests? = true [ symmetrytest ] if AntLions? = true [ antlionsnest ] if SpecialSpawn? = true [ specialspawn ] if leaves? = true [ create-leaves 10 * 1 + (random 3) [ set shape "leaf 2" set size 15 + (random 6) set color (colorb + 20 + ((random 2) * 10)) set health 1 while [any? other leaves-on patch-here] [ setxy min-pxcor (random-pycor * 3) ] set heading 45 + (random 135) ] ask n-of ((count leaves) / 2) leaves [ setxy max-pxcor (random-pycor * 3) while [any? other leaves-on patch-here] [ setxy max-pxcor (random-pycor * 3) ] set heading 225 + (random 135) ] ask leaves [set hidden? true] if random 20 = 1 [ ask leaves [ set color (colora - 10 + (random 3)) set shape "leaf" ] create-lleaves 25 + (random 6) [ set shape one-of ["leaf 2" "leaf"] set color ((colora - 10 + (random 3)) - 1) set size 1.5 + (0.5 * (random 3)) set health 1 setxy random-pxcor random-pycor set hidden? true ] ] ] __change-topology false false set rbudget 40 - (gamemode * 10) if gamemode = 2 [ set rbudget 15 ] set bbudget 40 - (gamemode * 10) if gamemode = 2 [ set bbudget 15 ] set rresources 8 - (gamemode * 2) set bresources 8 - (gamemode * 2) ask patch 1 -1 [set plabel 1 set rselected?? true set rselect true] ask patch 4 -1 [set plabel 2 set rselected?? true set rselect true] ask patch 7 -1 [set plabel 3 set rselected?? true set rselect true] ask patch 10 -1 [set plabel 4 set rselected?? true set rselect true] ask patch 13 -1 [set plabel 5 set rselected?? true set rselect true] ask patch 16 -1 [set plabel 6 set rselected?? true set rselect true] ask patch 19 -1 [set plabel 7 set rselected?? true set rselect true] ask patch 22 -1 [set plabel 8 set rselected?? true set rselect true] ask patch 25 -1 [set plabel 9 set rselected?? true set rselect true] ask patch 28 -1 [set plabel 0 set rselected?? true set rselect true] ask patch 31 -1 [set plabel "-" set rselected?? true set rselect true] ask patch 34 -1 [set plabel "=" set rselected?? true set rselect true] ask patch 1 -46 [set plabel 1 set bselected?? true set bselect true] ask patch 4 -46 [set plabel 2 set bselected?? true set bselect true] ask patch 7 -46 [set plabel 3 set bselected?? true set bselect true] ask patch 10 -46 [set plabel 4 set bselected?? true set bselect true] ask patch 13 -46 [set plabel 5 set bselected?? true set bselect true] ask patch 16 -46 [set plabel 6 set bselected?? true set bselect true] ask patch 19 -46 [set plabel 7 set bselected?? true set bselect true] ask patch 22 -46 [set plabel 8 set bselected?? true set bselect true] ask patch 25 -46 [set plabel 9 set bselected?? true set bselect true] ask patch 28 -46 [set plabel 0 set bselected?? true set bselect true] ask patch 31 -46 [set plabel "-" set bselected?? true set bselect true] ask patch 34 -46 [set plabel "=" set bselected?? true set bselect true] ask patch 1 -4 [set plabel "!" set rselected?? true set rselect true] ask patch 4 -4 [set plabel "@" set rselected?? true set rselect true] ask patch 7 -4 [set plabel "#" set rselected?? true set rselect true] ask patch 10 -4 [set plabel "$" set rselected?? true set rselect true] ask patch 13 -4 [set plabel "%" set rselected?? true set rselect true] ask patch 16 -4 [set plabel "^" set rselected?? true set rselect true] ask patch 19 -4 [set plabel "&" set rselected?? true set rselect true] ask patch 22 -4 [set plabel "*" set rselected?? true set rselect true] ask patch 25 -4 [set plabel "(" set rselected?? true set rselect true] ask patch 28 -4 [set plabel ")" set rselected?? true set rselect true] ask patch 31 -4 [set plabel "_" set rselected?? true set rselect true] ask patch 34 -4 [set plabel "+" set rselected?? true set rselect true] ask patch 1 -43 [set plabel "!" set bselected?? true set bselect true] ask patch 4 -43 [set plabel "@" set bselected?? true set bselect true] ask patch 7 -43 [set plabel "#" set bselected?? true set bselect true] ask patch 10 -43 [set plabel "$" set bselected?? true set bselect true] ask patch 13 -43 [set plabel "%" set bselected?? true set bselect true] ask patch 16 -43 [set plabel "^" set bselected?? true set bselect true] ask patch 19 -43 [set plabel "&" set bselected?? true set bselect true] ask patch 22 -43 [set plabel "*" set bselected?? true set bselect true] ask patch 25 -43 [set plabel "(" set bselected?? true set bselect true] ask patch 28 -43 [set plabel ")" set bselected?? true set bselect true] ask patch 31 -43 [set plabel "_" set bselected?? true set bselect true] ask patch 34 -43 [set plabel "+" set bselected?? true set bselect true] if gamemode = 2 [ ask patches [ set rselected?? false set bselected?? false ] set rgen 12 set bgen 12 ] reset-ticks if gamemode = 1 [ create-nests 1 [ setxy 18 -24 set shape "nest" set nestnumber 1 set color blue set size 6 set health 50 set selected? true set shield 1 ] next_nest ] if gamemode = 2 [ create-points pointamt [ setxy 18 -24 set shape "energybug" set color blue set size 2 set health 1 set shield 1 set spawntime (96 / pointamt) set selected? true ] ] tick end to next_nest if count nests with [selected? = false] = 1 [ create-nests 1 [ setxy 18 -24 set shape "nest" set nestnumber 2 set color red set size 6 set health 50 set selected? true set shield 1 ] ] end to next_bugs if count points with [selected? = false] = pointamt [ create-points pointamt [ setxy 18 -24 set shape "energybug" set color red set size 2 set health 1 set shield 1 set spawntime ([spawntime] of one-of points with [color = blue]) set selected? true ] ] end to center let y -1 repeat 16 [ create-turtles 1 [ setxy 1 y repeat 12 [ set heading 90 forward 3 ask patch-here [set center? true] ] set y (y - 3) ] ] ask turtles [die] end to symmetrytest repeat Special_Tile_Amount [ ask patch (1 + (3 * (random 12))) (-7 - (3 * (random 6))) [ set pcolor 12 sprout 1 [ setxy (max-pxcor - ([pxcor] of patch-here)) (max-pycor - (([pycor] of patch-here) - 1)) ask patch-here [ set pcolor 102 ] die ] ] ] ask patches with [pcolor != colormemory] [ ask patches in-radius 1.5 [ set pcolor [pcolor] of myself ] ask patches with [pcolor = 12] [ set rednest true ] ask patches with [pcolor = 102] [ set bluenest true ] ] end to antlionsnest repeat Special_Tile_Amount [ ask patch (1 + (3 * (random 12))) (-7 - (3 * (random 6))) [ set pcolor 47.5 set antlionsp true sprout-antlions 1 [ set shape "ant" set size 4 set health 1 set color black ] sprout 1 [ setxy (max-pxcor - ([pxcor] of patch-here)) (max-pycor - (([pycor] of patch-here) - 1)) ask patch-here [ set pcolor 47.5 set antlionsp true sprout-antlions 1 [ set shape "ant" set size 4 set health 1 set color black ] ] die ] ] ] ask patches with [pcolor = 47.5] [ ask patches in-radius 1.5 [ set pcolor [pcolor] of myself set antlionn true ] ] end to specialspawn ask patch (1 + (3 * (random 12))) (-16 - (3 * (random 3))) [ set plabel "S1" set rs1spawn true set plabel-color white sprout 1 [ setxy (max-pxcor - ([pxcor] of patch-here)) (max-pycor - (([pycor] of patch-here) - 1)) ask patch-here [ set plabel "S1" set bs1spawn true set plabel-color white ] die ] ] if Special_Tile_Amount >= 2 [ ask patch (1 + (3 * (random 12))) (-16 - (3 * (random 3))) [ set plabel "S2" set rs2spawn true set plabel-color white sprout 1 [ setxy (max-pxcor - ([pxcor] of patch-here)) (max-pycor - (([pycor] of patch-here) - 1)) ask patch-here [ set plabel "S2" set bs2spawn true set plabel-color white ] die ] ] ] if Special_Tile_Amount = 3 [ ask patch (1 + (3 * (random 12))) (-16 - (3 * (random 3))) [ set plabel "S3" set rs3spawn true set plabel-color white sprout 1 [ setxy (max-pxcor - ([pxcor] of patch-here)) (max-pycor - (([pycor] of patch-here) - 1)) ask patch-here [ set plabel "S3" set bs3spawn true set plabel-color white ] die ] ] ] end ;=================================================================== ;===========================BUILDINGS=============================== ;=================================================================== to rbugs_nest if rresources > 3 and (ticks = 1) [ create-bugs_nests 1 [ set building? true set selected? true set spawntime 10 set shield 1 set health 10 set shape "nest" set size 5 setxy 18 -24 set color red set rresources (rresources - 4) ] ] end to bbugs_nest if bresources > 3 and (ticks = 1) [ create-bugs_nests 1 [ set building? true set selected? true set spawntime 10 set shield 1 set health 10 set shape "nest" set size 5 setxy 18 -24 set color blue set bresources (bresources - 4) ] ] end to rpollen_flowers if rresources > 5 and (ticks = 1) [ create-pollen_flowers 1 [ set building? true set selected? true set spawntime 10 set shield 1 set health 8 set shape "flower" set size 5 setxy 18 -24 set color red set rresources (rresources - 6) ] ] end to bpollen_flowers if bresources > 5 and (ticks = 1) [ create-pollen_flowers 1 [ set building? true set selected? true set spawntime 10 set shield 1 set health 8 set shape "flower" set size 5 setxy 18 -24 set color blue set bresources (bresources - 6) ] ] end to bbug_decoys if bresources > 1 and (ticks = 1) [ create-bug_decoys 1 [ set building? true set selected? true set spawntime 10 set shield 1 set health 8 set shape "bugdecoy" set size 5 setxy 18 -24 set color blue set bresources (bresources - 2) ] ] end to rbug_decoys if rresources > 1 and (ticks = 1) [ create-bug_decoys 1 [ set building? true set selected? true set spawntime 10 set shield 1 set health 8 set shape "bugdecoy" set size 5 setxy 18 -24 set color red set rresources (rresources - 2) ] ] end to bhealth_givers if bresources > 3 and (ticks = 1) [ create-health_givers 1 [ set building? true set selected? true set shield 1 set health 15 set shape "healthgiver" set size 5 setxy 18 -24 set color blue set bresources (bresources - 4) ] ] end to rhealth_givers if rresources > 3 and (ticks = 1) [ create-health_givers 1 [ set building? true set selected? true set shield 1 set health 15 set shape "healthgiver" set size 5 setxy 18 -24 set color red set rresources (rresources - 4) ] ] end to bchemical_swaps if bresources > 5 and (ticks = 1) [ create-chemical_swaps 1 [ set building? true set selected? true set shield 1 set health 5 set shape "chemicalswap" set size 5 setxy 18 -24 set color blue set bresources (bresources - 6) ] ] end to rchemical_swaps if rresources > 5 and (ticks = 1) [ create-chemical_swaps 1 [ set building? true set selected? true set shield 1 set health 5 set shape "chemicalswap" set size 5 setxy 18 -24 set color red set rresources (rresources - 6) ] ] end ;=================================================================== ;==============================BUGS================================= ;=================================================================== to rbugstuff if rbudget > 0 [ create-bugs 1 [ set shield 1 set health 4 set maxhealth health set speed 1 set speedmemory 1 set damage 1 set dmemory damage set shape "bug" set size 3 setxy 18 -24 set color red set rbudget (rbudget - 1) set selected? true set labelmemory white if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [rselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [rselected?? = true]) ([pycor] of one-of patches with [rselected?? = true]) set selected? false ask patch-here [set rselected?? false]] [set rbudget (rbudget + 1) die] ] ] ] end to bbugstuff if bbudget > 0 [ create-bugs 1 [ set shield 1 set health 4 set maxhealth health set speed 1 set speedmemory 1 set damage 1 set dmemory damage set shape "bug" set size 3 setxy 18 -24 set color blue set bbudget (bbudget - 1) set selected? true set labelmemory white if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [bselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [bselected?? = true]) ([pycor] of one-of patches with [bselected?? = true]) set selected? false ask patch-here [set bselected?? false]] [set bbudget (bbudget + 1) die] ] ] ] end to rbeestuff if rbudget > 1 [ create-bees 1 [ set shield 1 set health 2 set maxhealth health set speed 3 set speedmemory 3 set damage 4 set dmemory damage set shape "bee 2" set size 3 setxy 18 -24 set color red set rbudget (rbudget - 2) set selected? true set labelmemory white set flying? true if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [rselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [rselected?? = true]) ([pycor] of one-of patches with [rselected?? = true]) set selected? false ask patch-here [set rselected?? false]] [set rbudget (rbudget + 2) die] ] ] ] end to bbeestuff if bbudget > 1 [ create-bees 1 [ set shield 1 set health 2 set maxhealth health set speed 3 set speedmemory 3 set damage 4 set dmemory damage set shape "bee 2" set size 3 setxy 18 -24 set color blue set bbudget (bbudget - 2) set selected? true set labelmemory white set flying? true if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [bselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [bselected?? = true]) ([pycor] of one-of patches with [bselected?? = true]) set selected? false ask patch-here [set bselected?? false]] [set bbudget (bbudget + 2) die] ] ] ] end to rantstuff if rbudget > 2 [ create-ants 1 [ set shield 1 set health 4.5 set maxhealth health set speed 1 set speedmemory 1 set damage 1 set dmemory damage set shape "ant 2" set size 3 setxy 18 -24 set color red set rbudget (rbudget - 3) set selected? true set labelmemory white set effectiverange 5 set ermemory effectiverange if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [rselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [rselected?? = true]) ([pycor] of one-of patches with [rselected?? = true]) set selected? false ask patch-here [set rselected?? false]] [set rbudget (rbudget + 3) die] ] ] ] end to bantstuff if bbudget > 2 [ create-ants 1 [ set shield 1 set health 4.5 set maxhealth health set speed 1 set speedmemory 1 set damage 1 set dmemory damage set shape "ant 2" set size 3 setxy 18 -24 set color blue set bbudget (bbudget - 3) set selected? true set labelmemory white set effectiverange 5 set ermemory effectiverange if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [bselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [bselected?? = true]) ([pycor] of one-of patches with [bselected?? = true]) set selected? false ask patch-here [set bselected?? false]] [set bbudget (bbudget + 3) die] ] ] ] end to rcaterpillars if rbudget > 0 [ create-caterpillars 1 [ set shield 1 set health 3 set maxhealth health set speed 1 set speedmemory 1 set damage 1 set dmemory damage set shape "caterpillar" set size 3 setxy 18 -24 set color red set rbudget (rbudget - 1) set selected? true set labelmemory white if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [rselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [rselected?? = true]) ([pycor] of one-of patches with [rselected?? = true]) set selected? false ask patch-here [set rselected?? false]] [set rbudget (rbudget + 1) die] ] ] ] end to bcaterpillars if bbudget > 0 [ create-caterpillars 1 [ set shield 1 set health 3 set maxhealth health set speed 1 set speedmemory 1 set damage 1 set dmemory damage set shape "caterpillar" set size 3 setxy 18 -24 set color blue set bbudget (bbudget - 1) set selected? true set labelmemory white if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [bselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [bselected?? = true]) ([pycor] of one-of patches with [bselected?? = true]) set selected? false ask patch-here [set bselected?? false]] [set bbudget (bbudget + 1) die] ] ] ] end to rbutterflies if rbudget > 3 [ create-butterflies 1 [ set shield 1 set health 5 set maxhealth health set speed 1.5 set speedmemory 1.5 set damage 1.5 set dmemory damage set shape "butterfly" set size 3 setxy 18 -24 set color red set rbudget (rbudget - 4) set selected? true set labelmemory white set flying? true set effectiverange 3 set ermemory effectiverange if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [rselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [rselected?? = true]) ([pycor] of one-of patches with [rselected?? = true]) set selected? false ask patch-here [set rselected?? false]] [set rbudget (rbudget + 4) die] ] ] ] end to bbutterflies if bbudget > 3 [ create-butterflies 1 [ set shield 1 set health 5 set maxhealth health set speed 1.5 set speedmemory 1.5 set damage 1.5 set dmemory damage set shape "butterfly" set size 3 setxy 18 -24 set color blue set bbudget (bbudget - 4) set selected? true set labelmemory white set flying? true set effectiverange 3 set ermemory effectiverange if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [bselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [bselected?? = true]) ([pycor] of one-of patches with [bselected?? = true]) set selected? false ask patch-here [set bselected?? false]] [set bbudget (bbudget + 4) die] ] ] ] end to bspiders if bbudget > 5 [ create-spiders 1 [ set shield 1 set health 5.5 set maxhealth health set speed 1 set speedmemory 1 set damage 2.5 set dmemory damage set shape "spider" set size 3.5 setxy 18 -24 set color blue set bbudget (bbudget - 6) set selected? true set labelmemory white set effectiverange 3 set ermemory effectiverange if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [bselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [bselected?? = true]) ([pycor] of one-of patches with [bselected?? = true]) set selected? false ask patch-here [set bselected?? false]] [set bbudget (bbudget + 6) die] ] ] ] end to rspiders if rbudget > 5 [ create-spiders 1 [ set shield 1 set health 5.5 set maxhealth health set speed 1 set speedmemory 1 set damage 2.5 set dmemory damage set shape "spider" set size 3.5 setxy 18 -24 set color red set rbudget (rbudget - 6) set selected? true set labelmemory white set effectiverange 3 set ermemory effectiverange if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [rselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [rselected?? = true]) ([pycor] of one-of patches with [rselected?? = true]) set selected? false ask patch-here [set rselected?? false]] [set rbudget (rbudget + 6) die] ] ] ] end to bmoths if bbudget > 2 [ create-moths 1 [ set shield 1 set health 5 set maxhealth health set speed 1.5 set speedmemory 1.5 set damage 1.5 set dmemory damage set shape "butterfly 2" set size 3 setxy 18 -24 set color blue set bbudget (bbudget - 3) set selected? true set labelmemory white set flying? true set effectiverange 3 set ermemory effectiverange if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [bselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [bselected?? = true]) ([pycor] of one-of patches with [bselected?? = true]) set selected? false ask patch-here [set bselected?? false]] [set bbudget (bbudget + 3) die] ] ] ] end to rmoths if rbudget > 2 [ create-moths 1 [ set shield 1 set health 5 set maxhealth health set speed 1.5 set speedmemory 1.5 set damage 1.5 set dmemory damage set shape "butterfly 2" set size 3 setxy 18 -24 set color red set rbudget (rbudget - 3) set selected? true set labelmemory white set flying? true set effectiverange 3 set ermemory effectiverange if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [rselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [rselected?? = true]) ([pycor] of one-of patches with [rselected?? = true]) set selected? false ask patch-here [set rselected?? false]] [set rbudget (rbudget + 3) die] ] ] ] end to bdragonflies if bbudget > 2 [ create-dragonflies 1 [ set shield 1 set health 4 set maxhealth health set speed 6 set speedmemory 6 set damage 2 set dmemory damage set shape "dragonfly" set size 3 setxy 18 -24 set color blue set bbudget (bbudget - 3) set selected? true set labelmemory white set flying? true set effectiverange 6 set ermemory effectiverange if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [bselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [bselected?? = true]) ([pycor] of one-of patches with [bselected?? = true]) set selected? false ask patch-here [set bselected?? false]] [set bbudget (bbudget + 3) die] ] ] ] end to rdragonflies if rbudget > 2 [ create-dragonflies 1 [ set shield 1 set health 4 set maxhealth health set speed 6 set speedmemory 6 set damage 2 set dmemory damage set shape "dragonfly" set size 3 setxy 18 -24 set color red set rbudget (rbudget - 3) set selected? true set labelmemory white set flying? true set effectiverange 6 set ermemory effectiverange if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [rselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [rselected?? = true]) ([pycor] of one-of patches with [rselected?? = true]) set selected? false ask patch-here [set rselected?? false]] [set rbudget (rbudget + 3) die] ] ] ] end to bbeetles if bbudget > 9 [ create-beetles 1 [ set shield 1 set health 10 set maxhealth health set speed 0.25 set speedmemory 0.5 set damage 0.25 set dmemory damage set shape "beetle" set size 4 setxy 18 -24 set color blue set bbudget (bbudget - 10) set selected? true set labelmemory white set effectiverange 2 set ermemory 2 if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [bselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [bselected?? = true]) ([pycor] of one-of patches with [bselected?? = true]) set selected? false ask patch-here [set bselected?? false]] [set bbudget (bbudget + 10) die] ] ] ] end to rbeetles if rbudget > 9 [ create-beetles 1 [ set shield 1 set health 10 set maxhealth health set speed 0.25 set speedmemory 0.25 set damage 0.25 set dmemory damage set shape "beetle" set size 4 setxy 18 -24 set color red set rbudget (rbudget - 10) set selected? true set labelmemory white set effectiverange 2 set ermemory 2 if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [rselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [rselected?? = true]) ([pycor] of one-of patches with [rselected?? = true]) set selected? false ask patch-here [set rselected?? false]] [set rbudget (rbudget + 10) die] ] ] ] end to bvenomspitters if bbudget > 4 [ create-venomspitters 1 [ set shield 1 set health 5.5 set maxhealth health set speed 1.5 set speedmemory 1.5 set damage 1.5 set dmemory damage set shape "venomspitter" set size 3 setxy 18 -24 set color blue set bbudget (bbudget - 5) set selected? true set labelmemory white set effectiverange 1.5 set ermemory 1.5 if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [bselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [bselected?? = true]) ([pycor] of one-of patches with [bselected?? = true]) set selected? false ask patch-here [set bselected?? false]] [set bbudget (bbudget + 6) die] ] ] ] end to rvenomspitters if rbudget > 4 [ create-venomspitters 1 [ set shield 1 set health 5.5 set maxhealth health set speed 1.5 set speedmemory 1.5 set damage 1.5 set dmemory damage set shape "venomspitter" set size 3 setxy 18 -24 set color red set rbudget (rbudget - 5) set selected? true set labelmemory white set effectiverange 1.5 set ermemory 1.5 if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [rselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [rselected?? = true]) ([pycor] of one-of patches with [rselected?? = true]) set selected? false ask patch-here [set rselected?? false]] [set rbudget (rbudget + 6) die] ] ] ] end to bgrasshoppers if bbudget > 2 [ create-grasshoppers 1 [ set shield 1 set health 5 set maxhealth health set speed 1 set speedmemory 1 set damage 1.5 set dmemory damage set shape "grasshopper" set size 3 setxy 18 -24 set color blue set bbudget (bbudget - 3) set selected? true set labelmemory white if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [bselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [bselected?? = true]) ([pycor] of one-of patches with [bselected?? = true]) set selected? false ask patch-here [set bselected?? false]] [set bbudget (bbudget + 3) die] ] ] ] end to rgrasshoppers if rbudget > 2 [ create-grasshoppers 1 [ set shield 1 set health 5 set maxhealth health set speed 1 set speedmemory 1 set damage 1.5 set dmemory damage set shape "grasshopper" set size 3 setxy 18 -24 set color red set rbudget (rbudget - 3) set selected? true set labelmemory white if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [rselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [rselected?? = true]) ([pycor] of one-of patches with [rselected?? = true]) set selected? false ask patch-here [set rselected?? false]] [set rbudget (rbudget + 3) die] ] ] ] end to bthornbugs if bbudget > 2 [ create-thornbugs 1 [ set shield 1 set health 3 set maxhealth health set speed 1 set speedmemory 1 set damage 1 set dmemory damage set thorns true set shape "thornbug" set size 3 setxy 18 -24 set color blue set bbudget (bbudget - 3) set selected? true set labelmemory white if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [bselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [bselected?? = true]) ([pycor] of one-of patches with [bselected?? = true]) set selected? false ask patch-here [set bselected?? false]] [set bbudget (bbudget + 2) die] ] ] ] end to rthornbugs if rbudget > 2 [ create-thornbugs 1 [ set shield 1 set health 3 set maxhealth health set speed 1 set speedmemory 1 set damage 1 set dmemory damage set thorns true set shape "thornbug" set size 3 setxy 18 -24 set color red set rbudget (rbudget - 3) set selected? true set labelmemory white if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [rselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [rselected?? = true]) ([pycor] of one-of patches with [rselected?? = true]) set selected? false ask patch-here [set rselected?? false]] [set rbudget (rbudget + 2) die] ] ] ] end to bmantis if bbudget > 7 [ create-mantises 1 [ set shield 1 set health 4.5 set maxhealth health set speed 2 set speedmemory 2 set damage 0.5 set dmemory damage set shape "mantis" set size 4 setxy 18 -24 set color blue set bbudget (bbudget - 8) set selected? true set labelmemory white set effectiverange 3 set ermemory effectiverange if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [bselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [bselected?? = true]) ([pycor] of one-of patches with [bselected?? = true]) set selected? false ask patch-here [set bselected?? false]] [set bbudget (bbudget + 8) die] ] ] ] end to rmantis if rbudget > 7 [ create-mantises 1 [ set shield 1 set health 4.5 set maxhealth health set speed 2 set speedmemory 2 set damage 0.5 set dmemory damage set shape "mantis" set size 4 setxy 18 -24 set color red set rbudget (rbudget - 8) set selected? true set labelmemory white set effectiverange 3 set ermemory effectiverange if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [rselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [rselected?? = true]) ([pycor] of one-of patches with [rselected?? = true]) set selected? false ask patch-here [set rselected?? false]] [set rbudget (rbudget + 8) die] ] ] ] end to bpillbug if bbudget > 3 [ create-pillbugs 1 [ set shield 1 set health 2 set maxhealth health set speed 1 set speedmemory 1 set damage 1 set dmemory damage set shape "pillbug" set size 2.5 setxy 18 -24 set color blue set bbudget (bbudget - 4) set selected? true set labelmemory white set effectiverange 1.5 set ermemory effectiverange if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [bselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [bselected?? = true]) ([pycor] of one-of patches with [bselected?? = true]) set selected? false ask patch-here [set bselected?? false]] [set bbudget (bbudget + 4) die] ] ] ] end to rpillbug if rbudget > 3 [ create-pillbugs 1 [ set shield 1 set health 2 set maxhealth health set speed 1 set speedmemory 1 set damage 1 set dmemory damage set shape "pillbug" set size 2.5 setxy 18 -24 set color red set rbudget (rbudget - 4) set selected? true set labelmemory white set effectiverange 1.5 set ermemory effectiverange if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [rselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [rselected?? = true]) ([pycor] of one-of patches with [rselected?? = true]) set selected? false ask patch-here [set rselected?? false]] [set rbudget (rbudget + 4) die] ] ] ] end to bcicada if bbudget > 4 [ create-cicadas 1 [ set shield 1 set health 5 set maxhealth health set speed 1.5 set speedmemory 1.5 set damage 2 set dmemory damage set shape "cicada" set size 3 setxy 18 -24 set color blue set bbudget (bbudget - 5) set selected? true set labelmemory white set effectiverange 3 set ermemory effectiverange if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [bselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [bselected?? = true]) ([pycor] of one-of patches with [bselected?? = true]) set selected? false ask patch-here [set bselected?? false]] [set bbudget (bbudget + 5) die] ] ] ] end to rcicada if rbudget > 4 [ create-cicadas 1 [ set shield 1 set health 5 set maxhealth health set speed 1.5 set speedmemory 1.5 set damage 2 set dmemory damage set shape "cicada" set size 3 setxy 18 -24 set color red set rbudget (rbudget - 5) set selected? true set labelmemory white set effectiverange 3 set ermemory effectiverange if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [rselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [rselected?? = true]) ([pycor] of one-of patches with [rselected?? = true]) set selected? false ask patch-here [set rselected?? false]] [set rbudget (rbudget + 5) die] ] ] ] end to bwasp if bbudget > 4 [ create-wasps 1 [ set shield 1 set health 3 set maxhealth health set speed 3 set speedmemory 3 set damage 4 set dmemory damage set shape "wasp" set size 3 setxy 18 -24 set color blue set bbudget (bbudget - 5) set selected? true set labelmemory white set flying? true set effectiverange 2 set ermemory effectiverange if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [bselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [bselected?? = true]) ([pycor] of one-of patches with [bselected?? = true]) set selected? false ask patch-here [set bselected?? false]] [set bbudget (bbudget + 5) die] ] ] ] end to rwasp if rbudget > 4 [ create-wasps 1 [ set shield 1 set health 3 set maxhealth health set speed 3 set speedmemory 3 set damage 4 set dmemory damage set shape "wasp" set size 3 setxy 18 -24 set color red set rbudget (rbudget - 5) set selected? true set labelmemory white set flying? true set effectiverange 2 set ermemory effectiverange if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [rselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [rselected?? = true]) ([pycor] of one-of patches with [rselected?? = true]) set selected? false ask patch-here [set rselected?? false]] [set rbudget (rbudget + 5) die] ] ] ] end to bbedbug if bbudget > 2 [ create-bedbugs 1 [ set shield 1 set health 4 set maxhealth health set speed 1 set speedmemory 1 set damage 1 set dmemory damage set shape "bedbug" set size 2 setxy 18 -24 set color blue set bbudget (bbudget - 3) set selected? true set labelmemory white set flying? false set effectiverange 3 set ermemory effectiverange if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [bselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [bselected?? = true]) ([pycor] of one-of patches with [bselected?? = true]) set selected? false ask patch-here [set bselected?? false]] [set bbudget (bbudget + 3) die] ] ] ] end to rbedbug if rbudget > 2 [ create-bedbugs 1 [ set shield 1 set health 4 set maxhealth health set speed 1 set speedmemory 1 set damage 1 set dmemory damage set shape "bedbug" set size 2 setxy 18 -24 set color red set rbudget (rbudget - 3) set selected? true set labelmemory white set flying? false set effectiverange 3 set ermemory effectiverange if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [rselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [rselected?? = true]) ([pycor] of one-of patches with [rselected?? = true]) set selected? false ask patch-here [set rselected?? false]] [set rbudget (rbudget + 3) die] ] ] ] end to bstickbug if bbudget > 4 [ create-stickbug 1 [ set shield 1 set health 4.5 set maxhealth health set speed 1.5 set speedmemory 1.5 set damage 2 set dmemory damage set shape "walkingstick" set size 3.5 setxy 18 -24 set color blue set bbudget (bbudget - 5) set selected? true set labelmemory white set effectiverange 1.5 set ermemory 1.5 if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [bselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [bselected?? = true]) ([pycor] of one-of patches with [bselected?? = true]) set selected? false ask patch-here [set bselected?? false]] [set bbudget (bbudget + 5) die] ] ] ] end to rstickbug if rbudget > 4 [ create-stickbug 1 [ set shield 1 set health 4.5 set maxhealth health set speed 1.5 set speedmemory 1.5 set damage 2 set dmemory damage set shape "walkingstick" set size 3.5 setxy 18 -24 set color red set rbudget (rbudget - 5) set selected? true set labelmemory white set effectiverange 1.5 set ermemory 1.5 if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [rselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [rselected?? = true]) ([pycor] of one-of patches with [rselected?? = true]) set selected? false ask patch-here [set rselected?? false]] [set rbudget (rbudget + 5) die] ] ] ] end to btarantulahawk if bbudget > 8 [ create-tarantulahawks 1 [ set shield 1 set health 5 set maxhealth health set speed 4 set speedmemory 4 set damage 4 set dmemory damage set shape "tarantulahawk" set size 4 setxy 18 -24 set color blue set bbudget (bbudget - 9) set selected? true set labelmemory white set flying? true if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [bselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [bselected?? = true]) ([pycor] of one-of patches with [bselected?? = true]) set selected? false ask patch-here [set bselected?? false]] [set bbudget (bbudget + 9) die] ] ] ] end to rtarantulahawk if rbudget > 8 [ create-tarantulahawks 1 [ set shield 1 set health 5 set maxhealth health set speed 4 set speedmemory 4 set damage 4 set dmemory damage set shape "tarantulahawk" set size 4 setxy 18 -24 set color red set rbudget (rbudget - 9) set selected? true set labelmemory white set flying? true if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [rselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [rselected?? = true]) ([pycor] of one-of patches with [rselected?? = true]) set selected? false ask patch-here [set rselected?? false]] [set rbudget (rbudget + 9) die] ] ] ] end to bscrewworms if bbudget > 6 [ create-screwworms 1 [ set shield 1 set health 4 set maxhealth health set speed 1.5 set speedmemory 1.5 set damage 1.5 set dmemory damage set shape "screwworm" set size 2.5 setxy 18 -24 set color blue set bbudget (bbudget - 7) set selected? true set labelmemory white set flying? true if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [bselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [bselected?? = true]) ([pycor] of one-of patches with [bselected?? = true]) set selected? false ask patch-here [set bselected?? false]] [set bbudget (bbudget + 7) die] ] ] ] end to rscrewworms if rbudget > 6 [ create-screwworms 1 [ set shield 1 set health 4 set maxhealth health set speed 1.5 set speedmemory 1.5 set damage 1.5 set dmemory damage set shape "screwworm" set size 2.5 setxy 18 -24 set color red set rbudget (rbudget - 7) set selected? true set labelmemory white set flying? true if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [rselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [rselected?? = true]) ([pycor] of one-of patches with [rselected?? = true]) set selected? false ask patch-here [set rselected?? false]] [set rbudget (rbudget + 7) die] ] ] ] end to btermites if bbudget > 3 [ create-termites 1 [ set shield 1 set health 4.5 set maxhealth health set speed 1 set speedmemory 1 set damage 1 set dmemory damage set shape "termite" set size 2.5 setxy 18 -24 set color blue set bbudget (bbudget - 4) set selected? true set labelmemory white if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [bselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [bselected?? = true]) ([pycor] of one-of patches with [bselected?? = true]) set selected? false ask patch-here [set bselected?? false]] [set bbudget (bbudget + 7) die] ] ] ] end to rtermites if rbudget > 3 [ create-termites 1 [ set shield 1 set health 4.5 set maxhealth health set speed 1 set speedmemory 1 set damage 1 set dmemory damage set shape "termite" set size 2.5 setxy 18 -24 set color red set rbudget (rbudget - 4) set selected? true set labelmemory white if gamemode = 2 and (ticks != 1) [ ifelse (count patches with [bselected?? = true]) = 1 [setxy ([pxcor] of one-of patches with [bselected?? = true]) ([pycor] of one-of patches with [bselected?? = true]) set selected? false ask patch-here [set bselected?? false]] [set bbudget (bbudget + 7) die] ] ] ] end ;=========================================================================================== to start if ticks = 1 [ ask turtles with [color = blue] [ set heading 0 ] ask turtles with [color = red] [ set heading 180 ] ] every 0.5 [ ask leaves [set hidden? false] ask lleaves [set hidden? false] ask turtles with [building? != true and shape != "energybug" and shape != "leaf 2" and shape != "leaf"] [ set label precision health 2 ] ask patches [ if redweb = true [ set pcolor 19.5 ] if blueweb = true [ set pcolor 109 ] if redweb = true and blueweb = true [ set pcolor 118.5 ] ] ask patches with [redweb = true or blueweb = true] [ set sspawntime (sspawntime - 1) if sspawntime <= 0 [ set redweb false set blueweb false set pcolor colormemory ] ] ;Building Stuff-------------------------------------------------------------------- ask turtles with [building? = true and shape != "chemicalswap"] [ set label health ] ask turtles with [shape = "chemicalswap"] [ set label spawntime ] ask turtles with [building? != true and (not any? (pollen_flowers with [shade-of? color ([color] of self)]) in-radius 6)] [ ask my-links with [shape = "pollon"] [ die ] ] ask turtles with [building? != true and (not any? (health_givers with [shade-of? color ([color] of self)]) in-radius 6)] [ ask my-links with [shape = "healing"] [ die ] ] ;Special Tiles---------------------------------------------------------------------- ask turtles with [flying? = 0] [ set flying? false ] ask antlions [ face min-one-of other turtles [distance myself] ] ask turtles with [shape != "ant"] [ if [color] of self = red and [pcolor] of patch-here = 12 [ hatch 1 [ set size (size / 2) set maxhealth (maxhealth / 4) set health maxhealth right 90 forward 3 left 90 set poisoned? false set label "" ] ask min-one-of patches with [rednest = true and ((count patches with [rednest = true] in-radius 1.5) = 9)] [distance myself] [ ask patches in-radius 1.5 [ set pcolor colormemory ] ] ] if [color] of self = blue and [pcolor] of patch-here = 102 [ hatch 1 [ set size (size / 2) set maxhealth (maxhealth / 4) set health maxhealth right 90 forward 3 left 90 set poisoned? false set label "" ] ask min-one-of patches with [bluenest = true and ((count patches with [bluenest = true] in-radius 1.5) = 9)] [distance myself] [ ask patches in-radius 1.5 [ set pcolor colormemory ] ] ] if any? antlions in-radius 1.5 and [flying?] of self = false [ ask patches in-radius 3 with [pcolor = 47.5] [ set pcolor colormemory ] ask antlions in-radius 1.5 [ die ] die ] ;Status Effects---------------------------------------------------------------------- if poisoned? = true and [shape] of self != "beetle" [set health (health - 0.25) set label-color green set labelmemory green] ;Cicada Ability============================================== ifelse count other cicadas with [color = [color] of myself] > 0 [ ifelse any? other cicadas with [color = ([color] of myself)] in-radius ([effectiverange] of min-one-of other cicadas [distance myself]) [ set effectiverange (ermemory * 2) ] [ set effectiverange ermemory ] ] [ set effectiverange ermemory ] ;Pillbug Ability============================================= ifelse count other pillbugs with [color = [color] of myself] > 0 [ ifelse any? other (pillbugs in-radius ([effectiverange] of min-one-of other pillbugs [distance myself])) with [color = ([color] of myself)] [ set shield 2 set label-color black ] [ set shield 1 set label-color [labelmemory] of self ] ] [ set shield 1 set label-color [labelmemory] of self ] ;Wasp Ability=============================================== ifelse count other wasps with [color = [color] of myself] > 0 [ ifelse any? other (wasps in-radius ([effectiverange] of min-one-of other wasps [distance myself])) with [color = ([color] of myself)] [ set damage (dmemory * 1.5) set label-color (red - 2) ] [ set damage dmemory set label-color [labelmemory] of self ] ] [ set damage dmemory set label-color [labelmemory] of self ] ;Dragonfly Ability================================================== ifelse count other dragonflies with [color = [color] of myself] > 0 [ ifelse any? (dragonflies in-radius ([effectiverange] of min-one-of other dragonflies [distance myself])) with [color = [color] of myself] and ([shape] of self != "dragonfly") [ set speed (speedmemory * 2) set label-color yellow ] [ set speed speedmemory set label-color [labelmemory] of self ] ] [ set speed speedmemory set label-color [labelmemory] of self ] ;Bedbug Ability====================================================== ifelse count other bedbugs with [color = [color] of myself] > 0 [ ifelse any? other (bedbugs in-radius ([effectiverange] of min-one-of other bedbugs [distance myself])) with [color = ([color] of myself)] [ set speed [speed] of one-of (bedbugs in-radius ([effectiverange] of min-one-of other bedbugs [distance myself])) with [color = ([color] of myself)] set label-color grey ] [ set speed speedmemory set label-color [labelmemory] of self ] ] [ set speed speedmemory set label-color [labelmemory] of self ] ;============================Termite Burrows======================================== if size = 1.256 [ die ] if [pcolor] of patch-here = black and flying? = false [ set size 1.256 set speed 0 set speed speedmemory ] ] ask poisons [ set label "" repeat 45 [ forward 1 if any? turtles with [color = [rival] of myself] in-radius effectiverange [ ask turtles with [color = [rival] of myself] in-radius effectiverange [ set poisoned? true ] die ] ] die ] ask blinds [ set label "" repeat 45 [ forward 1 if any? turtles with [color = [rival] of myself] in-radius effectiverange [ ask turtles with [color = [rival] of myself] in-radius effectiverange [ set blindtime (blindtime + 7) ] die ] ] die ] ;========================================================================================== ;======================================FREE FOR ALL======================================== ;========================================================================================== if gamemode = 0 [ ifelse count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 and gamemode = 0 [ if gamemode = 0 [ ;Bugs Nest============================================== ask bugs_nests with [shade-of? color blue] [ set color 104 if ticks = 1 [ set bx xcor set by ycor ] if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ set spawntime (spawntime - 1) if spawntime = 0 [ hatch-bugs 1 [ set shield 1 set building? 0 set health 1 set maxhealth health set speed 1 set speedmemory 1 set damage 1 set dmemory damage set shape "bug" set size 1.5 set color blue set labelmemory white ] set health (health - 2) set spawntime 10 ] ] setxy bx by ] ask bugs_nests with [shade-of? color red] [ set color 14 if ticks = 1 [ set bx xcor set by ycor ] if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ set spawntime (spawntime - 1) if spawntime = 0 [ hatch-bugs 1 [ set shield 1 set building? 0 set health 1 set maxhealth health set speed 1 set speedmemory 1 set damage 1 set dmemory damage set shape "bug" set size 1.5 set color red set labelmemory white ] set health (health - 2) set spawntime 10 ] ] setxy bx by ] ;Pollen Flowers============================================================= ask pollen_flowers with [shade-of? color blue] [ set color 104 if ticks = 1 [ set bx xcor set by ycor ] if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ set spawntime (spawntime - 1) if spawntime = 0 [ set health (health - 1) set spawntime 10 ] create-links-to turtles with [color = red] in-radius 4.5 [ set shape "pollon" set color yellow ] ask turtles with [color = red] in-radius 4.5 [ set blindtime 2 ] ] setxy bx by ] ask pollen_flowers with [shade-of? color red] [ set color 14 if ticks = 1 [ set bx xcor set by ycor ] if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ set spawntime (spawntime - 1) if spawntime = 0 [ set health (health - 1) set spawntime 10 ] create-links-to turtles with [color = blue] in-radius 4.5 [ set shape "pollon" set color yellow ] ask turtles with [color = blue] in-radius 4.5 [ set blindtime 2 ] ] setxy bx by ] ;Bug Decoys=============================================== ask bug_decoys with [shade-of? color blue] [ set color 104 if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ set spawntime (spawntime - 1) if spawntime = 0 [ set health (health - 1) set spawntime 10 ] ] ] ask bug_decoys with [shade-of? color red] [ set color 14 if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ set spawntime (spawntime - 1) if spawntime = 0 [ set health (health - 1) set spawntime 10 ] ] ] ;Health Givers============================================== ask health_givers with [shade-of? color blue] [ face min-one-of turtles with [color = blue] [distance myself] set color 104 if ticks = 1 [ set bx xcor set by ycor ] if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ create-links-to turtles with [color = blue and health < maxhealth] in-radius 6 [ set shape "healing" set color lime ] ask turtles with [color = blue and health < maxhealth] in-radius 6 [ set health (health + 0.5) ask myself [ set health (health - 0.5) ] if health > maxhealth [ set health maxhealth ] ] ] setxy bx by ] ask health_givers with [shade-of? color red] [ face min-one-of turtles with [color = red] [distance myself] set color 14 if ticks = 1 [ set bx xcor set by ycor ] if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ create-links-to turtles with [color = red and health < maxhealth] in-radius 6 [ set shape "healing" set color lime ] ask turtles with [color = red and health < maxhealth] in-radius 6 [ set health (health + 0.5) ask myself [ set health (health - 0.5) ] if health > maxhealth [ set health maxhealth ] ] ] setxy bx by ] ;Chemical Swappers============================================================================== ask chemical_swaps with [shade-of? color blue] [ set color 104 if ticks = 1 [ set bx xcor set by ycor ] if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ if count turtles with [color = red and switching? = true] != 1 [ if any? turtles with [color = red] in-radius 9 [ ask min-one-of turtles with [color = red] in-radius 9 [distance myself] [ set switching? true ] create-links-to turtles with [color = red and switching? = true] [ set color blue set shape "chemical" ] set spawntime ([maxhealth] of one-of turtles with [color = red and switching? = true] * 2) ] ] set spawntime (spawntime - 1) if spawntime <= 0 [ ask turtles with [color = red and switching? = true] in-radius 9 [ set color blue set switching? false ask my-links with [shape = "chemical"] [ die ] ] set spawntime 0 ] ] setxy bx by ] ask chemical_swaps with [shade-of? color red] [ set color 14 if ticks = 1 [ set bx xcor set by ycor ] if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ if count turtles with [color = blue and switching? = true] != 1 [ if any? turtles with [color = blue] in-radius 9 [ ask min-one-of turtles with [color = blue] in-radius 9 [distance myself] [ set switching? true ] create-links-to turtles with [color = blue and switching? = true] [ set color red set shape "chemical" ] set spawntime ([maxhealth] of one-of turtles with [color = blue and switching? = true] * 2) ] ] set spawntime (spawntime - 1) if spawntime <= 0 [ ask turtles with [color = blue and switching? = true] in-radius 9 [ set color red set switching? false ask my-links with [shape = "chemical"] [ die ] ] set spawntime 0 ] ] setxy bx by ] ;Bugs--------------------------------------------------- ask bugs with [color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ask bugs with [color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ;Bees------------------------------------------------------------------- ask bees with [color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ repeat speed [ forward 1 if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - ((([damage] of myself) / ([speed] of myself)) / shield)) forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] set health (health - ((1 / speed) / shield)) ] ] ] [ forward (speed / 4) ] ] ] ask bees with [color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ repeat speed [ forward 1 if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - ((([damage] of myself) / ([speed] of myself)) / shield)) forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] set health (health - ((1 / speed) / shield)) ] ] ] [ forward (speed / 4) ] ] ] ;Ants-------------------------------------------------------------------------- ask ants with [color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ set damage 1 + (0.5 * (count other ants in-radius effectiverange with [color = blue])) set dmemory damage face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ask ants with [color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ set damage 1 + (0.5 * (count other ants in-radius effectiverange with [color = red])) set dmemory damage face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ;Caterpillars-------------------------------------------------------------------------------- ask caterpillars with [color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ask caterpillars with [color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask (turtles in-radius 1) with [color = blue] [ set health (health - ([damage] of myself)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ;Butterflies----------------------------------------------------------------------- ask butterflies with [color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ ifelse any? caterpillars with [color = blue and health < maxhealth] [ face min-one-of caterpillars with [color = blue and health < maxhealth] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? caterpillars with [color = blue] in-radius effectiverange [ ask caterpillars with [color = blue] in-radius effectiverange [ set health (health + 1) if health > 3 [ set health 3] ] ] ] [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ] ask butterflies with [color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ ifelse any? caterpillars with [color = red and health < 3] [ face min-one-of caterpillars with [color = red and health < 3] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? caterpillars with [color = red] in-radius effectiverange [ ask caterpillars with [color = red] in-radius effectiverange [ set health (health + 1) if health > 3 [ set health 3] ] ] ] [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ] ;Spiders---------------------------------------------------------------------------- ask spiders with [color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ if random 20 = 1 and count (turtles-on patches with [pcolor != 109]) with [color = red] > 0 [ ask max-one-of (turtles-on patches with [pcolor != 109]) with [color = red] [distance myself] [ ask patches in-radius ([effectiverange] of myself) [ set pcolor 109 set blueweb true set sspawntime 60 ] ] ] face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 set poisoned? true if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ask spiders with [color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ if random 20 = 1 and count (turtles-on patches with [pcolor != 19.5]) with [color = blue] > 0 [ ask max-one-of (turtles-on patches with [pcolor != 19.5]) with [color = blue] [distance myself] [ ask patches in-radius ([effectiverange] of myself) [ set pcolor 19.5 set redweb true set sspawntime 60 ] ] ] face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 set poisoned? true if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ;Moths------------------------------------------------------------------------------- ask moths with [color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ ifelse any? butterflies with [color = red] [ face min-one-of butterflies with [color = red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (butterflies in-radius 1) with [color = red] [ ask one-of (butterflies in-radius 1) with [color = red] [ set health (health - ((([damage] of myself) * 2) / shield)) forward -2 forward -1 ] ] ] [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] if health <= 0 [ ask turtles in-radius effectiverange with [color = red and [shape] of self != "beetle"] [ set damage (damage / 2) set dmemory damage set speed (speed / 2) set speedmemory speed set label-color (grey - 2) set labelmemory (grey - 2) set dmemory damage set speedmemory speed ] ] ] ] ask moths with [color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ ifelse any? butterflies with [color = blue] [ face min-one-of butterflies with [color = blue] [distance myself] ifelse [BLUEWEB] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (butterflies in-radius 1) with [color = blue] [ ask one-of (butterflies in-radius 1) with [color = blue] [ set health (health - ((([damage] of myself) * 2) / shield)) forward -2 forward -1 ] ] ] [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [BLUEWEB] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] if health <= 0 [ ask turtles in-radius effectiverange with [color = blue and [shape] of self != "beetle"] [ set damage (damage / 2) set dmemory damage set speed (speed / 2) set speedmemory speed set label-color (grey - 2) set labelmemory (grey - 2) set dmemory damage set speedmemory speed ] ] ] ] ;Dragonflies------------------------------------------------------------------------- ask dragonflies with [color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ repeat speed [ forward 1 if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - ((([damage] of myself) / ([speed] of myself)) / shield)) forward -1 if thorns = true [ ask myself [ set health (health - (damage / 2)) ] ] ] ] ] ] [ forward (speed / 4) ] ] ] ask dragonflies with [color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ repeat speed [ forward 1 if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - ((([damage] of myself) / ([speed] of myself)) / shield)) forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] [ forward (speed / 4) ] ] ] ;Beetles----------------------------------------------------------------------------- ask beetles with [color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ ifelse ramming = true [ set heading facememory ] [ face min-one-of turtles with [shade-of? color red] [distance myself] ] forward speed set speed (speed + 0.25) set speedmemory speed set damage speed set dmemory damage if ([pxcor] of patch-here >= 33.9) or ([pycor] of patch-here >= -0.9) or ([pxcor] of patch-here <= 0.9) or ([pycor] of patch-here <= -45.9) and ramming = true [ set ramming false set speed 0.25 set speedmemory speed set damage speed set dmemory damage forward 0 - [damage] of self forward -1 ] if speed > 3 [ set facememory [heading] of self set ramming true ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask (turtles in-radius effectiverange) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward 0 - [damage] of myself forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] if [damage] of self > 3.5 [ forward 0 - [damage] of self forward -1 ] set speed 0.25 set speedmemory speed set damage speed set dmemory damage set ramming false ] ] ] ask beetles with [color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ ifelse ramming = true [ set heading facememory ] [ face min-one-of turtles with [shade-of? color blue] [distance myself] ] forward speed set speed (speed + 0.25) set speedmemory speed set damage speed set dmemory damage if ([pxcor] of patch-here >= 33.9) or ([pycor] of patch-here >= -0.9) or ([pxcor] of patch-here <= 0.9) or ([pycor] of patch-here <= -45.9) and ramming = true [ set ramming false set speed 0.25 set speedmemory speed set damage speed set dmemory damage forward -2 forward -1 ] if speed > 3 [ set facememory [heading] of self set ramming true ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask (turtles in-radius effectiverange) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward 0 - [damage] of myself forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] if [damage] of self > 3.5 [ forward 0 - [damage] of self forward -1 ] set speed 0.25 set speedmemory speed set damage speed set dmemory damage set ramming false ] ] ] ;Venom Spitters------------------------------------------------------------------------------------ ask venomspitters with [color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ ifelse any? turtles with [color = red and poisoned? = true] [ face min-one-of turtles with [color = red and poisoned? = true] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [color = red and poisoned? = true] [ ask one-of (turtles in-radius 1) with [color = red and poisoned? = true] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] [ face min-one-of turtles with [shade-of? color red] [distance myself] hatch-poisons 1 [ set label "" set rival red set color 52 set ermemory effectiverange set size 1 face min-one-of turtles with [shade-of? color red] [distance myself] ] ] ] ] ask venomspitters with [color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ ifelse any? turtles with [color = blue and poisoned? = true] [ face min-one-of turtles with [color = blue and poisoned? = true] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [color = blue and poisoned? = true] [ ask one-of (turtles in-radius 1) with [color = blue and poisoned? = true] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] [ face min-one-of turtles with [shade-of? color blue] [distance myself] hatch-poisons 1 [ set label "" set rival blue set color 52 set ermemory effectiverange set size 1 face min-one-of turtles with [shade-of? color blue] [distance myself] ] ] ] ] ;Grasshoppers---------------------------------------------------------------------------- ask grasshoppers with [color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ ifelse [distance myself] of (min-one-of turtles with [color = red] [distance myself]) > 12 [ set speed 12 ] [ set speed speedmemory ] face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage / 2)) ] ] ] ] ] ] ask grasshoppers with [color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ ifelse [distance myself] of (min-one-of turtles with [color = blue] [distance myself]) > 12 [ set speed 12 ] [ set speed speedmemory ] face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ;Thorn Bugs--------------------------------------------------------------------------- ask thornbugs with [color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ask thornbugs with [color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ;Mantises--------------------------------------------------------------------------------- ask mantises with [color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [distance myself] of (min-one-of turtles with [color = red] [distance myself]) < 7 and speed < ([distance myself] of min-one-of turtles with [color = red] [distance myself]) [ set speed (speed + 1) set speedmemory speed set damage (damage + 1) set dmemory damage ] [ ifelse [redweb] of patch-here = false [ forward speed - 1 set speed 2 ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] set speed 2 set speedmemory speed set damage 1 set dmemory damage ] ] if any? turtles with [color = red and health <= 0] in-radius 3 [ ask one-of turtles with [color = red and health <= 0] in-radius 3 [ ask turtles with [color = blue] in-radius 6 [ set health health + (1 + (([maxhealth] of one-of (turtles with [color = red and health <= 0] in-radius 6) / (count turtles with [color = blue] in-radius 6)))) if health > maxhealth [ set health maxhealth ] ] ] ] ] ] ask mantises with [color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [distance myself] of (min-one-of turtles with [color = blue] [distance myself]) < 7 and speed < ([distance myself] of min-one-of turtles with [color = blue] [distance myself]) [ set speed (speed + 1) set speedmemory speed set damage (damage + 1) set dmemory damage ] [ ifelse [blueweb] of patch-here = false [ forward speed - 1 set speed 2 ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] set speed 2 set speedmemory speed set damage 1 set dmemory damage ] ] if any? turtles with [color = blue and health <= 0] in-radius 3 [ ask one-of turtles with [color = blue and health <= 0] in-radius 3 [ ask turtles with [color = red] in-radius 6 [ set health health + (1 + (([maxhealth] of one-of (turtles with [color = blue and health <= 0] in-radius 6) / (count turtles with [color = red] in-radius 6)))) if health > maxhealth [ set health maxhealth ] ] ] ] ] ] ;Pillbug---------------------------------------------------------------------------------------------------- ask pillbugs with [color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ask pillbugs with [color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ;Cicadas----------------------------------------------------------------------------------------------------- ask cicadas with [color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ask cicadas with [color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ;Wasps----------------------------------------------------------------------------------------------- ask wasps with [color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ repeat speed [ forward 1 if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - ((([damage] of myself) / ([speed] of myself)) / shield)) forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] [ forward (speed / 4) ] ] ] ask wasps with [color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ repeat speed [ forward 1 if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - ((([damage] of myself) / ([speed] of myself)) / shield)) forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] [ forward (speed / 4) ] ] ] ;Bedbugs------------------------------------------------------------------------------------------- ask bedbugs with [color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ask bedbugs with [color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ;Walking Sticks-------------------------------------------------------------------------------------- ask stickbug with [color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ ifelse any? turtles with [color = red] and (random 15 != 1) [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] [ face one-of turtles with [color = red] with-max [damage] hatch-blinds 1 [ set rival red set color brown set ermemory effectiverange set size 1 set heading [heading] of myself ] ] ] ] ask stickbug with [color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ ifelse any? turtles with [color = blue] and (random 15 != 1) [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] [ face one-of turtles with [color = blue] with-max [damage] hatch-blinds 1 [ set rival blue set color brown set ermemory effectiverange set size 1 set heading [heading] of myself ] ] ] ] ;Tarantula Hawks------------------------------------------------------------------------------------- ask tarantulahawks with [color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ repeat speed [ forward 1 if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - ((([damage] of myself) / ([speed] of myself)) / shield)) if [shape] of self != "beetle" [ set poisoned? true set effectiverange 0 set ermemory 0 ] set paralyzetime (paralyzetime + 1) forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] [ forward (speed / 4) ] ] ] ask tarantulahawks with [color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ repeat speed [ forward 1 if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - ((([damage] of myself) / ([speed] of myself)) / shield)) if [shape] of self != "beetle" [ set poisoned? true set effectiverange 0 set ermemory 0 ] set paralyzetime (paralyzetime + 1) forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] [ forward (speed / 4) ] ] ] ;Screwworm Flies-------------------------------------------------------------------------- ask screwworms with [color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) set poisoned? true set bhost? true forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ask screwworms with [color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) set poisoned? true set rhost? true forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ask larvaes with [color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ set spawntime (spawntime - 1) if spawntime <= 0 [ hatch-screwworms 1 [ set shield 1 set health 4 set maxhealth health set speed 1.5 set speedmemory 1.5 set damage 1.5 set dmemory damage set shape "screwworm" set size 3 set color blue set flying? true ] die ] face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ask larvaes with [color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ set spawntime (spawntime - 1) if spawntime <= 0 [ hatch-screwworms 1 [ set shield 1 set health 4 set maxhealth health set speed 1.5 set speedmemory 1.5 set damage 1.5 set dmemory damage set shape "screwworm" set size 3 set color red set flying? true ] die ] face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ;Termites----------------------------------------------------------------------------------- ask termites with [color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] if ((not any? patches with ([nobody = true]) in-radius 3) and (any? (turtles-on patch-ahead 2) with [color = red]) and (not any? (patches with [pcolor = black]) in-radius 3)) [ ask patch-ahead 3 [ ask patches in-radius 1 with [center? = true] [ ask patches in-radius 1.5 [ set pcolor black ] ] ] ] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ ifelse building? != true [ set health (health - (([damage] of myself) / shield)) ] [ set health (health - ((([damage] of myself) / shield)) * 4) ] forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ask termites with [color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black)] [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] if ((not any? patches with ([nobody = true]) in-radius 3) and (any? (turtles-on patch-ahead 2) with [color = blue]) and (not any? (patches with [pcolor = black]) in-radius 3)) [ ask patch-ahead 3 [ ask patches in-radius 1 with [center? = true] [ ask patches in-radius 1.5 [ set pcolor black ] ] ] ] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ ifelse building? != true [ set health (health - (([damage] of myself) / shield)) ] [ set health (health - ((([damage] of myself) / shield)) * 4) ] forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ;------------------------------------------------------------------------------------------- ask turtles with [blindtime > 0] [ left random 90 right random 90 forward speed set blindtime (blindtime - 1) ] ask turtles with [paralyzetime > 0] [ set paralyzetime (paralyzetime - 1) ] ask turtles with [(patch-ahead speed = nobody) or ([pcolor] of (patch-ahead speed) = black) and (color = blue) and flying? = false] [ right 135 forward speed ] ask turtles with [(patch-ahead speed = nobody) or ([pcolor] of (patch-ahead speed) = black) and (color = red) and flying? = false] [ left 135 forward speed ] ask turtles with [health <= 0] [ if bhost? = true [ hatch-larvaes 1 [ set shield 1 set health 1.5 set maxhealth health set speed 1 set speedmemory 1 set damage 1 set dmemory damage set shape "larvae" set size 2 set color blue set label-color white set labelmemory white set poisoned? false set flying? true set spawntime 20 set bhost? false ] ] if rhost? = true [ hatch-larvaes 1 [ set shield 1 set health 1.5 set maxhealth health set speed 1 set speedmemory 1 set damage 1 set dmemory damage set shape "larvae" set size 2 set color red set label-color white set labelmemory white set poisoned? false set flying? true set spawntime 20 set rhost? false ] ] die ] ] ] [ if count turtles with [color = red] = 0 [ print "BLUE WINS" stop ] if count turtles with [color = blue] = 0 [ print "RED WINS" stop ] ] ] ;==================================================================================================== ;==========================================NEST DESTROYER============================================ ;==================================================================================================== if gamemode = 1 [ ifelse count nests = 2 and gamemode = 1 [ if gamemode = 1 [ ask nests with [color = blue] [ set color 103 set label health ] ask nests with [color = red] [ set color 13 set label health ] ask turtles with [color = red] [ set nestnumber 2 ] ask turtles with [color = blue] [ set nestnumber 1 ] ask turtles with [recovering? = true] [ setxy ([xcor] of one-of nests with [nestnumber = [nestnumber] of myself]) ([ycor] of one-of nests with [nestnumber = [nestnumber] of myself]) set health (health + 1) set paralyzetime 10 if health >= maxhealth [ set recovering? false ] ] ;Bugs Nest============================================== ask bugs_nests with [shade-of? color blue] [ set color 104 if ticks = 1 [ set bx xcor set by ycor ] if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ set spawntime (spawntime - 1) if spawntime = 0 [ hatch-bugs 1 [ set shield 1 set building? 0 set health 1 set maxhealth health set speed 1 set speedmemory 1 set damage 1 set dmemory damage set shape "bug" set size 1.5 set color blue set labelmemory white ] set health (health - 2) set spawntime 10 ] ] setxy bx by ] ask bugs_nests with [shade-of? color red] [ set color 14 if ticks = 1 [ set bx xcor set by ycor ] if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ set spawntime (spawntime - 1) if spawntime = 0 [ hatch-bugs 1 [ set shield 1 set building? 0 set health 1 set maxhealth health set speed 1 set speedmemory 1 set damage 1 set dmemory damage set shape "bug" set size 1.5 set color red set labelmemory white ] set health (health - 2) set spawntime 10 ] ] setxy bx by ] ;Pollen Flowers============================================================= ask pollen_flowers with [shade-of? color blue] [ set color 104 if ticks = 1 [ set bx xcor set by ycor ] if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ set spawntime (spawntime - 1) if spawntime = 0 [ set health (health - 1) set spawntime 10 ] create-links-to turtles with [color = red] in-radius 4.5 ask turtles with [color = red] in-radius 4.5 [ set blindtime 2 ] ] setxy bx by ] ask pollen_flowers with [shade-of? color red] [ set color 14 if ticks = 1 [ set bx xcor set by ycor ] if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ set spawntime (spawntime - 1) if spawntime = 0 [ set health (health - 1) set spawntime 10 ] create-links-to turtles with [color = blue] in-radius 4.5 ask turtles with [color = blue] in-radius 4.5 [ set blindtime 2 ] ] setxy bx by ] ;Bug Decoys============================================================ ask bug_decoys with [shade-of? color blue] [ set color 104 if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ set spawntime (spawntime - 1) if spawntime = 0 [ set health (health - 1) set spawntime 10 ] ] ] ask bug_decoys with [shade-of? color red] [ set color 14 if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ set spawntime (spawntime - 1) if spawntime = 0 [ set health (health - 1) set spawntime 10 ] ] ] ;Health Givers===================================================================== ask health_givers with [shade-of? color blue] [ face min-one-of turtles with [color = blue] [distance myself] set color 104 if ticks = 1 [ set bx xcor set by ycor ] if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ create-links-to turtles with [color = blue and health < maxhealth] in-radius 6 [ set shape "healing" set color lime ] ask turtles with [color = blue and health < maxhealth] in-radius 6 [ set health (health + 0.5) ask myself [ set health (health - 0.5) ] if health > maxhealth [ set health maxhealth ] ] ] setxy bx by ] ask health_givers with [shade-of? color red] [ face min-one-of turtles with [color = red] [distance myself] set color 14 if ticks = 1 [ set bx xcor set by ycor ] if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ create-links-to turtles with [color = red and health < maxhealth] in-radius 6 [ set shape "healing" set color lime ] ask turtles with [color = red and health < maxhealth] in-radius 6 [ set health (health + 0.5) ask myself [ set health (health - 0.5) ] if health > maxhealth [ set health maxhealth ] ] ] setxy bx by ] ;Chemical Swappers============================================================================== ask chemical_swaps with [shade-of? color blue] [ set color 104 if ticks = 1 [ set bx xcor set by ycor ] if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ if count turtles with [color = red and switching? = true] != 1 [ if any? turtles with [color = red] in-radius 9 [ ask min-one-of turtles with [color = red] in-radius 9 [distance myself] [ set switching? true ] create-links-to turtles with [color = red and switching? = true] [ set color blue set shape "chemical" ] set spawntime ([maxhealth] of one-of turtles with [color = red and switching? = true] * 3) ] ] set spawntime (spawntime - 1) if spawntime <= 0 [ ask turtles with [color = red and switching? = true] in-radius 9 [ set color blue set switching? false ask my-links with [shape = "chemical"] [ die ] ] set spawntime 0 ] ] setxy bx by ] ask chemical_swaps with [shade-of? color red] [ set color 14 if ticks = 1 [ set bx xcor set by ycor ] if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ if count turtles with [color = blue and switching? = true] != 1 [ if any? turtles with [color = blue] in-radius 9 [ ask min-one-of turtles with [color = blue] in-radius 9 [distance myself] [ set switching? true ] create-links-to turtles with [color = blue and switching? = true] [ set color red set shape "chemical" ] set spawntime ([maxhealth] of one-of turtles with [color = blue and switching? = true] * 3) ] ] set spawntime (spawntime - 1) if spawntime <= 0 [ ask turtles with [color = blue and switching? = true] in-radius 9 [ set color red set switching? false ask my-links with [shape = "chemical"] [ die ] ] set spawntime 0 ] ] setxy bx by ] ;========================================================================== ask turtles with [shape != "nest" and shape != "ant"] [ ifelse any? turtles with [(color != [color] of myself) and (shape != "nest")] in-radius 9 and (not any? nests with [nestnumber != [nestnumber] of myself] in-radius 9) [ if shape = "bug" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] if shape = "bug" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ;Bees------------------------------------------------------------------- if shape = "bee 2" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ repeat speed [ forward 1 if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - ((([damage] of myself) / ([speed] of myself)) / shield)) forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] set health (health - ((1 / speed) / shield)) ] ] ] [ forward (speed / 4) ] ] ] if shape = "bee 2" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ repeat speed [ forward 1 if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - ((([damage] of myself) / ([speed] of myself)) / shield)) forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] set health (health - ((1 / speed) / shield)) ] ] ] [ forward (speed / 4) ] ] ] ;Ants-------------------------------------------------------------------------- if shape = "ant 2" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ set damage 1 + (0.5 * (count other ants in-radius effectiverange with [color = blue])) set dmemory damage face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] if shape = "ant 2" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ set damage 1 + (0.5 * (count other ants in-radius effectiverange with [color = red])) set dmemory damage face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ;Caterpillars-------------------------------------------------------------------------------- if shape = "caterpillar" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] if shape = "caterpillar" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask (turtles in-radius 1) with [color = blue] [ set health (health - 1) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ;Butterflies----------------------------------------------------------------------- if shape = "butterfly" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ ifelse any? caterpillars with [color = blue and health < 3] [ face min-one-of caterpillars with [color = blue and health < 3] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? caterpillars with [color = blue] in-radius effectiverange [ ask caterpillars with [color = blue] in-radius effectiverange [ set health (health + 1) if health > 3 [ set health 3] ] ] ] [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ] if shape = "butterfly" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ ifelse any? caterpillars with [color = red and health < 3] [ face min-one-of caterpillars with [color = red and health < 3] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? caterpillars with [color = red] in-radius effectiverange [ ask caterpillars with [color = red] in-radius effectiverange [ set health (health + 1) if health > 3 [ set health 3] ] ] ] [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ] ;Spiders---------------------------------------------------------------------------- if shape = "spider" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ if random 20 = 1 and count (turtles-on patches with [pcolor != 109]) with [color = red] > 0 [ ask max-one-of (turtles-on patches with [pcolor != 109]) with [color = red] [distance myself] [ ask patches in-radius ([effectiverange] of myself) [ set pcolor 109 set blueweb true set sspawntime 60 ] ] ] face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 set poisoned? true if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] if shape = "spider" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ if random 20 = 1 and count (turtles-on patches with [pcolor != 19.5]) with [color = blue] > 0 [ ask max-one-of (turtles-on patches with [pcolor != 19.5]) with [color = blue] [distance myself] [ ask patches in-radius ([effectiverange] of myself) [ set pcolor 19.5 set redweb true set sspawntime 60 ] ] ] face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 set poisoned? true if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ;Moths------------------------------------------------------------------------------- if shape = "butterfly 2" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ ifelse any? butterflies with [color = red] [ face min-one-of butterflies with [color = red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (butterflies in-radius 1) with [color = red] [ ask one-of (butterflies in-radius 1) with [color = red] [ set health (health - ((([damage] of myself) * 2) / shield)) forward -2 forward -1 ] ] ] [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] if health <= 0 [ ask turtles in-radius effectiverange with [color = red and [shape] of self != "beetle"] [ set damage (damage / 2) set speed (speed / 2) set label-color (grey - 2) set labelmemory (grey - 2) set dmemory damage set speedmemory speed ] ] ] ] if shape = "butterfly 2" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ ifelse any? butterflies with [color = blue] [ face min-one-of butterflies with [color = blue] [distance myself] ifelse [BLUEWEB] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (butterflies in-radius 1) with [color = blue] [ ask one-of (butterflies in-radius 1) with [color = blue] [ set health (health - ((([damage] of myself) * 2) / shield)) forward -2 forward -1 ] ] ] [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [BLUEWEB] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] if health <= 0 [ ask turtles in-radius effectiverange with [color = blue and [shape] of self != "beetle"] [ set damage (damage / 2) set speed (speed / 2) set label-color (grey - 2) set labelmemory (grey - 2) set dmemory damage set speedmemory speed ] ] ] ] ;Dragonflies------------------------------------------------------------------------- if shape = "dragonfly" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ repeat speed [ forward 1 if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - ((([damage] of myself) / ([speed] of myself)) / shield)) forward -1 if thorns = true [ ask myself [ set health (health - (damage / 2)) ] ] ] ] ] ] [ forward (speed / 4) ] ] ] if shape = "dragonfly" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ repeat speed [ forward 1 if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - ((([damage] of myself) / ([speed] of myself)) / shield)) forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] [ forward (speed / 4) ] ] ] ;Beetles----------------------------------------------------------------------------- if shape = "beetle" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ ifelse ramming = true [ set heading facememory ] [ face min-one-of turtles with [shade-of? color red] [distance myself] ] forward speed set speed (speed + 0.25) set speedmemory speed set damage speed set dmemory damage if ([pxcor] of patch-here >= 33.9) or ([pycor] of patch-here >= -0.9) or ([pxcor] of patch-here <= 0.9) or ([pycor] of patch-here <= -45.9) and ramming = true [ set ramming false set speed 0.25 set speedmemory speed set damage speed set dmemory damage forward 0 - [damage] of self forward -1 ] if speed > 3 [ set facememory [heading] of self set ramming true ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask (turtles in-radius effectiverange) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward 0 - [damage] of myself forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] if [damage] of self > 3.5 [ forward 0 - [damage] of self forward -1 ] set speed 0.25 set speedmemory speed set damage speed set dmemory damage set ramming false ] ] ] if shape = "beetle" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ ifelse ramming = true [ set heading facememory ] [ face min-one-of turtles with [shade-of? color blue] [distance myself] ] forward speed set speed (speed + 0.25) set speedmemory speed set damage speed set dmemory damage if ([pxcor] of patch-here >= 33.9) or ([pycor] of patch-here >= -0.9) or ([pxcor] of patch-here <= 0.9) or ([pycor] of patch-here <= -45.9) and ramming = true [ set ramming false set speed 0.25 set speedmemory speed set damage speed set dmemory damage forward -2 forward -1 ] if speed > 3 [ set facememory [heading] of self set ramming true ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask (turtles in-radius effectiverange) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward 0 - [damage] of myself forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] if [damage] of self > 3.5 [ forward 0 - [damage] of self forward -1 ] set speed 0.25 set speedmemory speed set damage speed set dmemory damage set ramming false ] ] ] ;Venom Spitters------------------------------------------------------------------------------------ if shape = "venomspitter" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ ifelse any? turtles with [color = red and poisoned? = true] [ face min-one-of turtles with [color = red and poisoned? = true] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [color = red and poisoned? = true] [ ask one-of (turtles in-radius 1) with [color = red and poisoned? = true] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] [ face min-one-of turtles with [shade-of? color red] [distance myself] hatch-poisons 1 [ set label "" set rival red set color 52 set ermemory effectiverange set size 1 face min-one-of turtles with [shade-of? color red] [distance myself] ] ] ] ] if shape = "venomspitter" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ ifelse any? turtles with [color = blue and poisoned? = true] [ face min-one-of turtles with [color = blue and poisoned? = true] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [color = blue and poisoned? = true] [ ask one-of (turtles in-radius 1) with [color = blue and poisoned? = true] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] [ face min-one-of turtles with [shade-of? color blue] [distance myself] hatch-poisons 1 [ set label "" set rival blue set color 52 set ermemory effectiverange set size 1 face min-one-of turtles with [shade-of? color blue] [distance myself] ] ] ] ] ;Grasshoppers---------------------------------------------------------------------------- if shape = "grasshopper" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ ifelse [distance myself] of (min-one-of turtles with [color = red] [distance myself]) > 12 [ set speed 12 ] [ set speed speedmemory ] face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage / 2)) ] ] ] ] ] ] if shape = "grasshopper" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ ifelse [distance myself] of (min-one-of turtles with [color = blue] [distance myself]) > 12 [ set speed 12 ] [ set speed speedmemory ] face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ;Thorn Bugs--------------------------------------------------------------------------- if shape = "thornbug" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] if shape = "thornbug" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ;Mantises--------------------------------------------------------------------------------- if shape = "mantis" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [distance myself] of (min-one-of turtles with [color = red] [distance myself]) < 7 and speed < ([distance myself] of min-one-of turtles with [color = red] [distance myself]) [ set speed (speed + 1) set speedmemory speed set damage (damage + 1) set dmemory damage ] [ ifelse [redweb] of patch-here = false [ forward speed - 1 set speed 2 ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] set speed 2 set speedmemory speed set damage 1 set dmemory damage ] ] if any? turtles with [color = red and health <= 0] in-radius 3 [ ask one-of turtles with [color = red and health <= 0] in-radius 3 [ ask turtles with [color = blue] in-radius 6 [ set health health + (1 + (([maxhealth] of one-of (turtles with [color = red and health <= 0] in-radius 6) / (count turtles with [color = blue] in-radius 6)))) if health > maxhealth [ set health maxhealth ] ] ] ] ] ] if shape = "mantis" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [distance myself] of (min-one-of turtles with [color = blue] [distance myself]) < 7 and speed < ([distance myself] of min-one-of turtles with [color = blue] [distance myself]) [ set speed (speed + 1) set speedmemory speed set damage (damage + 1) set dmemory damage ] [ ifelse [blueweb] of patch-here = false [ forward speed - 1 set speed 2 ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] set speed 2 set speedmemory speed set damage 1 set dmemory damage ] ] if any? turtles with [color = blue and health <= 0] in-radius 3 [ ask one-of turtles with [color = blue and health <= 0] in-radius 3 [ ask turtles with [color = red] in-radius 6 [ set health health + (1 + (([maxhealth] of one-of (turtles with [color = blue and health <= 0] in-radius 6) / (count turtles with [color = red] in-radius 6)))) if health > maxhealth [ set health maxhealth ] ] ] ] ] ] ;Pillbug---------------------------------------------------------------------------------------------------- if shape = "pillbug" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] if shape = "pillbug" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ;Cicadas----------------------------------------------------------------------------------------------------- if shape = "cicada" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] if shape = "cicada" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ;Wasps----------------------------------------------------------------------------------------------- if shape = "wasp" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ repeat speed [ forward 1 if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - ((([damage] of myself) / ([speed] of myself)) / shield)) forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] [ forward (speed / 4) ] ] ] if shape = "wasp" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ repeat speed [ forward 1 if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - ((([damage] of myself) / ([speed] of myself)) / shield)) forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] [ forward (speed / 4) ] ] ] ;Bedbugs------------------------------------------------------------------------------------------- if shape = "bedbug" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] if shape = "bedbug" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ;Walking Sticks-------------------------------------------------------------------------------------- if shape = "walkingstick" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ ifelse any? turtles with [color = red] and (random 20 != 1) [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] [ face one-of turtles with [color = red] with-max [damage] hatch-blinds 1 [ set rival red set color brown set ermemory effectiverange set size 1 set heading [heading] of myself ] ] ] ] if shape = "walkingstick" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ ifelse any? turtles with [color = blue] and (random 20 != 1) [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] [ face one-of turtles with [color = blue] with-max [damage] hatch-blinds 1 [ set rival blue set color brown set ermemory effectiverange set size 1 set heading [heading] of myself ] ] ] ] ;Tarantula Hawks------------------------------------------------------------------------------------- if shape = "tarantulahawk" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ repeat speed [ forward 1 if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - ((([damage] of myself) / ([speed] of myself)) / shield)) if [shape] of self != "beetle" [ set poisoned? true set effectiverange 0 set ermemory 0 ] set paralyzetime (paralyzetime + 1) forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] [ forward (speed / 4) ] ] ] if shape = "tarantulahawk" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ repeat speed [ forward 1 if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - ((([damage] of myself) / ([speed] of myself)) / shield)) if [shape] of self != "beetle" [ set poisoned? true set effectiverange 0 set ermemory 0 ] set paralyzetime (paralyzetime + 1) forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] [ forward (speed / 4) ] ] ] ;Screwworms------------------------------------------------------------------------ if shape = "screwworm" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) set poisoned? true set bhost? true forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] if shape = "screwworm" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) set poisoned? true set rhost? true forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] if shape = "larvae" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ set spawntime (spawntime - 1) if spawntime <= 0 [ hatch-screwworms 1 [ set shield 1 set health 4 set maxhealth health set speed 1.5 set speedmemory 1.5 set damage 1.5 set dmemory damage set shape "screwworm" set size 3 set color blue set flying? true ] die ] face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] if shape = "larvae" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ set spawntime (spawntime - 1) if spawntime <= 0 [ hatch-screwworms 1 [ set shield 1 set health 4 set maxhealth health set speed 1.5 set speedmemory 1.5 set damage 1.5 set dmemory damage set shape "screwworm" set size 3 set color red set flying? true ] die ] face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ;Termites------------------------------------------------------------------------------------- if shape = "termite" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] if ((not any? patches with ([nobody = true]) in-radius 3) and (any? (turtles-on patch-ahead 2) with [color = red]) and (not any? (patches with [pcolor = black]) in-radius 3)) [ ask patch-ahead 3 [ ask patches in-radius 1 with [center? = true] [ ask patches in-radius 1.5 [ set pcolor black ] ] ] ] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ ifelse building? != true [ set health (health - (([damage] of myself) / shield)) ] [ set health (health - ((([damage] of myself) / shield)) * 4) ] forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] if shape = "termite" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] if ((not any? patches with ([nobody = true]) in-radius 3) and (any? (turtles-on patch-ahead 2) with [color = blue]) and (not any? (patches with [pcolor = black]) in-radius 3)) [ ask patch-ahead 3 [ ask patches in-radius 1 with [center? = true] [ ask patches in-radius 1.5 [ set pcolor black ] ] ] ] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ ifelse building? != true [ set health (health - (([damage] of myself) / shield)) ] [ set health (health - ((([damage] of myself) / shield)) * 4) ] forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ;------------ ] [ ;================= if any? nests with [nestnumber != [nestnumber] of myself] in-radius 4 [ ask nests with [nestnumber != [nestnumber] of myself] [ set health (health - [damage] of myself) ] ask self [ forward 0 - speed forward -1 if shape = "mantis" [ set speed 2 set speedmemory speed set damage 1 set dmemory damage ] if shape = "beetle" [ set speed 0.25 set speedmemory speed set damage speed set dmemory damage set ramming false ] ] ] if [color] of self = blue [ face one-of nests with [color = 13] ] if [color] of self = red [ face one-of nests with [color = 103] ] ifelse shape != "mantis" [ forward speed ] [ forward speed - 1 ] ] ] ;Grasshoppers---------- ask grasshoppers [ ifelse not any? turtles with [shade-of? [color] of self [color] of myself = false] in-radius 9 [ set speed 12 ] [ set speed speedmemory ] ] ;Spiders-------------------- ask spiders with [color = blue] [ if random 20 = 1 and count (turtles-on patches with [pcolor != 109]) with [color = red] > 0 [ ask max-one-of (turtles-on patches with [pcolor != 109]) with [color = red] [distance myself] [ ask patches in-radius ([effectiverange] of myself) [ set pcolor 109 set blueweb true set sspawntime 60 ] ] ] ] ask spiders with [color = red] [ if random 20 = 1 and count (turtles-on patches with [pcolor != 19.5]) with [color = blue] > 0 [ ask max-one-of (turtles-on patches with [pcolor != 19.5]) with [color = blue] [distance myself] [ ask patches in-radius ([effectiverange] of myself) [ set pcolor 19.5 set redweb true set sspawntime 60 ] ] ] ] ;Venom Spitters--- ask venomspitters with [color = blue] [ if count turtles with [color = red and poisoned? = true] = 0 [ if count turtles with [color = red] >= 1 [ face min-one-of turtles with [shade-of? color red] [distance myself] hatch-poisons 1 [ set label "" set rival red set color 52 set ermemory effectiverange set size 1 face min-one-of turtles with [shade-of? color red] [distance myself] ] ] ] ] ask venomspitters with [color = red] [ if count turtles with [color = blue and poisoned? = true] = 0 [ if count turtles with [color = blue] >= 1 [ face min-one-of turtles with [shade-of? color blue] [distance myself] hatch-poisons 1 [ set label "" set rival blue set color 52 set ermemory effectiverange set size 1 face min-one-of turtles with [shade-of? color blue] [distance myself] ] ] ] ] ;Beetles---------- ask beetles [ set speed (speed + 0.25) set speedmemory speed set damage speed set dmemory damage if speed > 3 [ set facememory [heading] of self set ramming true ] ] ;Walking Stick---- ask stickbug with [color = blue] [ if random 20 = 1 and (count turtles with [color = red] > 0) [ face one-of turtles with [color = red] with-max [damage] hatch-blinds 1 [ set rival red set color brown set ermemory effectiverange set size 1 set heading [heading] of myself ] ] ] ask stickbug with [color = red] [ if random 20 = 1 and (count turtles with [color = red] > 0) [ face one-of turtles with [color = blue] with-max [damage] hatch-blinds 1 [ set rival blue set color brown set ermemory effectiverange set size 1 set heading [heading] of myself ] ] ] ask larvaes with [color = blue] [ set spawntime (spawntime - 1) if spawntime <= 0 [ hatch-screwworms 1 [ set shield 1 set health 4 set maxhealth health set speed 1.5 set speedmemory 1.5 set damage 1.5 set dmemory damage set shape "screwworm" set size 2.5 set color blue set flying? true ] die ] ] ask larvaes with [color = red] [ set spawntime (spawntime - 1) if spawntime <= 0 [ hatch-screwworms 1 [ set shield 1 set health 4 set maxhealth health set speed 1.5 set speedmemory 1.5 set damage 1.5 set dmemory damage set shape "screwworm" set size 2.5 set color red set flying? true ] die ] ] ;================= ] ask turtles with [blindtime > 0] [ left random 90 right random 90 forward speed set blindtime (blindtime - 1) ] ask turtles with [paralyzetime > 0] [ set paralyzetime (paralyzetime - 1) ] ask turtles with [(patch-ahead speed = nobody) or ([pcolor] of (patch-ahead speed) = black) and (color = blue) and flying? = false] [ right 135 forward speed ] ask turtles with [(patch-ahead speed = nobody) or ([pcolor] of (patch-ahead speed) = black) and (color = red) and flying? = false] [ left 135 forward speed ] ask turtles with [shape != "nest"] [ if (health <= 0) [ ask nests with [nestnumber = [nestnumber] of myself] [ ifelse count turtles with [recovering? = true and nestnumber = [nestnumber] of myself] = 0 [ ask myself [ setxy ([xcor] of one-of nests with [nestnumber = [nestnumber] of myself]) ([ycor] of one-of nests with [nestnumber = [nestnumber] of myself]) set paralyzetime 10 set recovering? true ] ] [ ask myself [ if bhost? = true [ hatch-larvaes 1 [ set shield 1 set health 1.5 set maxhealth health set speed 1 set speedmemory 1 set damage 1 set dmemory damage set shape "larvae" set size 2 set color blue set poisoned? false set label-color white set labelmemory white set poisoned? false set flying? true set spawntime 20 set bhost? false ] ] if rhost? = true [ hatch-larvaes 1 [ set shield 1 set health 1.5 set maxhealth health set speed 1 set speedmemory 1 set damage 1 set dmemory damage set shape "larvae" set size 2 set color red set poisoned? false set label-color white set labelmemory white set poisoned? false set flying? true set spawntime 20 set bhost? false ] ] die ] ] ] ] ] ask nests [ if health <= 0 [ die ] ] ] [ if count nests with [color = 13] = 0 [ print "BLUE WINS" stop ] if count nests with [color = 103] = 0 [ print "RED WINS" stop ] ] ] ;===================================================================================== ;=================================ENERGY BUGS========================================= ;===================================================================================== if gamemode = 2 [ ask points with [color = blue] [ set color violet ] ask points with [color = red] [ set color orange ] ;Bugs Nest============================================== ask bugs_nests with [shade-of? color blue] [ set color 104 if ticks = 1 [ set bx xcor set by ycor ] if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ set spawntime (spawntime - 1) if spawntime = 0 [ hatch-bugs 1 [ set shield 1 set building? 0 set health 1 set maxhealth health set speed 1 set speedmemory 1 set damage 1 set dmemory damage set shape "bug" set size 1.5 set color blue set label "" set labelmemory white set building? 0 ] set health (health - 2) set spawntime 10 ] ] setxy bx by ] ask bugs_nests with [shade-of? color red] [ set color 14 if ticks = 1 [ set bx xcor set by ycor ] if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ set spawntime (spawntime - 1) if spawntime = 0 [ hatch-bugs 1 [ set shield 1 set building? 0 set health 1 set maxhealth health set speed 1 set speedmemory 1 set damage 1 set dmemory damage set shape "bug" set size 1.5 set color red set label "" set labelmemory white set building? 0 ] set health (health - 2) set spawntime 10 ] ] setxy bx by ] ;Pollen Flowers============================================================= ask pollen_flowers with [shade-of? color blue] [ set color 104 if ticks = 1 [ set bx xcor set by ycor ] if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ set spawntime (spawntime - 1) if spawntime = 0 [ set health (health - 1) set spawntime 10 ] create-links-to turtles with [color = red] in-radius 4.5 ask turtles with [color = red] in-radius 4.5 [ set blindtime 2 ] ] setxy bx by ] ask pollen_flowers with [shade-of? color red] [ set color 14 if ticks = 1 [ set bx xcor set by ycor ] if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ set spawntime (spawntime - 1) if spawntime = 0 [ set health (health - 1) set spawntime 10 ] create-links-to turtles with [color = blue] in-radius 4.5 ask turtles with [color = blue] in-radius 4.5 [ set blindtime 2 ] ] setxy bx by ] ;Bug Decoys============================================================ ask bug_decoys with [shade-of? color blue] [ set color 104 if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ set spawntime (spawntime - 1) if spawntime = 0 [ set health (health - 1) set spawntime 10 ] ] ] ask bug_decoys with [shade-of? color red] [ set color 14 if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ set spawntime (spawntime - 1) if spawntime = 0 [ set health (health - 1) set spawntime 10 ] ] ] ;Health Givers===================================================================== ask health_givers with [shade-of? color blue] [ if count turtles with [color = blue] > 0 [ face min-one-of turtles with [color = blue] [distance myself] ] set color 104 if ticks = 1 [ set bx xcor set by ycor ] if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ create-links-to turtles with [color = blue and health < maxhealth] in-radius 6 [ set shape "healing" set color lime ] ask turtles with [color = blue and health < maxhealth] in-radius 6 [ set health (health + 0.5) ask myself [ set health (health - 0.5) ] if health > maxhealth [ set health maxhealth ] ] ] setxy bx by ] ask health_givers with [shade-of? color red] [ if count turtles with [color = red] > 0 [ face min-one-of turtles with [color = red] [distance myself] ] set color 14 if ticks = 1 [ set bx xcor set by ycor ] if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ create-links-to turtles with [color = red and health < maxhealth] in-radius 6 [ set shape "healing" set color lime ] ask turtles with [color = red and health < maxhealth] in-radius 6 [ set health (health + 0.5) ask myself [ set health (health - 0.5) ] if health > maxhealth [ set health maxhealth ] ] ] setxy bx by ] ;Chemical Swappers============================================================================== ask chemical_swaps with [shade-of? color blue] [ set color 104 if ticks = 1 [ set bx xcor set by ycor ] if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ if count turtles with [color = red and switching? = true] != 1 [ if any? turtles with [color = red] in-radius 9 [ ask min-one-of turtles with [color = red] in-radius 9 [distance myself] [ set switching? true ] create-links-to turtles with [color = red and switching? = true] [ set color blue set shape "chemical" ] set spawntime ([maxhealth] of one-of turtles with [color = red and switching? = true] * 3) ] ] set spawntime (spawntime - 1) if spawntime <= 0 [ ask turtles with [color = red and switching? = true] in-radius 9 [ set color blue set switching? false ask my-links with [shape = "chemical"] [ die ] ] set spawntime 0 ] ] setxy bx by ] ask chemical_swaps with [shade-of? color red] [ set color 14 if ticks = 1 [ set bx xcor set by ycor ] if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ if count turtles with [color = blue and switching? = true] != 1 [ if any? turtles with [color = blue] in-radius 9 [ ask min-one-of turtles with [color = blue] in-radius 9 [distance myself] [ set switching? true ] create-links-to turtles with [color = blue and switching? = true] [ set color red set shape "chemical" ] set spawntime ([maxhealth] of one-of turtles with [color = blue and switching? = true] * 3) ] ] set spawntime (spawntime - 1) if spawntime <= 0 [ ask turtles with [color = blue and switching? = true] in-radius 9 [ set color red set switching? false ask my-links with [shape = "chemical"] [ die ] ] set spawntime 0 ] ] setxy bx by ] ;========================================================================== ;GAMEMODE CONSTANTS================================================================================================ ask patches with [(plabel != "") and ((rselected?? = true) or (bselected?? = true))] [ set plabel-color black ] ask patches with [(plabel != "") and ((rselected?? != true) and (bselected?? != true))] [ set plabel-color white ] ifelse (count points with [color = violet] > 0) and (count points with [color = orange] > 0) and gamemode = 2 [ set rgen (rgen - 1) set bgen (bgen - 1) if rgen <= 0 [ repeat (count points with [color = orange]) [ set rbudget (rbudget + 1) ] set rgen 12 ] if bgen <= 0 [ repeat (count points with [color = violet]) [ set bbudget (bbudget + 1) ] set bgen 12 ] ask points with [color = violet] [ if any? turtles with [color = red] in-radius 1 [ set spawntime (spawntime - 1) ] if spawntime <= 0 [ die ] set label precision spawntime 1 ] ask points with [color = orange] [ if any? turtles with [color = blue] in-radius 1 [ set spawntime (spawntime - 1) ] if spawntime <= 0 [ die ] set label precision spawntime 1 ] ask turtles with [blindtime > 0] [ left random 90 right random 90 forward speed set blindtime (blindtime - 1) ] ask turtles with [paralyzetime > 0] [ set paralyzetime (paralyzetime - 1) ] ask turtles with [(patch-ahead speed = nobody) or ([pcolor] of (patch-ahead speed) = black) and (color = blue) and flying? = false] [ right 135 forward speed ] ask turtles with [(patch-ahead speed = nobody) or ([pcolor] of (patch-ahead speed) = black) and (color = red) and flying? = false] [ left 135 forward speed ] ask turtles with [health <= 0] [ if bhost? = true [ hatch-larvaes 1 [ set shield 1 set health 1.5 set maxhealth health set speed 1 set speedmemory 1 set damage 1 set dmemory damage set shape "larvae" set size 2 set color blue set label-color white set labelmemory white set poisoned? false set flying? true set spawntime 20 set bhost? false ] ] if rhost? = true [ hatch-larvaes 1 [ set shield 1 set health 1.5 set maxhealth health set speed 1 set speedmemory 1 set damage 1 set dmemory damage set shape "larvae" set size 2 set color red set label-color white set labelmemory white set poisoned? false set flying? true set spawntime 20 set rhost? false ] ] die ] ;=================================================================================================================== ask turtles with [(building? != true) and (shape != "energybug")] [ ifelse not any? turtles with [(shade-of? color ([color] of myself) = false) and shape != "energybug"] in-radius 9 [ ifelse not any? (points-on patch-here) with [(color != ([color] of myself + 10))] [ if blindtime = 0 and paralyzetime = 0 [ if count points with [(color != ([color] of myself + 10))] > 0 [ face min-one-of points with [(color != ([color] of myself + 10))] [distance myself] if color = blue [ ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] ] if color = red [ ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] ] ;Grasshoppers---------- if shape = "grasshopper" [ ifelse not any? turtles with [shade-of? [color] of self [color] of myself = false] in-radius 9 [ set speed 12 ] [ set speed speedmemory ] ] ;Spiders-------------------- if shape = "spider" and color = blue [ if random 20 = 1 and count (turtles-on patches with [pcolor != 109]) with [color = red] > 0 [ ask max-one-of (turtles-on patches with [pcolor != 109]) with [color = red] [distance myself] [ ask patches in-radius ([effectiverange] of myself) [ set pcolor 109 set blueweb true set sspawntime 60 ] ] ] ] if shape = "spider" and color = red [ if random 20 = 1 and count (turtles-on patches with [pcolor != 19.5]) with [color = blue] > 0 [ ask max-one-of (turtles-on patches with [pcolor != 19.5]) with [color = blue] [distance myself] [ ask patches in-radius ([effectiverange] of myself) [ set pcolor 19.5 set redweb true set sspawntime 60 ] ] ] ] ;Venom Spitters--- if shape = "venomspitter" and color = blue [ if count turtles with [color = red and poisoned? = true] = 0 [ if count turtles with [color = red] >= 1 [ face min-one-of turtles with [shade-of? color red] [distance myself] hatch-poisons 1 [ set label "" set rival red set color 52 set ermemory effectiverange set size 1 face min-one-of turtles with [shade-of? color red] [distance myself] ] ] ] ] if shape = "venomspitter" and color = red [ if count turtles with [color = blue and poisoned? = true] = 0 [ if count turtles with [color = blue] >= 1 [ face min-one-of turtles with [shade-of? color blue] [distance myself] hatch-poisons 1 [ set label "" set rival blue set color 52 set ermemory effectiverange set size 1 face min-one-of turtles with [shade-of? color blue] [distance myself] ] ] ] ] ;Beetles---------- if shape = "beetle" [ set speed (speed + 0.25) set speedmemory speed set damage speed set dmemory damage if speed > 3 [ set facememory [heading] of self set ramming true ] ] ;Walking Stick---- if shape = "stickbug" and color = blue [ if random 20 = 1 and (count turtles with [color = red] > 0) [ face one-of turtles with [color = red] with-max [damage] hatch-blinds 1 [ set rival red set color brown set ermemory effectiverange set size 1 set heading [heading] of myself ] ] ] if shape = "stickbug" and color = red [ if random 20 = 1 and (count turtles with [color = red] > 0) [ face one-of turtles with [color = blue] with-max [damage] hatch-blinds 1 [ set rival blue set color brown set ermemory effectiverange set size 1 set heading [heading] of myself ] ] ] ;Larvae---------- if shape = "larvae" and color = blue [ set spawntime (spawntime - 1) if spawntime <= 0 [ hatch-screwworms 1 [ set shield 1 set health 4 set maxhealth health set speed 1.5 set speedmemory 1.5 set damage 1.5 set dmemory damage set shape "screwworm" set size 2.5 set color blue set flying? true ] die ] ] if shape = "larvae" and color = red [ set spawntime (spawntime - 1) if spawntime <= 0 [ hatch-screwworms 1 [ set shield 1 set health 4 set maxhealth health set speed 1.5 set speedmemory 1.5 set damage 1.5 set dmemory damage set shape "screwworm" set size 2.5 set color red set flying? true ] die ] ] ] ] ] [ ] ] [ ifelse not any? (points-on patch-here) with [(color != ([color] of myself + 10))] [ if shape = "bug" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] if shape = "bug" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ;Bees------------------------------------------------------------------- if shape = "bee 2" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ repeat speed [ forward 1 if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - ((([damage] of myself) / ([speed] of myself)) / shield)) forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] set health (health - ((1 / speed) / shield)) ] ] ] [ forward (speed / 4) ] ] ] if shape = "bee 2" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ repeat speed [ forward 1 if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - ((([damage] of myself) / ([speed] of myself)) / shield)) forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] set health (health - ((1 / speed) / shield)) ] ] ] [ forward (speed / 4) ] ] ] ;Ants-------------------------------------------------------------------------- if shape = "ant 2" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ set damage 1 + (0.5 * (count other ants in-radius effectiverange with [color = blue])) set dmemory damage face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] if shape = "ant 2" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ set damage 1 + (0.5 * (count other ants in-radius effectiverange with [color = red])) set dmemory damage face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ;Caterpillars-------------------------------------------------------------------------------- if shape = "caterpillar" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] if shape = "caterpillar" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask (turtles in-radius 1) with [color = blue] [ set health (health - ([damage] of myself)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ;Butterflies----------------------------------------------------------------------- if shape = "butterfly" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ ifelse any? caterpillars with [color = blue and health < 3] [ face min-one-of caterpillars with [color = blue and health < 3] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? caterpillars with [color = blue] in-radius effectiverange [ ask caterpillars with [color = blue] in-radius effectiverange [ set health (health + 1) if health > 3 [ set health 3] ] ] ] [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ] if shape = "butterfly" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ ifelse any? caterpillars with [color = red and health < 3] [ face min-one-of caterpillars with [color = red and health < 3] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? caterpillars with [color = red] in-radius effectiverange [ ask caterpillars with [color = red] in-radius effectiverange [ set health (health + 1) if health > 3 [ set health 3] ] ] ] [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ] ;Spiders---------------------------------------------------------------------------- if shape = "spider" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ if random 20 = 1 and count (turtles-on patches with [pcolor != 109]) with [color = red] > 0 [ ask max-one-of (turtles-on patches with [pcolor != 109]) with [color = red] [distance myself] [ ask patches in-radius ([effectiverange] of myself) [ set pcolor 109 set blueweb true set sspawntime 60 ] ] ] face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 set poisoned? true if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] if shape = "spider" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ if random 20 = 1 and count (turtles-on patches with [pcolor != 19.5]) with [color = blue] > 0 [ ask max-one-of (turtles-on patches with [pcolor != 19.5]) with [color = blue] [distance myself] [ ask patches in-radius ([effectiverange] of myself) [ set pcolor 19.5 set redweb true set sspawntime 60 ] ] ] face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 set poisoned? true if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ;Moths------------------------------------------------------------------------------- if shape = "butterfly 2" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ ifelse any? butterflies with [color = red] [ face min-one-of butterflies with [color = red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (butterflies in-radius 1) with [color = red] [ ask one-of (butterflies in-radius 1) with [color = red] [ set health (health - ((([damage] of myself) * 2) / shield)) forward -2 forward -1 ] ] ] [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] if health <= 0 [ ask turtles in-radius effectiverange with [color = red and [shape] of self != "beetle"] [ set damage (damage / 2) set dmemory damage set speed (speed / 2) set speedmemory speed set label-color (grey - 2) set labelmemory (grey - 2) set dmemory damage set speedmemory speed ] ] ] ] if shape = "butterfly 2" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ ifelse any? butterflies with [color = blue] [ face min-one-of butterflies with [color = blue] [distance myself] ifelse [BLUEWEB] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (butterflies in-radius 1) with [color = blue] [ ask one-of (butterflies in-radius 1) with [color = blue] [ set health (health - ((([damage] of myself) * 2) / shield)) forward -2 forward -1 ] ] ] [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [BLUEWEB] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] if health <= 0 [ ask turtles in-radius effectiverange with [color = blue and [shape] of self != "beetle"] [ set damage (damage / 2) set dmemory damage set speed (speed / 2) set speedmemory speed set label-color (grey - 2) set labelmemory (grey - 2) set dmemory damage set speedmemory speed ] ] ] ] ;Dragonflies------------------------------------------------------------------------- if shape = "dragonfly" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ repeat speed [ forward 1 if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - ((([damage] of myself) / ([speed] of myself)) / shield)) forward -1 if thorns = true [ ask myself [ set health (health - (damage / 2)) ] ] ] ] ] ] [ forward (speed / 4) ] ] ] if shape = "dragonfly" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ repeat speed [ forward 1 if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - ((([damage] of myself) / ([speed] of myself)) / shield)) forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] [ forward (speed / 4) ] ] ] ;Beetles----------------------------------------------------------------------------- if shape = "beetle" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ ifelse ramming = true [ set heading facememory ] [ face min-one-of turtles with [shade-of? color red] [distance myself] ] forward speed set speed (speed + 0.25) set speedmemory speed set damage speed set dmemory damage if ([pxcor] of patch-here >= 33.9) or ([pycor] of patch-here >= -0.9) or ([pxcor] of patch-here <= 0.9) or ([pycor] of patch-here <= -45.9) and ramming = true [ set ramming false set speed 0.25 set speedmemory speed set damage speed set dmemory damage forward 0 - [damage] of self forward -1 ] if speed > 3 [ set facememory [heading] of self set ramming true ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask (turtles in-radius effectiverange) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward 0 - [damage] of myself forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] if [damage] of self > 3.5 [ forward 0 - [damage] of self forward -1 ] set speed 0.25 set speedmemory speed set damage speed set dmemory damage set ramming false ] ] ] if shape = "beetle" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ ifelse ramming = true [ set heading facememory ] [ face min-one-of turtles with [shade-of? color blue] [distance myself] ] forward speed set speed (speed + 0.25) set speedmemory speed set damage speed set dmemory damage if ([pxcor] of patch-here >= 33.9) or ([pycor] of patch-here >= -0.9) or ([pxcor] of patch-here <= 0.9) or ([pycor] of patch-here <= -45.9) and ramming = true [ set ramming false set speed 0.25 set speedmemory speed set damage speed set dmemory damage forward -2 forward -1 ] if speed > 3 [ set facememory [heading] of self set ramming true ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask (turtles in-radius effectiverange) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward 0 - [damage] of myself forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] if [damage] of self > 3.5 [ forward 0 - [damage] of self forward -1 ] set speed 0.25 set speedmemory speed set damage speed set dmemory damage set ramming false ] ] ] ;Venom Spitters------------------------------------------------------------------------------------ if shape = "venomspitter" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ ifelse any? turtles with [color = red and poisoned? = true] [ face min-one-of turtles with [color = red and poisoned? = true] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [color = red and poisoned? = true] [ ask one-of (turtles in-radius 1) with [color = red and poisoned? = true] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] [ face min-one-of turtles with [shade-of? color red] [distance myself] hatch-poisons 1 [ set label "" set rival red set color 52 set ermemory effectiverange set size 1 face min-one-of turtles with [shade-of? color red] [distance myself] ] ] ] ] if shape = "venomspitter" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ ifelse any? turtles with [color = blue and poisoned? = true] [ face min-one-of turtles with [color = blue and poisoned? = true] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [color = blue and poisoned? = true] [ ask one-of (turtles in-radius 1) with [color = blue and poisoned? = true] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] [ face min-one-of turtles with [shade-of? color blue] [distance myself] hatch-poisons 1 [ set label "" set rival blue set color 52 set ermemory effectiverange set size 1 face min-one-of turtles with [shade-of? color blue] [distance myself] ] ] ] ] ;Grasshoppers---------------------------------------------------------------------------- if shape = "grasshopper" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ ifelse [distance myself] of (min-one-of turtles with [color = red] [distance myself]) > 12 [ set speed 12 ] [ set speed speedmemory ] face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage / 2)) ] ] ] ] ] ] if shape = "grasshopper" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ ifelse [distance myself] of (min-one-of turtles with [color = blue] [distance myself]) > 12 [ set speed 12 ] [ set speed speedmemory ] face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ;Thorn Bugs--------------------------------------------------------------------------- if shape = "thornbug" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] if shape = "thornbug" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ;Mantises--------------------------------------------------------------------------------- if shape = "mantis" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [distance myself] of (min-one-of turtles with [color = red] [distance myself]) < 7 and speed < ([distance myself] of min-one-of turtles with [color = red] [distance myself]) [ set speed (speed + 1) set speedmemory speed set damage (damage + 1) set dmemory damage ] [ ifelse [redweb] of patch-here = false [ forward speed - 1 set speed 2 ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] set speed 2 set speedmemory speed set damage 1 set dmemory damage ] ] if any? turtles with [color = red and health <= 0] in-radius 3 [ ask one-of turtles with [color = red and health <= 0] in-radius 3 [ ask turtles with [color = blue] in-radius 6 [ set health health + (1 + (([maxhealth] of one-of (turtles with [color = red and health <= 0] in-radius 6) / (count turtles with [color = blue] in-radius 6)))) if health > maxhealth [ set health maxhealth ] ] ] ] ] ] if shape = "mantis" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [distance myself] of (min-one-of turtles with [color = blue] [distance myself]) < 7 and speed < ([distance myself] of min-one-of turtles with [color = blue] [distance myself]) [ set speed (speed + 1) set speedmemory speed set damage (damage + 1) set dmemory damage ] [ ifelse [blueweb] of patch-here = false [ forward speed - 1 set speed 2 ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] set speed 2 set speedmemory speed set damage 1 set dmemory damage ] ] if any? turtles with [color = blue and health <= 0] in-radius 3 [ ask one-of turtles with [color = blue and health <= 0] in-radius 3 [ ask turtles with [color = red] in-radius 6 [ set health health + (1 + (([maxhealth] of one-of (turtles with [color = blue and health <= 0] in-radius 6) / (count turtles with [color = red] in-radius 6)))) if health > maxhealth [ set health maxhealth ] ] ] ] ] ] ;Pillbug---------------------------------------------------------------------------------------------------- if shape = "pillbug" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] if shape = "pillbug" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ;Cicadas----------------------------------------------------------------------------------------------------- if shape = "cicada" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] if shape = "cicada" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ;Wasps----------------------------------------------------------------------------------------------- if shape = "wasp" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ repeat speed [ forward 1 if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - ((([damage] of myself) / ([speed] of myself)) / shield)) forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] [ forward (speed / 4) ] ] ] if shape = "wasp" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ repeat speed [ forward 1 if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - ((([damage] of myself) / ([speed] of myself)) / shield)) forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] [ forward (speed / 4) ] ] ] ;Bedbugs------------------------------------------------------------------------------------------- if shape = "bedbug" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] if shape = "bedbug" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ;Walking Sticks-------------------------------------------------------------------------------------- if shape = "walkingstick" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ ifelse any? turtles with [color = red] and (random 15 != 1) [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] [ face one-of turtles with [color = red] with-max [damage] hatch-blinds 1 [ set rival red set color brown set ermemory effectiverange set size 1 set heading [heading] of myself ] ] ] ] if shape = "walkingstick" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ ifelse any? turtles with [color = blue] and (random 15 != 1) [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] [ face one-of turtles with [color = blue] with-max [damage] hatch-blinds 1 [ set rival blue set color brown set ermemory effectiverange set size 1 set heading [heading] of myself ] ] ] ] ;Tarantula Hawks------------------------------------------------------------------------------------- if shape = "tarantulahawk" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ repeat speed [ forward 1 if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - ((([damage] of myself) / ([speed] of myself)) / shield)) if [shape] of self != "beetle" [ set poisoned? true set effectiverange 0 set ermemory 0 ] set paralyzetime (paralyzetime + 1) forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] [ forward (speed / 4) ] ] ] if shape = "tarantulahawk" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ repeat speed [ forward 1 if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - ((([damage] of myself) / ([speed] of myself)) / shield)) if [shape] of self != "beetle" [ set poisoned? true set effectiverange 0 set ermemory 0 ] set paralyzetime (paralyzetime + 1) forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] [ forward (speed / 4) ] ] ] ;Screwworm Flies-------------------------------------------------------------------------- if shape = "screwworm" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) set poisoned? true set bhost? true forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] if shape = "screwworm" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) set poisoned? true set rhost? true forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] if shape = "larvae" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ set spawntime (spawntime - 1) if spawntime <= 0 [ hatch-screwworms 1 [ set shield 1 set health 4 set maxhealth health set speed 1.5 set speedmemory 1.5 set damage 1.5 set dmemory damage set shape "screwworm" set size 2.5 set color blue set flying? true ] die ] face min-one-of turtles with [shade-of? color red] [distance myself] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] if shape = "larvae" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ set spawntime (spawntime - 1) if spawntime <= 0 [ hatch-screwworms 1 [ set shield 1 set health 4 set maxhealth health set speed 1.5 set speedmemory 1.5 set damage 1.5 set dmemory damage set shape "screwworm" set size 2.5 set color red set flying? true ] die ] face min-one-of turtles with [shade-of? color blue] [distance myself] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ set health (health - (([damage] of myself) / shield)) forward -2 forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ;Termites------------------------------------------------------------------------------------------- if shape = "termite" and color = blue and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color red] [distance myself] if ((not any? patches with ([nobody = true]) in-radius 3) and (any? (turtles-on patch-ahead 2) with [color = red]) and (not any? (patches with [pcolor = black]) in-radius 3)) [ ask patch-ahead 3 [ ask patches in-radius 1 with [center? = true] [ ask patches in-radius 1.5 [ set pcolor black ] ] ] ] ifelse [redweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color red] [ ask one-of (turtles in-radius 1) with [shade-of? color red] [ ifelse building? != true [ set health (health - (([damage] of myself) / shield)) ] [ set health (health - ((([damage] of myself) / shield)) * 4) ] forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] if shape = "termite" and color = red and blindtime = 0 and paralyzetime = 0 and (patch-ahead speed != nobody) and ([pcolor] of (patch-ahead speed) != black) [ if count turtles with [color = red] > 0 and count turtles with [color = blue] > 0 [ face min-one-of turtles with [shade-of? color blue] [distance myself] if ((not any? patches with ([nobody = true]) in-radius 3) and (any? (turtles-on patch-ahead 2) with [color = blue]) and (not any? (patches with [pcolor = black]) in-radius 3)) [ ask patch-ahead 3 [ ask patches in-radius 1 with [center? = true] [ ask patches in-radius 1.5 [ set pcolor black ] ] ] ] ifelse [blueweb] of patch-here = false [ forward speed ] [ forward (speed / 4) ] if any? (turtles in-radius 1) with [shade-of? color blue] [ ask one-of (turtles in-radius 1) with [shade-of? color blue] [ ifelse building? != true [ set health (health - (([damage] of myself) / shield)) ] [ set health (health - ((([damage] of myself) / shield)) * 4) ] forward -1 if thorns = true [ ask myself [ set health (health - (damage * 0.75)) ] ] ] ] ] ] ;------------------------------------------------------- ] [ ] ] ] ] [ if count points with [color = orange] = 0 [ print "BLUE WINS" stop ] if count points with [color = violet] = 0 [ print "RED WINS" stop ] ] ] ] tick end
There is only one version of this model, created about 3 years ago by Israel Alderete.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Silly Bug Game.png | preview | Preview for 'Silly Bug Game' | about 3 years ago, by Israel Alderete | Download |
This model does not have any ancestors.
This model does not have any descendants.