<gh_stars>1-10
from Target import Target
import numpy as np
import World


class Deer(Target):
    viremicspan = 40  # Length in days that the deer will remain viremic

    def __init__(self, unique_id, model):
        super().__init__(unique_id, model)
        self.hasbtv = False
        self.isimmune = False
        self.viremiccounter = 0
        self.numbites = 0

    def isbitten(self, midge) -> None:
        if midge.hasbtv:
            self.hasbtv = True
        elif self.hasbtv and not midge.hasbtv:
            midge.btvincubating = True

        self.numbites += 1

    def feed(self, midge) -> None:
        self.isbitten(midge)
        midge.fed = True
        midge.timesincefed = 0

    def move(self) -> None:
        # Select a random location in the region
        x = np.random.randint(0, self.model.grid.width)
        y = np.random.randint(0, self.model.grid.height)

        # Moves the deer to a new location as long as it is not water
        if self.model.maparray[x][y].biomecode == 4:
            self.move()
            return
        else:
            self.model.grid.move_agent(self, (x, y))
            return

    def step(self) -> None:
        if self.hasbtv:
            if self.viremiccounter >= Deer.viremicspan:
                self.hasbtv = False
                self.isimmune = True
            else:
                self.viremiccounter += 1

        self.move()

        # print("By day " + str(self.model.day) + ", deer " + str(self.unique_id) + " was bitten " + str(self.numbites) + " times.")
        return

from Target import Target
import numpy as np
import World


class Deer(Target):
    viremicspan = 40  # Length in days that the deer will remain viremic

    def __init__(self, unique_id, model):
        super().__init__(unique_id, model)
        self.hasbtv = False
        self.isimmune = False
        self.viremiccounter = 0
        self.numbites = 0

    def isbitten(self, midge) -> None:
        if midge.hasbtv:
            self.hasbtv = True
        elif self.hasbtv and not midge.hasbtv:
            midge.btvincubating = True

        self.numbites += 1

    def feed(self, midge) -> None:
        self.isbitten(midge)
        midge.fed = True
        midge.timesincefed = 0

    def move(self) -> None:
        # Select a random location in the region
        x = np.random.randint(0, self.model.grid.width)
        y = np.random.randint(0, self.model.grid.height)

        # Moves the deer to a new location as long as it is not water
        if self.model.maparray[x][y].biomecode == 4:
            self.move()
            return
        else:
            self.model.grid.move_agent(self, (x, y))
            return

    def step(self) -> None:
        if self.hasbtv:
            if self.viremiccounter >= Deer.viremicspan:
                self.hasbtv = False
                self.isimmune = True
            else:
                self.viremiccounter += 1

        self.move()

        # print("By day " + str(self.model.day) + ", deer " + str(self.unique_id) + " was bitten " + str(self.numbites) + " times.")
        return
# Length in days that the deer will remain viremic # Select a random location in the region # Moves the deer to a new location as long as it is not water # print("By day " + str(self.model.day) + ", deer " + str(self.unique_id) + " was bitten " + str(self.numbites) + " times.")