< Summary

Information
Class: Safarimacik.Model.Wolf
Assembly: Safarimacik
File(s): /builds/szofttech-ab-2025/group-03/safarimacik/model/Predator.cs
Line coverage
100%
Covered lines: 12
Uncovered lines: 0
Coverable lines: 12
Total lines: 52
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
Safarimacik.Model.Purchasable.get_Price()100%11100%
Mate()100%22100%
Crave()100%11100%

File(s)

/builds/szofttech-ab-2025/group-03/safarimacik/model/Predator.cs

#LineLine coverage
 1using Godot;
 2
 3
 4namespace Safarimacik.Model;
 5
 6
 7/// <summary>
 8/// Base class for predator animals.
 9/// </summary>
 10public abstract class Predator(Vector2 position) : Animal(position) { }
 11
 12/// <summary>
 13/// A predator animal.
 14/// </summary>
 115public class Wolf(Vector2 position) : Predator(position), Purchasable {
 16  public const int Price = 14;
 17
 118  int Purchasable.Price => Price;
 19
 120  public override void Mate() {
 121    base.Mate();
 122    if (!_sex) { // is female
 123      OnOffspringSpawned(new Wolf(Position));
 124    }
 125  }
 26
 127  public override void Crave() {
 128    _hunger -= Math.Sqrt(_age) * 0.02 + 0.05;
 129    _thirst -= Math.Sqrt(_age) * 0.005 + 0.05;
 130  }
 31}
 32
 33/// <summary>
 34/// A predator animal.
 35/// </summary>
 36public class Fox(Vector2 position) : Predator(position), Purchasable {
 37  public const int Price = 20;
 38
 39  int Purchasable.Price => Price;
 40
 41  public override void Mate() {
 42    base.Mate();
 43    if (!_sex) { // is female
 44      OnOffspringSpawned(new Fox(Position));
 45    }
 46  }
 47
 48  public override void Crave() {
 49    _hunger -= Math.Sqrt(_age) * 0.02 + 0.1;
 50    _thirst -= Math.Sqrt(_age) * 0.005;
 51  }
 52}