< Summary

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

Feature is only available for sponsors

Upgrade to PRO version

Metrics

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

File(s)

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

#LineLine coverage
 1namespace Safarimacik.Model;
 2
 3
 4/// <summary>
 5/// Base class for regenerating plants.
 6/// </summary>
 7public abstract class RegeneratingPlant(double nutrition, int cooldown, bool isRipe) : Plant(nutrition) {
 8  public readonly int Cooldown = cooldown;
 9
 10  protected int _currentCooldown;
 11  protected bool _isRipe = isRipe;
 12
 13  public event Action? StateChanged;
 14
 15  public bool IsRipe => _isRipe;
 16
 17  public void Consume() {
 18    _isRipe = false;
 19    _currentCooldown = Cooldown;
 20    StateChanged?.Invoke();
 21  }
 22
 23  public void DecreaseCurrentCooldown() {
 24    --_currentCooldown;
 25    if (_currentCooldown == 0) {
 26      _isRipe = true;
 27      StateChanged?.Invoke();
 28    }
 29  }
 30}
 31
 32/// <summary>
 33/// Represents a regenerating, placeable
 34/// </summary>
 35public class Tree : RegeneratingPlant, Purchasable {
 36  public const int Price = 80;
 37  public new const int Cooldown = 120;
 38
 39  int Purchasable.Price => Price;
 40
 41  public Tree() : base(50, Cooldown, true) { }
 42}
 43
 44/// <summary>
 45/// Represents a regenerating, placeable
 46/// </summary>
 47public class Bush : RegeneratingPlant, Purchasable {
 48  public const int Price = 115;
 49  public new const int Cooldown = 60;
 50
 151  int Purchasable.Price => Price;
 52
 153  public Bush() : base(60, Cooldown, true) { }
 54}