public void Reset(bool potions) { m_NextGrowth = DateTime.Now + CheckDelay; m_GrowthIndicator = PlantGrowthIndicator.None; Hits = MaxHits; m_Infestation = 0; m_Fungus = 0; m_Poison = 0; m_Disease = 0; if (potions) { m_PoisonPotion = 0; m_CurePotion = 0; m_HealPotion = 0; m_StrengthPotion = 0; } m_Pollinated = false; m_AvailableSeeds = 0; m_LeftSeeds = 8; m_AvailableResources = 0; m_LeftResources = 8; }
public PlantSystem(PlantItem plant, bool fertileDirt) { this.m_Plant = plant; this.m_FertileDirt = fertileDirt; this.m_NextGrowth = DateTime.Now + CheckDelay; this.m_GrowthIndicator = PlantGrowthIndicator.None; this.m_Hits = this.MaxHits; this.m_LeftSeeds = 8; this.m_LeftResources = 8; }
public PlantSystem(PlantItem plant, bool fertileDirt) { m_Plant = plant; m_FertileDirt = fertileDirt; m_NextGrowth = DateTime.Now + CheckDelay; m_GrowthIndicator = PlantGrowthIndicator.None; m_Hits = MaxHits; m_LeftSeeds = 8; m_LeftResources = 8; }
public PlantSystem( PlantItem plant, bool fertileDirt ) { m_Plant = plant; m_FertileDirt = fertileDirt; m_NextGrowth = Core.Now + CheckDelay; m_GrowthIndicator = PlantGrowthIndicator.None; m_Hits = MaxHits; m_LeftSeeds = 8; m_LeftResources = 8; }
public PlantSystem(PlantItem plant, GenericReader reader) { m_Plant = plant; int version = reader.ReadInt(); m_FertileDirt = reader.ReadBool(); if (version >= 1) { m_NextGrowth = reader.ReadDateTime(); } else { m_NextGrowth = reader.ReadDeltaTime(); } m_GrowthIndicator = (PlantGrowthIndicator)reader.ReadInt(); m_Water = reader.ReadInt(); m_Hits = reader.ReadInt(); m_Infestation = reader.ReadInt(); m_Fungus = reader.ReadInt(); m_Poison = reader.ReadInt(); m_Disease = reader.ReadInt(); m_PoisonPotion = reader.ReadInt(); m_CurePotion = reader.ReadInt(); m_HealPotion = reader.ReadInt(); m_StrengthPotion = reader.ReadInt(); m_Pollinated = reader.ReadBool(); m_SeedType = (PlantType)reader.ReadInt(); m_SeedHue = (PlantHue)reader.ReadInt(); m_AvailableSeeds = reader.ReadInt(); m_LeftSeeds = reader.ReadInt(); m_AvailableResources = reader.ReadInt(); m_LeftResources = reader.ReadInt(); if (version < 2 && PlantHueInfo.IsCrossable(m_SeedHue)) { m_SeedHue |= PlantHue.Reproduces; } }
private void Grow() { if (Health < PlantHealth.Healthy) { m_GrowthIndicator = PlantGrowthIndicator.NotHealthy; } else if (m_FertileDirt && m_Plant.PlantStatus <= PlantStatus.Stage5 && Utility.RandomDouble() < 0.1) { int curStage = (int)m_Plant.PlantStatus; m_Plant.PlantStatus = (PlantStatus)(curStage + 2); m_GrowthIndicator = PlantGrowthIndicator.DoubleGrown; } else if (m_Plant.PlantStatus < PlantStatus.Stage9) { int curStage = (int)m_Plant.PlantStatus; m_Plant.PlantStatus = (PlantStatus)(curStage + 1); m_GrowthIndicator = PlantGrowthIndicator.Grown; } else { if (Pollinated && LeftSeeds > 0 && m_Plant.Reproduces) { LeftSeeds--; AvailableSeeds++; } if (LeftResources > 0 && PlantResourceInfo.GetInfo(m_Plant.PlantType, m_Plant.PlantHue) != null) { LeftResources--; AvailableResources++; } m_GrowthIndicator = PlantGrowthIndicator.Grown; } if (m_Plant.PlantStatus >= PlantStatus.Stage9 && !Pollinated) { Pollinated = true; SeedType = m_Plant.PlantType; SeedHue = m_Plant.PlantHue; } }
private void Grow() { if (this.Health < PlantHealth.Healthy) { this.m_GrowthIndicator = PlantGrowthIndicator.NotHealthy; } else if (this.m_FertileDirt && this.m_Plant.PlantStatus <= PlantStatus.Stage5 && Utility.RandomDouble() < 0.1) { int curStage = (int)this.m_Plant.PlantStatus; this.m_Plant.PlantStatus = (PlantStatus)(curStage + 2); this.m_GrowthIndicator = PlantGrowthIndicator.DoubleGrown; } else if (this.m_Plant.PlantStatus < PlantStatus.Stage9) { int curStage = (int)this.m_Plant.PlantStatus; this.m_Plant.PlantStatus = (PlantStatus)(curStage + 1); this.m_GrowthIndicator = PlantGrowthIndicator.Grown; } else { if (this.Pollinated && this.LeftSeeds > 0 && this.m_Plant.IsCrossable) { this.LeftSeeds--; this.AvailableSeeds++; } if (this.LeftResources > 0 && PlantResourceInfo.GetInfo(this.m_Plant.PlantType, this.m_Plant.PlantHue) != null) { this.LeftResources--; this.AvailableResources++; } this.m_GrowthIndicator = PlantGrowthIndicator.Grown; } if (this.m_Plant.PlantStatus >= PlantStatus.Stage9 && !this.Pollinated) { this.Pollinated = true; this.SeedType = this.m_Plant.PlantType; this.SeedHue = this.m_Plant.PlantHue; } }
public void DoGrowthCheck() { if (!m_Plant.IsGrowable) { return; } if (DateTime.Now < m_NextGrowth) { m_GrowthIndicator = PlantGrowthIndicator.Delay; return; } m_NextGrowth = DateTime.Now + CheckDelay; if (!m_Plant.ValidGrowthLocation) { m_GrowthIndicator = PlantGrowthIndicator.InvalidLocation; return; } if (m_Plant.PlantStatus == PlantStatus.BowlOfDirt) { if (Water > 2 || Utility.RandomDouble() < 0.9) { Water--; } return; } ApplyBeneficEffects(); if (!ApplyMaladiesEffects()) // Dead { return; } Grow(); UpdateMaladies(); }
public PlantSystem(PlantItem plant, GenericReader reader) { this.m_Plant = plant; int version = reader.ReadInt(); this.m_FertileDirt = reader.ReadBool(); if (version >= 1) this.m_NextGrowth = reader.ReadDateTime(); else this.m_NextGrowth = reader.ReadDeltaTime(); this.m_GrowthIndicator = (PlantGrowthIndicator)reader.ReadInt(); this.m_Water = reader.ReadInt(); this.m_Hits = reader.ReadInt(); this.m_Infestation = reader.ReadInt(); this.m_Fungus = reader.ReadInt(); this.m_Poison = reader.ReadInt(); this.m_Disease = reader.ReadInt(); this.m_PoisonPotion = reader.ReadInt(); this.m_CurePotion = reader.ReadInt(); this.m_HealPotion = reader.ReadInt(); this.m_StrengthPotion = reader.ReadInt(); this.m_Pollinated = reader.ReadBool(); this.m_SeedType = (PlantType)reader.ReadInt(); this.m_SeedHue = (PlantHue)reader.ReadInt(); this.m_AvailableSeeds = reader.ReadInt(); this.m_LeftSeeds = reader.ReadInt(); this.m_AvailableResources = reader.ReadInt(); this.m_LeftResources = reader.ReadInt(); }
private void Grow() { if ( Health < PlantHealth.Healthy ) { m_GrowthIndicator = PlantGrowthIndicator.NotHealthy; } else if ( m_FertileDirt && m_Plant.PlantStatus <= PlantStatus.Stage5 && Utility.RandomDouble() < 0.1 ) { int curStage = (int)m_Plant.PlantStatus; m_Plant.PlantStatus = (PlantStatus)( curStage + 2 ); m_GrowthIndicator = PlantGrowthIndicator.DoubleGrown; } else if ( m_Plant.PlantStatus < PlantStatus.Stage9 ) { int curStage = (int)m_Plant.PlantStatus; m_Plant.PlantStatus = (PlantStatus)( curStage + 1 ); m_GrowthIndicator = PlantGrowthIndicator.Grown; } else { if ( Pollinated && LeftSeeds > 0 && m_Plant.Reproduces ) { LeftSeeds--; AvailableSeeds++; } if ( !m_Plant.MaginciaPlant && LeftResources > 0 && PlantResourceInfo.GetInfo( m_Plant.PlantType, m_Plant.PlantHue ) != null ) { LeftResources--; AvailableResources++; } m_GrowthIndicator = PlantGrowthIndicator.Grown; } if ( m_Plant.PlantStatus >= PlantStatus.Stage9 && !Pollinated && !m_Plant.MaginciaPlant ) { Pollinated = true; SeedType = m_Plant.PlantType; SeedHue = m_Plant.PlantHue; } }
public void DoGrowthCheck() { if ( !m_Plant.IsGrowable ) return; if ( DateTime.UtcNow < m_NextGrowth ) { m_GrowthIndicator = PlantGrowthIndicator.Delay; return; } m_NextGrowth = DateTime.UtcNow + CheckDelay; if ( !m_Plant.ValidGrowthLocation ) { m_GrowthIndicator = PlantGrowthIndicator.InvalidLocation; return; } if ( m_Plant.PlantStatus == PlantStatus.BowlOfDirt) { if ( Water > 2 || Utility.RandomDouble() < 0.9 ) Water--; return; } ApplyBeneficEffects(); if ( !ApplyMaladiesEffects() ) // Dead return; Grow(); UpdateMaladies(); }
public void Reset( bool potions ) { m_NextGrowth = DateTime.UtcNow + CheckDelay; m_GrowthIndicator = PlantGrowthIndicator.None; Hits = MaxHits; m_Infestation = 0; m_Fungus = 0; m_Poison = 0; m_Disease = 0; if ( potions ) { m_PoisonPotion = 0; m_CurePotion = 0; m_HealPotion = 0; m_StrengthPotion = 0; } m_Pollinated = false; m_AvailableSeeds = 0; m_LeftSeeds = 8; m_AvailableResources = 0; m_LeftResources = 8; }