Skip to content

Commit

Permalink
Merge pull request #2198 from Lixxis/release-0.11.0
Browse files Browse the repository at this point in the history
Bugfixes: FKP
  • Loading branch information
archanyhm authored Apr 6, 2024
2 parents c283572 + b1f7253 commit 140fc20
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<strong>TBD</strong>
- Fix: ensure that the changelog is read as UTF-8

<strong>v0.11.2</strong>
- Fix: issue with manual feeding with tactic "low nutrition first"
- Fix: edge case of a cat has the exiled status, but is not outside

<strong>v0.11.1</strong>
- Fix: The changelog. Yep, just the changelog. Yes, it happened again-

Expand Down
14 changes: 11 additions & 3 deletions scripts/clan_resources/freshkill.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,21 +128,25 @@ def _update_needed_food(self, living_cats: List[Cat]) -> None:
# kits under 3 months are feed by the queen
for queen_id, their_kits in queen_dict.items():
queen = Cat.fetch_cat(queen_id)
if queen and (queen.outside or queen.status == "exiled"):
continue
young_kits = [kit for kit in their_kits if kit.moons < 3]
if len(young_kits) > 0:
relevant_queens.append(queen)
pregnant_cats = [cat for cat in living_cats if "pregnant" in cat.injuries and cat.ID not in queen_dict.keys()]
pregnant_cats = [
cat for cat in living_cats if "pregnant" in cat.injuries and cat.ID not in queen_dict.keys() and not cat.outside and cat.status != "exiled"
]

# all normal status cats calculation
needed_prey = sum([PREY_REQUIREMENT[cat.status] for cat in living_cats if cat.status not in ["newborn", "kitten"]])
needed_prey = sum([PREY_REQUIREMENT[cat.status] for cat in living_cats if cat.status not in ["newborn", "kitten", "exiled"] and not cat.outside])
# increase the number for sick cats
if game.clan and game.clan.game_mode == "cruel season":
sick_cats = [cat for cat in living_cats if cat.not_working() and "pregnant" not in cat.injuries]
needed_prey += len(sick_cats) * CONDITION_INCREASE
# increase the number of prey which are missing for relevant queens an pregnant cats
needed_prey += (len(relevant_queens) + len(pregnant_cats)) * (PREY_REQUIREMENT["queen/pregnant"] - PREY_REQUIREMENT["warrior"])
# increase the number of prey for kits, which are not taken care by a queen
needed_prey += sum([PREY_REQUIREMENT[cat.status] for cat in living_kits])
needed_prey += sum([PREY_REQUIREMENT[cat.status] for cat in living_kits if not cat.outside])

self.needed_prey = needed_prey

Expand Down Expand Up @@ -364,6 +368,10 @@ def tactic_less_nutrition_first(self, living_cats: List[Cat], not_moon_feeding =
feeding_amount += 1
elif self.amount_food_needed() < self.total_amount and self.nutrition_info[cat.ID].percentage < 100:
feeding_amount += 0.5

if not_moon_feeding:
needed_amount = 0

self.feed_cat(cat, feeding_amount, needed_amount)

# feed the rest according to their status
Expand Down

0 comments on commit 140fc20

Please sign in to comment.