# Duane's Dungeon - a rogue-like game
# Copyright (C) 2022 Duane Robertson

# mimic.gd - a monster

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty off
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.


extends Creature



var revealed := false

func set_species_attributes():
	species = 'mimic'
#	defense = {
#		weapon = 0.5,
#	}
	description = 'Mimics can change their appearance to resemble their surroundings. When their prey comes close, they attack.'
	energy_max = 15
	icon_name = 'chest'
	icon_fg = '999900'
	faction = 'ignore'
	hide_bars = true
	size = 4
	spell_chance = { chain = 3, }
	strength_max = 20 # 21 originally
	movement = 0
	name = 'mimic'
	vision = 1

	super()


func on_combat(attacker, targ) -> bool:
	var ret = super(attacker, targ)

	if not revealed:
		revealed = true

		show_bars(true)
		faction = 'mimic'
		movement = 1
		vision = 5

		var tex:ImageTexture = G.sprite_sheet.texture('mimic', '999900')
		sprite.texture = tex

	#	if ent.strength < ent.strength_max * .75 then
	#		--ent.strength =

		return ret and (targ != self)

	return ret
