# Duane's Dungeon - a rogue-like game # Copyright (C) 2022 Duane Robertson # mummy.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 of # 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 . extends Creature enum { CURSE_SUFFERING, CURSE_AMNESIA, CURSE_POVERTY, } func set_species_attributes(): species = 'mummy' defense = { freeze = 0, ice_spear = 0.5, fire_breath = 1.5, fireburst = 1.5, flame_breath = 1.5, weapon = 0.9, } description = 'Mummies are the strong, undead remains of deceased royalty. They frequently curse anyone who dares to disturb them.' energy_max = 17 extra_level = 1.0 icon_name = 'mummy' icon_fg = 'c1a889' spell_chance = { curse = 4, } strength_max = 18 unliving = true super() func die(killer=null) -> void: if not (killer and killer.is_in_group('entities')): return var ddie = 150 * level var lvl = killer.level if killer.is_in_group('player'): lvl = map.level ddie *= killer.get_gear_defense('magic') if ddie < 2 or lvl * 50 > randi() % int(ddie): killer.show_message('You resist the mummy\'s curse') return var curse = [ CURSE_SUFFERING ] if not killer.spell_book.is_empty(): curse.append(CURSE_AMNESIA) var its = [] if not killer.gear.is_empty(): # for slot in Item.slots.keys(): # if killer.gear.has(slot): # its.append(slot) if not its.empty(): curse.append(CURSE_POVERTY) var c = curse[randi() % len(curse)] match c: CURSE_AMNESIA: var sp = killer.spell_book.keys() var s = sp[randi() % len(sp)] killer.spell_book.erase(s) if killer.is_player: var spl = killer.spell_slot for i in spl.keys(): if spl[i].id == s: spl.erase(i) killer.emit_signal('update_spell_buttons') else: var spl = killer.spell_chance for i in spl.keys(): if i == s: spl.erase(i) killer.show_message('Forget!') CURSE_POVERTY: var i = its[randi() % len(its)] var it = killer.gear[i] var v = 'shatters' # if i == Item.ITEM_SLOT_HANDS \ # or i == Item.ITEM_SLOT_FEET: # v = 'shatter' killer.show_message('%s %s' % [it.name, v]) killer.gear.erase(i) CURSE_SUFFERING: killer.show_message('Suffer!') killer.change_strength(- level) super(killer)