diff --git a/code/modules/mob/living/simple_animal/hostile/mushroom.dm b/code/modules/mob/living/simple_animal/hostile/mushroom.dm index 777373763dd..80df7575956 100644 --- a/code/modules/mob/living/simple_animal/hostile/mushroom.dm +++ b/code/modules/mob/living/simple_animal/hostile/mushroom.dm @@ -1,8 +1,8 @@ /mob/living/simple_animal/hostile/mushroom name = "walking mushroom" desc = "It's a massive mushroom... with legs?" - icon_state = "mushroom" - icon_living = "mushroom" + icon_state = "mushroom_color" + icon_living = "mushroom_color" icon_dead = "mushroom_dead" speak_chance = 0 turns_per_move = 1 @@ -20,34 +20,111 @@ faction = "mushroom" environment_smash = 0 stat_attack = 2 + mouse_opacity = 1 var/powerlevel = 0 //Tracks our killcount var/bruised = 0 //If someone tries to cheat the system by attacking a shroom to lower its health, punish them so that it wont award levels to shrooms that eat it + var/recovery_cooldown = 0 //So you can't repeatedly revive it during a fight + var/faint_ticker = 0 //If we hit three, another mushroom's gonna eat us + var/cap_color = null //Holder for our unique mushroom cap color so we always keep it + +/mob/living/simple_animal/hostile/mushroom/examine() + ..() + if(health >= maxHealth) + usr << "It looks healthy." + else + usr << "It looks like it's been roughed up." + +/mob/living/simple_animal/hostile/mushroom/Life() + ..() + if(!stat)//Mushrooms slowly regenerate if conscious, for people who want to save them from being eaten + health += 2 + +/mob/living/simple_animal/hostile/mushroom/New()//Makes every shroom a little unique + melee_damage_lower = rand(3, 5) + melee_damage_upper = rand(10,20) + maxHealth = rand(40,60) + move_to_delay = rand(2,10) + cap_color = rgb(rand(0, 255), rand(0, 255), rand(0, 255)) + UpdateMushroomCap() + ..() + +/mob/living/simple_animal/hostile/mushroom/adjustBruteLoss(var/damage)//Possibility to flee from a fight just to make it more visually interesting + if(!retreat_distance && prob(33)) + retreat_distance = 5 + spawn(30) + retreat_distance = null + ..() /mob/living/simple_animal/hostile/mushroom/attack_animal(var/mob/living/L) - if(istype(L, /mob/living/simple_animal/hostile/mushroom) && stat == 2) + if(istype(L, /mob/living/simple_animal/hostile/mushroom) && stat == DEAD) var/mob/living/simple_animal/hostile/mushroom/M = L - M.visible_message("The [M.name] devours the [src.name]!") - if(!bruised) - M.LevelUp() + if(faint_ticker < 2) + M.visible_message("[M] chews a bit on [src].") + faint_ticker++ + return + M.visible_message("[M] devours [src]!") + var/level_gain = (powerlevel - M.powerlevel) + if(level_gain >= -1 && !bruised) + if(level_gain < 1)//So we still gain a level if two mushrooms were the same level + level_gain = 1 + M.LevelUp(level_gain) + M.health = M.maxHealth del(src) ..() -/mob/living/simple_animal/hostile/mushroom/proc/LevelUp() +/mob/living/simple_animal/hostile/mushroom/revive() + ..() + UpdateMushroomCap() + +/mob/living/simple_animal/hostile/mushroom/Die() + visible_message("[src] fainted.") + ..() + UpdateMushroomCap() + +/mob/living/simple_animal/hostile/mushroom/proc/UpdateMushroomCap() + overlays.Cut() + var/image/I = image('icons/mob/animal.dmi',icon_state = "mushroom_cap") + if(health == 0) + I = image('icons/mob/animal.dmi',icon_state = "mushroom_cap_dead") + I.color = cap_color + overlays += I + +/mob/living/simple_animal/hostile/mushroom/proc/Recover() + visible_message("[src] slowly begins to recover.") + health = 5 + faint_ticker = 0 + icon_state = icon_living + UpdateMushroomCap() + recovery_cooldown = 1 + spawn(300) + recovery_cooldown = 0 + +/mob/living/simple_animal/hostile/mushroom/proc/LevelUp(var/level_gain) if(powerlevel <= 9) - powerlevel += 1 - melee_damage_lower += 5 - melee_damage_upper += 5 - maxHealth += 5 - health = maxHealth + powerlevel += level_gain + if(prob(25)) + melee_damage_lower += (level_gain * rand(1,5)) + else + melee_damage_upper += (level_gain * rand(1,5)) + maxHealth += (level_gain * rand(1,5)) + health = maxHealth //They'll always heal, even if they don't gain a level, in case you want to keep this shroom around instead of harvesting it /mob/living/simple_animal/hostile/mushroom/proc/Bruise() if(!bruised && !stat) src.visible_message("The [src.name] was bruised!") bruised = 1 -/mob/living/simple_animal/hostile/mushroom/attackby(obj/item/weapon/W as obj, mob/user as mob) +/mob/living/simple_animal/hostile/mushroom/attackby(obj/item/I as obj, mob/user as mob) + if(istype(I, /obj/item/weapon/reagent_containers/food/snacks/grown/mushroom)) + if(stat == DEAD && !recovery_cooldown) + Recover() + del(I) + else + user << "[src] won't eat it!" + return + if(I.force) + Bruise() ..() - Bruise() /mob/living/simple_animal/hostile/mushroom/attack_hand(mob/living/carbon/human/M as mob) ..() @@ -61,6 +138,10 @@ if(T.throwforce) Bruise() +/mob/living/simple_animal/hostile/mushroom/bullet_act() + ..() + Bruise() + /mob/living/simple_animal/hostile/mushroom/harvest() var/counter for(counter=0, counter<=powerlevel, counter++) diff --git a/icons/mob/animal.dmi b/icons/mob/animal.dmi index ceeae46da7f..0f4a3682995 100644 Binary files a/icons/mob/animal.dmi and b/icons/mob/animal.dmi differ