diff --git a/agent.cc b/agent.cc index fefe291..a1a401f 100644 --- a/agent.cc +++ b/agent.cc @@ -191,6 +191,15 @@ spawn_herb(class tile &t) h->spawn_at(t); } +void +herb::smell_herb(class tile &t) +{ + /* Herb pheromone ("smell") #32768. */ + class pheromone p(32768, world::herb_phintensity); + t.pheromones.secrete(p); + chenergy(p.val * world::pheromone_cost); +} + void herb::on_tick(void) { @@ -204,5 +213,10 @@ herb::on_tick(void) spawn_herb(tile->tile_in_dir(0, -1)); tile->on_agent_leave(*this); tile = NULL; + } else { + smell_herb(tile->tile_in_dir(1, 0)); + smell_herb(tile->tile_in_dir(0, 1)); + smell_herb(tile->tile_in_dir(-1, 0)); + smell_herb(tile->tile_in_dir(0, -1)); } } diff --git a/agent.h b/agent.h index 5687d1f..aa59e0a 100644 --- a/agent.h +++ b/agent.h @@ -64,6 +64,8 @@ public: } void on_tick(void); +private: + void smell_herb(class tile &); }; #endif diff --git a/world.h b/world.h index a70ea18..7b8334e 100644 --- a/world.h +++ b/world.h @@ -15,13 +15,14 @@ struct world { const static int attack_idle_cost = -15; /* ... * attr.attack */ const static int defense_idle_cost = -15; /* ... * attr.defense */ const static int sun_energy = 10; - const static int soil_energy = 10; /* ... times five for lone herbs, times one for dense forests */ + const static int soil_energy = 20; /* ... times five for lone herbs, times one for dense forests */ const static int dead_body_energy = 2000; const static double dead_body_energy_carryover = 0.5; const static int dead_decay = -50; const static int herb_rate = 15; /* initially, one herb per herb_rate tiles */ + const static double herb_phintensity = 1.0; const static double phseep_alpha = 0.1; const static double phseep_beta = 0.05;